@imtbl/sdk 0.17.5 → 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/blockchain_data.js +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +8 -0
- package/dist/checkout_sdk.js +28 -8
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +31 -11
- package/dist/index.d.ts +8 -0
- package/dist/index.js +31 -11
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/checkout_sdk.d.ts
CHANGED
|
@@ -11283,6 +11283,7 @@ interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverri
|
|
|
11283
11283
|
type RemoteConfiguration = {
|
|
11284
11284
|
dex: DexConfig;
|
|
11285
11285
|
onramp: OnRampConfig;
|
|
11286
|
+
bridge: BridgeConfig;
|
|
11286
11287
|
allowedNetworks: AllowedNetworkConfig[];
|
|
11287
11288
|
gasEstimateTokens?: GasEstimateTokenConfig;
|
|
11288
11289
|
};
|
|
@@ -11324,6 +11325,13 @@ type DexConfig = {
|
|
|
11324
11325
|
overrides?: ExchangeOverrides;
|
|
11325
11326
|
tokens?: TokenInfo[];
|
|
11326
11327
|
};
|
|
11328
|
+
/**
|
|
11329
|
+
* A type representing the configuration for the Bridge.
|
|
11330
|
+
* @property {TokenInfo[] | undefined} tokens - An array of tokens compatible with the Bridge.
|
|
11331
|
+
*/
|
|
11332
|
+
type BridgeConfig = {
|
|
11333
|
+
tokens?: TokenInfo[];
|
|
11334
|
+
};
|
|
11327
11335
|
/**
|
|
11328
11336
|
* A type representing an allowed network.
|
|
11329
11337
|
* @property {number} chainId - The network chain id.
|
package/dist/checkout_sdk.js
CHANGED
|
@@ -19536,7 +19536,7 @@ class APIError extends Error {
|
|
|
19536
19536
|
|
|
19537
19537
|
/* eslint-disable implicit-arrow-linebreak */
|
|
19538
19538
|
const defaultHeaders = {
|
|
19539
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.
|
|
19539
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.6',
|
|
19540
19540
|
};
|
|
19541
19541
|
/**
|
|
19542
19542
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -21913,8 +21913,8 @@ const $7d1bfafb81e64d74$export$3a4140bd9e983e4e = async (provider, insufficientI
|
|
|
21913
21913
|
|
|
21914
21914
|
|
|
21915
21915
|
|
|
21916
|
-
const $1fda5c40669a566d$export$1fac8e857d728583 = async ()=>
|
|
21917
|
-
const $1fda5c40669a566d$export$2e83e9eeaf217e20 = async ()=>
|
|
21916
|
+
const $1fda5c40669a566d$export$1fac8e857d728583 = async ()=>false;
|
|
21917
|
+
const $1fda5c40669a566d$export$2e83e9eeaf217e20 = async ()=>false;
|
|
21918
21918
|
|
|
21919
21919
|
|
|
21920
21920
|
const $7f2e17f026d4fc8d$var$isPassportProvider = (provider)=>(provider.provider?.isPassport === true) ?? false;
|
|
@@ -22097,6 +22097,24 @@ const $07ac9c0576988336$export$a3dd181de896b7c7 = async (config, readOnlyProvide
|
|
|
22097
22097
|
|
|
22098
22098
|
|
|
22099
22099
|
|
|
22100
|
+
|
|
22101
|
+
const $5a5ccedc98d53d25$var$filterTokens = (allowedTokens, balances)=>{
|
|
22102
|
+
if (balances && balances.success) return allowedTokens.filter((token)=>{
|
|
22103
|
+
if ("address" in token) return balances.balances.find((balance)=>balance.token.address === token.address && balance.balance.gt(0));
|
|
22104
|
+
return balances.balances.find((balance)=>!("address" in balance.token) && balance.balance.gt(0));
|
|
22105
|
+
});
|
|
22106
|
+
return [];
|
|
22107
|
+
};
|
|
22108
|
+
const $5a5ccedc98d53d25$export$d744af9f1c0712bc = async (config, tokenBalances, availableRoutingOptions)=>{
|
|
22109
|
+
if (availableRoutingOptions.bridge) {
|
|
22110
|
+
const allowedTokens = (await config.remote.getConfig("bridge"))?.tokens ?? [];
|
|
22111
|
+
const balances = tokenBalances.get(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
|
|
22112
|
+
return $5a5ccedc98d53d25$var$filterTokens(allowedTokens, balances);
|
|
22113
|
+
}
|
|
22114
|
+
return [];
|
|
22115
|
+
};
|
|
22116
|
+
|
|
22117
|
+
|
|
22100
22118
|
const $fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665 = (balances, totalFees)=>{
|
|
22101
22119
|
const balance = ($f730af3b727f04ac$export$22fea095b15361de)(balances);
|
|
22102
22120
|
return balance.gte(totalFees);
|
|
@@ -22155,15 +22173,18 @@ const $fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa = async (config, readOnlyProvide
|
|
|
22155
22173
|
chainId: chainId.toString()
|
|
22156
22174
|
});
|
|
22157
22175
|
// If no balances on layer 1 then Bridge cannot be an option
|
|
22158
|
-
if (tokenBalanceResult === undefined || tokenBalanceResult.success === false)
|
|
22159
|
-
|
|
22160
|
-
|
|
22161
|
-
if (tokenBalanceResult.balances.length === 0) return undefined;
|
|
22176
|
+
if (tokenBalanceResult === undefined || tokenBalanceResult.success === false) return undefined;
|
|
22177
|
+
const allowedTokenList = await ($5a5ccedc98d53d25$export$d744af9f1c0712bc)(config, balances, availableRoutingOptions);
|
|
22178
|
+
if (allowedTokenList.length === 0) return undefined;
|
|
22162
22179
|
const bridgeFeeEstimate = await $fa9ac5bfdbbf9dfa$export$da05aed50d75046(config, readOnlyProviders, feeEstimates);
|
|
22163
22180
|
// If the user has no ETH to cover the bridge fees or approval fees then bridge cannot be an option
|
|
22164
22181
|
if (!$fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665(tokenBalanceResult, bridgeFeeEstimate)) return undefined;
|
|
22165
22182
|
const l1address = await $fa9ac5bfdbbf9dfa$export$952cdf461a00a8c6(config, balanceRequirement);
|
|
22166
22183
|
if (l1address === "") return undefined;
|
|
22184
|
+
// Ensure l1address is in the allowed token list
|
|
22185
|
+
if (l1address === ($823db9fb0ca4bc15$export$c37d8687c27b9660)) {
|
|
22186
|
+
if (!allowedTokenList.find((token)=>!("address" in token))) return undefined;
|
|
22187
|
+
} else if (!allowedTokenList.find((token)=>token.address === l1address)) return undefined;
|
|
22167
22188
|
const gasForApproval = await ($07ac9c0576988336$export$a3dd181de896b7c7)(config, readOnlyProviders, l1provider, depositorAddress, l1address, balanceRequirement.delta.balance);
|
|
22168
22189
|
if (!$fa9ac5bfdbbf9dfa$export$9994ad18c2f0e665(tokenBalanceResult, gasForApproval.add(bridgeFeeEstimate))) return undefined;
|
|
22169
22190
|
// If the L1 representation of the requirement is ETH then find the ETH balance and check if the balance covers the delta
|
|
@@ -22219,7 +22240,6 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
|
|
|
22219
22240
|
});
|
|
22220
22241
|
}
|
|
22221
22242
|
const tokenBalances = await ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, readOnlyProviders, ownerAddress, availableRoutingOptions);
|
|
22222
|
-
// Get allowed tokens?
|
|
22223
22243
|
// Bridge and swap fee cache
|
|
22224
22244
|
const feeEstimates = new Map();
|
|
22225
22245
|
// Ensures only 1 balance requirement is insufficient otherwise one bridge route cannot be recommended
|
package/dist/checkout_widgets.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useEffect } from 'react';
|
|
|
4
4
|
function $parcel$export(e, n, v, s) {
|
|
5
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
6
|
}
|
|
7
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.
|
|
7
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.6";
|
|
8
8
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
9
9
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
16
16
|
chainID,
|
|
17
17
|
coreContractAddress,
|
|
18
18
|
registrationContractAddress,
|
|
19
|
-
sdkVersion: 'ts-immutable-sdk-0.17.
|
|
19
|
+
sdkVersion: 'ts-immutable-sdk-0.17.6',
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
22
22
|
* Sets `sdkVersion` at the time of build
|