@imtbl/sdk 0.40.0 → 0.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockchain_data.js +1 -1
- package/dist/browser/checkout/sdk.js +5 -5
- package/dist/browser/checkout/widgets.js +1 -1
- package/dist/checkout.js +46 -42
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +3 -3
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +48 -44
- package/dist/index.js +48 -44
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4256,7 +4256,7 @@ class MultiRollupApiClients {
|
|
|
4256
4256
|
}
|
|
4257
4257
|
|
|
4258
4258
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4259
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
4259
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.41.1' };
|
|
4260
4260
|
const createConfig = ({ basePath, headers, }) => {
|
|
4261
4261
|
if (!basePath.trim()) {
|
|
4262
4262
|
throw Error('basePath can not be empty');
|
|
@@ -4316,7 +4316,7 @@ class APIError extends Error {
|
|
|
4316
4316
|
|
|
4317
4317
|
/* eslint-disable implicit-arrow-linebreak */
|
|
4318
4318
|
const defaultHeaders = {
|
|
4319
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
4319
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.41.1',
|
|
4320
4320
|
};
|
|
4321
4321
|
/**
|
|
4322
4322
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4755,7 +4755,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4755
4755
|
chainID,
|
|
4756
4756
|
coreContractAddress,
|
|
4757
4757
|
registrationContractAddress,
|
|
4758
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
4758
|
+
sdkVersion: 'ts-immutable-sdk-0.41.1',
|
|
4759
4759
|
});
|
|
4760
4760
|
/**
|
|
4761
4761
|
* Sets `sdkVersion` at the time of build
|
|
@@ -35533,7 +35533,7 @@ const GAS_OVERRIDES = {
|
|
|
35533
35533
|
maxPriorityFeePerGas: ethers.BigNumber.from(101e9),
|
|
35534
35534
|
};
|
|
35535
35535
|
|
|
35536
|
-
const SDK_VERSION_MARKER = '0.
|
|
35536
|
+
const SDK_VERSION_MARKER = '0.41.1';
|
|
35537
35537
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
35538
35538
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
35539
35539
|
|
|
@@ -35680,6 +35680,8 @@ class CheckoutConfiguration {
|
|
|
35680
35680
|
}
|
|
35681
35681
|
}
|
|
35682
35682
|
|
|
35683
|
+
const isMatchingAddress = (addressA = '', addressB = '') => (addressA.toLowerCase() === addressB.toLowerCase());
|
|
35684
|
+
|
|
35683
35685
|
const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId, exclude, }) => {
|
|
35684
35686
|
let tokens = [];
|
|
35685
35687
|
let onRampConfig;
|
|
@@ -35715,7 +35717,7 @@ const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId,
|
|
|
35715
35717
|
tokens: tokens.filter((token) => !exclude.map((e) => e.address).includes(token.address || '')),
|
|
35716
35718
|
};
|
|
35717
35719
|
};
|
|
35718
|
-
const isNativeToken = (address) => !address || address
|
|
35720
|
+
const isNativeToken = (address) => !address || isMatchingAddress(address, NATIVE);
|
|
35719
35721
|
async function getERC20TokenInfo(web3Provider, tokenAddress) {
|
|
35720
35722
|
return await withCheckoutError(async () => {
|
|
35721
35723
|
const contract = new ethers.Contract(tokenAddress, JSON.stringify(ERC20ABI), web3Provider);
|
|
@@ -36005,7 +36007,7 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
|
|
|
36005
36007
|
// For some reason isNativeToken always returns undefined.
|
|
36006
36008
|
// We have spent way too much time figuring out why this is happening.
|
|
36007
36009
|
// That we have given up -- keep it as it is for now.
|
|
36008
|
-
if (!token.address || token.address
|
|
36010
|
+
if (!token.address || isMatchingAddress(token.address, NATIVE)) {
|
|
36009
36011
|
allBalancePromises.push(getBalance(config, web3Provider, walletAddress));
|
|
36010
36012
|
}
|
|
36011
36013
|
else {
|
|
@@ -36019,7 +36021,7 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
|
|
|
36019
36021
|
// For some reason isNativeToken always returns undefined.
|
|
36020
36022
|
// We have spent way too much time figuring out why this is happening.
|
|
36021
36023
|
// That we have given up -- keep it as it is for now.
|
|
36022
|
-
if (!token.address || token.address
|
|
36024
|
+
if (!token.address || isMatchingAddress(token.address, NATIVE))
|
|
36023
36025
|
resp.value.token.address = NATIVE;
|
|
36024
36026
|
return resp.value;
|
|
36025
36027
|
});
|
|
@@ -36781,7 +36783,7 @@ const getERC721BalanceRequirement = (itemRequirement, balances) => {
|
|
|
36781
36783
|
// Find the requirements related balance
|
|
36782
36784
|
const itemBalanceResult = balances.find((balance) => {
|
|
36783
36785
|
const balanceERC721Result = balance;
|
|
36784
|
-
return balanceERC721Result.contractAddress
|
|
36786
|
+
return isMatchingAddress(balanceERC721Result.contractAddress, itemRequirement.contractAddress)
|
|
36785
36787
|
&& balanceERC721Result.id === itemRequirement.id;
|
|
36786
36788
|
});
|
|
36787
36789
|
// Calculate the balance delta
|
|
@@ -36821,7 +36823,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
|
|
|
36821
36823
|
// Get the requirements related balance
|
|
36822
36824
|
if (itemRequirement.type === ItemType.ERC20) {
|
|
36823
36825
|
itemBalanceResult = balances.find((balance) => {
|
|
36824
|
-
return balance.token?.address
|
|
36826
|
+
return isMatchingAddress(balance.token?.address, itemRequirement.tokenAddress);
|
|
36825
36827
|
});
|
|
36826
36828
|
}
|
|
36827
36829
|
else if (itemRequirement.type === ItemType.NATIVE) {
|
|
@@ -36943,7 +36945,7 @@ const getERC721Balances = async (provider, ownerAddress, itemRequirements) => {
|
|
|
36943
36945
|
erc721Owners.forEach((erc721OwnerAddress, index) => {
|
|
36944
36946
|
const itemRequirement = erc721s.get(erc721OwnersPromiseIds[index]);
|
|
36945
36947
|
let itemCount = 0;
|
|
36946
|
-
if (itemRequirement && ownerAddress
|
|
36948
|
+
if (itemRequirement && isMatchingAddress(ownerAddress, erc721OwnerAddress)) {
|
|
36947
36949
|
itemCount = 1;
|
|
36948
36950
|
}
|
|
36949
36951
|
erc721Balances.push({
|
|
@@ -37091,15 +37093,15 @@ const availabilityService = (isDevelopment, isProduction) => {
|
|
|
37091
37093
|
response = await globalAxios$1.post(`${postEndpoint()}/v1/availability/checkout/swap`);
|
|
37092
37094
|
}
|
|
37093
37095
|
catch (error) {
|
|
37096
|
+
// The request was made and the server responded with a status code
|
|
37097
|
+
// that falls out of the range of 2xx
|
|
37094
37098
|
response = error.response;
|
|
37099
|
+
// If 403 then the service is geo-blocked
|
|
37100
|
+
if (response.status === 403)
|
|
37101
|
+
return false;
|
|
37102
|
+
throw new CheckoutError(`Error fetching from api: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR);
|
|
37095
37103
|
}
|
|
37096
|
-
|
|
37097
|
-
return false;
|
|
37098
|
-
}
|
|
37099
|
-
if (response.status === 204) {
|
|
37100
|
-
return true;
|
|
37101
|
-
}
|
|
37102
|
-
throw new CheckoutError(`Error fetching from api: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR);
|
|
37104
|
+
return true;
|
|
37103
37105
|
};
|
|
37104
37106
|
return {
|
|
37105
37107
|
checkDexAvailability,
|
|
@@ -37383,7 +37385,7 @@ const checkUserCanCoverApprovalFees = (l2Balances, approval) => {
|
|
|
37383
37385
|
}
|
|
37384
37386
|
// Find the users balance of the approval token
|
|
37385
37387
|
const l2BalanceOfApprovalToken = l2Balances.find((balance) => (isNativeToken(balance.token.address) && isNativeToken(approvalGasTokenAddress))
|
|
37386
|
-
|| balance.token.address
|
|
37388
|
+
|| isMatchingAddress(balance.token.address, approvalGasTokenAddress));
|
|
37387
37389
|
if (!l2BalanceOfApprovalToken)
|
|
37388
37390
|
return { sufficient: false, approvalGasFee, approvalGasTokenAddress };
|
|
37389
37391
|
// If the user does not have enough of the token to cover approval fees then return sufficient false
|
|
@@ -37438,7 +37440,7 @@ const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFee, swapFee
|
|
|
37438
37440
|
if (fee === ethers.BigNumber.from(0))
|
|
37439
37441
|
continue;
|
|
37440
37442
|
const l2BalanceOfFeeToken = l2Balances.find((balance) => (isNativeToken(balance.token.address) && isNativeToken(tokenAddress))
|
|
37441
|
-
|| balance.token.address
|
|
37443
|
+
|| isMatchingAddress(balance.token.address, tokenAddress));
|
|
37442
37444
|
if (!l2BalanceOfFeeToken) {
|
|
37443
37445
|
return false;
|
|
37444
37446
|
}
|
|
@@ -37459,7 +37461,8 @@ const checkIfUserCanCoverRequirement = (l2balance, balanceRequirements, quoteTok
|
|
|
37459
37461
|
let requirementExists = false;
|
|
37460
37462
|
balanceRequirements.balanceRequirements.forEach((requirement) => {
|
|
37461
37463
|
if (requirement.type === ItemType.NATIVE || requirement.type === ItemType.ERC20) {
|
|
37462
|
-
if (requirement.required.token.address
|
|
37464
|
+
if (requirement.required.token.address
|
|
37465
|
+
&& isMatchingAddress(requirement.required.token.address, quoteTokenAddress)) {
|
|
37463
37466
|
balanceRequirementToken = requirement.required.token.address;
|
|
37464
37467
|
requirementExists = true;
|
|
37465
37468
|
// Get the balance that would remain if the requirement was removed from the users balance
|
|
@@ -37471,12 +37474,12 @@ const checkIfUserCanCoverRequirement = (l2balance, balanceRequirements, quoteTok
|
|
|
37471
37474
|
if (!requirementExists)
|
|
37472
37475
|
return true;
|
|
37473
37476
|
// Remove approval fees from the remainder if token matches as these need to be taken out to cover the swap
|
|
37474
|
-
if (approvalFees.approvalGasTokenAddress
|
|
37477
|
+
if (isMatchingAddress(approvalFees.approvalGasTokenAddress, balanceRequirementToken)) {
|
|
37475
37478
|
remainingBalance = remainingBalance.sub(approvalFees.approvalGasFee);
|
|
37476
37479
|
}
|
|
37477
37480
|
// Remove swap fees from the remainder if token matches as these need to be taken out to cover the swap
|
|
37478
37481
|
for (const swapFee of swapFees) {
|
|
37479
|
-
if (swapFee.amount.token.address
|
|
37482
|
+
if (isMatchingAddress(swapFee.amount.token.address, balanceRequirementToken)) {
|
|
37480
37483
|
remainingBalance = remainingBalance.sub(swapFee.amount.value);
|
|
37481
37484
|
}
|
|
37482
37485
|
}
|
|
@@ -37507,7 +37510,7 @@ const swapRoute = async (config, availableRoutingOptions, walletAddress, balance
|
|
|
37507
37510
|
if (!quote)
|
|
37508
37511
|
continue;
|
|
37509
37512
|
// Find the balance the user has for this quoted token
|
|
37510
|
-
const userBalanceOfQuotedToken = l2Balances.find((balance) => balance.token.address
|
|
37513
|
+
const userBalanceOfQuotedToken = l2Balances.find((balance) => isMatchingAddress(balance.token.address, quoteTokenAddress));
|
|
37511
37514
|
// If no balance found on L2 for this quoted token then continue
|
|
37512
37515
|
if (!userBalanceOfQuotedToken)
|
|
37513
37516
|
continue;
|
|
@@ -37540,7 +37543,8 @@ const filterTokens = (allowedTokens, balances) => {
|
|
|
37540
37543
|
if (balances && balances.success) {
|
|
37541
37544
|
return allowedTokens.filter((token) => {
|
|
37542
37545
|
if ('address' in token) {
|
|
37543
|
-
return balances.balances.find((balance) => balance.token.address
|
|
37546
|
+
return balances.balances.find((balance) => isMatchingAddress(balance.token.address, token.address)
|
|
37547
|
+
&& balance.balance.gt(0));
|
|
37544
37548
|
}
|
|
37545
37549
|
return balances.balances.find((balance) => !('address' in balance.token) && balance.balance.gt(0));
|
|
37546
37550
|
});
|
|
@@ -37640,9 +37644,8 @@ const fetchL1Representation = async (config, l2address) => {
|
|
|
37640
37644
|
chainName,
|
|
37641
37645
|
contractAddress: l2address,
|
|
37642
37646
|
});
|
|
37643
|
-
// TODO: When bridge is ready we need to understand how L2 ETH will be mapped back to L1 ETH
|
|
37644
37647
|
const l1address = tokenData.result.root_contract_address;
|
|
37645
|
-
if (l1address
|
|
37648
|
+
if (isMatchingAddress(l1address ?? '', INDEXER_ETH_ROOT_CONTRACT_ADDRESS)) {
|
|
37646
37649
|
return {
|
|
37647
37650
|
l1address: 'native',
|
|
37648
37651
|
l2address,
|
|
@@ -37744,7 +37747,7 @@ const bridgeRoute = async (config, readOnlyProviders, availableRoutingOptions, b
|
|
|
37744
37747
|
if (!allowedL1TokenList.find((token) => isNativeToken(token.address)))
|
|
37745
37748
|
return undefined;
|
|
37746
37749
|
}
|
|
37747
|
-
else if (!allowedL1TokenList.find((token) => token.address
|
|
37750
|
+
else if (!allowedL1TokenList.find((token) => isMatchingAddress(token.address, l1address))) {
|
|
37748
37751
|
return undefined;
|
|
37749
37752
|
}
|
|
37750
37753
|
const feesFromBridge = await getBridgeFeeEstimate(config, readOnlyProviders, l1ChainId, l2ChainId);
|
|
@@ -37763,7 +37766,7 @@ const bridgeRoute = async (config, readOnlyProviders, availableRoutingOptions, b
|
|
|
37763
37766
|
return undefined;
|
|
37764
37767
|
}
|
|
37765
37768
|
// Find the balance of the L1 representation of the token and check if the balance covers the delta
|
|
37766
|
-
const erc20balance = tokenBalanceResult.balances.find((balance) => balance.token.address
|
|
37769
|
+
const erc20balance = tokenBalanceResult.balances.find((balance) => isMatchingAddress(balance.token.address, l1address));
|
|
37767
37770
|
if (erc20balance && erc20balance.balance.gte(bridgeRequirement.amount)) {
|
|
37768
37771
|
const bridgeFees = constructFees(sourceChainGas, bridgeFee, imtblFee, approvalGas, nativeToken);
|
|
37769
37772
|
return constructBridgeFundingRoute(l1ChainId, erc20balance, bridgeRequirement, ItemType.ERC20, bridgeFees);
|
|
@@ -37801,12 +37804,12 @@ const getBalancesByChain = (config, tokenBalances) => {
|
|
|
37801
37804
|
const getFeesForTokenAddress = (dexQuote, tokenAddress) => {
|
|
37802
37805
|
let fees = ethers.BigNumber.from(0);
|
|
37803
37806
|
dexQuote.quote.fees.forEach((fee) => {
|
|
37804
|
-
if (fee.amount.token.address
|
|
37807
|
+
if (isMatchingAddress(fee.amount.token.address, tokenAddress)) {
|
|
37805
37808
|
fees = fees.add(fee.amount.value);
|
|
37806
37809
|
}
|
|
37807
37810
|
});
|
|
37808
37811
|
if (dexQuote.approval) {
|
|
37809
|
-
if (dexQuote.approval.token.address
|
|
37812
|
+
if (isMatchingAddress(dexQuote.approval.token.address, tokenAddress)) {
|
|
37810
37813
|
fees = fees.add(dexQuote.approval.value);
|
|
37811
37814
|
}
|
|
37812
37815
|
}
|
|
@@ -37819,7 +37822,7 @@ const getAmountFromBalanceRequirement = (balanceRequirements, quotedTokenAddress
|
|
|
37819
37822
|
// Find if there is an existing balance requirement of the token attempting to be bridged->swapped
|
|
37820
37823
|
for (const requirement of balanceRequirements.balanceRequirements) {
|
|
37821
37824
|
if (requirement.type === ItemType.NATIVE || requirement.type === ItemType.ERC20) {
|
|
37822
|
-
if (requirement.required.token.address
|
|
37825
|
+
if (isMatchingAddress(requirement.required.token.address, quotedTokenAddress)) {
|
|
37823
37826
|
return requirement.required.balance;
|
|
37824
37827
|
}
|
|
37825
37828
|
}
|
|
@@ -37857,8 +37860,8 @@ const constructBridgeRequirements = (dexQuotes, l1balances, l2balances, l1tol2ad
|
|
|
37857
37860
|
const bridgeRequirements = [];
|
|
37858
37861
|
for (const [tokenAddress, quote] of dexQuotes) {
|
|
37859
37862
|
// Get the L2 balance for the token address
|
|
37860
|
-
const l2balance = l2balances.find((balance) => balance.token.address
|
|
37861
|
-
const l1tol2TokenMapping = l1tol2addresses.find((token) => token.l2address
|
|
37863
|
+
const l2balance = l2balances.find((balance) => isMatchingAddress(balance.token.address, tokenAddress));
|
|
37864
|
+
const l1tol2TokenMapping = l1tol2addresses.find((token) => isMatchingAddress(token.l2address, tokenAddress));
|
|
37862
37865
|
if (!l1tol2TokenMapping)
|
|
37863
37866
|
continue;
|
|
37864
37867
|
const { l1address, l2address } = l1tol2TokenMapping;
|
|
@@ -37867,10 +37870,10 @@ const constructBridgeRequirements = (dexQuotes, l1balances, l2balances, l1tol2ad
|
|
|
37867
37870
|
// If the user does not have any L1 balance for this token then cannot bridge
|
|
37868
37871
|
const l1balance = l1balances.find((balance) => {
|
|
37869
37872
|
if (balance.token.address === undefined
|
|
37870
|
-
&& l1address
|
|
37873
|
+
&& isMatchingAddress(l1address, INDEXER_ETH_ROOT_CONTRACT_ADDRESS)) {
|
|
37871
37874
|
return true;
|
|
37872
37875
|
}
|
|
37873
|
-
return balance.token.address
|
|
37876
|
+
return isMatchingAddress(balance.token.address, l1address);
|
|
37874
37877
|
});
|
|
37875
37878
|
if (!l1balance)
|
|
37876
37879
|
continue;
|
|
@@ -37950,9 +37953,9 @@ const filterSwappableTokensByBridgeableAddresses = (requiredTokenAddress, bridge
|
|
|
37950
37953
|
if (!bridgeableTokens.includes(addresses.l1address))
|
|
37951
37954
|
continue;
|
|
37952
37955
|
// Filter out the token that is required from the swappable tokens list
|
|
37953
|
-
if (addresses.l2address
|
|
37956
|
+
if (isMatchingAddress(addresses.l2address, requiredTokenAddress))
|
|
37954
37957
|
continue;
|
|
37955
|
-
const tokenInfo = swappableTokens.find((token) => token.address
|
|
37958
|
+
const tokenInfo = swappableTokens.find((token) => isMatchingAddress(token.address, addresses.l2address));
|
|
37956
37959
|
if (!tokenInfo)
|
|
37957
37960
|
continue;
|
|
37958
37961
|
filteredSwappableTokens.push(tokenInfo);
|
|
@@ -37989,7 +37992,7 @@ const modifyTokenBalancesWithBridgedAmount = (config, tokenBalances, l2balances,
|
|
|
37989
37992
|
if (currentBalance)
|
|
37990
37993
|
l2balance = currentBalance.balance;
|
|
37991
37994
|
const newBalance = l2balance.add(amount);
|
|
37992
|
-
const tokenInfo = swappableTokens.find((token) => token.address
|
|
37995
|
+
const tokenInfo = swappableTokens.find((token) => isMatchingAddress(token.address, l2address));
|
|
37993
37996
|
balanceMap.set(l2address, {
|
|
37994
37997
|
balance: newBalance,
|
|
37995
37998
|
formattedBalance: ethers.utils.formatUnits(newBalance, tokenInfo.decimals),
|
|
@@ -38015,7 +38018,7 @@ const reapplyOriginalSwapBalances = (tokenBalances, swapRoutes) => {
|
|
|
38015
38018
|
continue;
|
|
38016
38019
|
let originalBalance = ethers.BigNumber.from(0);
|
|
38017
38020
|
let originalFormattedBalance = '0';
|
|
38018
|
-
const l2balance = tokenBalance.balances.find((balance) => balance.token.address
|
|
38021
|
+
const l2balance = tokenBalance.balances.find((balance) => isMatchingAddress(balance.token.address, fundingItem.token.address));
|
|
38019
38022
|
if (l2balance) {
|
|
38020
38023
|
originalBalance = l2balance.balance;
|
|
38021
38024
|
originalFormattedBalance = l2balance.formattedBalance;
|
|
@@ -38033,13 +38036,14 @@ const constructBridgeAndSwapRoutes = (bridgeFundingSteps, swapFundingSteps, l1to
|
|
|
38033
38036
|
continue;
|
|
38034
38037
|
const mapping = l1tol2Addresses.find((addresses) => {
|
|
38035
38038
|
if (bridgeFundingStep.fundingItem.token.address === undefined) {
|
|
38036
|
-
return addresses.l1address
|
|
38039
|
+
return isMatchingAddress(addresses.l1address, INDEXER_ETH_ROOT_CONTRACT_ADDRESS) && addresses.l2address;
|
|
38037
38040
|
}
|
|
38038
|
-
return addresses.l1address
|
|
38041
|
+
return (isMatchingAddress(addresses.l1address, bridgeFundingStep.fundingItem.token.address)
|
|
38042
|
+
&& addresses.l2address);
|
|
38039
38043
|
});
|
|
38040
38044
|
if (!mapping)
|
|
38041
38045
|
continue;
|
|
38042
|
-
const swapFundingStep = swapFundingSteps.find((step) => step.fundingItem.token.address
|
|
38046
|
+
const swapFundingStep = swapFundingSteps.find((step) => isMatchingAddress(step.fundingItem.token.address, mapping.l2address));
|
|
38043
38047
|
if (!swapFundingStep)
|
|
38044
38048
|
continue;
|
|
38045
38049
|
bridgeAndSwapRoutes.push({
|
|
@@ -38131,7 +38135,7 @@ const onRampRoute = async (config, availableRoutingOptions, balanceRequirement)
|
|
|
38131
38135
|
if (!required.token)
|
|
38132
38136
|
return;
|
|
38133
38137
|
if (isNativeToken(required.token.address)
|
|
38134
|
-
|| token.address
|
|
38138
|
+
|| isMatchingAddress(token.address, required.token.address)) {
|
|
38135
38139
|
hasAllowList = true;
|
|
38136
38140
|
}
|
|
38137
38141
|
});
|
|
@@ -39378,7 +39382,7 @@ class Checkout {
|
|
|
39378
39382
|
email = userInfo?.email;
|
|
39379
39383
|
}
|
|
39380
39384
|
const tokenList = await getTokenAllowList(this.config, { type: TokenFilterTypes.ONRAMP });
|
|
39381
|
-
const token = tokenList.tokens?.find((t) => t.address
|
|
39385
|
+
const token = tokenList.tokens?.find((t) => isMatchingAddress(t.address, params.tokenAddress));
|
|
39382
39386
|
if (token) {
|
|
39383
39387
|
tokenAmount = params.tokenAmount;
|
|
39384
39388
|
tokenSymbol = token.symbol;
|
package/dist/index.js
CHANGED
|
@@ -4234,7 +4234,7 @@ class MultiRollupApiClients {
|
|
|
4234
4234
|
}
|
|
4235
4235
|
|
|
4236
4236
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4237
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
4237
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.41.1' };
|
|
4238
4238
|
const createConfig = ({ basePath, headers, }) => {
|
|
4239
4239
|
if (!basePath.trim()) {
|
|
4240
4240
|
throw Error('basePath can not be empty');
|
|
@@ -4294,7 +4294,7 @@ class APIError extends Error {
|
|
|
4294
4294
|
|
|
4295
4295
|
/* eslint-disable implicit-arrow-linebreak */
|
|
4296
4296
|
const defaultHeaders = {
|
|
4297
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
4297
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.41.1',
|
|
4298
4298
|
};
|
|
4299
4299
|
/**
|
|
4300
4300
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4733,7 +4733,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4733
4733
|
chainID,
|
|
4734
4734
|
coreContractAddress,
|
|
4735
4735
|
registrationContractAddress,
|
|
4736
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
4736
|
+
sdkVersion: 'ts-immutable-sdk-0.41.1',
|
|
4737
4737
|
});
|
|
4738
4738
|
/**
|
|
4739
4739
|
* Sets `sdkVersion` at the time of build
|
|
@@ -35511,7 +35511,7 @@ const GAS_OVERRIDES = {
|
|
|
35511
35511
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
35512
35512
|
};
|
|
35513
35513
|
|
|
35514
|
-
const SDK_VERSION_MARKER = '0.
|
|
35514
|
+
const SDK_VERSION_MARKER = '0.41.1';
|
|
35515
35515
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
35516
35516
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
35517
35517
|
|
|
@@ -35658,6 +35658,8 @@ class CheckoutConfiguration {
|
|
|
35658
35658
|
}
|
|
35659
35659
|
}
|
|
35660
35660
|
|
|
35661
|
+
const isMatchingAddress = (addressA = '', addressB = '') => (addressA.toLowerCase() === addressB.toLowerCase());
|
|
35662
|
+
|
|
35661
35663
|
const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId, exclude, }) => {
|
|
35662
35664
|
let tokens = [];
|
|
35663
35665
|
let onRampConfig;
|
|
@@ -35693,7 +35695,7 @@ const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId,
|
|
|
35693
35695
|
tokens: tokens.filter((token) => !exclude.map((e) => e.address).includes(token.address || '')),
|
|
35694
35696
|
};
|
|
35695
35697
|
};
|
|
35696
|
-
const isNativeToken = (address) => !address || address
|
|
35698
|
+
const isNativeToken = (address) => !address || isMatchingAddress(address, NATIVE);
|
|
35697
35699
|
async function getERC20TokenInfo(web3Provider, tokenAddress) {
|
|
35698
35700
|
return await withCheckoutError(async () => {
|
|
35699
35701
|
const contract = new Contract$1(tokenAddress, JSON.stringify(ERC20ABI), web3Provider);
|
|
@@ -35983,7 +35985,7 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
|
|
|
35983
35985
|
// For some reason isNativeToken always returns undefined.
|
|
35984
35986
|
// We have spent way too much time figuring out why this is happening.
|
|
35985
35987
|
// That we have given up -- keep it as it is for now.
|
|
35986
|
-
if (!token.address || token.address
|
|
35988
|
+
if (!token.address || isMatchingAddress(token.address, NATIVE)) {
|
|
35987
35989
|
allBalancePromises.push(getBalance(config, web3Provider, walletAddress));
|
|
35988
35990
|
}
|
|
35989
35991
|
else {
|
|
@@ -35997,7 +35999,7 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
|
|
|
35997
35999
|
// For some reason isNativeToken always returns undefined.
|
|
35998
36000
|
// We have spent way too much time figuring out why this is happening.
|
|
35999
36001
|
// That we have given up -- keep it as it is for now.
|
|
36000
|
-
if (!token.address || token.address
|
|
36002
|
+
if (!token.address || isMatchingAddress(token.address, NATIVE))
|
|
36001
36003
|
resp.value.token.address = NATIVE;
|
|
36002
36004
|
return resp.value;
|
|
36003
36005
|
});
|
|
@@ -36759,7 +36761,7 @@ const getERC721BalanceRequirement = (itemRequirement, balances) => {
|
|
|
36759
36761
|
// Find the requirements related balance
|
|
36760
36762
|
const itemBalanceResult = balances.find((balance) => {
|
|
36761
36763
|
const balanceERC721Result = balance;
|
|
36762
|
-
return balanceERC721Result.contractAddress
|
|
36764
|
+
return isMatchingAddress(balanceERC721Result.contractAddress, itemRequirement.contractAddress)
|
|
36763
36765
|
&& balanceERC721Result.id === itemRequirement.id;
|
|
36764
36766
|
});
|
|
36765
36767
|
// Calculate the balance delta
|
|
@@ -36799,7 +36801,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
|
|
|
36799
36801
|
// Get the requirements related balance
|
|
36800
36802
|
if (itemRequirement.type === ItemType.ERC20) {
|
|
36801
36803
|
itemBalanceResult = balances.find((balance) => {
|
|
36802
|
-
return balance.token?.address
|
|
36804
|
+
return isMatchingAddress(balance.token?.address, itemRequirement.tokenAddress);
|
|
36803
36805
|
});
|
|
36804
36806
|
}
|
|
36805
36807
|
else if (itemRequirement.type === ItemType.NATIVE) {
|
|
@@ -36921,7 +36923,7 @@ const getERC721Balances = async (provider, ownerAddress, itemRequirements) => {
|
|
|
36921
36923
|
erc721Owners.forEach((erc721OwnerAddress, index) => {
|
|
36922
36924
|
const itemRequirement = erc721s.get(erc721OwnersPromiseIds[index]);
|
|
36923
36925
|
let itemCount = 0;
|
|
36924
|
-
if (itemRequirement && ownerAddress
|
|
36926
|
+
if (itemRequirement && isMatchingAddress(ownerAddress, erc721OwnerAddress)) {
|
|
36925
36927
|
itemCount = 1;
|
|
36926
36928
|
}
|
|
36927
36929
|
erc721Balances.push({
|
|
@@ -37069,15 +37071,15 @@ const availabilityService = (isDevelopment, isProduction) => {
|
|
|
37069
37071
|
response = await globalAxios$1.post(`${postEndpoint()}/v1/availability/checkout/swap`);
|
|
37070
37072
|
}
|
|
37071
37073
|
catch (error) {
|
|
37074
|
+
// The request was made and the server responded with a status code
|
|
37075
|
+
// that falls out of the range of 2xx
|
|
37072
37076
|
response = error.response;
|
|
37077
|
+
// If 403 then the service is geo-blocked
|
|
37078
|
+
if (response.status === 403)
|
|
37079
|
+
return false;
|
|
37080
|
+
throw new CheckoutError(`Error fetching from api: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR);
|
|
37073
37081
|
}
|
|
37074
|
-
|
|
37075
|
-
return false;
|
|
37076
|
-
}
|
|
37077
|
-
if (response.status === 204) {
|
|
37078
|
-
return true;
|
|
37079
|
-
}
|
|
37080
|
-
throw new CheckoutError(`Error fetching from api: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR);
|
|
37082
|
+
return true;
|
|
37081
37083
|
};
|
|
37082
37084
|
return {
|
|
37083
37085
|
checkDexAvailability,
|
|
@@ -37361,7 +37363,7 @@ const checkUserCanCoverApprovalFees = (l2Balances, approval) => {
|
|
|
37361
37363
|
}
|
|
37362
37364
|
// Find the users balance of the approval token
|
|
37363
37365
|
const l2BalanceOfApprovalToken = l2Balances.find((balance) => (isNativeToken(balance.token.address) && isNativeToken(approvalGasTokenAddress))
|
|
37364
|
-
|| balance.token.address
|
|
37366
|
+
|| isMatchingAddress(balance.token.address, approvalGasTokenAddress));
|
|
37365
37367
|
if (!l2BalanceOfApprovalToken)
|
|
37366
37368
|
return { sufficient: false, approvalGasFee, approvalGasTokenAddress };
|
|
37367
37369
|
// If the user does not have enough of the token to cover approval fees then return sufficient false
|
|
@@ -37416,7 +37418,7 @@ const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFee, swapFee
|
|
|
37416
37418
|
if (fee === BigNumber$1.from(0))
|
|
37417
37419
|
continue;
|
|
37418
37420
|
const l2BalanceOfFeeToken = l2Balances.find((balance) => (isNativeToken(balance.token.address) && isNativeToken(tokenAddress))
|
|
37419
|
-
|| balance.token.address
|
|
37421
|
+
|| isMatchingAddress(balance.token.address, tokenAddress));
|
|
37420
37422
|
if (!l2BalanceOfFeeToken) {
|
|
37421
37423
|
return false;
|
|
37422
37424
|
}
|
|
@@ -37437,7 +37439,8 @@ const checkIfUserCanCoverRequirement = (l2balance, balanceRequirements, quoteTok
|
|
|
37437
37439
|
let requirementExists = false;
|
|
37438
37440
|
balanceRequirements.balanceRequirements.forEach((requirement) => {
|
|
37439
37441
|
if (requirement.type === ItemType.NATIVE || requirement.type === ItemType.ERC20) {
|
|
37440
|
-
if (requirement.required.token.address
|
|
37442
|
+
if (requirement.required.token.address
|
|
37443
|
+
&& isMatchingAddress(requirement.required.token.address, quoteTokenAddress)) {
|
|
37441
37444
|
balanceRequirementToken = requirement.required.token.address;
|
|
37442
37445
|
requirementExists = true;
|
|
37443
37446
|
// Get the balance that would remain if the requirement was removed from the users balance
|
|
@@ -37449,12 +37452,12 @@ const checkIfUserCanCoverRequirement = (l2balance, balanceRequirements, quoteTok
|
|
|
37449
37452
|
if (!requirementExists)
|
|
37450
37453
|
return true;
|
|
37451
37454
|
// Remove approval fees from the remainder if token matches as these need to be taken out to cover the swap
|
|
37452
|
-
if (approvalFees.approvalGasTokenAddress
|
|
37455
|
+
if (isMatchingAddress(approvalFees.approvalGasTokenAddress, balanceRequirementToken)) {
|
|
37453
37456
|
remainingBalance = remainingBalance.sub(approvalFees.approvalGasFee);
|
|
37454
37457
|
}
|
|
37455
37458
|
// Remove swap fees from the remainder if token matches as these need to be taken out to cover the swap
|
|
37456
37459
|
for (const swapFee of swapFees) {
|
|
37457
|
-
if (swapFee.amount.token.address
|
|
37460
|
+
if (isMatchingAddress(swapFee.amount.token.address, balanceRequirementToken)) {
|
|
37458
37461
|
remainingBalance = remainingBalance.sub(swapFee.amount.value);
|
|
37459
37462
|
}
|
|
37460
37463
|
}
|
|
@@ -37485,7 +37488,7 @@ const swapRoute = async (config, availableRoutingOptions, walletAddress, balance
|
|
|
37485
37488
|
if (!quote)
|
|
37486
37489
|
continue;
|
|
37487
37490
|
// Find the balance the user has for this quoted token
|
|
37488
|
-
const userBalanceOfQuotedToken = l2Balances.find((balance) => balance.token.address
|
|
37491
|
+
const userBalanceOfQuotedToken = l2Balances.find((balance) => isMatchingAddress(balance.token.address, quoteTokenAddress));
|
|
37489
37492
|
// If no balance found on L2 for this quoted token then continue
|
|
37490
37493
|
if (!userBalanceOfQuotedToken)
|
|
37491
37494
|
continue;
|
|
@@ -37518,7 +37521,8 @@ const filterTokens = (allowedTokens, balances) => {
|
|
|
37518
37521
|
if (balances && balances.success) {
|
|
37519
37522
|
return allowedTokens.filter((token) => {
|
|
37520
37523
|
if ('address' in token) {
|
|
37521
|
-
return balances.balances.find((balance) => balance.token.address
|
|
37524
|
+
return balances.balances.find((balance) => isMatchingAddress(balance.token.address, token.address)
|
|
37525
|
+
&& balance.balance.gt(0));
|
|
37522
37526
|
}
|
|
37523
37527
|
return balances.balances.find((balance) => !('address' in balance.token) && balance.balance.gt(0));
|
|
37524
37528
|
});
|
|
@@ -37618,9 +37622,8 @@ const fetchL1Representation = async (config, l2address) => {
|
|
|
37618
37622
|
chainName,
|
|
37619
37623
|
contractAddress: l2address,
|
|
37620
37624
|
});
|
|
37621
|
-
// TODO: When bridge is ready we need to understand how L2 ETH will be mapped back to L1 ETH
|
|
37622
37625
|
const l1address = tokenData.result.root_contract_address;
|
|
37623
|
-
if (l1address
|
|
37626
|
+
if (isMatchingAddress(l1address ?? '', INDEXER_ETH_ROOT_CONTRACT_ADDRESS)) {
|
|
37624
37627
|
return {
|
|
37625
37628
|
l1address: 'native',
|
|
37626
37629
|
l2address,
|
|
@@ -37722,7 +37725,7 @@ const bridgeRoute = async (config, readOnlyProviders, availableRoutingOptions, b
|
|
|
37722
37725
|
if (!allowedL1TokenList.find((token) => isNativeToken(token.address)))
|
|
37723
37726
|
return undefined;
|
|
37724
37727
|
}
|
|
37725
|
-
else if (!allowedL1TokenList.find((token) => token.address
|
|
37728
|
+
else if (!allowedL1TokenList.find((token) => isMatchingAddress(token.address, l1address))) {
|
|
37726
37729
|
return undefined;
|
|
37727
37730
|
}
|
|
37728
37731
|
const feesFromBridge = await getBridgeFeeEstimate(config, readOnlyProviders, l1ChainId, l2ChainId);
|
|
@@ -37741,7 +37744,7 @@ const bridgeRoute = async (config, readOnlyProviders, availableRoutingOptions, b
|
|
|
37741
37744
|
return undefined;
|
|
37742
37745
|
}
|
|
37743
37746
|
// Find the balance of the L1 representation of the token and check if the balance covers the delta
|
|
37744
|
-
const erc20balance = tokenBalanceResult.balances.find((balance) => balance.token.address
|
|
37747
|
+
const erc20balance = tokenBalanceResult.balances.find((balance) => isMatchingAddress(balance.token.address, l1address));
|
|
37745
37748
|
if (erc20balance && erc20balance.balance.gte(bridgeRequirement.amount)) {
|
|
37746
37749
|
const bridgeFees = constructFees(sourceChainGas, bridgeFee, imtblFee, approvalGas, nativeToken);
|
|
37747
37750
|
return constructBridgeFundingRoute(l1ChainId, erc20balance, bridgeRequirement, ItemType.ERC20, bridgeFees);
|
|
@@ -37779,12 +37782,12 @@ const getBalancesByChain = (config, tokenBalances) => {
|
|
|
37779
37782
|
const getFeesForTokenAddress = (dexQuote, tokenAddress) => {
|
|
37780
37783
|
let fees = BigNumber$1.from(0);
|
|
37781
37784
|
dexQuote.quote.fees.forEach((fee) => {
|
|
37782
|
-
if (fee.amount.token.address
|
|
37785
|
+
if (isMatchingAddress(fee.amount.token.address, tokenAddress)) {
|
|
37783
37786
|
fees = fees.add(fee.amount.value);
|
|
37784
37787
|
}
|
|
37785
37788
|
});
|
|
37786
37789
|
if (dexQuote.approval) {
|
|
37787
|
-
if (dexQuote.approval.token.address
|
|
37790
|
+
if (isMatchingAddress(dexQuote.approval.token.address, tokenAddress)) {
|
|
37788
37791
|
fees = fees.add(dexQuote.approval.value);
|
|
37789
37792
|
}
|
|
37790
37793
|
}
|
|
@@ -37797,7 +37800,7 @@ const getAmountFromBalanceRequirement = (balanceRequirements, quotedTokenAddress
|
|
|
37797
37800
|
// Find if there is an existing balance requirement of the token attempting to be bridged->swapped
|
|
37798
37801
|
for (const requirement of balanceRequirements.balanceRequirements) {
|
|
37799
37802
|
if (requirement.type === ItemType.NATIVE || requirement.type === ItemType.ERC20) {
|
|
37800
|
-
if (requirement.required.token.address
|
|
37803
|
+
if (isMatchingAddress(requirement.required.token.address, quotedTokenAddress)) {
|
|
37801
37804
|
return requirement.required.balance;
|
|
37802
37805
|
}
|
|
37803
37806
|
}
|
|
@@ -37835,8 +37838,8 @@ const constructBridgeRequirements = (dexQuotes, l1balances, l2balances, l1tol2ad
|
|
|
37835
37838
|
const bridgeRequirements = [];
|
|
37836
37839
|
for (const [tokenAddress, quote] of dexQuotes) {
|
|
37837
37840
|
// Get the L2 balance for the token address
|
|
37838
|
-
const l2balance = l2balances.find((balance) => balance.token.address
|
|
37839
|
-
const l1tol2TokenMapping = l1tol2addresses.find((token) => token.l2address
|
|
37841
|
+
const l2balance = l2balances.find((balance) => isMatchingAddress(balance.token.address, tokenAddress));
|
|
37842
|
+
const l1tol2TokenMapping = l1tol2addresses.find((token) => isMatchingAddress(token.l2address, tokenAddress));
|
|
37840
37843
|
if (!l1tol2TokenMapping)
|
|
37841
37844
|
continue;
|
|
37842
37845
|
const { l1address, l2address } = l1tol2TokenMapping;
|
|
@@ -37845,10 +37848,10 @@ const constructBridgeRequirements = (dexQuotes, l1balances, l2balances, l1tol2ad
|
|
|
37845
37848
|
// If the user does not have any L1 balance for this token then cannot bridge
|
|
37846
37849
|
const l1balance = l1balances.find((balance) => {
|
|
37847
37850
|
if (balance.token.address === undefined
|
|
37848
|
-
&& l1address
|
|
37851
|
+
&& isMatchingAddress(l1address, INDEXER_ETH_ROOT_CONTRACT_ADDRESS)) {
|
|
37849
37852
|
return true;
|
|
37850
37853
|
}
|
|
37851
|
-
return balance.token.address
|
|
37854
|
+
return isMatchingAddress(balance.token.address, l1address);
|
|
37852
37855
|
});
|
|
37853
37856
|
if (!l1balance)
|
|
37854
37857
|
continue;
|
|
@@ -37928,9 +37931,9 @@ const filterSwappableTokensByBridgeableAddresses = (requiredTokenAddress, bridge
|
|
|
37928
37931
|
if (!bridgeableTokens.includes(addresses.l1address))
|
|
37929
37932
|
continue;
|
|
37930
37933
|
// Filter out the token that is required from the swappable tokens list
|
|
37931
|
-
if (addresses.l2address
|
|
37934
|
+
if (isMatchingAddress(addresses.l2address, requiredTokenAddress))
|
|
37932
37935
|
continue;
|
|
37933
|
-
const tokenInfo = swappableTokens.find((token) => token.address
|
|
37936
|
+
const tokenInfo = swappableTokens.find((token) => isMatchingAddress(token.address, addresses.l2address));
|
|
37934
37937
|
if (!tokenInfo)
|
|
37935
37938
|
continue;
|
|
37936
37939
|
filteredSwappableTokens.push(tokenInfo);
|
|
@@ -37967,7 +37970,7 @@ const modifyTokenBalancesWithBridgedAmount = (config, tokenBalances, l2balances,
|
|
|
37967
37970
|
if (currentBalance)
|
|
37968
37971
|
l2balance = currentBalance.balance;
|
|
37969
37972
|
const newBalance = l2balance.add(amount);
|
|
37970
|
-
const tokenInfo = swappableTokens.find((token) => token.address
|
|
37973
|
+
const tokenInfo = swappableTokens.find((token) => isMatchingAddress(token.address, l2address));
|
|
37971
37974
|
balanceMap.set(l2address, {
|
|
37972
37975
|
balance: newBalance,
|
|
37973
37976
|
formattedBalance: utils$3.formatUnits(newBalance, tokenInfo.decimals),
|
|
@@ -37993,7 +37996,7 @@ const reapplyOriginalSwapBalances = (tokenBalances, swapRoutes) => {
|
|
|
37993
37996
|
continue;
|
|
37994
37997
|
let originalBalance = BigNumber$1.from(0);
|
|
37995
37998
|
let originalFormattedBalance = '0';
|
|
37996
|
-
const l2balance = tokenBalance.balances.find((balance) => balance.token.address
|
|
37999
|
+
const l2balance = tokenBalance.balances.find((balance) => isMatchingAddress(balance.token.address, fundingItem.token.address));
|
|
37997
38000
|
if (l2balance) {
|
|
37998
38001
|
originalBalance = l2balance.balance;
|
|
37999
38002
|
originalFormattedBalance = l2balance.formattedBalance;
|
|
@@ -38011,13 +38014,14 @@ const constructBridgeAndSwapRoutes = (bridgeFundingSteps, swapFundingSteps, l1to
|
|
|
38011
38014
|
continue;
|
|
38012
38015
|
const mapping = l1tol2Addresses.find((addresses) => {
|
|
38013
38016
|
if (bridgeFundingStep.fundingItem.token.address === undefined) {
|
|
38014
|
-
return addresses.l1address
|
|
38017
|
+
return isMatchingAddress(addresses.l1address, INDEXER_ETH_ROOT_CONTRACT_ADDRESS) && addresses.l2address;
|
|
38015
38018
|
}
|
|
38016
|
-
return addresses.l1address
|
|
38019
|
+
return (isMatchingAddress(addresses.l1address, bridgeFundingStep.fundingItem.token.address)
|
|
38020
|
+
&& addresses.l2address);
|
|
38017
38021
|
});
|
|
38018
38022
|
if (!mapping)
|
|
38019
38023
|
continue;
|
|
38020
|
-
const swapFundingStep = swapFundingSteps.find((step) => step.fundingItem.token.address
|
|
38024
|
+
const swapFundingStep = swapFundingSteps.find((step) => isMatchingAddress(step.fundingItem.token.address, mapping.l2address));
|
|
38021
38025
|
if (!swapFundingStep)
|
|
38022
38026
|
continue;
|
|
38023
38027
|
bridgeAndSwapRoutes.push({
|
|
@@ -38109,7 +38113,7 @@ const onRampRoute = async (config, availableRoutingOptions, balanceRequirement)
|
|
|
38109
38113
|
if (!required.token)
|
|
38110
38114
|
return;
|
|
38111
38115
|
if (isNativeToken(required.token.address)
|
|
38112
|
-
|| token.address
|
|
38116
|
+
|| isMatchingAddress(token.address, required.token.address)) {
|
|
38113
38117
|
hasAllowList = true;
|
|
38114
38118
|
}
|
|
38115
38119
|
});
|
|
@@ -39356,7 +39360,7 @@ class Checkout {
|
|
|
39356
39360
|
email = userInfo?.email;
|
|
39357
39361
|
}
|
|
39358
39362
|
const tokenList = await getTokenAllowList(this.config, { type: TokenFilterTypes.ONRAMP });
|
|
39359
|
-
const token = tokenList.tokens?.find((t) => t.address
|
|
39363
|
+
const token = tokenList.tokens?.find((t) => isMatchingAddress(t.address, params.tokenAddress));
|
|
39360
39364
|
if (token) {
|
|
39361
39365
|
tokenAmount = params.tokenAmount;
|
|
39362
39366
|
tokenSymbol = token.symbol;
|