@imtbl/sdk 0.17.4 → 0.17.6

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 CHANGED
@@ -2724,7 +2724,7 @@ class MultiRollupApiClients {
2724
2724
  }
2725
2725
 
2726
2726
  // eslint-disable-next-line @typescript-eslint/naming-convention
2727
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.17.4' };
2727
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.17.6' };
2728
2728
  const createConfig = ({ basePath, headers, }) => {
2729
2729
  if (!basePath.trim()) {
2730
2730
  throw Error('basePath can not be empty');
@@ -2784,7 +2784,7 @@ class APIError extends Error {
2784
2784
 
2785
2785
  /* eslint-disable implicit-arrow-linebreak */
2786
2786
  const defaultHeaders = {
2787
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.4',
2787
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.6',
2788
2788
  };
2789
2789
  /**
2790
2790
  * createAPIConfiguration to create a custom Configuration
@@ -3070,7 +3070,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
3070
3070
  chainID,
3071
3071
  coreContractAddress,
3072
3072
  registrationContractAddress,
3073
- sdkVersion: 'ts-immutable-sdk-0.17.4',
3073
+ sdkVersion: 'ts-immutable-sdk-0.17.6',
3074
3074
  });
3075
3075
  /**
3076
3076
  * Sets `sdkVersion` at the time of build
@@ -27832,6 +27832,7 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
27832
27832
  CheckoutErrorType["EXECUTE_APPROVAL_TRANSACTION_ERROR"] = "EXECUTE_APPROVAL_TRANSACTION_ERROR";
27833
27833
  CheckoutErrorType["EXECUTE_FULFILMENT_TRANSACTION_ERROR"] = "EXECUTE_FULFILMENT_TRANSACTION_ERROR";
27834
27834
  CheckoutErrorType["SIGN_MESSAGE_ERROR"] = "SIGN_MESSAGE_ERROR";
27835
+ CheckoutErrorType["BRIDGE_GAS_ESTIMATE_ERROR"] = "BRIDGE_GAS_ESTIMATE_ERROR";
27835
27836
  })($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
27836
27837
  class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
27837
27838
  message;
@@ -28639,6 +28640,7 @@ async function $570856c68db0bd36$export$9e73e22953cebcfc(tokenBridge, tokenAddre
28639
28640
 
28640
28641
 
28641
28642
 
28643
+
28642
28644
  async function $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config) {
28643
28645
  const rootChainProvider = readOnlyProviders.get(fromChainId);
28644
28646
  const childChainProvider = readOnlyProviders.get(toChainId);
@@ -28674,6 +28676,13 @@ async function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
28674
28676
  }
28675
28677
  });
28676
28678
  }
28679
+ function $67fc622a2b913d5f$export$436dd76f23f463ff(config) {
28680
+ return new (BlockchainData)({
28681
+ baseConfig: {
28682
+ environment: config.environment
28683
+ }
28684
+ });
28685
+ }
28677
28686
 
28678
28687
 
28679
28688
 
@@ -29427,8 +29436,8 @@ const $7d1bfafb81e64d74$export$3a4140bd9e983e4e = async (provider, insufficientI
29427
29436
 
29428
29437
 
29429
29438
 
29430
- const $1fda5c40669a566d$export$1fac8e857d728583 = async ()=>true;
29431
- const $1fda5c40669a566d$export$2e83e9eeaf217e20 = async ()=>true;
29439
+ const $1fda5c40669a566d$export$1fac8e857d728583 = async ()=>false;
29440
+ const $1fda5c40669a566d$export$2e83e9eeaf217e20 = async ()=>false;
29432
29441
 
29433
29442
 
29434
29443
  const $7f2e17f026d4fc8d$var$isPassportProvider = (provider)=>(provider.provider?.isPassport === true) ?? false;
@@ -29464,43 +29473,30 @@ const $7f2e17f026d4fc8d$export$f1ca3744c025ab81 = async (config, provider)=>{
29464
29473
 
29465
29474
 
29466
29475
 
29476
+ var $b23305044c0e096a$export$3057de18ac0c076;
29477
+ (function(RouteCalculatorType) {
29478
+ RouteCalculatorType["ROUTES_FOUND"] = "ROUTES_FOUND";
29479
+ RouteCalculatorType["NO_ROUTES"] = "NO_ROUTES";
29480
+ RouteCalculatorType["NO_OPTIONS"] = "NO_OPTIONS";
29481
+ })($b23305044c0e096a$export$3057de18ac0c076 || ($b23305044c0e096a$export$3057de18ac0c076 = {}));
29482
+ var $b23305044c0e096a$export$3af78bb3e8650ee6;
29483
+ (function(FundingRouteType) {
29484
+ FundingRouteType["BRIDGE"] = "BRIDGE";
29485
+ FundingRouteType["ON_RAMP"] = "ONRAMP";
29486
+ FundingRouteType["SWAP"] = "SWAP";
29487
+ })($b23305044c0e096a$export$3af78bb3e8650ee6 || ($b23305044c0e096a$export$3af78bb3e8650ee6 = {}));
29467
29488
 
29468
29489
 
29469
29490
 
29470
29491
 
29471
29492
 
29472
- async function $0e0060cb42e136d2$export$339cb2be73677b30(config, existingReadOnlyProviders) {
29473
- if (config.isProduction && existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM)) return existingReadOnlyProviders;
29474
- if (existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA)) return existingReadOnlyProviders;
29475
- const readOnlyProviders = new Map();
29476
- const allowedNetworks = await $de192de6ef100f9f$export$3043f6442a9ef563(config, {
29477
- type: ($a47e48dd2c04791b$export$1f05a55fe0680cc7).ALL
29478
- });
29479
- allowedNetworks.networks.forEach((networkInfo)=>{
29480
- const rpcUrl = config.networkMap.get(networkInfo.chainId)?.rpcUrls[0];
29481
- const provider = new (providers.JsonRpcProvider)(rpcUrl);
29482
- readOnlyProviders.set(networkInfo.chainId, provider);
29483
- });
29484
- return readOnlyProviders;
29485
- }
29486
-
29487
-
29488
-
29489
-
29490
- const $33acec7b4a26c053$export$23ddeb2642d2f9d = async (config, ownerAddress, availableRoutingOptions)=>{
29493
+ const $33acec7b4a26c053$export$23ddeb2642d2f9d = async (config, readOnlyProviders, ownerAddress, availableRoutingOptions)=>{
29491
29494
  const chainBalances = new Map();
29492
29495
  const chainBalancePromises = new Map();
29493
- let readOnlyProviders = new Map();
29494
- let providerError;
29495
- try {
29496
- readOnlyProviders = await (0, $0e0060cb42e136d2$export$339cb2be73677b30)(config);
29497
- } catch (error) {
29498
- providerError = error;
29499
- }
29500
29496
  if (readOnlyProviders.size === 0) {
29501
29497
  const noProviderResult = {
29502
29498
  success: false,
29503
- error: providerError || new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Provider failed", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_ERROR),
29499
+ error: new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No L1 or L2 provider available", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_ERROR),
29504
29500
  balances: []
29505
29501
  };
29506
29502
  chainBalances.set(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config), noProviderResult);
@@ -29544,44 +29540,263 @@ const $33acec7b4a26c053$export$23ddeb2642d2f9d = async (config, ownerAddress, av
29544
29540
  };
29545
29541
 
29546
29542
 
29543
+ /* eslint-disable @typescript-eslint/no-unused-vars */
29544
+
29545
+
29546
+
29547
+
29548
+ const $f730af3b727f04ac$export$22fea095b15361de = (balances)=>{
29549
+ for (const balance of balances.balances){
29550
+ if (!balance.token.address || balance.token.address === "") return balance.balance;
29551
+ }
29552
+ return (ethers.BigNumber).from(0);
29553
+ };
29554
+
29555
+
29556
+
29557
+
29558
+
29559
+
29560
+ const $8a49d1a3783a2640$export$3aff971444a4f244 = async (config, readOnlyProviders)=>{
29561
+ try {
29562
+ const estimate = await (0, $2e7bf45a7c9a9570$export$942c8de7174809fc)({
29563
+ gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2,
29564
+ isSpendingCapApprovalRequired: false
29565
+ }, readOnlyProviders, config);
29566
+ const gasEstimate = estimate.gasFee.estimatedAmount;
29567
+ const bridgeFee = estimate.bridgeFee.estimatedAmount;
29568
+ let totalFees = (0, ethers.BigNumber).from(0);
29569
+ if (gasEstimate) totalFees = totalFees.add(gasEstimate);
29570
+ if (bridgeFee) totalFees = totalFees.add(bridgeFee);
29571
+ return totalFees;
29572
+ } catch (err) {
29573
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error estimating gas for bridge", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).BRIDGE_GAS_ESTIMATE_ERROR, {
29574
+ message: err.message
29575
+ });
29576
+ }
29577
+ };
29578
+
29579
+
29580
+
29581
+ const $823db9fb0ca4bc15$export$c37d8687c27b9660 = "0x0000000000000000000000000000000000000001";
29582
+ const $823db9fb0ca4bc15$export$1430626eec86fce9 = (chainId)=>{
29583
+ if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET) return "imtbl-zkevm-testnet";
29584
+ return "";
29585
+ };
29586
+ const $823db9fb0ca4bc15$export$53e663abd9b77fc1 = (chainId)=>{
29587
+ if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA) return "0x2Fa06C6672dDCc066Ab04631192738799231dE4a";
29588
+ if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM) return "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF";
29589
+ return "";
29590
+ };
29591
+
29592
+
29593
+
29594
+
29595
+
29596
+
29597
+
29598
+ const $07ac9c0576988336$export$7847f5f5cce25dfa = async (config, readOnlyProviders, l1provider, depositorAddress, fromChainId, toChainId, token, depositAmount)=>{
29599
+ try {
29600
+ const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config);
29601
+ const { unsignedTx: unsignedTx } = await tokenBridge.getUnsignedApproveDepositBridgeTx({
29602
+ depositorAddress: depositorAddress,
29603
+ token: token,
29604
+ depositAmount: depositAmount
29605
+ });
29606
+ if (unsignedTx === null) return (0, ethers.BigNumber).from(0);
29607
+ return await l1provider.estimateGas(unsignedTx);
29608
+ } catch (err) {
29609
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error occurred while attempting ot estimate gas for approval transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).BRIDGE_GAS_ESTIMATE_ERROR, {
29610
+ message: err.message
29611
+ });
29612
+ }
29613
+ };
29614
+ const $07ac9c0576988336$export$a3dd181de896b7c7 = async (config, readOnlyProviders, l1provider, depositorAddress, l1Address, delta)=>{
29615
+ if (l1Address === ($823db9fb0ca4bc15$export$c37d8687c27b9660)) return (ethers.BigNumber).from(0); // Native ETH does not require approval
29616
+ const fromChainId = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config);
29617
+ const toChainId = ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config);
29618
+ return await $07ac9c0576988336$export$7847f5f5cce25dfa(config, readOnlyProviders, l1provider, depositorAddress, fromChainId, toChainId, l1Address, delta);
29619
+ };
29620
+
29621
+
29622
+
29623
+
29624
+ const $5a5ccedc98d53d25$var$filterTokens = (allowedTokens, balances)=>{
29625
+ if (balances && balances.success) return allowedTokens.filter((token)=>{
29626
+ if ("address" in token) return balances.balances.find((balance)=>balance.token.address === token.address && balance.balance.gt(0));
29627
+ return balances.balances.find((balance)=>!("address" in balance.token) && balance.balance.gt(0));
29628
+ });
29629
+ return [];
29630
+ };
29631
+ const $5a5ccedc98d53d25$export$d744af9f1c0712bc = async (config, tokenBalances, availableRoutingOptions)=>{
29632
+ if (availableRoutingOptions.bridge) {
29633
+ const allowedTokens = (await config.remote.getConfig("bridge"))?.tokens ?? [];
29634
+ const balances = tokenBalances.get(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
29635
+ return $5a5ccedc98d53d25$var$filterTokens(allowedTokens, balances);
29636
+ }
29637
+ return [];
29638
+ };
29639
+
29640
+
29641
+ const $fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665 = (balances, totalFees)=>{
29642
+ const balance = ($f730af3b727f04ac$export$22fea095b15361de)(balances);
29643
+ return balance.gte(totalFees);
29644
+ };
29645
+ const $fa9ac5bfdbbf9dfa$export$97330fab5f794e7f = (balanceRequirement)=>{
29646
+ if (balanceRequirement.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return $d85ad1457a3f1a83$export$b80040cb173ba6e9;
29647
+ if (balanceRequirement.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) return balanceRequirement.required.token.address ?? "";
29648
+ return "";
29649
+ };
29650
+ const $fa9ac5bfdbbf9dfa$export$952cdf461a00a8c6 = async (config, balanceRequirement)=>{
29651
+ const l2address = $fa9ac5bfdbbf9dfa$export$97330fab5f794e7f(balanceRequirement);
29652
+ if (l2address === "") return "";
29653
+ if (l2address === ($d85ad1457a3f1a83$export$b80040cb173ba6e9)) return ($823db9fb0ca4bc15$export$53e663abd9b77fc1)(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
29654
+ const chainName = ($823db9fb0ca4bc15$export$1430626eec86fce9)(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
29655
+ if (chainName === "") return ""; // Chain name not a valid indexer chain name
29656
+ const blockchainData = ($67fc622a2b913d5f$export$436dd76f23f463ff)(config);
29657
+ const tokenData = await blockchainData.getToken({
29658
+ chainName: chainName,
29659
+ contractAddress: l2address
29660
+ });
29661
+ const l1address = tokenData.result.root_contract_address;
29662
+ if (l1address === null) return ""; // No L1 representation of this token
29663
+ return l1address;
29664
+ };
29665
+ const $fa9ac5bfdbbf9dfa$export$da05aed50d75046 = async (config, readOnlyProviders, feeEstimates)=>{
29666
+ let bridgeFeeEstimate = feeEstimates.get(($b23305044c0e096a$export$3af78bb3e8650ee6).BRIDGE);
29667
+ if (bridgeFeeEstimate) return bridgeFeeEstimate;
29668
+ bridgeFeeEstimate = await ($8a49d1a3783a2640$export$3aff971444a4f244)(config, readOnlyProviders);
29669
+ feeEstimates.set(($b23305044c0e096a$export$3af78bb3e8650ee6).BRIDGE, bridgeFeeEstimate);
29670
+ return bridgeFeeEstimate;
29671
+ };
29672
+ const $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute = (chainId, balance)=>({
29673
+ type: ($b23305044c0e096a$export$3af78bb3e8650ee6).BRIDGE,
29674
+ chainId: chainId,
29675
+ asset: {
29676
+ balance: balance.balance,
29677
+ formattedBalance: balance.formattedBalance,
29678
+ token: {
29679
+ name: balance.token.name,
29680
+ symbol: balance.token.symbol,
29681
+ address: balance.token.address,
29682
+ decimals: balance.token.decimals
29683
+ }
29684
+ }
29685
+ });
29686
+ const $fa9ac5bfdbbf9dfa$export$3139474685e4dedd = (address)=>{
29687
+ if (!address || address === "") return true;
29688
+ return false;
29689
+ };
29690
+ const $fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa = async (config, readOnlyProviders, depositorAddress, availableRoutingOptions, balanceRequirement, balances, feeEstimates)=>{
29691
+ if (!availableRoutingOptions.bridge) return undefined;
29692
+ const chainId = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config);
29693
+ const tokenBalanceResult = balances.get(chainId);
29694
+ const l1provider = readOnlyProviders.get(chainId);
29695
+ if (!l1provider) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No L1 provider available", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_ERROR, {
29696
+ chainId: chainId.toString()
29697
+ });
29698
+ // If no balances on layer 1 then Bridge cannot be an option
29699
+ if (tokenBalanceResult === undefined || tokenBalanceResult.success === false) return undefined;
29700
+ const allowedTokenList = await ($5a5ccedc98d53d25$export$d744af9f1c0712bc)(config, balances, availableRoutingOptions);
29701
+ if (allowedTokenList.length === 0) return undefined;
29702
+ const bridgeFeeEstimate = await $fa9ac5bfdbbf9dfa$export$da05aed50d75046(config, readOnlyProviders, feeEstimates);
29703
+ // If the user has no ETH to cover the bridge fees or approval fees then bridge cannot be an option
29704
+ if (!$fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665(tokenBalanceResult, bridgeFeeEstimate)) return undefined;
29705
+ const l1address = await $fa9ac5bfdbbf9dfa$export$952cdf461a00a8c6(config, balanceRequirement);
29706
+ if (l1address === "") return undefined;
29707
+ // Ensure l1address is in the allowed token list
29708
+ if (l1address === ($823db9fb0ca4bc15$export$c37d8687c27b9660)) {
29709
+ if (!allowedTokenList.find((token)=>!("address" in token))) return undefined;
29710
+ } else if (!allowedTokenList.find((token)=>token.address === l1address)) return undefined;
29711
+ const gasForApproval = await ($07ac9c0576988336$export$a3dd181de896b7c7)(config, readOnlyProviders, l1provider, depositorAddress, l1address, balanceRequirement.delta.balance);
29712
+ if (!$fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665(tokenBalanceResult, gasForApproval.add(bridgeFeeEstimate))) return undefined;
29713
+ // If the L1 representation of the requirement is ETH then find the ETH balance and check if the balance covers the delta
29714
+ if (l1address === ($823db9fb0ca4bc15$export$c37d8687c27b9660)) {
29715
+ const nativeETHBalance = tokenBalanceResult.balances.find((balance)=>$fa9ac5bfdbbf9dfa$export$3139474685e4dedd(balance.token.address));
29716
+ if (nativeETHBalance && nativeETHBalance.balance.gte(balanceRequirement.delta.balance.add(bridgeFeeEstimate))) return $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute(chainId, nativeETHBalance);
29717
+ return undefined;
29718
+ }
29719
+ // Find the balance of the L1 representation of the token and check if the balance covers the delta
29720
+ const erc20balance = tokenBalanceResult.balances.find((balance)=>balance.token.address === l1address);
29721
+ if (erc20balance && erc20balance.balance.gte(balanceRequirement.delta.balance)) return $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute(chainId, erc20balance);
29722
+ return undefined;
29723
+ };
29724
+
29725
+
29726
+
29727
+
29728
+
29729
+ async function $0e0060cb42e136d2$export$339cb2be73677b30(config, existingReadOnlyProviders) {
29730
+ if (config.isProduction && existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM)) return existingReadOnlyProviders;
29731
+ if (existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA)) return existingReadOnlyProviders;
29732
+ const readOnlyProviders = new Map();
29733
+ const allowedNetworks = await $de192de6ef100f9f$export$3043f6442a9ef563(config, {
29734
+ type: ($a47e48dd2c04791b$export$1f05a55fe0680cc7).ALL
29735
+ });
29736
+ allowedNetworks.networks.forEach((networkInfo)=>{
29737
+ const rpcUrl = config.networkMap.get(networkInfo.chainId)?.rpcUrls[0];
29738
+ const provider = new (providers.JsonRpcProvider)(rpcUrl);
29739
+ readOnlyProviders.set(networkInfo.chainId, provider);
29740
+ });
29741
+ return readOnlyProviders;
29742
+ }
29743
+
29744
+
29745
+
29746
+ const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
29747
+ let insufficientBalanceCount = 0;
29748
+ let insufficientBridgeRequirement;
29749
+ for (const balanceRequirement of balanceRequirements.balanceRequirements)if (!balanceRequirement.sufficient) {
29750
+ insufficientBalanceCount++;
29751
+ insufficientBridgeRequirement = balanceRequirement;
29752
+ }
29753
+ if (insufficientBalanceCount === 1) return insufficientBridgeRequirement;
29754
+ return undefined;
29755
+ };
29547
29756
  const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
