@defuse-protocol/intents-sdk 0.74.1 → 0.76.0

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.
@@ -17,7 +17,8 @@ function createWithdrawIntentsPrimitive(params) {
17
17
  const ftWithdrawPayload = {
18
18
  recipient,
19
19
  fee: "0",
20
- native_token_fee: params.nativeFee.toString()
20
+ native_token_fee: params.nativeFee.toString(),
21
+ external_id: crypto.randomUUID()
21
22
  };
22
23
  if (isUtxoChain(params.omniChainKind)) {
23
24
  (0, _defuse_protocol_internal_utils.assert)(params.utxoMaxGasFee !== null && params.utxoMaxGasFee > 0n, `Invalid utxo max gas fee: expected > 0, got ${params.utxoMaxGasFee}`);
@@ -36,7 +37,7 @@ function createWithdrawIntentsPrimitive(params) {
36
37
  },
37
38
  sender: `near:${params.intentsContract}`,
38
39
  msg
39
- }),
40
+ }, ftWithdrawPayload.external_id),
40
41
  amount: params.nativeFee.toString(),
41
42
  contract_id: require_omni_bridge_constants.OMNI_BRIDGE_CONTRACT,
42
43
  intent: "storage_deposit"
@@ -66,7 +67,8 @@ const CHAIN_MAPPINGS = [
66
67
  [require_caip2.Chains.Abstract, _omni_bridge_core.ChainKind.Abs],
67
68
  [require_caip2.Chains.Starknet, _omni_bridge_core.ChainKind.Strk],
68
69
  [require_caip2.Chains.Fogo, _omni_bridge_core.ChainKind.Fogo],
69
- [require_caip2.Chains.Polygon, _omni_bridge_core.ChainKind.Pol]
70
+ [require_caip2.Chains.Polygon, _omni_bridge_core.ChainKind.Pol],
71
+ [require_caip2.Chains.Aptos, _omni_bridge_core.ChainKind.Aptos]
70
72
  ];
71
73
  function caip2ToChainKind(network) {
72
74
  return CHAIN_MAPPINGS.find(([chain]) => chain === network)?.[1] ?? null;
@@ -98,7 +100,7 @@ async function getAccountOmniStorageBalance(nearProvider, accountId) {
98
100
  })])
99
101
  });
100
102
  }
