@imtbl/sdk 0.31.3 → 0.32.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/index.js CHANGED
@@ -3770,7 +3770,7 @@ class MultiRollupApiClients {
3770
3770
  }
3771
3771
 
3772
3772
  // eslint-disable-next-line @typescript-eslint/naming-convention
3773
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.31.3' };
3773
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.32.0' };
3774
3774
  const createConfig = ({ basePath, headers, }) => {
3775
3775
  if (!basePath.trim()) {
3776
3776
  throw Error('basePath can not be empty');
@@ -3830,7 +3830,7 @@ class APIError extends Error {
3830
3830
 
3831
3831
  /* eslint-disable implicit-arrow-linebreak */
3832
3832
  const defaultHeaders = {
3833
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.31.3',
3833
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.32.0',
3834
3834
  };
3835
3835
  /**
3836
3836
  * createAPIConfiguration to create a custom Configuration
@@ -4241,7 +4241,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4241
4241
  chainID,
4242
4242
  coreContractAddress,
4243
4243
  registrationContractAddress,
4244
- sdkVersion: 'ts-immutable-sdk-0.31.3',
4244
+ sdkVersion: 'ts-immutable-sdk-0.32.0',
4245
4245
  });
4246
4246
  /**
4247
4247
  * Sets `sdkVersion` at the time of build
@@ -28666,13 +28666,13 @@ const subtractAmount = (a, b) => {
28666
28666
  /**
28667
28667
  * Converts our internal token type which could be ERC20 or Native
28668
28668
  * into a format consumable by Checkout. They require an address to be
28669
- * present. We populate the address with empty string if it's Native.
28669
+ * present. We populate the address with the string 'native' if it's Native.
28670
28670
  * If it's ERC20, we don't need to change it.
28671
28671
  */
28672
28672
  const toPublicTokenType = (token) => {
28673
28673
  if (token.type === 'native') {
28674
28674
  return {
28675
- address: '',
28675
+ address: 'native',
28676
28676
  chainId: token.chainId,
28677
28677
  decimals: token.decimals,
28678
28678
  symbol: token.symbol,
@@ -28984,7 +28984,7 @@ const doesChainSupportEIP1559$1 = (fee) => {
28984
28984
  /**
28985
28985
  * Fetch the current gas price estimate. Supports both EIP-1559 and non-EIP1559 chains
28986
28986
  * @param {JsonRpcProvider} provider - The JSON RPC provider used to fetch fee data
28987
- * @param {Coin} nativeToken - The native token of the chain. Gas prices will be denominated in this token
28987
+ * @param {Native} nativeToken - The native token of the chain. Gas prices will be denominated in this token
28988
28988
  * @returns {Amount | null} - The gas price in the smallest denomination of the chain's currency,
28989
28989
  * or null if no gas price is available
28990
28990
  */
@@ -29109,9 +29109,6 @@ class NativeTokenService {
29109
29109
  this.wrappedToken = wrappedToken;
29110
29110
  }
29111
29111
  wrapAmount(amount) {
29112
- if (!canUnwrapToken(amount.token)) {
29113
- throw new Error(`cannot wrap non-native token: ${amount.token.address}`);
29114
- }
29115
29112
  return newAmount(amount.value, this.wrappedToken);
29116
29113
  }
29117
29114
  unwrapAmount(amount) {
@@ -29990,412 +29987,73 @@ const validateProviderDefaults = {
29990
29987
  allowUnsupportedProvider: false,
29991
29988
  };
29992
29989
 
29993
- const ENV_DEVELOPMENT = 'development';
29994
- const IMX_ADDRESS_ZKEVM = '0x0000000000000000000000000000000000001010';
29995
- const DEFAULT_TOKEN_DECIMALS$1 = 18;
29996
- const ZKEVM_NATIVE_TOKEN = {
29997
- name: 'IMX',
29998
- symbol: 'IMX',
29999
- decimals: DEFAULT_TOKEN_DECIMALS$1,
30000
- address: IMX_ADDRESS_ZKEVM,
30001
- };
30002
29990
  /**
30003
- * Base URL for the Immutable API based on the environment.
30004
- * @property {string} DEVELOPMENT - The base URL for the development environment.
30005
- * @property {string} SANDBOX - The base URL for the sandbox environment.
30006
- * @property {string} PRODUCTION - The base URL for the production environment.
29991
+ * An enum representing the checkout status types
29992
+ * @enum {string}
29993
+ * @property {string} SUCCESS - If checkout succeeded as the transactions were able to be processed
29994
+ * @property {string} FAILED - If checkout failed due to transactions not settling on chain
29995
+ * @property {string} INSUFFICIENT_FUNDS - If checkout failed due to insufficient funds
30007
29996
  */
30008
- const IMMUTABLE_API_BASE_URL = {
30009
- [ENV_DEVELOPMENT]: 'https://api.dev.immutable.com',
30010
- [Environment$1.SANDBOX]: 'https://api.sandbox.immutable.com',
30011
- [Environment$1.PRODUCTION]: 'https://api.immutable.com',
30012
- };
29997
+ var CheckoutStatus;
29998
+ (function (CheckoutStatus) {
29999
+ CheckoutStatus["SUCCESS"] = "SUCCESS";
30000
+ CheckoutStatus["FAILED"] = "FAILED";
30001
+ CheckoutStatus["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
30002
+ })(CheckoutStatus || (CheckoutStatus = {}));
30013
30003
  /**
30014
- * Base URL for the checkout API based on the environment.
30015
- * @property {string} DEVELOPMENT - The base URL for the development environment.
30016
- * @property {string} SANDBOX - The base URL for the sandbox environment.
30017
- * @property {string} PRODUCTION - The base URL for the production environment.
30004
+ * An enum representing the item types
30005
+ * @enum {string}
30006
+ * @property {string} NATIVE - If the item is a native token.
30007
+ * @property {string} ERC20 - If the item is an ERC20 token.
30008
+ * @property {string} ERC721 - If the item is an ERC721 token.
30018
30009
  */
30019
- const CHECKOUT_API_BASE_URL = {
30020
- [ENV_DEVELOPMENT]: 'https://checkout-api.dev.immutable.com',
30021
- [Environment$1.SANDBOX]: 'https://checkout-api.sandbox.immutable.com',
30022
- [Environment$1.PRODUCTION]: 'https://checkout-api.immutable.com',
30023
- };
30010
+ var ItemType;
30011
+ (function (ItemType) {
30012
+ ItemType["NATIVE"] = "NATIVE";
30013
+ ItemType["ERC20"] = "ERC20";
30014
+ ItemType["ERC721"] = "ERC721";
30015
+ })(ItemType || (ItemType = {}));
30024
30016
  /**
30025
- * Smart Checkout routing default onramp enabled flag
30017
+ * An enum representing transaction or gas types
30018
+ * @enum {string}
30019
+ * @property {string} TRANSACTION - If the type is a transaction
30020
+ * @property {string} GAS - If the type is the gas amount
30026
30021
  */
30027
- const DEFAULT_ON_RAMP_ENABLED = true;
30022
+ var TransactionOrGasType;
30023
+ (function (TransactionOrGasType) {
30024
+ TransactionOrGasType["TRANSACTION"] = "TRANSACTION";
30025
+ TransactionOrGasType["GAS"] = "GAS";
30026
+ })(TransactionOrGasType || (TransactionOrGasType = {}));
30028
30027
  /**
30029
- * Smart Checkout routing default swap enabled flag
30028
+ * An enum representing the gas token types
30029
+ * @enum {string}
30030
+ * @property {string} NATIVE - If the gas token is a native token.
30031
+ * @property {string} ERC20 - If the gas token is an ERC20 token.
30030
30032
  */
30031
- const DEFAULT_SWAP_ENABLED = true;
30033
+ var GasTokenType;
30034
+ (function (GasTokenType) {
30035
+ GasTokenType["NATIVE"] = "NATIVE";
30036
+ GasTokenType["ERC20"] = "ERC20";
30037
+ })(GasTokenType || (GasTokenType = {}));
30032
30038
  /**
30033
- * Smart Checkout routing default bridge enabled flag
30039
+ * An enum representing the routing outcome types
30040
+ * @enum {string}
30041
+ * @property {string} ROUTES_FOUND - If funding routes were found for the transaction.
30042
+ * @property {string} NO_ROUTES_FOUND - If no funding routes were found for the transaction.
30043
+ * @property {string} NO_ROUTE_OPTIONS - If no routing options were available for the transaction.
30034
30044
  */
30035
- const DEFAULT_BRIDGE_ENABLED = true;
30036
- const TRANSAK_API_BASE_URL = {
30037
- [Environment$1.SANDBOX]: 'https://global-stg.transak.com',
30038
- [Environment$1.PRODUCTION]: 'https://global.transak.com/',
30039
- };
30040
- const PRODUCTION_CHAIN_ID_NETWORK_MAP = new Map([
30041
- [
30042
- ChainId.ETHEREUM,
30043
- {
30044
- chainIdHex: `0x${ChainId.ETHEREUM.toString(16)}`,
30045
- chainName: ChainName.ETHEREUM,
30046
- rpcUrls: ['https://checkout-api.immutable.com/v1/rpc/eth-mainnet'],
30047
- nativeCurrency: {
30048
- name: ChainName.ETHEREUM,
30049
- symbol: 'ETH',
30050
- decimals: 18,
30051
- },
30052
- blockExplorerUrls: ['https://etherscan.io/'],
30053
- },
30054
- ],
30055
- [
30056
- ChainId.IMTBL_ZKEVM_MAINNET,
30057
- {
30058
- chainIdHex: `0x${ChainId.IMTBL_ZKEVM_MAINNET.toString(16)}`,
30059
- chainName: ChainName.IMTBL_ZKEVM_MAINNET,
30060
- rpcUrls: ['https://rpc.immutable.com'],
30061
- nativeCurrency: ZKEVM_NATIVE_TOKEN,
30062
- },
30063
- ],
30064
- ]);
30065
- const SANDBOX_CHAIN_ID_NETWORK_MAP = new Map([
30066
- [
30067
- ChainId.SEPOLIA,
30068
- {
30069
- chainIdHex: `0x${ChainId.SEPOLIA.toString(16)}`,
30070
- chainName: ChainName.SEPOLIA,
30071
- rpcUrls: [
30072
- 'https://checkout-api.sandbox.immutable.com/v1/rpc/eth-sepolia',
30073
- ],
30074
- nativeCurrency: {
30075
- name: 'Sep Eth',
30076
- symbol: 'ETH',
30077
- decimals: 18,
30078
- },
30079
- blockExplorerUrls: ['https://sepolia.etherscan.io/'],
30080
- },
30081
- ],
30082
- [
30083
- ChainId.IMTBL_ZKEVM_TESTNET,
30084
- {
30085
- chainIdHex: `0x${ChainId.IMTBL_ZKEVM_TESTNET.toString(16)}`,
30086
- chainName: ChainName.IMTBL_ZKEVM_TESTNET,
30087
- rpcUrls: ['https://rpc.testnet.immutable.com'],
30088
- nativeCurrency: ZKEVM_NATIVE_TOKEN,
30089
- },
30090
- ],
30091
- ]);
30092
- const DEV_CHAIN_ID_NETWORK_MAP = new Map([
30093
- [
30094
- ChainId.SEPOLIA,
30095
- {
30096
- chainIdHex: `0x${ChainId.SEPOLIA.toString(16)}`,
30097
- chainName: ChainName.SEPOLIA,
30098
- rpcUrls: ['https://checkout-api.dev.immutable.com/v1/rpc/eth-sepolia'],
30099
- nativeCurrency: {
30100
- name: 'Sep Eth',
30101
- symbol: 'ETH',
30102
- decimals: 18,
30103
- },
30104
- blockExplorerUrls: ['https://sepolia.etherscan.io/'],
30105
- },
30106
- ],
30107
- [
30108
- ChainId.IMTBL_ZKEVM_DEVNET,
30109
- {
30110
- chainIdHex: `0x${ChainId.IMTBL_ZKEVM_DEVNET.toString(16)}`,
30111
- chainName: ChainName.IMTBL_ZKEVM_DEVNET,
30112
- rpcUrls: ['https://rpc.dev.immutable.com'],
30113
- nativeCurrency: ZKEVM_NATIVE_TOKEN,
30114
- },
30115
- ],
30116
- ]);
30045
+ var RoutingOutcomeType;
30046
+ (function (RoutingOutcomeType) {
30047
+ RoutingOutcomeType["ROUTES_FOUND"] = "ROUTES_FOUND";
30048
+ RoutingOutcomeType["NO_ROUTES_FOUND"] = "NO_ROUTES_FOUND";
30049
+ RoutingOutcomeType["NO_ROUTE_OPTIONS"] = "NO_ROUTE_OPTIONS";
30050
+ })(RoutingOutcomeType || (RoutingOutcomeType = {}));
30117
30051
  /**
30118
- * Blockscout API configuration per chain
30119
- */
30120
- const BLOCKSCOUT_CHAIN_URL_MAP = {
30121
- [ChainId.IMTBL_ZKEVM_TESTNET]: {
30122
- url: 'https://explorer.testnet.immutable.com',
30123
- nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_TESTNET).nativeCurrency,
30124
- },
30125
- [ChainId.IMTBL_ZKEVM_MAINNET]: {
30126
- url: 'https://explorer.mainnet.immutable.com',
30127
- nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_MAINNET).nativeCurrency,
30128
- },
30129
- [ChainId.SEPOLIA]: {
30130
- url: 'https://eth-sepolia.blockscout.com',
30131
- nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.SEPOLIA).nativeCurrency,
30132
- },
30133
- [ChainId.ETHEREUM]: {
30134
- url: 'https://eth.blockscout.com/',
30135
- nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.ETHEREUM).nativeCurrency,
30136
- },
30137
- };
30138
- const ERC20ABI = [
30139
- {
30140
- constant: true,
30141
- inputs: [],
30142
- name: 'name',
30143
- outputs: [
30144
- {
30145
- name: '',
30146
- type: 'string',
30147
- },
30148
- ],
30149
- payable: false,
30150
- type: 'function',
30151
- },
30152
- {
30153
- constant: true,
30154
- inputs: [],
30155
- name: 'decimals',
30156
- outputs: [
30157
- {
30158
- name: '',
30159
- type: 'uint8',
30160
- },
30161
- ],
30162
- payable: false,
30163
- type: 'function',
30164
- },
30165
- {
30166
- constant: true,
30167
- inputs: [
30168
- {
30169
- name: '_owner',
30170
- type: 'address',
30171
- },
30172
- ],
30173
- name: 'balanceOf',
30174
- outputs: [
30175
- {
30176
- name: 'balance',
30177
- type: 'uint256',
30178
- },
30179
- ],
30180
- payable: false,
30181
- type: 'function',
30182
- },
30183
- {
30184
- constant: true,
30185
- inputs: [],
30186
- name: 'symbol',
30187
- outputs: [
30188
- {
30189
- name: '',
30190
- type: 'string',
30191
- },
30192
- ],
30193
- payable: false,
30194
- type: 'function',
30195
- },
30196
- {
30197
- constant: true,
30198
- inputs: [
30199
- {
30200
- name: '_owner',
30201
- type: 'address',
30202
- },
30203
- {
30204
- name: '_spender',
30205
- type: 'address',
30206
- },
30207
- ],
30208
- name: 'allowance',
30209
- outputs: [
30210
- {
30211
- name: '',
30212
- type: 'uint256',
30213
- },
30214
- ],
30215
- payable: false,
30216
- stateMutability: 'view',
30217
- type: 'function',
30218
- },
30219
- {
30220
- constant: false,
30221
- inputs: [
30222
- {
30223
- name: '_spender',
30224
- type: 'address',
30225
- },
30226
- {
30227
- name: '_value',
30228
- type: 'uint256',
30229
- },
30230
- ],
30231
- name: 'approve',
30232
- outputs: [
30233
- {
30234
- name: '',
30235
- type: 'bool',
30236
- },
30237
- ],
30238
- payable: false,
30239
- stateMutability: 'nonpayable',
30240
- type: 'function',
30241
- },
30242
- ];
30243
- const ERC721ABI = [
30244
- {
30245
- constant: false,
30246
- inputs: [
30247
- {
30248
- internalType: 'address',
30249
- name: 'to',
30250
- type: 'address',
30251
- },
30252
- {
30253
- internalType: 'uint256',
30254
- name: 'tokenId',
30255
- type: 'uint256',
30256
- },
30257
- ],
30258
- name: 'approve',
30259
- outputs: [],
30260
- payable: false,
30261
- stateMutability: 'nonpayable',
30262
- type: 'function',
30263
- },
30264
- {
30265
- constant: true,
30266
- inputs: [
30267
- {
30268
- internalType: 'address',
30269
- name: 'owner',
30270
- type: 'address',
30271
- },
30272
- {
30273
- internalType: 'address',
30274
- name: 'operator',
30275
- type: 'address',
30276
- },
30277
- ],
30278
- name: 'isApprovedForAll',
30279
- outputs: [
30280
- {
30281
- internalType: 'bool',
30282
- name: '',
30283
- type: 'bool',
30284
- },
30285
- ],
30286
- payable: false,
30287
- stateMutability: 'view',
30288
- type: 'function',
30289
- },
30290
- {
30291
- constant: true,
30292
- inputs: [
30293
- {
30294
- internalType: 'uint256',
30295
- name: 'tokenId',
30296
- type: 'uint256',
30297
- },
30298
- ],
30299
- name: 'getApproved',
30300
- outputs: [
30301
- {
30302
- internalType: 'address',
30303
- name: '',
30304
- type: 'address',
30305
- },
30306
- ],
30307
- payable: false,
30308
- stateMutability: 'view',
30309
- type: 'function',
30310
- },
30311
- {
30312
- inputs: [
30313
- {
30314
- internalType: 'uint256',
30315
- name: 'tokenId',
30316
- type: 'uint256',
30317
- },
30318
- ],
30319
- name: 'ownerOf',
30320
- outputs: [
30321
- {
30322
- internalType: 'address',
30323
- name: '',
30324
- type: 'address',
30325
- },
30326
- ],
30327
- stateMutability: 'view',
30328
- type: 'function',
30329
- },
30330
- ];
30331
-
30332
- /**
30333
- * An enum representing the checkout status types
30334
- * @enum {string}
30335
- * @property {string} SUCCESS - If checkout succeeded as the transactions were able to be processed
30336
- * @property {string} FAILED - If checkout failed due to transactions not settling on chain
30337
- * @property {string} INSUFFICIENT_FUNDS - If checkout failed due to insufficient funds
30338
- */
30339
- var CheckoutStatus;
30340
- (function (CheckoutStatus) {
30341
- CheckoutStatus["SUCCESS"] = "SUCCESS";
30342
- CheckoutStatus["FAILED"] = "FAILED";
30343
- CheckoutStatus["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
30344
- })(CheckoutStatus || (CheckoutStatus = {}));
30345
- /**
30346
- * An enum representing the item types
30347
- * @enum {string}
30348
- * @property {string} NATIVE - If the item is a native token.
30349
- * @property {string} ERC20 - If the item is an ERC20 token.
30350
- * @property {string} ERC721 - If the item is an ERC721 token.
30351
- */
30352
- var ItemType;
30353
- (function (ItemType) {
30354
- ItemType["NATIVE"] = "NATIVE";
30355
- ItemType["ERC20"] = "ERC20";
30356
- ItemType["ERC721"] = "ERC721";
30357
- })(ItemType || (ItemType = {}));
30358
- /**
30359
- * An enum representing transaction or gas types
30360
- * @enum {string}
30361
- * @property {string} TRANSACTION - If the type is a transaction
30362
- * @property {string} GAS - If the type is the gas amount
30363
- */
30364
- var TransactionOrGasType;
30365
- (function (TransactionOrGasType) {
30366
- TransactionOrGasType["TRANSACTION"] = "TRANSACTION";
30367
- TransactionOrGasType["GAS"] = "GAS";
30368
- })(TransactionOrGasType || (TransactionOrGasType = {}));
30369
- /**
30370
- * An enum representing the gas token types
30371
- * @enum {string}
30372
- * @property {string} NATIVE - If the gas token is a native token.
30373
- * @property {string} ERC20 - If the gas token is an ERC20 token.
30374
- */
30375
- var GasTokenType;
30376
- (function (GasTokenType) {
30377
- GasTokenType["NATIVE"] = "NATIVE";
30378
- GasTokenType["ERC20"] = "ERC20";
30379
- })(GasTokenType || (GasTokenType = {}));
30380
- /**
30381
- * An enum representing the routing outcome types
30382
- * @enum {string}
30383
- * @property {string} ROUTES_FOUND - If funding routes were found for the transaction.
30384
- * @property {string} NO_ROUTES_FOUND - If no funding routes were found for the transaction.
30385
- * @property {string} NO_ROUTE_OPTIONS - If no routing options were available for the transaction.
30386
- */
30387
- var RoutingOutcomeType;
30388
- (function (RoutingOutcomeType) {
30389
- RoutingOutcomeType["ROUTES_FOUND"] = "ROUTES_FOUND";
30390
- RoutingOutcomeType["NO_ROUTES_FOUND"] = "NO_ROUTES_FOUND";
30391
- RoutingOutcomeType["NO_ROUTE_OPTIONS"] = "NO_ROUTE_OPTIONS";
30392
- })(RoutingOutcomeType || (RoutingOutcomeType = {}));
30393
- /**
30394
- * An enum representing the funding step types
30395
- * @enum {string}
30396
- * @property {string} BRIDGE - If the funding step is a bridge.
30397
- * @property {string} SWAP - If the funding step is a swap.
30398
- * @property {string} ONRAMP - If the funding step is an onramp.
30052
+ * An enum representing the funding step types
30053
+ * @enum {string}
30054
+ * @property {string} BRIDGE - If the funding step is a bridge.
30055
+ * @property {string} SWAP - If the funding step is a swap.
30056
+ * @property {string} ONRAMP - If the funding step is an onramp.
30399
30057
  */
30400
30058
  var FundingStepType;
30401
30059
  (function (FundingStepType) {
@@ -30502,158 +30160,507 @@ fn, customError) => {
30502
30160
  }
30503
30161
  };
30504
30162
 
30505
- // this function needs to be in a separate file to prevent circular dependencies with ./network
30506
- // this gives us access to the properties of the underlying provider object
30507
- async function getUnderlyingChainId(web3Provider) {
30508
- if (!web3Provider.provider?.request) {
30509
- throw new CheckoutError('Parsed provider is not a valid Web3Provider', CheckoutErrorType.WEB3_PROVIDER_ERROR);
30510
- }
30511
- const chainId = await web3Provider.provider.request({
30512
- method: WalletAction.GET_CHAINID,
30513
- params: [],
30514
- });
30515
- return parseInt(chainId, 16);
30516
- }
30517
-
30518
- /* eslint-disable @typescript-eslint/no-explicit-any */
30519
- const UNRECOGNISED_CHAIN_ERROR_CODE = 4902; // error code (MetaMask)
30520
- // these functions should not be exported. These functions should be used as part of an exported function e.g switchWalletNetwork() above.
30521
- // make sure to check if(provider.provider?.request) in the exported function and throw an error
30522
- // eslint-disable-next-line consistent-return
30523
- async function switchNetworkInWallet(networkMap, web3Provider, chainId) {
30524
- if (web3Provider.provider?.request) {
30525
- return await web3Provider.provider.request({
30526
- method: WalletAction.SWITCH_NETWORK,
30527
- params: [
30528
- {
30529
- chainId: networkMap.get(chainId)?.chainIdHex,
30530
- },
30531
- ],
30532
- });
30533
- }
30534
- }
30535
- // TODO: Should these functions always return something?
30536
- // eslint-disable-next-line consistent-return
30537
- async function addNetworkToWallet(networkMap, web3Provider, chainId) {
30538
- if (web3Provider.provider?.request) {
30539
- const networkDetails = networkMap.get(chainId);
30540
- const addNetwork = {
30541
- chainId: networkDetails?.chainIdHex,
30542
- chainName: networkDetails?.chainName,
30543
- rpcUrls: networkDetails?.rpcUrls,
30544
- nativeCurrency: networkDetails?.nativeCurrency,
30545
- blockExplorerUrls: networkDetails?.blockExplorerUrls,
30546
- };
30547
- return await web3Provider.provider.request({
30548
- method: WalletAction.ADD_NETWORK,
30549
- params: [addNetwork],
30550
- });
30551
- }
30552
- }
30553
- async function getNetworkAllowList(config, { type = NetworkFilterTypes.ALL, exclude }) {
30554
- const { networkMap } = config;
30555
- const allowedNetworkConfig = (await config.remote.getConfig('allowedNetworks'));
30556
- const list = allowedNetworkConfig.filter((network) => {
30557
- const allowAllTokens = type === NetworkFilterTypes.ALL;
30558
- const networkNotExcluded = !(exclude || [])
30559
- .map((exc) => exc.chainId)
30560
- .includes(network.chainId);
30561
- return allowAllTokens && networkNotExcluded;
30562
- });
30563
- const allowedNetworks = [];
30564
- list.forEach((element) => {
30565
- const newNetwork = networkMap.get(element.chainId);
30566
- if (newNetwork) {
30567
- allowedNetworks.push({
30568
- name: newNetwork.chainName,
30569
- chainId: parseInt(newNetwork.chainIdHex, 16),
30570
- nativeCurrency: newNetwork.nativeCurrency,
30571
- isSupported: true,
30572
- });
30573
- }
30574
- });
30575
- return {
30576
- networks: allowedNetworks,
30577
- };
30578
- }
30579
- async function getNetworkInfo(config, web3Provider) {
30580
- const { networkMap } = config;
30581
- return withCheckoutError(async () => {
30582
- try {
30583
- const network = await web3Provider.getNetwork();
30584
- if (Array.from(networkMap.keys()).includes(network.chainId)) {
30585
- const chainIdNetworkInfo = networkMap.get(network.chainId);
30586
- return {
30587
- name: chainIdNetworkInfo.chainName,
30588
- chainId: parseInt(chainIdNetworkInfo.chainIdHex, 16),
30589
- nativeCurrency: chainIdNetworkInfo.nativeCurrency,
30590
- isSupported: true,
30591
- };
30592
- }
30593
- return {
30594
- chainId: network.chainId,
30595
- name: network.name,
30596
- isSupported: false,
30597
- };
30598
- }
30599
- catch (err) {
30600
- const chainId = await getUnderlyingChainId(web3Provider);
30601
- const isSupported = Array.from(networkMap.keys()).includes(chainId);
30602
- return {
30603
- chainId,
30604
- isSupported,
30605
- };
30606
- }
30607
- }, {
30608
- type: CheckoutErrorType.GET_NETWORK_INFO_ERROR,
30609
- });
30610
- }
30611
- async function switchWalletNetwork(config, web3Provider, chainId) {
30612
- const { networkMap } = config;
30613
- const allowedNetworks = await getNetworkAllowList(config, {
30614
- type: NetworkFilterTypes.ALL,
30615
- });
30616
- if (!allowedNetworks.networks.some((network) => network.chainId === chainId)) {
30617
- throw new CheckoutError(`Chain:${chainId} is not a supported chain`, CheckoutErrorType.CHAIN_NOT_SUPPORTED_ERROR);
30618
- }
30619
- if (web3Provider.provider?.isPassport) {
30620
- throw new CheckoutError('Switching networks with Passport provider is not supported', CheckoutErrorType.SWITCH_NETWORK_UNSUPPORTED);
30621
- }
30622
- // WT-1146 - Refer to the README in this folder for explanation on the switch network flow
30623
- try {
30624
- await switchNetworkInWallet(networkMap, web3Provider, chainId);
30625
- }
30626
- catch (err) {
30627
- if (err.code === UNRECOGNISED_CHAIN_ERROR_CODE) {
30628
- try {
30629
- await addNetworkToWallet(networkMap, web3Provider, chainId);
30630
- // eslint-disable-next-line @typescript-eslint/no-shadow
30631
- }
30632
- catch (err) {
30633
- throw new CheckoutError('User cancelled add network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30634
- }
30635
- }
30636
- else {
30637
- throw new CheckoutError('User cancelled switch network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30638
- }
30639
- }
30640
- const newProvider = new Web3Provider(web3Provider.provider);
30641
- const newProviderNetwork = await newProvider.getNetwork();
30642
- if (newProviderNetwork.chainId !== chainId) {
30643
- throw new CheckoutError('User cancelled switch network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30644
- }
30645
- const networkInfo = await getNetworkInfo(config, newProvider);
30646
- return {
30647
- network: networkInfo,
30648
- provider: newProvider,
30649
- };
30650
- }
30163
+ // this function needs to be in a separate file to prevent circular dependencies with ./network
30164
+ // this gives us access to the properties of the underlying provider object
30165
+ async function getUnderlyingChainId(web3Provider) {
30166
+ if (!web3Provider.provider?.request) {
30167
+ throw new CheckoutError('Parsed provider is not a valid Web3Provider', CheckoutErrorType.WEB3_PROVIDER_ERROR);
30168
+ }
30169
+ const chainId = await web3Provider.provider.request({
30170
+ method: WalletAction.GET_CHAINID,
30171
+ params: [],
30172
+ });
30173
+ return parseInt(chainId, 16);
30174
+ }
30175
+
30176
+ /* eslint-disable @typescript-eslint/no-explicit-any */
30177
+ const UNRECOGNISED_CHAIN_ERROR_CODE = 4902; // error code (MetaMask)
30178
+ // these functions should not be exported. These functions should be used as part of an exported function e.g switchWalletNetwork() above.
30179
+ // make sure to check if(provider.provider?.request) in the exported function and throw an error
30180
+ // eslint-disable-next-line consistent-return
30181
+ async function switchNetworkInWallet(networkMap, web3Provider, chainId) {
30182
+ if (web3Provider.provider?.request) {
30183
+ return await web3Provider.provider.request({
30184
+ method: WalletAction.SWITCH_NETWORK,
30185
+ params: [
30186
+ {
30187
+ chainId: networkMap.get(chainId)?.chainIdHex,
30188
+ },
30189
+ ],
30190
+ });
30191
+ }
30192
+ }
30193
+ // TODO: Should these functions always return something?
30194
+ // eslint-disable-next-line consistent-return
30195
+ async function addNetworkToWallet(networkMap, web3Provider, chainId) {
30196
+ if (web3Provider.provider?.request) {
30197
+ const networkDetails = networkMap.get(chainId);
30198
+ const addNetwork = {
30199
+ chainId: networkDetails?.chainIdHex,
30200
+ chainName: networkDetails?.chainName,
30201
+ rpcUrls: networkDetails?.rpcUrls,
30202
+ nativeCurrency: networkDetails?.nativeCurrency,
30203
+ blockExplorerUrls: networkDetails?.blockExplorerUrls,
30204
+ };
30205
+ return await web3Provider.provider.request({
30206
+ method: WalletAction.ADD_NETWORK,
30207
+ params: [addNetwork],
30208
+ });
30209
+ }
30210
+ }
30211
+ async function getNetworkAllowList(config, { type = NetworkFilterTypes.ALL, exclude }) {
30212
+ const { networkMap } = config;
30213
+ const allowedNetworkConfig = (await config.remote.getConfig('allowedNetworks'));
30214
+ const list = allowedNetworkConfig.filter((network) => {
30215
+ const allowAllTokens = type === NetworkFilterTypes.ALL;
30216
+ const networkNotExcluded = !(exclude || [])
30217
+ .map((exc) => exc.chainId)
30218
+ .includes(network.chainId);
30219
+ return allowAllTokens && networkNotExcluded;
30220
+ });
30221
+ const allowedNetworks = [];
30222
+ list.forEach((element) => {
30223
+ const newNetwork = networkMap.get(element.chainId);
30224
+ if (newNetwork) {
30225
+ allowedNetworks.push({
30226
+ name: newNetwork.chainName,
30227
+ chainId: parseInt(newNetwork.chainIdHex, 16),
30228
+ nativeCurrency: newNetwork.nativeCurrency,
30229
+ isSupported: true,
30230
+ });
30231
+ }
30232
+ });
30233
+ return {
30234
+ networks: allowedNetworks,
30235
+ };
30236
+ }
30237
+ async function getNetworkInfo(config, web3Provider) {
30238
+ const { networkMap } = config;
30239
+ return withCheckoutError(async () => {
30240
+ try {
30241
+ const network = await web3Provider.getNetwork();
30242
+ if (Array.from(networkMap.keys()).includes(network.chainId)) {
30243
+ const chainIdNetworkInfo = networkMap.get(network.chainId);
30244
+ return {
30245
+ name: chainIdNetworkInfo.chainName,
30246
+ chainId: parseInt(chainIdNetworkInfo.chainIdHex, 16),
30247
+ nativeCurrency: chainIdNetworkInfo.nativeCurrency,
30248
+ isSupported: true,
30249
+ };
30250
+ }
30251
+ return {
30252
+ chainId: network.chainId,
30253
+ name: network.name,
30254
+ isSupported: false,
30255
+ };
30256
+ }
30257
+ catch (err) {
30258
+ const chainId = await getUnderlyingChainId(web3Provider);
30259
+ const isSupported = Array.from(networkMap.keys()).includes(chainId);
30260
+ return {
30261
+ chainId,
30262
+ isSupported,
30263
+ };
30264
+ }
30265
+ }, {
30266
+ type: CheckoutErrorType.GET_NETWORK_INFO_ERROR,
30267
+ });
30268
+ }
30269
+ async function switchWalletNetwork(config, web3Provider, chainId) {
30270
+ const { networkMap } = config;
30271
+ const allowedNetworks = await getNetworkAllowList(config, {
30272
+ type: NetworkFilterTypes.ALL,
30273
+ });
30274
+ if (!allowedNetworks.networks.some((network) => network.chainId === chainId)) {
30275
+ throw new CheckoutError(`Chain:${chainId} is not a supported chain`, CheckoutErrorType.CHAIN_NOT_SUPPORTED_ERROR);
30276
+ }
30277
+ if (web3Provider.provider?.isPassport) {
30278
+ throw new CheckoutError('Switching networks with Passport provider is not supported', CheckoutErrorType.SWITCH_NETWORK_UNSUPPORTED);
30279
+ }
30280
+ // WT-1146 - Refer to the README in this folder for explanation on the switch network flow
30281
+ try {
30282
+ await switchNetworkInWallet(networkMap, web3Provider, chainId);
30283
+ }
30284
+ catch (err) {
30285
+ if (err.code === UNRECOGNISED_CHAIN_ERROR_CODE) {
30286
+ try {
30287
+ await addNetworkToWallet(networkMap, web3Provider, chainId);
30288
+ // eslint-disable-next-line @typescript-eslint/no-shadow
30289
+ }
30290
+ catch (err) {
30291
+ throw new CheckoutError('User cancelled add network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30292
+ }
30293
+ }
30294
+ else {
30295
+ throw new CheckoutError('User cancelled switch network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30296
+ }
30297
+ }
30298
+ const newProvider = new Web3Provider(web3Provider.provider);
30299
+ const newProviderNetwork = await newProvider.getNetwork();
30300
+ if (newProviderNetwork.chainId !== chainId) {
30301
+ throw new CheckoutError('User cancelled switch network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30302
+ }
30303
+ const networkInfo = await getNetworkInfo(config, newProvider);
30304
+ return {
30305
+ network: networkInfo,
30306
+ provider: newProvider,
30307
+ };
30308
+ }
30309
+
30310
+ const ENV_DEVELOPMENT = 'development';
30311
+ const DEFAULT_TOKEN_DECIMALS$1 = 18;
30312
+ const NATIVE = 'native';
30313
+ const ZKEVM_NATIVE_TOKEN = {
30314
+ name: 'IMX',
30315
+ symbol: 'IMX',
30316
+ decimals: DEFAULT_TOKEN_DECIMALS$1,
30317
+ };
30318
+ /**
30319
+ * Base URL for the Immutable API based on the environment.
30320
+ * @property {string} DEVELOPMENT - The base URL for the development environment.
30321
+ * @property {string} SANDBOX - The base URL for the sandbox environment.
30322
+ * @property {string} PRODUCTION - The base URL for the production environment.
30323
+ */
30324
+ const IMMUTABLE_API_BASE_URL = {
30325
+ [ENV_DEVELOPMENT]: 'https://api.dev.immutable.com',
30326
+ [Environment$1.SANDBOX]: 'https://api.sandbox.immutable.com',
30327
+ [Environment$1.PRODUCTION]: 'https://api.immutable.com',
30328
+ };
30329
+ /**
30330
+ * Base URL for the checkout API based on the environment.
30331
+ * @property {string} DEVELOPMENT - The base URL for the development environment.
30332
+ * @property {string} SANDBOX - The base URL for the sandbox environment.
30333
+ * @property {string} PRODUCTION - The base URL for the production environment.
30334
+ */
30335
+ const CHECKOUT_API_BASE_URL = {
30336
+ [ENV_DEVELOPMENT]: 'https://checkout-api.dev.immutable.com',
30337
+ [Environment$1.SANDBOX]: 'https://checkout-api.sandbox.immutable.com',
30338
+ [Environment$1.PRODUCTION]: 'https://checkout-api.immutable.com',
30339
+ };
30340
+ /**
30341
+ * Smart Checkout routing default onramp enabled flag
30342
+ */
30343
+ const DEFAULT_ON_RAMP_ENABLED = true;
30344
+ /**
30345
+ * Smart Checkout routing default swap enabled flag
30346
+ */
30347
+ const DEFAULT_SWAP_ENABLED = true;
30348
+ /**
30349
+ * Smart Checkout routing default bridge enabled flag
30350
+ */
30351
+ const DEFAULT_BRIDGE_ENABLED = true;
30352
+ const TRANSAK_API_BASE_URL = {
30353
+ [Environment$1.SANDBOX]: 'https://global-stg.transak.com',
30354
+ [Environment$1.PRODUCTION]: 'https://global.transak.com/',
30355
+ };
30356
+ const PRODUCTION_CHAIN_ID_NETWORK_MAP = new Map([
30357
+ [
30358
+ ChainId.ETHEREUM,
30359
+ {
30360
+ chainIdHex: `0x${ChainId.ETHEREUM.toString(16)}`,
30361
+ chainName: ChainName.ETHEREUM,
30362
+ rpcUrls: ['https://checkout-api.immutable.com/v1/rpc/eth-mainnet'],
30363
+ nativeCurrency: {
30364
+ name: ChainName.ETHEREUM,
30365
+ symbol: 'ETH',
30366
+ decimals: 18,
30367
+ },
30368
+ blockExplorerUrls: ['https://etherscan.io/'],
30369
+ },
30370
+ ],
30371
+ [
30372
+ ChainId.IMTBL_ZKEVM_MAINNET,
30373
+ {
30374
+ chainIdHex: `0x${ChainId.IMTBL_ZKEVM_MAINNET.toString(16)}`,
30375
+ chainName: ChainName.IMTBL_ZKEVM_MAINNET,
30376
+ rpcUrls: ['https://rpc.immutable.com'],
30377
+ nativeCurrency: ZKEVM_NATIVE_TOKEN,
30378
+ },
30379
+ ],
30380
+ ]);
30381
+ const SANDBOX_CHAIN_ID_NETWORK_MAP = new Map([
30382
+ [
30383
+ ChainId.SEPOLIA,
30384
+ {
30385
+ chainIdHex: `0x${ChainId.SEPOLIA.toString(16)}`,
30386
+ chainName: ChainName.SEPOLIA,
30387
+ rpcUrls: [
30388
+ 'https://checkout-api.sandbox.immutable.com/v1/rpc/eth-sepolia',
30389
+ ],
30390
+ nativeCurrency: {
30391
+ name: 'Sep Eth',
30392
+ symbol: 'ETH',
30393
+ decimals: 18,
30394
+ },
30395
+ blockExplorerUrls: ['https://sepolia.etherscan.io/'],
30396
+ },
30397
+ ],
30398
+ [
30399
+ ChainId.IMTBL_ZKEVM_TESTNET,
30400
+ {
30401
+ chainIdHex: `0x${ChainId.IMTBL_ZKEVM_TESTNET.toString(16)}`,
30402
+ chainName: ChainName.IMTBL_ZKEVM_TESTNET,
30403
+ rpcUrls: ['https://rpc.testnet.immutable.com'],
30404
+ nativeCurrency: ZKEVM_NATIVE_TOKEN,
30405
+ },
30406
+ ],
30407
+ ]);
30408
+ const DEV_CHAIN_ID_NETWORK_MAP = new Map([
30409
+ [
30410
+ ChainId.SEPOLIA,
30411
+ {
30412
+ chainIdHex: `0x${ChainId.SEPOLIA.toString(16)}`,
30413
+ chainName: ChainName.SEPOLIA,
30414
+ rpcUrls: ['https://checkout-api.dev.immutable.com/v1/rpc/eth-sepolia'],
30415
+ nativeCurrency: {
30416
+ name: 'Sep Eth',
30417
+ symbol: 'ETH',
30418
+ decimals: 18,
30419
+ },
30420
+ blockExplorerUrls: ['https://sepolia.etherscan.io/'],
30421
+ },
30422
+ ],
30423
+ [
30424
+ ChainId.IMTBL_ZKEVM_DEVNET,
30425
+ {
30426
+ chainIdHex: `0x${ChainId.IMTBL_ZKEVM_DEVNET.toString(16)}`,
30427
+ chainName: ChainName.IMTBL_ZKEVM_DEVNET,
30428
+ rpcUrls: ['https://rpc.dev.immutable.com'],
30429
+ nativeCurrency: ZKEVM_NATIVE_TOKEN,
30430
+ },
30431
+ ],
30432
+ ]);
30433
+ /**
30434
+ * Blockscout API configuration per chain
30435
+ */
30436
+ const BLOCKSCOUT_CHAIN_URL_MAP = {
30437
+ [ChainId.IMTBL_ZKEVM_TESTNET]: {
30438
+ url: 'https://explorer.testnet.immutable.com',
30439
+ nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_TESTNET).nativeCurrency,
30440
+ },
30441
+ [ChainId.IMTBL_ZKEVM_MAINNET]: {
30442
+ url: 'https://explorer.mainnet.immutable.com',
30443
+ nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_MAINNET).nativeCurrency,
30444
+ },
30445
+ [ChainId.SEPOLIA]: {
30446
+ url: 'https://eth-sepolia.blockscout.com',
30447
+ nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.SEPOLIA).nativeCurrency,
30448
+ },
30449
+ [ChainId.ETHEREUM]: {
30450
+ url: 'https://eth.blockscout.com/',
30451
+ nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.ETHEREUM).nativeCurrency,
30452
+ },
30453
+ };
30454
+ const ERC20ABI = [
30455
+ {
30456
+ constant: true,
30457
+ inputs: [],
30458
+ name: 'name',
30459
+ outputs: [
30460
+ {
30461
+ name: '',
30462
+ type: 'string',
30463
+ },
30464
+ ],
30465
+ payable: false,
30466
+ type: 'function',
30467
+ },
30468
+ {
30469
+ constant: true,
30470
+ inputs: [],
30471
+ name: 'decimals',
30472
+ outputs: [
30473
+ {
30474
+ name: '',
30475
+ type: 'uint8',
30476
+ },
30477
+ ],
30478
+ payable: false,
30479
+ type: 'function',
30480
+ },
30481
+ {
30482
+ constant: true,
30483
+ inputs: [
30484
+ {
30485
+ name: '_owner',
30486
+ type: 'address',
30487
+ },
30488
+ ],
30489
+ name: 'balanceOf',
30490
+ outputs: [
30491
+ {
30492
+ name: 'balance',
30493
+ type: 'uint256',
30494
+ },
30495
+ ],
30496
+ payable: false,
30497
+ type: 'function',
30498
+ },
30499
+ {
30500
+ constant: true,
30501
+ inputs: [],
30502
+ name: 'symbol',
30503
+ outputs: [
30504
+ {
30505
+ name: '',
30506
+ type: 'string',
30507
+ },
30508
+ ],
30509
+ payable: false,
30510
+ type: 'function',
30511
+ },
30512
+ {
30513
+ constant: true,
30514
+ inputs: [
30515
+ {
30516
+ name: '_owner',
30517
+ type: 'address',
30518
+ },
30519
+ {
30520
+ name: '_spender',
30521
+ type: 'address',
30522
+ },
30523
+ ],
30524
+ name: 'allowance',
30525
+ outputs: [
30526
+ {
30527
+ name: '',
30528
+ type: 'uint256',
30529
+ },
30530
+ ],
30531
+ payable: false,
30532
+ stateMutability: 'view',
30533
+ type: 'function',
30534
+ },
30535
+ {
30536
+ constant: false,
30537
+ inputs: [
30538
+ {
30539
+ name: '_spender',
30540
+ type: 'address',
30541
+ },
30542
+ {
30543
+ name: '_value',
30544
+ type: 'uint256',
30545
+ },
30546
+ ],
30547
+ name: 'approve',
30548
+ outputs: [
30549
+ {
30550
+ name: '',
30551
+ type: 'bool',
30552
+ },
30553
+ ],
30554
+ payable: false,
30555
+ stateMutability: 'nonpayable',
30556
+ type: 'function',
30557
+ },
30558
+ ];
30559
+ const ERC721ABI = [
30560
+ {
30561
+ constant: false,
30562
+ inputs: [
30563
+ {
30564
+ internalType: 'address',
30565
+ name: 'to',
30566
+ type: 'address',
30567
+ },
30568
+ {
30569
+ internalType: 'uint256',
30570
+ name: 'tokenId',
30571
+ type: 'uint256',
30572
+ },
30573
+ ],
30574
+ name: 'approve',
30575
+ outputs: [],
30576
+ payable: false,
30577
+ stateMutability: 'nonpayable',
30578
+ type: 'function',
30579
+ },
30580
+ {
30581
+ constant: true,
30582
+ inputs: [
30583
+ {
30584
+ internalType: 'address',
30585
+ name: 'owner',
30586
+ type: 'address',
30587
+ },
30588
+ {
30589
+ internalType: 'address',
30590
+ name: 'operator',
30591
+ type: 'address',
30592
+ },
30593
+ ],
30594
+ name: 'isApprovedForAll',
30595
+ outputs: [
30596
+ {
30597
+ internalType: 'bool',
30598
+ name: '',
30599
+ type: 'bool',
30600
+ },
30601
+ ],
30602
+ payable: false,
30603
+ stateMutability: 'view',
30604
+ type: 'function',
30605
+ },
30606
+ {
30607
+ constant: true,
30608
+ inputs: [
30609
+ {
30610
+ internalType: 'uint256',
30611
+ name: 'tokenId',
30612
+ type: 'uint256',
30613
+ },
30614
+ ],
30615
+ name: 'getApproved',
30616
+ outputs: [
30617
+ {
30618
+ internalType: 'address',
30619
+ name: '',
30620
+ type: 'address',
30621
+ },
30622
+ ],
30623
+ payable: false,
30624
+ stateMutability: 'view',
30625
+ type: 'function',
30626
+ },
30627
+ {
30628
+ inputs: [
30629
+ {
30630
+ internalType: 'uint256',
30631
+ name: 'tokenId',
30632
+ type: 'uint256',
30633
+ },
30634
+ ],
30635
+ name: 'ownerOf',
30636
+ outputs: [
30637
+ {
30638
+ internalType: 'address',
30639
+ name: '',
30640
+ type: 'address',
30641
+ },
30642
+ ],
30643
+ stateMutability: 'view',
30644
+ type: 'function',
30645
+ },
30646
+ ];
30647
+ // Gas overrides -- Anti-spam mechanism for when the baseFee drops low
30648
+ // https://github.com/immutable/imx-docs/blob/main/docs/main/zkEVM/overview/gas-configuration.md
30649
+ const GAS_OVERRIDES = {
30650
+ maxFeePerGas: BigNumber$1.from(102e9),
30651
+ maxPriorityFeePerGas: BigNumber$1.from(101e9),
30652
+ };
30653
+
30654
+ const SDK_VERSION_MARKER = '0.32.0';
30655
+ // This SDK version is replaced by the `yarn build` command ran on the root level
30656
+ const globalPackageVersion = () => SDK_VERSION_MARKER;
30651
30657
 
30652
30658
  class RemoteConfigFetcher {
30653
30659
  isDevelopment;
30654
30660
  isProduction;
30655
30661
  configCache;
30656
30662
  tokensCache;
30663
+ version = 'v1';
30657
30664
  constructor(params) {
30658
30665
  this.isDevelopment = params.isDevelopment;
30659
30666
  this.isProduction = params.isProduction;
@@ -30681,14 +30688,14 @@ class RemoteConfigFetcher {
30681
30688
  async loadConfig() {
30682
30689
  if (this.configCache)
30683
30690
  return this.configCache;
30684
- const response = await RemoteConfigFetcher.makeHttpRequest(`${this.getEndpoint()}/v1/config`);
30691
+ const response = await RemoteConfigFetcher.makeHttpRequest(`${this.getEndpoint()}/${this.version}/config`);
30685
30692
  this.configCache = response.data;
30686
30693
  return this.configCache;
30687
30694
  }
30688
30695
  async loadConfigTokens() {
30689
30696
  if (this.tokensCache)
30690
30697
  return this.tokensCache;
30691
- const response = await RemoteConfigFetcher.makeHttpRequest(`${this.getEndpoint()}/v1/config/tokens`);
30698
+ const response = await RemoteConfigFetcher.makeHttpRequest(`${this.getEndpoint()}/${this.version}/config/tokens`);
30692
30699
  this.tokensCache = response.data;
30693
30700
  return this.tokensCache;
30694
30701
  }
@@ -30804,6 +30811,7 @@ const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId,
30804
30811
  tokens: tokens.filter((token) => !exclude.map((e) => e.address).includes(token.address || '')),
30805
30812
  };
30806
30813
  };
30814
+ const isNativeToken = (address) => !address || address.toLocaleLowerCase() === NATIVE;
30807
30815
 
30808
30816
  const CACHE_DATA_TTL = 60; // seconds
30809
30817
  /**
@@ -31003,7 +31011,7 @@ const getIndexerBalance = async (walletAddress, chainId, filterTokens) => {
31003
31011
  // Shuffle the mapping of the tokens configuration so it is a hashmap
31004
31012
  // for faster access to tokens config objects.
31005
31013
  const shouldFilter = filterTokens.length > 0;
31006
- const mapFilterTokens = Object.assign({}, ...(filterTokens.map((t) => ({ [t.address || '']: t }))));
31014
+ const mapFilterTokens = Object.assign({}, ...(filterTokens.map((t) => ({ [t.address || NATIVE]: t }))));
31007
31015
  // Get blockscout client for the given chain
31008
31016
  let blockscoutClient = blockscoutClientMap.get(chainId);
31009
31017
  if (!blockscoutClient) {
@@ -31044,6 +31052,7 @@ const getIndexerBalance = async (walletAddress, chainId, filterTokens) => {
31044
31052
  const nativeBalances = async (client) => {
31045
31053
  try {
31046
31054
  const respNative = await client.getNativeTokenByWalletAddress({ walletAddress });
31055
+ respNative.token.address ||= NATIVE;
31047
31056
  items.push(respNative);
31048
31057
  }
31049
31058
  catch (err) {
@@ -31086,8 +31095,7 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
31086
31095
  const allBalancePromises = [];
31087
31096
  tokens
31088
31097
  .forEach((token) => {
31089
- // Check for NATIVE token
31090
- if (!token.address || token.address === IMX_ADDRESS_ZKEVM) {
31098
+ if (!token.address || token.address.toLocaleLowerCase() === NATIVE) {
31091
31099
  allBalancePromises.push(getBalance(config, web3Provider, walletAddress));
31092
31100
  }
31093
31101
  else {
@@ -31273,11 +31281,17 @@ async function getWalletAllowList(params) {
31273
31281
  };
31274
31282
  }
31275
31283
 
31284
+ const setTransactionGasLimits = (transaction) => {
31285
+ const rawTx = transaction;
31286
+ rawTx.maxFeePerGas = GAS_OVERRIDES.maxFeePerGas;
31287
+ rawTx.maxPriorityFeePerGas = GAS_OVERRIDES.maxPriorityFeePerGas;
31288
+ return rawTx;
31289
+ };
31276
31290
  const sendTransaction = async (web3Provider, transaction) => {
31277
31291
  try {
31278
- const transactionResponse = await web3Provider
31279
- .getSigner()
31280
- .sendTransaction(transaction);
31292
+ const signer = web3Provider.getSigner();
31293
+ const rawTx = setTransactionGasLimits(transaction);
31294
+ const transactionResponse = await signer.sendTransaction(rawTx);
31281
31295
  return {
31282
31296
  transactionResponse,
31283
31297
  };
@@ -31440,25 +31454,21 @@ async function swapGasEstimator(config) {
31440
31454
  const exchange = await createExchangeInstance(chainId, config);
31441
31455
  // Create a fake transaction to get the gas from the quote
31442
31456
  const { swap } = await exchange.getUnsignedSwapTxFromAmountIn(DUMMY_WALLET_ADDRESS, inAddress, outAddress, BigNumber$1.from(utils$1.parseUnits('1', DEFAULT_TOKEN_DECIMALS)));
31443
- if (swap.gasFeeEstimate === null) {
31457
+ if (!swap.gasFeeEstimate) {
31444
31458
  return {
31445
31459
  gasEstimateType: GasEstimateType.SWAP,
31446
31460
  gasFee: {},
31447
31461
  };
31448
31462
  }
31449
- let estimatedAmount;
31450
- if (swap.gasFeeEstimate.value) {
31451
- estimatedAmount = BigNumber$1.from(swap.gasFeeEstimate.value);
31452
- }
31453
31463
  return {
31454
31464
  gasEstimateType: GasEstimateType.SWAP,
31455
31465
  gasFee: {
31456
- estimatedAmount,
31466
+ estimatedAmount: swap.gasFeeEstimate.value ? BigNumber$1.from(swap.gasFeeEstimate.value) : undefined,
31457
31467
  token: {
31458
- address: swap.gasFeeEstimate?.token.address,
31459
- symbol: swap.gasFeeEstimate?.token.symbol ?? '',
31460
- name: swap.gasFeeEstimate?.token.name ?? '',
31461
- decimals: swap.gasFeeEstimate?.token.decimals ?? DEFAULT_TOKEN_DECIMALS,
31468
+ address: swap.gasFeeEstimate.token.address,
31469
+ symbol: swap.gasFeeEstimate.token.symbol ?? '',
31470
+ name: swap.gasFeeEstimate.token.name ?? '',
31471
+ decimals: swap.gasFeeEstimate.token.decimals ?? DEFAULT_TOKEN_DECIMALS,
31462
31472
  },
31463
31473
  },
31464
31474
  };
@@ -31849,7 +31859,7 @@ const getTokensFromRequirements = (itemRequirements) => itemRequirements
31849
31859
  .map((itemRequirement) => {
31850
31860
  if (itemRequirement.type === ItemType.NATIVE) {
31851
31861
  return {
31852
- address: IMX_ADDRESS_ZKEVM,
31862
+ address: NATIVE,
31853
31863
  };
31854
31864
  }
31855
31865
  return {
@@ -31909,8 +31919,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
31909
31919
  }
31910
31920
  else if (itemRequirement.type === ItemType.NATIVE) {
31911
31921
  itemBalanceResult = balances.find((balance) => {
31912
- return balance.token?.address === ''
31913
- || balance.token?.address === IMX_ADDRESS_ZKEVM;
31922
+ return isNativeToken(balance.token?.address);
31914
31923
  });
31915
31924
  }
31916
31925
  // Calculate the balance delta
@@ -31938,7 +31947,6 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
31938
31947
  name,
31939
31948
  symbol,
31940
31949
  decimals: DEFAULT_TOKEN_DECIMALS$1,
31941
- address: IMX_ADDRESS_ZKEVM,
31942
31950
  },
31943
31951
  };
31944
31952
  }
@@ -31997,9 +32005,13 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
31997
32005
  const getTokenBalances = async (config, provider, ownerAddress, itemRequirements) => {
31998
32006
  try {
31999
32007
  const tokenMap = new Map();
32000
- getTokensFromRequirements(itemRequirements).forEach((item) => tokenMap.set((item.address || '').toLocaleLowerCase(), item));
32001
- const { balances } = await getAllBalances(config, provider, ownerAddress);
32002
- return balances.filter((balance) => tokenMap.get((balance.token.address || '').toLocaleLowerCase()));
32008
+ getTokensFromRequirements(itemRequirements).forEach((item) => {
32009
+ if (!item.address)
32010
+ return;
32011
+ tokenMap.set(item.address.toLocaleLowerCase(), item);
32012
+ });
32013
+ const { balances } = await getAllBalances(config, provider, ownerAddress, getL2ChainId(config));
32014
+ return balances.filter((balance) => tokenMap.get((balance.token.address || NATIVE).toLocaleLowerCase()));
32003
32015
  }
32004
32016
  catch (error) {
32005
32017
  throw new CheckoutError('Failed to get balances', CheckoutErrorType.GET_BALANCE_ERROR);
@@ -32405,7 +32417,7 @@ const constructFees$1 = (approvalGasFees, swapGasFees, swapFees) => {
32405
32417
  const constructSwapRoute = (chainId, fundsRequired, userBalance, fees) => {
32406
32418
  const tokenAddress = userBalance.token.address;
32407
32419
  let type = ItemType.ERC20;
32408
- if (tokenAddress === IMX_ADDRESS_ZKEVM) {
32420
+ if (isNativeToken(tokenAddress)) {
32409
32421
  type = ItemType.NATIVE;
32410
32422
  }
32411
32423
  return {
@@ -32426,16 +32438,24 @@ const constructSwapRoute = (chainId, fundsRequired, userBalance, fees) => {
32426
32438
  fees,
32427
32439
  };
32428
32440
  };
32441
+ const isBalanceRequirementTokenValid = (balanceRequirement) => {
32442
+ if (balanceRequirement.type === ItemType.ERC20) {
32443
+ return !!balanceRequirement.required.token.address;
32444
+ }
32445
+ if (balanceRequirement.type === ItemType.NATIVE) {
32446
+ return isNativeToken(balanceRequirement.required.token.address);
32447
+ }
32448
+ return false;
32449
+ };
32429
32450
  const getRequiredToken = (balanceRequirement) => {
32430
32451
  let address = '';
32431
32452
  let amount = BigNumber$1.from(0);
32432
32453
  switch (balanceRequirement.type) {
32433
32454
  case ItemType.ERC20:
32434
- address = balanceRequirement.required.token.address ?? '';
32455
+ address = balanceRequirement.required.token.address;
32435
32456
  amount = balanceRequirement.delta.balance;
32436
32457
  break;
32437
32458
  case ItemType.NATIVE:
32438
- address = IMX_ADDRESS_ZKEVM;
32439
32459
  amount = balanceRequirement.delta.balance;
32440
32460
  break;
32441
32461
  }
@@ -32456,7 +32476,8 @@ const checkUserCanCoverApprovalFees = (l2Balances, approval) => {
32456
32476
  };
32457
32477
  }
32458
32478
  // Find the users balance of the approval token
32459
- const l2BalanceOfApprovalToken = l2Balances.find((balance) => balance.token.address === approvalGasTokenAddress);
32479
+ const l2BalanceOfApprovalToken = l2Balances.find((balance) => (isNativeToken(balance.token.address) && isNativeToken(approvalGasTokenAddress))
32480
+ || balance.token.address === approvalGasTokenAddress);
32460
32481
  if (!l2BalanceOfApprovalToken)
32461
32482
  return { sufficient: false, approvalGasFee, approvalGasTokenAddress };
32462
32483
  // If the user does not have enough of the token to cover approval fees then return sufficient false
@@ -32474,7 +32495,7 @@ const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFees, swapFe
32474
32495
  // Set up a map of token addresses to amounts for each of the swap fees
32475
32496
  const feeMap = new Map();
32476
32497
  // Add the approval fee to list of fees
32477
- if (approvalFees.approvalGasTokenAddress !== '') {
32498
+ if (approvalFees.approvalGasFee.gt(BigNumber$1.from(0))) {
32478
32499
  feeMap.set(approvalFees.approvalGasTokenAddress, approvalFees.approvalGasFee);
32479
32500
  }
32480
32501
  // Add the swap gas fee to list of fees
@@ -32510,7 +32531,8 @@ const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFees, swapFe
32510
32531
  for (const [tokenAddress, fee] of feeMap.entries()) {
32511
32532
  if (fee === BigNumber$1.from(0))
32512
32533
  continue;
32513
- const l2BalanceOfFeeToken = l2Balances.find((balance) => balance.token.address === tokenAddress);
32534
+ const l2BalanceOfFeeToken = l2Balances.find((balance) => (isNativeToken(balance.token.address) && isNativeToken(tokenAddress))
32535
+ || balance.token.address === tokenAddress);
32514
32536
  if (!l2BalanceOfFeeToken) {
32515
32537
  return false;
32516
32538
  }
@@ -32562,9 +32584,9 @@ const swapRoute = async (config, availableRoutingOptions, walletAddress, balance
32562
32584
  return fundingSteps;
32563
32585
  if (swappableTokens.length === 0)
32564
32586
  return fundingSteps;
32565
- const requiredToken = getRequiredToken(balanceRequirement);
32566
- if (requiredToken.address === '')
32587
+ if (!isBalanceRequirementTokenValid(balanceRequirement))
32567
32588
  return fundingSteps;
32589
+ const requiredToken = getRequiredToken(balanceRequirement);
32568
32590
  const chainId = getL2ChainId(config);
32569
32591
  const l2TokenBalanceResult = tokenBalanceResults.get(chainId);
32570
32592
  if (!l2TokenBalanceResult)
@@ -32661,7 +32683,7 @@ const allowListCheck = async (config, tokenBalances, availableRoutingOptions) =>
32661
32683
 
32662
32684
  const getEthBalance = (balances) => {
32663
32685
  for (const balance of balances.balances) {
32664
- if (!balance.token.address || balance.token.address === '') {
32686
+ if (isNativeToken(balance.token.address)) {
32665
32687
  return balance.balance;
32666
32688
  }
32667
32689
  }
@@ -32717,25 +32739,28 @@ const getImxL1Representation = async (chainId, config) => {
32717
32739
  return imxMappingConfig[chainId] ?? '';
32718
32740
  };
32719
32741
  const fetchL1Representation = async (config, l2address) => {
32720
- if (l2address === '')
32721
- return { l1address: '', l2address };
32722
- if (l2address === IMX_ADDRESS_ZKEVM) {
32742
+ if (isNativeToken(l2address)) {
32723
32743
  return {
32724
32744
  l1address: await getImxL1Representation(getL1ChainId(config), config),
32725
- l2address: IMX_ADDRESS_ZKEVM,
32745
+ l2address: NATIVE,
32726
32746
  };
32727
32747
  }
32728
32748
  const chainName = getIndexerChainName(getL2ChainId(config));
32729
- if (chainName === '')
32730
- return { l1address: '', l2address }; // Chain name not a valid indexer chain name
32731
32749
  const blockchainData = createBlockchainDataInstance(config);
32732
32750
  const tokenData = await blockchainData.getToken({
32733
32751
  chainName,
32734
32752
  contractAddress: l2address,
32735
32753
  });
32754
+ // TODO: When bridge is ready we need to understand how L2 ETH will be mapped back to L1 ETH
32736
32755
  const l1address = tokenData.result.root_contract_address;
32756
+ if (l1address === INDEXER_ETH_ROOT_CONTRACT_ADDRESS) {
32757
+ return {
32758
+ l1address: 'native',
32759
+ l2address,
32760
+ };
32761
+ }
32737
32762
  if (l1address === null)
32738
- return { l1address: '', l2address }; // No L1 representation of this token
32763
+ return undefined; // No L1 representation of this token
32739
32764
  return {
32740
32765
  l1address,
32741
32766
  l2address,
@@ -32822,16 +32847,9 @@ const constructBridgeFundingRoute = (chainId, balance, bridgeRequirement, itemTy
32822
32847
  },
32823
32848
  fees,
32824
32849
  });
32825
- const isNativeEth = (address) => {
32826
- if (!address || address === '')
32827
- return true;
32828
- return false;
32829
- };
32830
32850
  const bridgeRoute = async (config, readOnlyProviders, depositorAddress, availableRoutingOptions, bridgeRequirement, tokenBalanceResults, feeEstimates) => {
32831
32851
  if (!availableRoutingOptions.bridge)
32832
32852
  return undefined;
32833
- if (bridgeRequirement.l2address === undefined || bridgeRequirement.l2address === '')
32834
- return undefined;
32835
32853
  const chainId = getL1ChainId(config);
32836
32854
  const tokenBalanceResult = tokenBalanceResults.get(chainId);
32837
32855
  const l1provider = readOnlyProviders.get(chainId);
@@ -32849,12 +32867,11 @@ const bridgeRoute = async (config, readOnlyProviders, depositorAddress, availabl
32849
32867
  if (!hasSufficientL1Eth(tokenBalanceResult, bridgeFeeEstimate.totalFees))
32850
32868
  return undefined;
32851
32869
  const l1RepresentationResult = await fetchL1Representation(config, bridgeRequirement.l2address);
32852
- // No mapping on L1 for this token
32853
- const { l1address } = l1RepresentationResult;
32854
- if (l1address === '')
32870
+ if (!l1RepresentationResult)
32855
32871
  return undefined;
32856
32872
  // Ensure l1address is in the allowed token list
32857
- if (l1address === INDEXER_ETH_ROOT_CONTRACT_ADDRESS) {
32873
+ const { l1address } = l1RepresentationResult;
32874
+ if (isNativeToken(l1address)) {
32858
32875
  if (!allowedTokenList.find((token) => !('address' in token)))
32859
32876
  return undefined;
32860
32877
  }
@@ -32864,9 +32881,9 @@ const bridgeRoute = async (config, readOnlyProviders, depositorAddress, availabl
32864
32881
  const gasForApproval = await estimateGasForBridgeApproval(config, readOnlyProviders, l1provider, depositorAddress, l1address, bridgeRequirement.amount);
32865
32882
  let totalFees = bridgeFeeEstimate.bridgeFee.estimatedAmount;
32866
32883
  // If the L1 representation of the requirement is ETH then find the ETH balance and check if the balance covers the delta
32867
- if (l1address === INDEXER_ETH_ROOT_CONTRACT_ADDRESS) {
32884
+ if (isNativeToken(l1address)) {
32868
32885
  const nativeETHBalance = tokenBalanceResult.balances
32869
- .find((balance) => isNativeEth(balance.token.address));
32886
+ .find((balance) => isNativeToken(balance.token.address));
32870
32887
  if (bridgeFeeEstimate.gasFee.estimatedAmount) {
32871
32888
  totalFees = totalFees.add(bridgeFeeEstimate.gasFee.estimatedAmount);
32872
32889
  }
@@ -33022,8 +33039,10 @@ const constructBridgeRequirements = (dexQuotes, l1balances, l2balances, l1tol2ad
33022
33039
  };
33023
33040
 
33024
33041
  const fetchL1ToL2Mappings = async (config, swappableTokens) => {
33025
- const l1tol2addressMappingPromises = swappableTokens.map((token) => fetchL1Representation(config, token.address ?? ''));
33026
- return await Promise.all(l1tol2addressMappingPromises);
33042
+ const l1tol2addressMappingPromises = swappableTokens
33043
+ .map((token) => fetchL1Representation(config, token.address ?? ''));
33044
+ const mappings = await Promise.all(l1tol2addressMappingPromises);
33045
+ return mappings.filter((mapping) => mapping !== undefined);
33027
33046
  };
33028
33047
 
33029
33048
  // Fetch all the dex quotes from the list of swappable tokens
@@ -33063,10 +33082,7 @@ const abortBridgeAndSwap = (bridgeableTokens, swappableTokens, l1balances, l2bal
33063
33082
  const filterSwappableTokensByBridgeableAddresses = (requiredTokenAddress, bridgeableTokens, swappableTokens, l1tol2Addresses) => {
33064
33083
  const filteredSwappableTokens = [];
33065
33084
  for (const addresses of l1tol2Addresses) {
33066
- if (addresses.l1address === '')
33067
- continue;
33068
- if (addresses.l2address === '')
33069
- continue;
33085
+ // TODO: Check for ETH (native) L1 in bridgeableTokens first
33070
33086
  if (!bridgeableTokens.includes(addresses.l1address))
33071
33087
  continue;
33072
33088
  // Filter out the token that is required from the swappable tokens list
@@ -33255,7 +33271,7 @@ const onRampRoute = async (config, availableRoutingOptions, balanceRequirement)
33255
33271
  type: FundingStepType.ONRAMP,
33256
33272
  chainId: getL2ChainId(config),
33257
33273
  fundingItem: {
33258
- type: required.token.address === IMX_ADDRESS_ZKEVM ? ItemType.NATIVE : ItemType.ERC20,
33274
+ type: isNativeToken(required.token.address) ? ItemType.NATIVE : ItemType.ERC20,
33259
33275
  fundsRequired: {
33260
33276
  amount: delta.balance,
33261
33277
  formattedAmount: delta.formattedBalance,
@@ -33491,8 +33507,8 @@ var SignTransactionStatusType;
33491
33507
  const signApprovalTransactions = async (provider, approvalTransactions) => {
33492
33508
  let receipts = [];
33493
33509
  try {
33494
- const response = await Promise.all(approvalTransactions.map((transaction) => provider.getSigner().sendTransaction(transaction)));
33495
- receipts = await Promise.all(response.map((transaction) => transaction.wait()));
33510
+ const response = await Promise.all(approvalTransactions.map((transaction) => sendTransaction(provider, transaction)));
33511
+ receipts = await Promise.all(response.map((transaction) => transaction.transactionResponse.wait()));
33496
33512
  }
33497
33513
  catch (err) {
33498
33514
  throw new CheckoutError('An error occurred while executing the approval transaction', CheckoutErrorType.EXECUTE_APPROVAL_TRANSACTION_ERROR, {
@@ -33515,8 +33531,8 @@ const signApprovalTransactions = async (provider, approvalTransactions) => {
33515
33531
  const signFulfillmentTransactions = async (provider, fulfillmentTransactions) => {
33516
33532
  let receipts = [];
33517
33533
  try {
33518
- const response = await Promise.all(fulfillmentTransactions.map((transaction) => provider.getSigner().sendTransaction(transaction)));
33519
- receipts = await Promise.all(response.map((transaction) => transaction.wait()));
33534
+ const response = await Promise.all(fulfillmentTransactions.map((transaction) => sendTransaction(provider, transaction)));
33535
+ receipts = await Promise.all(response.map((transaction) => transaction.transactionResponse.wait()));
33520
33536
  }
33521
33537
  catch (err) {
33522
33538
  throw new CheckoutError('An error occurred while executing the fulfillment transaction', CheckoutErrorType.EXECUTE_FULFILLMENT_TRANSACTION_ERROR, {
@@ -34092,10 +34108,6 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
34092
34108
  return itemRequirements;
34093
34109
  }
34094
34110
 
34095
- const SDK_VERSION_MARKER = '0.31.3';
34096
- // This SDK version is replaced by the `yarn build` command ran on the root level
34097
- const globalPackageVersion = () => SDK_VERSION_MARKER;
34098
-
34099
34111
  /**
34100
34112
  * Validates and builds a version string based on the given SemanticVersion object.
34101
34113
  * If the version is undefined or has an invalid major version, it returns the default checkout version.
@@ -34448,7 +34460,7 @@ class Checkout {
34448
34460
  }
34449
34461
  }
34450
34462
 
34451
- var checkout_sdk = /*#__PURE__*/Object.freeze({
34463
+ var checkout = /*#__PURE__*/Object.freeze({
34452
34464
  __proto__: null,
34453
34465
  get BridgeEventType () { return BridgeEventType; },
34454
34466
  CHECKOUT_API_BASE_URL: CHECKOUT_API_BASE_URL,
@@ -34482,4 +34494,4 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
34482
34494
  get WidgetType () { return WidgetType; }
34483
34495
  });
34484
34496
 
34485
- export { blockchain_data as blockchainData, checkout_sdk as checkoutSdk, config, immutablex_client as immutablexClient, orderbook, passport, provider };
34497
+ export { blockchain_data as blockchainData, checkout, config, immutablex_client as immutablexClient, orderbook, passport, provider };