@imtbl/sdk 0.36.2 → 0.36.4
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 +6 -6
- package/dist/browser/checkout/widgets.js +58 -58
- package/dist/checkout.d.ts +55 -11
- package/dist/checkout.js +216 -87
- 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 +218 -88
- package/dist/index.d.ts +197 -67
- package/dist/index.js +218 -88
- package/dist/passport.js +2 -2
- package/package.json +1 -1
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.
|
|
4237
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.36.4' };
|
|
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.
|
|
4297
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.36.4',
|
|
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.
|
|
4736
|
+
sdkVersion: 'ts-immutable-sdk-0.36.4',
|
|
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, {
|
|
@@ -34613,12 +34676,12 @@ var ChainId;
|
|
|
34613
34676
|
})(ChainId || (ChainId = {}));
|
|
34614
34677
|
/**
|
|
34615
34678
|
* Enum representing different chain names.
|
|
34616
|
-
* @enum {
|
|
34617
|
-
* @property {
|
|
34618
|
-
* @property {
|
|
34619
|
-
* @property {
|
|
34620
|
-
* @property {
|
|
34621
|
-
* @property {
|
|
34679
|
+
* @enum {string}
|
|
34680
|
+
* @property {string} IMTBL_ZKEVM_MAINNET - The chain name for IMTBL ZKEVM Mainnet.
|
|
34681
|
+
* @property {string} IMTBL_ZKEVM_TESTNET - The chain name for IMTBL ZKEVM Testnet.
|
|
34682
|
+
* @property {string} IMTBL_ZKEVM_DEVNET - The chain name for IMTBL ZKEVM Devnet.
|
|
34683
|
+
* @property {string} ETHEREUM - The chain name for Ethereum.
|
|
34684
|
+
* @property {string} SEPOLIA - The chain name for Sepolia.
|
|
34622
34685
|
*/
|
|
34623
34686
|
var ChainName;
|
|
34624
34687
|
(function (ChainName) {
|
|
@@ -34628,6 +34691,23 @@ var ChainName;
|
|
|
34628
34691
|
ChainName["IMTBL_ZKEVM_DEVNET"] = "Immutable zkEVM Dev";
|
|
34629
34692
|
ChainName["IMTBL_ZKEVM_MAINNET"] = "Immutable zkEVM";
|
|
34630
34693
|
})(ChainName || (ChainName = {}));
|
|
34694
|
+
/**
|
|
34695
|
+
* Enum representing different chain slugs.
|
|
34696
|
+
* @enum {string}
|
|
34697
|
+
* @property {string} IMTBL_ZKEVM_MAINNET - The chain slug for IMTBL ZKEVM Mainnet.
|
|
34698
|
+
* @property {string} IMTBL_ZKEVM_TESTNET - The chain slug for IMTBL ZKEVM Testnet.
|
|
34699
|
+
* @property {string} IMTBL_ZKEVM_DEVNET - The chain slug for IMTBL ZKEVM Devnet.
|
|
34700
|
+
* @property {string} ETHEREUM - The chain slug for Ethereum.
|
|
34701
|
+
* @property {string} SEPOLIA - The chain slug for Sepolia.
|
|
34702
|
+
*/
|
|
34703
|
+
var ChainSlug;
|
|
34704
|
+
(function (ChainSlug) {
|
|
34705
|
+
ChainSlug["ETHEREUM"] = "ethereum";
|
|
34706
|
+
ChainSlug["SEPOLIA"] = "sepolia";
|
|
34707
|
+
ChainSlug["IMTBL_ZKEVM_MAINNET"] = "imtbl-zkevm-mainnet";
|
|
34708
|
+
ChainSlug["IMTBL_ZKEVM_TESTNET"] = "imtbl-zkevm-testnet";
|
|
34709
|
+
ChainSlug["IMTBL_ZKEVM_DEVNET"] = "imtbl-zkevm-devnet";
|
|
34710
|
+
})(ChainSlug || (ChainSlug = {}));
|
|
34631
34711
|
|
|
34632
34712
|
var OnRampProvider;
|
|
34633
34713
|
(function (OnRampProvider) {
|
|
@@ -34785,12 +34865,14 @@ var ExchangeType;
|
|
|
34785
34865
|
*/
|
|
34786
34866
|
var CheckoutErrorType;
|
|
34787
34867
|
(function (CheckoutErrorType) {
|
|
34868
|
+
CheckoutErrorType["MISSING_PARAMS"] = "MISSING_PARAMS";
|
|
34788
34869
|
CheckoutErrorType["WEB3_PROVIDER_ERROR"] = "WEB3_PROVIDER_ERROR";
|
|
34789
34870
|
CheckoutErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
|
|
34790
34871
|
CheckoutErrorType["DEFAULT_PROVIDER_ERROR"] = "DEFAULT_PROVIDER_ERROR";
|
|
34791
34872
|
CheckoutErrorType["CONNECT_PROVIDER_ERROR"] = "CONNECT_PROVIDER_ERROR";
|
|
34792
34873
|
CheckoutErrorType["GET_BALANCE_ERROR"] = "GET_BALANCE_ERROR";
|
|
34793
34874
|
CheckoutErrorType["GET_INDEXER_BALANCE_ERROR"] = "GET_INDEXER_BALANCE_ERROR";
|
|
34875
|
+
CheckoutErrorType["GET_ERC20_INFO_ERROR"] = "GET_ERC20_INFO_ERROR";
|
|
34794
34876
|
CheckoutErrorType["GET_ERC20_BALANCE_ERROR"] = "GET_ERC20_BALANCE_ERROR";
|
|
34795
34877
|
CheckoutErrorType["GET_ERC721_BALANCE_ERROR"] = "GET_ERC721_BALANCE_ERROR";
|
|
34796
34878
|
CheckoutErrorType["GET_NETWORK_INFO_ERROR"] = "GET_NETWORK_INFO_ERROR";
|
|
@@ -35146,7 +35228,7 @@ const BLOCKSCOUT_CHAIN_URL_MAP = {
|
|
|
35146
35228
|
nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_TESTNET).nativeCurrency,
|
|
35147
35229
|
},
|
|
35148
35230
|
[ChainId.IMTBL_ZKEVM_MAINNET]: {
|
|
35149
|
-
url: 'https://explorer.
|
|
35231
|
+
url: 'https://explorer.immutable.com',
|
|
35150
35232
|
nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_MAINNET).nativeCurrency,
|
|
35151
35233
|
},
|
|
35152
35234
|
[ChainId.SEPOLIA]: {
|
|
@@ -35358,7 +35440,7 @@ const GAS_OVERRIDES = {
|
|
|
35358
35440
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
35359
35441
|
};
|
|
35360
35442
|
|
|
35361
|
-
const SDK_VERSION_MARKER = '0.36.
|
|
35443
|
+
const SDK_VERSION_MARKER = '0.36.4';
|
|
35362
35444
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
35363
35445
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
35364
35446
|
|
|
@@ -35519,6 +35601,22 @@ const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId,
|
|
|
35519
35601
|
};
|
|
35520
35602
|
};
|
|
35521
35603
|
const isNativeToken = (address) => !address || address.toLocaleLowerCase() === NATIVE;
|
|
35604
|
+
async function getERC20TokenInfo(web3Provider, tokenAddress) {
|
|
35605
|
+
return await withCheckoutError(async () => {
|
|
35606
|
+
const contract = new Contract$1(tokenAddress, JSON.stringify(ERC20ABI), web3Provider);
|
|
35607
|
+
const [name, symbol, decimals] = await Promise.all([
|
|
35608
|
+
contract.name(),
|
|
35609
|
+
contract.symbol(),
|
|
35610
|
+
contract.decimals(),
|
|
35611
|
+
]);
|
|
35612
|
+
return {
|
|
35613
|
+
name,
|
|
35614
|
+
symbol,
|
|
35615
|
+
decimals,
|
|
35616
|
+
address: tokenAddress,
|
|
35617
|
+
};
|
|
35618
|
+
}, { type: CheckoutErrorType.GET_ERC20_INFO_ERROR });
|
|
35619
|
+
}
|
|
35522
35620
|
|
|
35523
35621
|
const CACHE_DATA_TTL = 60; // seconds
|
|
35524
35622
|
/**
|
|
@@ -35689,20 +35787,18 @@ async function getERC20Balance(web3Provider, walletAddress, tokenAddress) {
|
|
|
35689
35787
|
return await withCheckoutError(async () => {
|
|
35690
35788
|
const contract = new Contract$1(tokenAddress, JSON.stringify(ERC20ABI), web3Provider);
|
|
35691
35789
|
return Promise.all([
|
|
35692
|
-
|
|
35693
|
-
contract.symbol(),
|
|
35790
|
+
getERC20TokenInfo(web3Provider, tokenAddress),
|
|
35694
35791
|
contract.balanceOf(walletAddress),
|
|
35695
|
-
contract.decimals(),
|
|
35696
35792
|
])
|
|
35697
|
-
.then(([
|
|
35698
|
-
const formattedBalance = utils$2.formatUnits(balance, decimals);
|
|
35793
|
+
.then(([tokenInfo, balance]) => {
|
|
35794
|
+
const formattedBalance = utils$2.formatUnits(balance, tokenInfo.decimals);
|
|
35699
35795
|
return {
|
|
35700
35796
|
balance,
|
|
35701
35797
|
formattedBalance,
|
|
35702
35798
|
token: {
|
|
35703
|
-
name,
|
|
35704
|
-
symbol,
|
|
35705
|
-
decimals,
|
|
35799
|
+
name: tokenInfo.name,
|
|
35800
|
+
symbol: tokenInfo.symbol,
|
|
35801
|
+
decimals: tokenInfo.decimals,
|
|
35706
35802
|
address: tokenAddress,
|
|
35707
35803
|
},
|
|
35708
35804
|
};
|
|
@@ -35802,6 +35898,9 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
|
|
|
35802
35898
|
const allBalancePromises = [];
|
|
35803
35899
|
tokens
|
|
35804
35900
|
.forEach((token) => {
|
|
35901
|
+
// For some reason isNativeToken always returns undefined.
|
|
35902
|
+
// We have spent way too much time figuring out why this is happening.
|
|
35903
|
+
// That we have given up -- keep it as it is for now.
|
|
35805
35904
|
if (!token.address || token.address.toLocaleLowerCase() === NATIVE) {
|
|
35806
35905
|
allBalancePromises.push(getBalance(config, web3Provider, walletAddress));
|
|
35807
35906
|
}
|
|
@@ -35810,12 +35909,25 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
|
|
|
35810
35909
|
}
|
|
35811
35910
|
});
|
|
35812
35911
|
const balanceResults = await Promise.allSettled(allBalancePromises);
|
|
35813
|
-
const balances = balanceResults.filter((result) => result.status === 'fulfilled').map((result) =>
|
|
35912
|
+
const balances = balanceResults.filter((result) => result.status === 'fulfilled').map((result) => {
|
|
35913
|
+
const resp = result;
|
|
35914
|
+
const { token } = resp.value;
|
|
35915
|
+
// For some reason isNativeToken always returns undefined.
|
|
35916
|
+
// We have spent way too much time figuring out why this is happening.
|
|
35917
|
+
// That we have given up -- keep it as it is for now.
|
|
35918
|
+
if (!token.address || token.address.toLocaleLowerCase() === NATIVE)
|
|
35919
|
+
resp.value.token.address = NATIVE;
|
|
35920
|
+
return resp.value;
|
|
35921
|
+
});
|
|
35814
35922
|
return { balances };
|
|
35815
35923
|
};
|
|
35816
35924
|
const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
35817
|
-
|
|
35818
|
-
|
|
35925
|
+
if (!walletAddress && !web3Provider) {
|
|
35926
|
+
throw new CheckoutError('both walletAddress and provider are missing. At least one must be provided.', CheckoutErrorType.MISSING_PARAMS);
|
|
35927
|
+
}
|
|
35928
|
+
if (!config.networkMap.get(chainId)) {
|
|
35929
|
+
throw new CheckoutError(`chain ID ${chainId} not supported by the environment`, CheckoutErrorType.CHAIN_NOT_SUPPORTED_ERROR);
|
|
35930
|
+
}
|
|
35819
35931
|
const { tokens } = await getTokenAllowList(config, {
|
|
35820
35932
|
type: TokenFilterTypes.ALL,
|
|
35821
35933
|
chainId,
|
|
@@ -35831,6 +35943,7 @@ const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
|
35831
35943
|
// eslint-disable-next-line no-console
|
|
35832
35944
|
console.error(err);
|
|
35833
35945
|
}
|
|
35946
|
+
let address = walletAddress;
|
|
35834
35947
|
if (flag && Blockscout.isChainSupported(chainId)) {
|
|
35835
35948
|
// This is a hack because the widgets are still using the tokens symbol
|
|
35836
35949
|
// to drive the conversions. If we remove all the token symbols from e.g. zkevm
|
|
@@ -35838,12 +35951,18 @@ const getAllBalances = async (config, web3Provider, walletAddress, chainId) => {
|
|
|
35838
35951
|
// Please remove this hack once https://immutable.atlassian.net/browse/WT-1710
|
|
35839
35952
|
// is done.
|
|
35840
35953
|
const isL1Chain = getL1ChainId(config) === chainId;
|
|
35841
|
-
|
|
35954
|
+
if (!address)
|
|
35955
|
+
address = await web3Provider?.getSigner().getAddress();
|
|
35956
|
+
return await measureAsyncExecution(config, `Time to fetch balances using blockscout for ${chainId}`, getIndexerBalance(address, chainId, isL1Chain ? tokens : undefined));
|
|
35957
|
+
}
|
|
35958
|
+
if (!web3Provider) {
|
|
35959
|
+
throw new CheckoutError('indexer is disabled for this chain, you must provide a provider.', CheckoutErrorType.MISSING_PARAMS);
|
|
35842
35960
|
}
|
|
35843
35961
|
// This fallback to use ERC20s calls which is a best effort solution
|
|
35844
35962
|
// Fails in fetching data from the RCP calls might result in some
|
|
35845
35963
|
// missing data.
|
|
35846
|
-
|
|
35964
|
+
address ||= await web3Provider.getSigner().getAddress();
|
|
35965
|
+
return await measureAsyncExecution(config, `Time to fetch balances using RPC for ${chainId}`, getBalances(config, web3Provider, address, tokens));
|
|
35847
35966
|
};
|
|
35848
35967
|
|
|
35849
35968
|
async function checkIsWalletConnected(web3Provider) {
|
|
@@ -37370,14 +37489,16 @@ const getEthBalance = (balances) => {
|
|
|
37370
37489
|
const getBridgeFeeEstimate = async (config, readOnlyProviders, fromChainId, toChainId) => {
|
|
37371
37490
|
const bridge = createBridgeInstance(fromChainId, toChainId, readOnlyProviders, config);
|
|
37372
37491
|
try {
|
|
37373
|
-
const
|
|
37492
|
+
const bridgeFeeResponse = await bridge.getFee({
|
|
37374
37493
|
action: BridgeFeeActions.DEPOSIT,
|
|
37375
37494
|
gasMultiplier: 1.1,
|
|
37376
37495
|
sourceChainId: fromChainId.toString(),
|
|
37377
37496
|
destinationChainId: toChainId.toString(),
|
|
37378
37497
|
});
|
|
37379
|
-
|
|
37380
|
-
|
|
37498
|
+
return {
|
|
37499
|
+
...bridgeFeeResponse,
|
|
37500
|
+
approvalGas: BigNumber$1.from(0),
|
|
37501
|
+
};
|
|
37381
37502
|
}
|
|
37382
37503
|
catch (err) {
|
|
37383
37504
|
throw new CheckoutError('Error estimating gas for bridge', CheckoutErrorType.BRIDGE_GAS_ESTIMATE_ERROR, { message: err.message });
|
|
@@ -37388,11 +37509,11 @@ const getBridgeFeeEstimate = async (config, readOnlyProviders, fromChainId, toCh
|
|
|
37388
37509
|
const INDEXER_ETH_ROOT_CONTRACT_ADDRESS = '0x0000000000000000000000000000000000000eee';
|
|
37389
37510
|
const getIndexerChainName = (chainId) => {
|
|
37390
37511
|
if (chainId === ChainId.IMTBL_ZKEVM_MAINNET)
|
|
37391
|
-
return
|
|
37512
|
+
return ChainSlug.IMTBL_ZKEVM_MAINNET;
|
|
37392
37513
|
if (chainId === ChainId.IMTBL_ZKEVM_TESTNET)
|
|
37393
|
-
return
|
|
37514
|
+
return ChainSlug.IMTBL_ZKEVM_TESTNET;
|
|
37394
37515
|
if (chainId === ChainId.IMTBL_ZKEVM_DEVNET)
|
|
37395
|
-
return
|
|
37516
|
+
return ChainSlug.IMTBL_ZKEVM_DEVNET;
|
|
37396
37517
|
return '';
|
|
37397
37518
|
};
|
|
37398
37519
|
// Indexer ERC20 call does not support IMX so cannot get root chain mapping from this endpoint.
|
|
@@ -38838,6 +38959,8 @@ class Checkout {
|
|
|
38838
38959
|
*/
|
|
38839
38960
|
async widgets(init) {
|
|
38840
38961
|
const checkout = this;
|
|
38962
|
+
// Preload the configurations
|
|
38963
|
+
await checkout.config.remote.getConfig();
|
|
38841
38964
|
const factory = new Promise((resolve, reject) => {
|
|
38842
38965
|
function checkForWidgetsBundleLoaded() {
|
|
38843
38966
|
if (typeof ImmutableCheckoutWidgets !== 'undefined') {
|
|
@@ -38853,8 +38976,6 @@ class Checkout {
|
|
|
38853
38976
|
try {
|
|
38854
38977
|
const script = loadUnresolved(init.version);
|
|
38855
38978
|
if (script.loaded && typeof ImmutableCheckoutWidgets !== 'undefined') {
|
|
38856
|
-
// eslint-disable-next-line no-console
|
|
38857
|
-
console.warn('Checkout widgets script is already loaded');
|
|
38858
38979
|
resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, init.config));
|
|
38859
38980
|
}
|
|
38860
38981
|
else {
|
|
@@ -38908,6 +39029,15 @@ class Checkout {
|
|
|
38908
39029
|
const switchNetworkRes = await switchWalletNetwork(this.config, web3Provider, params.chainId);
|
|
38909
39030
|
return switchNetworkRes;
|
|
38910
39031
|
}
|
|
39032
|
+
/**
|
|
39033
|
+
* Retrieves the token information given the token address. This function makes RPC calls to
|
|
39034
|
+
* ERC20 contracts to fetch the main contract information (e.g. symbol).
|
|
39035
|
+
* @param {GetTokenInfoParams} params - The parameters for retrieving the token information.
|
|
39036
|
+
* @returns {Promise<TokenInfo>} - A promise that resolves to the token info request.
|
|
39037
|
+
*/
|
|
39038
|
+
async getTokenInfo(params) {
|
|
39039
|
+
return await getERC20TokenInfo(params.provider, params.tokenAddress);
|
|
39040
|
+
}
|
|
38911
39041
|
/**
|
|
38912
39042
|
* Retrieves the balance of a wallet address.
|
|
38913
39043
|
* @param {GetBalanceParams} params - The parameters for retrieving the balance.
|
|
@@ -38926,8 +39056,7 @@ class Checkout {
|
|
|
38926
39056
|
* @returns {Promise<GetAllBalancesResult>} - A promise that resolves to the result of retrieving the balances.
|
|
38927
39057
|
*/
|
|
38928
39058
|
async getAllBalances(params) {
|
|
38929
|
-
|
|
38930
|
-
return getAllBalances(this.config, web3Provider, params.walletAddress, params.chainId);
|
|
39059
|
+
return getAllBalances(this.config, params.provider, params.walletAddress, params.chainId);
|
|
38931
39060
|
}
|
|
38932
39061
|
/**
|
|
38933
39062
|
* Retrieves the supported networks based on the provided parameters.
|
|
@@ -39093,6 +39222,7 @@ var checkout = /*#__PURE__*/Object.freeze({
|
|
|
39093
39222
|
get BridgeEventType () { return BridgeEventType; },
|
|
39094
39223
|
get ChainId () { return ChainId; },
|
|
39095
39224
|
get ChainName () { return ChainName; },
|
|
39225
|
+
get ChainSlug () { return ChainSlug; },
|
|
39096
39226
|
Checkout: Checkout,
|
|
39097
39227
|
CheckoutConfiguration: CheckoutConfiguration,
|
|
39098
39228
|
get CheckoutErrorType () { return CheckoutErrorType; },
|
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.
|
|
2352
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.36.4' };
|
|
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.
|
|
2408
|
+
sdkVersion: 'ts-immutable-sdk-0.36.4',
|
|
2409
2409
|
});
|
|
2410
2410
|
/**
|
|
2411
2411
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED