@imtbl/sdk 0.1.9-alpha.2 → 0.1.9-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { ActivityType } from '@imtbl/generated-clients/dist/multi-rollup';
1
2
  import globalAxios$1 from 'axios';
2
3
  import { ImmutableX, Config, generateLegacyStarkPrivateKey, createStarkSigner, TransfersApi, OrdersApi as OrdersApi$1, UsersApi, Contracts, TradesApi, ExchangesApi, WithdrawalsApi, MintsApi, DepositsApi, EncodingApi, TokensApi as TokensApi$1 } from '@imtbl/core-sdk';
3
4
  export { createStarkSigner as imxClientCreateStarkSigner, generateLegacyStarkPrivateKey as imxClientGenerateLegacyStarkPrivateKey } from '@imtbl/core-sdk';
@@ -13,11 +14,6 @@ import { Seaport as Seaport$1 } from '@opensea/seaport-js';
13
14
  import { parseUnits } from '@ethersproject/units';
14
15
  import { BigNumber as BigNumber$1 } from '@ethersproject/bignumber';
15
16
  import detectEthereumProvider from '@metamask/detect-provider';
16
- import { BigNumber as BigNumber$2, utils as utils$2 } from 'ethers/lib/ethers';
17
- import { BridgeConfiguration, ETH_MAINNET_TO_ZKEVM_MAINNET, ETH_SEPOLIA_TO_ZKEVM_DEVNET, TokenBridge } from '@imtbl/bridge-sdk';
18
- import { Exchange, ExchangeConfiguration } from '@imtbl/dex-sdk';
19
- import { jsx } from 'react/jsx-runtime';
20
- import { useEffect } from 'react';
21
17
 
22
18
  var Environment;
