@cowprotocol/sdk-bridging 4.1.2 → 4.2.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/index.js CHANGED
@@ -236,7 +236,7 @@ async function getCrossChainOrder(params) {
236
236
  // src/BridgingSdk/BridgingSdk.ts
237
237
  var import_sdk_trading2 = require("@cowprotocol/sdk-trading");
238
238
  var import_sdk_order_book3 = require("@cowprotocol/sdk-order-book");
239
- var import_sdk_config3 = require("@cowprotocol/sdk-config");
239
+ var import_sdk_config4 = require("@cowprotocol/sdk-config");
240
240
  var import_sdk_common8 = require("@cowprotocol/sdk-common");
241
241
 
242
242
  // src/BridgingSdk/helpers.ts
@@ -313,6 +313,7 @@ function getHookMockForCostEstimation(gasLimit) {
313
313
  var import_sdk_common6 = require("@cowprotocol/sdk-common");
314
314
 
315
315
  // src/BridgingSdk/determineIntermediateToken.ts
316
+ var import_sdk_config3 = require("@cowprotocol/sdk-config");
316
317
  var import_sdk_common5 = require("@cowprotocol/sdk-common");
317
318
 
318
319
  // src/BridgingSdk/tokenPriority.ts
@@ -320,72 +321,161 @@ var import_sdk_config2 = require("@cowprotocol/sdk-config");
320
321
  var import_sdk_common4 = require("@cowprotocol/sdk-common");
321
322
  var PRIORITY_STABLECOIN_TOKENS = {
322
323
  [import_sdk_config2.SupportedChainId.MAINNET]: /* @__PURE__ */ new Set([
323
- "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
324
- // USDC
325
- "0xdac17f958d2ee523a2206206994597c13d831ec7"
326
- // USDT
324
+ {
325
+ chainId: import_sdk_config2.SupportedChainId.MAINNET,
326
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
327
+ decimals: 6,
328
+ symbol: "USDC"
329
+ },
330
+ {
331
+ chainId: import_sdk_config2.SupportedChainId.MAINNET,
332
+ address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
333
+ decimals: 6,
334
+ symbol: "USDT"
335
+ }
327
336
  ]),
328
337
  [import_sdk_config2.SupportedChainId.BNB]: /* @__PURE__ */ new Set([
329
- "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
330
- // USDC
331
- "0x55d398326f99059ff775485246999027b3197955"
332
- // USDT
338
+ {
339
+ chainId: import_sdk_config2.SupportedChainId.BNB,
340
+ address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
341
+ decimals: 18,
342
+ symbol: "USDC"
343
+ },
344
+ {
345
+ chainId: import_sdk_config2.SupportedChainId.BNB,
346
+ address: "0x55d398326f99059ff775485246999027b3197955",
347
+ decimals: 18,
348
+ symbol: "USDT"
349
+ }
333
350
  ]),
334
351
  [import_sdk_config2.SupportedChainId.GNOSIS_CHAIN]: /* @__PURE__ */ new Set([
335
- "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
336
- // USDC
337
- "0x2a22f9c3b484c3629090feed35f17ff8f88f76f0",
338
- // USDC.e
339
- "0x4ecaba5870353805a9f068101a40e0f32ed605c6"
340
- // USDT
352
+ {
353
+ chainId: import_sdk_config2.SupportedChainId.GNOSIS_CHAIN,
354
+ address: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
355
+ decimals: 6,
356
+ symbol: "USDC"
357
+ },
358
+ {
359
+ chainId: import_sdk_config2.SupportedChainId.GNOSIS_CHAIN,
360
+ address: "0x2a22f9c3b484c3629090feed35f17ff8f88f76f0",
361
+ decimals: 6,
362
+ symbol: "USDC.e"
363
+ },
364
+ {
365
+ chainId: import_sdk_config2.SupportedChainId.GNOSIS_CHAIN,
366
+ address: "0x4ecaba5870353805a9f068101a40e0f32ed605c6",
367
+ decimals: 6,
368
+ symbol: "USDT"
369
+ }
341
370
  ]),
342
371
  [import_sdk_config2.SupportedChainId.POLYGON]: /* @__PURE__ */ new Set([
343
- "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
344
- // USDC
345
- "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"
346
- // USDT
372
+ {
373
+ chainId: import_sdk_config2.SupportedChainId.POLYGON,
374
+ address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
375
+ decimals: 6,
376
+ symbol: "USDC"
377
+ },
378
+ {
379
+ chainId: import_sdk_config2.SupportedChainId.POLYGON,
380
+ address: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
381
+ decimals: 6,
382
+ symbol: "USDT"
383
+ }
347
384
  ]),
348
385
  [import_sdk_config2.SupportedChainId.BASE]: /* @__PURE__ */ new Set([
349
- "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
350
- // USDC
351
- "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2"
352
- // USDT
386
+ {
387
+ chainId: import_sdk_config2.SupportedChainId.BASE,
388
+ address: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
389
+ decimals: 6,
390
+ symbol: "USDC"
391
+ },
392
+ {
393
+ chainId: import_sdk_config2.SupportedChainId.BASE,
394
+ address: "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2",
395
+ decimals: 6,
396
+ symbol: "USDT"
397
+ }
353
398
  ]),
354
399
  [import_sdk_config2.SupportedChainId.ARBITRUM_ONE]: /* @__PURE__ */ new Set([
355
- "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
356
- // USDC
357
- "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
358
- // USDT
400
+ {
401
+ chainId: import_sdk_config2.SupportedChainId.ARBITRUM_ONE,
402
+ address: "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
403
+ decimals: 6,
404
+ symbol: "USDC"
405
+ },
406
+ {
407
+ chainId: import_sdk_config2.SupportedChainId.ARBITRUM_ONE,
408
+ address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
409
+ decimals: 6,
410
+ symbol: "USDT"
411
+ }
359
412
  ]),
360
413
  [import_sdk_config2.SupportedChainId.AVALANCHE]: /* @__PURE__ */ new Set([
361
- "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
362
- // USDC
363
- "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7"
364
- // USDT
414
+ {
415
+ chainId: import_sdk_config2.SupportedChainId.AVALANCHE,
416
+ address: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
417
+ decimals: 6,
418
+ symbol: "USDC"
419
+ },
420
+ {
421
+ chainId: import_sdk_config2.SupportedChainId.AVALANCHE,
422
+ address: "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
423
+ decimals: 6,
424
+ symbol: "USDT"
425
+ }
365
426
  ]),
366
427
  [import_sdk_config2.SupportedChainId.LINEA]: /* @__PURE__ */ new Set([
367
- "0x176211869ca2b568f2a7d4ee941e073a821ee1ff",
368
- // USDC
369
- "0xa219439258ca9da29e9cc4ce5596924745e12b93"
370
- // USDT
428
+ {
429
+ chainId: import_sdk_config2.SupportedChainId.LINEA,
430
+ address: "0x176211869ca2b568f2a7d4ee941e073a821ee1ff",
431
+ decimals: 6,
432
+ symbol: "USDC"
433
+ },
434
+ {
435
+ chainId: import_sdk_config2.SupportedChainId.LINEA,
436
+ address: "0xa219439258ca9da29e9cc4ce5596924745e12b93",
437
+ decimals: 6,
438
+ symbol: "USDT"
439
+ }
371
440
  ]),
372
441
  [import_sdk_config2.SupportedChainId.SEPOLIA]: /* @__PURE__ */ new Set([
373
- "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238"
374
- // USDC
442
+ {
443
+ chainId: import_sdk_config2.SupportedChainId.SEPOLIA,
444
+ address: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
445
+ decimals: 6,
446
+ symbol: "USDC"
447
+ }
375
448
  ])
376
449
  };
377
- function isStablecoinPriorityToken(chainId, tokenAddress) {
450
+ function getStablecoinPriorityToken(chainId, tokenAddress) {
378
451
  const chainTokens = PRIORITY_STABLECOIN_TOKENS[chainId];
379
452
  if (!chainTokens)
380
- return false;
381
- return chainTokens.has((0, import_sdk_common4.getAddressKey)(tokenAddress));
453
+ return void 0;
454
+ const key = (0, import_sdk_common4.getAddressKey)(tokenAddress);
455
+ for (const token of chainTokens) {
456
+ if ((0, import_sdk_common4.getAddressKey)(token.address) === key)
457
+ return token;
458
+ }
459
+ return void 0;
460
+ }
461
+ function isStablecoinPriorityToken(chainId, tokenAddress) {
462
+ return getStablecoinPriorityToken(chainId, tokenAddress) !== void 0;
382
463
  }
383
464
  function isCorrelatedToken(tokenAddress, correlatedTokens) {
384
465
  return correlatedTokens.has((0, import_sdk_common4.getAddressKey)(tokenAddress));
385
466
  }
386
467
 
387
468
  // src/BridgingSdk/determineIntermediateToken.ts
388
- async function determineIntermediateToken(sourceChainId, sourceTokenAddress, intermediateTokens, getCorrelatedTokens, allowIntermediateEqSellToken) {
469
+ async function determineIntermediateToken(context) {
470
+ const {
471
+ sourceChainId,
472
+ sourceTokenAddress,
473
+ destinationChainId,
474
+ destinationTokenAddress,
475
+ intermediateTokens,
476
+ getCorrelatedTokens,
477
+ allowIntermediateEqSellToken
478
+ } = context;
389
479
  const firstToken = intermediateTokens[0];
390
480
  if (intermediateTokens.length === 0 || !firstToken) {
391
481
  throw new BridgeProviderQuoteError("NO_INTERMEDIATE_TOKENS" /* NO_INTERMEDIATE_TOKENS */, { intermediateTokens });
@@ -394,26 +484,29 @@ async function determineIntermediateToken(sourceChainId, sourceTokenAddress, int
394
484
  return firstToken;
395
485
  }
396
486
  const correlatedTokens = await resolveCorrelatedTokens(sourceChainId, getCorrelatedTokens);
397
- const sellTokenLike = { chainId: sourceChainId, address: sourceTokenAddress };
398
- const isSellNativeOrWrapped = (0, import_sdk_common5.isNativeToken)(sellTokenLike) || (0, import_sdk_common5.isWrappedNativeToken)(sellTokenLike);
399
487
  const filteredTokens = allowIntermediateEqSellToken ? intermediateTokens : intermediateTokens.filter((token) => !(0, import_sdk_common5.areAddressesEqual)(token.address, sourceTokenAddress));
488
+ const destinationStableCoin = (0, import_sdk_config3.isSupportedChain)(destinationChainId) ? getStablecoinPriorityToken(destinationChainId, destinationTokenAddress) : void 0;
400
489
  const tokensWithPriority = filteredTokens.map((token) => {
401
- const isNativeOrWrapped = (0, import_sdk_common5.isNativeToken)(token) || (0, import_sdk_common5.isWrappedNativeToken)(token);
402
- if ((0, import_sdk_common5.areAddressesEqual)(token.address, sourceTokenAddress)) {
403
- if (!(isSellNativeOrWrapped && isNativeOrWrapped)) {
404
- return { token, priority: 5 /* HIGHEST */ };
490
+ const isStableCoin = isStablecoinPriorityToken(token.chainId, token.address);
491
+ if (destinationStableCoin && isStableCoin) {
492
+ const matchesDestinationTokenSymbol = !!token.symbol && token.symbol.toLowerCase() === destinationStableCoin?.symbol?.toLowerCase();
493
+ if (matchesDestinationTokenSymbol) {
494
+ return { token, priority: 6 /* STABLECOIN_MATCHES_DESTINATION */ };
405
495
  }
406
496
  }
407
- if (isStablecoinPriorityToken(token.chainId, token.address)) {
408
- return { token, priority: 4 /* HIGH */ };
497
+ if ((0, import_sdk_common5.areAddressesEqual)(token.address, sourceTokenAddress)) {
498
+ return { token, priority: 5 /* MATCHES_SELL */ };
499
+ }
500
+ if (isStableCoin) {
501
+ return { token, priority: 4 /* STABLECOIN */ };
409
502
  }
410
503
  if (isCorrelatedToken(token.address, correlatedTokens)) {
411
- return { token, priority: 3 /* MEDIUM */ };
504
+ return { token, priority: 3 /* CORRELATED */ };
412
505
  }
413
- if ((0, import_sdk_common5.isNativeToken)(token) && !isSellNativeOrWrapped) {
414
- return { token, priority: 2 /* LOW */ };
506
+ if ((0, import_sdk_common5.isNativeToken)(token)) {
507
+ return { token, priority: 2 /* NATIVE */ };
415
508
  }
416
- return { token, priority: 1 /* LOWEST */ };
509
+ return { token, priority: 1 /* OTHER */ };
417
510
  });
418
511
  tokensWithPriority.sort((a, b) => {
419
512
  if (a.priority !== b.priority) {
@@ -468,13 +561,15 @@ async function getIntermediateSwapResult({
468
561
  quoteBridgeRequest: swapAndBridgeRequest,
469
562
  intermediateTokensCache: params.intermediateTokensCache
470
563
  });
471
- const intermediateToken = await determineIntermediateToken(
472
- sellTokenChainId,
473
- sellTokenAddress,
564
+ const intermediateToken = await determineIntermediateToken({
565
+ sourceChainId: sellTokenChainId,
566
+ sourceTokenAddress: sellTokenAddress,
567
+ destinationChainId: buyTokenChainId,
568
+ destinationTokenAddress: buyTokenAddress,
474
569
  intermediateTokens,
475
- params.advancedSettings?.getCorrelatedTokens,
570
+ getCorrelatedTokens: params.advancedSettings?.getCorrelatedTokens,
476
571
  allowIntermediateEqSellToken
477
- );
572
+ });
478
573
  (0, import_sdk_common6.log)(`Using ${intermediateToken?.name ?? intermediateToken?.address} as intermediate tokens`);
479
574
  const bridgeRequestWithoutAmount = {
480
575
  ...swapAndBridgeRequest,
@@ -1262,7 +1357,7 @@ var BridgingSdk = class {
1262
1357
  * Get the available sources networks for the bridging.
1263
1358
  */
1264
1359
  async getSourceNetworks() {
1265
- return import_sdk_config3.ALL_SUPPORTED_CHAINS;
1360
+ return import_sdk_config4.ALL_SUPPORTED_CHAINS;
1266
1361
  }
1267
1362
  /**
1268
1363
  * Get the available target networks for the bridging.
@@ -1558,56 +1653,56 @@ var COW_TRADE_EVENT_INTERFACE = () => {
1558
1653
  };
1559
1654
 
1560
1655
  // src/providers/across/const/contracts.ts
1561
- var import_sdk_config4 = require("@cowprotocol/sdk-config");
1656
+ var import_sdk_config5 = require("@cowprotocol/sdk-config");
1562
1657
  var ACROSS_SPOOK_CONTRACT_ADDRESSES = {
1563
1658
  // https://docs.across.to/reference/contract-addresses/mainnet-chain-id-1
1564
- [import_sdk_config4.SupportedChainId.MAINNET]: "0x5c7BCd6E7De5423a257D81B442095A1a6ced35C5",
1659
+ [import_sdk_config5.SupportedChainId.MAINNET]: "0x5c7BCd6E7De5423a257D81B442095A1a6ced35C5",
1565
1660
  // https://docs.across.to/reference/contract-addresses/arbitrum-chain-id-42161-1
1566
- [import_sdk_config4.SupportedChainId.ARBITRUM_ONE]: "0xe35e9842fceaca96570b734083f4a58e8f7c5f2a",
1661
+ [import_sdk_config5.SupportedChainId.ARBITRUM_ONE]: "0xe35e9842fceaca96570b734083f4a58e8f7c5f2a",
1567
1662
  // https://docs.across.to/reference/contract-addresses/base-chain-id-8453
1568
- [import_sdk_config4.SupportedChainId.BASE]: "0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64",
1663
+ [import_sdk_config5.SupportedChainId.BASE]: "0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64",
1569
1664
  // // https://docs.across.to/reference/contract-addresses/mainnet-chain-id-1
1570
- [import_sdk_config4.SupportedChainId.SEPOLIA]: "0x5ef6C01E11889d86803e0B23e3cB3F9E9d97B662",
1665
+ [import_sdk_config5.SupportedChainId.SEPOLIA]: "0x5ef6C01E11889d86803e0B23e3cB3F9E9d97B662",
1571
1666
  // https://docs.across.to/reference/contract-addresses/polygon-chain-id-137
1572
- [import_sdk_config4.SupportedChainId.POLYGON]: "0x9295ee1d8C5b022Be115A2AD3c30C72E34e7F096",
1667
+ [import_sdk_config5.SupportedChainId.POLYGON]: "0x9295ee1d8C5b022Be115A2AD3c30C72E34e7F096",
1573
1668
  // https://docs.across.to/reference/contract-addresses/bnb-smart-chain
1574
- [import_sdk_config4.SupportedChainId.BNB]: "0x4e8E101924eDE233C13e2D8622DC8aED2872d505",
1669
+ [import_sdk_config5.SupportedChainId.BNB]: "0x4e8E101924eDE233C13e2D8622DC8aED2872d505",
1575
1670
  // https://docs.across.to/reference/contract-addresses/linea-chain-id-59144
1576
- [import_sdk_config4.SupportedChainId.LINEA]: "0x7E63A5f1a8F0B4d0934B2f2327DAED3F6bb2ee75",
1671
+ [import_sdk_config5.SupportedChainId.LINEA]: "0x7E63A5f1a8F0B4d0934B2f2327DAED3F6bb2ee75",
1577
1672
  // https://docs.across.to/reference/contract-addresses/plasma
1578
- [import_sdk_config4.SupportedChainId.PLASMA]: "0x50039fAEfebef707cFD94D6d462fE6D10B39207a",
1673
+ [import_sdk_config5.SupportedChainId.PLASMA]: "0x50039fAEfebef707cFD94D6d462fE6D10B39207a",
1579
1674
  // https://docs.across.to/reference/contract-addresses/ink-chain-id-57073
1580
- [import_sdk_config4.SupportedChainId.INK]: "0xeF684C38F94F48775959ECf2012D7E864ffb9dd4",
1675
+ [import_sdk_config5.SupportedChainId.INK]: "0xeF684C38F94F48775959ECf2012D7E864ffb9dd4",
1581
1676
  // https://docs.across.to/reference/contract-addresses/optimism-chain-id-10
1582
- [import_sdk_config4.AdditionalTargetChainId.OPTIMISM]: "0x6f26Bf09B1C792e3228e5467807a900A503c0281",
1677
+ [import_sdk_config5.AdditionalTargetChainId.OPTIMISM]: "0x6f26Bf09B1C792e3228e5467807a900A503c0281",
1583
1678
  // Not supported chains
1584
1679
  // TODO: This first integration is a draft, some of this chains might be supported, so we will need to update here as we iterate on the provider
1585
- [import_sdk_config4.SupportedChainId.GNOSIS_CHAIN]: void 0,
1586
- [import_sdk_config4.SupportedChainId.AVALANCHE]: void 0,
1587
- [import_sdk_config4.AdditionalTargetChainId.BITCOIN]: void 0,
1588
- [import_sdk_config4.SupportedChainId.SOLANA]: void 0
1680
+ [import_sdk_config5.SupportedChainId.GNOSIS_CHAIN]: void 0,
1681
+ [import_sdk_config5.SupportedChainId.AVALANCHE]: void 0,
1682
+ [import_sdk_config5.AdditionalTargetChainId.BITCOIN]: void 0,
1683
+ [import_sdk_config5.SupportedChainId.SOLANA]: void 0
1589
1684
  };
1590
1685
  var ACROSS_MATH_CONTRACT_ADDRESSES = {
1591
- [import_sdk_config4.SupportedChainId.MAINNET]: "0xf2ae6728b6f146556977Af0A68bFbf5bADA22863",
1592
- [import_sdk_config4.SupportedChainId.ARBITRUM_ONE]: "0x5771A4b4029832e79a75De7B485E5fBbec28848f",
1593
- [import_sdk_config4.SupportedChainId.BASE]: "0xd4e943dc6ddc885f6229ce33c2e3dfe402a12c81",
1686
+ [import_sdk_config5.SupportedChainId.MAINNET]: "0xf2ae6728b6f146556977Af0A68bFbf5bADA22863",
1687
+ [import_sdk_config5.SupportedChainId.ARBITRUM_ONE]: "0x5771A4b4029832e79a75De7B485E5fBbec28848f",
1688
+ [import_sdk_config5.SupportedChainId.BASE]: "0xd4e943dc6ddc885f6229ce33c2e3dfe402a12c81",
1594
1689
  // Not supported chains
1595
1690
  // TODO: This first integration is a draft, some of this chains might be supported, so we will need to update here as we iterate on the provider
1596
- [import_sdk_config4.SupportedChainId.GNOSIS_CHAIN]: void 0,
1597
- [import_sdk_config4.SupportedChainId.SEPOLIA]: void 0,
1598
- [import_sdk_config4.SupportedChainId.POLYGON]: void 0,
1599
- [import_sdk_config4.SupportedChainId.AVALANCHE]: void 0,
1600
- [import_sdk_config4.SupportedChainId.BNB]: void 0,
1691
+ [import_sdk_config5.SupportedChainId.GNOSIS_CHAIN]: void 0,
1692
+ [import_sdk_config5.SupportedChainId.SEPOLIA]: void 0,
1693
+ [import_sdk_config5.SupportedChainId.POLYGON]: void 0,
1694
+ [import_sdk_config5.SupportedChainId.AVALANCHE]: void 0,
1695
+ [import_sdk_config5.SupportedChainId.BNB]: void 0,
1601
1696
  // TODO: confirm
1602
- [import_sdk_config4.SupportedChainId.LINEA]: void 0,
1697
+ [import_sdk_config5.SupportedChainId.LINEA]: void 0,
1603
1698
  // TODO: confirm
1604
- [import_sdk_config4.SupportedChainId.PLASMA]: void 0,
1699
+ [import_sdk_config5.SupportedChainId.PLASMA]: void 0,
1605
1700
  // TODO: confirm
1606
- [import_sdk_config4.SupportedChainId.INK]: void 0,
1701
+ [import_sdk_config5.SupportedChainId.INK]: void 0,
1607
1702
  // TODO: confirm
1608
- [import_sdk_config4.AdditionalTargetChainId.OPTIMISM]: void 0,
1609
- [import_sdk_config4.AdditionalTargetChainId.BITCOIN]: void 0,
1610
- [import_sdk_config4.SupportedChainId.SOLANA]: void 0
1703
+ [import_sdk_config5.AdditionalTargetChainId.OPTIMISM]: void 0,
1704
+ [import_sdk_config5.AdditionalTargetChainId.BITCOIN]: void 0,
1705
+ [import_sdk_config5.SupportedChainId.SOLANA]: void 0
1611
1706
  };
1612
1707
 
1613
1708
  // src/providers/across/util.ts
@@ -3677,11 +3772,11 @@ async function getGasLimitEstimationForHook({
3677
3772
 
3678
3773
  // src/providers/across/AcrossBridgeProvider.ts
3679
3774
  var import_sdk_common15 = require("@cowprotocol/sdk-common");
3680
- var import_sdk_config5 = require("@cowprotocol/sdk-config");
3775
+ var import_sdk_config6 = require("@cowprotocol/sdk-config");
3681
3776
  var import_sdk_cow_shed = require("@cowprotocol/sdk-cow-shed");
3682
3777
  var import_sdk_order_book5 = require("@cowprotocol/sdk-order-book");
3683
3778
  var ACROSS_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/across`;
3684
- var ACROSS_SUPPORTED_NETWORKS = [import_sdk_config5.mainnet, import_sdk_config5.polygon, import_sdk_config5.arbitrumOne, import_sdk_config5.base, import_sdk_config5.optimism];
3779
+ var ACROSS_SUPPORTED_NETWORKS = [import_sdk_config6.mainnet, import_sdk_config6.polygon, import_sdk_config6.arbitrumOne, import_sdk_config6.base, import_sdk_config6.optimism];
3685
3780
  var SLIPPAGE_TOLERANCE_BPS = 0;
3686
3781
  var providerType = "HookBridgeProvider";
3687
3782
  var AcrossBridgeProvider = class {
@@ -3788,7 +3883,7 @@ var AcrossBridgeProvider = class {
3788
3883
  throw new Error("Not implemented");
3789
3884
  }
3790
3885
  async getBridgingParams(chainId, order, txHash, settlementContractOverride) {
3791
- if (!(0, import_sdk_config5.isSupportedChain)(chainId)) {
3886
+ if (!(0, import_sdk_config6.isSupportedChain)(chainId)) {
3792
3887
  return null;
3793
3888
  }
3794
3889
  const orderUid = order.uid;
@@ -4034,69 +4129,69 @@ var getBungeeBridgeFromDisplayName = (displayName) => {
4034
4129
  };
4035
4130
 
4036
4131
  // src/providers/bungee/const/contracts.ts
4037
- var import_sdk_config6 = require("@cowprotocol/sdk-config");
4132
+ var import_sdk_config7 = require("@cowprotocol/sdk-config");
4038
4133
  var BUNGEE_COWSWAP_LIB_ADDRESS = "0x75b6ba5fcab20848ca00f132d253638fea82e598";
4039
4134
  var BungeeCowswapLibAddresses = {
4040
- [import_sdk_config6.SupportedChainId.MAINNET]: BUNGEE_COWSWAP_LIB_ADDRESS,
4041
- [import_sdk_config6.SupportedChainId.GNOSIS_CHAIN]: BUNGEE_COWSWAP_LIB_ADDRESS,
4042
- [import_sdk_config6.SupportedChainId.ARBITRUM_ONE]: BUNGEE_COWSWAP_LIB_ADDRESS,
4043
- [import_sdk_config6.SupportedChainId.BASE]: BUNGEE_COWSWAP_LIB_ADDRESS,
4044
- [import_sdk_config6.SupportedChainId.AVALANCHE]: BUNGEE_COWSWAP_LIB_ADDRESS,
4045
- [import_sdk_config6.SupportedChainId.POLYGON]: BUNGEE_COWSWAP_LIB_ADDRESS,
4046
- [import_sdk_config6.SupportedChainId.BNB]: void 0,
4135
+ [import_sdk_config7.SupportedChainId.MAINNET]: BUNGEE_COWSWAP_LIB_ADDRESS,
4136
+ [import_sdk_config7.SupportedChainId.GNOSIS_CHAIN]: BUNGEE_COWSWAP_LIB_ADDRESS,
4137
+ [import_sdk_config7.SupportedChainId.ARBITRUM_ONE]: BUNGEE_COWSWAP_LIB_ADDRESS,
4138
+ [import_sdk_config7.SupportedChainId.BASE]: BUNGEE_COWSWAP_LIB_ADDRESS,
4139
+ [import_sdk_config7.SupportedChainId.AVALANCHE]: BUNGEE_COWSWAP_LIB_ADDRESS,
4140
+ [import_sdk_config7.SupportedChainId.POLYGON]: BUNGEE_COWSWAP_LIB_ADDRESS,
4141
+ [import_sdk_config7.SupportedChainId.BNB]: void 0,
4047
4142
  // TODO: confirm
4048
- [import_sdk_config6.SupportedChainId.LINEA]: void 0,
4143
+ [import_sdk_config7.SupportedChainId.LINEA]: void 0,
4049
4144
  // TODO: confirm
4050
- [import_sdk_config6.SupportedChainId.PLASMA]: void 0,
4145
+ [import_sdk_config7.SupportedChainId.PLASMA]: void 0,
4051
4146
  // TODO: confirm
4052
- [import_sdk_config6.SupportedChainId.INK]: void 0,
4147
+ [import_sdk_config7.SupportedChainId.INK]: void 0,
4053
4148
  // TODO: confirm
4054
- [import_sdk_config6.SupportedChainId.SEPOLIA]: void 0,
4055
- [import_sdk_config6.AdditionalTargetChainId.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS,
4056
- [import_sdk_config6.AdditionalTargetChainId.BITCOIN]: void 0,
4057
- [import_sdk_config6.SupportedChainId.SOLANA]: void 0
4149
+ [import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
4150
+ [import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS,
4151
+ [import_sdk_config7.AdditionalTargetChainId.BITCOIN]: void 0,
4152
+ [import_sdk_config7.SupportedChainId.SOLANA]: void 0
4058
4153
  };
4059
4154
  var SOCKET_VERIFIER_ADDRESS = "0xa27A3f5A96DF7D8Be26EE2790999860C00eb688D";
4060
4155
  var SocketVerifierAddresses = {
4061
- [import_sdk_config6.SupportedChainId.MAINNET]: SOCKET_VERIFIER_ADDRESS,
4062
- [import_sdk_config6.SupportedChainId.GNOSIS_CHAIN]: SOCKET_VERIFIER_ADDRESS,
4063
- [import_sdk_config6.SupportedChainId.ARBITRUM_ONE]: SOCKET_VERIFIER_ADDRESS,
4064
- [import_sdk_config6.SupportedChainId.BASE]: SOCKET_VERIFIER_ADDRESS,
4065
- [import_sdk_config6.SupportedChainId.AVALANCHE]: SOCKET_VERIFIER_ADDRESS,
4066
- [import_sdk_config6.SupportedChainId.POLYGON]: SOCKET_VERIFIER_ADDRESS,
4067
- [import_sdk_config6.SupportedChainId.BNB]: void 0,
4156
+ [import_sdk_config7.SupportedChainId.MAINNET]: SOCKET_VERIFIER_ADDRESS,
4157
+ [import_sdk_config7.SupportedChainId.GNOSIS_CHAIN]: SOCKET_VERIFIER_ADDRESS,
4158
+ [import_sdk_config7.SupportedChainId.ARBITRUM_ONE]: SOCKET_VERIFIER_ADDRESS,
4159
+ [import_sdk_config7.SupportedChainId.BASE]: SOCKET_VERIFIER_ADDRESS,
4160
+ [import_sdk_config7.SupportedChainId.AVALANCHE]: SOCKET_VERIFIER_ADDRESS,
4161
+ [import_sdk_config7.SupportedChainId.POLYGON]: SOCKET_VERIFIER_ADDRESS,
4162
+ [import_sdk_config7.SupportedChainId.BNB]: void 0,
4068
4163
  // TODO: confirm
4069
- [import_sdk_config6.SupportedChainId.LINEA]: void 0,
4164
+ [import_sdk_config7.SupportedChainId.LINEA]: void 0,
4070
4165
  // TODO: confirm
4071
- [import_sdk_config6.SupportedChainId.PLASMA]: void 0,
4166
+ [import_sdk_config7.SupportedChainId.PLASMA]: void 0,
4072
4167
  // TODO: confirm
4073
- [import_sdk_config6.SupportedChainId.INK]: void 0,
4168
+ [import_sdk_config7.SupportedChainId.INK]: void 0,
4074
4169
  // TODO: confirm
4075
- [import_sdk_config6.SupportedChainId.SEPOLIA]: void 0,
4076
- [import_sdk_config6.AdditionalTargetChainId.OPTIMISM]: SOCKET_VERIFIER_ADDRESS,
4077
- [import_sdk_config6.AdditionalTargetChainId.BITCOIN]: void 0,
4078
- [import_sdk_config6.SupportedChainId.SOLANA]: void 0
4170
+ [import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
4171
+ [import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: SOCKET_VERIFIER_ADDRESS,
4172
+ [import_sdk_config7.AdditionalTargetChainId.BITCOIN]: void 0,
4173
+ [import_sdk_config7.SupportedChainId.SOLANA]: void 0
4079
4174
  };
4080
4175
  var BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS = "0xD06a673fe1fa27B1b9E5BA0be980AB15Dbce85cc";
4081
4176
  var BungeeApproveAndBridgeV1Addresses = {
4082
- [import_sdk_config6.SupportedChainId.MAINNET]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4083
- [import_sdk_config6.SupportedChainId.GNOSIS_CHAIN]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4084
- [import_sdk_config6.SupportedChainId.ARBITRUM_ONE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4085
- [import_sdk_config6.SupportedChainId.BASE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4086
- [import_sdk_config6.SupportedChainId.AVALANCHE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4087
- [import_sdk_config6.SupportedChainId.POLYGON]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4088
- [import_sdk_config6.SupportedChainId.BNB]: void 0,
4177
+ [import_sdk_config7.SupportedChainId.MAINNET]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4178
+ [import_sdk_config7.SupportedChainId.GNOSIS_CHAIN]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4179
+ [import_sdk_config7.SupportedChainId.ARBITRUM_ONE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4180
+ [import_sdk_config7.SupportedChainId.BASE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4181
+ [import_sdk_config7.SupportedChainId.AVALANCHE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4182
+ [import_sdk_config7.SupportedChainId.POLYGON]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4183
+ [import_sdk_config7.SupportedChainId.BNB]: void 0,
4089
4184
  // TODO: confirm
4090
- [import_sdk_config6.SupportedChainId.LINEA]: void 0,
4185
+ [import_sdk_config7.SupportedChainId.LINEA]: void 0,
4091
4186
  // TODO: confirm
4092
- [import_sdk_config6.SupportedChainId.PLASMA]: void 0,
4187
+ [import_sdk_config7.SupportedChainId.PLASMA]: void 0,
4093
4188
  // TODO: confirm
4094
- [import_sdk_config6.SupportedChainId.INK]: void 0,
4189
+ [import_sdk_config7.SupportedChainId.INK]: void 0,
4095
4190
  // TODO: confirm
4096
- [import_sdk_config6.SupportedChainId.SEPOLIA]: void 0,
4097
- [import_sdk_config6.AdditionalTargetChainId.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4098
- [import_sdk_config6.AdditionalTargetChainId.BITCOIN]: void 0,
4099
- [import_sdk_config6.SupportedChainId.SOLANA]: void 0
4191
+ [import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
4192
+ [import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4193
+ [import_sdk_config7.AdditionalTargetChainId.BITCOIN]: void 0,
4194
+ [import_sdk_config7.SupportedChainId.SOLANA]: void 0
4100
4195
  };
4101
4196
 
4102
4197
  // src/providers/bungee/abi.ts
@@ -4737,7 +4832,7 @@ var BungeeApi = class {
4737
4832
  };
4738
4833
 
4739
4834
  // src/providers/bungee/createBungeeDepositCall.ts
4740
- var import_sdk_config7 = require("@cowprotocol/sdk-config");
4835
+ var import_sdk_config8 = require("@cowprotocol/sdk-config");
4741
4836
  var import_sdk_common17 = require("@cowprotocol/sdk-common");
4742
4837
  async function createBungeeDepositCall(params) {
4743
4838
  const adapter = (0, import_sdk_common17.getGlobalAdapter)();
@@ -4778,7 +4873,7 @@ async function createBungeeDepositCall(params) {
4778
4873
  fullData
4779
4874
  // data
4780
4875
  ]);
4781
- const value = (0, import_sdk_common17.areAddressesEqual)(request.sellTokenAddress, import_sdk_config7.ETH_ADDRESS) ? BigInt(bridgeInputAmount) : 0n;
4876
+ const value = (0, import_sdk_common17.areAddressesEqual)(request.sellTokenAddress, import_sdk_config8.ETH_ADDRESS) ? BigInt(bridgeInputAmount) : 0n;
4782
4877
  const finalValue = value + nativeTokenExtraFee;
4783
4878
  const to = BungeeApproveAndBridgeV1Addresses[request.sellTokenChainId];
4784
4879
  if (!to) {
@@ -4827,11 +4922,11 @@ async function getBridgingStatusFromEvents(events, getAcrossStatus) {
4827
4922
  }
4828
4923
 
4829
4924
  // src/providers/bungee/BungeeBridgeProvider.ts
4830
- var import_sdk_config8 = require("@cowprotocol/sdk-config");
4925
+ var import_sdk_config9 = require("@cowprotocol/sdk-config");
4831
4926
  var import_sdk_cow_shed2 = require("@cowprotocol/sdk-cow-shed");
4832
4927
  var import_sdk_common18 = require("@cowprotocol/sdk-common");
4833
4928
  var BUNGEE_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX2}/bungee`;
4834
- var BUNGEE_SUPPORTED_NETWORKS = [import_sdk_config8.mainnet, import_sdk_config8.polygon, import_sdk_config8.arbitrumOne, import_sdk_config8.base, import_sdk_config8.optimism, import_sdk_config8.avalanche, import_sdk_config8.gnosisChain];
4929
+ var BUNGEE_SUPPORTED_NETWORKS = [import_sdk_config9.mainnet, import_sdk_config9.polygon, import_sdk_config9.arbitrumOne, import_sdk_config9.base, import_sdk_config9.optimism, import_sdk_config9.avalanche, import_sdk_config9.gnosisChain];
4835
4930
  var SLIPPAGE_TOLERANCE_BPS2 = 0;
4836
4931
  var providerType2 = "HookBridgeProvider";
4837
4932
  var BungeeBridgeProvider = class {
@@ -4986,20 +5081,30 @@ var BungeeBridgeProvider = class {
4986
5081
  }
4987
5082
  isExtraGasRequired(request) {
4988
5083
  const { sellTokenChainId, buyTokenChainId } = request;
4989
- return sellTokenChainId === import_sdk_config8.SupportedChainId.MAINNET && buyTokenChainId === import_sdk_config8.SupportedChainId.GNOSIS_CHAIN;
5084
+ return sellTokenChainId === import_sdk_config9.SupportedChainId.MAINNET && buyTokenChainId === import_sdk_config9.SupportedChainId.GNOSIS_CHAIN;
4990
5085
  }
4991
5086
  };
4992
5087
 
4993
5088
  // src/providers/near-intents/NearIntentsBridgeProvider.ts
4994
5089
  var import_sdk_common20 = require("@cowprotocol/sdk-common");
4995
- var import_sdk_config11 = require("@cowprotocol/sdk-config");
5090
+ var import_sdk_config12 = require("@cowprotocol/sdk-config");
4996
5091
  var import_sdk_cow_shed3 = require("@cowprotocol/sdk-cow-shed");
4997
5092
  var import_sdk_order_book8 = require("@cowprotocol/sdk-order-book");
4998
5093
  var import_one_click_sdk_typescript2 = require("@defuse-protocol/one-click-sdk-typescript");
4999
5094
 
5000
5095
  // src/providers/near-intents/NearIntentsApi.ts
5001
5096
  var import_one_click_sdk_typescript = require("@defuse-protocol/one-click-sdk-typescript");
5002
- var NearIntentsApi = class {
5097
+ var NearIntentsApi = class _NearIntentsApi {
5098
+ // Upstream /v0/tokens still lists deprecated assets the attestation service
5099
+ // no longer signs. They share `blockchain: 'btc'` with the live token and
5100
+ // both resolve to BTC_CURRENCY_ADDRESS, so without this filter `tokens.find()`
5101
+ // picks the deprecated entry (it appears first) and /v0/attestation fails
5102
+ // with "Invalid quote hash".
5103
+ static DEPRECATED_ASSET_IDS = /* @__PURE__ */ new Set([
5104
+ // POA BTC bridge, replaced by `1cs_v1:btc:native:coin` (Omni migration).
5105
+ // https://partners.near-intents.org/omni-migration
5106
+ "nep141:btc.omft.near"
5107
+ ]);
5003
5108
  cachedTokens = [];
5004
5109
  constructor(apiKey) {
5005
5110
  if (apiKey) {
@@ -5009,7 +5114,7 @@ var NearIntentsApi = class {
5009
5114
  async getTokens() {
5010
5115
  if (this.cachedTokens.length === 0) {
5011
5116
  const response = await import_one_click_sdk_typescript.OneClickService.getTokens();
5012
- this.cachedTokens = response;
5117
+ this.cachedTokens = response.filter((t) => !_NearIntentsApi.DEPRECATED_ASSET_IDS.has(t.assetId));
5013
5118
  }
5014
5119
  return this.cachedTokens;
5015
5120
  }
@@ -5054,33 +5159,33 @@ var NearIntentsApi = class {
5054
5159
  };
5055
5160
 
5056
5161
  // src/providers/near-intents/const/index.ts
5057
- var import_sdk_config9 = require("@cowprotocol/sdk-config");
5162
+ var import_sdk_config10 = require("@cowprotocol/sdk-config");
5058
5163
  var NEAR_INTENTS_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/near-intents`;
5059
5164
  var NEAR_INTENTS_SUPPORTED_NETWORKS = [
5060
- import_sdk_config9.arbitrumOne,
5061
- import_sdk_config9.avalanche,
5062
- import_sdk_config9.base,
5063
- import_sdk_config9.bnb,
5064
- import_sdk_config9.gnosisChain,
5065
- import_sdk_config9.mainnet,
5066
- import_sdk_config9.optimism,
5067
- import_sdk_config9.polygon,
5068
- import_sdk_config9.plasma,
5069
- import_sdk_config9.bitcoin,
5070
- import_sdk_config9.solana
5165
+ import_sdk_config10.arbitrumOne,
5166
+ import_sdk_config10.avalanche,
5167
+ import_sdk_config10.base,
5168
+ import_sdk_config10.bnb,
5169
+ import_sdk_config10.gnosisChain,
5170
+ import_sdk_config10.mainnet,
5171
+ import_sdk_config10.optimism,
5172
+ import_sdk_config10.polygon,
5173
+ import_sdk_config10.plasma,
5174
+ import_sdk_config10.bitcoin,
5175
+ import_sdk_config10.solana
5071
5176
  ];
5072
5177
  var NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS = {
5073
- arb: import_sdk_config9.arbitrumOne.id,
5074
- avax: import_sdk_config9.avalanche.id,
5075
- base: import_sdk_config9.base.id,
5076
- bsc: import_sdk_config9.bnb.id,
5077
- eth: import_sdk_config9.mainnet.id,
5078
- gnosis: import_sdk_config9.gnosisChain.id,
5079
- op: import_sdk_config9.optimism.id,
5080
- pol: import_sdk_config9.polygon.id,
5081
- plasma: import_sdk_config9.plasma.id,
5082
- btc: import_sdk_config9.bitcoin.id,
5083
- sol: import_sdk_config9.solana.id
5178
+ arb: import_sdk_config10.arbitrumOne.id,
5179
+ avax: import_sdk_config10.avalanche.id,
5180
+ base: import_sdk_config10.base.id,
5181
+ bsc: import_sdk_config10.bnb.id,
5182
+ eth: import_sdk_config10.mainnet.id,
5183
+ gnosis: import_sdk_config10.gnosisChain.id,
5184
+ op: import_sdk_config10.optimism.id,
5185
+ pol: import_sdk_config10.polygon.id,
5186
+ plasma: import_sdk_config10.plasma.id,
5187
+ btc: import_sdk_config10.bitcoin.id,
5188
+ sol: import_sdk_config10.solana.id
5084
5189
  };
5085
5190
  var NEAR_INTENTS_STATUS_TO_COW_STATUS = {
5086
5191
  KNOWN_DEPOSIT_TX: "in_progress" /* IN_PROGRESS */,
@@ -5098,7 +5203,7 @@ var ATTESTATOR_ADDRESS = "0x0073DD100b51C555E41B2a452E5933ef76F42790";
5098
5203
  // src/providers/near-intents/util.ts
5099
5204
  var import_json_stable_stringify3 = __toESM(require("json-stable-stringify"));
5100
5205
  var import_sdk_common19 = require("@cowprotocol/sdk-common");
5101
- var import_sdk_config10 = require("@cowprotocol/sdk-config");
5206
+ var import_sdk_config11 = require("@cowprotocol/sdk-config");
5102
5207
  var calculateDeadline = (seconds) => {
5103
5208
  const secs = Number(seconds);
5104
5209
  if (!Number.isFinite(secs)) {
@@ -5107,11 +5212,23 @@ var calculateDeadline = (seconds) => {
5107
5212
  const d = new Date(Date.now() + secs * 1e3);
5108
5213
  return d.toISOString().replace(/\.\d{3}Z$/, "Z");
5109
5214
  };
5215
+ var resolveTokenAddress = (chainId, contractAddress) => {
5216
+ const isBtcNative = chainId === NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS.btc && (!contractAddress || contractAddress === "coin");
5217
+ if (isBtcNative)
5218
+ return import_sdk_config11.BTC_CURRENCY_ADDRESS;
5219
+ if (contractAddress)
5220
+ return contractAddress;
5221
+ if (chainId === NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS.sol)
5222
+ return import_sdk_config11.SOL_NATIVE_CURRENCY_ADDRESS;
5223
+ if ((0, import_sdk_config11.isEvmChain)(chainId))
5224
+ return import_sdk_config11.ETH_ADDRESS;
5225
+ return null;
5226
+ };
5110
5227
  var adaptToken = (token) => {
5111
5228
  const chainId = NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS[token.blockchain];
5112
5229
  if (!chainId)
5113
5230
  return null;
5114
- const tokenAddress = token.contractAddress ?? (chainId === NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS.btc ? import_sdk_config10.BTC_CURRENCY_ADDRESS : chainId === NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS.sol ? import_sdk_config10.SOL_NATIVE_CURRENCY_ADDRESS : import_sdk_config10.ETH_ADDRESS);
5231
+ const tokenAddress = resolveTokenAddress(chainId, token.contractAddress);
5115
5232
  if (!tokenAddress)
5116
5233
  return null;
5117
5234
  return {
@@ -5133,21 +5250,10 @@ var adaptTokens = (tokens) => tokens.reduce((acc, token) => {
5133
5250
  var getTokenByAddressAndChainId = (tokens, targetTokenAddress, targetTokenChainId) => {
5134
5251
  return tokens.find((token) => {
5135
5252
  const chainId = NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS[token.blockchain];
5136
- if (!chainId)
5137
- return false;
5138
- if (chainId !== targetTokenChainId)
5253
+ if (!chainId || chainId !== targetTokenChainId)
5139
5254
  return false;
5140
- if (!(0, import_sdk_config10.isEvmChain)(targetTokenChainId)) {
5141
- if (!token.contractAddress) {
5142
- return (0, import_sdk_common19.areAddressesEqual)(targetTokenAddress, import_sdk_config10.BTC_CURRENCY_ADDRESS) || (0, import_sdk_common19.areAddressesEqual)(targetTokenAddress, import_sdk_config10.SOL_NATIVE_CURRENCY_ADDRESS);
5143
- }
5144
- return (0, import_sdk_common19.areAddressesEqual)(token.contractAddress, targetTokenAddress);
5145
- }
5146
- if ((0, import_sdk_common19.areAddressesEqual)(targetTokenAddress, import_sdk_config10.ETH_ADDRESS)) {
5147
- return !token.contractAddress;
5148
- }
5149
- const tokenAddress = token.contractAddress || import_sdk_config10.ETH_ADDRESS;
5150
- return (0, import_sdk_common19.areAddressesEqual)(tokenAddress, targetTokenAddress);
5255
+ const tokenAddress = resolveTokenAddress(chainId, token.contractAddress);
5256
+ return tokenAddress ? (0, import_sdk_common19.areAddressesEqual)(tokenAddress, targetTokenAddress) : false;
5151
5257
  });
5152
5258
  };
5153
5259
  var hashQuote = ({
@@ -5267,7 +5373,7 @@ var NearIntentsBridgeProvider = class {
5267
5373
  validFor,
5268
5374
  owner
5269
5375
  } = request;
5270
- if ((0, import_sdk_common20.areAddressesEqual)(sellTokenAddress, import_sdk_config11.BTC_CURRENCY_ADDRESS) || (0, import_sdk_common20.areAddressesEqual)(sellTokenAddress, import_sdk_config11.SOL_NATIVE_CURRENCY_ADDRESS)) {
5376
+ if ((0, import_sdk_common20.areAddressesEqual)(sellTokenAddress, import_sdk_config12.BTC_CURRENCY_ADDRESS) || (0, import_sdk_common20.areAddressesEqual)(sellTokenAddress, import_sdk_config12.SOL_NATIVE_CURRENCY_ADDRESS)) {
5271
5377
  throw new BridgeProviderQuoteError("NO_ROUTES" /* NO_ROUTES */);
5272
5378
  }
5273
5379
  const tokens = await this.api.getTokens();
@@ -5375,8 +5481,8 @@ var NearIntentsBridgeProvider = class {
5375
5481
  fillTxHash: status.swapDetails?.destinationChainTxHashes?.[0]?.hash
5376
5482
  },
5377
5483
  params: {
5378
- inputTokenAddress: inputToken.contractAddress ?? adaptedInput.address,
5379
- outputTokenAddress: outputToken.contractAddress ?? adaptedOutput.address,
5484
+ inputTokenAddress: adaptedInput.address,
5485
+ outputTokenAddress: adaptedOutput.address,
5380
5486
  inputAmount: BigInt(quote.amountIn),
5381
5487
  outputAmount: swapDetails.amountOut ? BigInt(swapDetails.amountOut) : BigInt(quote.amountOut),
5382
5488
  owner: order.owner,