@defuse-protocol/intents-sdk 0.62.0 → 0.62.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,7 +64,7 @@ var HotBridge = class HotBridge {
64
64
  }
65
65
  parseAssetId(assetId) {
66
66
  const parsed = require_parse_defuse_asset_id.parseDefuseAssetId(assetId);
67
- if (!(parsed.contractId === _hot_labs_omni_sdk.OMNI_HOT_V2)) return null;
67
+ if (!(parsed.contractId === _hot_labs_omni_sdk.GlobalSettings.omniHotContract)) return null;
68
68
  if (parsed.standard !== "nep245") throw new require_errors.UnsupportedAssetIdError(assetId, "Should start with \"nep245:\".");
69
69
  const [chainId, address] = _hot_labs_omni_sdk.utils.fromOmni(parsed.tokenId).split(":");
70
70
  if (chainId == null || address == null) throw new require_errors.UnsupportedAssetIdError(assetId, "Asset has invalid token id format.");
@@ -138,7 +138,7 @@ var HotBridge = class HotBridge {
138
138
  token: "native" in assetInfo ? "native" : assetInfo.address,
139
139
  receiver: args.withdrawalParams.destinationAddress
140
140
  });
141
- if (assetInfo.blockchain === require_caip2.Chains.Plasma && args.withdrawalParams.assetId !== feeAssetId) result.gasPrice *= 20n;
141
+ if (assetInfo.blockchain === require_caip2.Chains.Plasma && args.withdrawalParams.assetId !== feeAssetId) result.gasPrice *= 100n;
142
142
  return result;
143
143
  }, {
144
144
  errorInstance: new require_error.HotWithdrawalApiFeeRequestTimeoutError(),
@@ -10,7 +10,7 @@ import { HotWithdrawStatus, MIN_GAS_AMOUNT } from "./hot-bridge-constants.js";
10
10
  import { formatTxHash, getFeeAssetIdForChain, hotBlockchainInvariant, hotNetworkIdToCAIP2, toHotNetworkId } from "./hot-bridge-utils.js";
11
11
  import isHex from "../../lib/hex.js";
12
12
  import { assert, bridgeIndexer, withTimeout } from "@defuse-protocol/internal-utils";
13
- import { OMNI_HOT_V2, utils as utils$1 } from "@hot-labs/omni-sdk";
13
+ import { GlobalSettings, utils as utils$1 } from "@hot-labs/omni-sdk";
14
14
  import { LRUCache } from "lru-cache";
15
15
  import * as v from "valibot";
16
16
 
@@ -62,7 +62,7 @@ var HotBridge$1 = class HotBridge$1 {
62
62
  }
63
63
  parseAssetId(assetId) {
64
64
  const parsed = parseDefuseAssetId(assetId);
65
- if (!(parsed.contractId === OMNI_HOT_V2)) return null;
65
+ if (!(parsed.contractId === GlobalSettings.omniHotContract)) return null;
66
66
  if (parsed.standard !== "nep245") throw new UnsupportedAssetIdError(assetId, "Should start with \"nep245:\".");
67
67
  const [chainId, address] = utils$1.fromOmni(parsed.tokenId).split(":");
68
68
  if (chainId == null || address == null) throw new UnsupportedAssetIdError(assetId, "Asset has invalid token id format.");
@@ -136,7 +136,7 @@ var HotBridge$1 = class HotBridge$1 {
136
136
  token: "native" in assetInfo ? "native" : assetInfo.address,
137
137
  receiver: args.withdrawalParams.destinationAddress
138
138
  });
139
- if (assetInfo.blockchain === Chains.Plasma && args.withdrawalParams.assetId !== feeAssetId) result.gasPrice *= 20n;
139
+ if (assetInfo.blockchain === Chains.Plasma && args.withdrawalParams.assetId !== feeAssetId) result.gasPrice *= 100n;
140
140
  return result;
141
141
  }, {
142
142
  errorInstance: new HotWithdrawalApiFeeRequestTimeoutError(),
@@ -1,6 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_errors = require('../../classes/errors.cjs');
3
3
  const require_route_enum = require('../../constants/route-enum.cjs');
4
+ const require_caip2 = require('../../lib/caip2.cjs');
4
5
  const require_estimate_fee = require('../../lib/estimate-fee.cjs');
5
6
  const require_parse_defuse_asset_id = require('../../lib/parse-defuse-asset-id.cjs');
6
7
  const require_validateAddress = require('../../lib/validateAddress.cjs');
@@ -139,9 +140,11 @@ var OmniBridge = class {
139
140
  (0, _defuse_protocol_internal_utils.assert)(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
140
141
  amount += utxoMaxGasFee + utxoProtocolFee;
141
142
  }
143
+ let destinationAddress = args.withdrawalParams.destinationAddress;
144
+ if (assetInfo.blockchain === require_caip2.Chains.Bitcoin && /^bc1/i.test(destinationAddress)) destinationAddress = destinationAddress.toLowerCase();
142
145
  intents.push(...require_omni_bridge_utils.createWithdrawIntentsPrimitive({
143
146
  assetId: args.withdrawalParams.assetId,
144
- destinationAddress: args.withdrawalParams.destinationAddress,
147
+ destinationAddress,
145
148
  amount,
146
149
  omniChainKind,
147
150
  intentsContract: this.envConfig.contractID,
@@ -1,5 +1,6 @@
1
1
  import { InvalidDestinationAddressForWithdrawalError, MinWithdrawalAmountError, UnsupportedAssetIdError } from "../../classes/errors.js";
2
2
  import { RouteEnum } from "../../constants/route-enum.js";
3
+ import { Chains } from "../../lib/caip2.js";
3
4
  import { getFeeQuote, getUnderlyingFee } from "../../lib/estimate-fee.js";
4
5
  import { parseDefuseAssetId } from "../../lib/parse-defuse-asset-id.js";
5
6
  import { validateAddress } from "../../lib/validateAddress.js";
@@ -137,9 +138,11 @@ var OmniBridge = class {
137
138
  assert(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
138
139
  amount += utxoMaxGasFee + utxoProtocolFee;
139
140
  }
141
+ let destinationAddress = args.withdrawalParams.destinationAddress;
142
+ if (assetInfo.blockchain === Chains.Bitcoin && /^bc1/i.test(destinationAddress)) destinationAddress = destinationAddress.toLowerCase();
140
143
  intents.push(...createWithdrawIntentsPrimitive({
141
144
  assetId: args.withdrawalParams.assetId,
142
- destinationAddress: args.withdrawalParams.destinationAddress,
145
+ destinationAddress,
143
146
  amount,
144
147
  omniChainKind,
145
148
  intentsContract: this.envConfig.contractID,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defuse-protocol/intents-sdk",
3
- "version": "0.62.0",
3
+ "version": "0.62.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "typescript": "^5"
32
32
  },
33
33
  "dependencies": {
34
- "@hot-labs/omni-sdk": "2.24.8",
34
+ "@hot-labs/omni-sdk": "2.25.5",
35
35
  "@isaacs/ttlcache": "^1.0.0",
36
36
  "@lifeomic/attempt": "^3.0.0",
37
37
  "@omni-bridge/core": "0.6.1",