@imtbl/sdk 0.44.4-alpha.1 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockchain_data.js +1 -1
- package/dist/browser/checkout/sdk.js +5 -5
- package/dist/checkout.d.ts +2 -2
- package/dist/checkout.js +11 -8
- package/dist/index.browser.js +8 -8
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +2114 -2116
- package/dist/index.d.ts +209 -214
- package/dist/index.js +2116 -2117
- package/dist/passport.d.ts +2 -2
- package/dist/passport.js +4 -4
- package/dist/{immutablex_client.d.ts → x.d.ts} +155 -2
- package/dist/{provider.js → x.js} +522 -9
- package/package.json +7 -11
- package/dist/immutablex_client.js +0 -523
- package/dist/provider.d.ts +0 -979
package/dist/checkout.d.ts
CHANGED
|
@@ -10131,7 +10131,7 @@ interface ImxOverrides {
|
|
|
10131
10131
|
interface ImxModuleConfiguration extends ModuleConfiguration<ImxOverrides> {
|
|
10132
10132
|
}
|
|
10133
10133
|
|
|
10134
|
-
declare class
|
|
10134
|
+
declare class IMXClient {
|
|
10135
10135
|
private immutableX;
|
|
10136
10136
|
depositsApi: DepositsApi$1;
|
|
10137
10137
|
mintsApi: MintsApi$1;
|
|
@@ -21257,7 +21257,7 @@ interface PassportOverrides {
|
|
|
21257
21257
|
magicProviderId: string;
|
|
21258
21258
|
passportDomain: string;
|
|
21259
21259
|
imxPublicApiDomain: string;
|
|
21260
|
-
immutableXClient:
|
|
21260
|
+
immutableXClient: IMXClient;
|
|
21261
21261
|
imxApiClients: ImxApiClients;
|
|
21262
21262
|
zkEvmRpcUrl: string;
|
|
21263
21263
|
relayerUrl: string;
|
package/dist/checkout.js
CHANGED
|
@@ -25961,7 +25961,7 @@ class APIError extends Error {
|
|
|
25961
25961
|
|
|
25962
25962
|
/* eslint-disable implicit-arrow-linebreak */
|
|
25963
25963
|
const defaultHeaders = {
|
|
25964
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
25964
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.45.0',
|
|
25965
25965
|
};
|
|
25966
25966
|
/**
|
|
25967
25967
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -27322,7 +27322,7 @@ const GAS_OVERRIDES = {
|
|
|
27322
27322
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
27323
27323
|
};
|
|
27324
27324
|
|
|
27325
|
-
const SDK_VERSION_MARKER = '0.
|
|
27325
|
+
const SDK_VERSION_MARKER = '0.45.0';
|
|
27326
27326
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
27327
27327
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
27328
27328
|
|
|
@@ -27816,7 +27816,7 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
|
|
|
27816
27816
|
});
|
|
27817
27817
|
return { balances };
|
|
27818
27818
|
};
|
|
27819
|
-
const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
27819
|
+
const getAllBalances = async (config, web3Provider, walletAddress, chainId, forceFetch = false) => {
|
|
27820
27820
|
if (!walletAddress && !web3Provider) {
|
|
27821
27821
|
throw new CheckoutError('both walletAddress and provider are missing. At least one must be provided.', CheckoutErrorType.MISSING_PARAMS);
|
|
27822
27822
|
}
|
|
@@ -27838,6 +27838,9 @@ const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
|
27838
27838
|
// eslint-disable-next-line no-console
|
|
27839
27839
|
console.error(err);
|
|
27840
27840
|
}
|
|
27841
|
+
if (forceFetch) {
|
|
27842
|
+
resetBlockscoutClientMap();
|
|
27843
|
+
}
|
|
27841
27844
|
let address = walletAddress;
|
|
27842
27845
|
if (flag && Blockscout.isChainSupported(chainId)) {
|
|
27843
27846
|
// This is a hack because the widgets are still using the tokens symbol
|
|
@@ -28714,7 +28717,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
|
|
|
28714
28717
|
/**
|
|
28715
28718
|
* Gets the balances for all NATIVE and ERC20 balance requirements.
|
|
28716
28719
|
*/
|
|
28717
|
-
const getTokenBalances = async (config, provider, ownerAddress, itemRequirements) => {
|
|
28720
|
+
const getTokenBalances = async (config, provider, ownerAddress, itemRequirements, forceFetch = false) => {
|
|
28718
28721
|
try {
|
|
28719
28722
|
const tokenMap = new Map();
|
|
28720
28723
|
getTokensFromRequirements(itemRequirements).forEach((item) => {
|
|
@@ -28722,7 +28725,7 @@ const getTokenBalances = async (config, provider, ownerAddress, itemRequirements
|
|
|
28722
28725
|
return;
|
|
28723
28726
|
tokenMap.set(item.address.toLocaleLowerCase(), item);
|
|
28724
28727
|
});
|
|
28725
|
-
const { balances } = await getAllBalances(config, provider, ownerAddress, getL2ChainId(config));
|
|
28728
|
+
const { balances } = await getAllBalances(config, provider, ownerAddress, getL2ChainId(config), forceFetch);
|
|
28726
28729
|
return balances.filter((balance) => tokenMap.get((balance.token.address || NATIVE).toLocaleLowerCase()));
|
|
28727
28730
|
}
|
|
28728
28731
|
catch (err) {
|
|
@@ -28772,7 +28775,7 @@ const getERC721Balances = async (provider, ownerAddress, itemRequirements) => {
|
|
|
28772
28775
|
/**
|
|
28773
28776
|
* Checks the item requirements against the owner balances.
|
|
28774
28777
|
*/
|
|
28775
|
-
const balanceCheck = async (config, provider, ownerAddress, itemRequirements) => {
|
|
28778
|
+
const balanceCheck = async (config, provider, ownerAddress, itemRequirements, forceFetch = false) => {
|
|
28776
28779
|
const aggregatedItems = balanceAggregator(itemRequirements);
|
|
28777
28780
|
const requiredToken = [];
|
|
28778
28781
|
const requiredERC721 = [];
|
|
@@ -28793,7 +28796,7 @@ const balanceCheck = async (config, provider, ownerAddress, itemRequirements) =>
|
|
|
28793
28796
|
// Get all ERC20 and NATIVE balances
|
|
28794
28797
|
const balancePromises = [];
|
|
28795
28798
|
if (requiredToken.length > 0) {
|
|
28796
|
-
balancePromises.push(getTokenBalances(config, provider, ownerAddress, aggregatedItems));
|
|
28799
|
+
balancePromises.push(getTokenBalances(config, provider, ownerAddress, aggregatedItems, forceFetch));
|
|
28797
28800
|
}
|
|
28798
28801
|
// Get all ERC721 balances
|
|
28799
28802
|
if (requiredERC721.length > 0) {
|
|
@@ -30156,7 +30159,7 @@ const smartCheckout = async (config, provider, itemRequirements, transactionOrGa
|
|
|
30156
30159
|
aggregatedItems.push(gasItem);
|
|
30157
30160
|
aggregatedItems = itemAggregator(aggregatedItems);
|
|
30158
30161
|
}
|
|
30159
|
-
const balanceCheckResult = await measureAsyncExecution(config, 'Time to run balance checks', balanceCheck(config, provider, ownerAddress, aggregatedItems));
|
|
30162
|
+
const balanceCheckResult = await measureAsyncExecution(config, 'Time to run balance checks', balanceCheck(config, provider, ownerAddress, aggregatedItems, true));
|
|
30160
30163
|
const { sufficient } = balanceCheckResult;
|
|
30161
30164
|
const transactionRequirements = balanceCheckResult.balanceRequirements;
|
|
30162
30165
|
if (sufficient) {
|