@defuse-protocol/intents-sdk 0.75.0 → 0.77.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.
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.cjs +3 -2
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.js +3 -2
- package/dist/src/bridges/omni-bridge/omni-bridge.cjs +1 -1
- package/dist/src/bridges/omni-bridge/omni-bridge.js +1 -1
- package/dist/src/lib/validateAddress.cjs +2 -2
- package/dist/src/lib/validateAddress.js +2 -2
- package/package.json +3 -4
|
@@ -67,7 +67,8 @@ const CHAIN_MAPPINGS = [
|
|
|
67
67
|
[require_caip2.Chains.Abstract, _omni_bridge_core.ChainKind.Abs],
|
|
68
68
|
[require_caip2.Chains.Starknet, _omni_bridge_core.ChainKind.Strk],
|
|
69
69
|
[require_caip2.Chains.Fogo, _omni_bridge_core.ChainKind.Fogo],
|
|
70
|
-
[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]
|
|
71
72
|
];
|
|
72
73
|
function caip2ToChainKind(network) {
|
|
73
74
|
return CHAIN_MAPPINGS.find(([chain]) => chain === network)?.[1] ?? null;
|
|
@@ -99,7 +100,7 @@ async function getAccountOmniStorageBalance(nearProvider, accountId) {
|
|
|
99
100
|
})])
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
|
-
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");
|
|
103
104
|
/**
|
|
104
105
|
* Converts a token address from one chain to its equivalent on another chain.
|
|
105
106
|
* @param nearProvider Near provider used for querying the contract
|
|
@@ -65,7 +65,8 @@ const CHAIN_MAPPINGS = [
|
|
|
65
65
|
[Chains.Abstract, ChainKind.Abs],
|
|
66
66
|
[Chains.Starknet, ChainKind.Strk],
|
|
67
67
|
[Chains.Fogo, ChainKind.Fogo],
|
|
68
|
-
[Chains.Polygon, ChainKind.Pol]
|
|
68
|
+
[Chains.Polygon, ChainKind.Pol],
|
|
69
|
+
[Chains.Aptos, ChainKind.Aptos]
|
|
69
70
|
];
|
|
70
71
|
function caip2ToChainKind(network) {
|
|
71
72
|
return CHAIN_MAPPINGS.find(([chain]) => chain === network)?.[1] ?? null;
|
|
@@ -97,7 +98,7 @@ async function getAccountOmniStorageBalance(nearProvider, accountId) {
|
|
|
97
98
|
})])
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
|
-
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");
|
|
101
102
|
/**
|
|
102
103
|
* Converts a token address from one chain to its equivalent on another chain.
|
|
103
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",
|
|
@@ -5,7 +5,6 @@ let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils")
|
|
|
5
5
|
let viem = require("viem");
|
|
6
6
|
let _noble_hashes_sha2 = require("@noble/hashes/sha2");
|
|
7
7
|
let _scure_base = require("@scure/base");
|
|
8
|
-
let _solana_web3_js = require("@solana/web3.js");
|
|
9
8
|
let ripple_address_codec = require("ripple-address-codec");
|
|
10
9
|
|
|
11
10
|
//#region src/lib/validateAddress.ts
|
|
@@ -180,7 +179,8 @@ function verifyBchChecksum(address) {
|
|
|
180
179
|
}
|
|
181
180
|
function validateSolAddress(address) {
|
|
182
181
|
try {
|
|
183
|
-
|
|
182
|
+
if (_scure_base.base58.decode(address).length !== 32) return false;
|
|
183
|
+
return true;
|
|
184
184
|
} catch {
|
|
185
185
|
return false;
|
|
186
186
|
}
|
|
@@ -4,7 +4,6 @@ import { utils } from "@defuse-protocol/internal-utils";
|
|
|
4
4
|
import { isAddress } from "viem";
|
|
5
5
|
import { sha256 } from "@noble/hashes/sha2";
|
|
6
6
|
import { base58, bech32, bech32m, hex } from "@scure/base";
|
|
7
|
-
import { PublicKey } from "@solana/web3.js";
|
|
8
7
|
import { isValidClassicAddress, isValidXAddress } from "ripple-address-codec";
|
|
9
8
|
|
|
10
9
|
//#region src/lib/validateAddress.ts
|
|
@@ -179,7 +178,8 @@ function verifyBchChecksum(address) {
|
|
|
179
178
|
}
|
|
180
179
|
function validateSolAddress(address) {
|
|
181
180
|
try {
|
|
182
|
-
|
|
181
|
+
if (base58.decode(address).length !== 32) return false;
|
|
182
|
+
return true;
|
|
183
183
|
} catch {
|
|
184
184
|
return false;
|
|
185
185
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defuse-protocol/intents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -38,11 +38,10 @@
|
|
|
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.
|
|
42
|
-
"@omni-bridge/near": "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
|
-
"@solana/web3.js": "^1.0.0",
|
|
46
45
|
"borsher": "^4.0.0",
|
|
47
46
|
"lru-cache": "^11",
|
|
48
47
|
"near-api-js": "^4.0.0 || ^5.0.0",
|