101
- const OmniAddressSchema = valibot.custom((input) => typeof input === "string" && (input.startsWith("eth:") || input.startsWith("near:") || input.startsWith("sol:") || input.startsWith("arb:") || input.startsWith("base:") || input.startsWith("btc:") || input.startsWith("bnb:") || input.startsWith("abs:") || input.startsWith("strk:") || input.startsWith("fogo:") || input.startsWith("pol:")), "Must comply with omni address schema");
103
+ const OmniAddressSchema = valibot.custom((input) => typeof input === "string" && (input.startsWith("eth:") || input.startsWith("near:") || input.startsWith("sol:") || input.startsWith("arb:") || input.startsWith("base:") || input.startsWith("btc:") || input.startsWith("bnb:") || input.startsWith("abs:") || input.startsWith("strk:") || input.startsWith("fogo:") || input.startsWith("pol:") || input.startsWith("aptos:")), "Must comply with omni address schema");
102
104
  /**
103
105
  * Converts a token address from one chain to its equivalent on another chain.
104
106
  * @param nearProvider Near provider used for querying the contract
@@ -15,7 +15,8 @@ function createWithdrawIntentsPrimitive(params) {
15
15
  const ftWithdrawPayload = {
16
16
  recipient,
17
17
  fee: "0",
18
- native_token_fee: params.nativeFee.toString()
18
+ native_token_fee: params.nativeFee.toString(),
19
+ external_id: crypto.randomUUID()
19
20
  };
20
21
  if (isUtxoChain(params.omniChainKind)) {
21
22
  assert(params.utxoMaxGasFee !== null && params.utxoMaxGasFee > 0n, `Invalid utxo max gas fee: expected > 0, got ${params.utxoMaxGasFee}`);
@@ -34,7 +35,7 @@ function createWithdrawIntentsPrimitive(params) {
34
35
  },
35
36
  sender: `near:${params.intentsContract}`,
36
37
  msg
37
- }),
38
+ }, ftWithdrawPayload.external_id),
38
39
  amount: params.nativeFee.toString(),
39
40
  contract_id: OMNI_BRIDGE_CONTRACT,
40
41
  intent: "storage_deposit"
@@ -64,7 +65,8 @@ const CHAIN_MAPPINGS = [
64
65
  [Chains.Abstract, ChainKind.Abs],
65
66
  [Chains.Starknet, ChainKind.Strk],
66
67
  [Chains.Fogo, ChainKind.Fogo],
67
- [Chains.Polygon, ChainKind.Pol]
68
+ [Chains.Polygon, ChainKind.Pol],
69
+ [Chains.Aptos, ChainKind.Aptos]
68
70
  ];
69
71
  function caip2ToChainKind(network) {
70
72
  return CHAIN_MAPPINGS.find(([chain]) => chain === network)?.[1] ?? null;
@@ -96,7 +98,7 @@ async function getAccountOmniStorageBalance(nearProvider, accountId) {
96
98
  })])
97
99
  });
98
100
  }
99
- const OmniAddressSchema = v.custom((input) => typeof input === "string" && (input.startsWith("eth:") || input.startsWith("near:") || input.startsWith("sol:") || input.startsWith("arb:") || input.startsWith("base:") || input.startsWith("btc:") || input.startsWith("bnb:") || input.startsWith("abs:") || input.startsWith("strk:") || input.startsWith("fogo:") || input.startsWith("pol:")), "Must comply with omni address schema");
101
+ const OmniAddressSchema = v.custom((input) => typeof input === "string" && (input.startsWith("eth:") || input.startsWith("near:") || input.startsWith("sol:") || input.startsWith("arb:") || input.startsWith("base:") || input.startsWith("btc:") || input.startsWith("bnb:") || input.startsWith("abs:") || input.startsWith("strk:") || input.startsWith("fogo:") || input.startsWith("pol:") || input.startsWith("aptos:")), "Must comply with omni address schema");
100
102
  /**
101
103
  * Converts a token address from one chain to its equivalent on another chain.
102
104
  * @param nearProvider Near provider used for querying the contract
@@ -266,7 +266,7 @@ var OmniBridge = class {
266
266
  if (transfer == null || transfer.recipient == null) return { status: "pending" };
267
267
  const destinationChain = (0, _omni_bridge_core.getChain)(transfer.recipient);
268
268
  let txHash = null;
269
- if ((0, _omni_bridge_core.isEvmChain)(destinationChain) || destinationChain === _omni_bridge_core.ChainKind.Sol || destinationChain === _omni_bridge_core.ChainKind.Fogo || destinationChain === _omni_bridge_core.ChainKind.Strk) txHash = transfer.finalised?.transaction_hash;
269
+ if ((0, _omni_bridge_core.isEvmChain)(destinationChain) || destinationChain === _omni_bridge_core.ChainKind.Sol || destinationChain === _omni_bridge_core.ChainKind.Fogo || destinationChain === _omni_bridge_core.ChainKind.Strk || destinationChain === _omni_bridge_core.ChainKind.Aptos) txHash = transfer.finalised?.transaction_hash;
270
270
  else if (require_omni_bridge_utils.isUtxoChain(destinationChain)) txHash = typeof window !== "undefined" ? transfer.utxo_meta?.pending_sign_id : transfer.finalised?.transaction_hash;
271
271
  else return {
272
272
  status: "completed",
@@ -264,7 +264,7 @@ var OmniBridge = class {
264
264
  if (transfer == null || transfer.recipient == null) return { status: "pending" };
265
265
  const destinationChain = getChain(transfer.recipient);
266
266
  let txHash = null;
267
- if (isEvmChain(destinationChain) || destinationChain === ChainKind.Sol || destinationChain === ChainKind.Fogo || destinationChain === ChainKind.Strk) txHash = transfer.finalised?.transaction_hash;
267
+ if (isEvmChain(destinationChain) || destinationChain === ChainKind.Sol || destinationChain === ChainKind.Fogo || destinationChain === ChainKind.Strk || destinationChain === ChainKind.Aptos) txHash = transfer.finalised?.transaction_hash;
268
268
  else if (isUtxoChain(destinationChain)) txHash = typeof window !== "undefined" ? transfer.utxo_meta?.pending_sign_id : transfer.finalised?.transaction_hash;
269
269
  else return {
270
270
  status: "completed",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defuse-protocol/intents-sdk",
3
- "version": "0.74.1",
3
+ "version": "0.76.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "@hot-labs/omni-sdk": "2.25.5",
39
39
  "@isaacs/ttlcache": "^1.0.0",
40
40
  "@lifeomic/attempt": "^3.0.0",
41
- "@omni-bridge/core": "0.14.0",
42
- "@omni-bridge/near": "0.14.0",
41
+ "@omni-bridge/core": "0.16.0",
42
+ "@omni-bridge/near": "0.16.0",
43
43
  "@noble/hashes": "^1.7.1",
44
44
  "@scure/base": "^1.0.0",
45
45
  "@solana/web3.js": "^1.0.0",