23
19
  (function (Environment) {
@@ -48,7 +44,7 @@ class ImmutableConfiguration {
48
44
  */
49
45
  // Some imports not used depending on template conditions
50
46
  // @ts-ignore
51
- const BASE_PATH$1 = "https://indexer-mr.dev.imtbl.com".replace(/\/+$/, "");
47
+ const BASE_PATH$1 = "https://indexer-mr.sandbox.imtbl.com".replace(/\/+$/, "");
52
48
  /**
53
49
  *
54
50
  * @export
@@ -2225,7 +2221,7 @@ class APIError extends Error {
2225
2221
 
2226
2222
  /* eslint-disable implicit-arrow-linebreak */
2227
2223
  const defaultHeaders = {
2228
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.1.9-alpha.2',
2224
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.1.9-alpha.4',
2229
2225
  };
2230
2226
  /**
2231
2227
  * createAPIConfiguration to create a custom Configuration
@@ -2243,10 +2239,10 @@ const createAPIConfiguration = ({ basePath, headers: baseHeaders, }) => {
2243
2239
  return new index.Configuration(configParams);
2244
2240
  };
2245
2241
  const production$1 = () => createAPIConfiguration({
2246
- basePath: 'https://indexer-mr.dev.imtbl.com/v1', // TODO update before mainnet release
2242
+ basePath: 'https://indexer-mr.imtbl.com',
2247
2243
  });
2248
2244
  const sandbox$1 = () => createAPIConfiguration({
2249
- basePath: 'https://indexer-mr.dev.imtbl.com/v1', // TODO update before testnet release
2245
+ basePath: 'https://indexer-mr.sandbox.imtbl.com',
2250
2246
  });
2251
2247
  class BlockchainDataConfiguration {
2252
2248
  apiConfig;
@@ -2491,7 +2487,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
2491
2487
  chainID,
2492
2488
  coreContractAddress,
2493
2489
  registrationContractAddress,
2494
- sdkVersion: 'ts-immutable-sdk-0.1.9-alpha.2',
2490
+ sdkVersion: 'ts-immutable-sdk-0.1.9-alpha.4',
2495
2491
  });
2496
2492
  /**
2497
2493
  * Sets `sdkVersion` at the time of build
@@ -10748,1336 +10744,6 @@ class ProviderConfiguration {
10748
10744
  }
10749
10745
  }
10750
10746
 
10751
- function $parcel$interopDefault(a) {
10752
- return a && a.__esModule ? a.default : a;
10753
- }
10754
- /* eslint-disable class-methods-use-this */
10755
- const $762782b6c862d954$export$db5daa1b5156ccfe = [
10756
- {
10757
- constant: true,
10758
- inputs: [],
10759
- name: "name",
10760
- outputs: [
10761
- {
10762
- name: "",
10763
- type: "string"
10764
- }
10765
- ],
10766
- payable: false,
10767
- type: "function"
10768
- },
10769
- {
10770
- constant: true,
10771
- inputs: [],
10772
- name: "decimals",
10773
- outputs: [
10774
- {
10775
- name: "",
10776
- type: "uint8"
10777
- }
10778
- ],
10779
- payable: false,
10780
- type: "function"
10781
- },
10782
- {
10783
- constant: true,
10784
- inputs: [
10785
- {
10786
- name: "_owner",
10787
- type: "address"
10788
- }
10789
- ],
10790
- name: "balanceOf",
10791
- outputs: [
10792
- {
10793
- name: "balance",
10794
- type: "uint256"
10795
- }
10796
- ],
10797
- payable: false,
10798
- type: "function"
10799
- },
10800
- {
10801
- constant: true,
10802
- inputs: [],
10803
- name: "symbol",
10804
- outputs: [
10805
- {
10806
- name: "",
10807
- type: "string"
10808
- }
10809
- ],
10810
- payable: false,
10811
- type: "function"
10812
- }
10813
- ];
10814
-
10815
-
10816
- /**
10817
- * Enum representing the supported chains with their corresponding IDs.
10818
- */ var $baec09ddc3013323$export$c06e1e7429de6283;
10819
- (function(ChainId) {
10820
- ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
10821
- ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13372] = "IMTBL_ZKEVM_TESTNET";
10822
- ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
10823
- ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 13383] = "IMTBL_ZKEVM_DEVNET";
10824
- })($baec09ddc3013323$export$c06e1e7429de6283 || ($baec09ddc3013323$export$c06e1e7429de6283 = {}));
10825
-
10826
-
10827
-
10828
- const $bc2bfebf768286d3$export$6a2ba3c3bd042990 = {
10829
- baseConfig: {
10830
- environment: (Environment).SANDBOX
10831
- }
10832
- };
10833
-
10834
-
10835
-
10836
-
10837
- var $de275b98d2b651c3$export$788b1fd17f3dad84;
10838
- (function(GasEstimateType) {
10839
- GasEstimateType["BRIDGE_TO_L2"] = "BRIDGE_TO_L2";
10840
- GasEstimateType["SWAP"] = "SWAP";
10841
- })($de275b98d2b651c3$export$788b1fd17f3dad84 || ($de275b98d2b651c3$export$788b1fd17f3dad84 = {}));
10842
-
10843
-
10844
-
10845
-
10846
-
10847
-
10848
- const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
10849
- [(Environment).SANDBOX]: "https://checkout-api.dev.immutable.com",
10850
- [(Environment).PRODUCTION]: "https://checkout-api.sandbox.immutable.com"
10851
- };
10852
- const $d85ad1457a3f1a83$export$720c0def10d6df2d = {
10853
- [($baec09ddc3013323$export$c06e1e7429de6283).ETHEREUM]: "/v1/rpc/eth-mainnet",
10854
- [($baec09ddc3013323$export$c06e1e7429de6283).SEPOLIA]: "/v1/rpc/eth-sepolia"
10855
- };
10856
-
10857
-
10858
- const $a47e48dd2c04791b$export$345c852d0dc8f1df = new Map([
10859
- [
10860
- ($baec09ddc3013323$export$c06e1e7429de6283).ETHEREUM,
10861
- `${($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment).PRODUCTION]}${($d85ad1457a3f1a83$export$720c0def10d6df2d)[($baec09ddc3013323$export$c06e1e7429de6283).ETHEREUM]}`
10862
- ],
10863
- [
10864
- ($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET,
10865
- "https://zkevm-rpc.sandbox.x.immutable.com"
10866
- ],
10867
- [
10868
- ($baec09ddc3013323$export$c06e1e7429de6283).SEPOLIA,
10869
- `${($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment).PRODUCTION]}${($d85ad1457a3f1a83$export$720c0def10d6df2d)[($baec09ddc3013323$export$c06e1e7429de6283).SEPOLIA]}`
10870
- ],
10871
- [
10872
- ($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET,
10873
- "https://zkevm-rpc.dev.x.immutable.com"
10874
- ]
10875
- ]);
10876
- const $a47e48dd2c04791b$export$6f24f3cef7d501c4 = new Map([
10877
- [
10878
- ($baec09ddc3013323$export$c06e1e7429de6283).ETHEREUM,
10879
- {
10880
- chainIdHex: "0x1",
10881
- chainName: "Ethereum",
10882
- rpcUrls: [
10883
- $a47e48dd2c04791b$export$345c852d0dc8f1df.get(($baec09ddc3013323$export$c06e1e7429de6283).ETHEREUM)
10884
- ],
10885
- nativeCurrency: {
10886
- name: "Ethereum",
10887
- symbol: "ETH",
10888
- decimals: 18
10889
- },
10890
- blockExplorerUrls: [
10891
- "https://etherscan.io/"
10892
- ]
10893
- }
10894
- ],
10895
- [
10896
- ($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET,
10897
- {
10898
- chainIdHex: "0x343C",
10899
- chainName: "Immutable zkEVM Testnet",
10900
- rpcUrls: [
10901
- $a47e48dd2c04791b$export$345c852d0dc8f1df.get(($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET)
10902
- ],
10903
- nativeCurrency: {
10904
- name: "IMX",
10905
- symbol: "IMX",
10906
- decimals: 18
10907
- }
10908
- }
10909
- ]
10910
- ]);
10911
- const $a47e48dd2c04791b$export$3e81fc0987227f10 = new Map([
10912
- [
10913
- ($baec09ddc3013323$export$c06e1e7429de6283).SEPOLIA,
10914
- {
10915
- chainIdHex: "0xaa36a7",
10916
- chainName: "Sepolia",
10917
- rpcUrls: [
10918
- $a47e48dd2c04791b$export$345c852d0dc8f1df.get(($baec09ddc3013323$export$c06e1e7429de6283).SEPOLIA)
10919
- ],
10920
- nativeCurrency: {
10921
- name: "Sep Eth",
10922
- symbol: "ETH",
10923
- decimals: 18
10924
- },
10925
- blockExplorerUrls: [
10926
- "https://sepolia.etherscan.io/"
10927
- ]
10928
- }
10929
- ],
10930
- [
10931
- ($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET,
10932
- {
10933
- chainIdHex: "0x3447",
10934
- chainName: "Immutable zkEVM Devnet",
10935
- rpcUrls: [
10936
- $a47e48dd2c04791b$export$345c852d0dc8f1df.get(($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET)
10937
- ],
10938
- nativeCurrency: {
10939
- name: "IMX",
10940
- symbol: "IMX",
10941
- decimals: 18
10942
- }
10943
- }
10944
- ]
10945
- ]);
10946
- var $a47e48dd2c04791b$export$1f05a55fe0680cc7;
10947
- (function(NetworkFilterTypes) {
10948
- NetworkFilterTypes["ALL"] = "all";
10949
- })($a47e48dd2c04791b$export$1f05a55fe0680cc7 || ($a47e48dd2c04791b$export$1f05a55fe0680cc7 = {}));
10950
-
10951
-
10952
-
10953
-
10954
- var $08d5ddc39acd6833$export$fd9b17d87f4121d2;
10955
- (function(TokenFilterTypes) {
10956
- TokenFilterTypes["SWAP"] = "swap";
10957
- TokenFilterTypes["BRIDGE"] = "bridge";
10958
- TokenFilterTypes["ALL"] = "all";
10959
- })($08d5ddc39acd6833$export$fd9b17d87f4121d2 || ($08d5ddc39acd6833$export$fd9b17d87f4121d2 = {}));
10960
-
10961
-
10962
- /**
10963
- * Interface representing token information.
10964
- * @property {string} name - The token name.
10965
- * @property {string} symbol - The token symbol.
10966
- * @property {number} decimals - The token decimals.
10967
- * @property {string} [address] - The token contract address.
10968
- * @property {string} [icon] - The token icon URL/data:image.
10969
- */
10970
-
10971
-
10972
-
10973
- var $4f91c5f280efe242$export$35b06f0d33f57e26;
10974
- (function(WalletAction) {
10975
- WalletAction["CHECK_CONNECTION"] = "eth_accounts";
10976
- WalletAction["CONNECT"] = "eth_requestAccounts";
10977
- WalletAction["ADD_NETWORK"] = "wallet_addEthereumChain";
10978
- WalletAction["SWITCH_NETWORK"] = "wallet_switchEthereumChain";
10979
- WalletAction["GET_CHAINID"] = "eth_chainId";
10980
- })($4f91c5f280efe242$export$35b06f0d33f57e26 || ($4f91c5f280efe242$export$35b06f0d33f57e26 = {}));
10981
- var $4f91c5f280efe242$export$a75605c67ea83a5a;
10982
- (function(WalletFilterTypes) {
10983
- WalletFilterTypes["ALL"] = "all";
10984
- WalletFilterTypes["DESKTOP"] = "desktop";
10985
- WalletFilterTypes["MOBILE"] = "mobile";
10986
- })($4f91c5f280efe242$export$a75605c67ea83a5a || ($4f91c5f280efe242$export$a75605c67ea83a5a = {}));
10987
-
10988
-
10989
- var $e768639828688ca3$export$2d7a51a18d87e21d;
10990
- (function(WalletProviderName) {
10991
- WalletProviderName["METAMASK"] = "metamask";
10992
- })($e768639828688ca3$export$2d7a51a18d87e21d || ($e768639828688ca3$export$2d7a51a18d87e21d = {}));
10993
- const $e768639828688ca3$export$44dde05038008549 = {
10994
- allowMistmatchedChainId: false,
10995
- allowUnsupportedProvider: false
10996
- };
10997
-
10998
-
10999
-
11000
-
11001
-
11002
- /**
11003
- * The different types of errors that can be returned by the checkout process.
11004
- */ var $a8bc256d81a5e2c1$export$e3dc0620abde7f5a;
11005
- (function(CheckoutErrorType) {
11006
- CheckoutErrorType["WEB3_PROVIDER_ERROR"] = "WEB3_PROVIDER_ERROR";
11007
- CheckoutErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
11008
- CheckoutErrorType["DEFAULT_PROVIDER_ERROR"] = "DEFAULT_PROVIDER_ERROR";
11009
- CheckoutErrorType["CONNECT_PROVIDER_ERROR"] = "CONNECT_PROVIDER_ERROR";
11010
- CheckoutErrorType["GET_BALANCE_ERROR"] = "GET_BALANCE_ERROR";
11011
- CheckoutErrorType["GET_ERC20_BALANCE_ERROR"] = "GET_ERC20_BALANCE_ERROR";
11012
- CheckoutErrorType["GET_NETWORK_INFO_ERROR"] = "GET_NETWORK_INFO_ERROR";
11013
- CheckoutErrorType["METAMASK_PROVIDER_ERROR"] = "METAMASK_PROVIDER_ERROR";
11014
- CheckoutErrorType["CHAIN_NOT_SUPPORTED_ERROR"] = "CHAIN_NOT_SUPPORTED_ERROR";
11015
- CheckoutErrorType["PROVIDER_REQUEST_MISSING_ERROR"] = "PROVIDER_REQUEST_MISSING_ERROR";
11016
- CheckoutErrorType["PROVIDER_REQUEST_FAILED_ERROR"] = "PROVIDER_REQUEST_FAILED_ERROR";
11017
- CheckoutErrorType["USER_REJECTED_REQUEST_ERROR"] = "USER_REJECTED_REQUEST_ERROR";
11018
- CheckoutErrorType["TRANSACTION_FAILED"] = "TRANSACTION_FAILED";
11019
- CheckoutErrorType["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
11020
- CheckoutErrorType["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
11021
- CheckoutErrorType["INVALID_GAS_ESTIMATE_TYPE"] = "INVALID_GAS_ESTIMATE_TYPE";
11022
- })($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
11023
- class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
11024
- message;
11025
- type;
11026
- data;
11027
- constructor(message, type, data){
11028
- super(message);
11029
- this.message = message;
11030
- this.type = type;
11031
- this.data = data;
11032
- }
11033
- }
11034
- var $a8bc256d81a5e2c1$export$a22d4e0719ee6def;
11035
- (function(CheckoutInternalErrorType) {
11036
- CheckoutInternalErrorType["REJECTED_SWITCH_AFTER_ADDING_NETWORK"] = "REJECTED_SWITCH_AFTER_ADDING_NETWORK";
11037
- })($a8bc256d81a5e2c1$export$a22d4e0719ee6def || ($a8bc256d81a5e2c1$export$a22d4e0719ee6def = {}));
11038
- const $a8bc256d81a5e2c1$export$bacc563de539c6c3 = async (fn, customError)=>{
11039
- try {
11040
- return await fn();
11041
- } catch (error) {
11042
- const cause = `${error.message}` || "UnknownError";
11043
- const errorMessage = customError.message ? `[${customError.type}]:${customError.message}. Cause:${cause}` : `[${customError.type}] Cause:${cause}`;
11044
- if (error instanceof $a8bc256d81a5e2c1$export$b722478a3cbfa3bc) throw new $a8bc256d81a5e2c1$export$b722478a3cbfa3bc(errorMessage, customError.type, {
11045
- ...customError.data,
11046
- innerErrorType: error.type,
11047
- ...error.data
11048
- });
11049
- throw new $a8bc256d81a5e2c1$export$b722478a3cbfa3bc(errorMessage, customError.type, {
11050
- ...customError.data
11051
- });
11052
- }
11053
- };
11054
-
11055
-
11056
-
11057
-
11058
- /* eslint-disable @typescript-eslint/no-explicit-any */
11059
-
11060
-
11061
- // this function needs to be in a separate file to prevent circular dependencies with ./network
11062
-
11063
-
11064
- async function $a1555a1d2c8d059b$export$c3ba3e93a9fee972(web3Provider) {
11065
- if (!web3Provider.provider.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Parsed provider is not a valid Web3Provider", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).WEB3_PROVIDER_ERROR);
11066
- const chainId = await web3Provider.provider.request({
11067
- method: ($4f91c5f280efe242$export$35b06f0d33f57e26).GET_CHAINID,
11068
- params: []
11069
- });
11070
- return parseInt(chainId, 16);
11071
- }
11072
-
11073
-
11074
- const $de192de6ef100f9f$var$UNRECOGNISED_CHAIN_ERROR_CODE = 4902; // error code (MetaMask)
11075
- // these functions should not be exported. These functions should be used as part of an exported function e.g switchWalletNetwork() above.
11076
- // make sure to check if(provider.provider?.request) in the exported function and throw an error
11077
- // eslint-disable-next-line consistent-return
11078
- async function $de192de6ef100f9f$var$switchNetworkInWallet(networkMap, web3Provider, chainId) {
11079
- if (web3Provider.provider?.request) return await web3Provider.provider.request({
11080
- method: ($4f91c5f280efe242$export$35b06f0d33f57e26).SWITCH_NETWORK,
11081
- params: [
11082
- {
11083
- chainId: networkMap.get(chainId)?.chainIdHex
11084
- }
11085
- ]
11086
- });
11087
- }
11088
- // TODO: Should these functions always return something?
11089
- // eslint-disable-next-line consistent-return
11090
- async function $de192de6ef100f9f$var$addNetworkToWallet(networkMap, web3Provider, chainId) {
11091
- if (web3Provider.provider?.request) {
11092
- const networkDetails = networkMap.get(chainId);
11093
- const addNetwork = {
11094
- chainId: networkDetails?.chainIdHex,
11095
- chainName: networkDetails?.chainName,
11096
- rpcUrls: networkDetails?.rpcUrls,
11097
- nativeCurrency: networkDetails?.nativeCurrency,
11098
- blockExplorerUrls: networkDetails?.blockExplorerUrls
11099
- };
11100
- return await web3Provider.provider.request({
11101
- method: ($4f91c5f280efe242$export$35b06f0d33f57e26).ADD_NETWORK,
11102
- params: [
11103
- addNetwork
11104
- ]
11105
- });
11106
- }
11107
- }
11108
- async function $de192de6ef100f9f$export$3043f6442a9ef563(config, { type: type = ($a47e48dd2c04791b$export$1f05a55fe0680cc7).ALL , exclude: exclude }) {
11109
- const { networkMap: networkMap } = config;
11110
- const allowedNetworkConfig = await config.remoteConfigFetcher.get("allowedNetworks");
11111
- const list = allowedNetworkConfig.filter((network)=>{
11112
- const allowAllTokens = type === ($a47e48dd2c04791b$export$1f05a55fe0680cc7).ALL;
11113
- const networkNotExcluded = !(exclude || []).map((exc)=>exc.chainId).includes(network.chainId);
11114
- return allowAllTokens && networkNotExcluded;
11115
- });
11116
- const allowedNetworks = [];
11117
- list.forEach((element)=>{
11118
- const newNetwork = networkMap.get(element.chainId);
11119
- if (newNetwork) allowedNetworks.push({
11120
- name: newNetwork.chainName,
11121
- chainId: parseInt(newNetwork.chainIdHex, 16),
11122
- nativeCurrency: newNetwork.nativeCurrency,
11123
- isSupported: true
11124
- });
11125
- });
11126
- return {
11127
- networks: allowedNetworks
11128
- };
11129
- }
11130
- async function $de192de6ef100f9f$export$79f13b4cfaaf0d09(config, web3Provider) {
11131
- const { networkMap: networkMap } = config;
11132
- return ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
11133
- try {
11134
- const network = await web3Provider.getNetwork();
11135
- if (Array.from(networkMap.keys()).includes(network.chainId)) {
11136
- const chainIdNetworkInfo = networkMap.get(network.chainId);
11137
- return {
11138
- name: chainIdNetworkInfo.chainName,
11139
- chainId: parseInt(chainIdNetworkInfo.chainIdHex, 16),
11140
- nativeCurrency: chainIdNetworkInfo.nativeCurrency,
11141
- isSupported: true
11142
- };
11143
- }
11144
- return {
11145
- chainId: network.chainId,
11146
- name: network.name,
11147
- isSupported: false
11148
- };
11149
- } catch (err) {
11150
- const chainId = await ($a1555a1d2c8d059b$export$c3ba3e93a9fee972)(web3Provider);
11151
- const isSupported = Array.from(networkMap.keys()).includes(chainId);
11152
- return {
11153
- chainId: chainId,
11154
- isSupported: isSupported
11155
- };
11156
- }
11157
- }, {
11158
- type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_NETWORK_INFO_ERROR
11159
- });
11160
- }
11161
- async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, web3Provider, chainId) {
11162
- const { networkMap: networkMap } = config;
11163
- const allowedNetworks = await $de192de6ef100f9f$export$3043f6442a9ef563(config, {
11164
- type: ($a47e48dd2c04791b$export$1f05a55fe0680cc7).ALL
11165
- });
11166
- if (!allowedNetworks.networks.some((network)=>network.chainId === chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
11167
- // WT-1146 - Refer to the README in this folder for explantion on the switch network flow
11168
- try {
11169
- await $de192de6ef100f9f$var$switchNetworkInWallet(networkMap, web3Provider, chainId);
11170
- } catch (err) {
11171
- if (err.code === $de192de6ef100f9f$var$UNRECOGNISED_CHAIN_ERROR_CODE) try {
11172
- await $de192de6ef100f9f$var$addNetworkToWallet(networkMap, web3Provider, chainId);
11173
- // eslint-disable-next-line @typescript-eslint/no-shadow
11174
- } catch (err) {
11175
- throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("User cancelled add network request", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
11176
- }
11177
- else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("User cancelled switch network request", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
11178
- }
11179
- const newProvider = new (Web3Provider)(web3Provider.provider);
11180
- const newProviderNetwork = await newProvider.getNetwork();
11181
- if (newProviderNetwork.chainId !== chainId) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("User cancelled switch network request", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
11182
- const networkInfo = await $de192de6ef100f9f$export$79f13b4cfaaf0d09(config, newProvider);
11183
- return {
11184
- network: networkInfo,
11185
- provider: newProvider
11186
- };
11187
- }
11188
-
11189
-
11190
-
11191
-
11192
-
11193
- var $cda6003506e4182e$exports = {};
11194
- $cda6003506e4182e$exports = JSON.parse("[{\"chainId\":13383,\"name\":\"IMX\",\"symbol\":\"IMX\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"chainId\":13383,\"name\":\"FUN token\",\"address\":\"0xFEa9FF93DC0C6DC73F8Be009Fe7a22Bb9dcE8A2d\",\"symbol\":\"FUN\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"chainId\":13383,\"name\":\"USDC\",\"address\":\"0x5893A5c7bc615Dfd36D7383366d00FFFca5f7178\",\"symbol\":\"USDC\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"chainId\":13383,\"name\":\"WETH\",\"address\":\"0xD6d9321DCC42377C1fa8cFec665182c463b2392C\",\"symbol\":\"WETH\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"chainId\":1,\"name\":\"Ethereum\",\"symbol\":\"ETH\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"address\":\"0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF\",\"chainId\":1,\"name\":\"Immutable X\",\"symbol\":\"IMX\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"chainId\":11155111,\"name\":\"Sep Eth\",\"symbol\":\"ETH\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\"]},{\"chainId\":11155111,\"name\":\"Immutable Test token\",\"address\":\"0xd1da7e9b2Ce1a4024DaD52b3D37F4c5c91a525C1\",\"symbol\":\"TEST\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"chainId\":11155111,\"name\":\"FUN token\",\"address\":\"0x741185AEFC3E539c1F42c1d6eeE8bFf1c89D70FE\",\"symbol\":\"FUN\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"chainId\":11155111,\"name\":\"US Dollar Coin\",\"address\":\"0x1836E16b2036088490C2CFe4d11970Fc8e5884C4\",\"symbol\":\"USDC\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"chainId\":13383,\"name\":\"DEX\",\"address\":\"0x8AC26EfCbf5D700b37A27aA00E6934e6904e7B8e\",\"symbol\":\"DEX\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"chainId\":11155111,\"name\":\"DEX\",\"address\":\"0xaC953a0d7B67Fae17c87abf79f09D0f818AC66A2\",\"symbol\":\"DEX\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"chainId\":1442,\"name\":\"WETH\",\"address\":\"0x4F062A3EAeC3730560aB89b5CE5aC0ab2C5517aE\",\"symbol\":\"WETH\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"address\":\"0x72958b06abdF2701AcE6ceb3cE0B8B1CE11E0851\",\"chainId\":1442,\"name\":\"Immutable X\",\"symbol\":\"IMX\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]}]");
11195
-
11196
-
11197
- const $efe60cea83bfc4e8$var$filterTokenList = ({ type: type , chainId: chainId , exclude: exclude })=>((/*@__PURE__*/$parcel$interopDefault($cda6003506e4182e$exports))).filter((token)=>{
11198
- const skipChainIdCheck = !chainId;
11199
- const chainIdMatches = token.chainId === chainId;
11200
- const tokenNotExcluded = !exclude?.map((excludeToken)=>excludeToken.address).includes(token.address || "");
11201
- const allowAllTokens = type === ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL;
11202
- const tokenAllowedForType = token.tokenFeatures.includes(type);
11203
- return (skipChainIdCheck || chainIdMatches) && tokenNotExcluded && (allowAllTokens || tokenAllowedForType);
11204
- });
11205
- const $efe60cea83bfc4e8$export$473cec51305fdae8 = async ({ type: type = ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL , chainId: chainId , exclude: exclude })=>{
11206
- const filteredTokenList = $efe60cea83bfc4e8$var$filterTokenList({
11207
- type: type,
11208
- chainId: chainId,
11209
- exclude: exclude
11210
- }).map((token)=>({
11211
- name: token.name,
11212
- symbol: token.symbol,
11213
- decimals: token.decimals,
11214
- address: token.address,
11215
- icon: token.icon
11216
- }));
11217
- return {
11218
- tokens: filteredTokenList
11219
- };
11220
- };
11221
-
11222
-
11223
-
11224
-
11225
- const $1564e43dde50bb61$export$df96cd8d56be0ab1 = async (config, web3Provider, walletAddress)=>await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
11226
- const networkInfo = await ($de192de6ef100f9f$export$79f13b4cfaaf0d09)(config, web3Provider);
11227
- if (!networkInfo.isSupported) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${networkInfo.chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR, {
11228
- chainName: networkInfo.name
11229
- });
11230
- const balance = await web3Provider.getBalance(walletAddress);
11231
- return {
11232
- balance: balance,
11233
- formattedBalance: (utils$1).formatUnits(balance, networkInfo.nativeCurrency.decimals),
11234
- token: networkInfo.nativeCurrency
11235
- };
11236
- }, {
11237
- type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_BALANCE_ERROR
11238
- });
11239
- async function $1564e43dde50bb61$export$60e0fe116a0e6ed0(web3Provider, walletAddress, contractAddress) {
11240
- return await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
11241
- const contract = new (Contract)(contractAddress, JSON.stringify(($762782b6c862d954$export$db5daa1b5156ccfe)), web3Provider);
11242
- const name = await contract.name();
11243
- const symbol = await contract.symbol();
11244
- const balance = await contract.balanceOf(walletAddress);
11245
- const decimals = await contract.decimals();
11246
- const formattedBalance = (utils$1).formatUnits(balance, decimals);
11247
- return {
11248
- balance: balance,
11249
- formattedBalance: formattedBalance,
11250
- token: {
11251
- name: name,
11252
- symbol: symbol,
11253
- decimals: decimals,
11254
- address: contractAddress
11255
- }
11256
- };
11257
- }, {
11258
- type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_ERC20_BALANCE_ERROR
11259
- });
11260
- }
11261
- const $1564e43dde50bb61$export$fee49741664a4d7e = async (config, web3Provider, walletAddress, chainId)=>{
11262
- const tokenList = await ($efe60cea83bfc4e8$export$473cec51305fdae8)({
11263
- type: ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL,
11264
- chainId: chainId
11265
- });
11266
- const allBalancePromises = [];
11267
- allBalancePromises.push($1564e43dde50bb61$export$df96cd8d56be0ab1(config, web3Provider, walletAddress));
11268
- tokenList.tokens.filter((token)=>token.address).forEach((token)=>allBalancePromises.push($1564e43dde50bb61$export$60e0fe116a0e6ed0(web3Provider, walletAddress, token.address ?? "")));
11269
- const balanceResults = await Promise.allSettled(allBalancePromises);
11270
- const getBalanceResults = balanceResults.filter((result)=>result.status === "fulfilled").map((fulfilledResult)=>fulfilledResult.value);
11271
- return {
11272
- balances: getBalanceResults
11273
- };
11274
- };
11275
-
11276
-
11277
-
11278
-
11279
-
11280
- /* eslint-disable @typescript-eslint/no-explicit-any */
11281
-
11282
- async function $c99672cf2294e839$export$2d040992269b4717(web3Provider) {
11283
- if (!web3Provider?.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Check wallet connection request failed", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_FAILED_ERROR, {
11284
- rpcMethod: ($4f91c5f280efe242$export$35b06f0d33f57e26).CHECK_CONNECTION
11285
- });
11286
- let accounts = [];
11287
- try {
11288
- accounts = await web3Provider.provider.request({
11289
- method: (0, $4f91c5f280efe242$export$35b06f0d33f57e26).CHECK_CONNECTION,
11290
- params: []
11291
- });
11292
- } catch (err) {
11293
- throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Check wallet connection request failed", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_FAILED_ERROR, {
11294
- rpcMethod: ($4f91c5f280efe242$export$35b06f0d33f57e26).CHECK_CONNECTION
11295
- });
11296
- }
11297
- // accounts[0] will have the active account if connected.
11298
- return {
11299
- isConnected: accounts && accounts.length > 0,
11300
- walletAddress: accounts[0] ?? ""
11301
- };
11302
- }
11303
- async function $c99672cf2294e839$export$43f7168eb392a88c(web3Provider) {
11304
- await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
11305
- if (!web3Provider || !web3Provider?.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Incompatible provider", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR, {
11306
- details: "Attempting to connect with an incompatible provider"
11307
- });
11308
- // this makes the request to the wallet to connect i.e request eth accounts ('eth_requestAccounts')
11309
- await web3Provider.provider.request({
11310
- method: ($4f91c5f280efe242$export$35b06f0d33f57e26).CONNECT,
11311
- params: []
11312
- });
11313
- }, {
11314
- type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR
11315
- });
11316
- return web3Provider;
11317
- }
11318
-
11319
-
11320
-
11321
-
11322
- /* eslint-disable @typescript-eslint/no-explicit-any */
11323
-
11324
-
11325
-
11326
- async function $5c763be0b0b81038$var$getMetaMaskProvider() {
11327
- const provider = await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>await (detectEthereumProvider)(), {
11328
- type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).METAMASK_PROVIDER_ERROR
11329
- });
11330
- if (!provider || !provider.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No MetaMask provider installed.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).METAMASK_PROVIDER_ERROR);
11331
- return new (Web3Provider)(provider);
11332
- }
11333
- async function $5c763be0b0b81038$export$500fbc0cd14cdbaa(defaultProvider) {
11334
- let web3Provider = null;
11335
- switch(defaultProvider){
11336
- case ($e768639828688ca3$export$2d7a51a18d87e21d).METAMASK:
11337
- web3Provider = await $5c763be0b0b81038$var$getMetaMaskProvider();
11338
- break;
11339
- default:
11340
- throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Provider not supported", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).DEFAULT_PROVIDER_ERROR);
11341
- }
11342
- return web3Provider;
11343
- }
11344
-
11345
-
11346
- // this function needs to be in a separate file to prevent circular dependencies with ./network
11347
-
11348
-
11349
-
11350
-
11351
-
11352
- function $bb88265fe45a0393$export$ebe4804963e71f98(web3Provider) {
11353
- if (web3Provider && web3Provider instanceof (Web3Provider) && web3Provider.provider?.request) return true;
11354
- return false;
11355
- }
11356
- async function $bb88265fe45a0393$export$9e1fd9cc88c637a0(config, web3Provider, validateProviderOptions) {
11357
- return ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
11358
- if (!$bb88265fe45a0393$export$ebe4804963e71f98(web3Provider)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Parsed provider is not a valid Web3Provider", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).WEB3_PROVIDER_ERROR);
11359
- // this sets the default options and overrides them with any parsed options
11360
- const options = {
11361
- ...($e768639828688ca3$export$44dde05038008549),
11362
- ...validateProviderOptions
11363
- };
11364
- const underlyingChainId = await ($a1555a1d2c8d059b$export$c3ba3e93a9fee972)(web3Provider);
11365
- let web3ChainId = web3Provider.network?.chainId;
11366
- try {
11367
- web3ChainId = web3Provider.network?.chainId;
11368
- if (!web3ChainId) web3ChainId = (await web3Provider.getNetwork()).chainId;
11369
- } catch (err) {
11370
- throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Unable to detect the web3Provider network", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).WEB3_PROVIDER_ERROR);
11371
- }
11372
- if (web3ChainId !== underlyingChainId && !options.allowMistmatchedChainId) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Your wallet has changed network, please switch to a supported network", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).WEB3_PROVIDER_ERROR);
11373
- const allowedNetworks = await ($de192de6ef100f9f$export$3043f6442a9ef563)(config, {
11374
- type: ($a47e48dd2c04791b$export$1f05a55fe0680cc7).ALL
11375
- });
11376
- const isAllowed = allowedNetworks.networks.some((network)=>network.chainId === underlyingChainId);
11377
- if (!isAllowed && !options.allowUnsupportedProvider) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Your wallet is connected to an unsupported network, please switch to a supported network", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).WEB3_PROVIDER_ERROR);
11378
- return web3Provider;
11379
- }, {
11380
- type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).WEB3_PROVIDER_ERROR
11381
- });
11382
- }
11383
-
11384
-
11385
-
11386
-
11387
-
11388
- var $6f3c55a615003cbf$exports = {};
11389
- $6f3c55a615003cbf$exports = JSON.parse('[{"walletProvider":"metamask","icon":"some-icon-url","name":"MetaMask","description":"complete web3 wallet solution","platform":["desktop"]},{"walletProvider":"passport","icon":"pp-icon","name":"Passport","description":"Web3 with your email!","platform":["mobile","desktop"]},{"walletProvider":"gamestop","icon":"gme-icon","name":"GameStop","description":"Never stopping the game!","platform":["mobile"]}]');
11390
-
11391
-
11392
- async function $5cdde2ffe6360fec$export$a822caa90d7eef09({ type: type = ($4f91c5f280efe242$export$a75605c67ea83a5a).ALL , exclude: exclude }) {
11393
- // todo:For async API call, use the CheckoutError with errorType:API_CALL_ERROR?? or any other
11394
- const filteredWalletsList = ((/*@__PURE__*/$parcel$interopDefault($6f3c55a615003cbf$exports))).filter((wallet)=>{
11395
- const walletNotExcluded = !exclude?.map((excludeWallet)=>excludeWallet.walletProvider).includes(wallet.walletProvider);
11396
- const allowAllWallets = type === ($4f91c5f280efe242$export$a75605c67ea83a5a).ALL;
11397
- const walletsAllowedForType = wallet.platform.includes(type);
11398
- return walletNotExcluded && (allowAllWallets || walletsAllowedForType);
11399
- }).map((wallet)=>{
11400
- const { platform: platform , ...walletInfo } = wallet;
11401
- return walletInfo;
11402
- });
11403
- return {
11404
- wallets: filteredWalletsList
11405
- };
11406
- }
11407
-
11408
-
11409
-
11410
-
11411
-
11412
-
11413
-
11414
- const $dbe95599a4661140$export$8e0e7ffc78696d30 = async (web3Provider, transaction)=>{
11415
- try {
11416
- const transactionResponse = await web3Provider.getSigner().sendTransaction(transaction);
11417
- return {
11418
- transactionResponse: transactionResponse
11419
- };
11420
- } catch (err) {
11421
- if (err.code === (ethers).errors.INSUFFICIENT_FUNDS) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).INSUFFICIENT_FUNDS);
11422
- if (err.code === (ethers).errors.ACTION_REJECTED) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
11423
- if (err.code === (ethers).errors.UNPREDICTABLE_GAS_LIMIT) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNPREDICTABLE_GAS_LIMIT);
11424
- throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).TRANSACTION_FAILED);
11425
- }
11426
- };
11427
-
11428
-
11429
-
11430
-
11431
-
11432
-
11433
-
11434
-
11435
-
11436
-
11437
-
11438
- const $570856c68db0bd36$var$GAS_LIMIT = 140000;
11439
- async function $570856c68db0bd36$var$getTokenInfoByAddress(tokenAddress, chainId) {
11440
- return (await $efe60cea83bfc4e8$export$473cec51305fdae8({
11441
- type: ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL,
11442
- chainId: chainId
11443
- })).tokens.find((token)=>(token.address || "NATIVE") === tokenAddress);
11444
- }
11445
- const $570856c68db0bd36$var$doesChainSupportEIP1559 = (feeData)=>!!feeData.maxFeePerGas && !!feeData.maxPriorityFeePerGas;
11446
- const $570856c68db0bd36$var$getGasPriceInWei = (feeData)=>$570856c68db0bd36$var$doesChainSupportEIP1559(feeData) ? (BigNumber).from(feeData.maxFeePerGas).add((BigNumber).from(feeData.maxPriorityFeePerGas)) : feeData.gasPrice && (BigNumber).from(feeData.gasPrice);
11447
- const $570856c68db0bd36$var$getGasEstimates = async (provider)=>{
11448
- const txnGasLimitInWei = $570856c68db0bd36$var$GAS_LIMIT; // todo: fetch gasLimit from bridgeSDK when they add new fn
11449
- const feeData = await provider.getFeeData();
11450
- const gasPriceInWei = $570856c68db0bd36$var$getGasPriceInWei(feeData);
11451
- if (!gasPriceInWei) return undefined;
11452
- return gasPriceInWei.mul(txnGasLimitInWei);
11453
- };
11454
- async function $570856c68db0bd36$export$51010590edbe56a6(provider, chainId, isApproveTxnRequired, gasTokenAddress) {
11455
- const token = await $570856c68db0bd36$var$getTokenInfoByAddress(gasTokenAddress || "NATIVE", chainId);
11456
- let estimatedAmount = await $570856c68db0bd36$var$getGasEstimates(provider);
11457
- if (!estimatedAmount) return {
11458
- estimatedAmount: undefined,
11459
- token: token
11460
- };
11461
- if (isApproveTxnRequired) estimatedAmount = estimatedAmount.add(estimatedAmount);
11462
- const result = {
11463
- estimatedAmount: estimatedAmount,
11464
- token: token
11465
- };
11466
- return result;
11467
- }
11468
- async function $570856c68db0bd36$export$9e73e22953cebcfc(tokenBridge, tokenAddress, destinationChainId) {
11469
- const bridgeFeeReq = {
11470
- token: tokenAddress
11471
- };
11472
- const bridgeFeeResponse = await tokenBridge.getFee(bridgeFeeReq);
11473
- const tokenInfo = await $570856c68db0bd36$var$getTokenInfoByAddress(tokenAddress, destinationChainId);
11474
- return {
11475
- bridgeFee: {
11476
- estimatedAmount: bridgeFeeResponse.feeAmount,
11477
- token: tokenInfo
11478
- },
11479
- bridgeable: bridgeFeeResponse.bridgeable
11480
- };
11481
- }
11482
-
11483
-
11484
-
11485
-
11486
-
11487
-
11488
- async function $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, environment) {
11489
- const rootChainProvider = readOnlyProviders.get(fromChainId);
11490
- const childChainProvider = readOnlyProviders.get(toChainId);
11491
- if (!rootChainProvider) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${fromChainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
11492
- if (!childChainProvider) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${toChainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
11493
- const bridgeConfig = new (BridgeConfiguration)({
11494
- baseConfig: new (ImmutableConfiguration)({
11495
- environment: environment
11496
- }),
11497
- bridgeInstance: environment === (Environment).PRODUCTION ? (ETH_MAINNET_TO_ZKEVM_MAINNET) : (ETH_SEPOLIA_TO_ZKEVM_DEVNET),
11498
- rootProvider: rootChainProvider,
11499
- childProvider: childChainProvider
11500
- });
11501
- return new (TokenBridge)(bridgeConfig);
11502
- }
11503
- async function $67fc622a2b913d5f$export$7cf6178417769841(chainId, config) {
11504
- const dexConfig = await config.remoteConfigFetcher.get("dex");
11505
- return new (Exchange)(new (ExchangeConfiguration)({
11506
- chainId: chainId,
11507
- baseConfig: new (ImmutableConfiguration)({
11508
- environment: config.environment
11509
- }),
11510
- overrides: dexConfig?.overrides
11511
- }));
11512
- }
11513
-
11514
-
11515
-
11516
-
11517
- const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000000";
11518
- const $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS = 18;
11519
- const $2e7bf45a7c9a9570$var$getL1ChainId = (environment)=>{
11520
- if (environment === (Environment).PRODUCTION) return ($baec09ddc3013323$export$c06e1e7429de6283).SEPOLIA;
11521
- return ($baec09ddc3013323$export$c06e1e7429de6283).SEPOLIA;
11522
- };
11523
- const $2e7bf45a7c9a9570$var$getL2ChainId = (environment)=>{
11524
- if (environment === (Environment).PRODUCTION) return ($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET;
11525
- return ($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET;
11526
- };
11527
- async function $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired, tokenAddress) {
11528
- const fromChainId = $2e7bf45a7c9a9570$var$getL1ChainId(config.environment);
11529
- const toChainId = $2e7bf45a7c9a9570$var$getL2ChainId(config.environment);
11530
- const gasEstimateTokensConfig = await config.remoteConfigFetcher.get("gasEstimateTokens");
11531
- const { gasTokenAddress: gasTokenAddress , fromAddress: fromAddress } = gasEstimateTokensConfig[fromChainId.toString()].bridgeToL2Addresses;
11532
- const provider = readOnlyProviders.get(fromChainId);
11533
- try {
11534
- const { estimatedAmount: estimatedAmount , token: token } = await (0, $570856c68db0bd36$export$51010590edbe56a6)(provider, fromChainId, isSpendingCapApprovalRequired, tokenAddress ?? gasTokenAddress);
11535
- const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config.environment);
11536
- const { bridgeFee: bridgeFee , bridgeable: bridgeable } = await (0, $570856c68db0bd36$export$9e73e22953cebcfc)(tokenBridge, fromAddress, toChainId);
11537
- return {
11538
- gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2,
11539
- gasFee: {
11540
- estimatedAmount: estimatedAmount,
11541
- token: token
11542
- },
11543
- bridgeFee: {
11544
- estimatedAmount: bridgeFee?.estimatedAmount,
11545
- token: bridgeFee?.token
11546
- },
11547
- bridgeable: bridgeable
11548
- };
11549
- } catch {
11550
- // In the case of an error, just return an empty gas & bridge fee estimate
11551
- return {
11552
- gasEstimateType: ($de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2,
11553
- gasFee: {},
11554
- bridgeFee: {},
11555
- bridgeable: false
11556
- };
11557
- }
11558
- }
11559
- async function $2e7bf45a7c9a9570$var$swapGasEstimator(config) {
11560
- const chainId = $2e7bf45a7c9a9570$var$getL2ChainId(config.environment);
11561
- const gasEstimateTokensConfig = await config.remoteConfigFetcher.get("gasEstimateTokens");
11562
- const { inAddress: inAddress , outAddress: outAddress } = gasEstimateTokensConfig[chainId].swapAddresses;
11563
- try {
11564
- const exchange = await $67fc622a2b913d5f$export$7cf6178417769841(chainId, config);
11565
- // Create a fake transaction to get the gas from the quote
11566
- const { info: info } = await exchange.getUnsignedSwapTxFromAmountIn($2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS, inAddress, outAddress, (0, BigNumber$2).from((0, utils$2).parseUnits("1", $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS)));
11567
- if (info.gasFeeEstimate === null) return {
11568
- gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).SWAP,
11569
- gasFee: {}
11570
- };
11571
- let estimatedAmount;
11572
- if (info.gasFeeEstimate.amount) estimatedAmount = (0, BigNumber$2).from(info.gasFeeEstimate.amount);
11573
- return {
11574
- gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).SWAP,
11575
- gasFee: {
11576
- estimatedAmount: estimatedAmount,
11577
- token: {
11578
- address: info.gasFeeEstimate?.token.address,
11579
- symbol: info.gasFeeEstimate?.token.symbol ?? "",
11580
- name: info.gasFeeEstimate?.token.name ?? "",
11581
- decimals: info.gasFeeEstimate?.token.decimals ?? $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS
11582
- }
11583
- }
11584
- };
11585
- } catch {
11586
- // In the case of an error, just return an empty gas fee estimate
11587
- return {
11588
- gasEstimateType: ($de275b98d2b651c3$export$788b1fd17f3dad84).SWAP,
11589
- gasFee: {}
11590
- };
11591
- }
11592
- }
11593
- async function $2e7bf45a7c9a9570$export$942c8de7174809fc(params, readOnlyProviders, config) {
11594
- switch(params.gasEstimateType){
11595
- case ($de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2:
11596
- return await $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired, params.tokenAddress);
11597
- case ($de275b98d2b651c3$export$788b1fd17f3dad84).SWAP:
11598
- return await $2e7bf45a7c9a9570$var$swapGasEstimator(config);
11599
- default:
11600
- throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Invalid type provided for gasEstimateType", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).INVALID_GAS_ESTIMATE_TYPE);
11601
- }
11602
- }
11603
-
11604
-
11605
-
11606
-
11607
-
11608
-
11609
-
11610
-
11611
-
11612
-
11613
- class $a492ee374ae7b613$export$d902b56530cd5f87 {
11614
- cache;
11615
- environment;
11616
- constructor(params){
11617
- this.environment = params.environment;
11618
- }
11619
- async load() {
11620
- if (this.cache) return this.cache;
11621
- let response;
11622
- try {
11623
- response = await (0, globalAxios$1).get(`${(0, $d85ad1457a3f1a83$export$161d4a74df65fc08)[this.environment]}/v1/config`);
11624
- } catch (error) {
11625
- throw new Error(`Error fetching config: ${error.message}`);
11626
- }
11627
- if (response.status !== 200) throw new Error(`Error fetching config: ${response.status} ${response.statusText}`);
11628
- this.cache = response.data;
11629
- return this.cache;
11630
- }
11631
- async get(key) {
11632
- const config = await this.load();
11633
- if (config && key) return config[key];
11634
- return config;
11635
- }
11636
- }
11637
-
11638
-
11639
- class $4013c5c91bb535f6$export$6ad73ea7e1b6f37f extends Error {
11640
- message;
11641
- constructor(message){
11642
- super(message);
11643
- this.message = message;
11644
- }
11645
- }
11646
- class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
11647
- environment;
11648
- networkMap;
11649
- remoteConfigFetcher;
11650
- constructor(config){
11651
- // validate input
11652
- if (!Object.values((Environment)).includes(config.baseConfig.environment)) throw new $4013c5c91bb535f6$export$6ad73ea7e1b6f37f("Invalid checkout configuration of environment");
11653
- this.environment = config.baseConfig.environment;
11654
- this.networkMap = config.baseConfig.environment === (Environment).PRODUCTION ? ($a47e48dd2c04791b$export$6f24f3cef7d501c4) : ($a47e48dd2c04791b$export$3e81fc0987227f10);
11655
- this.remoteConfigFetcher = new ($a492ee374ae7b613$export$d902b56530cd5f87)({
11656
- environment: config.baseConfig.environment
11657
- });
11658
- }
11659
- }
11660
-
11661
-
11662
-
11663
-
11664
-
11665
-
11666
-
11667
-
11668
- async function $0e0060cb42e136d2$export$339cb2be73677b30(config, existingReadOnlyProviders) {
11669
- if (config.environment === (Environment).PRODUCTION && existingReadOnlyProviders?.has(($baec09ddc3013323$export$c06e1e7429de6283).ETHEREUM) || config.environment === (Environment).SANDBOX && existingReadOnlyProviders?.has(($baec09ddc3013323$export$c06e1e7429de6283).SEPOLIA)) return existingReadOnlyProviders;
11670
- const readOnlyProviders = new Map();
11671
- const allowedNetworks = await $de192de6ef100f9f$export$3043f6442a9ef563(config, {
11672
- type: ($a47e48dd2c04791b$export$1f05a55fe0680cc7).ALL
11673
- });
11674
- allowedNetworks.networks.forEach((networkInfo)=>{
11675
- const rpcUrl = config.networkMap.get(networkInfo.chainId)?.rpcUrls[0];
11676
- const provider = new (ethers).providers.JsonRpcProvider(rpcUrl);
11677
- readOnlyProviders.set(networkInfo.chainId, provider);
11678
- });
11679
- return readOnlyProviders;
11680
- }
11681
-
11682
-
11683
- class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
11684
- config;
11685
- readOnlyProviders;
11686
- constructor(config = ($bc2bfebf768286d3$export$6a2ba3c3bd042990)){
11687
- this.config = new ($4013c5c91bb535f6$export$4823433c4a67bbc6)(config);
11688
- this.readOnlyProviders = new Map();
11689
- }
11690
- /**
11691
- * Create a provider object which can be used within the Checkout class methods.
11692
- * @param {CreateProviderParams} params The data required to create a provider
11693
- * @returns A new provider object
11694
- * @throws {@link ErrorType}
11695
- */ async createProvider(params) {
11696
- const web3Provider = await $5c763be0b0b81038$export$500fbc0cd14cdbaa(params.walletProvider);
11697
- return {
11698
- provider: web3Provider
11699
- };
11700
- }
11701
- /**
11702
- * Check if a wallet is connected to the current application
11703
- * without requesting permission from the wallet and hence triggering a connect popup.
11704
- * @param {CheckConnectionParams} params - The necessary data required to verify a wallet connection status.
11705
- * @returns Wallet connection status details.
11706
- * @throws {@link ErrorType}
11707
- */ async checkIsWalletConnected(params) {
11708
- const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider, {
11709
- allowUnsupportedProvider: true
11710
- });
11711
- return $c99672cf2294e839$export$2d040992269b4717(web3Provider);
11712
- }
11713
- /**
11714
- * Establish a connection with a wallet provider such as MetaMask and returns the provider object and the current network details.
11715
- * @param {ConnectParams} params - The necessary data required to establish a connection with a wallet provider.
11716
- * @returns Wallet provider and current network information.
11717
- * @throws {@link ErrorType}
11718
- */ async connect(params) {
11719
- const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider, {
11720
- allowUnsupportedProvider: true
11721
- });
11722
- await $c99672cf2294e839$export$43f7168eb392a88c(web3Provider);
11723
- const networkInfo = await $de192de6ef100f9f$export$79f13b4cfaaf0d09(this.config, web3Provider);
11724
- return {
11725
- provider: web3Provider,
11726
- network: networkInfo
11727
- };
11728
- }
11729
- /**
11730
- * Switch the currently connected wallet to a new network.
11731
- * @param {SwitchNetworkParams} params - The necessary data required to switch network.
11732
- * @returns The new network information.
11733
- * @throws {@link ErrorType}
11734
- */ async switchNetwork(params) {
11735
- const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider, {
11736
- allowUnsupportedProvider: true,
11737
- allowMistmatchedChainId: true
11738
- });
11739
- const switchNetworkRes = await $de192de6ef100f9f$export$b827d9418aeb5dbd(this.config, web3Provider, params.chainId);
11740
- return switchNetworkRes;
11741
- }
11742
- /**
11743
- * Fetch the balance of the native token of the current connected network or,
11744
- * if a contract address is provided, it will return the balance of that ERC20 token. For example,
11745
- * if the wallet is connected to the Ethereum Mainnet then the function gets the wallet ETH L1 balance.
11746
- * @param {GetBalanceParams} params - The necessary data required to fetch the wallet balance.
11747
- * @returns Native token balance for the given wallet.
11748
- * @throws {@link ErrorType}
11749
- */ async getBalance(params) {
11750
- const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
11751
- if (!params.contractAddress || params.contractAddress === "") return await $1564e43dde50bb61$export$df96cd8d56be0ab1(this.config, web3Provider, params.walletAddress);
11752
- return await $1564e43dde50bb61$export$60e0fe116a0e6ed0(web3Provider, params.walletAddress, params.contractAddress);
11753
- }
11754
- /**
11755
- * Fetch all available balances (ERC20 & Native) of the current connected network of the given wallet.
11756
- * It will loop through the list of allowed tokens and check for balance on each one.
11757
- * @param {GetAllBalancesParams} params - The necessary data required to fetch all the wallet balances.
11758
- * @returns List of tokens balance for the given wallet.
11759
- * @throws {@link ErrorType}
11760
- */ async getAllBalances(params) {
11761
- const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
11762
- return $1564e43dde50bb61$export$fee49741664a4d7e(this.config, web3Provider, params.walletAddress, params.chainId);
11763
- }
11764
- /**
11765
- * Fetch the list of available networks that a wallet can add or/and switch to.
11766
- * @param {GetNetworkAllowListParams} params - The necessary data required to fetch the list of available networks.
11767
- * @returns List of networks.
11768
- * @throws {@link ErrorType}
11769
- */ async getNetworkAllowList(params) {
11770
- return await $de192de6ef100f9f$export$3043f6442a9ef563(this.config, params);
11771
- }
11772
- /**
11773
- * Get the list of tokens which are allowed to be used with the product.
11774
- * @param {GetTokenAllowListParams} params - The necessary data required to fetch the list of allowed tokens.
11775
- * @returns List of allowed tokens.
11776
- * @throws {@link ErrorType}
11777
- */ async getTokenAllowList(params) {
11778
- return await $efe60cea83bfc4e8$export$473cec51305fdae8(params);
11779
- }
11780
- /**
11781
- * Fetch the list of wallets which are available to connect with.
11782
- * @param {GetWalletAllowListParams} params - The necessary data required to fetch the list of allowed wallets.
11783
- * @returns List of allowed wallets.
11784
- * @throws {@link ErrorType}
11785
- */ async getWalletAllowList(params) {
11786
- return await $5cdde2ffe6360fec$export$a822caa90d7eef09(params);
11787
- }
11788
- /**
11789
- * Send a generic transaction to the provider.
11790
- * @param {SendTransactionParams} params - The necessary data required to send a transaction.
11791
- * @returns Transaction response.
11792
- * @throws {@link ErrorType}
11793
- * @remarks
11794
- * Further documenation can be found at [MetaMask | Sending Transactions](https://docs.metamask.io/guide/sending-transactions.html).
11795
- */ async sendTransaction(params) {
11796
- const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider);
11797
- return await $dbe95599a4661140$export$8e0e7ffc78696d30(web3Provider, params.transaction);
11798
- }
11799
- /**
11800
- * Get network information about the currently selected network.
11801
- * @param {GetNetworkParams} params - The necessary data required to get the current network information.
11802
- * @returns Network details.
11803
- * @throws {@link ErrorType}
11804
- */ async getNetworkInfo(params) {
11805
- const web3Provider = await $bb88265fe45a0393$export$9e1fd9cc88c637a0(this.config, params.provider, {
11806
- allowUnsupportedProvider: true,
11807
- allowMistmatchedChainId: true
11808
- });
11809
- return await $de192de6ef100f9f$export$79f13b4cfaaf0d09(this.config, web3Provider);
11810
- }
11811
- static isWeb3Provider(web3Provider) {
11812
- return $bb88265fe45a0393$export$ebe4804963e71f98(web3Provider);
11813
- }
11814
- /**
11815
- * Estimates the gas to perform an action.
11816
- * @param {GasEstimateParams} params - The params required to calculate a gas estimate
11817
- * @returns The gas estimate for the given action.
11818
- */ async gasEstimate(params) {
11819
- this.readOnlyProviders = await ($0e0060cb42e136d2$export$339cb2be73677b30)(this.config, this.readOnlyProviders);
11820
- return await $2e7bf45a7c9a9570$export$942c8de7174809fc(params, this.readOnlyProviders, this.config);
11821
- }
11822
- }
11823
-
11824
- function $parcel$export(e, n, v, s) {
11825
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
11826
- }
11827
- // Definitions | Events
11828
- var $207ed853f11d19d5$exports = {};
11829
-
11830
- $parcel$export($207ed853f11d19d5$exports, "IMTBLWidgetEvents", () => $207ed853f11d19d5$export$5a0ace85cae72d45);
11831
- var $207ed853f11d19d5$export$5a0ace85cae72d45;
11832
- (function(IMTBLWidgetEvents) {
11833
- IMTBLWidgetEvents["IMTBL_CONNECT_WIDGET_EVENT"] = "imtbl-connect-widget";
11834
- IMTBLWidgetEvents["IMTBL_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
11835
- IMTBLWidgetEvents["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
11836
- IMTBLWidgetEvents["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
11837
- })($207ed853f11d19d5$export$5a0ace85cae72d45 || ($207ed853f11d19d5$export$5a0ace85cae72d45 = {}));
11838
-
11839
-
11840
- var $a85ecdbd885c58ad$exports = {};
11841
-
11842
- $parcel$export($a85ecdbd885c58ad$exports, "ConnectEventType", () => $a85ecdbd885c58ad$export$e72e7f9969a47dd3);
11843
- var $a85ecdbd885c58ad$export$e72e7f9969a47dd3;
11844
- (function(ConnectEventType) {
11845
- ConnectEventType["CLOSE_WIDGET"] = "close-widget";
11846
- ConnectEventType["SUCCESS"] = "success";
11847
- ConnectEventType["FAILURE"] = "failure";
11848
- })($a85ecdbd885c58ad$export$e72e7f9969a47dd3 || ($a85ecdbd885c58ad$export$e72e7f9969a47dd3 = {}));
11849
-
11850
-
11851
- var $77b6aac5c353d4a9$exports = {};
11852
-
11853
- $parcel$export($77b6aac5c353d4a9$exports, "WalletEventType", () => $77b6aac5c353d4a9$export$d9be06b70b28c742);
11854
- var $77b6aac5c353d4a9$export$d9be06b70b28c742;
11855
- (function(WalletEventType) {
11856
- WalletEventType["CLOSE_WIDGET"] = "close-widget";
11857
- WalletEventType["NETWORK_SWITCH"] = "network-switch";
11858
- WalletEventType["DISCONNECT_WALLET"] = "disconnect-wallet";
11859
- })($77b6aac5c353d4a9$export$d9be06b70b28c742 || ($77b6aac5c353d4a9$export$d9be06b70b28c742 = {}));
11860
-
11861
-
11862
- var $53d219e7f6bf0cd6$exports = {};
11863
-
11864
- $parcel$export($53d219e7f6bf0cd6$exports, "SwapEventType", () => $53d219e7f6bf0cd6$export$140a49745ab55563);
11865
- /**
11866
- * Enum representing possible Swap Widget event types.
11867
- */ var $53d219e7f6bf0cd6$export$140a49745ab55563;
11868
- (function(SwapEventType) {
11869
- SwapEventType["CLOSE_WIDGET"] = "close-widget";
11870
- SwapEventType["SUCCESS"] = "success";
11871
- SwapEventType["FAILURE"] = "failure";
11872
- SwapEventType["REJECTED"] = "rejected";
11873
- })($53d219e7f6bf0cd6$export$140a49745ab55563 || ($53d219e7f6bf0cd6$export$140a49745ab55563 = {}));
11874
-
11875
-
11876
- var $15cc9e120aa6f3bf$exports = {};
11877
-
11878
- $parcel$export($15cc9e120aa6f3bf$exports, "BridgeEventType", () => $15cc9e120aa6f3bf$export$d1bfa21f7c76447a);
11879
- /**
11880
- * Enum of possible Bridge Widget event types.
11881
- */ var $15cc9e120aa6f3bf$export$d1bfa21f7c76447a;
11882
- (function(BridgeEventType) {
11883
- BridgeEventType["CLOSE_WIDGET"] = "close-widget";
11884
- BridgeEventType["SUCCESS"] = "success";
11885
- BridgeEventType["FAILURE"] = "failure";
11886
- })($15cc9e120aa6f3bf$export$d1bfa21f7c76447a || ($15cc9e120aa6f3bf$export$d1bfa21f7c76447a = {}));
11887
-
11888
-
11889
- var $ad06b030b1a3ba34$exports = {};
11890
-
11891
- $parcel$export($ad06b030b1a3ba34$exports, "OrchestrationEventType", () => $ad06b030b1a3ba34$export$b80d2daf830437b9);
11892
- var $ad06b030b1a3ba34$export$b80d2daf830437b9;
11893
- (function(OrchestrationEventType) {
11894
- OrchestrationEventType["REQUEST_CONNECT"] = "request-connect";
11895
- OrchestrationEventType["REQUEST_WALLET"] = "request-wallet";
11896
- OrchestrationEventType["REQUEST_SWAP"] = "request-swap";
11897
- OrchestrationEventType["REQUEST_BRIDGE"] = "request-bridge";
11898
- OrchestrationEventType["REQUEST_ONRAMP"] = "request-onramp";
11899
- })($ad06b030b1a3ba34$export$b80d2daf830437b9 || ($ad06b030b1a3ba34$export$b80d2daf830437b9 = {}));
11900
- /* eslint-disable @typescript-eslint/naming-convention */
11901
-
11902
- var $045213b18e9f1f94$exports = {};
11903
-
11904
- $parcel$export($045213b18e9f1f94$exports, "Network", () => $045213b18e9f1f94$export$95be4ae94445245a);
11905
- $parcel$export($045213b18e9f1f94$exports, "WidgetTheme", () => $045213b18e9f1f94$export$c88931fdc51854eb);
11906
- $parcel$export($045213b18e9f1f94$exports, "CheckoutWidgetTagNames", () => $045213b18e9f1f94$export$75be0f6af9650f2c);
11907
- /**
11908
- * Enum representing the networks supported by Checkout.
11909
- */ var $045213b18e9f1f94$export$95be4ae94445245a;
11910
- (function(Network) {
11911
- Network["ETHEREUM"] = "Ethereum";
11912
- Network["SEPOLIA"] = "Sepolia";
11913
- Network["IMTBL_ZKEVM_TESTNET"] = "Immutable zkEVM Testnet";
11914
- Network["IMTBL_ZKEVM_DEVNET"] = "Immutable zkEVM Devnet";
11915
- })($045213b18e9f1f94$export$95be4ae94445245a || ($045213b18e9f1f94$export$95be4ae94445245a = {}));
11916
- var $045213b18e9f1f94$export$c88931fdc51854eb;
11917
- (function(WidgetTheme) {
11918
- WidgetTheme["LIGHT"] = "light";
11919
- WidgetTheme["DARK"] = "dark";
11920
- WidgetTheme["CUSTOM"] = "custom";
11921
- })($045213b18e9f1f94$export$c88931fdc51854eb || ($045213b18e9f1f94$export$c88931fdc51854eb = {}));
11922
- var $045213b18e9f1f94$export$75be0f6af9650f2c;
11923
- (function(CheckoutWidgetTagNames) {
11924
- CheckoutWidgetTagNames["CONNECT"] = "imtbl-connect";
11925
- CheckoutWidgetTagNames["WALLET"] = "imtbl-wallet";
11926
- CheckoutWidgetTagNames["SWAP"] = "imtbl-swap";
11927
- CheckoutWidgetTagNames["BRIDGE"] = "imtbl-bridge";
11928
- })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
11929
-
11930
-
11931
- var $1f969328e5988c99$exports = {};
11932
-
11933
- $parcel$export($1f969328e5988c99$exports, "BridgeReact", () => $1f969328e5988c99$export$30f61ebf204c69f6);
11934
-
11935
-
11936
- function $77ec335383336bdd$export$931068bc678f0d73(tagName, provider) {
11937
- if (!provider) {
11938
- // eslint-disable-next-line no-console
11939
- console.error("no provider parsed");
11940
- return;
11941
- }
11942
- let attempts = 0;
11943
- const maxAttempts = 10;
11944
- let timer;
11945
- const attemptToSetProvider = ()=>{
11946
- try {
11947
- const elements = document.getElementsByTagName(tagName);
11948
- const widget = elements[0];
11949
- widget.setProvider(provider);
11950
- window.clearInterval(timer);
11951
- } catch (err) {
11952
- attempts++;
11953
- if (attempts >= maxAttempts) {
11954
- window.clearInterval(timer);
11955
- // eslint-disable-next-line no-console
11956
- console.error("failed to set the provider");
11957
- }
11958
- }
11959
- };
11960
- timer = window.setInterval(attemptToSetProvider, 10);
11961
- attemptToSetProvider();
11962
- }
11963
-
11964
-
11965
-
11966
- function $1f969328e5988c99$export$30f61ebf204c69f6(props) {
11967
- const { walletProvider: walletProvider , fromContractAddress: fromContractAddress , amount: amount , provider: provider } = props;
11968
- (useEffect)(()=>{
11969
- if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).BRIDGE, provider);
11970
- }, [
11971
- provider
11972
- ]);
11973
- const config = window.ImtblCheckoutWidgetConfig;
11974
- return /*#__PURE__*/ (jsx)("imtbl-bridge", {
11975
- widgetConfig: config,
11976
- walletProvider: walletProvider,
11977
- fromContractAddress: fromContractAddress ?? "",
11978
- amount: amount ?? ""
11979
- });
11980
- }
11981
-
11982
-
11983
- var $f2083cd30e2f5c56$exports = {};
11984
-
11985
- $parcel$export($f2083cd30e2f5c56$exports, "ConnectReact", () => $f2083cd30e2f5c56$export$49d62957f420a1e2);
11986
-
11987
-
11988
- function $f2083cd30e2f5c56$export$49d62957f420a1e2() {
11989
- const config = window.ImtblCheckoutWidgetConfig;
11990
- return /*#__PURE__*/ (jsx)("imtbl-connect", {
11991
- widgetConfig: config
11992
- });
11993
- }
11994
-
11995
-
11996
- var $a4fbb8e3a6aeff58$exports = {};
11997
-
11998
- $parcel$export($a4fbb8e3a6aeff58$exports, "SwapReact", () => $a4fbb8e3a6aeff58$export$971e031379577f4);
11999
- /* eslint-disable max-len */
12000
-
12001
-
12002
-
12003
- function $a4fbb8e3a6aeff58$export$971e031379577f4(props) {
12004
- const { walletProvider: walletProvider , fromContractAddress: fromContractAddress , amount: amount , toContractAddress: toContractAddress , provider: provider } = props;
12005
- (useEffect)(()=>{
12006
- if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).SWAP, provider);
12007
- }, [
12008
- provider
12009
- ]);
12010
- const config = window.ImtblCheckoutWidgetConfig;
12011
- return /*#__PURE__*/ (jsx)("imtbl-swap", {
12012
- widgetConfig: config,
12013
- walletProvider: walletProvider,
12014
- fromContractAddress: fromContractAddress ?? "",
12015
- toContractAddress: toContractAddress ?? "",
12016
- amount: amount ?? ""
12017
- });
12018
- }
12019
-
12020
-
12021
- var $89d55ace0f8f1c07$exports = {};
12022
-
12023
- $parcel$export($89d55ace0f8f1c07$exports, "WalletReact", () => $89d55ace0f8f1c07$export$ceaac94f34dba154);
12024
-
12025
-
12026
-
12027
-
12028
- function $89d55ace0f8f1c07$export$ceaac94f34dba154(props) {
12029
- const { walletProvider: walletProvider , provider: provider } = props;
12030
- (useEffect)(()=>{
12031
- if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).WALLET, provider);
12032
- }, [
12033
- provider
12034
- ]);
12035
- const config = window.ImtblCheckoutWidgetConfig;
12036
- return /*#__PURE__*/ (jsx)("imtbl-wallet", {
12037
- widgetConfig: config,
12038
- walletProvider: walletProvider
12039
- });
12040
- }
12041
-
12042
-
12043
- var $430e3eda76fa4d5f$exports = {};
12044
-
12045
- $parcel$export($430e3eda76fa4d5f$exports, "DEFAULT_CHECKOUT_VERSION", () => $430e3eda76fa4d5f$export$391f2d917401f2bb);
12046
- $parcel$export($430e3eda76fa4d5f$exports, "validateAndBuildVersion", () => $430e3eda76fa4d5f$export$46b1ae20f762ad4c);
12047
- $parcel$export($430e3eda76fa4d5f$exports, "CheckoutWidgets", () => $430e3eda76fa4d5f$export$af210a0808087845);
12048
- $parcel$export($430e3eda76fa4d5f$exports, "UpdateConfig", () => $430e3eda76fa4d5f$export$bf1548ba7e61c17f);
12049
- const $430e3eda76fa4d5f$export$391f2d917401f2bb = "0.1.9-alpha";
12050
- function $430e3eda76fa4d5f$export$46b1ae20f762ad4c(version) {
12051
- if (!version || version?.major === undefined || version.major < 0) return $430e3eda76fa4d5f$export$391f2d917401f2bb;
12052
- if (version.major === 0 && version.minor === 0 && version.patch === 0) return $430e3eda76fa4d5f$export$391f2d917401f2bb;
12053
- let validatedVersion = $430e3eda76fa4d5f$export$391f2d917401f2bb;
12054
- if (!Number.isNaN(version.major) && version.major >= 0) validatedVersion = version.major.toString();
12055
- if (version.minor !== undefined && !Number.isNaN(version.minor) && version.minor >= 0) validatedVersion += `.${version.minor.toString()}`;
12056
- if (version.patch !== undefined && !Number.isNaN(version.patch) && version.patch >= 0) {
12057
- if (version.minor === undefined) validatedVersion += `.0.${version.patch.toString()}`;
12058
- else validatedVersion += `.${version.patch.toString()}`;
12059
- }
12060
- // TODO: at the moment all of the releases that include
12061
- // the checkout widgets script have '-alpha' appended
12062
- // Change this when we go to testnet. ticket WT-1432
12063
- validatedVersion += "-alpha";
12064
- if (version.build !== undefined) validatedVersion += `.${version.build}`;
12065
- return validatedVersion;
12066
- }
12067
- function $430e3eda76fa4d5f$export$af210a0808087845(config) {
12068
- const checkoutWidgetJS = document.createElement("script");
12069
- const validVersion = $430e3eda76fa4d5f$export$46b1ae20f762ad4c(config?.version);
12070
- {
12071
- const cdnUrl = `https://cdn.jsdelivr.net/npm/@imtbl/sdk@${validVersion}/dist/browser/checkout.js`;
12072
- checkoutWidgetJS.setAttribute("src", cdnUrl);
12073
- }
12074
- document.head.appendChild(checkoutWidgetJS);
12075
- window.ImtblCheckoutWidgetConfig = JSON.stringify(config);
12076
- }
12077
- function $430e3eda76fa4d5f$export$bf1548ba7e61c17f(config) {
12078
- window.ImtblCheckoutWidgetConfig = JSON.stringify(config);
12079
- }
12080
-
12081
10747
  /* Autogenerated file. Do not edit manually. */
