@defuse-protocol/intents-sdk 0.17.0 → 0.17.1
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/index.cjs +10 -8
- package/dist/index.js +7 -5
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -72,7 +72,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
72
72
|
|
|
73
73
|
// src/sdk.ts
|
|
74
74
|
var import_internal_utils19 = require("@defuse-protocol/internal-utils");
|
|
75
|
-
var
|
|
75
|
+
var import_omni_sdk4 = __toESM(require("@hot-labs/omni-sdk"), 1);
|
|
76
76
|
var import_viem2 = require("viem");
|
|
77
77
|
|
|
78
78
|
// src/bridges/aurora-engine-bridge/aurora-engine-bridge.ts
|
|
@@ -616,6 +616,7 @@ var DirectBridge = class {
|
|
|
616
616
|
// src/bridges/hot-bridge/hot-bridge.ts
|
|
617
617
|
var import_internal_utils12 = require("@defuse-protocol/internal-utils");
|
|
618
618
|
var import_omni_sdk2 = require("@hot-labs/omni-sdk");
|
|
619
|
+
var import_omni_sdk3 = require("@hot-labs/omni-sdk");
|
|
619
620
|
var import_attempt = require("@lifeomic/attempt");
|
|
620
621
|
|
|
621
622
|
// src/bridges/hot-bridge/error.ts
|
|
@@ -743,7 +744,7 @@ var HotBridge = class {
|
|
|
743
744
|
}
|
|
744
745
|
parseAssetId(assetId) {
|
|
745
746
|
const parsed = parseDefuseAssetId(assetId);
|
|
746
|
-
const contractIdSatisfies = parsed.contractId === import_omni_sdk2.
|
|
747
|
+
const contractIdSatisfies = parsed.contractId === import_omni_sdk2.OMNI_HOT_V2;
|
|
747
748
|
if (!contractIdSatisfies) {
|
|
748
749
|
return null;
|
|
749
750
|
}
|
|
@@ -753,7 +754,7 @@ var HotBridge = class {
|
|
|
753
754
|
'Should start with "nep245:".'
|
|
754
755
|
);
|
|
755
756
|
}
|
|
756
|
-
const [chainId, address] =
|
|
757
|
+
const [chainId, address] = import_omni_sdk3.utils.fromOmni(parsed.tokenId).split(":");
|
|
757
758
|
if (chainId == null || address == null) {
|
|
758
759
|
throw new UnsupportedAssetIdError(
|
|
759
760
|
assetId,
|
|
@@ -853,10 +854,11 @@ var HotBridge = class {
|
|
|
853
854
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
854
855
|
(0, import_internal_utils12.assert)(assetInfo != null, "Asset is not supported");
|
|
855
856
|
hotBlockchainInvariant(assetInfo.blockchain);
|
|
856
|
-
const { gasPrice: feeAmount } = await this.hotSdk.getGaslessWithdrawFee(
|
|
857
|
-
toHotNetworkId(assetInfo.blockchain),
|
|
858
|
-
|
|
859
|
-
|
|
857
|
+
const { gasPrice: feeAmount } = await this.hotSdk.getGaslessWithdrawFee({
|
|
858
|
+
chain: toHotNetworkId(assetInfo.blockchain),
|
|
859
|
+
token: "native" in assetInfo ? "native" : assetInfo.address,
|
|
860
|
+
receiver: args.withdrawalParams.destinationAddress
|
|
861
|
+
});
|
|
860
862
|
const feeAssetId = getFeeAssetIdForChain(assetInfo.blockchain);
|
|
861
863
|
const feeQuote = args.withdrawalParams.assetId === feeAssetId || feeAmount === 0n ? null : await getFeeQuote({
|
|
862
864
|
feeAmount,
|
|
@@ -1807,7 +1809,7 @@ var IntentsSDK = class {
|
|
|
1807
1809
|
new PoaBridge({ env: this.env }),
|
|
1808
1810
|
new HotBridge({
|
|
1809
1811
|
env: this.env,
|
|
1810
|
-
hotSdk: new
|
|
1812
|
+
hotSdk: new import_omni_sdk4.default.HotBridge({
|
|
1811
1813
|
logger: console,
|
|
1812
1814
|
evmRpc: evmRpcUrls,
|
|
1813
1815
|
// 1. HotBridge from omni-sdk does not support FailoverProvider.
|
package/dist/index.js
CHANGED
|
@@ -567,6 +567,7 @@ import {
|
|
|
567
567
|
assert as assert7,
|
|
568
568
|
RETRY_CONFIGS
|
|
569
569
|
} from "@defuse-protocol/internal-utils";
|
|
570
|
+
import { OMNI_HOT_V2 } from "@hot-labs/omni-sdk";
|
|
570
571
|
import { utils as utils6 } from "@hot-labs/omni-sdk";
|
|
571
572
|
import { retry } from "@lifeomic/attempt";
|
|
572
573
|
|
|
@@ -695,7 +696,7 @@ var HotBridge = class {
|
|
|
695
696
|
}
|
|
696
697
|
parseAssetId(assetId) {
|
|
697
698
|
const parsed = parseDefuseAssetId(assetId);
|
|
698
|
-
const contractIdSatisfies = parsed.contractId ===
|
|
699
|
+
const contractIdSatisfies = parsed.contractId === OMNI_HOT_V2;
|
|
699
700
|
if (!contractIdSatisfies) {
|
|
700
701
|
return null;
|
|
701
702
|
}
|
|
@@ -805,10 +806,11 @@ var HotBridge = class {
|
|
|
805
806
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
806
807
|
assert7(assetInfo != null, "Asset is not supported");
|
|
807
808
|
hotBlockchainInvariant(assetInfo.blockchain);
|
|
808
|
-
const { gasPrice: feeAmount } = await this.hotSdk.getGaslessWithdrawFee(
|
|
809
|
-
toHotNetworkId(assetInfo.blockchain),
|
|
810
|
-
|
|
811
|
-
|
|
809
|
+
const { gasPrice: feeAmount } = await this.hotSdk.getGaslessWithdrawFee({
|
|
810
|
+
chain: toHotNetworkId(assetInfo.blockchain),
|
|
811
|
+
token: "native" in assetInfo ? "native" : assetInfo.address,
|
|
812
|
+
receiver: args.withdrawalParams.destinationAddress
|
|
813
|
+
});
|
|
812
814
|
const feeAssetId = getFeeAssetIdForChain(assetInfo.blockchain);
|
|
813
815
|
const feeQuote = args.withdrawalParams.assetId === feeAssetId || feeAmount === 0n ? null : await getFeeQuote({
|
|
814
816
|
feeAmount,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defuse-protocol/intents-sdk",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"typescript": "^5"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@hot-labs/omni-sdk": "2.
|
|
25
|
+
"@hot-labs/omni-sdk": "2.19.4",
|
|
26
26
|
"@isaacs/ttlcache": "^1.0.0",
|
|
27
27
|
"@lifeomic/attempt": "^3.0.0",
|
|
28
28
|
"@scure/base": "^1.0.0",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@near-js/client": "^2.0.1",
|
|
34
34
|
"@near-js/accounts": "^2.0.1",
|
|
35
35
|
"@near-js/keystores": "^2.0.1",
|
|
36
|
-
"@defuse-protocol/
|
|
37
|
-
"@defuse-protocol/
|
|
36
|
+
"@defuse-protocol/contract-types": "0.0.3",
|
|
37
|
+
"@defuse-protocol/internal-utils": "0.8.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"tsup": "^8.5.0",
|