@defuse-protocol/intents-sdk 0.16.4 → 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 +414 -264
- package/dist/index.d.cts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +359 -213
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -30,31 +30,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
AssertionError: () =>
|
|
34
|
-
BaseError: () =>
|
|
33
|
+
AssertionError: () => import_internal_utils25.AssertionError,
|
|
34
|
+
BaseError: () => import_internal_utils22.BaseError,
|
|
35
35
|
BridgeNameEnum: () => BridgeNameEnum,
|
|
36
36
|
Chains: () => Chains,
|
|
37
37
|
FeeExceedsAmountError: () => FeeExceedsAmountError,
|
|
38
38
|
HotWithdrawalCancelledError: () => HotWithdrawalCancelledError,
|
|
39
39
|
HotWithdrawalNotFoundError: () => HotWithdrawalNotFoundError,
|
|
40
40
|
HotWithdrawalPendingError: () => HotWithdrawalPendingError,
|
|
41
|
-
HttpRequestError: () =>
|
|
42
|
-
IntentSettlementError: () =>
|
|
41
|
+
HttpRequestError: () => import_internal_utils24.HttpRequestError,
|
|
42
|
+
IntentSettlementError: () => import_internal_utils26.IntentSettlementError,
|
|
43
43
|
IntentsSDK: () => IntentsSDK,
|
|
44
44
|
MinWithdrawalAmountError: () => MinWithdrawalAmountError,
|
|
45
45
|
OmniTransferDestinationChainHashNotFoundError: () => OmniTransferDestinationChainHashNotFoundError,
|
|
46
46
|
OmniTransferNotFoundError: () => OmniTransferNotFoundError,
|
|
47
|
-
PoaWithdrawalInvariantError: () =>
|
|
48
|
-
PoaWithdrawalNotFoundError: () =>
|
|
49
|
-
PoaWithdrawalPendingError: () =>
|
|
50
|
-
QuoteError: () =>
|
|
51
|
-
RelayPublishError: () =>
|
|
47
|
+
PoaWithdrawalInvariantError: () => import_internal_utils23.PoaWithdrawalInvariantError,
|
|
48
|
+
PoaWithdrawalNotFoundError: () => import_internal_utils23.PoaWithdrawalNotFoundError,
|
|
49
|
+
PoaWithdrawalPendingError: () => import_internal_utils23.PoaWithdrawalPendingError,
|
|
50
|
+
QuoteError: () => import_internal_utils26.QuoteError,
|
|
51
|
+
RelayPublishError: () => import_internal_utils26.RelayPublishError,
|
|
52
52
|
RouteEnum: () => RouteEnum,
|
|
53
|
-
RpcRequestError: () =>
|
|
54
|
-
TimeoutError: () =>
|
|
53
|
+
RpcRequestError: () => import_internal_utils24.RpcRequestError,
|
|
54
|
+
TimeoutError: () => import_internal_utils24.TimeoutError,
|
|
55
55
|
TokenNotFoundInDestinationChainError: () => TokenNotFoundInDestinationChainError,
|
|
56
56
|
TokenNotSupportedByOmniRelayerError: () => TokenNotSupportedByOmniRelayerError,
|
|
57
57
|
TrustlineNotFoundError: () => TrustlineNotFoundError,
|
|
58
|
+
UnsupportedAssetIdError: () => UnsupportedAssetIdError,
|
|
58
59
|
UnsupportedDestinationMemoError: () => UnsupportedDestinationMemoError,
|
|
59
60
|
createDefaultRoute: () => createDefaultRoute,
|
|
60
61
|
createHotBridgeRoute: () => createHotBridgeRoute,
|
|
@@ -63,19 +64,19 @@ __export(index_exports, {
|
|
|
63
64
|
createIntentSignerViem: () => createIntentSignerViem,
|
|
64
65
|
createInternalTransferRoute: () => createInternalTransferRoute,
|
|
65
66
|
createNearWithdrawalRoute: () => createNearWithdrawalRoute,
|
|
66
|
-
|
|
67
|
+
createOmniBridgeRoute: () => createOmniBridgeRoute,
|
|
67
68
|
createPoaBridgeRoute: () => createPoaBridgeRoute,
|
|
68
69
|
createVirtualChainRoute: () => createVirtualChainRoute
|
|
69
70
|
});
|
|
70
71
|
module.exports = __toCommonJS(index_exports);
|
|
71
72
|
|
|
72
73
|
// src/sdk.ts
|
|
73
|
-
var
|
|
74
|
-
var
|
|
74
|
+
var import_internal_utils19 = require("@defuse-protocol/internal-utils");
|
|
75
|
+
var import_omni_sdk4 = __toESM(require("@hot-labs/omni-sdk"), 1);
|
|
75
76
|
var import_viem2 = require("viem");
|
|
76
77
|
|
|
77
78
|
// src/bridges/aurora-engine-bridge/aurora-engine-bridge.ts
|
|
78
|
-
var
|
|
79
|
+
var import_internal_utils6 = require("@defuse-protocol/internal-utils");
|
|
79
80
|
|
|
80
81
|
// src/constants/route-enum.ts
|
|
81
82
|
var RouteEnum = {
|
|
@@ -129,6 +130,190 @@ function withdrawalParamsInvariant(params) {
|
|
|
129
130
|
);
|
|
130
131
|
}
|
|
131
132
|
|
|
133
|
+
// src/lib/parse-defuse-asset-id.ts
|
|
134
|
+
var import_internal_utils3 = require("@defuse-protocol/internal-utils");
|
|
135
|
+
|
|
136
|
+
// src/classes/errors.ts
|
|
137
|
+
var import_internal_utils2 = require("@defuse-protocol/internal-utils");
|
|
138
|
+
var FeeExceedsAmountError = class extends import_internal_utils2.BaseError {
|
|
139
|
+
constructor(feeEstimation, amount) {
|
|
140
|
+
super("Amount too small to pay fee.", {
|
|
141
|
+
metaMessages: [
|
|
142
|
+
`Required fee: ${feeEstimation.amount}`,
|
|
143
|
+
`Withdrawal amount: ${amount}`
|
|
144
|
+
],
|
|
145
|
+
name: "FeeExceedsAmountError"
|
|
146
|
+
});
|
|
147
|
+
this.feeEstimation = feeEstimation;
|
|
148
|
+
this.amount = amount;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var MinWithdrawalAmountError = class extends import_internal_utils2.BaseError {
|
|
152
|
+
constructor(minAmount, requestedAmount, assetId) {
|
|
153
|
+
super("Withdrawal amount is below minimum required by the bridge.", {
|
|
154
|
+
metaMessages: [
|
|
155
|
+
`Asset ID: ${assetId}`,
|
|
156
|
+
`Minimum amount: ${minAmount}`,
|
|
157
|
+
`Requested amount: ${requestedAmount}`
|
|
158
|
+
],
|
|
159
|
+
name: "MinWithdrawalAmountError"
|
|
160
|
+
});
|
|
161
|
+
this.minAmount = minAmount;
|
|
162
|
+
this.requestedAmount = requestedAmount;
|
|
163
|
+
this.assetId = assetId;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
var UnsupportedDestinationMemoError = class extends import_internal_utils2.BaseError {
|
|
167
|
+
constructor(blockchain, assetId) {
|
|
168
|
+
super("Destination memo is not supported for this blockchain.", {
|
|
169
|
+
details: "Destination memo is only supported for XRP Ledger withdrawals.",
|
|
170
|
+
metaMessages: [`Blockchain: ${blockchain}`, `Asset ID: ${assetId}`],
|
|
171
|
+
name: "UnsupportedDestinationMemoError"
|
|
172
|
+
});
|
|
173
|
+
this.blockchain = blockchain;
|
|
174
|
+
this.assetId = assetId;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
var TrustlineNotFoundError = class extends import_internal_utils2.BaseError {
|
|
178
|
+
constructor(destinationAddress, assetId, blockchain, tokenAddress) {
|
|
179
|
+
super("Destination address does not have a trustline for this asset.", {
|
|
180
|
+
details: "The destination address must establish a trustline before receiving this asset.",
|
|
181
|
+
metaMessages: [
|
|
182
|
+
`Blockchain: ${blockchain}`,
|
|
183
|
+
`Asset ID: ${assetId}`,
|
|
184
|
+
`Destination address: ${destinationAddress}`,
|
|
185
|
+
`Token address: ${tokenAddress}`
|
|
186
|
+
],
|
|
187
|
+
name: "TrustlineNotFoundError"
|
|
188
|
+
});
|
|
189
|
+
this.destinationAddress = destinationAddress;
|
|
190
|
+
this.assetId = assetId;
|
|
191
|
+
this.blockchain = blockchain;
|
|
192
|
+
this.tokenAddress = tokenAddress;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var UnsupportedAssetIdError = class extends import_internal_utils2.BaseError {
|
|
196
|
+
constructor(assetId, details) {
|
|
197
|
+
super("Asset ID is not supported.", {
|
|
198
|
+
details,
|
|
199
|
+
metaMessages: [`Asset ID: ${assetId}`],
|
|
200
|
+
name: "UnsupportedAssetIdError"
|
|
201
|
+
});
|
|
202
|
+
this.assetId = assetId;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// src/lib/parse-defuse-asset-id.ts
|
|
207
|
+
function parseDefuseAssetId(assetId) {
|
|
208
|
+
try {
|
|
209
|
+
return import_internal_utils3.utils.parseDefuseAssetId(assetId);
|
|
210
|
+
} catch {
|
|
211
|
+
throw new UnsupportedAssetIdError(assetId, "Invalid asset id format.");
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// src/lib/estimate-fee.ts
|
|
216
|
+
var import_internal_utils5 = require("@defuse-protocol/internal-utils");
|
|
217
|
+
|
|
218
|
+
// src/lib/tokensUsdPricesHttpClient/apis.ts
|
|
219
|
+
var import_internal_utils4 = require("@defuse-protocol/internal-utils");
|
|
220
|
+
async function tokens(config) {
|
|
221
|
+
const response = await (0, import_internal_utils4.request)({
|
|
222
|
+
url: new URL(
|
|
223
|
+
"tokens",
|
|
224
|
+
import_internal_utils4.configsByEnvironment[config.env].managerConsoleBaseURL
|
|
225
|
+
),
|
|
226
|
+
...config,
|
|
227
|
+
fetchOptions: {
|
|
228
|
+
...config.fetchOptions,
|
|
229
|
+
method: "GET"
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
return response.json();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// src/lib/estimate-fee.ts
|
|
236
|
+
async function getFeeQuote({
|
|
237
|
+
feeAmount,
|
|
238
|
+
feeAssetId,
|
|
239
|
+
tokenAssetId,
|
|
240
|
+
quoteOptions,
|
|
241
|
+
env,
|
|
242
|
+
logger
|
|
243
|
+
}) {
|
|
244
|
+
try {
|
|
245
|
+
return await import_internal_utils5.solverRelay.getQuote({
|
|
246
|
+
quoteParams: {
|
|
247
|
+
defuse_asset_identifier_in: tokenAssetId,
|
|
248
|
+
defuse_asset_identifier_out: feeAssetId,
|
|
249
|
+
exact_amount_out: feeAmount.toString(),
|
|
250
|
+
wait_ms: quoteOptions?.waitMs
|
|
251
|
+
},
|
|
252
|
+
config: {
|
|
253
|
+
baseURL: import_internal_utils5.configsByEnvironment[env].solverRelayBaseURL,
|
|
254
|
+
logBalanceSufficient: false,
|
|
255
|
+
logger
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
} catch (err) {
|
|
259
|
+
if (!(err instanceof import_internal_utils5.QuoteError)) {
|
|
260
|
+
throw err;
|
|
261
|
+
}
|
|
262
|
+
logger?.info(
|
|
263
|
+
"Can't get exact out quote, trying to get exact in quote with x1.2"
|
|
264
|
+
);
|
|
265
|
+
const prices = await tokens({ env });
|
|
266
|
+
const feeAssetPrice = prices.items.find(
|
|
267
|
+
(t) => t.defuse_asset_id === feeAssetId
|
|
268
|
+
);
|
|
269
|
+
const tokenAssetPrice = prices.items.find(
|
|
270
|
+
(t) => t.defuse_asset_id === tokenAssetId
|
|
271
|
+
);
|
|
272
|
+
if (feeAssetPrice == null || tokenAssetPrice == null) {
|
|
273
|
+
throw err;
|
|
274
|
+
}
|
|
275
|
+
const USD_SCALE = 1e6;
|
|
276
|
+
const feePriceScaled = BigInt(Math.round(feeAssetPrice.price * USD_SCALE));
|
|
277
|
+
const tokenPriceScaled = BigInt(
|
|
278
|
+
Math.round(tokenAssetPrice.price * USD_SCALE)
|
|
279
|
+
);
|
|
280
|
+
const feeDecimals = BigInt(feeAssetPrice.decimals);
|
|
281
|
+
const tokenDecimals = BigInt(tokenAssetPrice.decimals);
|
|
282
|
+
const num = feeAmount * feePriceScaled * 12n * 10n ** tokenDecimals;
|
|
283
|
+
const den = tokenPriceScaled * 10n ** feeDecimals * 10n;
|
|
284
|
+
let exactAmountIn = num / den;
|
|
285
|
+
if (num % den !== 0n) exactAmountIn += 1n;
|
|
286
|
+
if (exactAmountIn === 0n) exactAmountIn = 1n;
|
|
287
|
+
const quote = await import_internal_utils5.solverRelay.getQuote({
|
|
288
|
+
quoteParams: {
|
|
289
|
+
defuse_asset_identifier_in: tokenAssetId,
|
|
290
|
+
defuse_asset_identifier_out: feeAssetId,
|
|
291
|
+
exact_amount_in: exactAmountIn.toString(),
|
|
292
|
+
wait_ms: quoteOptions?.waitMs
|
|
293
|
+
},
|
|
294
|
+
config: {
|
|
295
|
+
baseURL: import_internal_utils5.configsByEnvironment[env].solverRelayBaseURL,
|
|
296
|
+
logBalanceSufficient: false,
|
|
297
|
+
logger
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
const RATIO_SCALE = 1000n;
|
|
301
|
+
const actualRatio = BigInt(quote.amount_out) * RATIO_SCALE / feeAmount;
|
|
302
|
+
const actualRatioNumber = Number(actualRatio) / Number(RATIO_SCALE);
|
|
303
|
+
if (actualRatio > 1500n) {
|
|
304
|
+
logger?.warn(
|
|
305
|
+
`Quote amount_out ratio is too high: ${actualRatioNumber.toFixed(2)}x`
|
|
306
|
+
);
|
|
307
|
+
throw err;
|
|
308
|
+
}
|
|
309
|
+
if (BigInt(quote.amount_out) < feeAmount) {
|
|
310
|
+
logger?.warn("Quote amount_out is less than feeAmount");
|
|
311
|
+
throw err;
|
|
312
|
+
}
|
|
313
|
+
return quote;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
132
317
|
// src/bridges/aurora-engine-bridge/aurora-engine-bridge.ts
|
|
133
318
|
var AuroraEngineBridge = class {
|
|
134
319
|
constructor({
|
|
@@ -141,11 +326,19 @@ var AuroraEngineBridge = class {
|
|
|
141
326
|
is(routeConfig) {
|
|
142
327
|
return routeConfig.route === RouteEnum.VirtualChain;
|
|
143
328
|
}
|
|
144
|
-
supports(params) {
|
|
145
|
-
if (
|
|
146
|
-
return
|
|
329
|
+
async supports(params) {
|
|
330
|
+
if (params.routeConfig == null || !this.is(params.routeConfig)) {
|
|
331
|
+
return false;
|
|
147
332
|
}
|
|
148
|
-
|
|
333
|
+
const assetInfo = parseDefuseAssetId(params.assetId);
|
|
334
|
+
const isValid = assetInfo.standard === "nep141";
|
|
335
|
+
if (!isValid) {
|
|
336
|
+
throw new UnsupportedAssetIdError(
|
|
337
|
+
params.assetId,
|
|
338
|
+
"`assetId` does not match `routeConfig`."
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
return isValid;
|
|
149
342
|
}
|
|
150
343
|
parseAssetId() {
|
|
151
344
|
return null;
|
|
@@ -182,16 +375,16 @@ var AuroraEngineBridge = class {
|
|
|
182
375
|
}
|
|
183
376
|
async estimateWithdrawalFee(args) {
|
|
184
377
|
withdrawalParamsInvariant(args.withdrawalParams);
|
|
185
|
-
const { contractId: tokenAccountId, standard } =
|
|
378
|
+
const { contractId: tokenAccountId, standard } = import_internal_utils6.utils.parseDefuseAssetId(
|
|
186
379
|
args.withdrawalParams.assetId
|
|
187
380
|
);
|
|
188
|
-
(0,
|
|
381
|
+
(0, import_internal_utils6.assert)(standard === "nep141", "Only NEP-141 is supported");
|
|
189
382
|
const [minStorageBalance, userStorageBalance] = await Promise.all([
|
|
190
|
-
(0,
|
|
383
|
+
(0, import_internal_utils6.getNearNep141MinStorageBalance)({
|
|
191
384
|
contractId: tokenAccountId,
|
|
192
385
|
nearProvider: this.nearProvider
|
|
193
386
|
}),
|
|
194
|
-
(0,
|
|
387
|
+
(0, import_internal_utils6.getNearNep141StorageBalance)({
|
|
195
388
|
contractId: tokenAccountId,
|
|
196
389
|
accountId: args.withdrawalParams.routeConfig.auroraEngineContractId,
|
|
197
390
|
nearProvider: this.nearProvider
|
|
@@ -205,18 +398,13 @@ var AuroraEngineBridge = class {
|
|
|
205
398
|
}
|
|
206
399
|
const feeAssetId = NEAR_NATIVE_ASSET_ID;
|
|
207
400
|
const feeAmount = minStorageBalance - userStorageBalance;
|
|
208
|
-
const feeQuote = args.withdrawalParams.assetId === feeAssetId ? null : await
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
config: {
|
|
216
|
-
baseURL: import_internal_utils2.configsByEnvironment[this.env].solverRelayBaseURL,
|
|
217
|
-
logBalanceSufficient: false,
|
|
218
|
-
logger: args.logger
|
|
219
|
-
}
|
|
401
|
+
const feeQuote = args.withdrawalParams.assetId === feeAssetId ? null : await getFeeQuote({
|
|
402
|
+
feeAmount,
|
|
403
|
+
feeAssetId,
|
|
404
|
+
tokenAssetId: args.withdrawalParams.assetId,
|
|
405
|
+
logger: args.logger,
|
|
406
|
+
env: this.env,
|
|
407
|
+
quoteOptions: args.quoteOptions
|
|
220
408
|
});
|
|
221
409
|
return {
|
|
222
410
|
amount: feeQuote ? BigInt(feeQuote.amount_in) : feeAmount,
|
|
@@ -229,7 +417,7 @@ var AuroraEngineBridge = class {
|
|
|
229
417
|
};
|
|
230
418
|
|
|
231
419
|
// src/bridges/direct-bridge/direct-bridge.ts
|
|
232
|
-
var
|
|
420
|
+
var import_internal_utils9 = require("@defuse-protocol/internal-utils");
|
|
233
421
|
|
|
234
422
|
// src/constants/bridge-name-enum.ts
|
|
235
423
|
var BridgeNameEnum = {
|
|
@@ -240,7 +428,7 @@ var BridgeNameEnum = {
|
|
|
240
428
|
};
|
|
241
429
|
|
|
242
430
|
// src/lib/caip2.ts
|
|
243
|
-
var
|
|
431
|
+
var import_internal_utils7 = require("@defuse-protocol/internal-utils");
|
|
244
432
|
var Chains = {
|
|
245
433
|
Bitcoin: "bip122:000000000019d6689c085ae165831e93",
|
|
246
434
|
Zcash: "bip122:00040fe8ec8471911baa1db1266ea15d",
|
|
@@ -265,11 +453,11 @@ var Chains = {
|
|
|
265
453
|
Cardano: "cip34:1-764824073"
|
|
266
454
|
};
|
|
267
455
|
function getEIP155ChainId(chain) {
|
|
268
|
-
(0,
|
|
456
|
+
(0, import_internal_utils7.assert)(chain.startsWith("eip155:"), "Chain is not an EIP-155 chain");
|
|
269
457
|
const chainIdStr = chain.slice(7);
|
|
270
|
-
(0,
|
|
458
|
+
(0, import_internal_utils7.assert)(chainIdStr.length > 0, "Chain is not an EIP-155 chain");
|
|
271
459
|
const chainId = Number(chainIdStr);
|
|
272
|
-
(0,
|
|
460
|
+
(0, import_internal_utils7.assert)(!Number.isNaN(chainId), "Chain is not an EIP-155 chain");
|
|
273
461
|
return chainId;
|
|
274
462
|
}
|
|
275
463
|
|
|
@@ -277,7 +465,7 @@ function getEIP155ChainId(chain) {
|
|
|
277
465
|
var NEAR_NATIVE_ASSET_ID2 = "nep141:wrap.near";
|
|
278
466
|
|
|
279
467
|
// src/bridges/direct-bridge/direct-bridge-utils.ts
|
|
280
|
-
var
|
|
468
|
+
var import_internal_utils8 = require("@defuse-protocol/internal-utils");
|
|
281
469
|
function createWithdrawIntentPrimitive2(params) {
|
|
282
470
|
if (params.assetId === NEAR_NATIVE_ASSET_ID2 && // Ensure `msg` is not passed, because `native_withdraw` intent doesn't support `msg`
|
|
283
471
|
params.msg === void 0) {
|
|
@@ -287,10 +475,10 @@ function createWithdrawIntentPrimitive2(params) {
|
|
|
287
475
|
amount: params.amount.toString()
|
|
288
476
|
};
|
|
289
477
|
}
|
|
290
|
-
const { contractId: tokenAccountId, standard } =
|
|
478
|
+
const { contractId: tokenAccountId, standard } = import_internal_utils8.utils.parseDefuseAssetId(
|
|
291
479
|
params.assetId
|
|
292
480
|
);
|
|
293
|
-
(0,
|
|
481
|
+
(0, import_internal_utils8.assert)(standard === "nep141", "Only NEP-141 is supported");
|
|
294
482
|
return {
|
|
295
483
|
intent: "ft_withdraw",
|
|
296
484
|
token: tokenAccountId,
|
|
@@ -301,7 +489,7 @@ function createWithdrawIntentPrimitive2(params) {
|
|
|
301
489
|
};
|
|
302
490
|
}
|
|
303
491
|
function withdrawalParamsInvariant2(params) {
|
|
304
|
-
(0,
|
|
492
|
+
(0, import_internal_utils8.assert)(
|
|
305
493
|
!params.routeConfig ? true : params.routeConfig.route === RouteEnum.NearWithdrawal,
|
|
306
494
|
"Bridge is not direct"
|
|
307
495
|
);
|
|
@@ -319,19 +507,22 @@ var DirectBridge = class {
|
|
|
319
507
|
is(routeConfig) {
|
|
320
508
|
return routeConfig.route === RouteEnum.NearWithdrawal;
|
|
321
509
|
}
|
|
322
|
-
supports(params) {
|
|
323
|
-
|
|
324
|
-
if ("routeConfig" in params && params.routeConfig != null) {
|
|
325
|
-
result && (result = this.is(params.routeConfig));
|
|
326
|
-
}
|
|
327
|
-
try {
|
|
328
|
-
return result && this.parseAssetId(params.assetId) != null;
|
|
329
|
-
} catch {
|
|
510
|
+
async supports(params) {
|
|
511
|
+
if (params.routeConfig != null && !this.is(params.routeConfig)) {
|
|
330
512
|
return false;
|
|
331
513
|
}
|
|
514
|
+
const assetInfo = this.parseAssetId(params.assetId);
|
|
515
|
+
const isValid = assetInfo != null;
|
|
516
|
+
if (!isValid && params.routeConfig != null) {
|
|
517
|
+
throw new UnsupportedAssetIdError(
|
|
518
|
+
params.assetId,
|
|
519
|
+
"`assetId` does not match `routeConfig`."
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
return isValid;
|
|
332
523
|
}
|
|
333
524
|
parseAssetId(assetId) {
|
|
334
|
-
const parsed =
|
|
525
|
+
const parsed = parseDefuseAssetId(assetId);
|
|
335
526
|
if (parsed.standard === "nep141") {
|
|
336
527
|
return Object.assign(parsed, {
|
|
337
528
|
blockchain: Chains.Near,
|
|
@@ -372,10 +563,10 @@ var DirectBridge = class {
|
|
|
372
563
|
}
|
|
373
564
|
async estimateWithdrawalFee(args) {
|
|
374
565
|
withdrawalParamsInvariant2(args.withdrawalParams);
|
|
375
|
-
const { contractId: tokenAccountId, standard } =
|
|
566
|
+
const { contractId: tokenAccountId, standard } = import_internal_utils9.utils.parseDefuseAssetId(
|
|
376
567
|
args.withdrawalParams.assetId
|
|
377
568
|
);
|
|
378
|
-
(0,
|
|
569
|
+
(0, import_internal_utils9.assert)(standard === "nep141", "Only NEP-141 is supported");
|
|
379
570
|
if (
|
|
380
571
|
// We don't directly withdraw `wrap.near`, we unwrap it first, so it doesn't require storage
|
|
381
572
|
args.withdrawalParams.assetId === NEAR_NATIVE_ASSET_ID2 && // Ensure `msg` is not passed, because `native_withdraw` intent doesn't support `msg`
|
|
@@ -386,11 +577,11 @@ var DirectBridge = class {
|
|
|
386
577
|
quote: null
|
|
387
578
|
};
|
|
388
579
|
const [minStorageBalance, userStorageBalance] = await Promise.all([
|
|
389
|
-
(0,
|
|
580
|
+
(0, import_internal_utils9.getNearNep141MinStorageBalance)({
|
|
390
581
|
contractId: tokenAccountId,
|
|
391
582
|
nearProvider: this.nearProvider
|
|
392
583
|
}),
|
|
393
|
-
(0,
|
|
584
|
+
(0, import_internal_utils9.getNearNep141StorageBalance)({
|
|
394
585
|
contractId: tokenAccountId,
|
|
395
586
|
accountId: args.withdrawalParams.destinationAddress,
|
|
396
587
|
nearProvider: this.nearProvider
|
|
@@ -404,18 +595,13 @@ var DirectBridge = class {
|
|
|
404
595
|
}
|
|
405
596
|
const feeAssetId = NEAR_NATIVE_ASSET_ID2;
|
|
406
597
|
const feeAmount = minStorageBalance - userStorageBalance;
|
|
407
|
-
const feeQuote = args.withdrawalParams.assetId === feeAssetId ? null : await
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
config: {
|
|
415
|
-
baseURL: import_internal_utils5.configsByEnvironment[this.env].solverRelayBaseURL,
|
|
416
|
-
logBalanceSufficient: false,
|
|
417
|
-
logger: args.logger
|
|
418
|
-
}
|
|
598
|
+
const feeQuote = args.withdrawalParams.assetId === feeAssetId ? null : await getFeeQuote({
|
|
599
|
+
feeAmount,
|
|
600
|
+
feeAssetId,
|
|
601
|
+
tokenAssetId: args.withdrawalParams.assetId,
|
|
602
|
+
logger: args.logger,
|
|
603
|
+
env: this.env,
|
|
604
|
+
quoteOptions: args.quoteOptions
|
|
419
605
|
});
|
|
420
606
|
return {
|
|
421
607
|
amount: feeQuote ? BigInt(feeQuote.amount_in) : feeAmount,
|
|
@@ -428,73 +614,14 @@ var DirectBridge = class {
|
|
|
428
614
|
};
|
|
429
615
|
|
|
430
616
|
// src/bridges/hot-bridge/hot-bridge.ts
|
|
431
|
-
var
|
|
617
|
+
var import_internal_utils12 = require("@defuse-protocol/internal-utils");
|
|
432
618
|
var import_omni_sdk2 = require("@hot-labs/omni-sdk");
|
|
619
|
+
var import_omni_sdk3 = require("@hot-labs/omni-sdk");
|
|
433
620
|
var import_attempt = require("@lifeomic/attempt");
|
|
434
621
|
|
|
435
|
-
// src/classes/errors.ts
|
|
436
|
-
var import_internal_utils6 = require("@defuse-protocol/internal-utils");
|
|
437
|
-
var FeeExceedsAmountError = class extends import_internal_utils6.BaseError {
|
|
438
|
-
constructor(feeEstimation, amount) {
|
|
439
|
-
super("Amount too small to pay fee.", {
|
|
440
|
-
metaMessages: [
|
|
441
|
-
`Required fee: ${feeEstimation.amount}`,
|
|
442
|
-
`Withdrawal amount: ${amount}`
|
|
443
|
-
],
|
|
444
|
-
name: "FeeExceedsAmountError"
|
|
445
|
-
});
|
|
446
|
-
this.feeEstimation = feeEstimation;
|
|
447
|
-
this.amount = amount;
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
var MinWithdrawalAmountError = class extends import_internal_utils6.BaseError {
|
|
451
|
-
constructor(minAmount, requestedAmount, assetId) {
|
|
452
|
-
super("Withdrawal amount is below minimum required by the bridge.", {
|
|
453
|
-
metaMessages: [
|
|
454
|
-
`Asset ID: ${assetId}`,
|
|
455
|
-
`Minimum amount: ${minAmount}`,
|
|
456
|
-
`Requested amount: ${requestedAmount}`
|
|
457
|
-
],
|
|
458
|
-
name: "MinWithdrawalAmountError"
|
|
459
|
-
});
|
|
460
|
-
this.minAmount = minAmount;
|
|
461
|
-
this.requestedAmount = requestedAmount;
|
|
462
|
-
this.assetId = assetId;
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
var UnsupportedDestinationMemoError = class extends import_internal_utils6.BaseError {
|
|
466
|
-
constructor(blockchain, assetId) {
|
|
467
|
-
super("Destination memo is not supported for this blockchain.", {
|
|
468
|
-
details: "Destination memo is only supported for XRP Ledger withdrawals.",
|
|
469
|
-
metaMessages: [`Blockchain: ${blockchain}`, `Asset ID: ${assetId}`],
|
|
470
|
-
name: "UnsupportedDestinationMemoError"
|
|
471
|
-
});
|
|
472
|
-
this.blockchain = blockchain;
|
|
473
|
-
this.assetId = assetId;
|
|
474
|
-
}
|
|
475
|
-
};
|
|
476
|
-
var TrustlineNotFoundError = class extends import_internal_utils6.BaseError {
|
|
477
|
-
constructor(destinationAddress, assetId, blockchain, tokenAddress) {
|
|
478
|
-
super("Destination address does not have a trustline for this asset.", {
|
|
479
|
-
details: "The destination address must establish a trustline before receiving this asset.",
|
|
480
|
-
metaMessages: [
|
|
481
|
-
`Blockchain: ${blockchain}`,
|
|
482
|
-
`Asset ID: ${assetId}`,
|
|
483
|
-
`Destination address: ${destinationAddress}`,
|
|
484
|
-
`Token address: ${tokenAddress}`
|
|
485
|
-
],
|
|
486
|
-
name: "TrustlineNotFoundError"
|
|
487
|
-
});
|
|
488
|
-
this.destinationAddress = destinationAddress;
|
|
489
|
-
this.assetId = assetId;
|
|
490
|
-
this.blockchain = blockchain;
|
|
491
|
-
this.tokenAddress = tokenAddress;
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
|
|
495
622
|
// src/bridges/hot-bridge/error.ts
|
|
496
|
-
var
|
|
497
|
-
var HotWithdrawalPendingError = class extends
|
|
623
|
+
var import_internal_utils10 = require("@defuse-protocol/internal-utils");
|
|
624
|
+
var HotWithdrawalPendingError = class extends import_internal_utils10.BaseError {
|
|
498
625
|
constructor(txHash, index) {
|
|
499
626
|
super("Withdrawal is still pending.", {
|
|
500
627
|
metaMessages: [`TxHash: ${txHash}`, `Index: ${index}`],
|
|
@@ -504,7 +631,7 @@ var HotWithdrawalPendingError = class extends import_internal_utils7.BaseError {
|
|
|
504
631
|
this.index = index;
|
|
505
632
|
}
|
|
506
633
|
};
|
|
507
|
-
var HotWithdrawalNotFoundError = class extends
|
|
634
|
+
var HotWithdrawalNotFoundError = class extends import_internal_utils10.BaseError {
|
|
508
635
|
constructor(txHash, index) {
|
|
509
636
|
super("Withdrawal with given index is not found.", {
|
|
510
637
|
metaMessages: [`TxHash: ${txHash}`, `Index: ${index}`],
|
|
@@ -514,7 +641,7 @@ var HotWithdrawalNotFoundError = class extends import_internal_utils7.BaseError
|
|
|
514
641
|
this.index = index;
|
|
515
642
|
}
|
|
516
643
|
};
|
|
517
|
-
var HotWithdrawalCancelledError = class extends
|
|
644
|
+
var HotWithdrawalCancelledError = class extends import_internal_utils10.BaseError {
|
|
518
645
|
constructor(txHash, index) {
|
|
519
646
|
super("Gasless withdrawal was canceled.", {
|
|
520
647
|
metaMessages: [`TxHash: ${txHash}`, `Index: ${index}`],
|
|
@@ -532,7 +659,7 @@ var HotWithdrawStatus = {
|
|
|
532
659
|
};
|
|
533
660
|
|
|
534
661
|
// src/bridges/hot-bridge/hot-bridge-utils.ts
|
|
535
|
-
var
|
|
662
|
+
var import_internal_utils11 = require("@defuse-protocol/internal-utils");
|
|
536
663
|
var import_omni_sdk = require("@hot-labs/omni-sdk");
|
|
537
664
|
|
|
538
665
|
// src/bridges/hot-bridge/hot-bridge-chains.ts
|
|
@@ -586,7 +713,7 @@ function formatTxHash(txHash, caip2) {
|
|
|
586
713
|
return txHash;
|
|
587
714
|
}
|
|
588
715
|
function hotBlockchainInvariant(blockchain) {
|
|
589
|
-
(0,
|
|
716
|
+
(0, import_internal_utils11.assert)(
|
|
590
717
|
HotBridgeChains.includes(blockchain),
|
|
591
718
|
`${blockchain} is not a valid HOT Bridge blockchain. Supported values: ${HotBridgeChains.join()}`
|
|
592
719
|
);
|
|
@@ -601,41 +728,60 @@ var HotBridge = class {
|
|
|
601
728
|
is(routeConfig) {
|
|
602
729
|
return routeConfig.route === RouteEnum.HotBridge;
|
|
603
730
|
}
|
|
604
|
-
supports(params) {
|
|
605
|
-
|
|
606
|
-
if ("routeConfig" in params && params.routeConfig != null) {
|
|
607
|
-
result && (result = this.is(params.routeConfig));
|
|
608
|
-
}
|
|
609
|
-
try {
|
|
610
|
-
return result && this.parseAssetId(params.assetId) != null;
|
|
611
|
-
} catch {
|
|
731
|
+
async supports(params) {
|
|
732
|
+
if (params.routeConfig != null && !this.is(params.routeConfig)) {
|
|
612
733
|
return false;
|
|
613
734
|
}
|
|
735
|
+
const assetInfo = this.parseAssetId(params.assetId);
|
|
736
|
+
const isValid = assetInfo != null;
|
|
737
|
+
if (!isValid && params.routeConfig != null) {
|
|
738
|
+
throw new UnsupportedAssetIdError(
|
|
739
|
+
params.assetId,
|
|
740
|
+
"`assetId` does not match `routeConfig`."
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
return isValid;
|
|
614
744
|
}
|
|
615
745
|
parseAssetId(assetId) {
|
|
616
|
-
const parsed =
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
746
|
+
const parsed = parseDefuseAssetId(assetId);
|
|
747
|
+
const contractIdSatisfies = parsed.contractId === import_omni_sdk2.OMNI_HOT_V2;
|
|
748
|
+
if (!contractIdSatisfies) {
|
|
749
|
+
return null;
|
|
750
|
+
}
|
|
751
|
+
if (parsed.standard !== "nep245") {
|
|
752
|
+
throw new UnsupportedAssetIdError(
|
|
753
|
+
assetId,
|
|
754
|
+
'Should start with "nep245:".'
|
|
621
755
|
);
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
blockchain: hotNetworkIdToCAIP2(chainId),
|
|
629
|
-
bridgeName: BridgeNameEnum.Hot
|
|
630
|
-
},
|
|
631
|
-
address === "native" ? { native: true } : { address }
|
|
756
|
+
}
|
|
757
|
+
const [chainId, address] = import_omni_sdk3.utils.fromOmni(parsed.tokenId).split(":");
|
|
758
|
+
if (chainId == null || address == null) {
|
|
759
|
+
throw new UnsupportedAssetIdError(
|
|
760
|
+
assetId,
|
|
761
|
+
"Asset has invalid token id format."
|
|
632
762
|
);
|
|
633
763
|
}
|
|
634
|
-
|
|
764
|
+
let blockchain;
|
|
765
|
+
try {
|
|
766
|
+
blockchain = hotNetworkIdToCAIP2(chainId);
|
|
767
|
+
} catch {
|
|
768
|
+
throw new UnsupportedAssetIdError(
|
|
769
|
+
assetId,
|
|
770
|
+
"Asset belongs to unknown blockchain."
|
|
771
|
+
);
|
|
772
|
+
}
|
|
773
|
+
return Object.assign(
|
|
774
|
+
parsed,
|
|
775
|
+
{
|
|
776
|
+
blockchain,
|
|
777
|
+
bridgeName: BridgeNameEnum.Hot
|
|
778
|
+
},
|
|
779
|
+
address === "native" ? { native: true } : { address }
|
|
780
|
+
);
|
|
635
781
|
}
|
|
636
782
|
async createWithdrawalIntents(args) {
|
|
637
783
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
638
|
-
(0,
|
|
784
|
+
(0, import_internal_utils12.assert)(assetInfo != null, "Asset is not supported");
|
|
639
785
|
if (args.withdrawalParams.destinationMemo != null && args.withdrawalParams.destinationMemo !== "") {
|
|
640
786
|
throw new UnsupportedDestinationMemoError(
|
|
641
787
|
assetInfo.blockchain,
|
|
@@ -669,9 +815,9 @@ var HotBridge = class {
|
|
|
669
815
|
intentAccount: ""
|
|
670
816
|
// it is not used inside the function
|
|
671
817
|
});
|
|
672
|
-
(0,
|
|
818
|
+
(0, import_internal_utils12.assert)(intent.amounts[0] === amount.toString(), "Amount is not correct");
|
|
673
819
|
if (intent.amounts.length === 2) {
|
|
674
|
-
(0,
|
|
820
|
+
(0, import_internal_utils12.assert)(
|
|
675
821
|
intent.amounts[1] === feeAmount.toString(),
|
|
676
822
|
"Amount is not correct"
|
|
677
823
|
);
|
|
@@ -686,7 +832,7 @@ var HotBridge = class {
|
|
|
686
832
|
*/
|
|
687
833
|
async validateWithdrawal(args) {
|
|
688
834
|
const assetInfo = this.parseAssetId(args.assetId);
|
|
689
|
-
(0,
|
|
835
|
+
(0, import_internal_utils12.assert)(assetInfo != null, "Asset is not supported");
|
|
690
836
|
hotBlockchainInvariant(assetInfo.blockchain);
|
|
691
837
|
if (assetInfo.blockchain === Chains.Stellar) {
|
|
692
838
|
const token = "native" in assetInfo ? "native" : assetInfo.address;
|
|
@@ -706,25 +852,21 @@ var HotBridge = class {
|
|
|
706
852
|
}
|
|
707
853
|
async estimateWithdrawalFee(args) {
|
|
708
854
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
709
|
-
(0,
|
|
855
|
+
(0, import_internal_utils12.assert)(assetInfo != null, "Asset is not supported");
|
|
710
856
|
hotBlockchainInvariant(assetInfo.blockchain);
|
|
711
|
-
const { gasPrice: feeAmount } = await this.hotSdk.getGaslessWithdrawFee(
|
|
712
|
-
toHotNetworkId(assetInfo.blockchain),
|
|
713
|
-
|
|
714
|
-
|
|
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
|
+
});
|
|
715
862
|
const feeAssetId = getFeeAssetIdForChain(assetInfo.blockchain);
|
|
716
|
-
const feeQuote = args.withdrawalParams.assetId === feeAssetId || feeAmount === 0n ? null : await
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
config: {
|
|
724
|
-
baseURL: import_internal_utils9.configsByEnvironment[this.env].solverRelayBaseURL,
|
|
725
|
-
logBalanceSufficient: false,
|
|
726
|
-
logger: args.logger
|
|
727
|
-
}
|
|
863
|
+
const feeQuote = args.withdrawalParams.assetId === feeAssetId || feeAmount === 0n ? null : await getFeeQuote({
|
|
864
|
+
feeAmount,
|
|
865
|
+
feeAssetId,
|
|
866
|
+
tokenAssetId: args.withdrawalParams.assetId,
|
|
867
|
+
logger: args.logger,
|
|
868
|
+
env: this.env,
|
|
869
|
+
quoteOptions: args.quoteOptions
|
|
728
870
|
});
|
|
729
871
|
return {
|
|
730
872
|
amount: feeQuote ? BigInt(feeQuote.amount_in) : feeAmount,
|
|
@@ -762,7 +904,7 @@ var HotBridge = class {
|
|
|
762
904
|
throw new HotWithdrawalPendingError(args.tx.hash, args.index);
|
|
763
905
|
},
|
|
764
906
|
{
|
|
765
|
-
...args.retryOptions ??
|
|
907
|
+
...args.retryOptions ?? import_internal_utils12.RETRY_CONFIGS.TWO_MINS_GRADUAL,
|
|
766
908
|
handleError: (err, ctx) => {
|
|
767
909
|
if (err instanceof HotWithdrawalCancelledError || err === args.signal?.reason) {
|
|
768
910
|
ctx.abort();
|
|
@@ -778,7 +920,7 @@ var IntentsBridge = class {
|
|
|
778
920
|
is(routeConfig) {
|
|
779
921
|
return routeConfig.route === RouteEnum.InternalTransfer;
|
|
780
922
|
}
|
|
781
|
-
supports(params) {
|
|
923
|
+
async supports(params) {
|
|
782
924
|
if ("routeConfig" in params && params.routeConfig != null) {
|
|
783
925
|
return this.is(params.routeConfig);
|
|
784
926
|
}
|
|
@@ -817,13 +959,13 @@ var IntentsBridge = class {
|
|
|
817
959
|
};
|
|
818
960
|
|
|
819
961
|
// src/bridges/poa-bridge/poa-bridge.ts
|
|
820
|
-
var
|
|
962
|
+
var import_internal_utils14 = require("@defuse-protocol/internal-utils");
|
|
821
963
|
var import_ttlcache = __toESM(require("@isaacs/ttlcache"), 1);
|
|
822
964
|
|
|
823
965
|
// src/bridges/poa-bridge/poa-bridge-utils.ts
|
|
824
|
-
var
|
|
966
|
+
var import_internal_utils13 = require("@defuse-protocol/internal-utils");
|
|
825
967
|
function createWithdrawIntentPrimitive3(params) {
|
|
826
|
-
const { contractId: tokenAccountId } =
|
|
968
|
+
const { contractId: tokenAccountId } = import_internal_utils13.utils.parseDefuseAssetId(
|
|
827
969
|
params.assetId
|
|
828
970
|
);
|
|
829
971
|
return {
|
|
@@ -904,30 +1046,43 @@ var PoaBridge = class {
|
|
|
904
1046
|
is(routeConfig) {
|
|
905
1047
|
return routeConfig.route === RouteEnum.PoaBridge;
|
|
906
1048
|
}
|
|
907
|
-
supports(params) {
|
|
908
|
-
|
|
909
|
-
if ("routeConfig" in params && params.routeConfig != null) {
|
|
910
|
-
result && (result = this.is(params.routeConfig));
|
|
911
|
-
}
|
|
912
|
-
try {
|
|
913
|
-
return result && this.parseAssetId(params.assetId) != null;
|
|
914
|
-
} catch {
|
|
1049
|
+
async supports(params) {
|
|
1050
|
+
if (params.routeConfig != null && !this.is(params.routeConfig)) {
|
|
915
1051
|
return false;
|
|
916
1052
|
}
|
|
1053
|
+
const assetInfo = this.parseAssetId(params.assetId);
|
|
1054
|
+
const isValid = assetInfo != null;
|
|
1055
|
+
if (!isValid && params.routeConfig != null) {
|
|
1056
|
+
throw new UnsupportedAssetIdError(
|
|
1057
|
+
params.assetId,
|
|
1058
|
+
"`assetId` does not match `routeConfig`."
|
|
1059
|
+
);
|
|
1060
|
+
}
|
|
1061
|
+
return isValid;
|
|
917
1062
|
}
|
|
918
1063
|
parseAssetId(assetId) {
|
|
919
|
-
const parsed =
|
|
920
|
-
|
|
921
|
-
`.${
|
|
922
|
-
)
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
bridgeName: BridgeNameEnum.Poa,
|
|
926
|
-
address: ""
|
|
927
|
-
// todo: derive address (or native)
|
|
928
|
-
});
|
|
1064
|
+
const parsed = parseDefuseAssetId(assetId);
|
|
1065
|
+
const contractIdSatisfies = parsed.contractId.endsWith(
|
|
1066
|
+
`.${import_internal_utils14.configsByEnvironment[this.env].poaTokenFactoryContractID}`
|
|
1067
|
+
);
|
|
1068
|
+
if (!contractIdSatisfies) {
|
|
1069
|
+
return null;
|
|
929
1070
|
}
|
|
930
|
-
|
|
1071
|
+
let blockchain;
|
|
1072
|
+
try {
|
|
1073
|
+
blockchain = contractIdToCaip2(parsed.contractId);
|
|
1074
|
+
} catch {
|
|
1075
|
+
throw new UnsupportedAssetIdError(
|
|
1076
|
+
assetId,
|
|
1077
|
+
"Asset belongs to unknown blockchain."
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
1080
|
+
return Object.assign(parsed, {
|
|
1081
|
+
blockchain,
|
|
1082
|
+
bridgeName: BridgeNameEnum.Poa,
|
|
1083
|
+
address: ""
|
|
1084
|
+
// todo: derive address (or native)
|
|
1085
|
+
});
|
|
931
1086
|
}
|
|
932
1087
|
createWithdrawalIntents(args) {
|
|
933
1088
|
const intent = createWithdrawIntentPrimitive3({
|
|
@@ -945,12 +1100,12 @@ var PoaBridge = class {
|
|
|
945
1100
|
*/
|
|
946
1101
|
async validateWithdrawal(args) {
|
|
947
1102
|
const assetInfo = this.parseAssetId(args.assetId);
|
|
948
|
-
(0,
|
|
949
|
-
const { tokens } = await this.getCachedSupportedTokens(
|
|
1103
|
+
(0, import_internal_utils14.assert)(assetInfo != null, "Asset is not supported");
|
|
1104
|
+
const { tokens: tokens2 } = await this.getCachedSupportedTokens(
|
|
950
1105
|
[toPoaNetwork(assetInfo.blockchain)],
|
|
951
1106
|
args.logger
|
|
952
1107
|
);
|
|
953
|
-
const tokenInfo =
|
|
1108
|
+
const tokenInfo = tokens2.find(
|
|
954
1109
|
(token) => token.intents_token_id === args.assetId
|
|
955
1110
|
);
|
|
956
1111
|
if (tokenInfo != null) {
|
|
@@ -966,16 +1121,16 @@ var PoaBridge = class {
|
|
|
966
1121
|
}
|
|
967
1122
|
async estimateWithdrawalFee(args) {
|
|
968
1123
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
969
|
-
(0,
|
|
970
|
-
const estimation = await
|
|
1124
|
+
(0, import_internal_utils14.assert)(assetInfo != null, "Asset is not supported");
|
|
1125
|
+
const estimation = await import_internal_utils14.poaBridge.httpClient.getWithdrawalEstimate(
|
|
971
1126
|
{
|
|
972
|
-
token:
|
|
1127
|
+
token: import_internal_utils14.utils.getTokenAccountId(args.withdrawalParams.assetId),
|
|
973
1128
|
address: args.withdrawalParams.destinationAddress,
|
|
974
1129
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
975
1130
|
chain: toPoaNetwork(assetInfo.blockchain)
|
|
976
1131
|
},
|
|
977
1132
|
{
|
|
978
|
-
baseURL:
|
|
1133
|
+
baseURL: import_internal_utils14.configsByEnvironment[this.env].poaBridgeBaseURL,
|
|
979
1134
|
logger: args.logger
|
|
980
1135
|
}
|
|
981
1136
|
);
|
|
@@ -985,12 +1140,12 @@ var PoaBridge = class {
|
|
|
985
1140
|
};
|
|
986
1141
|
}
|
|
987
1142
|
async waitForWithdrawalCompletion(args) {
|
|
988
|
-
const withdrawalStatus = await
|
|
1143
|
+
const withdrawalStatus = await import_internal_utils14.poaBridge.waitForWithdrawalCompletion({
|
|
989
1144
|
txHash: args.tx.hash,
|
|
990
1145
|
index: args.index,
|
|
991
1146
|
signal: args.signal ?? new AbortController().signal,
|
|
992
1147
|
retryOptions: args.retryOptions,
|
|
993
|
-
baseURL:
|
|
1148
|
+
baseURL: import_internal_utils14.configsByEnvironment[this.env].poaBridgeBaseURL,
|
|
994
1149
|
logger: args.logger
|
|
995
1150
|
});
|
|
996
1151
|
return { hash: withdrawalStatus.destinationTxHash };
|
|
@@ -1005,10 +1160,10 @@ var PoaBridge = class {
|
|
|
1005
1160
|
if (cached != null) {
|
|
1006
1161
|
return cached;
|
|
1007
1162
|
}
|
|
1008
|
-
const data = await
|
|
1163
|
+
const data = await import_internal_utils14.poaBridge.httpClient.getSupportedTokens(
|
|
1009
1164
|
{ chains },
|
|
1010
1165
|
{
|
|
1011
|
-
baseURL:
|
|
1166
|
+
baseURL: import_internal_utils14.configsByEnvironment[this.env].poaBridgeBaseURL,
|
|
1012
1167
|
logger
|
|
1013
1168
|
}
|
|
1014
1169
|
);
|
|
@@ -1030,7 +1185,7 @@ var PUBLIC_STELLAR_RPC_URLS = {
|
|
|
1030
1185
|
};
|
|
1031
1186
|
|
|
1032
1187
|
// src/intents/intent-executer-impl/intent-executer.ts
|
|
1033
|
-
var
|
|
1188
|
+
var import_internal_utils15 = require("@defuse-protocol/internal-utils");
|
|
1034
1189
|
|
|
1035
1190
|
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_u64.js
|
|
1036
1191
|
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
@@ -1411,7 +1566,7 @@ var IntentExecuter = class {
|
|
|
1411
1566
|
relayParams: relayParamsFactory,
|
|
1412
1567
|
...intentParams
|
|
1413
1568
|
}) {
|
|
1414
|
-
const verifyingContract =
|
|
1569
|
+
const verifyingContract = import_internal_utils15.configsByEnvironment[this.env].contractID;
|
|
1415
1570
|
let intentPayload = defaultIntentPayloadFactory({
|
|
1416
1571
|
verifying_contract: verifyingContract,
|
|
1417
1572
|
...intentParams
|
|
@@ -1461,7 +1616,7 @@ async function mergeIntentPayloads(basePayload, intentPayloadFactory) {
|
|
|
1461
1616
|
}
|
|
1462
1617
|
|
|
1463
1618
|
// src/intents/intent-relayer-impl/intent-relayer-public.ts
|
|
1464
|
-
var
|
|
1619
|
+
var import_internal_utils16 = require("@defuse-protocol/internal-utils");
|
|
1465
1620
|
var IntentRelayerPublic = class {
|
|
1466
1621
|
constructor({ env }) {
|
|
1467
1622
|
this.env = env;
|
|
@@ -1483,13 +1638,13 @@ var IntentRelayerPublic = class {
|
|
|
1483
1638
|
multiPayloads,
|
|
1484
1639
|
quoteHashes
|
|
1485
1640
|
}, ctx = {}) {
|
|
1486
|
-
const a = await
|
|
1641
|
+
const a = await import_internal_utils16.solverRelay.publishIntents(
|
|
1487
1642
|
{
|
|
1488
1643
|
quote_hashes: quoteHashes,
|
|
1489
1644
|
signed_datas: multiPayloads
|
|
1490
1645
|
},
|
|
1491
1646
|
{
|
|
1492
|
-
baseURL:
|
|
1647
|
+
baseURL: import_internal_utils16.configsByEnvironment[this.env].solverRelayBaseURL,
|
|
1493
1648
|
logger: ctx.logger
|
|
1494
1649
|
}
|
|
1495
1650
|
);
|
|
@@ -1499,10 +1654,10 @@ var IntentRelayerPublic = class {
|
|
|
1499
1654
|
throw a.unwrapErr();
|
|
1500
1655
|
}
|
|
1501
1656
|
async waitForSettlement(ticket, ctx = {}) {
|
|
1502
|
-
const result = await
|
|
1657
|
+
const result = await import_internal_utils16.solverRelay.waitForIntentSettlement({
|
|
1503
1658
|
intentHash: ticket,
|
|
1504
1659
|
signal: new AbortController().signal,
|
|
1505
|
-
baseURL:
|
|
1660
|
+
baseURL: import_internal_utils16.configsByEnvironment[this.env].solverRelayBaseURL,
|
|
1506
1661
|
logger: ctx.logger
|
|
1507
1662
|
});
|
|
1508
1663
|
return {
|
|
@@ -1510,7 +1665,7 @@ var IntentRelayerPublic = class {
|
|
|
1510
1665
|
hash: result.txHash,
|
|
1511
1666
|
// Usually relayer's account id is the verifying contract (`intents.near`),
|
|
1512
1667
|
// but it is not set in stone and may change in the future.
|
|
1513
|
-
accountId:
|
|
1668
|
+
accountId: import_internal_utils16.configsByEnvironment[this.env].contractID
|
|
1514
1669
|
}
|
|
1515
1670
|
};
|
|
1516
1671
|
}
|
|
@@ -1524,14 +1679,14 @@ var noopIntentSigner = {
|
|
|
1524
1679
|
};
|
|
1525
1680
|
|
|
1526
1681
|
// src/lib/array.ts
|
|
1527
|
-
var
|
|
1682
|
+
var import_internal_utils17 = require("@defuse-protocol/internal-utils");
|
|
1528
1683
|
function zip(arr1, arr2) {
|
|
1529
|
-
(0,
|
|
1684
|
+
(0, import_internal_utils17.assert)(arr1.length === arr2.length, "Arrays must have the same length");
|
|
1530
1685
|
return arr1.map((v, i) => [v, arr2[i]]);
|
|
1531
1686
|
}
|
|
1532
1687
|
|
|
1533
1688
|
// src/lib/configure-rpc-config.ts
|
|
1534
|
-
var
|
|
1689
|
+
var import_internal_utils18 = require("@defuse-protocol/internal-utils");
|
|
1535
1690
|
|
|
1536
1691
|
// src/lib/object.ts
|
|
1537
1692
|
function pick(obj, keys) {
|
|
@@ -1555,7 +1710,7 @@ function configureEvmRpcUrls(defaultRpcUrls, userRpcUrls, supportedChains) {
|
|
|
1555
1710
|
).map(([caip2, urls]) => [getEIP155ChainId(caip2), urls])
|
|
1556
1711
|
);
|
|
1557
1712
|
for (const [chainId, urls] of Object.entries(evmRpcUrls)) {
|
|
1558
|
-
(0,
|
|
1713
|
+
(0, import_internal_utils18.assert)(
|
|
1559
1714
|
urls.length > 0,
|
|
1560
1715
|
`EVM RPC URLs for chain ${chainId} are not provided`
|
|
1561
1716
|
);
|
|
@@ -1569,7 +1724,7 @@ function configureStellarRpcUrls(defaultRpcUrls, userRpcUrls) {
|
|
|
1569
1724
|
userRpcUrls?.[Chains.Stellar] ?? {}
|
|
1570
1725
|
);
|
|
1571
1726
|
for (const [key, value] of Object.entries(stellarRpcUrls)) {
|
|
1572
|
-
(0,
|
|
1727
|
+
(0, import_internal_utils18.assert)(value.length > 0, `Stellar RPC URL for ${key} is not provided`);
|
|
1573
1728
|
}
|
|
1574
1729
|
return stellarRpcUrls;
|
|
1575
1730
|
}
|
|
@@ -1581,7 +1736,7 @@ function createInternalTransferRoute() {
|
|
|
1581
1736
|
function createNearWithdrawalRoute(msg) {
|
|
1582
1737
|
return { route: RouteEnum.NearWithdrawal, msg };
|
|
1583
1738
|
}
|
|
1584
|
-
function
|
|
1739
|
+
function createOmniBridgeRoute() {
|
|
1585
1740
|
return { route: RouteEnum.OmniBridge };
|
|
1586
1741
|
}
|
|
1587
1742
|
function createVirtualChainRoute(auroraEngineContractId, proxyTokenContractId) {
|
|
@@ -1615,17 +1770,11 @@ function determineRouteConfig(sdk, withdrawalParams) {
|
|
|
1615
1770
|
const bridgeName = parseAssetId.bridgeName;
|
|
1616
1771
|
switch (bridgeName) {
|
|
1617
1772
|
case BridgeNameEnum.Hot:
|
|
1618
|
-
return
|
|
1619
|
-
route: RouteEnum.HotBridge,
|
|
1620
|
-
chain: parseAssetId.blockchain
|
|
1621
|
-
};
|
|
1773
|
+
return createHotBridgeRoute(parseAssetId.blockchain);
|
|
1622
1774
|
case BridgeNameEnum.Poa:
|
|
1623
|
-
return
|
|
1624
|
-
route: RouteEnum.PoaBridge,
|
|
1625
|
-
chain: parseAssetId.blockchain
|
|
1626
|
-
};
|
|
1775
|
+
return createPoaBridgeRoute(parseAssetId.blockchain);
|
|
1627
1776
|
case BridgeNameEnum.Omni:
|
|
1628
|
-
return
|
|
1777
|
+
return createOmniBridgeRoute();
|
|
1629
1778
|
case BridgeNameEnum.None:
|
|
1630
1779
|
return createNearWithdrawalRoute();
|
|
1631
1780
|
default:
|
|
@@ -1639,9 +1788,9 @@ var IntentsSDK = class {
|
|
|
1639
1788
|
constructor(args) {
|
|
1640
1789
|
this.env = args.env ?? "production";
|
|
1641
1790
|
this.referral = args.referral;
|
|
1642
|
-
const nearRpcUrls = args.rpc?.[Chains.Near] ??
|
|
1643
|
-
(0,
|
|
1644
|
-
const nearProvider = (0,
|
|
1791
|
+
const nearRpcUrls = args.rpc?.[Chains.Near] ?? import_internal_utils19.PUBLIC_NEAR_RPC_URLS;
|
|
1792
|
+
(0, import_internal_utils19.assert)(nearRpcUrls.length > 0, "NEAR RPC URLs are not provided");
|
|
1793
|
+
const nearProvider = (0, import_internal_utils19.nearFailoverRpcProvider)({ urls: nearRpcUrls });
|
|
1645
1794
|
const stellarRpcUrls = configureStellarRpcUrls(
|
|
1646
1795
|
PUBLIC_STELLAR_RPC_URLS,
|
|
1647
1796
|
args.rpc
|
|
@@ -1660,7 +1809,7 @@ var IntentsSDK = class {
|
|
|
1660
1809
|
new PoaBridge({ env: this.env }),
|
|
1661
1810
|
new HotBridge({
|
|
1662
1811
|
env: this.env,
|
|
1663
|
-
hotSdk: new
|
|
1812
|
+
hotSdk: new import_omni_sdk4.default.HotBridge({
|
|
1664
1813
|
logger: console,
|
|
1665
1814
|
evmRpc: evmRpcUrls,
|
|
1666
1815
|
// 1. HotBridge from omni-sdk does not support FailoverProvider.
|
|
@@ -1690,7 +1839,7 @@ var IntentsSDK = class {
|
|
|
1690
1839
|
}
|
|
1691
1840
|
async createWithdrawalIntents(args) {
|
|
1692
1841
|
for (const bridge of this.bridges) {
|
|
1693
|
-
if (bridge.supports(args.withdrawalParams)) {
|
|
1842
|
+
if (await bridge.supports(args.withdrawalParams)) {
|
|
1694
1843
|
const actualAmount = args.withdrawalParams.feeInclusive ? args.withdrawalParams.amount - args.feeEstimation.amount : args.withdrawalParams.amount;
|
|
1695
1844
|
await bridge.validateWithdrawal({
|
|
1696
1845
|
assetId: args.withdrawalParams.assetId,
|
|
@@ -1732,7 +1881,7 @@ var IntentsSDK = class {
|
|
|
1732
1881
|
}
|
|
1733
1882
|
async _estimateWithdrawalFee(args) {
|
|
1734
1883
|
for (const bridge of this.bridges) {
|
|
1735
|
-
if (bridge.supports(args.withdrawalParams)) {
|
|
1884
|
+
if (await bridge.supports(args.withdrawalParams)) {
|
|
1736
1885
|
const fee = await bridge.estimateWithdrawalFee({
|
|
1737
1886
|
withdrawalParams: args.withdrawalParams,
|
|
1738
1887
|
quoteOptions: args.quoteOptions,
|
|
@@ -1767,7 +1916,7 @@ var IntentsSDK = class {
|
|
|
1767
1916
|
const routeConfig = determineRouteConfig(this, w);
|
|
1768
1917
|
const route = routeConfig.route;
|
|
1769
1918
|
const index = indexes.get(route);
|
|
1770
|
-
(0,
|
|
1919
|
+
(0, import_internal_utils19.assert)(index != null, "Index is not found for route");
|
|
1771
1920
|
indexes.set(route, index + 1);
|
|
1772
1921
|
return {
|
|
1773
1922
|
routeConfig,
|
|
@@ -1801,7 +1950,7 @@ var IntentsSDK = class {
|
|
|
1801
1950
|
if (Array.isArray(args.withdrawalParams)) {
|
|
1802
1951
|
return result;
|
|
1803
1952
|
}
|
|
1804
|
-
(0,
|
|
1953
|
+
(0, import_internal_utils19.assert)(result.length === 1, "Unexpected result length");
|
|
1805
1954
|
return result[0];
|
|
1806
1955
|
}
|
|
1807
1956
|
parseAssetId(assetId) {
|
|
@@ -1815,7 +1964,7 @@ var IntentsSDK = class {
|
|
|
1815
1964
|
}
|
|
1816
1965
|
async signAndSendIntent(args) {
|
|
1817
1966
|
const intentSigner = args.signer ?? this.intentSigner;
|
|
1818
|
-
(0,
|
|
1967
|
+
(0, import_internal_utils19.assert)(intentSigner != null, "Intent signer is not provided");
|
|
1819
1968
|
const intentExecuter = new IntentExecuter({
|
|
1820
1969
|
env: this.env,
|
|
1821
1970
|
logger: args.logger,
|
|
@@ -1884,12 +2033,12 @@ var IntentsSDK = class {
|
|
|
1884
2033
|
intentHash,
|
|
1885
2034
|
logger
|
|
1886
2035
|
}) {
|
|
1887
|
-
return
|
|
2036
|
+
return import_internal_utils19.solverRelay.getStatus(
|
|
1888
2037
|
{
|
|
1889
2038
|
intent_hash: intentHash
|
|
1890
2039
|
},
|
|
1891
2040
|
{
|
|
1892
|
-
baseURL:
|
|
2041
|
+
baseURL: import_internal_utils19.configsByEnvironment[this.env].solverRelayBaseURL,
|
|
1893
2042
|
logger
|
|
1894
2043
|
}
|
|
1895
2044
|
);
|
|
@@ -1920,7 +2069,7 @@ var IntentsSDK = class {
|
|
|
1920
2069
|
withdrawalParams,
|
|
1921
2070
|
intentTx,
|
|
1922
2071
|
logger: args.logger,
|
|
1923
|
-
retryOptions:
|
|
2072
|
+
retryOptions: import_internal_utils19.RETRY_CONFIGS.FIVE_MINS_STEADY
|
|
1924
2073
|
});
|
|
1925
2074
|
if (!Array.isArray(args.withdrawalParams)) {
|
|
1926
2075
|
return {
|
|
@@ -1999,14 +2148,14 @@ var IntentSignerNearKeypair = class extends IntentSignerNEP413 {
|
|
|
1999
2148
|
};
|
|
2000
2149
|
|
|
2001
2150
|
// src/intents/intent-signer-impl/intent-signer-viem.ts
|
|
2002
|
-
var
|
|
2151
|
+
var import_internal_utils20 = require("@defuse-protocol/internal-utils");
|
|
2003
2152
|
var IntentSignerViem = class {
|
|
2004
2153
|
constructor(account) {
|
|
2005
2154
|
this.account = account;
|
|
2006
2155
|
}
|
|
2007
2156
|
async signIntent(intent) {
|
|
2008
2157
|
const payload = JSON.stringify({
|
|
2009
|
-
signer_id: intent.signer_id ??
|
|
2158
|
+
signer_id: intent.signer_id ?? import_internal_utils20.utils.authHandleToIntentsUserId({
|
|
2010
2159
|
identifier: this.account.address,
|
|
2011
2160
|
method: "evm"
|
|
2012
2161
|
}),
|
|
@@ -2024,7 +2173,7 @@ var IntentSignerViem = class {
|
|
|
2024
2173
|
return {
|
|
2025
2174
|
standard: "erc191",
|
|
2026
2175
|
payload,
|
|
2027
|
-
signature:
|
|
2176
|
+
signature: import_internal_utils20.utils.transformERC191Signature(signature)
|
|
2028
2177
|
};
|
|
2029
2178
|
}
|
|
2030
2179
|
};
|
|
@@ -2041,11 +2190,11 @@ function createIntentSignerViem(config) {
|
|
|
2041
2190
|
}
|
|
2042
2191
|
|
|
2043
2192
|
// index.ts
|
|
2044
|
-
var
|
|
2193
|
+
var import_internal_utils22 = require("@defuse-protocol/internal-utils");
|
|
2045
2194
|
|
|
2046
2195
|
// src/bridges/omni-bridge/error.ts
|
|
2047
|
-
var
|
|
2048
|
-
var OmniTransferNotFoundError = class extends
|
|
2196
|
+
var import_internal_utils21 = require("@defuse-protocol/internal-utils");
|
|
2197
|
+
var OmniTransferNotFoundError = class extends import_internal_utils21.BaseError {
|
|
2049
2198
|
constructor(txHash) {
|
|
2050
2199
|
super("Omni transfer with given hash is not found in the relayer.", {
|
|
2051
2200
|
metaMessages: [`OriginTxHash: ${txHash}`],
|
|
@@ -2054,7 +2203,7 @@ var OmniTransferNotFoundError = class extends import_internal_utils18.BaseError
|
|
|
2054
2203
|
this.txHash = txHash;
|
|
2055
2204
|
}
|
|
2056
2205
|
};
|
|
2057
|
-
var OmniTransferDestinationChainHashNotFoundError = class extends
|
|
2206
|
+
var OmniTransferDestinationChainHashNotFoundError = class extends import_internal_utils21.BaseError {
|
|
2058
2207
|
constructor(txHash, destinationChain) {
|
|
2059
2208
|
super("Relayer did not return destination chain hash for a transfer.", {
|
|
2060
2209
|
metaMessages: [
|
|
@@ -2067,7 +2216,7 @@ var OmniTransferDestinationChainHashNotFoundError = class extends import_interna
|
|
|
2067
2216
|
this.destinationChain = destinationChain;
|
|
2068
2217
|
}
|
|
2069
2218
|
};
|
|
2070
|
-
var TokenNotSupportedByOmniRelayerError = class extends
|
|
2219
|
+
var TokenNotSupportedByOmniRelayerError = class extends import_internal_utils21.BaseError {
|
|
2071
2220
|
constructor(token) {
|
|
2072
2221
|
super(`Omni Relayer doesn't accept fee in the transferred token ${token}`, {
|
|
2073
2222
|
metaMessages: [`Token: ${token}`],
|
|
@@ -2076,7 +2225,7 @@ var TokenNotSupportedByOmniRelayerError = class extends import_internal_utils18.
|
|
|
2076
2225
|
this.token = token;
|
|
2077
2226
|
}
|
|
2078
2227
|
};
|
|
2079
|
-
var TokenNotFoundInDestinationChainError = class extends
|
|
2228
|
+
var TokenNotFoundInDestinationChainError = class extends import_internal_utils21.BaseError {
|
|
2080
2229
|
constructor(token, chainKind) {
|
|
2081
2230
|
super(
|
|
2082
2231
|
`The token ${token} doesn't exist in destination network ${chainKind}`,
|
|
@@ -2090,10 +2239,10 @@ var TokenNotFoundInDestinationChainError = class extends import_internal_utils18
|
|
|
2090
2239
|
};
|
|
2091
2240
|
|
|
2092
2241
|
// index.ts
|
|
2093
|
-
var import_internal_utils20 = require("@defuse-protocol/internal-utils");
|
|
2094
|
-
var import_internal_utils21 = require("@defuse-protocol/internal-utils");
|
|
2095
|
-
var import_internal_utils22 = require("@defuse-protocol/internal-utils");
|
|
2096
2242
|
var import_internal_utils23 = require("@defuse-protocol/internal-utils");
|
|
2243
|
+
var import_internal_utils24 = require("@defuse-protocol/internal-utils");
|
|
2244
|
+
var import_internal_utils25 = require("@defuse-protocol/internal-utils");
|
|
2245
|
+
var import_internal_utils26 = require("@defuse-protocol/internal-utils");
|
|
2097
2246
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2098
2247
|
0 && (module.exports = {
|
|
2099
2248
|
AssertionError,
|
|
@@ -2121,6 +2270,7 @@ var import_internal_utils23 = require("@defuse-protocol/internal-utils");
|
|
|
2121
2270
|
TokenNotFoundInDestinationChainError,
|
|
2122
2271
|
TokenNotSupportedByOmniRelayerError,
|
|
2123
2272
|
TrustlineNotFoundError,
|
|
2273
|
+
UnsupportedAssetIdError,
|
|
2124
2274
|
UnsupportedDestinationMemoError,
|
|
2125
2275
|
createDefaultRoute,
|
|
2126
2276
|
createHotBridgeRoute,
|
|
@@ -2129,7 +2279,7 @@ var import_internal_utils23 = require("@defuse-protocol/internal-utils");
|
|
|
2129
2279
|
createIntentSignerViem,
|
|
2130
2280
|
createInternalTransferRoute,
|
|
2131
2281
|
createNearWithdrawalRoute,
|
|
2132
|
-
|
|
2282
|
+
createOmniBridgeRoute,
|
|
2133
2283
|
createPoaBridgeRoute,
|
|
2134
2284
|
createVirtualChainRoute
|
|
2135
2285
|
});
|