@imtbl/sdk 0.17.4 → 0.17.5
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/blockchain_data.js +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +2 -1
- package/dist/checkout_sdk.js +3091 -59
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +15 -15
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +245 -50
- package/dist/index.d.ts +2 -1
- package/dist/index.js +245 -50
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2702,7 +2702,7 @@ class MultiRollupApiClients {
|
|
|
2702
2702
|
}
|
|
2703
2703
|
|
|
2704
2704
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2705
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.17.
|
|
2705
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.17.5' };
|
|
2706
2706
|
const createConfig = ({ basePath, headers, }) => {
|
|
2707
2707
|
if (!basePath.trim()) {
|
|
2708
2708
|
throw Error('basePath can not be empty');
|
|
@@ -2762,7 +2762,7 @@ class APIError extends Error {
|
|
|
2762
2762
|
|
|
2763
2763
|
/* eslint-disable implicit-arrow-linebreak */
|
|
2764
2764
|
const defaultHeaders = {
|
|
2765
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.
|
|
2765
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.5',
|
|
2766
2766
|
};
|
|
2767
2767
|
/**
|
|
2768
2768
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -3048,7 +3048,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
3048
3048
|
chainID,
|
|
3049
3049
|
coreContractAddress,
|
|
3050
3050
|
registrationContractAddress,
|
|
3051
|
-
sdkVersion: 'ts-immutable-sdk-0.17.
|
|
3051
|
+
sdkVersion: 'ts-immutable-sdk-0.17.5',
|
|
3052
3052
|
});
|
|
3053
3053
|
/**
|
|
3054
3054
|
* Sets `sdkVersion` at the time of build
|
|
@@ -27810,6 +27810,7 @@ var $e055e79256bbc1dd$export$80f4da0d409a629d;
|
|
|
27810
27810
|
CheckoutErrorType["EXECUTE_APPROVAL_TRANSACTION_ERROR"] = "EXECUTE_APPROVAL_TRANSACTION_ERROR";
|
|
27811
27811
|
CheckoutErrorType["EXECUTE_FULFILMENT_TRANSACTION_ERROR"] = "EXECUTE_FULFILMENT_TRANSACTION_ERROR";
|
|
27812
27812
|
CheckoutErrorType["SIGN_MESSAGE_ERROR"] = "SIGN_MESSAGE_ERROR";
|
|
27813
|
+
CheckoutErrorType["BRIDGE_GAS_ESTIMATE_ERROR"] = "BRIDGE_GAS_ESTIMATE_ERROR";
|
|
27813
27814
|
})($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
|
|
27814
27815
|
class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
|
|
27815
27816
|
message;
|
|
@@ -28617,6 +28618,7 @@ async function $570856c68db0bd36$export$9e73e22953cebcfc(tokenBridge, tokenAddre
|
|
|
28617
28618
|
|
|
28618
28619
|
|
|
28619
28620
|
|
|
28621
|
+
|
|
28620
28622
|
async function $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config) {
|
|
28621
28623
|
const rootChainProvider = readOnlyProviders.get(fromChainId);
|
|
28622
28624
|
const childChainProvider = readOnlyProviders.get(toChainId);
|
|
@@ -28652,6 +28654,13 @@ async function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
|
|
|
28652
28654
|
}
|
|
28653
28655
|
});
|
|
28654
28656
|
}
|
|
28657
|
+
function $67fc622a2b913d5f$export$436dd76f23f463ff(config) {
|
|
28658
|
+
return new (BlockchainData)({
|
|
28659
|
+
baseConfig: {
|
|
28660
|
+
environment: config.environment
|
|
28661
|
+
}
|
|
28662
|
+
});
|
|
28663
|
+
}
|
|
28655
28664
|
|
|
28656
28665
|
|
|
28657
28666
|
|
|
@@ -29442,43 +29451,30 @@ const $7f2e17f026d4fc8d$export$f1ca3744c025ab81 = async (config, provider)=>{
|
|
|
29442
29451
|
|
|
29443
29452
|
|
|
29444
29453
|
|
|
29454
|
+
var $b23305044c0e096a$export$3057de18ac0c076;
|
|
29455
|
+
(function(RouteCalculatorType) {
|
|
29456
|
+
RouteCalculatorType["ROUTES_FOUND"] = "ROUTES_FOUND";
|
|
29457
|
+
RouteCalculatorType["NO_ROUTES"] = "NO_ROUTES";
|
|
29458
|
+
RouteCalculatorType["NO_OPTIONS"] = "NO_OPTIONS";
|
|
29459
|
+
})($b23305044c0e096a$export$3057de18ac0c076 || ($b23305044c0e096a$export$3057de18ac0c076 = {}));
|
|
29460
|
+
var $b23305044c0e096a$export$3af78bb3e8650ee6;
|
|
29461
|
+
(function(FundingRouteType) {
|
|
29462
|
+
FundingRouteType["BRIDGE"] = "BRIDGE";
|
|
29463
|
+
FundingRouteType["ON_RAMP"] = "ONRAMP";
|
|
29464
|
+
FundingRouteType["SWAP"] = "SWAP";
|
|
29465
|
+
})($b23305044c0e096a$export$3af78bb3e8650ee6 || ($b23305044c0e096a$export$3af78bb3e8650ee6 = {}));
|
|
29445
29466
|
|
|
29446
29467
|
|
|
29447
29468
|
|
|
29448
29469
|
|
|
29449
29470
|
|
|
29450
|
-
|
|
29451
|
-
if (config.isProduction && existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM)) return existingReadOnlyProviders;
|
|
29452
|
-
if (existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA)) return existingReadOnlyProviders;
|
|
29453
|
-
const readOnlyProviders = new Map();
|
|
29454
|
-
const allowedNetworks = await $de192de6ef100f9f$export$3043f6442a9ef563(config, {
|
|
29455
|
-
type: ($a47e48dd2c04791b$export$1f05a55fe0680cc7).ALL
|
|
29456
|
-
});
|
|
29457
|
-
allowedNetworks.networks.forEach((networkInfo)=>{
|
|
29458
|
-
const rpcUrl = config.networkMap.get(networkInfo.chainId)?.rpcUrls[0];
|
|
29459
|
-
const provider = new (JsonRpcProvider)(rpcUrl);
|
|
29460
|
-
readOnlyProviders.set(networkInfo.chainId, provider);
|
|
29461
|
-
});
|
|
29462
|
-
return readOnlyProviders;
|
|
29463
|
-
}
|
|
29464
|
-
|
|
29465
|
-
|
|
29466
|
-
|
|
29467
|
-
|
|
29468
|
-
const $33acec7b4a26c053$export$23ddeb2642d2f9d = async (config, ownerAddress, availableRoutingOptions)=>{
|
|
29471
|
+
const $33acec7b4a26c053$export$23ddeb2642d2f9d = async (config, readOnlyProviders, ownerAddress, availableRoutingOptions)=>{
|
|
29469
29472
|
const chainBalances = new Map();
|
|
29470
29473
|
const chainBalancePromises = new Map();
|
|
29471
|
-
let readOnlyProviders = new Map();
|
|
29472
|
-
let providerError;
|
|
29473
|
-
try {
|
|
29474
|
-
readOnlyProviders = await (0, $0e0060cb42e136d2$export$339cb2be73677b30)(config);
|
|
29475
|
-
} catch (error) {
|
|
29476
|
-
providerError = error;
|
|
29477
|
-
}
|
|
29478
29474
|
if (readOnlyProviders.size === 0) {
|
|
29479
29475
|
const noProviderResult = {
|
|
29480
29476
|
success: false,
|
|
29481
|
-
error:
|
|
29477
|
+
error: new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No L1 or L2 provider available", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_ERROR),
|
|
29482
29478
|
balances: []
|
|
29483
29479
|
};
|
|
29484
29480
|
chainBalances.set(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config), noProviderResult);
|
|
@@ -29522,44 +29518,243 @@ const $33acec7b4a26c053$export$23ddeb2642d2f9d = async (config, ownerAddress, av
|
|
|
29522
29518
|
};
|
|
29523
29519
|
|
|
29524
29520
|
|
|
29521
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
29522
|
+
|
|
29523
|
+
|
|
29524
|
+
|
|
29525
|
+
|
|
29526
|
+
const $f730af3b727f04ac$export$22fea095b15361de = (balances)=>{
|
|
29527
|
+
for (const balance of balances.balances){
|
|
29528
|
+
if (!balance.token.address || balance.token.address === "") return balance.balance;
|
|
29529
|
+
}
|
|
29530
|
+
return (BigNumber$1).from(0);
|
|
29531
|
+
};
|
|
29532
|
+
|
|
29533
|
+
|
|
29534
|
+
|
|
29535
|
+
|
|
29536
|
+
|
|
29537
|
+
|
|
29538
|
+
const $8a49d1a3783a2640$export$3aff971444a4f244 = async (config, readOnlyProviders)=>{
|
|
29539
|
+
try {
|
|
29540
|
+
const estimate = await (0, $2e7bf45a7c9a9570$export$942c8de7174809fc)({
|
|
29541
|
+
gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2,
|
|
29542
|
+
isSpendingCapApprovalRequired: false
|
|
29543
|
+
}, readOnlyProviders, config);
|
|
29544
|
+
const gasEstimate = estimate.gasFee.estimatedAmount;
|
|
29545
|
+
const bridgeFee = estimate.bridgeFee.estimatedAmount;
|
|
29546
|
+
let totalFees = (0, BigNumber$1).from(0);
|
|
29547
|
+
if (gasEstimate) totalFees = totalFees.add(gasEstimate);
|
|
29548
|
+
if (bridgeFee) totalFees = totalFees.add(bridgeFee);
|
|
29549
|
+
return totalFees;
|
|
29550
|
+
} catch (err) {
|
|
29551
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error estimating gas for bridge", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).BRIDGE_GAS_ESTIMATE_ERROR, {
|
|
29552
|
+
message: err.message
|
|
29553
|
+
});
|
|
29554
|
+
}
|
|
29555
|
+
};
|
|
29556
|
+
|
|
29557
|
+
|
|
29558
|
+
|
|
29559
|
+
const $823db9fb0ca4bc15$export$c37d8687c27b9660 = "0x0000000000000000000000000000000000000001";
|
|
29560
|
+
const $823db9fb0ca4bc15$export$1430626eec86fce9 = (chainId)=>{
|
|
29561
|
+
if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET) return "imtbl-zkevm-testnet";
|
|
29562
|
+
return "";
|
|
29563
|
+
};
|
|
29564
|
+
const $823db9fb0ca4bc15$export$53e663abd9b77fc1 = (chainId)=>{
|
|
29565
|
+
if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA) return "0x2Fa06C6672dDCc066Ab04631192738799231dE4a";
|
|
29566
|
+
if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM) return "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF";
|
|
29567
|
+
return "";
|
|
29568
|
+
};
|
|
29569
|
+
|
|
29570
|
+
|
|
29571
|
+
|
|
29572
|
+
|
|
29573
|
+
|
|
29574
|
+
|
|
29575
|
+
|
|
29576
|
+
const $07ac9c0576988336$export$7847f5f5cce25dfa = async (config, readOnlyProviders, l1provider, depositorAddress, fromChainId, toChainId, token, depositAmount)=>{
|
|
29577
|
+
try {
|
|
29578
|
+
const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config);
|
|
29579
|
+
const { unsignedTx: unsignedTx } = await tokenBridge.getUnsignedApproveDepositBridgeTx({
|
|
29580
|
+
depositorAddress: depositorAddress,
|
|
29581
|
+
token: token,
|
|
29582
|
+
depositAmount: depositAmount
|
|
29583
|
+
});
|
|
29584
|
+
if (unsignedTx === null) return (0, BigNumber$1).from(0);
|
|
29585
|
+
return await l1provider.estimateGas(unsignedTx);
|
|
29586
|
+
} catch (err) {
|
|
29587
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error occurred while attempting ot estimate gas for approval transaction", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).BRIDGE_GAS_ESTIMATE_ERROR, {
|
|
29588
|
+
message: err.message
|
|
29589
|
+
});
|
|
29590
|
+
}
|
|
29591
|
+
};
|
|
29592
|
+
const $07ac9c0576988336$export$a3dd181de896b7c7 = async (config, readOnlyProviders, l1provider, depositorAddress, l1Address, delta)=>{
|
|
29593
|
+
if (l1Address === ($823db9fb0ca4bc15$export$c37d8687c27b9660)) return (BigNumber$1).from(0); // Native ETH does not require approval
|
|
29594
|
+
const fromChainId = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config);
|
|
29595
|
+
const toChainId = ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config);
|
|
29596
|
+
return await $07ac9c0576988336$export$7847f5f5cce25dfa(config, readOnlyProviders, l1provider, depositorAddress, fromChainId, toChainId, l1Address, delta);
|
|
29597
|
+
};
|
|
29598
|
+
|
|
29599
|
+
|
|
29600
|
+
|
|
29601
|
+
const $fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665 = (balances, totalFees)=>{
|
|
29602
|
+
const balance = ($f730af3b727f04ac$export$22fea095b15361de)(balances);
|
|
29603
|
+
return balance.gte(totalFees);
|
|
29604
|
+
};
|
|
29605
|
+
const $fa9ac5bfdbbf9dfa$export$97330fab5f794e7f = (balanceRequirement)=>{
|
|
29606
|
+
if (balanceRequirement.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return $d85ad1457a3f1a83$export$b80040cb173ba6e9;
|
|
29607
|
+
if (balanceRequirement.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) return balanceRequirement.required.token.address ?? "";
|
|
29608
|
+
return "";
|
|
29609
|
+
};
|
|
29610
|
+
const $fa9ac5bfdbbf9dfa$export$952cdf461a00a8c6 = async (config, balanceRequirement)=>{
|
|
29611
|
+
const l2address = $fa9ac5bfdbbf9dfa$export$97330fab5f794e7f(balanceRequirement);
|
|
29612
|
+
if (l2address === "") return "";
|
|
29613
|
+
if (l2address === ($d85ad1457a3f1a83$export$b80040cb173ba6e9)) return ($823db9fb0ca4bc15$export$53e663abd9b77fc1)(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
|
|
29614
|
+
const chainName = ($823db9fb0ca4bc15$export$1430626eec86fce9)(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
|
|
29615
|
+
if (chainName === "") return ""; // Chain name not a valid indexer chain name
|
|
29616
|
+
const blockchainData = ($67fc622a2b913d5f$export$436dd76f23f463ff)(config);
|
|
29617
|
+
const tokenData = await blockchainData.getToken({
|
|
29618
|
+
chainName: chainName,
|
|
29619
|
+
contractAddress: l2address
|
|
29620
|
+
});
|
|
29621
|
+
const l1address = tokenData.result.root_contract_address;
|
|
29622
|
+
if (l1address === null) return ""; // No L1 representation of this token
|
|
29623
|
+
return l1address;
|
|
29624
|
+
};
|
|
29625
|
+
const $fa9ac5bfdbbf9dfa$export$da05aed50d75046 = async (config, readOnlyProviders, feeEstimates)=>{
|
|
29626
|
+
let bridgeFeeEstimate = feeEstimates.get(($b23305044c0e096a$export$3af78bb3e8650ee6).BRIDGE);
|
|
29627
|
+
if (bridgeFeeEstimate) return bridgeFeeEstimate;
|
|
29628
|
+
bridgeFeeEstimate = await ($8a49d1a3783a2640$export$3aff971444a4f244)(config, readOnlyProviders);
|
|
29629
|
+
feeEstimates.set(($b23305044c0e096a$export$3af78bb3e8650ee6).BRIDGE, bridgeFeeEstimate);
|
|
29630
|
+
return bridgeFeeEstimate;
|
|
29631
|
+
};
|
|
29632
|
+
const $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute = (chainId, balance)=>({
|
|
29633
|
+
type: ($b23305044c0e096a$export$3af78bb3e8650ee6).BRIDGE,
|
|
29634
|
+
chainId: chainId,
|
|
29635
|
+
asset: {
|
|
29636
|
+
balance: balance.balance,
|
|
29637
|
+
formattedBalance: balance.formattedBalance,
|
|
29638
|
+
token: {
|
|
29639
|
+
name: balance.token.name,
|
|
29640
|
+
symbol: balance.token.symbol,
|
|
29641
|
+
address: balance.token.address,
|
|
29642
|
+
decimals: balance.token.decimals
|
|
29643
|
+
}
|
|
29644
|
+
}
|
|
29645
|
+
});
|
|
29646
|
+
const $fa9ac5bfdbbf9dfa$export$3139474685e4dedd = (address)=>{
|
|
29647
|
+
if (!address || address === "") return true;
|
|
29648
|
+
return false;
|
|
29649
|
+
};
|
|
29650
|
+
const $fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa = async (config, readOnlyProviders, depositorAddress, availableRoutingOptions, balanceRequirement, balances, feeEstimates)=>{
|
|
29651
|
+
if (!availableRoutingOptions.bridge) return undefined;
|
|
29652
|
+
const chainId = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config);
|
|
29653
|
+
const tokenBalanceResult = balances.get(chainId);
|
|
29654
|
+
const l1provider = readOnlyProviders.get(chainId);
|
|
29655
|
+
if (!l1provider) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No L1 provider available", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_ERROR, {
|
|
29656
|
+
chainId: chainId.toString()
|
|
29657
|
+
});
|
|
29658
|
+
// If no balances on layer 1 then Bridge cannot be an option
|
|
29659
|
+
if (tokenBalanceResult === undefined || tokenBalanceResult.success === false) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error getting balances", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_BALANCE_ERROR, {
|
|
29660
|
+
chainId: chainId.toString()
|
|
29661
|
+
});
|
|
29662
|
+
if (tokenBalanceResult.balances.length === 0) return undefined;
|
|
29663
|
+
const bridgeFeeEstimate = await $fa9ac5bfdbbf9dfa$export$da05aed50d75046(config, readOnlyProviders, feeEstimates);
|
|
29664
|
+
// If the user has no ETH to cover the bridge fees or approval fees then bridge cannot be an option
|
|
29665
|
+
if (!$fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665(tokenBalanceResult, bridgeFeeEstimate)) return undefined;
|
|
29666
|
+
const l1address = await $fa9ac5bfdbbf9dfa$export$952cdf461a00a8c6(config, balanceRequirement);
|
|
29667
|
+
if (l1address === "") return undefined;
|
|
29668
|
+
const gasForApproval = await ($07ac9c0576988336$export$a3dd181de896b7c7)(config, readOnlyProviders, l1provider, depositorAddress, l1address, balanceRequirement.delta.balance);
|
|
29669
|
+
if (!$fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665(tokenBalanceResult, gasForApproval.add(bridgeFeeEstimate))) return undefined;
|
|
29670
|
+
// If the L1 representation of the requirement is ETH then find the ETH balance and check if the balance covers the delta
|
|
29671
|
+
if (l1address === ($823db9fb0ca4bc15$export$c37d8687c27b9660)) {
|
|
29672
|
+
const nativeETHBalance = tokenBalanceResult.balances.find((balance)=>$fa9ac5bfdbbf9dfa$export$3139474685e4dedd(balance.token.address));
|
|
29673
|
+
if (nativeETHBalance && nativeETHBalance.balance.gte(balanceRequirement.delta.balance.add(bridgeFeeEstimate))) return $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute(chainId, nativeETHBalance);
|
|
29674
|
+
return undefined;
|
|
29675
|
+
}
|
|
29676
|
+
// Find the balance of the L1 representation of the token and check if the balance covers the delta
|
|
29677
|
+
const erc20balance = tokenBalanceResult.balances.find((balance)=>balance.token.address === l1address);
|
|
29678
|
+
if (erc20balance && erc20balance.balance.gte(balanceRequirement.delta.balance)) return $fa9ac5bfdbbf9dfa$var$constructBridgeFundingRoute(chainId, erc20balance);
|
|
29679
|
+
return undefined;
|
|
29680
|
+
};
|
|
29681
|
+
|
|
29682
|
+
|
|
29683
|
+
|
|
29684
|
+
|
|
29685
|
+
|
|
29686
|
+
async function $0e0060cb42e136d2$export$339cb2be73677b30(config, existingReadOnlyProviders) {
|
|
29687
|
+
if (config.isProduction && existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM)) return existingReadOnlyProviders;
|
|
29688
|
+
if (existingReadOnlyProviders?.has(($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA)) return existingReadOnlyProviders;
|
|
29689
|
+
const readOnlyProviders = new Map();
|
|
29690
|
+
const allowedNetworks = await $de192de6ef100f9f$export$3043f6442a9ef563(config, {
|
|
29691
|
+
type: ($a47e48dd2c04791b$export$1f05a55fe0680cc7).ALL
|
|
29692
|
+
});
|
|
29693
|
+
allowedNetworks.networks.forEach((networkInfo)=>{
|
|
29694
|
+
const rpcUrl = config.networkMap.get(networkInfo.chainId)?.rpcUrls[0];
|
|
29695
|
+
const provider = new (JsonRpcProvider)(rpcUrl);
|
|
29696
|
+
readOnlyProviders.set(networkInfo.chainId, provider);
|
|
29697
|
+
});
|
|
29698
|
+
return readOnlyProviders;
|
|
29699
|
+
}
|
|
29700
|
+
|
|
29701
|
+
|
|
29702
|
+
|
|
29703
|
+
const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
|
|
29704
|
+
let insufficientBalanceCount = 0;
|
|
29705
|
+
let insufficientBridgeRequirement;
|
|
29706
|
+
for (const balanceRequirement of balanceRequirements.balanceRequirements)if (!balanceRequirement.sufficient) {
|
|
29707
|
+
insufficientBalanceCount++;
|
|
29708
|
+
insufficientBridgeRequirement = balanceRequirement;
|
|
29709
|
+
}
|
|
29710
|
+
if (insufficientBalanceCount === 1) return insufficientBridgeRequirement;
|
|
29711
|
+
return undefined;
|
|
29712
|
+
};
|
|
29525
29713
|
const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
|
|
29526
|
-
|
|
29527
|
-
|
|
29528
|
-
|
|
29714
|
+
let readOnlyProviders;
|
|
29715
|
+
try {
|
|
29716
|
+
readOnlyProviders = await (0, $0e0060cb42e136d2$export$339cb2be73677b30)(config);
|
|
29717
|
+
} catch (err) {
|
|
29718
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Error occurred while creating read only providers", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_ERROR, {
|
|
29719
|
+
message: err.message
|
|
29720
|
+
});
|
|
29721
|
+
}
|
|
29722
|
+
const tokenBalances = await ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, readOnlyProviders, ownerAddress, availableRoutingOptions);
|
|
29529
29723
|
// Get allowed tokens?
|
|
29530
|
-
//
|
|
29724
|
+
// Bridge and swap fee cache
|
|
29725
|
+
const feeEstimates = new Map();
|
|
29726
|
+
// Ensures only 1 balance requirement is insufficient otherwise one bridge route cannot be recommended
|
|
29727
|
+
let bridgeFundingStep;
|
|
29728
|
+
const insufficientRequirement = $c16168a9c28ae4fd$export$31ce7ba1a2956195(balanceRequirements);
|
|
29729
|
+
if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
|
|
29531
29730
|
// Check on-ramp routes
|
|
29532
29731
|
// Check swap routes
|
|
29533
29732
|
// > Could bridge first
|
|
29534
29733
|
// > Could on-ramp first
|
|
29535
29734
|
// > Could double swap
|
|
29536
|
-
return {
|
|
29735
|
+
if (bridgeFundingStep) return {
|
|
29537
29736
|
availableOptions: [],
|
|
29538
29737
|
response: {
|
|
29539
|
-
type:
|
|
29738
|
+
type: ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND,
|
|
29540
29739
|
message: "Routes found"
|
|
29541
29740
|
},
|
|
29542
29741
|
fundingRoutes: [
|
|
29543
29742
|
{
|
|
29544
29743
|
priority: 1,
|
|
29545
29744
|
steps: [
|
|
29546
|
-
|
|
29547
|
-
type: "bridge",
|
|
29548
|
-
chainId: 1,
|
|
29549
|
-
asset: {
|
|
29550
|
-
balance: (BigNumber$1).from(0),
|
|
29551
|
-
formattedBalance: "0",
|
|
29552
|
-
token: {
|
|
29553
|
-
name: "ETH",
|
|
29554
|
-
symbol: "ETH",
|
|
29555
|
-
decimals: 18
|
|
29556
|
-
}
|
|
29557
|
-
}
|
|
29558
|
-
}
|
|
29745
|
+
bridgeFundingStep
|
|
29559
29746
|
]
|
|
29560
29747
|
}
|
|
29561
29748
|
]
|
|
29562
29749
|
};
|
|
29750
|
+
return {
|
|
29751
|
+
availableOptions: [],
|
|
29752
|
+
response: {
|
|
29753
|
+
type: ($b23305044c0e096a$export$3057de18ac0c076).NO_ROUTES,
|
|
29754
|
+
message: "Routes not found"
|
|
29755
|
+
},
|
|
29756
|
+
fundingRoutes: []
|
|
29757
|
+
};
|
|
29563
29758
|
};
|
|
29564
29759
|
|
|
29565
29760
|
|
|
@@ -30272,7 +30467,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
30272
30467
|
function $parcel$export(e, n, v, s) {
|
|
30273
30468
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
30274
30469
|
}
|
|
30275
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.
|
|
30470
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.5";
|
|
30276
30471
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
30277
30472
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
30278
30473
|
|
package/dist/passport.js
CHANGED
|
@@ -1709,7 +1709,7 @@ class MultiRollupApiClients {
|
|
|
1709
1709
|
}
|
|
1710
1710
|
|
|
1711
1711
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1712
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.17.
|
|
1712
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.17.5' };
|
|
1713
1713
|
const createConfig = ({ basePath, headers, }) => {
|
|
1714
1714
|
if (!basePath.trim()) {
|
|
1715
1715
|
throw Error('basePath can not be empty');
|
|
@@ -1765,7 +1765,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
1765
1765
|
chainID,
|
|
1766
1766
|
coreContractAddress,
|
|
1767
1767
|
registrationContractAddress,
|
|
1768
|
-
sdkVersion: 'ts-immutable-sdk-0.17.
|
|
1768
|
+
sdkVersion: 'ts-immutable-sdk-0.17.5',
|
|
1769
1769
|
});
|
|
1770
1770
|
/**
|
|
1771
1771
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED