@imtbl/sdk 0.36.1 → 0.36.2-alpha.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.d.ts +138 -57
- package/dist/blockchain_data.js +1 -1
- package/dist/browser/checkout/sdk.js +3 -3
- package/dist/browser/checkout/widgets.js +61 -54
- package/dist/checkout.d.ts +17 -16
- package/dist/checkout.js +144 -71
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +146 -73
- package/dist/index.d.ts +155 -73
- package/dist/index.js +146 -73
- package/dist/passport.js +2 -2
- package/package.json +2 -2
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.36.1' };
|
|
4237
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.36.2-alpha.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.36.1',
|
|
4297
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.36.2-alpha.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.36.1',
|
|
4736
|
+
sdkVersion: 'ts-immutable-sdk-0.36.2-alpha.1',
|
|
4737
4737
|
});
|
|
4738
4738
|
/**
|
|
4739
4739
|
* Sets `sdkVersion` at the time of build
|
|
@@ -26753,59 +26753,18 @@ function parseUnits(value, unitName) {
|
|
|
26753
26753
|
return parseFixed(value, (unitName != null) ? unitName : 18);
|
|
26754
26754
|
}
|
|
26755
26755
|
|
|
26756
|
-
/**
|
|
26757
|
-
* @typedef {Object} CompletionStatus
|
|
26758
|
-
* @property {string} SUCCESS - The transaction has been successfully synced.
|
|
26759
|
-
* @property {string} PENDING - The transaction is still pending.
|
|
26760
|
-
* @property {string} FAILED - The transaction has failed.
|
|
26761
|
-
*/
|
|
26762
|
-
var CompletionStatus;
|
|
26763
|
-
(function (CompletionStatus) {
|
|
26764
|
-
CompletionStatus["SUCCESS"] = "SUCCESS";
|
|
26765
|
-
CompletionStatus["PENDING"] = "PENDING";
|
|
26766
|
-
CompletionStatus["FAILED"] = "FAILED";
|
|
26767
|
-
})(CompletionStatus || (CompletionStatus = {}));
|
|
26768
|
-
/**
|
|
26769
|
-
* @typedef {Object} BridgeFeeActions
|
|
26770
|
-
* @property {string} DEPOSIT - The transaction has been successfully synced.
|
|
26771
|
-
* @property {string} WITHDRAW - The transaction is still pending.
|
|
26772
|
-
* @property {string} FINALISE_WITHDRAWAL - Calculate gas .
|
|
26773
|
-
*/
|
|
26774
|
-
var BridgeFeeActions;
|
|
26775
|
-
(function (BridgeFeeActions) {
|
|
26776
|
-
BridgeFeeActions["DEPOSIT"] = "DEPOSIT";
|
|
26777
|
-
BridgeFeeActions["WITHDRAW"] = "WITHDRAW";
|
|
26778
|
-
BridgeFeeActions["FINALISE_WITHDRAWAL"] = "FINALISE_WITHDRAWAL";
|
|
26779
|
-
})(BridgeFeeActions || (BridgeFeeActions = {}));
|
|
26780
|
-
/**
|
|
26781
|
-
* @typedef {Object} BridgeMethodGas
|
|
26782
|
-
* @property {string} DEPOSIT_SOURCE - The gas required to deposit to the bridge.
|
|
26783
|
-
* @property {string} DEPOSIT_DESTINATION - The gas required to process the deposit on the destination chain.
|
|
26784
|
-
* @property {string} WITHDRAW_SOURCE - The gas required to withdraw from the bridge.
|
|
26785
|
-
* @property {string} WITHDRAW_DESTINATION - The gas required to process the withdrawal on the destination chain.
|
|
26786
|
-
* @property {string} FINALISE_WITHDRAWAL - The gas required to finalise a withdrawal from the flow rate queue.
|
|
26787
|
-
*/
|
|
26788
|
-
var BridgeMethodsGasLimit;
|
|
26789
|
-
(function (BridgeMethodsGasLimit) {
|
|
26790
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 500000] = "DEPOSIT_SOURCE";
|
|
26791
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_DESTINATION"] = 700000] = "DEPOSIT_DESTINATION";
|
|
26792
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 400000] = "WITHDRAW_SOURCE";
|
|
26793
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_DESTINATION"] = 700000] = "WITHDRAW_DESTINATION";
|
|
26794
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_SOURCE"] = 300000] = "MAP_TOKEN_SOURCE";
|
|
26795
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_DESTINATION"] = 700000] = "MAP_TOKEN_DESTINATION";
|
|
26796
|
-
BridgeMethodsGasLimit[BridgeMethodsGasLimit["FINALISE_WITHDRAWAL"] = 200000] = "FINALISE_WITHDRAWAL";
|
|
26797
|
-
})(BridgeMethodsGasLimit || (BridgeMethodsGasLimit = {}));
|
|
26798
|
-
var StatusResponse;
|
|
26799
|
-
(function (StatusResponse) {
|
|
26800
|
-
StatusResponse["PROCESSING"] = "PROCESSING";
|
|
26801
|
-
StatusResponse["COMPLETE"] = "COMPLETE";
|
|
26802
|
-
StatusResponse["RETRY"] = "RETRY";
|
|
26803
|
-
StatusResponse["ERROR"] = "ERROR";
|
|
26804
|
-
StatusResponse["NOT_ENOUGH_GAS"] = "NOT_ENOUGH_GAS";
|
|
26805
|
-
StatusResponse["FLOW_RATE_CONTROLLED"] = "FLOW_RATE_CONTROLLED";
|
|
26806
|
-
})(StatusResponse || (StatusResponse = {}));
|
|
26807
|
-
|
|
26808
26756
|
const ROOT_ERC20_BRIDGE_FLOW_RATE = [
|
|
26757
|
+
{
|
|
26758
|
+
inputs: [
|
|
26759
|
+
{
|
|
26760
|
+
internalType: 'address',
|
|
26761
|
+
name: '_initializerAddress',
|
|
26762
|
+
type: 'address',
|
|
26763
|
+
},
|
|
26764
|
+
],
|
|
26765
|
+
stateMutability: 'nonpayable',
|
|
26766
|
+
type: 'constructor',
|
|
26767
|
+
},
|
|
26809
26768
|
{
|
|
26810
26769
|
inputs: [],
|
|
26811
26770
|
name: 'AlreadyMapped',
|
|
@@ -26956,6 +26915,16 @@ const ROOT_ERC20_BRIDGE_FLOW_RATE = [
|
|
|
26956
26915
|
name: 'TokenIsZero',
|
|
26957
26916
|
type: 'error',
|
|
26958
26917
|
},
|
|
26918
|
+
{
|
|
26919
|
+
inputs: [],
|
|
26920
|
+
name: 'TokenNotSupported',
|
|
26921
|
+
type: 'error',
|
|
26922
|
+
},
|
|
26923
|
+
{
|
|
26924
|
+
inputs: [],
|
|
26925
|
+
name: 'UnauthorizedInitializer',
|
|
26926
|
+
type: 'error',
|
|
26927
|
+
},
|
|
26959
26928
|
{
|
|
26960
26929
|
inputs: [
|
|
26961
26930
|
{
|
|
@@ -28379,6 +28348,19 @@ const ROOT_ERC20_BRIDGE_FLOW_RATE = [
|
|
|
28379
28348
|
stateMutability: 'pure',
|
|
28380
28349
|
type: 'function',
|
|
28381
28350
|
},
|
|
28351
|
+
{
|
|
28352
|
+
inputs: [],
|
|
28353
|
+
name: 'initializerAddress',
|
|
28354
|
+
outputs: [
|
|
28355
|
+
{
|
|
28356
|
+
internalType: 'address',
|
|
28357
|
+
name: '',
|
|
28358
|
+
type: 'address',
|
|
28359
|
+
},
|
|
28360
|
+
],
|
|
28361
|
+
stateMutability: 'view',
|
|
28362
|
+
type: 'function',
|
|
28363
|
+
},
|
|
28382
28364
|
{
|
|
28383
28365
|
inputs: [
|
|
28384
28366
|
{
|
|
@@ -29075,6 +29057,17 @@ const withBridgeError = async (fn, customErrorType, details) => {
|
|
|
29075
29057
|
};
|
|
29076
29058
|
|
|
29077
29059
|
const CHILD_ERC20_BRIDGE = [
|
|
29060
|
+
{
|
|
29061
|
+
inputs: [
|
|
29062
|
+
{
|
|
29063
|
+
internalType: 'address',
|
|
29064
|
+
name: '_initializerAddress',
|
|
29065
|
+
type: 'address',
|
|
29066
|
+
},
|
|
29067
|
+
],
|
|
29068
|
+
stateMutability: 'nonpayable',
|
|
29069
|
+
type: 'constructor',
|
|
29070
|
+
},
|
|
29078
29071
|
{
|
|
29079
29072
|
inputs: [],
|
|
29080
29073
|
name: 'AlreadyMapped',
|
|
@@ -29177,6 +29170,11 @@ const CHILD_ERC20_BRIDGE = [
|
|
|
29177
29170
|
name: 'TransferWIMXFailed',
|
|
29178
29171
|
type: 'error',
|
|
29179
29172
|
},
|
|
29173
|
+
{
|
|
29174
|
+
inputs: [],
|
|
29175
|
+
name: 'UnauthorizedInitializer',
|
|
29176
|
+
type: 'error',
|
|
29177
|
+
},
|
|
29180
29178
|
{
|
|
29181
29179
|
inputs: [],
|
|
29182
29180
|
name: 'ZeroAddress',
|
|
@@ -29931,6 +29929,19 @@ const CHILD_ERC20_BRIDGE = [
|
|
|
29931
29929
|
stateMutability: 'nonpayable',
|
|
29932
29930
|
type: 'function',
|
|
29933
29931
|
},
|
|
29932
|
+
{
|
|
29933
|
+
inputs: [],
|
|
29934
|
+
name: 'initializerAddress',
|
|
29935
|
+
outputs: [
|
|
29936
|
+
{
|
|
29937
|
+
internalType: 'address',
|
|
29938
|
+
name: '',
|
|
29939
|
+
type: 'address',
|
|
29940
|
+
},
|
|
29941
|
+
],
|
|
29942
|
+
stateMutability: 'view',
|
|
29943
|
+
type: 'function',
|
|
29944
|
+
},
|
|
29934
29945
|
{
|
|
29935
29946
|
inputs: [
|
|
29936
29947
|
{
|
|
@@ -30280,6 +30291,58 @@ const getGasPriceInWei$1 = (feeData) => {
|
|
|
30280
30291
|
return null;
|
|
30281
30292
|
};
|
|
30282
30293
|
|
|
30294
|
+
/**
|
|
30295
|
+
* @typedef {Object} CompletionStatus
|
|
30296
|
+
* @property {string} SUCCESS - The transaction has been successfully synced.
|
|
30297
|
+
* @property {string} PENDING - The transaction is still pending.
|
|
30298
|
+
* @property {string} FAILED - The transaction has failed.
|
|
30299
|
+
*/
|
|
30300
|
+
var CompletionStatus;
|
|
30301
|
+
(function (CompletionStatus) {
|
|
30302
|
+
CompletionStatus["SUCCESS"] = "SUCCESS";
|
|
30303
|
+
CompletionStatus["PENDING"] = "PENDING";
|
|
30304
|
+
CompletionStatus["FAILED"] = "FAILED";
|
|
30305
|
+
})(CompletionStatus || (CompletionStatus = {}));
|
|
30306
|
+
/**
|
|
30307
|
+
* @typedef {Object} BridgeFeeActions
|
|
30308
|
+
* @property {string} DEPOSIT - The transaction has been successfully synced.
|
|
30309
|
+
* @property {string} WITHDRAW - The transaction is still pending.
|
|
30310
|
+
* @property {string} FINALISE_WITHDRAWAL - Calculate gas .
|
|
30311
|
+
*/
|
|
30312
|
+
var BridgeFeeActions;
|
|
30313
|
+
(function (BridgeFeeActions) {
|
|
30314
|
+
BridgeFeeActions["DEPOSIT"] = "DEPOSIT";
|
|
30315
|
+
BridgeFeeActions["WITHDRAW"] = "WITHDRAW";
|
|
30316
|
+
BridgeFeeActions["FINALISE_WITHDRAWAL"] = "FINALISE_WITHDRAWAL";
|
|
30317
|
+
})(BridgeFeeActions || (BridgeFeeActions = {}));
|
|
30318
|
+
/**
|
|
30319
|
+
* @typedef {Object} BridgeMethodGas
|
|
30320
|
+
* @property {string} DEPOSIT_SOURCE - The gas required to deposit to the bridge.
|
|
30321
|
+
* @property {string} DEPOSIT_DESTINATION - The gas required to process the deposit on the destination chain.
|
|
30322
|
+
* @property {string} WITHDRAW_SOURCE - The gas required to withdraw from the bridge.
|
|
30323
|
+
* @property {string} WITHDRAW_DESTINATION - The gas required to process the withdrawal on the destination chain.
|
|
30324
|
+
* @property {string} FINALISE_WITHDRAWAL - The gas required to finalise a withdrawal from the flow rate queue.
|
|
30325
|
+
*/
|
|
30326
|
+
var BridgeMethodsGasLimit;
|
|
30327
|
+
(function (BridgeMethodsGasLimit) {
|
|
30328
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_SOURCE"] = 500000] = "DEPOSIT_SOURCE";
|
|
30329
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["DEPOSIT_DESTINATION"] = 700000] = "DEPOSIT_DESTINATION";
|
|
30330
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_SOURCE"] = 400000] = "WITHDRAW_SOURCE";
|
|
30331
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["WITHDRAW_DESTINATION"] = 700000] = "WITHDRAW_DESTINATION";
|
|
30332
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_SOURCE"] = 300000] = "MAP_TOKEN_SOURCE";
|
|
30333
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_DESTINATION"] = 700000] = "MAP_TOKEN_DESTINATION";
|
|
30334
|
+
BridgeMethodsGasLimit[BridgeMethodsGasLimit["FINALISE_WITHDRAWAL"] = 200000] = "FINALISE_WITHDRAWAL";
|
|
30335
|
+
})(BridgeMethodsGasLimit || (BridgeMethodsGasLimit = {}));
|
|
30336
|
+
var StatusResponse;
|
|
30337
|
+
(function (StatusResponse) {
|
|
30338
|
+
StatusResponse["PROCESSING"] = "PROCESSING";
|
|
30339
|
+
StatusResponse["COMPLETE"] = "COMPLETE";
|
|
30340
|
+
StatusResponse["RETRY"] = "RETRY";
|
|
30341
|
+
StatusResponse["ERROR"] = "ERROR";
|
|
30342
|
+
StatusResponse["NOT_ENOUGH_GAS"] = "NOT_ENOUGH_GAS";
|
|
30343
|
+
StatusResponse["FLOW_RATE_CONTROLLED"] = "FLOW_RATE_CONTROLLED";
|
|
30344
|
+
})(StatusResponse || (StatusResponse = {}));
|
|
30345
|
+
|
|
30283
30346
|
/* eslint-disable class-methods-use-this */
|
|
30284
30347
|
/**
|
|
30285
30348
|
* Represents a token bridge, which manages asset transfers between two chains.
|
|
@@ -30900,8 +30963,8 @@ const CONTRACTS_FOR_BRIDGE = new Map()
|
|
|
30900
30963
|
wrappedIMX: '0x0',
|
|
30901
30964
|
})
|
|
30902
30965
|
.set(ETH_SEPOLIA_TO_ZKEVM_TESTNET, {
|
|
30903
|
-
rootERC20BridgeFlowRate: '
|
|
30904
|
-
childERC20Bridge: '
|
|
30966
|
+
rootERC20BridgeFlowRate: '0x0D3C59c779Fd552C27b23F723E80246c840100F5',
|
|
30967
|
+
childERC20Bridge: '0x0D3C59c779Fd552C27b23F723E80246c840100F5',
|
|
30905
30968
|
wrappedIMX: '0xa86C6C6d3D51c0592BE85dA05A9b06B62360D56E',
|
|
30906
30969
|
})
|
|
30907
30970
|
.set(ETH_MAINNET_TO_ZKEVM_MAINNET, {
|
|
@@ -34785,6 +34848,7 @@ var ExchangeType;
|
|
|
34785
34848
|
*/
|
|
34786
34849
|
var CheckoutErrorType;
|
|
34787
34850
|
(function (CheckoutErrorType) {
|
|
34851
|
+
CheckoutErrorType["MISSING_PARAMS"] = "MISSING_PARAMS";
|
|
34788
34852
|
CheckoutErrorType["WEB3_PROVIDER_ERROR"] = "WEB3_PROVIDER_ERROR";
|
|
34789
34853
|
CheckoutErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
|
|
34790
34854
|
CheckoutErrorType["DEFAULT_PROVIDER_ERROR"] = "DEFAULT_PROVIDER_ERROR";
|
|
@@ -35146,7 +35210,7 @@ const BLOCKSCOUT_CHAIN_URL_MAP = {
|
|
|
35146
35210
|
nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_TESTNET).nativeCurrency,
|
|
35147
35211
|
},
|
|
35148
35212
|
[ChainId.IMTBL_ZKEVM_MAINNET]: {
|
|
35149
|
-
url: 'https://explorer.
|
|
35213
|
+
url: 'https://explorer.immutable.com',
|
|
35150
35214
|
nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_MAINNET).nativeCurrency,
|
|
35151
35215
|
},
|
|
35152
35216
|
[ChainId.SEPOLIA]: {
|
|
@@ -35358,7 +35422,7 @@ const GAS_OVERRIDES = {
|
|
|
35358
35422
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
35359
35423
|
};
|
|
35360
35424
|
|
|
35361
|
-
const SDK_VERSION_MARKER = '0.36.1';
|
|
35425
|
+
const SDK_VERSION_MARKER = '0.36.2-alpha.1';
|
|
35362
35426
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
35363
35427
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
35364
35428
|
|
|
@@ -35685,9 +35749,9 @@ const getBalance = async (config, web3Provider, walletAddress) => await withChec
|
|
|
35685
35749
|
token: networkInfo.nativeCurrency,
|
|
35686
35750
|
};
|
|
35687
35751
|
}, { type: CheckoutErrorType.GET_BALANCE_ERROR });
|
|
35688
|
-
async function getERC20Balance(web3Provider, walletAddress,
|
|
35752
|
+
async function getERC20Balance(web3Provider, walletAddress, tokenAddress) {
|
|
35689
35753
|
return await withCheckoutError(async () => {
|
|
35690
|
-
const contract = new Contract$1(
|
|
35754
|
+
const contract = new Contract$1(tokenAddress, JSON.stringify(ERC20ABI), web3Provider);
|
|
35691
35755
|
return Promise.all([
|
|
35692
35756
|
contract.name(),
|
|
35693
35757
|
contract.symbol(),
|
|
@@ -35703,7 +35767,7 @@ async function getERC20Balance(web3Provider, walletAddress, contractAddress) {
|
|
|
35703
35767
|
name,
|
|
35704
35768
|
symbol,
|
|
35705
35769
|
decimals,
|
|
35706
|
-
address:
|
|
35770
|
+
address: tokenAddress,
|
|
35707
35771
|
},
|
|
35708
35772
|
};
|
|
35709
35773
|
});
|
|
@@ -35814,8 +35878,9 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
|
|
|
35814
35878
|
return { balances };
|
|
35815
35879
|
};
|
|
35816
35880
|
const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
35817
|
-
|
|
35818
|
-
|
|
35881
|
+
if (!walletAddress && !web3Provider) {
|
|
35882
|
+
throw new CheckoutError('both walletAddress and provider are missing. At least one must be provided.', CheckoutErrorType.MISSING_PARAMS);
|
|
35883
|
+
}
|
|
35819
35884
|
const { tokens } = await getTokenAllowList(config, {
|
|
35820
35885
|
type: TokenFilterTypes.ALL,
|
|
35821
35886
|
chainId,
|
|
@@ -35831,6 +35896,7 @@ const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
|
35831
35896
|
// eslint-disable-next-line no-console
|
|
35832
35897
|
console.error(err);
|
|
35833
35898
|
}
|
|
35899
|
+
let address = walletAddress;
|
|
35834
35900
|
if (flag && Blockscout.isChainSupported(chainId)) {
|
|
35835
35901
|
// This is a hack because the widgets are still using the tokens symbol
|
|
35836
35902
|
// to drive the conversions. If we remove all the token symbols from e.g. zkevm
|
|
@@ -35838,12 +35904,18 @@ const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
|
35838
35904
|
// Please remove this hack once https://immutable.atlassian.net/browse/WT-1710
|
|
35839
35905
|
// is done.
|
|
35840
35906
|
const isL1Chain = getL1ChainId(config) === chainId;
|
|
35841
|
-
|
|
35907
|
+
if (!address)
|
|
35908
|
+
address = await web3Provider?.getSigner().getAddress();
|
|
35909
|
+
return await measureAsyncExecution(config, `Time to fetch balances using blockscout for ${chainId}`, getIndexerBalance(address, chainId, isL1Chain ? tokens : undefined));
|
|
35910
|
+
}
|
|
35911
|
+
if (!web3Provider) {
|
|
35912
|
+
throw new CheckoutError('indexer is disabled for this chain, you must provide a provider.', CheckoutErrorType.MISSING_PARAMS);
|
|
35842
35913
|
}
|
|
35843
35914
|
// This fallback to use ERC20s calls which is a best effort solution
|
|
35844
35915
|
// Fails in fetching data from the RCP calls might result in some
|
|
35845
35916
|
// missing data.
|
|
35846
|
-
|
|
35917
|
+
address ||= await web3Provider.getSigner().getAddress();
|
|
35918
|
+
return await measureAsyncExecution(config, `Time to fetch balances using RPC for ${chainId}`, getBalances(config, web3Provider, address, tokens));
|
|
35847
35919
|
};
|
|
35848
35920
|
|
|
35849
35921
|
async function checkIsWalletConnected(web3Provider) {
|
|
@@ -37370,14 +37442,16 @@ const getEthBalance = (balances) => {
|
|
|
37370
37442
|
const getBridgeFeeEstimate = async (config, readOnlyProviders, fromChainId, toChainId) => {
|
|
37371
37443
|
const bridge = createBridgeInstance(fromChainId, toChainId, readOnlyProviders, config);
|
|
37372
37444
|
try {
|
|
37373
|
-
const
|
|
37445
|
+
const bridgeFeeResponse = await bridge.getFee({
|
|
37374
37446
|
action: BridgeFeeActions.DEPOSIT,
|
|
37375
37447
|
gasMultiplier: 1.1,
|
|
37376
37448
|
sourceChainId: fromChainId.toString(),
|
|
37377
37449
|
destinationChainId: toChainId.toString(),
|
|
37378
37450
|
});
|
|
37379
|
-
|
|
37380
|
-
|
|
37451
|
+
return {
|
|
37452
|
+
...bridgeFeeResponse,
|
|
37453
|
+
approvalGas: BigNumber$1.from(0),
|
|
37454
|
+
};
|
|
37381
37455
|
}
|
|
37382
37456
|
catch (err) {
|
|
37383
37457
|
throw new CheckoutError('Error estimating gas for bridge', CheckoutErrorType.BRIDGE_GAS_ESTIMATE_ERROR, { message: err.message });
|
|
@@ -38915,10 +38989,10 @@ class Checkout {
|
|
|
38915
38989
|
*/
|
|
38916
38990
|
async getBalance(params) {
|
|
38917
38991
|
const web3Provider = await validateProvider(this.config, params.provider);
|
|
38918
|
-
if (!params.
|
|
38992
|
+
if (!params.tokenAddress || params.tokenAddress === '') {
|
|
38919
38993
|
return await getBalance(this.config, web3Provider, params.walletAddress);
|
|
38920
38994
|
}
|
|
38921
|
-
return await getERC20Balance(web3Provider, params.walletAddress, params.
|
|
38995
|
+
return await getERC20Balance(web3Provider, params.walletAddress, params.tokenAddress);
|
|
38922
38996
|
}
|
|
38923
38997
|
/**
|
|
38924
38998
|
* Retrieves the balances of all tokens for a given wallet address on a specific chain.
|
|
@@ -38926,8 +39000,7 @@ class Checkout {
|
|
|
38926
39000
|
* @returns {Promise<GetAllBalancesResult>} - A promise that resolves to the result of retrieving the balances.
|
|
38927
39001
|
*/
|
|
38928
39002
|
async getAllBalances(params) {
|
|
38929
|
-
|
|
38930
|
-
return getAllBalances(this.config, web3Provider, params.walletAddress, params.chainId);
|
|
39003
|
+
return getAllBalances(this.config, params.provider, params.walletAddress, params.chainId);
|
|
38931
39004
|
}
|
|
38932
39005
|
/**
|
|
38933
39006
|
* Retrieves the supported networks based on the provided parameters.
|
package/dist/passport.js
CHANGED
|
@@ -2349,7 +2349,7 @@ class MultiRollupApiClients {
|
|
|
2349
2349
|
}
|
|
2350
2350
|
|
|
2351
2351
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2352
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.36.1' };
|
|
2352
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.36.2-alpha.1' };
|
|
2353
2353
|
const createConfig = ({ basePath, headers, }) => {
|
|
2354
2354
|
if (!basePath.trim()) {
|
|
2355
2355
|
throw Error('basePath can not be empty');
|
|
@@ -2405,7 +2405,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
2405
2405
|
chainID,
|
|
2406
2406
|
coreContractAddress,
|
|
2407
2407
|
registrationContractAddress,
|
|
2408
|
-
sdkVersion: 'ts-immutable-sdk-0.36.1',
|
|
2408
|
+
sdkVersion: 'ts-immutable-sdk-0.36.2-alpha.1',
|
|
2409
2409
|
});
|
|
2410
2410
|
/**
|
|
2411
2411
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/sdk",
|
|
3
3
|
"description": "Immutable Unified SDK",
|
|
4
|
-
"version": "0.36.1",
|
|
4
|
+
"version": "0.36.2-alpha.1",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"browser": "./dist/index.browser.js",
|
|
7
7
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@0xsequence/abi": "^1.4.3",
|
|
10
10
|
"@0xsequence/core": "^1.4.3",
|
|
11
11
|
"@biom3/design-tokens": "0.2.9",
|
|
12
|
-
"@biom3/react": "^0.19.
|
|
12
|
+
"@biom3/react": "^0.19.22",
|
|
13
13
|
"@ethersproject/abi": "^5.7.0",
|
|
14
14
|
"@ethersproject/abstract-signer": "^5.7.0",
|
|
15
15
|
"@ethersproject/providers": "^5.7.2",
|