12082
10748
  /* tslint:disable */
12083
10749
  /* eslint-disable */
@@ -13608,4 +12274,4 @@ class ERC721PermissionedMintable {
13608
12274
  }
13609
12275
  }
13610
12276
 
13611
- export { APIError, BlockchainData, $15cc9e120aa6f3bf$export$d1bfa21f7c76447a as BridgeEventType, $1f969328e5988c99$export$30f61ebf204c69f6 as BridgeReact, $d85ad1457a3f1a83$export$161d4a74df65fc08 as CHECKOUT_API_BASE_URL, $baec09ddc3013323$export$c06e1e7429de6283 as ChainId, $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 as Checkout, $a8bc256d81a5e2c1$export$e3dc0620abde7f5a as CheckoutErrorType, $045213b18e9f1f94$export$75be0f6af9650f2c as CheckoutWidgetTagNames, $430e3eda76fa4d5f$export$af210a0808087845 as CheckoutWidgets, $a85ecdbd885c58ad$export$e72e7f9969a47dd3 as ConnectEventType, $f2083cd30e2f5c56$export$49d62957f420a1e2 as ConnectReact, $430e3eda76fa4d5f$export$391f2d917401f2bb as DEFAULT_CHECKOUT_VERSION, ERC20, ERC721PermissionedMintable, Environment, $de275b98d2b651c3$export$788b1fd17f3dad84 as GasEstimateType, GenericIMXProvider, $207ed853f11d19d5$export$5a0ace85cae72d45 as IMTBLWidgetEvents, ImmutableConfiguration, ImmutableXClient, MetaMaskIMXProvider, $045213b18e9f1f94$export$95be4ae94445245a as Network, $a47e48dd2c04791b$export$1f05a55fe0680cc7 as NetworkFilterTypes, Networks, $ad06b030b1a3ba34$export$b80d2daf830437b9 as OrchestrationEventType, Orderbook, Passport, PassportError, ProviderConfiguration, $a47e48dd2c04791b$export$345c852d0dc8f1df as RPC_URL_MAP, $53d219e7f6bf0cd6$export$140a49745ab55563 as SwapEventType, $a4fbb8e3a6aeff58$export$971e031379577f4 as SwapReact, $08d5ddc39acd6833$export$fd9b17d87f4121d2 as TokenFilterTypes, $430e3eda76fa4d5f$export$bf1548ba7e61c17f as UpdateConfig, $77b6aac5c353d4a9$export$d9be06b70b28c742 as WalletEventType, $4f91c5f280efe242$export$a75605c67ea83a5a as WalletFilterTypes, $e768639828688ca3$export$2d7a51a18d87e21d as WalletProviderName, $89d55ace0f8f1c07$export$ceaac94f34dba154 as WalletReact, $045213b18e9f1f94$export$c88931fdc51854eb as WidgetTheme, module, $430e3eda76fa4d5f$export$46b1ae20f762ad4c as validateAndBuildVersion };
12277
+ export { APIError, BlockchainData, ERC20, ERC721PermissionedMintable, Environment, GenericIMXProvider, ImmutableConfiguration, ImmutableXClient, MetaMaskIMXProvider, Networks, Orderbook, Passport, PassportError, ProviderConfiguration, module };