29548
- // eslint-disable-next-line no-console
29549
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
29550
- await ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, ownerAddress, availableRoutingOptions);
29551
- // Get allowed tokens?
29552
- // Check bridging routes
29757
+ let readOnlyProviders;
29758
+ try {
29759
+ readOnlyProviders = await (0, $0e0060cb42e136d2$export$339cb2be73677b30)(config);
29760
+ } catch (err) {
29761
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error occurred while creating read only providers", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_ERROR, {
29762
+ message: err.message
29763
+ });
29764
+ }
29765
+ const tokenBalances = await ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, readOnlyProviders, ownerAddress, availableRoutingOptions);
29766
+ // Bridge and swap fee cache
29767
+ const feeEstimates = new Map();
29768
+ // Ensures only 1 balance requirement is insufficient otherwise one bridge route cannot be recommended
29769
+ let bridgeFundingStep;
29770
+ const insufficientRequirement = $c16168a9c28ae4fd$export$31ce7ba1a2956195(balanceRequirements);
29771
+ if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
29553
29772
  // Check on-ramp routes
29554
29773
  // Check swap routes
29555
29774
  // > Could bridge first
29556
29775
  // > Could on-ramp first
29557
29776
  // > Could double swap
29558
- return {
29777
+ if (bridgeFundingStep) return {
29559
29778
  availableOptions: [],
29560
29779
  response: {
29561
- type: "ROUTES_FOUND",
29780
+ type: ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND,
29562
29781
  message: "Routes found"
29563
29782
  },
29564
29783
  fundingRoutes: [
29565
29784
  {
29566
29785
  priority: 1,
29567
29786
  steps: [
29568
- {
29569
- type: "bridge",
29570
- chainId: 1,
29571
- asset: {
29572
- balance: (ethers.BigNumber).from(0),
29573
- formattedBalance: "0",
29574
- token: {
29575
- name: "ETH",
29576
- symbol: "ETH",
29577
- decimals: 18
29578
- }
29579
- }
29580
- }
29787
+ bridgeFundingStep
29581
29788
  ]
29582
29789
  }
29583
29790
  ]
29584
29791
  };
29792
+ return {
29793
+ availableOptions: [],
29794
+ response: {
29795
+ type: ($b23305044c0e096a$export$3057de18ac0c076).NO_ROUTES,
29796
+ message: "Routes not found"
29797
+ },
29798
+ fundingRoutes: []
29799
+ };
29585
29800
  };
