@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.cjs CHANGED
@@ -3792,7 +3792,7 @@ class MultiRollupApiClients {
3792
3792
  }
3793
3793
 
3794
3794
  // eslint-disable-next-line @typescript-eslint/naming-convention
3795
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.31.3' };
3795
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.32.0' };
3796
3796
  const createConfig = ({ basePath, headers, }) => {
3797
3797
  if (!basePath.trim()) {
3798
3798
  throw Error('basePath can not be empty');
@@ -3852,7 +3852,7 @@ class APIError extends Error {
3852
3852
 
3853
3853
  /* eslint-disable implicit-arrow-linebreak */
3854
3854
  const defaultHeaders = {
3855
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.31.3',
3855
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.32.0',
3856
3856
  };
3857
3857
  /**
3858
3858
  * createAPIConfiguration to create a custom Configuration
@@ -4263,7 +4263,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4263
4263
  chainID,
4264
4264
  coreContractAddress,
4265
4265
  registrationContractAddress,
4266
- sdkVersion: 'ts-immutable-sdk-0.31.3',
4266
+ sdkVersion: 'ts-immutable-sdk-0.32.0',
4267
4267
  });
4268
4268
  /**
4269
4269
  * Sets `sdkVersion` at the time of build
@@ -28688,13 +28688,13 @@ const subtractAmount = (a, b) => {
28688
28688
  /**
28689
28689
  * Converts our internal token type which could be ERC20 or Native
28690
28690
  * into a format consumable by Checkout. They require an address to be
28691
- * present. We populate the address with empty string if it's Native.
28691
+ * present. We populate the address with the string 'native' if it's Native.
28692
28692
  * If it's ERC20, we don't need to change it.
28693
28693
  */
28694
28694
  const toPublicTokenType = (token) => {
28695
28695
  if (token.type === 'native') {
28696
28696
  return {
28697
- address: '',
28697
+ address: 'native',
28698
28698
  chainId: token.chainId,
28699
28699
  decimals: token.decimals,
28700
28700
  symbol: token.symbol,
@@ -29006,7 +29006,7 @@ const doesChainSupportEIP1559$1 = (fee) => {
29006
29006
  /**
29007
29007
  * Fetch the current gas price estimate. Supports both EIP-1559 and non-EIP1559 chains
29008
29008
  * @param {JsonRpcProvider} provider - The JSON RPC provider used to fetch fee data
29009
- * @param {Coin} nativeToken - The native token of the chain. Gas prices will be denominated in this token
29009
+ * @param {Native} nativeToken - The native token of the chain. Gas prices will be denominated in this token
29010
29010
  * @returns {Amount | null} - The gas price in the smallest denomination of the chain's currency,
29011
29011
  * or null if no gas price is available
29012
29012
  */
@@ -29131,9 +29131,6 @@ class NativeTokenService {
29131
29131
  this.wrappedToken = wrappedToken;
29132
29132
  }
29133
29133
  wrapAmount(amount) {
29134
- if (!canUnwrapToken(amount.token)) {
29135
- throw new Error(`cannot wrap non-native token: ${amount.token.address}`);
29136
- }
29137
29134
  return newAmount(amount.value, this.wrappedToken);
29138
29135
  }
29139
29136
  unwrapAmount(amount) {
@@ -30012,412 +30009,73 @@ const validateProviderDefaults = {
30012
30009
  allowUnsupportedProvider: false,
30013
30010
  };
30014
30011
 
30015
- const ENV_DEVELOPMENT = 'development';
30016
- const IMX_ADDRESS_ZKEVM = '0x0000000000000000000000000000000000001010';
30017
- const DEFAULT_TOKEN_DECIMALS$1 = 18;
30018
- const ZKEVM_NATIVE_TOKEN = {
30019
- name: 'IMX',
30020
- symbol: 'IMX',
30021
- decimals: DEFAULT_TOKEN_DECIMALS$1,
30022
- address: IMX_ADDRESS_ZKEVM,
30023
- };
30024
30012
  /**
30025
- * Base URL for the Immutable API based on the environment.
30026
- * @property {string} DEVELOPMENT - The base URL for the development environment.
30027
- * @property {string} SANDBOX - The base URL for the sandbox environment.
30028
- * @property {string} PRODUCTION - The base URL for the production environment.
30013
+ * An enum representing the checkout status types
30014
+ * @enum {string}
30015
+ * @property {string} SUCCESS - If checkout succeeded as the transactions were able to be processed
30016
+ * @property {string} FAILED - If checkout failed due to transactions not settling on chain
30017
+ * @property {string} INSUFFICIENT_FUNDS - If checkout failed due to insufficient funds
30029
30018
  */
30030
- const IMMUTABLE_API_BASE_URL = {
30031
- [ENV_DEVELOPMENT]: 'https://api.dev.immutable.com',
30032
- [Environment$1.SANDBOX]: 'https://api.sandbox.immutable.com',
30033
- [Environment$1.PRODUCTION]: 'https://api.immutable.com',
30034
- };
30019
+ var CheckoutStatus;
30020
+ (function (CheckoutStatus) {
30021
+ CheckoutStatus["SUCCESS"] = "SUCCESS";
30022
+ CheckoutStatus["FAILED"] = "FAILED";
30023
+ CheckoutStatus["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
30024
+ })(CheckoutStatus || (CheckoutStatus = {}));
30035
30025
  /**
30036
- * Base URL for the checkout API based on the environment.
30037
- * @property {string} DEVELOPMENT - The base URL for the development environment.
30038
- * @property {string} SANDBOX - The base URL for the sandbox environment.
30039
- * @property {string} PRODUCTION - The base URL for the production environment.
30026
+ * An enum representing the item types
30027
+ * @enum {string}
30028
+ * @property {string} NATIVE - If the item is a native token.
30029
+ * @property {string} ERC20 - If the item is an ERC20 token.
30030
+ * @property {string} ERC721 - If the item is an ERC721 token.
30040
30031
  */
30041
- const CHECKOUT_API_BASE_URL = {
30042
- [ENV_DEVELOPMENT]: 'https://checkout-api.dev.immutable.com',
30043
- [Environment$1.SANDBOX]: 'https://checkout-api.sandbox.immutable.com',
30044
- [Environment$1.PRODUCTION]: 'https://checkout-api.immutable.com',
30045
- };
30032
+ var ItemType;
30033
+ (function (ItemType) {
30034
+ ItemType["NATIVE"] = "NATIVE";
30035
+ ItemType["ERC20"] = "ERC20";
30036
+ ItemType["ERC721"] = "ERC721";
30037
+ })(ItemType || (ItemType = {}));
30046
30038
  /**
30047
- * Smart Checkout routing default onramp enabled flag
30039
+ * An enum representing transaction or gas types
30040
+ * @enum {string}
30041
+ * @property {string} TRANSACTION - If the type is a transaction
30042
+ * @property {string} GAS - If the type is the gas amount
30048
30043
  */
30049
- const DEFAULT_ON_RAMP_ENABLED = true;
30044
+ var TransactionOrGasType;
30045
+ (function (TransactionOrGasType) {
30046
+ TransactionOrGasType["TRANSACTION"] = "TRANSACTION";
30047
+ TransactionOrGasType["GAS"] = "GAS";
30048
+ })(TransactionOrGasType || (TransactionOrGasType = {}));
30050
30049
  /**
30051
- * Smart Checkout routing default swap enabled flag
30050
+ * An enum representing the gas token types
30051
+ * @enum {string}
30052
+ * @property {string} NATIVE - If the gas token is a native token.
30053
+ * @property {string} ERC20 - If the gas token is an ERC20 token.
30052
30054
  */
30053
- const DEFAULT_SWAP_ENABLED = true;
30055
+ var GasTokenType;
30056
+ (function (GasTokenType) {
30057
+ GasTokenType["NATIVE"] = "NATIVE";
30058
+ GasTokenType["ERC20"] = "ERC20";
30059
+ })(GasTokenType || (GasTokenType = {}));
30054
30060
  /**
30055
- * Smart Checkout routing default bridge enabled flag
30061
+ * An enum representing the routing outcome types
30062
+ * @enum {string}
30063
+ * @property {string} ROUTES_FOUND - If funding routes were found for the transaction.
30064
+ * @property {string} NO_ROUTES_FOUND - If no funding routes were found for the transaction.
30065
+ * @property {string} NO_ROUTE_OPTIONS - If no routing options were available for the transaction.
30056
30066
  */
30057
- const DEFAULT_BRIDGE_ENABLED = true;
30058
- const TRANSAK_API_BASE_URL = {
30059
- [Environment$1.SANDBOX]: 'https://global-stg.transak.com',
30060
- [Environment$1.PRODUCTION]: 'https://global.transak.com/',
30061
- };
30062
- const PRODUCTION_CHAIN_ID_NETWORK_MAP = new Map([
30063
- [
30064
- ChainId.ETHEREUM,
30065
- {
30066
- chainIdHex: `0x${ChainId.ETHEREUM.toString(16)}`,
30067
- chainName: ChainName.ETHEREUM,
30068
- rpcUrls: ['https://checkout-api.immutable.com/v1/rpc/eth-mainnet'],
30069
- nativeCurrency: {
30070
- name: ChainName.ETHEREUM,
30071
- symbol: 'ETH',
30072
- decimals: 18,
30073
- },
30074
- blockExplorerUrls: ['https://etherscan.io/'],
30075
- },
30076
- ],
30077
- [
30078
- ChainId.IMTBL_ZKEVM_MAINNET,
30079
- {
30080
- chainIdHex: `0x${ChainId.IMTBL_ZKEVM_MAINNET.toString(16)}`,
30081
- chainName: ChainName.IMTBL_ZKEVM_MAINNET,
30082
- rpcUrls: ['https://rpc.immutable.com'],
30083
- nativeCurrency: ZKEVM_NATIVE_TOKEN,
30084
- },
30085
- ],
30086
- ]);
30087
- const SANDBOX_CHAIN_ID_NETWORK_MAP = new Map([
30088
- [
30089
- ChainId.SEPOLIA,
30090
- {
30091
- chainIdHex: `0x${ChainId.SEPOLIA.toString(16)}`,
30092
- chainName: ChainName.SEPOLIA,
30093
- rpcUrls: [
30094
- 'https://checkout-api.sandbox.immutable.com/v1/rpc/eth-sepolia',
30095
- ],
30096
- nativeCurrency: {
30097
- name: 'Sep Eth',
30098
- symbol: 'ETH',
30099
- decimals: 18,
30100
- },
30101
- blockExplorerUrls: ['https://sepolia.etherscan.io/'],
30102
- },
30103
- ],
30104
- [
30105
- ChainId.IMTBL_ZKEVM_TESTNET,
30106
- {
30107
- chainIdHex: `0x${ChainId.IMTBL_ZKEVM_TESTNET.toString(16)}`,
30108
- chainName: ChainName.IMTBL_ZKEVM_TESTNET,
30109
- rpcUrls: ['https://rpc.testnet.immutable.com'],
30110
- nativeCurrency: ZKEVM_NATIVE_TOKEN,
30111
- },
30112
- ],
30113
- ]);
30114
- const DEV_CHAIN_ID_NETWORK_MAP = new Map([
30115
- [
30116
- ChainId.SEPOLIA,
30117
- {
30118
- chainIdHex: `0x${ChainId.SEPOLIA.toString(16)}`,
30119
- chainName: ChainName.SEPOLIA,
30120
- rpcUrls: ['https://checkout-api.dev.immutable.com/v1/rpc/eth-sepolia'],
30121
- nativeCurrency: {
30122
- name: 'Sep Eth',
30123
- symbol: 'ETH',
30124
- decimals: 18,
30125
- },
30126
- blockExplorerUrls: ['https://sepolia.etherscan.io/'],
30127
- },
30128
- ],
30129
- [
30130
- ChainId.IMTBL_ZKEVM_DEVNET,
30131
- {
30132
- chainIdHex: `0x${ChainId.IMTBL_ZKEVM_DEVNET.toString(16)}`,
30133
- chainName: ChainName.IMTBL_ZKEVM_DEVNET,
30134
- rpcUrls: ['https://rpc.dev.immutable.com'],
30135
- nativeCurrency: ZKEVM_NATIVE_TOKEN,
30136
- },
30137
- ],
30138
- ]);
30067
+ var RoutingOutcomeType;
30068
+ (function (RoutingOutcomeType) {
30069
+ RoutingOutcomeType["ROUTES_FOUND"] = "ROUTES_FOUND";
30070
+ RoutingOutcomeType["NO_ROUTES_FOUND"] = "NO_ROUTES_FOUND";
30071
+ RoutingOutcomeType["NO_ROUTE_OPTIONS"] = "NO_ROUTE_OPTIONS";
30072
+ })(RoutingOutcomeType || (RoutingOutcomeType = {}));
30139
30073
  /**
30140
- * Blockscout API configuration per chain
30141
- */
30142
- const BLOCKSCOUT_CHAIN_URL_MAP = {
30143
- [ChainId.IMTBL_ZKEVM_TESTNET]: {
30144
- url: 'https://explorer.testnet.immutable.com',
30145
- nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_TESTNET).nativeCurrency,
30146
- },
30147
- [ChainId.IMTBL_ZKEVM_MAINNET]: {
30148
- url: 'https://explorer.mainnet.immutable.com',
30149
- nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_MAINNET).nativeCurrency,
30150
- },
30151
- [ChainId.SEPOLIA]: {
30152
- url: 'https://eth-sepolia.blockscout.com',
30153
- nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.SEPOLIA).nativeCurrency,
30154
- },
30155
- [ChainId.ETHEREUM]: {
30156
- url: 'https://eth.blockscout.com/',
30157
- nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.ETHEREUM).nativeCurrency,
30158
- },
30159
- };
30160
- const ERC20ABI = [
30161
- {
30162
- constant: true,
30163
- inputs: [],
30164
- name: 'name',
30165
- outputs: [
30166
- {
30167
- name: '',
30168
- type: 'string',
30169
- },
30170
- ],
30171
- payable: false,
30172
- type: 'function',
30173
- },
30174
- {
30175
- constant: true,
30176
- inputs: [],
30177
- name: 'decimals',
30178
- outputs: [
30179
- {
30180
- name: '',
30181
- type: 'uint8',
30182
- },
30183
- ],
30184
- payable: false,
30185
- type: 'function',
30186
- },
30187
- {
30188
- constant: true,
30189
- inputs: [
30190
- {
30191
- name: '_owner',
30192
- type: 'address',
30193
- },
30194
- ],
30195
- name: 'balanceOf',
30196
- outputs: [
30197
- {
30198
- name: 'balance',
30199
- type: 'uint256',
30200
- },
30201
- ],
30202
- payable: false,
30203
- type: 'function',
30204
- },
30205
- {
30206
- constant: true,
30207
- inputs: [],
30208
- name: 'symbol',
30209
- outputs: [
30210
- {
30211
- name: '',
30212
- type: 'string',
30213
- },
30214
- ],
30215
- payable: false,
30216
- type: 'function',
30217
- },
30218
- {
30219
- constant: true,
30220
- inputs: [
30221
- {
30222
- name: '_owner',
30223
- type: 'address',
30224
- },
30225
- {
30226
- name: '_spender',
30227
- type: 'address',
30228
- },
30229
- ],
30230
- name: 'allowance',
30231
- outputs: [
30232
- {
30233
- name: '',
30234
- type: 'uint256',
30235
- },
30236
- ],
30237
- payable: false,
30238
- stateMutability: 'view',
30239
- type: 'function',
30240
- },
30241
- {
30242
- constant: false,
30243
- inputs: [
30244
- {
30245
- name: '_spender',
30246
- type: 'address',
30247
- },
30248
- {
30249
- name: '_value',
30250
- type: 'uint256',
30251
- },
30252
- ],
30253
- name: 'approve',
30254
- outputs: [
30255
- {
30256
- name: '',
30257
- type: 'bool',
30258
- },
30259
- ],
30260
- payable: false,
30261
- stateMutability: 'nonpayable',
30262
- type: 'function',
30263
- },
30264
- ];
30265
- const ERC721ABI = [
30266
- {
30267
- constant: false,
30268
- inputs: [
30269
- {
30270
- internalType: 'address',
30271
- name: 'to',
30272
- type: 'address',
30273
- },
30274
- {
30275
- internalType: 'uint256',
30276
- name: 'tokenId',
30277
- type: 'uint256',
30278
- },
30279
- ],
30280
- name: 'approve',
30281
- outputs: [],
30282
- payable: false,
30283
- stateMutability: 'nonpayable',
30284
- type: 'function',
30285
- },
30286
- {
30287
- constant: true,
30288
- inputs: [
30289
- {
30290
- internalType: 'address',
30291
- name: 'owner',
30292
- type: 'address',
30293
- },
30294
- {
30295
- internalType: 'address',
30296
- name: 'operator',
30297
- type: 'address',
30298
- },
30299
- ],
30300
- name: 'isApprovedForAll',
30301
- outputs: [
30302
- {
30303
- internalType: 'bool',
30304
- name: '',
30305
- type: 'bool',
30306
- },
30307
- ],
30308
- payable: false,
30309
- stateMutability: 'view',
30310
- type: 'function',
30311
- },
30312
- {
30313
- constant: true,
30314
- inputs: [
30315
- {
30316
- internalType: 'uint256',
30317
- name: 'tokenId',
30318
- type: 'uint256',
30319
- },
30320
- ],
30321
- name: 'getApproved',
30322
- outputs: [
30323
- {
30324
- internalType: 'address',
30325
- name: '',
30326
- type: 'address',
30327
- },
30328
- ],
30329
- payable: false,
30330
- stateMutability: 'view',
30331
- type: 'function',
30332
- },
30333
- {
30334
- inputs: [
30335
- {
30336
- internalType: 'uint256',
30337
- name: 'tokenId',
30338
- type: 'uint256',
30339
- },
30340
- ],
30341
- name: 'ownerOf',
30342
- outputs: [
30343
- {
30344
- internalType: 'address',
30345
- name: '',
30346
- type: 'address',
30347
- },
30348
- ],
30349
- stateMutability: 'view',
30350
- type: 'function',
30351
- },
30352
- ];
30353
-
30354
- /**
30355
- * An enum representing the checkout status types
30356
- * @enum {string}
30357
- * @property {string} SUCCESS - If checkout succeeded as the transactions were able to be processed
30358
- * @property {string} FAILED - If checkout failed due to transactions not settling on chain
30359
- * @property {string} INSUFFICIENT_FUNDS - If checkout failed due to insufficient funds
30360
- */
30361
- var CheckoutStatus;
30362
- (function (CheckoutStatus) {
30363
- CheckoutStatus["SUCCESS"] = "SUCCESS";
30364
- CheckoutStatus["FAILED"] = "FAILED";
30365
- CheckoutStatus["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
30366
- })(CheckoutStatus || (CheckoutStatus = {}));
30367
- /**
30368
- * An enum representing the item types
30369
- * @enum {string}
30370
- * @property {string} NATIVE - If the item is a native token.
30371
- * @property {string} ERC20 - If the item is an ERC20 token.
30372
- * @property {string} ERC721 - If the item is an ERC721 token.
30373
- */
30374
- var ItemType;
30375
- (function (ItemType) {
30376
- ItemType["NATIVE"] = "NATIVE";
30377
- ItemType["ERC20"] = "ERC20";
30378
- ItemType["ERC721"] = "ERC721";
30379
- })(ItemType || (ItemType = {}));
30380
- /**
30381
- * An enum representing transaction or gas types
30382
- * @enum {string}
30383
- * @property {string} TRANSACTION - If the type is a transaction
30384
- * @property {string} GAS - If the type is the gas amount
30385
- */
30386
- var TransactionOrGasType;
30387
- (function (TransactionOrGasType) {
30388
- TransactionOrGasType["TRANSACTION"] = "TRANSACTION";
30389
- TransactionOrGasType["GAS"] = "GAS";
30390
- })(TransactionOrGasType || (TransactionOrGasType = {}));
30391
- /**
30392
- * An enum representing the gas token types
30393
- * @enum {string}
30394
- * @property {string} NATIVE - If the gas token is a native token.
30395
- * @property {string} ERC20 - If the gas token is an ERC20 token.
30396
- */
30397
- var GasTokenType;
30398
- (function (GasTokenType) {
30399
- GasTokenType["NATIVE"] = "NATIVE";
30400
- GasTokenType["ERC20"] = "ERC20";
30401
- })(GasTokenType || (GasTokenType = {}));
30402
- /**
30403
- * An enum representing the routing outcome types
30404
- * @enum {string}
30405
- * @property {string} ROUTES_FOUND - If funding routes were found for the transaction.
30406
- * @property {string} NO_ROUTES_FOUND - If no funding routes were found for the transaction.
30407
- * @property {string} NO_ROUTE_OPTIONS - If no routing options were available for the transaction.
30408
- */
30409
- var RoutingOutcomeType;
30410
- (function (RoutingOutcomeType) {
30411
- RoutingOutcomeType["ROUTES_FOUND"] = "ROUTES_FOUND";
30412
- RoutingOutcomeType["NO_ROUTES_FOUND"] = "NO_ROUTES_FOUND";
30413
- RoutingOutcomeType["NO_ROUTE_OPTIONS"] = "NO_ROUTE_OPTIONS";
30414
- })(RoutingOutcomeType || (RoutingOutcomeType = {}));
30415
- /**
30416
- * An enum representing the funding step types
30417
- * @enum {string}
30418
- * @property {string} BRIDGE - If the funding step is a bridge.
30419
- * @property {string} SWAP - If the funding step is a swap.
30420
- * @property {string} ONRAMP - If the funding step is an onramp.
30074
+ * An enum representing the funding step types
30075
+ * @enum {string}
30076
+ * @property {string} BRIDGE - If the funding step is a bridge.
30077
+ * @property {string} SWAP - If the funding step is a swap.
30078
+ * @property {string} ONRAMP - If the funding step is an onramp.
30421
30079
  */
30422
30080
  var FundingStepType;
30423
30081
  (function (FundingStepType) {
@@ -30524,158 +30182,507 @@ fn, customError) => {
30524
30182
  }
30525
30183
  };
30526
30184
 
30527
- // this function needs to be in a separate file to prevent circular dependencies with ./network
30528
- // this gives us access to the properties of the underlying provider object
30529
- async function getUnderlyingChainId(web3Provider) {
30530
- if (!web3Provider.provider?.request) {
30531
- throw new CheckoutError('Parsed provider is not a valid Web3Provider', CheckoutErrorType.WEB3_PROVIDER_ERROR);
30532
- }
30533
- const chainId = await web3Provider.provider.request({
30534
- method: WalletAction.GET_CHAINID,
30535
- params: [],
30536
- });
30537
- return parseInt(chainId, 16);
30538
- }
30539
-
30540
- /* eslint-disable @typescript-eslint/no-explicit-any */
30541
- const UNRECOGNISED_CHAIN_ERROR_CODE = 4902; // error code (MetaMask)
30542
- // these functions should not be exported. These functions should be used as part of an exported function e.g switchWalletNetwork() above.
30543
- // make sure to check if(provider.provider?.request) in the exported function and throw an error
30544
- // eslint-disable-next-line consistent-return
30545
- async function switchNetworkInWallet(networkMap, web3Provider, chainId) {
30546
- if (web3Provider.provider?.request) {
30547
- return await web3Provider.provider.request({
30548
- method: WalletAction.SWITCH_NETWORK,
30549
- params: [
30550
- {
30551
- chainId: networkMap.get(chainId)?.chainIdHex,
30552
- },
30553
- ],
30554
- });
30555
- }
30556
- }
30557
- // TODO: Should these functions always return something?
30558
- // eslint-disable-next-line consistent-return
30559
- async function addNetworkToWallet(networkMap, web3Provider, chainId) {
30560
- if (web3Provider.provider?.request) {
30561
- const networkDetails = networkMap.get(chainId);
30562
- const addNetwork = {
30563
- chainId: networkDetails?.chainIdHex,
30564
- chainName: networkDetails?.chainName,
30565
- rpcUrls: networkDetails?.rpcUrls,
30566
- nativeCurrency: networkDetails?.nativeCurrency,
30567
- blockExplorerUrls: networkDetails?.blockExplorerUrls,
30568
- };
30569
- return await web3Provider.provider.request({
30570
- method: WalletAction.ADD_NETWORK,
30571
- params: [addNetwork],
30572
- });
30573
- }
30574
- }
30575
- async function getNetworkAllowList(config, { type = NetworkFilterTypes.ALL, exclude }) {
30576
- const { networkMap } = config;
30577
- const allowedNetworkConfig = (await config.remote.getConfig('allowedNetworks'));
30578
- const list = allowedNetworkConfig.filter((network) => {
30579
- const allowAllTokens = type === NetworkFilterTypes.ALL;
30580
- const networkNotExcluded = !(exclude || [])
30581
- .map((exc) => exc.chainId)
30582
- .includes(network.chainId);
30583
- return allowAllTokens && networkNotExcluded;
30584
- });
30585
- const allowedNetworks = [];
30586
- list.forEach((element) => {
30587
- const newNetwork = networkMap.get(element.chainId);
30588
- if (newNetwork) {
30589
- allowedNetworks.push({
30590
- name: newNetwork.chainName,
30591
- chainId: parseInt(newNetwork.chainIdHex, 16),
30592
- nativeCurrency: newNetwork.nativeCurrency,
30593
- isSupported: true,
30594
- });
30595
- }
30596
- });
30597
- return {
30598
- networks: allowedNetworks,
30599
- };
30600
- }
30601
- async function getNetworkInfo(config, web3Provider) {
30602
- const { networkMap } = config;
30603
- return withCheckoutError(async () => {
30604
- try {
30605
- const network = await web3Provider.getNetwork();
30606
- if (Array.from(networkMap.keys()).includes(network.chainId)) {
30607
- const chainIdNetworkInfo = networkMap.get(network.chainId);
30608
- return {
30609
- name: chainIdNetworkInfo.chainName,
30610
- chainId: parseInt(chainIdNetworkInfo.chainIdHex, 16),
30611
- nativeCurrency: chainIdNetworkInfo.nativeCurrency,
30612
- isSupported: true,
30613
- };
30614
- }
30615
- return {
30616
- chainId: network.chainId,
30617
- name: network.name,
30618
- isSupported: false,
30619
- };
30620
- }
30621
- catch (err) {
30622
- const chainId = await getUnderlyingChainId(web3Provider);
30623
- const isSupported = Array.from(networkMap.keys()).includes(chainId);
30624
- return {
30625
- chainId,
30626
- isSupported,
30627
- };
30628
- }
30629
- }, {
30630
- type: CheckoutErrorType.GET_NETWORK_INFO_ERROR,
30631
- });
30632
- }
30633
- async function switchWalletNetwork(config, web3Provider, chainId) {
30634
- const { networkMap } = config;
30635
- const allowedNetworks = await getNetworkAllowList(config, {
30636
- type: NetworkFilterTypes.ALL,
30637
- });
30638
- if (!allowedNetworks.networks.some((network) => network.chainId === chainId)) {
30639
- throw new CheckoutError(`Chain:${chainId} is not a supported chain`, CheckoutErrorType.CHAIN_NOT_SUPPORTED_ERROR);
30640
- }
30641
- if (web3Provider.provider?.isPassport) {
30642
- throw new CheckoutError('Switching networks with Passport provider is not supported', CheckoutErrorType.SWITCH_NETWORK_UNSUPPORTED);
30643
- }
30644
- // WT-1146 - Refer to the README in this folder for explanation on the switch network flow
30645
- try {
30646
- await switchNetworkInWallet(networkMap, web3Provider, chainId);
30647
- }
30648
- catch (err) {
30649
- if (err.code === UNRECOGNISED_CHAIN_ERROR_CODE) {
30650
- try {
30651
- await addNetworkToWallet(networkMap, web3Provider, chainId);
30652
- // eslint-disable-next-line @typescript-eslint/no-shadow
30653
- }
30654
- catch (err) {
30655
- throw new CheckoutError('User cancelled add network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30656
- }
30657
- }
30658
- else {
30659
- throw new CheckoutError('User cancelled switch network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30660
- }
30661
- }
30662
- const newProvider = new providers.Web3Provider(web3Provider.provider);
30663
- const newProviderNetwork = await newProvider.getNetwork();
30664
- if (newProviderNetwork.chainId !== chainId) {
30665
- throw new CheckoutError('User cancelled switch network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30666
- }
30667
- const networkInfo = await getNetworkInfo(config, newProvider);
30668
- return {
30669
- network: networkInfo,
30670
- provider: newProvider,
30671
- };
30672
- }
30185
+ // this function needs to be in a separate file to prevent circular dependencies with ./network
30186
+ // this gives us access to the properties of the underlying provider object
30187
+ async function getUnderlyingChainId(web3Provider) {
30188
+ if (!web3Provider.provider?.request) {
30189
+ throw new CheckoutError('Parsed provider is not a valid Web3Provider', CheckoutErrorType.WEB3_PROVIDER_ERROR);
30190
+ }
30191
+ const chainId = await web3Provider.provider.request({
30192
+ method: WalletAction.GET_CHAINID,
30193
+ params: [],
30194
+ });
30195
+ return parseInt(chainId, 16);
30196
+ }
30197
+
30198
+ /* eslint-disable @typescript-eslint/no-explicit-any */
30199
+ const UNRECOGNISED_CHAIN_ERROR_CODE = 4902; // error code (MetaMask)
30200
+ // these functions should not be exported. These functions should be used as part of an exported function e.g switchWalletNetwork() above.
30201
+ // make sure to check if(provider.provider?.request) in the exported function and throw an error
30202
+ // eslint-disable-next-line consistent-return
30203
+ async function switchNetworkInWallet(networkMap, web3Provider, chainId) {
30204
+ if (web3Provider.provider?.request) {
30205
+ return await web3Provider.provider.request({
30206
+ method: WalletAction.SWITCH_NETWORK,
30207
+ params: [
30208
+ {
30209
+ chainId: networkMap.get(chainId)?.chainIdHex,
30210
+ },
30211
+ ],
30212
+ });
30213
+ }
30214
+ }
30215
+ // TODO: Should these functions always return something?
30216
+ // eslint-disable-next-line consistent-return
30217
+ async function addNetworkToWallet(networkMap, web3Provider, chainId) {
30218
+ if (web3Provider.provider?.request) {
30219
+ const networkDetails = networkMap.get(chainId);
30220
+ const addNetwork = {
30221
+ chainId: networkDetails?.chainIdHex,
30222
+ chainName: networkDetails?.chainName,
30223
+ rpcUrls: networkDetails?.rpcUrls,
30224
+ nativeCurrency: networkDetails?.nativeCurrency,
30225
+ blockExplorerUrls: networkDetails?.blockExplorerUrls,
30226
+ };
30227
+ return await web3Provider.provider.request({
30228
+ method: WalletAction.ADD_NETWORK,
30229
+ params: [addNetwork],
30230
+ });
30231
+ }
30232
+ }
30233
+ async function getNetworkAllowList(config, { type = NetworkFilterTypes.ALL, exclude }) {
30234
+ const { networkMap } = config;
30235
+ const allowedNetworkConfig = (await config.remote.getConfig('allowedNetworks'));
30236
+ const list = allowedNetworkConfig.filter((network) => {
30237
+ const allowAllTokens = type === NetworkFilterTypes.ALL;
30238
+ const networkNotExcluded = !(exclude || [])
30239
+ .map((exc) => exc.chainId)
30240
+ .includes(network.chainId);
30241
+ return allowAllTokens && networkNotExcluded;
30242
+ });
30243
+ const allowedNetworks = [];
30244
+ list.forEach((element) => {
30245
+ const newNetwork = networkMap.get(element.chainId);
30246
+ if (newNetwork) {
30247
+ allowedNetworks.push({
30248
+ name: newNetwork.chainName,
30249
+ chainId: parseInt(newNetwork.chainIdHex, 16),
30250
+ nativeCurrency: newNetwork.nativeCurrency,
30251
+ isSupported: true,
30252
+ });
30253
+ }
30254
+ });
30255
+ return {
30256
+ networks: allowedNetworks,
30257
+ };
30258
+ }
30259
+ async function getNetworkInfo(config, web3Provider) {
30260
+ const { networkMap } = config;
30261
+ return withCheckoutError(async () => {
30262
+ try {
30263
+ const network = await web3Provider.getNetwork();
30264
+ if (Array.from(networkMap.keys()).includes(network.chainId)) {
30265
+ const chainIdNetworkInfo = networkMap.get(network.chainId);
30266
+ return {
30267
+ name: chainIdNetworkInfo.chainName,
30268
+ chainId: parseInt(chainIdNetworkInfo.chainIdHex, 16),
30269
+ nativeCurrency: chainIdNetworkInfo.nativeCurrency,
30270
+ isSupported: true,
30271
+ };
30272
+ }
30273
+ return {
30274
+ chainId: network.chainId,
30275
+ name: network.name,
30276
+ isSupported: false,
30277
+ };
30278
+ }
30279
+ catch (err) {
30280
+ const chainId = await getUnderlyingChainId(web3Provider);
30281
+ const isSupported = Array.from(networkMap.keys()).includes(chainId);
30282
+ return {
30283
+ chainId,
30284
+ isSupported,
30285
+ };
30286
+ }
30287
+ }, {
30288
+ type: CheckoutErrorType.GET_NETWORK_INFO_ERROR,
30289
+ });
30290
+ }
30291
+ async function switchWalletNetwork(config, web3Provider, chainId) {
30292
+ const { networkMap } = config;
30293
+ const allowedNetworks = await getNetworkAllowList(config, {
30294
+ type: NetworkFilterTypes.ALL,
30295
+ });
30296
+ if (!allowedNetworks.networks.some((network) => network.chainId === chainId)) {
30297
+ throw new CheckoutError(`Chain:${chainId} is not a supported chain`, CheckoutErrorType.CHAIN_NOT_SUPPORTED_ERROR);
30298
+ }
30299
+ if (web3Provider.provider?.isPassport) {
30300
+ throw new CheckoutError('Switching networks with Passport provider is not supported', CheckoutErrorType.SWITCH_NETWORK_UNSUPPORTED);
30301
+ }
30302
+ // WT-1146 - Refer to the README in this folder for explanation on the switch network flow
30303
+ try {
30304
+ await switchNetworkInWallet(networkMap, web3Provider, chainId);
30305
+ }
30306
+ catch (err) {
30307
+ if (err.code === UNRECOGNISED_CHAIN_ERROR_CODE) {
30308
+ try {
30309
+ await addNetworkToWallet(networkMap, web3Provider, chainId);
30310
+ // eslint-disable-next-line @typescript-eslint/no-shadow
30311
+ }
30312
+ catch (err) {
30313
+ throw new CheckoutError('User cancelled add network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30314
+ }
30315
+ }
30316
+ else {
30317
+ throw new CheckoutError('User cancelled switch network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30318
+ }
30319
+ }
30320
+ const newProvider = new providers.Web3Provider(web3Provider.provider);
30321
+ const newProviderNetwork = await newProvider.getNetwork();
30322
+ if (newProviderNetwork.chainId !== chainId) {
30323
+ throw new CheckoutError('User cancelled switch network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
30324
+ }
30325
+ const networkInfo = await getNetworkInfo(config, newProvider);
30326
+ return {
30327
+ network: networkInfo,
30328
+ provider: newProvider,
30329
+ };
30330
+ }
30331
+
30332
+ const ENV_DEVELOPMENT = 'development';
30333
+ const DEFAULT_TOKEN_DECIMALS$1 = 18;
30334
+ const NATIVE = 'native';
30335
+ const ZKEVM_NATIVE_TOKEN = {
30336
+ name: 'IMX',
30337
+ symbol: 'IMX',
30338
+ decimals: DEFAULT_TOKEN_DECIMALS$1,
30339
+ };
30340
+ /**
30341
+ * Base URL for the Immutable API based on the environment.
30342
+ * @property {string} DEVELOPMENT - The base URL for the development environment.
30343
+ * @property {string} SANDBOX - The base URL for the sandbox environment.
30344
+ * @property {string} PRODUCTION - The base URL for the production environment.
30345
+ */
30346
+ const IMMUTABLE_API_BASE_URL = {
30347
+ [ENV_DEVELOPMENT]: 'https://api.dev.immutable.com',
30348
+ [Environment$1.SANDBOX]: 'https://api.sandbox.immutable.com',
30349
+ [Environment$1.PRODUCTION]: 'https://api.immutable.com',
30350
+ };
30351
+ /**
30352
+ * Base URL for the checkout API based on the environment.
30353
+ * @property {string} DEVELOPMENT - The base URL for the development environment.
30354
+ * @property {string} SANDBOX - The base URL for the sandbox environment.
30355
+ * @property {string} PRODUCTION - The base URL for the production environment.
30356
+ */
30357
+ const CHECKOUT_API_BASE_URL = {
30358
+ [ENV_DEVELOPMENT]: 'https://checkout-api.dev.immutable.com',
30359
+ [Environment$1.SANDBOX]: 'https://checkout-api.sandbox.immutable.com',
30360
+ [Environment$1.PRODUCTION]: 'https://checkout-api.immutable.com',
30361
+ };
30362
+ /**
30363
+ * Smart Checkout routing default onramp enabled flag
30364
+ */
30365
+ const DEFAULT_ON_RAMP_ENABLED = true;
30366
+ /**
30367
+ * Smart Checkout routing default swap enabled flag
30368
+ */
30369
+ const DEFAULT_SWAP_ENABLED = true;
30370
+ /**
30371
+ * Smart Checkout routing default bridge enabled flag
30372
+ */
30373
+ const DEFAULT_BRIDGE_ENABLED = true;
30374
+ const TRANSAK_API_BASE_URL = {
30375
+ [Environment$1.SANDBOX]: 'https://global-stg.transak.com',
30376
+ [Environment$1.PRODUCTION]: 'https://global.transak.com/',
30377
+ };
30378
+ const PRODUCTION_CHAIN_ID_NETWORK_MAP = new Map([
30379
+ [
30380
+ ChainId.ETHEREUM,
30381
+ {
30382
+ chainIdHex: `0x${ChainId.ETHEREUM.toString(16)}`,
30383
+ chainName: ChainName.ETHEREUM,
30384
+ rpcUrls: ['https://checkout-api.immutable.com/v1/rpc/eth-mainnet'],
30385
+ nativeCurrency: {
30386
+ name: ChainName.ETHEREUM,
30387
+ symbol: 'ETH',
30388
+ decimals: 18,
30389
+ },
30390
+ blockExplorerUrls: ['https://etherscan.io/'],
30391
+ },
30392
+ ],
30393
+ [
30394
+ ChainId.IMTBL_ZKEVM_MAINNET,
30395
+ {
30396
+ chainIdHex: `0x${ChainId.IMTBL_ZKEVM_MAINNET.toString(16)}`,
30397
+ chainName: ChainName.IMTBL_ZKEVM_MAINNET,
30398
+ rpcUrls: ['https://rpc.immutable.com'],
30399
+ nativeCurrency: ZKEVM_NATIVE_TOKEN,
30400
+ },
30401
+ ],
30402
+ ]);
30403
+ const SANDBOX_CHAIN_ID_NETWORK_MAP = new Map([
30404
+ [
30405
+ ChainId.SEPOLIA,
30406
+ {
30407
+ chainIdHex: `0x${ChainId.SEPOLIA.toString(16)}`,
30408
+ chainName: ChainName.SEPOLIA,
30409
+ rpcUrls: [
30410
+ 'https://checkout-api.sandbox.immutable.com/v1/rpc/eth-sepolia',
30411
+ ],
30412
+ nativeCurrency: {
30413
+ name: 'Sep Eth',
30414
+ symbol: 'ETH',
30415
+ decimals: 18,
30416
+ },
30417
+ blockExplorerUrls: ['https://sepolia.etherscan.io/'],
30418
+ },
30419
+ ],
30420
+ [
30421
+ ChainId.IMTBL_ZKEVM_TESTNET,
30422
+ {
30423
+ chainIdHex: `0x${ChainId.IMTBL_ZKEVM_TESTNET.toString(16)}`,
30424
+ chainName: ChainName.IMTBL_ZKEVM_TESTNET,
30425
+ rpcUrls: ['https://rpc.testnet.immutable.com'],
30426
+ nativeCurrency: ZKEVM_NATIVE_TOKEN,
30427
+ },
30428
+ ],
30429
+ ]);
30430
+ const DEV_CHAIN_ID_NETWORK_MAP = new Map([
30431
+ [
30432
+ ChainId.SEPOLIA,
30433
+ {
30434
+ chainIdHex: `0x${ChainId.SEPOLIA.toString(16)}`,
30435
+ chainName: ChainName.SEPOLIA,
30436
+ rpcUrls: ['https://checkout-api.dev.immutable.com/v1/rpc/eth-sepolia'],
30437
+ nativeCurrency: {
30438
+ name: 'Sep Eth',
30439
+ symbol: 'ETH',
30440
+ decimals: 18,
30441
+ },
30442
+ blockExplorerUrls: ['https://sepolia.etherscan.io/'],
30443
+ },
30444
+ ],
30445
+ [
30446
+ ChainId.IMTBL_ZKEVM_DEVNET,
30447
+ {
30448
+ chainIdHex: `0x${ChainId.IMTBL_ZKEVM_DEVNET.toString(16)}`,
30449
+ chainName: ChainName.IMTBL_ZKEVM_DEVNET,
30450
+ rpcUrls: ['https://rpc.dev.immutable.com'],
30451
+ nativeCurrency: ZKEVM_NATIVE_TOKEN,
30452
+ },
30453
+ ],
30454
+ ]);
30455
+ /**
30456
+ * Blockscout API configuration per chain
30457
+ */
30458
+ const BLOCKSCOUT_CHAIN_URL_MAP = {
30459
+ [ChainId.IMTBL_ZKEVM_TESTNET]: {
30460
+ url: 'https://explorer.testnet.immutable.com',
30461
+ nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_TESTNET).nativeCurrency,
30462
+ },
30463
+ [ChainId.IMTBL_ZKEVM_MAINNET]: {
30464
+ url: 'https://explorer.mainnet.immutable.com',
30465
+ nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.IMTBL_ZKEVM_MAINNET).nativeCurrency,
30466
+ },
30467
+ [ChainId.SEPOLIA]: {
30468
+ url: 'https://eth-sepolia.blockscout.com',
30469
+ nativeToken: SANDBOX_CHAIN_ID_NETWORK_MAP.get(ChainId.SEPOLIA).nativeCurrency,
30470
+ },
30471
+ [ChainId.ETHEREUM]: {
30472
+ url: 'https://eth.blockscout.com/',
30473
+ nativeToken: PRODUCTION_CHAIN_ID_NETWORK_MAP.get(ChainId.ETHEREUM).nativeCurrency,
30474
+ },
30475
+ };
30476
+ const ERC20ABI = [
30477
+ {
30478
+ constant: true,
30479
+ inputs: [],
30480
+ name: 'name',
30481
+ outputs: [
30482
+ {
30483
+ name: '',
30484
+ type: 'string',
30485
+ },
30486
+ ],
30487
+ payable: false,
30488
+ type: 'function',
30489
+ },
30490
+ {
30491
+ constant: true,
30492
+ inputs: [],
30493
+ name: 'decimals',
30494
+ outputs: [
30495
+ {
30496
+ name: '',
30497
+ type: 'uint8',
30498
+ },
30499
+ ],
30500
+ payable: false,
30501
+ type: 'function',
30502
+ },
30503
+ {
30504
+ constant: true,
30505
+ inputs: [
30506
+ {
30507
+ name: '_owner',
30508
+ type: 'address',
30509
+ },
30510
+ ],
30511
+ name: 'balanceOf',
30512
+ outputs: [
30513
+ {
30514
+ name: 'balance',
30515
+ type: 'uint256',
30516
+ },
30517
+ ],
30518
+ payable: false,
30519
+ type: 'function',
30520
+ },
30521
+ {
30522
+ constant: true,
30523
+ inputs: [],
30524
+ name: 'symbol',
30525
+ outputs: [
30526
+ {
30527
+ name: '',
30528
+ type: 'string',
30529
+ },
30530
+ ],
30531
+ payable: false,
30532
+ type: 'function',
30533
+ },
30534
+ {
30535
+ constant: true,
30536
+ inputs: [
30537
+ {
30538
+ name: '_owner',
30539
+ type: 'address',
30540
+ },
30541
+ {
30542
+ name: '_spender',
30543
+ type: 'address',
30544
+ },
30545
+ ],
30546
+ name: 'allowance',
30547
+ outputs: [
30548
+ {
30549
+ name: '',
30550
+ type: 'uint256',
30551
+ },
30552
+ ],
30553
+ payable: false,
30554
+ stateMutability: 'view',
30555
+ type: 'function',
30556
+ },
30557
+ {
30558
+ constant: false,
30559
+ inputs: [
30560
+ {
30561
+ name: '_spender',
30562
+ type: 'address',
30563
+ },
30564
+ {
30565
+ name: '_value',
30566
+ type: 'uint256',
30567
+ },
30568
+ ],
30569
+ name: 'approve',
30570
+ outputs: [
30571
+ {
30572
+ name: '',
30573
+ type: 'bool',
30574
+ },
30575
+ ],
30576
+ payable: false,
30577
+ stateMutability: 'nonpayable',
30578
+ type: 'function',
30579
+ },
30580
+ ];
30581
+ const ERC721ABI = [
30582
+ {
30583
+ constant: false,
30584
+ inputs: [
30585
+ {
30586
+ internalType: 'address',
30587
+ name: 'to',
30588
+ type: 'address',
30589
+ },
30590
+ {
30591
+ internalType: 'uint256',
30592
+ name: 'tokenId',
30593
+ type: 'uint256',
30594
+ },
30595
+ ],
30596
+ name: 'approve',
30597
+ outputs: [],
30598
+ payable: false,
30599
+ stateMutability: 'nonpayable',
30600
+ type: 'function',
30601
+ },
30602
+ {
30603
+ constant: true,
30604
+ inputs: [
30605
+ {
30606
+ internalType: 'address',
30607
+ name: 'owner',
30608
+ type: 'address',
30609
+ },
30610
+ {
30611
+ internalType: 'address',
30612
+ name: 'operator',
30613
+ type: 'address',
30614
+ },
30615
+ ],
30616
+ name: 'isApprovedForAll',
30617
+ outputs: [
30618
+ {
30619
+ internalType: 'bool',
30620
+ name: '',
30621
+ type: 'bool',
30622
+ },
30623
+ ],
30624
+ payable: false,
30625
+ stateMutability: 'view',
30626
+ type: 'function',
30627
+ },
30628
+ {
30629
+ constant: true,
30630
+ inputs: [
30631
+ {
30632
+ internalType: 'uint256',
30633
+ name: 'tokenId',
30634
+ type: 'uint256',
30635
+ },
30636
+ ],
30637
+ name: 'getApproved',
30638
+ outputs: [
30639
+ {
30640
+ internalType: 'address',
30641
+ name: '',
30642
+ type: 'address',
30643
+ },
30644
+ ],
30645
+ payable: false,
30646
+ stateMutability: 'view',
30647
+ type: 'function',
30648
+ },
30649
+ {
30650
+ inputs: [
30651
+ {
30652
+ internalType: 'uint256',
30653
+ name: 'tokenId',
30654
+ type: 'uint256',
30655
+ },
30656
+ ],
30657
+ name: 'ownerOf',
30658
+ outputs: [
30659
+ {
30660
+ internalType: 'address',
30661
+ name: '',
30662
+ type: 'address',
30663
+ },
30664
+ ],
30665
+ stateMutability: 'view',
30666
+ type: 'function',
30667
+ },
30668
+ ];
30669
+ // Gas overrides -- Anti-spam mechanism for when the baseFee drops low
30670
+ // https://github.com/immutable/imx-docs/blob/main/docs/main/zkEVM/overview/gas-configuration.md
30671
+ const GAS_OVERRIDES = {
30672
+ maxFeePerGas: ethers.BigNumber.from(102e9),
30673
+ maxPriorityFeePerGas: ethers.BigNumber.from(101e9),
30674
+ };
30675
+
30676
+ const SDK_VERSION_MARKER = '0.32.0';
30677
+ // This SDK version is replaced by the `yarn build` command ran on the root level
30678
+ const globalPackageVersion = () => SDK_VERSION_MARKER;
30673
30679
 
30674
30680
  class RemoteConfigFetcher {
30675
30681
  isDevelopment;
30676
30682
  isProduction;
30677
30683
  configCache;
30678
30684
  tokensCache;
30685
+ version = 'v1';
30679
30686
  constructor(params) {
30680
30687
  this.isDevelopment = params.isDevelopment;
30681
30688
  this.isProduction = params.isProduction;
@@ -30703,14 +30710,14 @@ class RemoteConfigFetcher {
30703
30710
  async loadConfig() {
30704
30711
  if (this.configCache)
30705
30712
  return this.configCache;
30706
- const response = await RemoteConfigFetcher.makeHttpRequest(`${this.getEndpoint()}/v1/config`);
30713
+ const response = await RemoteConfigFetcher.makeHttpRequest(`${this.getEndpoint()}/${this.version}/config`);
30707
30714
  this.configCache = response.data;
30708
30715
  return this.configCache;
30709
30716
  }
30710
30717
  async loadConfigTokens() {
30711
30718
  if (this.tokensCache)
30712
30719
  return this.tokensCache;
30713
- const response = await RemoteConfigFetcher.makeHttpRequest(`${this.getEndpoint()}/v1/config/tokens`);
30720
+ const response = await RemoteConfigFetcher.makeHttpRequest(`${this.getEndpoint()}/${this.version}/config/tokens`);
30714
30721
  this.tokensCache = response.data;
30715
30722
  return this.tokensCache;
30716
30723
  }
@@ -30826,6 +30833,7 @@ const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId,
30826
30833
  tokens: tokens.filter((token) => !exclude.map((e) => e.address).includes(token.address || '')),
30827
30834
  };
30828
30835
  };
30836
+ const isNativeToken = (address) => !address || address.toLocaleLowerCase() === NATIVE;
30829
30837
 
30830
30838
  const CACHE_DATA_TTL = 60; // seconds
30831
30839
  /**
@@ -31025,7 +31033,7 @@ const getIndexerBalance = async (walletAddress, chainId, filterTokens) => {
31025
31033
  // Shuffle the mapping of the tokens configuration so it is a hashmap
31026
31034
  // for faster access to tokens config objects.
31027
31035
  const shouldFilter = filterTokens.length > 0;
31028
- const mapFilterTokens = Object.assign({}, ...(filterTokens.map((t) => ({ [t.address || '']: t }))));
31036
+ const mapFilterTokens = Object.assign({}, ...(filterTokens.map((t) => ({ [t.address || NATIVE]: t }))));
31029
31037
  // Get blockscout client for the given chain
31030
31038
  let blockscoutClient = blockscoutClientMap.get(chainId);
31031
31039
  if (!blockscoutClient) {
@@ -31066,6 +31074,7 @@ const getIndexerBalance = async (walletAddress, chainId, filterTokens) => {
31066
31074
  const nativeBalances = async (client) => {
31067
31075
  try {
31068
31076
  const respNative = await client.getNativeTokenByWalletAddress({ walletAddress });
31077
+ respNative.token.address ||= NATIVE;
31069
31078
  items.push(respNative);
31070
31079
  }
31071
31080
  catch (err) {
@@ -31108,8 +31117,7 @@ const getBalances = async (config, web3Provider, walletAddress, tokens) => {
31108
31117
  const allBalancePromises = [];
31109
31118
  tokens
31110
31119
  .forEach((token) => {
31111
- // Check for NATIVE token
31112
- if (!token.address || token.address === IMX_ADDRESS_ZKEVM) {
31120
+ if (!token.address || token.address.toLocaleLowerCase() === NATIVE) {
31113
31121
  allBalancePromises.push(getBalance(config, web3Provider, walletAddress));
31114
31122
  }
31115
31123
  else {
@@ -31295,11 +31303,17 @@ async function getWalletAllowList(params) {
31295
31303
  };
31296
31304
  }
31297
31305
 
31306
+ const setTransactionGasLimits = (transaction) => {
31307
+ const rawTx = transaction;
31308
+ rawTx.maxFeePerGas = GAS_OVERRIDES.maxFeePerGas;
31309
+ rawTx.maxPriorityFeePerGas = GAS_OVERRIDES.maxPriorityFeePerGas;
31310
+ return rawTx;
31311
+ };
31298
31312
  const sendTransaction = async (web3Provider, transaction) => {
31299
31313
  try {
31300
- const transactionResponse = await web3Provider
31301
- .getSigner()
31302
- .sendTransaction(transaction);
31314
+ const signer = web3Provider.getSigner();
31315
+ const rawTx = setTransactionGasLimits(transaction);
31316
+ const transactionResponse = await signer.sendTransaction(rawTx);
31303
31317
  return {
31304
31318
  transactionResponse,
31305
31319
  };
@@ -31462,25 +31476,21 @@ async function swapGasEstimator(config) {
31462
31476
  const exchange = await createExchangeInstance(chainId, config);
31463
31477
  // Create a fake transaction to get the gas from the quote
31464
31478
  const { swap } = await exchange.getUnsignedSwapTxFromAmountIn(DUMMY_WALLET_ADDRESS, inAddress, outAddress, ethers.BigNumber.from(ethers.utils.parseUnits('1', DEFAULT_TOKEN_DECIMALS)));
31465
- if (swap.gasFeeEstimate === null) {
31479
+ if (!swap.gasFeeEstimate) {
31466
31480
  return {
31467
31481
  gasEstimateType: GasEstimateType.SWAP,
31468
31482
  gasFee: {},
31469
31483
  };
31470
31484
  }
31471
- let estimatedAmount;
31472
- if (swap.gasFeeEstimate.value) {
31473
- estimatedAmount = ethers.BigNumber.from(swap.gasFeeEstimate.value);
31474
- }
31475
31485
  return {
31476
31486
  gasEstimateType: GasEstimateType.SWAP,
31477
31487
  gasFee: {
31478
- estimatedAmount,
31488
+ estimatedAmount: swap.gasFeeEstimate.value ? ethers.BigNumber.from(swap.gasFeeEstimate.value) : undefined,
31479
31489
  token: {
31480
- address: swap.gasFeeEstimate?.token.address,
31481
- symbol: swap.gasFeeEstimate?.token.symbol ?? '',
31482
- name: swap.gasFeeEstimate?.token.name ?? '',
31483
- decimals: swap.gasFeeEstimate?.token.decimals ?? DEFAULT_TOKEN_DECIMALS,
31490
+ address: swap.gasFeeEstimate.token.address,
31491
+ symbol: swap.gasFeeEstimate.token.symbol ?? '',
31492
+ name: swap.gasFeeEstimate.token.name ?? '',
31493
+ decimals: swap.gasFeeEstimate.token.decimals ?? DEFAULT_TOKEN_DECIMALS,
31484
31494
  },
31485
31495
  },
31486
31496
  };
@@ -31871,7 +31881,7 @@ const getTokensFromRequirements = (itemRequirements) => itemRequirements
31871
31881
  .map((itemRequirement) => {
31872
31882
  if (itemRequirement.type === ItemType.NATIVE) {
31873
31883
  return {
31874
- address: IMX_ADDRESS_ZKEVM,
31884
+ address: NATIVE,
31875
31885
  };
31876
31886
  }
31877
31887
  return {
@@ -31931,8 +31941,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
31931
31941
  }
31932
31942
  else if (itemRequirement.type === ItemType.NATIVE) {
31933
31943
  itemBalanceResult = balances.find((balance) => {
31934
- return balance.token?.address === ''
31935
- || balance.token?.address === IMX_ADDRESS_ZKEVM;
31944
+ return isNativeToken(balance.token?.address);
31936
31945
  });
31937
31946
  }
31938
31947
  // Calculate the balance delta
@@ -31960,7 +31969,6 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
31960
31969
  name,
31961
31970
  symbol,
31962
31971
  decimals: DEFAULT_TOKEN_DECIMALS$1,
31963
- address: IMX_ADDRESS_ZKEVM,
31964
31972
  },
31965
31973
  };
31966
31974
  }
@@ -32019,9 +32027,13 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
32019
32027
  const getTokenBalances = async (config, provider, ownerAddress, itemRequirements) => {
32020
32028
  try {
32021
32029
  const tokenMap = new Map();
32022
- getTokensFromRequirements(itemRequirements).forEach((item) => tokenMap.set((item.address || '').toLocaleLowerCase(), item));
32023
- const { balances } = await getAllBalances(config, provider, ownerAddress);
32024
- return balances.filter((balance) => tokenMap.get((balance.token.address || '').toLocaleLowerCase()));
32030
+ getTokensFromRequirements(itemRequirements).forEach((item) => {
32031
+ if (!item.address)
32032
+ return;
32033
+ tokenMap.set(item.address.toLocaleLowerCase(), item);
32034
+ });
32035
+ const { balances } = await getAllBalances(config, provider, ownerAddress, getL2ChainId(config));
32036
+ return balances.filter((balance) => tokenMap.get((balance.token.address || NATIVE).toLocaleLowerCase()));
32025
32037
  }
32026
32038
  catch (error) {
32027
32039
  throw new CheckoutError('Failed to get balances', CheckoutErrorType.GET_BALANCE_ERROR);
@@ -32427,7 +32439,7 @@ const constructFees$1 = (approvalGasFees, swapGasFees, swapFees) => {
32427
32439
  const constructSwapRoute = (chainId, fundsRequired, userBalance, fees) => {
32428
32440
  const tokenAddress = userBalance.token.address;
32429
32441
  let type = ItemType.ERC20;
32430
- if (tokenAddress === IMX_ADDRESS_ZKEVM) {
32442
+ if (isNativeToken(tokenAddress)) {
32431
32443
  type = ItemType.NATIVE;
32432
32444
  }
32433
32445
  return {
@@ -32448,16 +32460,24 @@ const constructSwapRoute = (chainId, fundsRequired, userBalance, fees) => {
32448
32460
  fees,
32449
32461
  };
32450
32462
  };
32463
+ const isBalanceRequirementTokenValid = (balanceRequirement) => {
32464
+ if (balanceRequirement.type === ItemType.ERC20) {
32465
+ return !!balanceRequirement.required.token.address;
32466
+ }
32467
+ if (balanceRequirement.type === ItemType.NATIVE) {
32468
+ return isNativeToken(balanceRequirement.required.token.address);
32469
+ }
32470
+ return false;
32471
+ };
32451
32472
  const getRequiredToken = (balanceRequirement) => {
32452
32473
  let address = '';
32453
32474
  let amount = ethers.BigNumber.from(0);
32454
32475
  switch (balanceRequirement.type) {
32455
32476
  case ItemType.ERC20:
32456
- address = balanceRequirement.required.token.address ?? '';
32477
+ address = balanceRequirement.required.token.address;
32457
32478
  amount = balanceRequirement.delta.balance;
32458
32479
  break;
32459
32480
  case ItemType.NATIVE:
32460
- address = IMX_ADDRESS_ZKEVM;
32461
32481
  amount = balanceRequirement.delta.balance;
32462
32482
  break;
32463
32483
  }
@@ -32478,7 +32498,8 @@ const checkUserCanCoverApprovalFees = (l2Balances, approval) => {
32478
32498
  };
32479
32499
  }
32480
32500
  // Find the users balance of the approval token
32481
- const l2BalanceOfApprovalToken = l2Balances.find((balance) => balance.token.address === approvalGasTokenAddress);
32501
+ const l2BalanceOfApprovalToken = l2Balances.find((balance) => (isNativeToken(balance.token.address) && isNativeToken(approvalGasTokenAddress))
32502
+ || balance.token.address === approvalGasTokenAddress);
32482
32503
  if (!l2BalanceOfApprovalToken)
32483
32504
  return { sufficient: false, approvalGasFee, approvalGasTokenAddress };
32484
32505
  // If the user does not have enough of the token to cover approval fees then return sufficient false
@@ -32496,7 +32517,7 @@ const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFees, swapFe
32496
32517
  // Set up a map of token addresses to amounts for each of the swap fees
32497
32518
  const feeMap = new Map();
32498
32519
  // Add the approval fee to list of fees
32499
- if (approvalFees.approvalGasTokenAddress !== '') {
32520
+ if (approvalFees.approvalGasFee.gt(ethers.BigNumber.from(0))) {
32500
32521
  feeMap.set(approvalFees.approvalGasTokenAddress, approvalFees.approvalGasFee);
32501
32522
  }
32502
32523
  // Add the swap gas fee to list of fees
@@ -32532,7 +32553,8 @@ const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFees, swapFe
32532
32553
  for (const [tokenAddress, fee] of feeMap.entries()) {
32533
32554
  if (fee === ethers.BigNumber.from(0))
32534
32555
  continue;
32535
- const l2BalanceOfFeeToken = l2Balances.find((balance) => balance.token.address === tokenAddress);
32556
+ const l2BalanceOfFeeToken = l2Balances.find((balance) => (isNativeToken(balance.token.address) && isNativeToken(tokenAddress))
32557
+ || balance.token.address === tokenAddress);
32536
32558
  if (!l2BalanceOfFeeToken) {
32537
32559
  return false;
32538
32560
  }
@@ -32584,9 +32606,9 @@ const swapRoute = async (config, availableRoutingOptions, walletAddress, balance
32584
32606
  return fundingSteps;
32585
32607
  if (swappableTokens.length === 0)
32586
32608
  return fundingSteps;
32587
- const requiredToken = getRequiredToken(balanceRequirement);
32588
- if (requiredToken.address === '')
32609
+ if (!isBalanceRequirementTokenValid(balanceRequirement))
32589
32610
  return fundingSteps;
32611
+ const requiredToken = getRequiredToken(balanceRequirement);
32590
32612
  const chainId = getL2ChainId(config);
32591
32613
  const l2TokenBalanceResult = tokenBalanceResults.get(chainId);
32592
32614
  if (!l2TokenBalanceResult)
@@ -32683,7 +32705,7 @@ const allowListCheck = async (config, tokenBalances, availableRoutingOptions) =>
32683
32705
 
32684
32706
  const getEthBalance = (balances) => {
32685
32707
  for (const balance of balances.balances) {
32686
- if (!balance.token.address || balance.token.address === '') {
32708
+ if (isNativeToken(balance.token.address)) {
32687
32709
  return balance.balance;
32688
32710
  }
32689
32711
  }
@@ -32739,25 +32761,28 @@ const getImxL1Representation = async (chainId, config) => {
32739
32761
  return imxMappingConfig[chainId] ?? '';
32740
32762
  };
32741
32763
  const fetchL1Representation = async (config, l2address) => {
32742
- if (l2address === '')
32743
- return { l1address: '', l2address };
32744
- if (l2address === IMX_ADDRESS_ZKEVM) {
32764
+ if (isNativeToken(l2address)) {
32745
32765
  return {
32746
32766
  l1address: await getImxL1Representation(getL1ChainId(config), config),
32747
- l2address: IMX_ADDRESS_ZKEVM,
32767
+ l2address: NATIVE,
32748
32768
  };
32749
32769
  }
32750
32770
  const chainName = getIndexerChainName(getL2ChainId(config));
32751
- if (chainName === '')
32752
- return { l1address: '', l2address }; // Chain name not a valid indexer chain name
32753
32771
  const blockchainData = createBlockchainDataInstance(config);
32754
32772
  const tokenData = await blockchainData.getToken({
32755
32773
  chainName,
32756
32774
  contractAddress: l2address,
32757
32775
  });
32776
+ // TODO: When bridge is ready we need to understand how L2 ETH will be mapped back to L1 ETH
32758
32777
  const l1address = tokenData.result.root_contract_address;
32778
+ if (l1address === INDEXER_ETH_ROOT_CONTRACT_ADDRESS) {
32779
+ return {
32780
+ l1address: 'native',
32781
+ l2address,
32782
+ };
32783
+ }
32759
32784
  if (l1address === null)
32760
- return { l1address: '', l2address }; // No L1 representation of this token
32785
+ return undefined; // No L1 representation of this token
32761
32786
  return {
32762
32787
  l1address,
32763
32788
  l2address,
@@ -32844,16 +32869,9 @@ const constructBridgeFundingRoute = (chainId, balance, bridgeRequirement, itemTy
32844
32869
  },
32845
32870
  fees,
32846
32871
  });
32847
- const isNativeEth = (address) => {
32848
- if (!address || address === '')
32849
- return true;
32850
- return false;
32851
- };
32852
32872
  const bridgeRoute = async (config, readOnlyProviders, depositorAddress, availableRoutingOptions, bridgeRequirement, tokenBalanceResults, feeEstimates) => {
32853
32873
  if (!availableRoutingOptions.bridge)
32854
32874
  return undefined;
32855
- if (bridgeRequirement.l2address === undefined || bridgeRequirement.l2address === '')
32856
- return undefined;
32857
32875
  const chainId = getL1ChainId(config);
32858
32876
  const tokenBalanceResult = tokenBalanceResults.get(chainId);
32859
32877
  const l1provider = readOnlyProviders.get(chainId);
@@ -32871,12 +32889,11 @@ const bridgeRoute = async (config, readOnlyProviders, depositorAddress, availabl
32871
32889
  if (!hasSufficientL1Eth(tokenBalanceResult, bridgeFeeEstimate.totalFees))
32872
32890
  return undefined;
32873
32891
  const l1RepresentationResult = await fetchL1Representation(config, bridgeRequirement.l2address);
32874
- // No mapping on L1 for this token
32875
- const { l1address } = l1RepresentationResult;
32876
- if (l1address === '')
32892
+ if (!l1RepresentationResult)
32877
32893
  return undefined;
32878
32894
  // Ensure l1address is in the allowed token list
32879
- if (l1address === INDEXER_ETH_ROOT_CONTRACT_ADDRESS) {
32895
+ const { l1address } = l1RepresentationResult;
32896
+ if (isNativeToken(l1address)) {
32880
32897
  if (!allowedTokenList.find((token) => !('address' in token)))
32881
32898
  return undefined;
32882
32899
  }
@@ -32886,9 +32903,9 @@ const bridgeRoute = async (config, readOnlyProviders, depositorAddress, availabl
32886
32903
  const gasForApproval = await estimateGasForBridgeApproval(config, readOnlyProviders, l1provider, depositorAddress, l1address, bridgeRequirement.amount);
32887
32904
  let totalFees = bridgeFeeEstimate.bridgeFee.estimatedAmount;
32888
32905
  // If the L1 representation of the requirement is ETH then find the ETH balance and check if the balance covers the delta
32889
- if (l1address === INDEXER_ETH_ROOT_CONTRACT_ADDRESS) {
32906
+ if (isNativeToken(l1address)) {
32890
32907
  const nativeETHBalance = tokenBalanceResult.balances
32891
- .find((balance) => isNativeEth(balance.token.address));
32908
+ .find((balance) => isNativeToken(balance.token.address));
32892
32909
  if (bridgeFeeEstimate.gasFee.estimatedAmount) {
32893
32910
  totalFees = totalFees.add(bridgeFeeEstimate.gasFee.estimatedAmount);
32894
32911
  }
@@ -33044,8 +33061,10 @@ const constructBridgeRequirements = (dexQuotes, l1balances, l2balances, l1tol2ad
33044
33061
  };
33045
33062
 
33046
33063
  const fetchL1ToL2Mappings = async (config, swappableTokens) => {
33047
- const l1tol2addressMappingPromises = swappableTokens.map((token) => fetchL1Representation(config, token.address ?? ''));
33048
- return await Promise.all(l1tol2addressMappingPromises);
33064
+ const l1tol2addressMappingPromises = swappableTokens
33065
+ .map((token) => fetchL1Representation(config, token.address ?? ''));
33066
+ const mappings = await Promise.all(l1tol2addressMappingPromises);
33067
+ return mappings.filter((mapping) => mapping !== undefined);
33049
33068
  };
33050
33069
 
33051
33070
  // Fetch all the dex quotes from the list of swappable tokens
@@ -33085,10 +33104,7 @@ const abortBridgeAndSwap = (bridgeableTokens, swappableTokens, l1balances, l2bal
33085
33104
  const filterSwappableTokensByBridgeableAddresses = (requiredTokenAddress, bridgeableTokens, swappableTokens, l1tol2Addresses) => {
33086
33105
  const filteredSwappableTokens = [];
33087
33106
  for (const addresses of l1tol2Addresses) {
33088
- if (addresses.l1address === '')
33089
- continue;
33090
- if (addresses.l2address === '')
33091
- continue;
33107
+ // TODO: Check for ETH (native) L1 in bridgeableTokens first
33092
33108
  if (!bridgeableTokens.includes(addresses.l1address))
33093
33109
  continue;
33094
33110
  // Filter out the token that is required from the swappable tokens list
@@ -33277,7 +33293,7 @@ const onRampRoute = async (config, availableRoutingOptions, balanceRequirement)
33277
33293
  type: FundingStepType.ONRAMP,
33278
33294
  chainId: getL2ChainId(config),
33279
33295
  fundingItem: {
33280
- type: required.token.address === IMX_ADDRESS_ZKEVM ? ItemType.NATIVE : ItemType.ERC20,
33296
+ type: isNativeToken(required.token.address) ? ItemType.NATIVE : ItemType.ERC20,
33281
33297
  fundsRequired: {
33282
33298
  amount: delta.balance,
33283
33299
  formattedAmount: delta.formattedBalance,
@@ -33513,8 +33529,8 @@ var SignTransactionStatusType;
33513
33529
  const signApprovalTransactions = async (provider, approvalTransactions) => {
33514
33530
  let receipts = [];
33515
33531
  try {
33516
- const response = await Promise.all(approvalTransactions.map((transaction) => provider.getSigner().sendTransaction(transaction)));
33517
- receipts = await Promise.all(response.map((transaction) => transaction.wait()));
33532
+ const response = await Promise.all(approvalTransactions.map((transaction) => sendTransaction(provider, transaction)));
33533
+ receipts = await Promise.all(response.map((transaction) => transaction.transactionResponse.wait()));
33518
33534
  }
33519
33535
  catch (err) {
33520
33536
  throw new CheckoutError('An error occurred while executing the approval transaction', CheckoutErrorType.EXECUTE_APPROVAL_TRANSACTION_ERROR, {
@@ -33537,8 +33553,8 @@ const signApprovalTransactions = async (provider, approvalTransactions) => {
33537
33553
  const signFulfillmentTransactions = async (provider, fulfillmentTransactions) => {
33538
33554
  let receipts = [];
33539
33555
  try {
33540
- const response = await Promise.all(fulfillmentTransactions.map((transaction) => provider.getSigner().sendTransaction(transaction)));
33541
- receipts = await Promise.all(response.map((transaction) => transaction.wait()));
33556
+ const response = await Promise.all(fulfillmentTransactions.map((transaction) => sendTransaction(provider, transaction)));
33557
+ receipts = await Promise.all(response.map((transaction) => transaction.transactionResponse.wait()));
33542
33558
  }
33543
33559
  catch (err) {
33544
33560
  throw new CheckoutError('An error occurred while executing the fulfillment transaction', CheckoutErrorType.EXECUTE_FULFILLMENT_TRANSACTION_ERROR, {
@@ -34114,10 +34130,6 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
34114
34130
  return itemRequirements;
34115
34131
  }
34116
34132
 
34117
- const SDK_VERSION_MARKER = '0.31.3';
34118
- // This SDK version is replaced by the `yarn build` command ran on the root level
34119
- const globalPackageVersion = () => SDK_VERSION_MARKER;
34120
-
34121
34133
  /**
34122
34134
  * Validates and builds a version string based on the given SemanticVersion object.
34123
34135
  * If the version is undefined or has an invalid major version, it returns the default checkout version.
@@ -34470,7 +34482,7 @@ class Checkout {
34470
34482
  }
34471
34483
  }
34472
34484
 
34473
- var checkout_sdk = /*#__PURE__*/Object.freeze({
34485
+ var checkout = /*#__PURE__*/Object.freeze({
34474
34486
  __proto__: null,
34475
34487
  get BridgeEventType () { return BridgeEventType; },
34476
34488
  CHECKOUT_API_BASE_URL: CHECKOUT_API_BASE_URL,
@@ -34505,7 +34517,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
34505
34517
  });
34506
34518
 
34507
34519
  exports.blockchainData = blockchain_data;
34508
- exports.checkoutSdk = checkout_sdk;
34520
+ exports.checkout = checkout;
34509
34521
  exports.config = config;
34510
34522
  exports.immutablexClient = immutablex_client;
34511
34523
  exports.orderbook = orderbook;