@imtbl/sdk 0.1.7-alpha.2 → 0.1.7-alpha.3

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.
@@ -63,7 +63,7 @@ declare type AccessList = Array<{
63
63
  storageKeys: Array<string>;
64
64
  }>;
65
65
  declare type AccessListish = AccessList | Array<[string, Array<string>]> | Record<string, Array<string>>;
66
- interface Transaction$1 {
66
+ interface Transaction {
67
67
  hash?: string;
68
68
  to?: string;
69
69
  from?: string;
@@ -119,7 +119,7 @@ declare type TransactionRequest = {
119
119
  customData?: Record<string, any>;
120
120
  ccipReadEnabled?: boolean;
121
121
  };
122
- interface TransactionResponse extends Transaction$1 {
122
+ interface TransactionResponse extends Transaction {
123
123
  hash: string;
124
124
  blockNumber?: number;
125
125
  blockHash?: string;
@@ -375,7 +375,7 @@ declare class BaseProvider extends Provider implements EnsProvider {
375
375
  get ready(): Promise<Network>;
376
376
  static getFormatter(): Formatter;
377
377
  static getNetwork(network: Networkish): Network;
378
- ccipReadFetch(tx: Transaction$1, calldata: string, urls: Array<string>): Promise<null | string>;
378
+ ccipReadFetch(tx: Transaction, calldata: string, urls: Array<string>): Promise<null | string>;
379
379
  _getInternalBlockNumber(maxAge: number): Promise<number>;
380
380
  poll(): Promise<void>;
381
381
  resetEventsBlock(blockNumber: number): void;
@@ -404,9 +404,9 @@ declare class BaseProvider extends Provider implements EnsProvider {
404
404
  getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
405
405
  getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
406
406
  getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
407
- _wrapTransaction(tx: Transaction$1, hash?: string, startBlock?: number): TransactionResponse;
407
+ _wrapTransaction(tx: Transaction, hash?: string, startBlock?: number): TransactionResponse;
408
408
  sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
409
- _getTransactionRequest(transaction: Deferrable<TransactionRequest>): Promise<Transaction$1>;
409
+ _getTransactionRequest(transaction: Deferrable<TransactionRequest>): Promise<Transaction>;
410
410
  _getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>;
411
411
  _call(transaction: TransactionRequest, blockTag: BlockTag, attempt: number): Promise<string>;
412
412
  call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
@@ -563,6 +563,17 @@ interface ModuleConfiguration<T> {
563
563
  overrides?: T;
564
564
  }
565
565
 
566
+ /**
567
+ * Enum representing the supported chains with their corresponding IDs.
568
+ */
569
+ declare enum ChainId {
570
+ ETHEREUM = 1,
571
+ SEPOLIA = 11155111,
572
+ IMTBL_ZKEVM_DEVNET = 13373,
573
+ IMTBL_ZKEVM_TESTNET = 13372,
574
+ POLYGON_ZKEVM_TESTNET = 1442,
575
+ POLYGON_ZKEVM = 137
576
+ }
566
577
  /**
567
578
  * Interface representing token information.
568
579
  * @property {string} name - The token name.
@@ -579,48 +590,48 @@ interface TokenInfo {
579
590
  icon?: string;
580
591
  }
581
592
  /**
582
- * Interface representing the parameters for {@link Checkout.getTokenAllowList}.
583
- * @property {TokenFilterTypes} type - The type of token to retrieve.
584
- * @property {ChainId} chainId - The ID of the blockchain network.
585
- * @property {TokenFilter[]} [exclude] - The tokens to exclude from the list.
593
+ * Interface representing the parameters for {@link Checkout.getBalance}.
594
+ * @property {@link Web3Provider} provider - The provider to connect to the network.
595
+ * @property {string} walletAddress - The wallet address.
596
+ * @property {string | undefined} contractAddress - The contract address of the token.
586
597
  */
587
- interface GetTokenAllowListParams {
588
- type: TokenFilterTypes;
589
- chainId?: ChainId;
590
- exclude?: TokenFilter[];
598
+ interface GetBalanceParams {
599
+ provider: Web3Provider;
600
+ walletAddress: string;
601
+ contractAddress?: string;
591
602
  }
592
603
  /**
593
- * Interface representing the result of {@link Checkout.getTokenAllowList}.
594
- * @property {TokenInfo[]} tokens - The list of tokens allowed for the specified params.
604
+ * Interface representing the result of {@link Checkout.getBalance}.
605
+ * @property {BigNumber} balance - The balance of the wallet for the token.
606
+ * @property {string} formattedBalance - The formatted balance of the wallet for the token.
607
+ * @property {TokenInfo} token - The token information.
595
608
  */
596
- interface GetTokenAllowListResult {
597
- tokens: TokenInfo[];
609
+ interface GetBalanceResult {
610
+ balance: BigNumber;
611
+ formattedBalance: string;
612
+ token: TokenInfo;
598
613
  }
599
614
  /**
600
- * Enum representing the types of token filters available.
615
+ * Interface representing the parameters for {@link Checkout.getAllBalances}.
616
+ * @property {Web3Provider} provider - The provider to connect to the network.
617
+ * @property {string} walletAddress - The wallet address.
618
+ * @property {ChainId} chainId - The ID of the network.
601
619
  */
602
- declare enum TokenFilterTypes {
603
- SWAP = "swap",
604
- BRIDGE = "bridge",
605
- ALL = "all"
620
+ interface GetAllBalancesParams {
621
+ provider: Web3Provider;
622
+ walletAddress: string;
623
+ chainId: ChainId;
606
624
  }
607
625
  /**
608
- * Interface representing a token filter that can be used to exclude certain tokens.
609
- * @property {string} address - The token contract address.
626
+ * Interface representing the result of {@link Checkout.getAllBalances}.
627
+ * @property {GetBalanceResult[]} balances - The array of balances of the wallet for every token.
610
628
  */
611
- interface TokenFilter {
612
- address: string;
629
+ interface GetAllBalancesResult {
630
+ balances: GetBalanceResult[];
613
631
  }
614
- /**
615
- * Enum representing the supported chains with their corresponding IDs.
616
- */
617
- declare enum ChainId {
618
- ETHEREUM = 1,
619
- SEPOLIA = 11155111,
620
- IMTBL_ZKEVM_DEVNET = 13373,
621
- IMTBL_ZKEVM_TESTNET = 13372,
622
- POLYGON_ZKEVM_TESTNET = 1442,
623
- POLYGON_ZKEVM = 137
632
+ interface CheckoutOverrides {
633
+ }
634
+ interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
624
635
  }
625
636
  /**
626
637
  * Interface representing the information of a network.
@@ -635,6 +646,44 @@ interface NetworkInfo {
635
646
  nativeCurrency: TokenInfo;
636
647
  isSupported: boolean;
637
648
  }
649
+ /**
650
+ * Enum representing the list of default supported providers.
651
+ */
652
+ declare enum ConnectionProviders {
653
+ METAMASK = "metamask"
654
+ }
655
+ /**
656
+ * Interface representing the parameters for {@link Checkout.connect}.
657
+ * @property {ConnectionProviders} providerPreference - The preferred provider to connect to the network.
658
+ */
659
+ type ConnectParams = {
660
+ providerPreference: ConnectionProviders;
661
+ };
662
+ /**
663
+ * Interface representing the result of {@link Checkout.connect}.
664
+ * @property {Web3Provider} provider - The provider used to connect to the network.
665
+ * @property {NetworkInfo} network - Information about the connected network.
666
+ */
667
+ interface ConnectResult {
668
+ provider: Web3Provider;
669
+ network: NetworkInfo;
670
+ }
671
+ /**
672
+ * Interface representing the parameters for {@link Checkout.checkIsWalletConnected}.
673
+ * @property {ConnectionProviders} providerPreference - The preferred provider to use to check the connection status to th Web3 network.
674
+ */
675
+ interface CheckConnectionParams {
676
+ providerPreference: ConnectionProviders;
677
+ }
678
+ /**
679
+ * Interface representing the result of {@link Checkout.checkIsWalletConnected}.
680
+ * @property {boolean} isConnected - A boolean indicating the connection status of th Web3 provider.
681
+ * @property {string} walletAddress - The wallet address used to check the connection.
682
+ */
683
+ interface CheckConnectionResult {
684
+ isConnected: boolean;
685
+ walletAddress: string;
686
+ }
638
687
  /**
639
688
  * Type representing the details of a network.
640
689
  * @property {string} chainIdHex - The hexadecimal ID of the network.
@@ -708,95 +757,46 @@ interface GetNetworkAllowListResult {
708
757
  networks: NetworkInfo[];
709
758
  }
710
759
  /**
711
- * Interface representing the parameters for {@link Checkout.getBalance}.
712
- * @property {@link Web3Provider} provider - The provider to connect to the network.
713
- * @property {string} walletAddress - The wallet address.
714
- * @property {string | undefined} contractAddress - The contract address of the token.
715
- */
716
- interface GetBalanceParams {
717
- provider: Web3Provider;
718
- walletAddress: string;
719
- contractAddress?: string;
720
- }
721
- /**
722
- * Interface representing the result of {@link Checkout.getBalance}.
723
- * @property {BigNumber} balance - The balance of the wallet for the token.
724
- * @property {string} formattedBalance - The formatted balance of the wallet for the token.
725
- * @property {TokenInfo} token - The token information.
726
- */
727
- interface GetBalanceResult {
728
- balance: BigNumber;
729
- formattedBalance: string;
730
- token: TokenInfo;
731
- }
732
- /**
733
- * Interface representing the parameters for {@link Checkout.getAllBalances}.
734
- * @property {Web3Provider} provider - The provider to connect to the network.
735
- * @property {string} walletAddress - The wallet address.
736
- * @property {ChainId} chainId - The ID of the network.
737
- */
738
- interface GetAllBalancesParams {
739
- provider: Web3Provider;
740
- walletAddress: string;
741
- chainId: ChainId;
742
- }
743
- /**
744
- * Interface representing the result of {@link Checkout.getAllBalances}.
745
- * @property {GetBalanceResult[]} balances - The array of balances of the wallet for every token.
746
- */
747
- interface GetAllBalancesResult {
748
- balances: GetBalanceResult[];
749
- }
750
- interface CheckoutOverrides {
751
- }
752
- interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
753
- }
754
- /**
755
- * Enum representing the list of default supported providers.
760
+ * Interface representing the parameters for {@link Checkout.getTokenAllowList}.
761
+ * @property {TokenFilterTypes} type - The type of token to retrieve.
762
+ * @property {ChainId} chainId - The ID of the blockchain network.
763
+ * @property {TokenFilter[]} [exclude] - The tokens to exclude from the list.
756
764
  */
757
- declare enum ConnectionProviders {
758
- METAMASK = "metamask"
765
+ interface GetTokenAllowListParams {
766
+ type: TokenFilterTypes;
767
+ chainId?: ChainId;
768
+ exclude?: TokenFilter[];
759
769
  }
760
770
  /**
761
- * Interface representing the parameters for {@link Checkout.connect}.
762
- * @property {ConnectionProviders} providerPreference - The preferred provider to connect to the network.
763
- */
764
- type ConnectParams = {
765
- providerPreference: ConnectionProviders;
766
- };
767
- /**
768
- * Interface representing the result of {@link Checkout.connect}.
769
- * @property {Web3Provider} provider - The provider used to connect to the network.
770
- * @property {NetworkInfo} network - Information about the connected network.
771
+ * Interface representing the result of {@link Checkout.getTokenAllowList}.
772
+ * @property {TokenInfo[]} tokens - The list of tokens allowed for the specified params.
771
773
  */
772
- interface ConnectResult {
773
- provider: Web3Provider;
774
- network: NetworkInfo;
774
+ interface GetTokenAllowListResult {
775
+ tokens: TokenInfo[];
775
776
  }
776
777
  /**
777
- * Interface representing the parameters for {@link Checkout.checkIsWalletConnected}.
778
- * @property {ConnectionProviders} providerPreference - The preferred provider to use to check the connection status to th Web3 network.
778
+ * Enum representing the types of token filters available.
779
779
  */
780
- interface CheckConnectionParams {
781
- providerPreference: ConnectionProviders;
780
+ declare enum TokenFilterTypes {
781
+ SWAP = "swap",
782
+ BRIDGE = "bridge",
783
+ ALL = "all"
782
784
  }
783
785
  /**
784
- * Interface representing the result of {@link Checkout.checkIsWalletConnected}.
785
- * @property {boolean} isConnected - A boolean indicating the connection status of th Web3 provider.
786
- * @property {string} walletAddress - The wallet address used to check the connection.
786
+ * Interface representing a token filter that can be used to exclude certain tokens.
787
+ * @property {string} address - The token contract address.
787
788
  */
788
- interface CheckConnectionResult {
789
- isConnected: boolean;
790
- walletAddress: string;
789
+ interface TokenFilter {
790
+ address: string;
791
791
  }
792
792
  /**
793
793
  * Interface representing the parameters for {@link Checkout.sendTransaction}.
794
794
  * @property {Web3Provider} provider - The provider to connect to the network.
795
- * @property {Transaction} transaction - The transaction to send.
795
+ * @property {TransactionRequest} transaction - The transaction to send.
796
796
  */
797
797
  interface SendTransactionParams {
798
798
  provider: Web3Provider;
799
- transaction: Transaction;
799
+ transaction: TransactionRequest;
800
800
  }
801
801
  /**
802
802
  * Interface representing the result of {@link Checkout.sendTransaction}.
@@ -805,27 +805,6 @@ interface SendTransactionParams {
805
805
  interface SendTransactionResult {
806
806
  transactionResponse: TransactionResponse;
807
807
  }
808
- /**
809
- * Interface representing a blockchain transaction.
810
- * @property {string} nonce - The transaction nonce.
811
- * @property {string} gasPrice - The gas price of the transaction.
812
- * @property {string} gas - The gas limit for the transaction.
813
- * @property {string} to - The address of the recipient.
814
- * @property {string} from - The address of the sender.
815
- * @property {string} value - The value to transfer in wei.
816
- * @property {string} data - The data to include in the transaction.
817
- * @property {number} chainId - The ID of the chain the transaction is for.
818
- */
819
- interface Transaction {
820
- nonce: string;
821
- gasPrice: string;
822
- gas: string;
823
- to: string;
824
- from: string;
825
- value: string;
826
- data: string;
827
- chainId: number;
828
- }
829
808
  /**
830
809
  * Interface representing a wallet filter to be used in {@link GetWalletAllowListParams}.
831
810
  * @property {ConnectionProviders} connectionProvider - The connection provider to filter wallets by.
@@ -884,7 +863,9 @@ declare enum CheckoutErrorType {
884
863
  PROVIDER_REQUEST_MISSING_ERROR = "PROVIDER_REQUEST_MISSING_ERROR",
885
864
  PROVIDER_REQUEST_FAILED_ERROR = "PROVIDER_REQUEST_FAILED_ERROR",
886
865
  USER_REJECTED_REQUEST_ERROR = "USER_REJECTED_REQUEST_ERROR",
887
- TRANSACTION_ERROR = "TRANSACTION_ERROR"
866
+ TRANSACTION_FAILED = "TRANSACTION_FAILED",
867
+ INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
868
+ UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT"
888
869
  }
889
870
  /**
890
871
  * The type signature for an error.
@@ -983,4 +964,4 @@ declare class Checkout {
983
964
  getNetworkInfo(params: GetNetworkParams): Promise<NetworkInfo>;
984
965
  }
985
966
 
986
- export { ChainId, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, ConnectParams, ConnectResult, ConnectionProviders, ErrorType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, NetworkFilter, NetworkFilterTypes, NetworkInfo, SendTransactionParams, SendTransactionResult, SwitchNetworkParams, SwitchNetworkResult, TokenFilter, TokenFilterTypes, TokenInfo, Transaction, WalletFilter, WalletFilterTypes, WalletInfo };
967
+ export { ChainId, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, ConnectParams, ConnectResult, ConnectionProviders, ErrorType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, NetworkFilter, NetworkFilterTypes, NetworkInfo, SendTransactionParams, SendTransactionResult, SwitchNetworkParams, SwitchNetworkResult, TokenFilter, TokenFilterTypes, TokenInfo, WalletFilter, WalletFilterTypes, WalletInfo };
@@ -1,4 +1,4 @@
1
- import { utils, Contract } from 'ethers';
1
+ import { utils, Contract, ethers } from 'ethers';
2
2
  import $7v2Z6$metamaskdetectprovider from '@metamask/detect-provider';
3
3
  import { Web3Provider } from '@ethersproject/providers';
4
4
 
@@ -73,6 +73,19 @@ const $762782b6c862d954$export$db5daa1b5156ccfe = [
73
73
  ];
74
74
 
75
75
 
76
+ /**
77
+ * Enum representing the supported chains with their corresponding IDs.
78
+ */ let $baec09ddc3013323$export$c06e1e7429de6283;
79
+ (function(ChainId) {
80
+ ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
81
+ ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
82
+ ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 13373] = "IMTBL_ZKEVM_DEVNET";
83
+ ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13372] = "IMTBL_ZKEVM_TESTNET";
84
+ ChainId[ChainId["POLYGON_ZKEVM_TESTNET"] = 1442] = "POLYGON_ZKEVM_TESTNET";
85
+ ChainId[ChainId["POLYGON_ZKEVM"] = 137] = "POLYGON_ZKEVM";
86
+ })($baec09ddc3013323$export$c06e1e7429de6283 || ($baec09ddc3013323$export$c06e1e7429de6283 = {}));
87
+
88
+
76
89
 
77
90
  const $bc2bfebf768286d3$export$6a2ba3c3bd042990 = {
78
91
  baseConfig: {
@@ -87,18 +100,10 @@ let $d176a05e966364ba$export$3bfad4d03ada24c4;
87
100
  })($d176a05e966364ba$export$3bfad4d03ada24c4 || ($d176a05e966364ba$export$3bfad4d03ada24c4 = {}));
88
101
 
89
102
 
90
- let $a47e48dd2c04791b$export$c06e1e7429de6283;
91
- (function(ChainId) {
92
- ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
93
- ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
94
- ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 13373] = "IMTBL_ZKEVM_DEVNET";
95
- ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13372] = "IMTBL_ZKEVM_TESTNET";
96
- ChainId[ChainId["POLYGON_ZKEVM_TESTNET"] = 1442] = "POLYGON_ZKEVM_TESTNET";
97
- ChainId[ChainId["POLYGON_ZKEVM"] = 137] = "POLYGON_ZKEVM";
98
- })($a47e48dd2c04791b$export$c06e1e7429de6283 || ($a47e48dd2c04791b$export$c06e1e7429de6283 = {}));
103
+
99
104
  const $a47e48dd2c04791b$export$6f24f3cef7d501c4 = new Map([
100
105
  [
101
- $a47e48dd2c04791b$export$c06e1e7429de6283.ETHEREUM,
106
+ ($baec09ddc3013323$export$c06e1e7429de6283).ETHEREUM,
102
107
  {
103
108
  chainIdHex: "0x1",
104
109
  chainName: "Ethereum",
@@ -116,7 +121,7 @@ const $a47e48dd2c04791b$export$6f24f3cef7d501c4 = new Map([
116
121
  }
117
122
  ],
118
123
  [
119
- $a47e48dd2c04791b$export$c06e1e7429de6283.IMTBL_ZKEVM_TESTNET,
124
+ ($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET,
120
125
  {
121
126
  chainIdHex: "0x343C",
122
127
  chainName: "Immutable zkEVM Testnet",
@@ -131,7 +136,7 @@ const $a47e48dd2c04791b$export$6f24f3cef7d501c4 = new Map([
131
136
  }
132
137
  ],
133
138
  [
134
- $a47e48dd2c04791b$export$c06e1e7429de6283.POLYGON_ZKEVM,
139
+ ($baec09ddc3013323$export$c06e1e7429de6283).POLYGON_ZKEVM,
135
140
  {
136
141
  chainIdHex: "0x89",
137
142
  chainName: "Polygon zkEVM",
@@ -151,7 +156,7 @@ const $a47e48dd2c04791b$export$6f24f3cef7d501c4 = new Map([
151
156
  ]);
152
157
  const $a47e48dd2c04791b$export$3e81fc0987227f10 = new Map([
153
158
  [
154
- $a47e48dd2c04791b$export$c06e1e7429de6283.SEPOLIA,
159
+ ($baec09ddc3013323$export$c06e1e7429de6283).SEPOLIA,
155
160
  {
156
161
  chainIdHex: "0xaa36a7",
157
162
  chainName: "Sepolia",
@@ -169,7 +174,7 @@ const $a47e48dd2c04791b$export$3e81fc0987227f10 = new Map([
169
174
  }
170
175
  ],
171
176
  [
172
- $a47e48dd2c04791b$export$c06e1e7429de6283.IMTBL_ZKEVM_DEVNET,
177
+ ($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET,
173
178
  {
174
179
  chainIdHex: "0x343D",
175
180
  chainName: "Immutable zkEVM Devnet",
@@ -184,7 +189,7 @@ const $a47e48dd2c04791b$export$3e81fc0987227f10 = new Map([
184
189
  }
185
190
  ],
186
191
  [
187
- $a47e48dd2c04791b$export$c06e1e7429de6283.POLYGON_ZKEVM_TESTNET,
192
+ ($baec09ddc3013323$export$c06e1e7429de6283).POLYGON_ZKEVM_TESTNET,
188
193
  {
189
194
  chainIdHex: "0x5A2",
190
195
  chainName: "Polygon zkEVM Testnet",
@@ -208,8 +213,8 @@ let $a47e48dd2c04791b$export$1f05a55fe0680cc7;
208
213
  })($a47e48dd2c04791b$export$1f05a55fe0680cc7 || ($a47e48dd2c04791b$export$1f05a55fe0680cc7 = {}));
209
214
 
210
215
 
211
- // TODO: fix circular dependency
212
- // eslint-disable-next-line import/no-cycle
216
+
217
+
213
218
  let $08d5ddc39acd6833$export$fd9b17d87f4121d2;
214
219
  (function(TokenFilterTypes) {
215
220
  TokenFilterTypes["SWAP"] = "swap";
@@ -218,10 +223,17 @@ let $08d5ddc39acd6833$export$fd9b17d87f4121d2;
218
223
  })($08d5ddc39acd6833$export$fd9b17d87f4121d2 || ($08d5ddc39acd6833$export$fd9b17d87f4121d2 = {}));
219
224
 
220
225
 
226
+ /**
227
+ * Interface representing token information.
228
+ * @property {string} name - The token name.
229
+ * @property {string} symbol - The token symbol.
230
+ * @property {number} decimals - The token decimals.
231
+ * @property {string} [address] - The token contract address.
232
+ * @property {string} [icon] - The token icon URL/data:image.
233
+ */
234
+
221
235
 
222
236
 
223
- // TODO: fix circular dependency
224
- // eslint-disable-next-line import/no-cycle
225
237
  let $4f91c5f280efe242$export$35b06f0d33f57e26;
226
238
  (function(WalletAction) {
227
239
  WalletAction["CHECK_CONNECTION"] = "eth_accounts";
@@ -253,7 +265,9 @@ let $4f91c5f280efe242$export$a75605c67ea83a5a;
253
265
  CheckoutErrorType["PROVIDER_REQUEST_MISSING_ERROR"] = "PROVIDER_REQUEST_MISSING_ERROR";
254
266
  CheckoutErrorType["PROVIDER_REQUEST_FAILED_ERROR"] = "PROVIDER_REQUEST_FAILED_ERROR";
255
267
  CheckoutErrorType["USER_REJECTED_REQUEST_ERROR"] = "USER_REJECTED_REQUEST_ERROR";
256
- CheckoutErrorType["TRANSACTION_ERROR"] = "TRANSACTION_ERROR";
268
+ CheckoutErrorType["TRANSACTION_FAILED"] = "TRANSACTION_FAILED";
269
+ CheckoutErrorType["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
270
+ CheckoutErrorType["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
257
271
  })($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
258
272
  class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
259
273
  constructor(message, type, data){
@@ -413,7 +427,7 @@ async function $de192de6ef100f9f$export$79f13b4cfaaf0d09(config, provider) {
413
427
  async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, providerPreference, provider, chainId) {
414
428
  let currentProvider = provider;
415
429
  const { networkMap: networkMap } = config;
416
- if (!Object.values(($a47e48dd2c04791b$export$c06e1e7429de6283)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
430
+ if (!Object.values(($baec09ddc3013323$export$c06e1e7429de6283)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
417
431
  if (!currentProvider || !currentProvider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Incompatible provider", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR, {
418
432
  details: "Unsupported provider"
419
433
  });
@@ -541,7 +555,7 @@ async function $1564e43dde50bb61$export$60e0fe116a0e6ed0(provider, walletAddress
541
555
  });
542
556
  }
543
557
  const $1564e43dde50bb61$export$fee49741664a4d7e = async (config, provider, walletAddress, chainId)=>{
544
- if (!Object.values(($a47e48dd2c04791b$export$c06e1e7429de6283)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`ChainId ${chainId} is not supported`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
558
+ if (!Object.values(($baec09ddc3013323$export$c06e1e7429de6283)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`ChainId ${chainId} is not supported`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
545
559
  if (!provider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("provider object is missing request function", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR);
546
560
  const tokenList = await ($efe60cea83bfc4e8$export$473cec51305fdae8)({
547
561
  type: ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL,
@@ -590,16 +604,20 @@ async function $5cdde2ffe6360fec$export$a822caa90d7eef09({ type: type = ($4f91c5
590
604
 
591
605
 
592
606
 
607
+
593
608
  const $dbe95599a4661140$export$8e0e7ffc78696d30 = async (params)=>{
594
609
  const { provider: provider , transaction: transaction } = params;
595
- return await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
610
+ try {
596
611
  const transactionResponse = await provider.getSigner().sendTransaction(transaction);
597
612
  return {
598
613
  transactionResponse: transactionResponse
599
614
  };
600
- }, {
601
- type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).TRANSACTION_ERROR
602
- });
615
+ } catch (err) {
616
+ if (err.code === (ethers).errors.INSUFFICIENT_FUNDS) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).INSUFFICIENT_FUNDS);
617
+ if (err.code === (ethers).errors.ACTION_REJECTED) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
618
+ if (err.code === (ethers).errors.UNPREDICTABLE_GAS_LIMIT) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNPREDICTABLE_GAS_LIMIT);
619
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).TRANSACTION_FAILED);
620
+ }
603
621
  };
604
622
 
605
623
 
@@ -731,4 +749,4 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
731
749
  }
732
750
  }
733
751
 
734
- export { $a47e48dd2c04791b$export$c06e1e7429de6283 as ChainId, $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 as Checkout, $a8bc256d81a5e2c1$export$e3dc0620abde7f5a as CheckoutErrorType, $d176a05e966364ba$export$3bfad4d03ada24c4 as ConnectionProviders, $a47e48dd2c04791b$export$1f05a55fe0680cc7 as NetworkFilterTypes, $08d5ddc39acd6833$export$fd9b17d87f4121d2 as TokenFilterTypes, $4f91c5f280efe242$export$a75605c67ea83a5a as WalletFilterTypes };
752
+ export { $baec09ddc3013323$export$c06e1e7429de6283 as ChainId, $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 as Checkout, $a8bc256d81a5e2c1$export$e3dc0620abde7f5a as CheckoutErrorType, $d176a05e966364ba$export$3bfad4d03ada24c4 as ConnectionProviders, $a47e48dd2c04791b$export$1f05a55fe0680cc7 as NetworkFilterTypes, $08d5ddc39acd6833$export$fd9b17d87f4121d2 as TokenFilterTypes, $4f91c5f280efe242$export$a75605c67ea83a5a as WalletFilterTypes };