29586
29801
 
29587
29802
 
@@ -30294,7 +30509,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
30294
30509
  function $parcel$export(e, n, v, s) {
30295
30510
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
30296
30511
  }
30297
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.4";
30512
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.6";
30298
30513
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
30299
30514
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
30300
30515
 
package/dist/index.d.ts CHANGED
@@ -14520,6 +14520,7 @@ interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverri
14520
14520
  type RemoteConfiguration = {
14521
14521
  dex: DexConfig;
14522
14522
  onramp: OnRampConfig;
14523
+ bridge: BridgeConfig;
14523
14524
  allowedNetworks: AllowedNetworkConfig[];
14524
14525
  gasEstimateTokens?: GasEstimateTokenConfig;
14525
14526
  };
@@ -14561,6 +14562,13 @@ type DexConfig = {
14561
14562
  overrides?: ExchangeOverrides;
14562
14563
  tokens?: TokenInfo[];
14563
14564
  };
14565
+ /**
14566
+ * A type representing the configuration for the Bridge.
14567
+ * @property {TokenInfo[] | undefined} tokens - An array of tokens compatible with the Bridge.
14568
+ */
14569
+ type BridgeConfig = {
14570
+ tokens?: TokenInfo[];
14571
+ };
14564
14572
  /**
14565
14573
  * A type representing an allowed network.
14566
14574
  * @property {number} chainId - The network chain id.
@@ -15052,7 +15060,8 @@ declare enum CheckoutErrorType {
15052
15060
  GET_ERC721_ALLOWANCE_ERROR = "GET_ERC721_ALLOWANCE_ERROR",
15053
15061
  EXECUTE_APPROVAL_TRANSACTION_ERROR = "EXECUTE_APPROVAL_TRANSACTION_ERROR",
15054
15062
  EXECUTE_FULFILMENT_TRANSACTION_ERROR = "EXECUTE_FULFILMENT_TRANSACTION_ERROR",
15055
- SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR"
15063
+ SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR",
15064
+ BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR"
15056
15065
  }
15057
15066
  /**
15058
15067
  * Represents an error object with a specific type, optional message, and optional data.