@defuse-protocol/intents-sdk 0.43.1 → 0.43.3
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/aurora-engine-bridge/aurora-engine-bridge-constants.cjs +4 -0
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-constants.js +3 -1
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.cjs +5 -2
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.js +5 -2
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.cjs +1 -1
- package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.js +1 -1
- package/dist/src/bridges/direct-bridge/direct-bridge-constants.cjs +2 -0
- package/dist/src/bridges/direct-bridge/direct-bridge-constants.js +2 -1
- package/dist/src/bridges/direct-bridge/direct-bridge-utils.cjs +3 -1
- package/dist/src/bridges/direct-bridge/direct-bridge-utils.js +4 -2
- package/dist/src/bridges/direct-bridge/direct-bridge.cjs +2 -1
- package/dist/src/bridges/direct-bridge/direct-bridge.js +2 -1
- package/dist/src/bridges/hot-bridge/hot-bridge-constants.cjs +3 -1
- package/dist/src/bridges/hot-bridge/hot-bridge-constants.js +2 -1
- package/dist/src/bridges/hot-bridge/hot-bridge.cjs +3 -1
- package/dist/src/bridges/hot-bridge/hot-bridge.js +4 -2
- package/dist/src/bridges/omni-bridge/omni-bridge-constants.cjs +2 -0
- package/dist/src/bridges/omni-bridge/omni-bridge-constants.js +2 -1
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.cjs +2 -1
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.js +3 -2
- package/dist/src/bridges/poa-bridge/poa-bridge-utils.cjs +3 -1
- package/dist/src/bridges/poa-bridge/poa-bridge-utils.js +3 -1
- package/dist/src/bridges/poa-bridge/poa-bridge.cjs +1 -1
- package/dist/src/bridges/poa-bridge/poa-bridge.js +1 -1
- package/dist/src/bridges/poa-bridge/poa-constants.cjs +6 -0
- package/dist/src/bridges/poa-bridge/poa-constants.js +5 -0
- package/dist/src/sdk.cjs +6 -7
- package/dist/src/sdk.js +6 -7
- package/dist/src/shared-types.d.cts +2 -0
- package/dist/src/shared-types.d.ts +2 -0
- package/package.json +3 -3
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/bridges/aurora-engine-bridge/aurora-engine-bridge-constants.ts
|
|
3
3
|
const NEAR_NATIVE_ASSET_ID = "nep141:wrap.near";
|
|
4
|
+
const MIN_GAS_AMOUNT = "38500000000000";
|
|
5
|
+
const MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS = "100000000000000";
|
|
4
6
|
|
|
5
7
|
//#endregion
|
|
8
|
+
exports.MIN_GAS_AMOUNT = MIN_GAS_AMOUNT;
|
|
9
|
+
exports.MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS = MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS;
|
|
6
10
|
exports.NEAR_NATIVE_ASSET_ID = NEAR_NATIVE_ASSET_ID;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
//#region src/bridges/aurora-engine-bridge/aurora-engine-bridge-constants.ts
|
|
2
2
|
const NEAR_NATIVE_ASSET_ID = "nep141:wrap.near";
|
|
3
|
+
const MIN_GAS_AMOUNT = "38500000000000";
|
|
4
|
+
const MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS = "100000000000000";
|
|
3
5
|
|
|
4
6
|
//#endregion
|
|
5
|
-
export { NEAR_NATIVE_ASSET_ID };
|
|
7
|
+
export { MIN_GAS_AMOUNT, MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS, NEAR_NATIVE_ASSET_ID };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_route_enum = require('../../constants/route-enum.cjs');
|
|
3
|
+
const require_aurora_engine_bridge_constants = require('./aurora-engine-bridge-constants.cjs');
|
|
3
4
|
let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
|
|
4
5
|
let viem = require("viem");
|
|
5
6
|
|
|
@@ -13,7 +14,8 @@ function createWithdrawIntentPrimitive(params) {
|
|
|
13
14
|
receiver_id: params.auroraEngineContractId,
|
|
14
15
|
amount: params.amount.toString(),
|
|
15
16
|
msg: makeAuroraEngineDepositMsg(params.destinationAddress),
|
|
16
|
-
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0
|
|
17
|
+
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
18
|
+
min_gas: require_aurora_engine_bridge_constants.MIN_GAS_AMOUNT
|
|
17
19
|
};
|
|
18
20
|
return {
|
|
19
21
|
intent: "ft_withdraw",
|
|
@@ -21,7 +23,8 @@ function createWithdrawIntentPrimitive(params) {
|
|
|
21
23
|
receiver_id: params.proxyTokenContractId,
|
|
22
24
|
amount: params.amount.toString(),
|
|
23
25
|
msg: `${params.auroraEngineContractId}:${makeAuroraEngineDepositMsg(params.destinationAddress)}`,
|
|
24
|
-
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0
|
|
26
|
+
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
27
|
+
min_gas: require_aurora_engine_bridge_constants.MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RouteEnum } from "../../constants/route-enum.js";
|
|
2
|
+
import { MIN_GAS_AMOUNT, MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS } from "./aurora-engine-bridge-constants.js";
|
|
2
3
|
import { assert, utils } from "@defuse-protocol/internal-utils";
|
|
3
4
|
import { getAddress } from "viem";
|
|
4
5
|
|
|
@@ -12,7 +13,8 @@ function createWithdrawIntentPrimitive(params) {
|
|
|
12
13
|
receiver_id: params.auroraEngineContractId,
|
|
13
14
|
amount: params.amount.toString(),
|
|
14
15
|
msg: makeAuroraEngineDepositMsg(params.destinationAddress),
|
|
15
|
-
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0
|
|
16
|
+
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
17
|
+
min_gas: MIN_GAS_AMOUNT
|
|
16
18
|
};
|
|
17
19
|
return {
|
|
18
20
|
intent: "ft_withdraw",
|
|
@@ -20,7 +22,8 @@ function createWithdrawIntentPrimitive(params) {
|
|
|
20
22
|
receiver_id: params.proxyTokenContractId,
|
|
21
23
|
amount: params.amount.toString(),
|
|
22
24
|
msg: `${params.auroraEngineContractId}:${makeAuroraEngineDepositMsg(params.destinationAddress)}`,
|
|
23
|
-
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0
|
|
25
|
+
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
26
|
+
min_gas: MIN_GAS_AMOUNT_NON_STANDARD_DECIMALS
|
|
24
27
|
};
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
@@ -90,7 +90,7 @@ var AuroraEngineBridge = class {
|
|
|
90
90
|
underlyingFees: { [require_route_enum.RouteEnum.VirtualChain]: { storageDepositFee: feeAmount } }
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
async waitForWithdrawalCompletion(
|
|
93
|
+
async waitForWithdrawalCompletion() {
|
|
94
94
|
return { hash: null };
|
|
95
95
|
}
|
|
96
96
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/bridges/direct-bridge/direct-bridge-constants.ts
|
|
3
3
|
const NEAR_NATIVE_ASSET_ID = "nep141:wrap.near";
|
|
4
|
+
const MIN_GAS_AMOUNT = "17050000000000";
|
|
4
5
|
|
|
5
6
|
//#endregion
|
|
7
|
+
exports.MIN_GAS_AMOUNT = MIN_GAS_AMOUNT;
|
|
6
8
|
exports.NEAR_NATIVE_ASSET_ID = NEAR_NATIVE_ASSET_ID;
|
|
@@ -13,13 +13,15 @@ function createWithdrawIntentPrimitive(params) {
|
|
|
13
13
|
};
|
|
14
14
|
const { contractId: tokenAccountId, standard } = __defuse_protocol_internal_utils.utils.parseDefuseAssetId(params.assetId);
|
|
15
15
|
(0, __defuse_protocol_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
|
|
16
|
+
if (params.msg !== void 0) params.logger?.warn("min_gas is not set for direct-bridge withdrawal with msg, gas consumption is unpredictable");
|
|
16
17
|
return {
|
|
17
18
|
intent: "ft_withdraw",
|
|
18
19
|
token: tokenAccountId,
|
|
19
20
|
receiver_id: params.destinationAddress,
|
|
20
21
|
amount: params.amount.toString(),
|
|
21
22
|
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
22
|
-
msg: params.msg
|
|
23
|
+
msg: params.msg,
|
|
24
|
+
min_gas: params.msg == null ? require_direct_bridge_constants.MIN_GAS_AMOUNT : void 0
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
function withdrawalParamsInvariant(params) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RouteEnum } from "../../constants/route-enum.js";
|
|
2
|
-
import { NEAR_NATIVE_ASSET_ID } from "./direct-bridge-constants.js";
|
|
2
|
+
import { MIN_GAS_AMOUNT, NEAR_NATIVE_ASSET_ID } from "./direct-bridge-constants.js";
|
|
3
3
|
import { assert, unwrapNearFailoverRpcProvider, utils } from "@defuse-protocol/internal-utils";
|
|
4
4
|
import { providers } from "near-api-js";
|
|
5
5
|
|
|
@@ -12,13 +12,15 @@ function createWithdrawIntentPrimitive(params) {
|
|
|
12
12
|
};
|
|
13
13
|
const { contractId: tokenAccountId, standard } = utils.parseDefuseAssetId(params.assetId);
|
|
14
14
|
assert(standard === "nep141", "Only NEP-141 is supported");
|
|
15
|
+
if (params.msg !== void 0) params.logger?.warn("min_gas is not set for direct-bridge withdrawal with msg, gas consumption is unpredictable");
|
|
15
16
|
return {
|
|
16
17
|
intent: "ft_withdraw",
|
|
17
18
|
token: tokenAccountId,
|
|
18
19
|
receiver_id: params.destinationAddress,
|
|
19
20
|
amount: params.amount.toString(),
|
|
20
21
|
storage_deposit: params.storageDeposit > 0n ? params.storageDeposit.toString() : void 0,
|
|
21
|
-
msg: params.msg
|
|
22
|
+
msg: params.msg,
|
|
23
|
+
min_gas: params.msg == null ? MIN_GAS_AMOUNT : void 0
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
function withdrawalParamsInvariant(params) {
|
|
@@ -61,7 +61,8 @@ var DirectBridge = class {
|
|
|
61
61
|
destinationAddress: args.withdrawalParams.destinationAddress,
|
|
62
62
|
amount: args.withdrawalParams.amount,
|
|
63
63
|
storageDeposit: require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.NearWithdrawal, "storageDepositFee"),
|
|
64
|
-
msg: args.withdrawalParams.routeConfig?.msg
|
|
64
|
+
msg: args.withdrawalParams.routeConfig?.msg,
|
|
65
|
+
logger: args.logger
|
|
65
66
|
});
|
|
66
67
|
intents.push(intent);
|
|
67
68
|
return Promise.resolve(intents);
|
|
@@ -60,7 +60,8 @@ var DirectBridge = class {
|
|
|
60
60
|
destinationAddress: args.withdrawalParams.destinationAddress,
|
|
61
61
|
amount: args.withdrawalParams.amount,
|
|
62
62
|
storageDeposit: getUnderlyingFee(args.feeEstimation, RouteEnum.NearWithdrawal, "storageDepositFee"),
|
|
63
|
-
msg: args.withdrawalParams.routeConfig?.msg
|
|
63
|
+
msg: args.withdrawalParams.routeConfig?.msg,
|
|
64
|
+
logger: args.logger
|
|
64
65
|
});
|
|
65
66
|
intents.push(intent);
|
|
66
67
|
return Promise.resolve(intents);
|
|
@@ -4,6 +4,8 @@ const HotWithdrawStatus = {
|
|
|
4
4
|
Completed: "COMPLETED",
|
|
5
5
|
Canceled: "CANCELED"
|
|
6
6
|
};
|
|
7
|
+
const MIN_GAS_AMOUNT = "91300000000000";
|
|
7
8
|
|
|
8
9
|
//#endregion
|
|
9
|
-
exports.HotWithdrawStatus = HotWithdrawStatus;
|
|
10
|
+
exports.HotWithdrawStatus = HotWithdrawStatus;
|
|
11
|
+
exports.MIN_GAS_AMOUNT = MIN_GAS_AMOUNT;
|
|
@@ -75,7 +75,9 @@ var HotBridge = class {
|
|
|
75
75
|
});
|
|
76
76
|
(0, __defuse_protocol_internal_utils.assert)(intent.amounts[0] === amount.toString(), "Amount is not correct");
|
|
77
77
|
if (intent.amounts.length === 2) (0, __defuse_protocol_internal_utils.assert)(intent.amounts[1] === feeAmount.toString(), "Amount is not correct");
|
|
78
|
-
|
|
78
|
+
const mtWithdrawIntent = intent;
|
|
79
|
+
mtWithdrawIntent.min_gas = require_hot_bridge_constants.MIN_GAS_AMOUNT;
|
|
80
|
+
intents.push(mtWithdrawIntent);
|
|
79
81
|
return intents;
|
|
80
82
|
}
|
|
81
83
|
/**
|
|
@@ -6,7 +6,7 @@ import { Chains } from "../../lib/caip2.js";
|
|
|
6
6
|
import { validateAddress } from "../../lib/validateAddress.js";
|
|
7
7
|
import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
|
|
8
8
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError } from "./error.js";
|
|
9
|
-
import { HotWithdrawStatus } from "./hot-bridge-constants.js";
|
|
9
|
+
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 { RETRY_CONFIGS, assert, withTimeout } from "@defuse-protocol/internal-utils";
|
|
@@ -74,7 +74,9 @@ var HotBridge$1 = class {
|
|
|
74
74
|
});
|
|
75
75
|
assert(intent.amounts[0] === amount.toString(), "Amount is not correct");
|
|
76
76
|
if (intent.amounts.length === 2) assert(intent.amounts[1] === feeAmount.toString(), "Amount is not correct");
|
|
77
|
-
|
|
77
|
+
const mtWithdrawIntent = intent;
|
|
78
|
+
mtWithdrawIntent.min_gas = MIN_GAS_AMOUNT;
|
|
79
|
+
intents.push(mtWithdrawIntent);
|
|
78
80
|
return intents;
|
|
79
81
|
}
|
|
80
82
|
/**
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
const NEAR_NATIVE_ASSET_ID = "nep141:wrap.near";
|
|
4
4
|
const OMNI_BRIDGE_CONTRACT = "omni.bridge.near";
|
|
5
5
|
const MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR = 500000000000000000000000n;
|
|
6
|
+
const MIN_GAS_AMOUNT = "37400000000000";
|
|
6
7
|
|
|
7
8
|
//#endregion
|
|
8
9
|
exports.MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR = MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR;
|
|
10
|
+
exports.MIN_GAS_AMOUNT = MIN_GAS_AMOUNT;
|
|
9
11
|
exports.NEAR_NATIVE_ASSET_ID = NEAR_NATIVE_ASSET_ID;
|
|
10
12
|
exports.OMNI_BRIDGE_CONTRACT = OMNI_BRIDGE_CONTRACT;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const NEAR_NATIVE_ASSET_ID = "nep141:wrap.near";
|
|
3
3
|
const OMNI_BRIDGE_CONTRACT = "omni.bridge.near";
|
|
4
4
|
const MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR = 500000000000000000000000n;
|
|
5
|
+
const MIN_GAS_AMOUNT = "37400000000000";
|
|
5
6
|
|
|
6
7
|
//#endregion
|
|
7
|
-
export { MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT };
|
|
8
|
+
export { MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR, MIN_GAS_AMOUNT, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT };
|
|
@@ -45,7 +45,8 @@ function createWithdrawIntentsPrimitive(params) {
|
|
|
45
45
|
receiver_id: require_omni_bridge_constants.OMNI_BRIDGE_CONTRACT,
|
|
46
46
|
amount: params.amount.toString(),
|
|
47
47
|
storage_deposit: params.storageDepositAmount > 0n ? params.storageDepositAmount.toString() : void 0,
|
|
48
|
-
msg: JSON.stringify(ftWithdrawPayload)
|
|
48
|
+
msg: JSON.stringify(ftWithdrawPayload),
|
|
49
|
+
min_gas: require_omni_bridge_constants.MIN_GAS_AMOUNT
|
|
49
50
|
});
|
|
50
51
|
return intents;
|
|
51
52
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chains } from "../../lib/caip2.js";
|
|
2
|
-
import { OMNI_BRIDGE_CONTRACT } from "./omni-bridge-constants.js";
|
|
2
|
+
import { MIN_GAS_AMOUNT, OMNI_BRIDGE_CONTRACT } from "./omni-bridge-constants.js";
|
|
3
3
|
import { assert, utils } from "@defuse-protocol/internal-utils";
|
|
4
4
|
import { ChainKind, calculateStorageAccountId, getChain, isBridgeToken, omniAddress } from "omni-bridge-sdk";
|
|
5
5
|
import * as v from "valibot";
|
|
@@ -43,7 +43,8 @@ function createWithdrawIntentsPrimitive(params) {
|
|
|
43
43
|
receiver_id: OMNI_BRIDGE_CONTRACT,
|
|
44
44
|
amount: params.amount.toString(),
|
|
45
45
|
storage_deposit: params.storageDepositAmount > 0n ? params.storageDepositAmount.toString() : void 0,
|
|
46
|
-
msg: JSON.stringify(ftWithdrawPayload)
|
|
46
|
+
msg: JSON.stringify(ftWithdrawPayload),
|
|
47
|
+
min_gas: MIN_GAS_AMOUNT
|
|
47
48
|
});
|
|
48
49
|
return intents;
|
|
49
50
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_caip2 = require('../../lib/caip2.cjs');
|
|
3
|
+
const require_poa_constants = require('./poa-constants.cjs');
|
|
3
4
|
let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
|
|
4
5
|
|
|
5
6
|
//#region src/bridges/poa-bridge/poa-bridge-utils.ts
|
|
@@ -13,7 +14,8 @@ function createWithdrawIntentPrimitive(params) {
|
|
|
13
14
|
memo: createWithdrawMemo({
|
|
14
15
|
receiverAddress: params.destinationAddress,
|
|
15
16
|
xrpMemo: params.destinationMemo
|
|
16
|
-
})
|
|
17
|
+
}),
|
|
18
|
+
min_gas: require_poa_constants.MIN_GAS_AMOUNT
|
|
17
19
|
};
|
|
18
20
|
}
|
|
19
21
|
function createWithdrawMemo({ receiverAddress, xrpMemo }) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Chains } from "../../lib/caip2.js";
|
|
2
|
+
import { MIN_GAS_AMOUNT } from "./poa-constants.js";
|
|
2
3
|
import { utils } from "@defuse-protocol/internal-utils";
|
|
3
4
|
|
|
4
5
|
//#region src/bridges/poa-bridge/poa-bridge-utils.ts
|
|
@@ -12,7 +13,8 @@ function createWithdrawIntentPrimitive(params) {
|
|
|
12
13
|
memo: createWithdrawMemo({
|
|
13
14
|
receiverAddress: params.destinationAddress,
|
|
14
15
|
xrpMemo: params.destinationMemo
|
|
15
|
-
})
|
|
16
|
+
}),
|
|
17
|
+
min_gas: MIN_GAS_AMOUNT
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
20
|
function createWithdrawMemo({ receiverAddress, xrpMemo }) {
|
|
@@ -89,7 +89,7 @@ var PoaBridge = class {
|
|
|
89
89
|
async waitForWithdrawalCompletion(args) {
|
|
90
90
|
return { hash: (await __defuse_protocol_internal_utils.poaBridge.waitForWithdrawalCompletion({
|
|
91
91
|
txHash: args.tx.hash,
|
|
92
|
-
|
|
92
|
+
withdrawalCriteria: { assetId: args.withdrawalParams.assetId },
|
|
93
93
|
signal: args.signal ?? new AbortController().signal,
|
|
94
94
|
retryOptions: args.retryOptions,
|
|
95
95
|
baseURL: __defuse_protocol_internal_utils.configsByEnvironment[this.env].poaBridgeBaseURL,
|
|
@@ -87,7 +87,7 @@ var PoaBridge = class {
|
|
|
87
87
|
async waitForWithdrawalCompletion(args) {
|
|
88
88
|
return { hash: (await poaBridge.waitForWithdrawalCompletion({
|
|
89
89
|
txHash: args.tx.hash,
|
|
90
|
-
|
|
90
|
+
withdrawalCriteria: { assetId: args.withdrawalParams.assetId },
|
|
91
91
|
signal: args.signal ?? new AbortController().signal,
|
|
92
92
|
retryOptions: args.retryOptions,
|
|
93
93
|
baseURL: configsByEnvironment[this.env].poaBridgeBaseURL,
|
package/dist/src/sdk.cjs
CHANGED
|
@@ -208,18 +208,16 @@ var IntentsSDK = class {
|
|
|
208
208
|
throw new Error(`Cannot determine bridge for withdrawal = ${(0, viem.stringify)(args.withdrawalParams)}`);
|
|
209
209
|
}
|
|
210
210
|
getWithdrawalsIdentifiers({ withdrawalParams, intentTx }) {
|
|
211
|
-
const indexes = new Map(
|
|
212
|
-
return require_route_config.determineRouteConfig(this, w).route;
|
|
213
|
-
}), Array(withdrawalParams.length).fill(0)));
|
|
211
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
214
212
|
return withdrawalParams.map((w) => {
|
|
215
213
|
const routeConfig = require_route_config.determineRouteConfig(this, w);
|
|
216
214
|
const route = routeConfig.route;
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
indexes.set(route, index + 1);
|
|
215
|
+
const currentIndex = indexes.get(route) ?? 0;
|
|
216
|
+
indexes.set(route, currentIndex + 1);
|
|
220
217
|
return {
|
|
221
218
|
routeConfig,
|
|
222
|
-
index,
|
|
219
|
+
index: currentIndex,
|
|
220
|
+
withdrawalParams: w,
|
|
223
221
|
tx: intentTx
|
|
224
222
|
};
|
|
225
223
|
});
|
|
@@ -233,6 +231,7 @@ var IntentsSDK = class {
|
|
|
233
231
|
for (const bridge of this.bridges) if (bridge.is(wid.routeConfig)) return bridge.waitForWithdrawalCompletion({
|
|
234
232
|
tx: args.intentTx,
|
|
235
233
|
index: wid.index,
|
|
234
|
+
withdrawalParams: wid.withdrawalParams,
|
|
236
235
|
routeConfig: wid.routeConfig,
|
|
237
236
|
signal: args.signal,
|
|
238
237
|
retryOptions: args.retryOptions,
|
package/dist/src/sdk.js
CHANGED
|
@@ -206,18 +206,16 @@ var IntentsSDK = class {
|
|
|
206
206
|
throw new Error(`Cannot determine bridge for withdrawal = ${stringify(args.withdrawalParams)}`);
|
|
207
207
|
}
|
|
208
208
|
getWithdrawalsIdentifiers({ withdrawalParams, intentTx }) {
|
|
209
|
-
const indexes = new Map(
|
|
210
|
-
return determineRouteConfig(this, w).route;
|
|
211
|
-
}), Array(withdrawalParams.length).fill(0)));
|
|
209
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
212
210
|
return withdrawalParams.map((w) => {
|
|
213
211
|
const routeConfig = determineRouteConfig(this, w);
|
|
214
212
|
const route = routeConfig.route;
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
indexes.set(route, index + 1);
|
|
213
|
+
const currentIndex = indexes.get(route) ?? 0;
|
|
214
|
+
indexes.set(route, currentIndex + 1);
|
|
218
215
|
return {
|
|
219
216
|
routeConfig,
|
|
220
|
-
index,
|
|
217
|
+
index: currentIndex,
|
|
218
|
+
withdrawalParams: w,
|
|
221
219
|
tx: intentTx
|
|
222
220
|
};
|
|
223
221
|
});
|
|
@@ -231,6 +229,7 @@ var IntentsSDK = class {
|
|
|
231
229
|
for (const bridge of this.bridges) if (bridge.is(wid.routeConfig)) return bridge.waitForWithdrawalCompletion({
|
|
232
230
|
tx: args.intentTx,
|
|
233
231
|
index: wid.index,
|
|
232
|
+
withdrawalParams: wid.withdrawalParams,
|
|
234
233
|
routeConfig: wid.routeConfig,
|
|
235
234
|
signal: args.signal,
|
|
236
235
|
retryOptions: args.retryOptions,
|
|
@@ -298,6 +298,7 @@ interface Bridge {
|
|
|
298
298
|
waitForWithdrawalCompletion(args: {
|
|
299
299
|
tx: NearTxInfo;
|
|
300
300
|
index: number;
|
|
301
|
+
withdrawalParams: WithdrawalParams;
|
|
301
302
|
routeConfig: RouteConfig;
|
|
302
303
|
signal?: AbortSignal;
|
|
303
304
|
retryOptions?: RetryOptions;
|
|
@@ -307,6 +308,7 @@ interface Bridge {
|
|
|
307
308
|
interface WithdrawalIdentifier {
|
|
308
309
|
routeConfig: RouteConfig;
|
|
309
310
|
index: number;
|
|
311
|
+
withdrawalParams: WithdrawalParams;
|
|
310
312
|
tx: NearTxInfo;
|
|
311
313
|
}
|
|
312
314
|
type ParsedAssetInfo = ({
|
|
@@ -298,6 +298,7 @@ interface Bridge {
|
|
|
298
298
|
waitForWithdrawalCompletion(args: {
|
|
299
299
|
tx: NearTxInfo;
|
|
300
300
|
index: number;
|
|
301
|
+
withdrawalParams: WithdrawalParams;
|
|
301
302
|
routeConfig: RouteConfig;
|
|
302
303
|
signal?: AbortSignal;
|
|
303
304
|
retryOptions?: RetryOptions;
|
|
@@ -307,6 +308,7 @@ interface Bridge {
|
|
|
307
308
|
interface WithdrawalIdentifier {
|
|
308
309
|
routeConfig: RouteConfig;
|
|
309
310
|
index: number;
|
|
311
|
+
withdrawalParams: WithdrawalParams;
|
|
310
312
|
tx: NearTxInfo;
|
|
311
313
|
}
|
|
312
314
|
type ParsedAssetInfo = ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defuse-protocol/intents-sdk",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.3",
|
|
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.
|
|
34
|
+
"@hot-labs/omni-sdk": "2.24.3",
|
|
35
35
|
"@isaacs/ttlcache": "^1.0.0",
|
|
36
36
|
"@lifeomic/attempt": "^3.0.0",
|
|
37
37
|
"@near-js/accounts": "^2.0.1",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"valibot": "^1.0.0",
|
|
49
49
|
"viem": "^2.0.0",
|
|
50
50
|
"@defuse-protocol/contract-types": "0.4.3",
|
|
51
|
-
"@defuse-protocol/internal-utils": "0.21.
|
|
51
|
+
"@defuse-protocol/internal-utils": "0.21.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"tsdown": "0.15.5",
|