@imtbl/sdk 0.28.10 → 0.29.0-alpha.1

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.
@@ -41,6 +41,14 @@ declare class BigNumber implements Hexable {
41
41
  static isBigNumber(value: any): value is BigNumber;
42
42
  }
43
43
 
44
+ declare type Network = {
45
+ name: string;
46
+ chainId: number;
47
+ ensAddress?: string;
48
+ _defaultProvider?: (providers: any, options?: any) => any;
49
+ };
50
+ declare type Networkish = Network | string | number;
51
+
44
52
  declare type Deferrable<T> = {
45
53
  [K in keyof T]: T[K] | Promise<T[K]>;
46
54
  };
@@ -50,14 +58,6 @@ declare class Description<T = any> {
50
58
  });
51
59
  }
52
60
 
53
- declare type Network = {
54
- name: string;
55
- chainId: number;
56
- ensAddress?: string;
57
- _defaultProvider?: (providers: any, options?: any) => any;
58
- };
59
- declare type Networkish = Network | string | number;
60
-
61
61
  declare type AccessList = Array<{
62
62
  address: string;
63
63
  storageKeys: Array<string>;
@@ -238,43 +238,6 @@ declare abstract class Provider$1 implements OnceBlockable {
238
238
  static isProvider(value: any): value is Provider$1;
239
239
  }
240
240
 
241
- interface TypedDataDomain {
242
- name?: string;
243
- version?: string;
244
- chainId?: BigNumberish;
245
- verifyingContract?: string;
246
- salt?: BytesLike;
247
- }
248
- interface TypedDataField {
249
- name: string;
250
- type: string;
251
- }
252
- interface TypedDataSigner {
253
- _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
254
- }
255
- declare abstract class Signer {
256
- readonly provider?: Provider$1;
257
- abstract getAddress(): Promise<string>;
258
- abstract signMessage(message: Bytes | string): Promise<string>;
259
- abstract signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
260
- abstract connect(provider: Provider$1): Signer;
261
- readonly _isSigner: boolean;
262
- constructor();
263
- getBalance(blockTag?: BlockTag): Promise<BigNumber>;
264
- getTransactionCount(blockTag?: BlockTag): Promise<number>;
265
- estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
266
- call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag): Promise<string>;
267
- sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
268
- getChainId(): Promise<number>;
269
- getGasPrice(): Promise<BigNumber>;
270
- getFeeData(): Promise<FeeData$1>;
271
- resolveName(name: string): Promise<string>;
272
- checkTransaction(transaction: Deferrable<TransactionRequest>): Deferrable<TransactionRequest>;
273
- populateTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionRequest>;
274
- _checkProvider(operation?: string): void;
275
- static isSigner(value: any): value is Signer;
276
- }
277
-
278
241
  declare type FormatFunc = (value: any) => any;
279
242
  declare type FormatFuncs = {
280
243
  [key: string]: FormatFunc;
@@ -475,6 +438,43 @@ declare class BaseProvider extends Provider$1 implements EnsProvider {
475
438
  removeAllListeners(eventName?: EventType): this;
476
439
  }
477
440
 
441
+ interface TypedDataDomain {
442
+ name?: string;
443
+ version?: string;
444
+ chainId?: BigNumberish;
445
+ verifyingContract?: string;
446
+ salt?: BytesLike;
447
+ }
448
+ interface TypedDataField {
449
+ name: string;
450
+ type: string;
451
+ }
452
+ interface TypedDataSigner {
453
+ _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
454
+ }
455
+ declare abstract class Signer {
456
+ readonly provider?: Provider$1;
457
+ abstract getAddress(): Promise<string>;
458
+ abstract signMessage(message: Bytes | string): Promise<string>;
459
+ abstract signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
460
+ abstract connect(provider: Provider$1): Signer;
461
+ readonly _isSigner: boolean;
462
+ constructor();
463
+ getBalance(blockTag?: BlockTag): Promise<BigNumber>;
464
+ getTransactionCount(blockTag?: BlockTag): Promise<number>;
465
+ estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
466
+ call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag): Promise<string>;
467
+ sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
468
+ getChainId(): Promise<number>;
469
+ getGasPrice(): Promise<BigNumber>;
470
+ getFeeData(): Promise<FeeData$1>;
471
+ resolveName(name: string): Promise<string>;
472
+ checkTransaction(transaction: Deferrable<TransactionRequest>): Deferrable<TransactionRequest>;
473
+ populateTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionRequest>;
474
+ _checkProvider(operation?: string): void;
475
+ static isSigner(value: any): value is Signer;
476
+ }
477
+
478
478
  declare class JsonRpcSigner extends Signer implements TypedDataSigner {
479
479
  readonly provider: JsonRpcProvider;
480
480
  _index: number;
@@ -546,95 +546,6 @@ declare class Web3Provider extends JsonRpcProvider {
546
546
  send(method: string, params: Array<any>): Promise<any>;
547
547
  }
548
548
 
549
- declare enum Environment {
550
- PRODUCTION = "production",
551
- SANDBOX = "sandbox"
552
- }
553
- declare class ImmutableConfiguration {
554
- readonly environment: Environment;
555
- readonly rateLimitingKey?: string;
556
- readonly apiKey?: string;
557
- readonly clientAppId?: string;
558
- constructor(options: {
559
- environment: Environment;
560
- rateLimitingKey?: string;
561
- apiKey?: string;
562
- clientAppId?: string;
563
- });
564
- }
565
- interface ModuleConfiguration<T> {
566
- baseConfig: ImmutableConfiguration;
567
- overrides?: T;
568
- }
569
-
570
- type ExchangeContracts = {
571
- multicall: string;
572
- coreFactory: string;
573
- quoterV2: string;
574
- peripheryRouter: string;
575
- secondaryFee: string;
576
- };
577
- /**
578
- * Type representing an ERC20 token
579
- * @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
580
- * @property {number} chainId - The chain ID
581
- * @property {string} address - The token address
582
- * @property {number} decimals - The token decimals
583
- * @property {string | undefined} symbol - The token symbol or undefined if it is not available
584
- * @property {string | undefined} name - The token name or undefined if it is not available
585
- */
586
- type ERC20 = {
587
- type: 'erc20';
588
- chainId: number;
589
- address: string;
590
- decimals: number;
591
- symbol?: string;
592
- name?: string;
593
- };
594
- /**
595
- * Type representing a native token
596
- * @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
597
- * @property {number} chainId - The chain ID
598
- * @property {number} decimals - The token decimals
599
- * @property {string | undefined} symbol - The token symbol or undefined if it is not available
600
- * @property {string | undefined} name - The token name or undefined if it is not available
601
- */
602
- type Native = {
603
- type: 'native';
604
- chainId: number;
605
- decimals: number;
606
- symbol?: string;
607
- name?: string;
608
- };
609
- /**
610
- * Type representing a token, either an {@link ERC20} or {@link Native}
611
- */
612
- type Coin = ERC20 | Native;
613
- /**
614
- * Type representing the overrides for the {@link Exchange} module
615
- * @property {string} rpcURL - The RPC URL for the chain
616
- * @property {ExchangeContracts} exchangeContracts - The DEX contract addresses
617
- * @property {ERC20[]} commonRoutingTokens - The tokens used to find available pools for a swap
618
- * @property {Coin} nativeToken - The native token of the chain
619
- * @property {ERC20} wrappedNativeToken - The wrapped native token of the chain
620
- */
621
- type ExchangeOverrides = {
622
- rpcURL: string;
623
- exchangeContracts: ExchangeContracts;
624
- commonRoutingTokens: ERC20[];
625
- nativeToken: Coin;
626
- wrappedNativeToken: ERC20;
627
- };
628
-
629
- /**
630
- * @typedef {string} Address - Represents an Ethereum address.
631
- */
632
- type Address = string;
633
- /**
634
- * @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
635
- */
636
- type FungibleToken = Address | 'NATIVE';
637
-
638
549
  // TypeScript Version: 3.0
639
550
 
640
551
  type AxiosRequestHeaders = Record<string, string | number | boolean>;
@@ -10184,6 +10095,36 @@ interface IMXProvider {
10184
10095
  completeWithdrawal(starkPublicKey: string, token: AnyToken): Promise<TransactionResponse>;
10185
10096
  }
10186
10097
 
10098
+ declare enum Environment {
10099
+ PRODUCTION = "production",
10100
+ SANDBOX = "sandbox"
10101
+ }
10102
+ declare class ImmutableConfiguration {
10103
+ readonly environment: Environment;
10104
+ readonly rateLimitingKey?: string;
10105
+ readonly apiKey?: string;
10106
+ readonly publishableKey?: string;
10107
+ constructor(options: {
10108
+ environment: Environment;
10109
+ });
10110
+ }
10111
+ type ImmutableConfigurationWithRequireableFields<T> = ImmutableConfiguration & (T extends {
10112
+ apiKey: 'required';
10113
+ } ? Required<{
10114
+ apiKey: string;
10115
+ }> : {}) & (T extends {
10116
+ publishableKey: 'required';
10117
+ } ? Required<{
10118
+ publishableKey: string;
10119
+ }> : {});
10120
+ type ImmutableConfigurationWithOmitableFields<T> = (T extends {
10121
+ apiKey: 'omit';
10122
+ } ? Omit<ImmutableConfigurationWithRequireableFields<T>, 'apiKey'> : ImmutableConfigurationWithRequireableFields<T>);
10123
+ interface ModuleConfiguration<T> {
10124
+ baseConfig: ImmutableConfigurationWithOmitableFields<T>;
10125
+ overrides?: T;
10126
+ }
10127
+
10187
10128
  interface ImxOverrides {
10188
10129
  immutableXConfig: ImmutableXConfiguration;
10189
10130
  }
@@ -10724,6 +10665,7 @@ declare enum ChainName {
10724
10665
  IMTBL_ZKEVM_DEVNET = "Immutable zkEVM Dev",
10725
10666
  IMTBL_ZKEVM_MAINNET = "Immutable zkEVM"
10726
10667
  }
10668
+
10727
10669
  /**
10728
10670
  * Represents information about a token.
10729
10671
  * @interface TokenInfo
@@ -10740,6 +10682,7 @@ interface TokenInfo {
10740
10682
  address?: string;
10741
10683
  icon?: string;
10742
10684
  }
10685
+
10743
10686
  /**
10744
10687
  * Interface representing the parameters for {@link Checkout.getBalance}.
10745
10688
  * @property {Web3Provider} provider - The provider used to get the balance.
@@ -10780,6 +10723,7 @@ interface GetAllBalancesParams {
10780
10723
  interface GetAllBalancesResult {
10781
10724
  balances: GetBalanceResult[];
10782
10725
  }
10726
+
10783
10727
  interface OrderFee {
10784
10728
  amount: FeeToken | FeePercentage;
10785
10729
  recipient: string;
@@ -10790,88 +10734,111 @@ interface FeeToken {
10790
10734
  interface FeePercentage {
10791
10735
  percentageDecimal: number;
10792
10736
  }
10737
+
10793
10738
  type BuyResult = BuyResultSuccess | BuyResultFailed | BuyResultInsufficientFunds;
10794
10739
  /**
10795
10740
  * Represents the result of {@link Checkout.buy}
10796
- * @property {CheckoutStatus.SUCCESS} status - The status to indicate success
10797
- * @property {SmartCheckoutSufficient} smartCheckoutResult - The sufficient result of smart checkout
10741
+ * @property {CheckoutStatus.SUCCESS} status
10742
+ * @property {SmartCheckoutSufficient} smartCheckoutResult
10798
10743
  */
10799
10744
  type BuyResultSuccess = {
10745
+ /** The status to indicate success */
10800
10746
  status: CheckoutStatus.SUCCESS;
10747
+ /** The sufficient result of smart checkout */
10801
10748
  smartCheckoutResult: SmartCheckoutSufficient;
10802
10749
  };
10803
10750
  /**
10804
10751
  * Represents the result of {@link Checkout.buy}
10805
- * @property {CheckoutStatus.FAILED} status - The status to indicate failure
10806
- * @property {string} transactionHash - The transaction hash of the failed transaction
10807
- * @property {string} reason - The reason for the failure
10808
- * @property {SmartCheckoutSufficient} smartCheckoutResult - The sufficient result of smart checkout
10752
+ * @property {CheckoutStatus.FAILED} status
10753
+ * @property {string} transactionHash
10754
+ * @property {string} reason
10755
+ * @property {SmartCheckoutSufficient} smartCheckoutResult
10809
10756
  */
10810
10757
  type BuyResultFailed = {
10758
+ /** The status to indicate failure */
10811
10759
  status: CheckoutStatus.FAILED;
10760
+ /** The transaction hash of the failed transaction */
10812
10761
  transactionHash: string;
10762
+ /** The reason for the failure */
10813
10763
  reason: string;
10764
+ /** The sufficient result of smart checkout */
10814
10765
  smartCheckoutResult: SmartCheckoutSufficient;
10815
10766
  };
10816
10767
  /**
10817
10768
  * Represents the result of {@link Checkout.buy}
10818
- * @property {CheckoutStatus.INSUFFICIENT_FUNDS} status - The status to indicate insufficient funds
10819
- * @property {SmartCheckoutInsufficient} smartCheckoutResult - The insufficient result of smart checkout
10769
+ * @property {CheckoutStatus.INSUFFICIENT_FUNDS} status
10770
+ * @property {SmartCheckoutInsufficient} smartCheckoutResult
10820
10771
  */
10821
10772
  type BuyResultInsufficientFunds = {
10773
+ /** The status to indicate insufficient funds */
10822
10774
  status: CheckoutStatus.INSUFFICIENT_FUNDS;
10775
+ /** The insufficient result of smart checkout */
10823
10776
  smartCheckoutResult: SmartCheckoutInsufficient;
10824
10777
  };
10825
10778
  type SellResult = SellResultSuccess | SellResultFailed | SellResultInsufficientFunds;
10826
10779
  /**
10827
10780
  * Represents the result of {@link Checkout.sell}
10828
- * @property {CheckoutStatus.SUCCESS} status - The status to indicate success
10829
- * @property {SmartCheckoutSufficient} smartCheckoutResult - The sufficient result of smart checkout
10781
+ * @property {CheckoutStatus.SUCCESS} status
10782
+ * @property {string[]} orderIds
10783
+ * @property {SmartCheckoutSufficient} smartCheckoutResult
10830
10784
  */
10831
10785
  type SellResultSuccess = {
10786
+ /** The status to indicate success */
10832
10787
  status: CheckoutStatus.SUCCESS;
10788
+ /** The orders' ids */
10833
10789
  orderIds: string[];
10790
+ /** The sufficient result of smart checkout */
10834
10791
  smartCheckoutResult: SmartCheckoutSufficient;
10835
10792
  };
10836
10793
  /**
10837
10794
  * Represents the result of {@link Checkout.sell}
10838
- * @property {CheckoutStatus.FAILED} status - The status to indicate failure
10839
- * @property {string} transactionHash - The transaction hash of the failed transaction
10840
- * @property {string} reason - The reason for the failure
10841
- * @property {SmartCheckoutSufficient} smartCheckoutResult - The sufficient result of smart checkout
10795
+ * @property {CheckoutStatus.FAILED} status
10796
+ * @property {string} transactionHash
10797
+ * @property {string} reason
10798
+ * @property {SmartCheckoutSufficient} smartCheckoutResult
10842
10799
  */
10843
10800
  type SellResultFailed = {
10801
+ /** The status to indicate failure */
10844
10802
  status: CheckoutStatus.FAILED;
10803
+ /** The transaction hash of the failed transaction */
10845
10804
  transactionHash: string;
10805
+ /** The reason for the failure */
10846
10806
  reason: string;
10807
+ /** The sufficient result of smart checkout */
10847
10808
  smartCheckoutResult: SmartCheckoutSufficient;
10848
10809
  };
10849
10810
  /**
10850
10811
  * Represents the result of {@link Checkout.sell}
10851
- * @property {CheckoutStatus.INSUFFICIENT_FUNDS} status - The status to indicate insufficient funds
10852
- * @property {SmartCheckoutInsufficient} smartCheckoutResult - The insufficient result of smart checkout
10812
+ * @property {CheckoutStatus.INSUFFICIENT_FUNDS} status
10813
+ * @property {SmartCheckoutInsufficient} smartCheckoutResult
10853
10814
  */
10854
10815
  type SellResultInsufficientFunds = {
10816
+ /** The status to indicate insufficient funds */
10855
10817
  status: CheckoutStatus.INSUFFICIENT_FUNDS;
10818
+ /** The insufficient result of smart checkout */
10856
10819
  smartCheckoutResult: SmartCheckoutInsufficient;
10857
10820
  };
10858
10821
  type CancelResult = CancelResultSuccess | CancelResultFailed;
10859
10822
  /**
10860
10823
  * Represents the result of {@link Checkout.cancel}
10861
- * @property {CheckoutStatus.SUCCESS} status - The status to indicate success
10824
+ * @property {CheckoutStatus.SUCCESS} status
10862
10825
  */
10863
10826
  type CancelResultSuccess = {
10827
+ /** The status to indicate success */
10864
10828
  status: CheckoutStatus.SUCCESS;
10865
10829
  };
10866
10830
  /**
10867
10831
  * Represents the result of {@link Checkout.cancel}
10868
- * @property {CheckoutStatus.FAILED} status - The status to indicate failure
10869
- * @property {string} transactionHash - The transaction hash of the failed transaction
10870
- * @property {string} reason - The reason for the failure
10832
+ * @property {CheckoutStatus.FAILED} status
10833
+ * @property {string} transactionHash
10834
+ * @property {string} reason
10871
10835
  */
10872
10836
  type CancelResultFailed = {
10837
+ /** The status to indicate failure */
10873
10838
  status: CheckoutStatus.FAILED;
10839
+ /** The transaction hash of the failed transaction */
10874
10840
  transactionHash: string;
10841
+ /** The reason for the failure */
10875
10842
  reason: string;
10876
10843
  };
10877
10844
  /**
@@ -10888,22 +10855,27 @@ declare enum CheckoutStatus {
10888
10855
  }
10889
10856
  /**
10890
10857
  * The type representing the order to buy
10891
- * @property {string} orderId - the id of the order to buy
10892
- * @property {Array<OrderFee>} takerFees - array of order fees to apply to the order
10858
+ * @property {string} orderId
10859
+ * @property {Array<OrderFee>} takerFees
10893
10860
  */
10894
10861
  type BuyOrder = {
10862
+ /** the id of the order to buy */
10895
10863
  id: string;
10864
+ /** array of order fees to apply to the order */
10896
10865
  takerFees?: OrderFee[];
10897
10866
  };
10898
10867
  /**
10899
10868
  * The type representing the sell order to create a listing from
10900
- * @property {SellToken} sellToken - the token to be listed for sale
10901
- * @property {BuyToken} buyToken - the token info of the price of the item
10902
- * @property {OrderFee[]} makerFees - option array of makerFees to be applied to the listing
10869
+ * @property {SellToken} sellToken
10870
+ * @property {BuyToken} buyToken
10871
+ * @property {OrderFee[]} makerFees
10903
10872
  */
10904
10873
  type SellOrder = {
10874
+ /** the token to be listed for sale */
10905
10875
  sellToken: SellToken;
10876
+ /** the token info of the price of the item */
10906
10877
  buyToken: BuyToken;
10878
+ /** option array of makerFees to be applied to the listing */
10907
10879
  makerFees?: OrderFee[];
10908
10880
  };
10909
10881
  /**
@@ -10913,77 +10885,97 @@ type SellOrder = {
10913
10885
  type BuyToken = NativeBuyToken | ERC20BuyToken;
10914
10886
  /**
10915
10887
  * Represents a native buy token
10916
- * @property {ItemType} type - The type indicate this is a native token.
10917
- * @property {string} amount - The amount of native token.
10888
+ * @property {ItemType} type
10889
+ * @property {string} amount
10918
10890
  */
10919
10891
  type NativeBuyToken = {
10892
+ /** The type indicate this is a native token. */
10920
10893
  type: ItemType.NATIVE;
10894
+ /** The amount of native token. */
10921
10895
  amount: string;
10922
10896
  };
10923
10897
  /**
10924
10898
  * Represents a ERC20 buy token
10925
- * @property {ItemType} type - The type indicate this is a ERC20 token.
10926
- * @property {string} amount - The amount of native token.
10927
- * @property {string} contractAddress - The contract address of the ERC20.
10899
+ * @property {ItemType} type
10900
+ * @property {string} amount
10901
+ * @property {string} contractAddress
10928
10902
  */
10929
10903
  type ERC20BuyToken = {
10904
+ /** The type indicate this is a ERC20 token. */
10930
10905
  type: ItemType.ERC20;
10906
+ /** The amount of native token. */
10931
10907
  amount: string;
10908
+ /** The contract address of the ERC20. */
10932
10909
  contractAddress: string;
10933
10910
  };
10934
10911
  /**
10935
10912
  * The SellToken type
10936
- * @property {string} id - The ERC721 token id
10937
- * @property {string} collectionAddress - The ERC721 collection address
10913
+ * @property {string} id
10914
+ * @property {string} collectionAddress
10938
10915
  */
10939
10916
  type SellToken = {
10917
+ /** The ERC721 token id */
10940
10918
  id: string;
10919
+ /** The ERC721 collection address */
10941
10920
  collectionAddress: string;
10942
10921
  };
10943
10922
  /**
10944
10923
  * Interface representing the parameters for {@link Checkout.smartCheckout}
10945
- * @property {Web3Provider} provider - The provider to use for smart checkout.
10946
- * @property {ItemRequirement[]} itemRequirements - The item requirements for the transaction.
10947
- * @property {FulfillmentTransaction | GasAmount} transactionOrGasAmount - The transaction or gas amount.
10924
+ * @property {Web3Provider} provider
10925
+ * @property {ItemRequirement[]} itemRequirements
10926
+ * @property {FulfillmentTransaction | GasAmount} transactionOrGasAmount
10948
10927
  */
10949
10928
  interface SmartCheckoutParams {
10929
+ /** The provider to use for smart checkout. */
10950
10930
  provider: Web3Provider;
10931
+ /** The item requirements for the transaction. */
10951
10932
  itemRequirements: (NativeItemRequirement | ERC20ItemRequirement | ERC721ItemRequirement)[];
10933
+ /** The transaction or gas amount. */
10952
10934
  transactionOrGasAmount: FulfillmentTransaction | GasAmount;
10953
10935
  }
10954
10936
  /**
10955
10937
  * Represents a native item requirement for a transaction.
10956
- * @property {ItemType.NATIVE} type - The type to indicate this is a native item requirement.
10957
- * @property {string} amount - The amount of the item.
10938
+ * @property {ItemType.NATIVE} type
10939
+ * @property {string} amount
10958
10940
  */
10959
10941
  type NativeItemRequirement = {
10942
+ /** The type to indicate this is a native item requirement. */
10960
10943
  type: ItemType.NATIVE;
10944
+ /** The amount of the item. */
10961
10945
  amount: string;
10962
10946
  };
10963
10947
  /**
10964
10948
  * Represents an ERC20 item requirement for a transaction.
10965
- * @property {ItemType.ERC20} type - The type to indicate this is a ERC20 item requirement.
10966
- * @property {string} amount - The amount of the item.
10967
- * @property {string} contractAddress - The contract address of the ERC20.
10968
- * @property {string} spenderAddress - The contract address of the approver.
10949
+ * @property {ItemType.ERC20} type
10950
+ * @property {string} amount
10951
+ * @property {string} contractAddress
10952
+ * @property {string} spenderAddress
10969
10953
  */
10970
10954
  type ERC20ItemRequirement = {
10955
+ /** The type to indicate this is a ERC20 item requirement. */
10971
10956
  type: ItemType.ERC20;
10957
+ /** The amount of the item. */
10972
10958
  contractAddress: string;
10959
+ /** The contract address of the ERC20. */
10973
10960
  amount: string;
10961
+ /** The contract address of the approver. */
10974
10962
  spenderAddress: string;
10975
10963
  };
10976
10964
  /**
10977
10965
  * Represents an ERC721 item requirement for a transaction.
10978
- * @property {ItemType.ERC721} type - The type to indicate this is a ERC721 item requirement.
10979
- * @property {string} contractAddress - The contract address of the ERC721 collection.
10980
- * @property {string} id - The ID of this ERC721 in the collection.
10981
- * @property {string} spenderAddress - The contract address of the approver.
10966
+ * @property {ItemType.ERC721} type
10967
+ * @property {string} contractAddress
10968
+ * @property {string} id
10969
+ * @property {string} spenderAddress
10982
10970
  */
10983
10971
  type ERC721ItemRequirement = {
10972
+ /** The type to indicate this is a ERC721 item requirement. */
10984
10973
  type: ItemType.ERC721;
10974
+ /** The contract address of the ERC721 collection. */
10985
10975
  contractAddress: string;
10976
+ /** The ID of this ERC721 in the collection. */
10986
10977
  id: string;
10978
+ /** The contract address of the approver. */
10987
10979
  spenderAddress: string;
10988
10980
  };
10989
10981
  /**
@@ -11010,20 +11002,24 @@ declare enum TransactionOrGasType {
11010
11002
  }
11011
11003
  /**
11012
11004
  * The fulfillment transaction which contains the transaction to send.
11013
- * @property {TransactionOrGasType} type - The type to indicate this is a fulfillment transaction.
11014
- * @property {TransactionRequest} transaction - The transaction to send.
11005
+ * @property {TransactionOrGasType} type
11006
+ * @property {TransactionRequest} transaction
11015
11007
  */
11016
11008
  type FulfillmentTransaction = {
11009
+ /** The type to indicate this is a fulfillment transaction. */
11017
11010
  type: TransactionOrGasType.TRANSACTION;
11011
+ /** The transaction to send. */
11018
11012
  transaction: TransactionRequest;
11019
11013
  };
11020
11014
  /**
11021
11015
  * The gas amount which contains the gas token and the gas limit.
11022
- * @property {TransactionOrGasType} type - The type to indicate this is a gas amount.
11023
- * @property {GasToken} gasToken - The gas token.
11016
+ * @property {TransactionOrGasType} type
11017
+ * @property {GasToken} gasToken
11024
11018
  */
11025
11019
  type GasAmount = {
11020
+ /** The type to indicate this is a gas amount. */
11026
11021
  type: TransactionOrGasType.GAS;
11022
+ /** The gas token. */
11027
11023
  gasToken: GasToken;
11028
11024
  };
11029
11025
  /**
@@ -11042,22 +11038,27 @@ declare enum GasTokenType {
11042
11038
  }
11043
11039
  /**
11044
11040
  * Represents a native gas token.
11045
- * @property {GasTokenType} type - The type to indicate this is a native gas token.
11046
- * @property {BigNumber} limit - The gas limit.
11041
+ * @property {GasTokenType} type
11042
+ * @property {BigNumber} limit
11047
11043
  */
11048
11044
  type NativeGas = {
11045
+ /** The type to indicate this is a native gas token. */
11049
11046
  type: GasTokenType.NATIVE;
11047
+ /** The gas limit. */
11050
11048
  limit: BigNumber;
11051
11049
  };
11052
11050
  /**
11053
11051
  * Represents an ERC20 gas token.
11054
- * @property {GasTokenType} type - The type to indicate this is an ERC20 gas token.
11055
- * @property {string} contractAddress - The contract address of the ERC20.
11056
- * @property {BigNumber} limit - The gas limit.
11052
+ * @property {GasTokenType} type
11053
+ * @property {string} contractAddress
11054
+ * @property {BigNumber} limit
11057
11055
  */
11058
11056
  type ERC20Gas = {
11057
+ /** The type to indicate this is an ERC20 gas token. */
11059
11058
  type: GasTokenType.ERC20;
11059
+ /** The contract address of the ERC20. */
11060
11060
  contractAddress: string;
11061
+ /** The gas limit. */
11061
11062
  limit: BigNumber;
11062
11063
  };
11063
11064
  /**
@@ -11066,34 +11067,38 @@ type ERC20Gas = {
11066
11067
  type SmartCheckoutResult = SmartCheckoutSufficient | SmartCheckoutInsufficient;
11067
11068
  /**
11068
11069
  * Represents the result of {@link Checkout.smartCheckout} when smart checkout is sufficient.
11069
- * @property {boolean} sufficient - Indicates that smart checkout determined the user had sufficient funds.
11070
- * @property {TransactionRequirement[]} transactionRequirements - The transaction requirements smart checkout
11071
- * determined were required for the transaction.
11070
+ * @property {boolean} sufficient
11071
+ * @property {TransactionRequirement[]} transactionRequirements
11072
11072
  */
11073
11073
  type SmartCheckoutSufficient = {
11074
+ /** Indicates that smart checkout determined the user had sufficient funds. */
11074
11075
  sufficient: true;
11076
+ /** The transaction requirements smart checkout determined were required for the transaction. */
11075
11077
  transactionRequirements: TransactionRequirement[];
11076
11078
  };
11077
11079
  /**
11078
11080
  * Represents the result of {@link Checkout.smartCheckout} when smart checkout is insufficient.
11079
- * @property {boolean} sufficient - Indicates that smart checkout determined the user has insufficient funds
11080
- * @property {TransactionRequirement[]} transactionRequirements - The transaction requirements smart checkout
11081
- * determined were required for the transaction.
11082
- * @property {SmartCheckoutRouter} router - The type containing the funding routes the user can take to fulfill the transaction requirements
11081
+ * @property {boolean} sufficient
11082
+ * @property {TransactionRequirement[]} transactionRequirements
11083
+ * @property {SmartCheckoutRouter} router
11083
11084
  */
11084
11085
  type SmartCheckoutInsufficient = {
11086
+ /** Indicates that smart checkout determined the user has insufficient funds */
11085
11087
  sufficient: false;
11088
+ /** The transaction requirements smart checkout determined were required for the transaction. */
11086
11089
  transactionRequirements: TransactionRequirement[];
11090
+ /** The type containing the funding routes the user can take to fulfill the transaction requirements */
11087
11091
  router: SmartCheckoutRouter;
11088
11092
  };
11089
11093
  /**
11090
11094
  * Represents the routing outcome for a transaction.
11091
- * @property {AvailableRoutingOptions} availableRoutingOptions - The routing options available to the user
11092
- * @property {RoutingOutcome} routingOutcome - The routing outcome for the transaction which
11093
- * includes the funding routes if routes were found
11095
+ * @property {AvailableRoutingOptions} availableRoutingOptions
11096
+ * @property {RoutingOutcome} routingOutcome
11094
11097
  */
11095
11098
  type SmartCheckoutRouter = {
11099
+ /** The routing options available to the user */
11096
11100
  availableRoutingOptions: AvailableRoutingOptions;
11101
+ /** The routing outcome for the transaction which includes the funding routes if routes were found */
11097
11102
  routingOutcome: RoutingOutcome;
11098
11103
  };
11099
11104
  /**
@@ -11111,109 +11116,137 @@ declare enum RoutingOutcomeType {
11111
11116
  type RoutingOutcome = RoutesFound | NoRoutesFound | NoRouteOptions;
11112
11117
  /**
11113
11118
  * Represents a routing outcome where funding routes were found.
11114
- * @property {RoutingOutcomeType.ROUTES_FOUND} type - Indicates that funding routes were found for the transaction.
11115
- * @property {AvailableRoutingOptions} fundingRoutes - The funding routes found for the transaction.
11119
+ * @property {RoutingOutcomeType.ROUTES_FOUND} type
11120
+ * @property {AvailableRoutingOptions} fundingRoutes
11116
11121
  */
11117
11122
  type RoutesFound = {
11123
+ /** Indicates that funding routes were found for the transaction. */
11118
11124
  type: RoutingOutcomeType.ROUTES_FOUND;
11125
+ /** The funding routes found for the transaction. */
11119
11126
  fundingRoutes: FundingRoute[];
11120
11127
  };
11121
11128
  /**
11122
11129
  * Represents a routing outcome where no funding routes were found.
11123
- * @property {RoutingOutcomeType.NO_ROUTES_FOUND} type - Indicates that no funding routes were found for the transaction.
11124
- * @property {string} message - The message indicating why no funding routes were found.
11130
+ * @property {RoutingOutcomeType.NO_ROUTES_FOUND} type
11131
+ * @property {string} message
11125
11132
  */
11126
11133
  type NoRoutesFound = {
11134
+ /** Indicates that no funding routes were found for the transaction. */
11127
11135
  type: RoutingOutcomeType.NO_ROUTES_FOUND;
11136
+ /** The message indicating why no funding routes were found. */
11128
11137
  message: string;
11129
11138
  };
11130
11139
  /**
11131
11140
  * Represents a routing outcome where no routing options were available for the transaction.
11132
- * @property {RoutingOutcomeType.NO_ROUTE_OPTIONS} type - Indicates that no routing options were available for the transaction.
11133
- * @property {string} message - The message indicating why no routing options were available.
11141
+ * @property {RoutingOutcomeType.NO_ROUTE_OPTIONS} type
11142
+ * @property {string} message
11134
11143
  */
11135
11144
  type NoRouteOptions = {
11145
+ /** Indicates that no routing options were available for the transaction. */
11136
11146
  type: RoutingOutcomeType.NO_ROUTE_OPTIONS;
11147
+ /** The message indicating why no routing options were available. */
11137
11148
  message: string;
11138
11149
  };
11139
11150
  /**
11140
11151
  * Represents a funding route
11141
- * @property {number} priority - The priority of the route
11142
- * @property {FundingStep[]} steps - The steps associated with this funding route
11152
+ * @property {number} priority
11153
+ * @property {FundingStep[]} steps
11143
11154
  */
11144
11155
  type FundingRoute = {
11156
+ /** The priority of the route */
11145
11157
  priority: number;
11158
+ /** The steps associated with this funding route */
11146
11159
  steps: FundingStep[];
11147
11160
  };
11148
11161
  /**
11149
11162
  * Represents a fee
11150
- * @property {BigNumber} amount - The amount of the fee
11151
- * @property {string} formatted - The formatted amount of the fee
11152
- * @property {TokenInfo | undefined} token - The token info for the fee
11163
+ * @property {BigNumber} amount
11164
+ * @property {string} formatted
11165
+ * @property {TokenInfo | undefined} token
11153
11166
  */
11154
11167
  type Fee = {
11168
+ /** The amount of the fee */
11155
11169
  amount: BigNumber;
11170
+ /** The formatted amount of the fee */
11156
11171
  formattedAmount: string;
11172
+ /** The token info for the fee */
11157
11173
  token?: TokenInfo;
11158
11174
  };
11159
11175
  type FundingStep = BridgeFundingStep | SwapFundingStep | OnRampFundingStep;
11160
11176
  /**
11161
11177
  * Represents a bridge funding route
11162
- * @property {FundingStepType.BRIDGE} type - Indicates that this is a bridge funding step
11163
- * @property {number} chainId - The chain id the bridge should be executed on
11164
- * @property {FundingItem} fundingItem - The funding item for the bridge
11165
- * @property {BridgeFees} fees - The fees for the bridge
11178
+ * @property {FundingStepType.BRIDGE} type
11179
+ * @property {number} chainId
11180
+ * @property {FundingItem} fundingItem
11181
+ * @property {BridgeFees} fees
11166
11182
  */
11167
11183
  type BridgeFundingStep = {
11184
+ /** Indicates that this is a bridge funding step */
11168
11185
  type: FundingStepType.BRIDGE;
11186
+ /** The chain id the bridge should be executed on */
11169
11187
  chainId: number;
11188
+ /** The funding item for the bridge */
11170
11189
  fundingItem: FundingItem;
11190
+ /** The fees for the bridge */
11171
11191
  fees: BridgeFees;
11172
11192
  };
11173
11193
  /**
11174
11194
  * Represents the fees for a bridge funding step
11175
- * @property {Fee} approvalGasFees - The approval gas fees for the bridge
11176
- * @property {Fee} bridgeGasFees - The bridge gas fees for the bridge
11177
- * @property {Fee[]} bridgeFees - Additional bridge fees for the bridge
11195
+ * @property {Fee} approvalGasFees
11196
+ * @property {Fee} bridgeGasFees
11197
+ * @property {Fee[]} bridgeFees
11178
11198
  */
11179
11199
  type BridgeFees = {
11200
+ /** The approval gas fees for the bridge */
11180
11201
  approvalGasFees: Fee;
11202
+ /** The bridge gas fees for the bridge */
11181
11203
  bridgeGasFees: Fee;
11204
+ /** Additional bridge fees for the bridge */
11182
11205
  bridgeFees: Fee[];
11183
11206
  };
11184
11207
  /**
11185
11208
  * Represents a swap funding route
11186
- * @property {FundingStepType.SWAP} type - Indicates that this is a swap funding step
11187
- * @property {number} chainId - The chain id the swap should be executed on
11188
- * @property {FundingItem} fundingItem - The funding item for the swap
11189
- * @property {SwapFees} fees - The fees for the swap
11209
+ * @property {FundingStepType.SWAP} type
11210
+ * @property {number} chainId
11211
+ * @property {FundingItem} fundingItem
11212
+ * @property {SwapFees} fees
11190
11213
  */
11191
11214
  type SwapFundingStep = {
11215
+ /** Indicates that this is a swap funding step */
11192
11216
  type: FundingStepType.SWAP;
11217
+ /** The chain id the swap should be executed on */
11193
11218
  chainId: number;
11219
+ /** The funding item for the swap */
11194
11220
  fundingItem: FundingItem;
11221
+ /** The fees for the swap */
11195
11222
  fees: SwapFees;
11196
11223
  };
11197
11224
  /**
11198
11225
  * Represents the fees for a swap funding step
11199
- * @property {Fee} approvalGasFees - The approval gas fees for the swap
11200
- * @property {Fee} swapGasFees - The swap gas fees for the swap
11201
- * @property {Fee[]} swapFees - Additional swap fees for the swap
11226
+ * @property {Fee} approvalGasFees
11227
+ * @property {Fee} swapGasFees
11228
+ * @property {Fee[]} swapFees
11202
11229
  */
11203
11230
  type SwapFees = {
11231
+ /** The approval gas fees for the swap */
11204
11232
  approvalGasFees: Fee;
11233
+ /** The swap gas fees for the swap */
11205
11234
  swapGasFees: Fee;
11235
+ /** Additional swap fees for the swap */
11206
11236
  swapFees: Fee[];
11207
11237
  };
11208
11238
  /**
11209
11239
  * Represents an onramp funding route
11210
- * @property {FundingStepType.ONRAMP} type - Indicates that this is an onramp funding step
11211
- * @property {number} chainId - The chain id the onramp should provide funds to
11212
- * @property {FundingItem} fundingItem - The item to be onramped
11240
+ * @property {FundingStepType.ONRAMP} type
11241
+ * @property {number} chainId
11242
+ * @property {FundingItem} fundingItem
11213
11243
  */
11214
11244
  type OnRampFundingStep = {
11245
+ /** Indicates that this is an onramp funding step */
11215
11246
  type: FundingStepType.ONRAMP;
11247
+ /** The chain id the onramp should provide funds to */
11216
11248
  chainId: number;
11249
+ /** The item to be onramped */
11217
11250
  fundingItem: FundingItem;
11218
11251
  };
11219
11252
  /**
@@ -11230,76 +11263,98 @@ declare enum FundingStepType {
11230
11263
  }
11231
11264
  /**
11232
11265
  * Represents a funding item
11233
- * @property {ItemType.NATIVE | ItemType.ERC20} type - The type of the funding item
11234
- * @property {FundsRequired} fundsRequired - The amount of funds required of this funding item
11235
- * @property {UserBalance} userBalance - The current user balance of this funding item
11236
- * @property {TokenInfo} token - The token info for the funding item
11266
+ * @property {ItemType.NATIVE | ItemType.ERC20} type
11267
+ * @property {FundsRequired} fundsRequired
11268
+ * @property {UserBalance} userBalance
11269
+ * @property {TokenInfo} token
11237
11270
  */
11238
11271
  type FundingItem = {
11272
+ /** The type of the funding item */
11239
11273
  type: ItemType.NATIVE | ItemType.ERC20;
11274
+ /** The amount of funds required of this funding item */
11240
11275
  fundsRequired: FundsRequired;
11276
+ /** The current user balance of this funding item */
11241
11277
  userBalance: UserBalance;
11278
+ /** The token info for the funding item */
11242
11279
  token: TokenInfo;
11243
11280
  };
11244
11281
  /**
11245
11282
  * Represents the funds required of a funding item
11246
- * @property {BigNumber} amount - The amount of funds required
11247
- * @property {string} formattedAmount - The formatted amount of funds required
11283
+ * @property {BigNumber} amount
11284
+ * @property {string} formattedAmount
11248
11285
  */
11249
11286
  type FundsRequired = {
11287
+ /** The amount of funds required */
11250
11288
  amount: BigNumber;
11289
+ /** The formatted amount of funds required */
11251
11290
  formattedAmount: string;
11252
11291
  };
11253
11292
  /**
11254
11293
  * Represents the user balance of a funding item
11255
- * @property {BigNumber} balance - The balance of the funding item
11256
- * @property {string} formattedBalance - The formatted balance of the funding item
11294
+ * @property {BigNumber} balance
11295
+ * @property {string} formattedBalance
11257
11296
  */
11258
11297
  type UserBalance = {
11298
+ /** The balance of the funding item */
11259
11299
  balance: BigNumber;
11300
+ /** The formatted balance of the funding item */
11260
11301
  formattedBalance: string;
11261
11302
  };
11262
11303
  /**
11263
11304
  * Represents the transaction requirement for a transaction.
11264
- * @property {ItemType} type - The type of the transaction requirement.
11265
- * @property {boolean} sufficient - If the user address has sufficient funds to cover the transaction.
11266
- * @property {ItemBalance} required - The required item balance.
11267
- * @property {ItemBalance} current - The current item balance.
11268
- * @property {BalanceDelta} delta - The delta between the required and current balances.
11305
+ * @property {ItemType} type
11306
+ * @property {boolean} sufficient
11307
+ * @property {ItemBalance} required
11308
+ * @property {ItemBalance} current
11309
+ * @property {BalanceDelta} delta
11269
11310
  */
11270
11311
  type TransactionRequirement = {
11312
+ /** The type of the transaction requirement. */
11271
11313
  type: ItemType;
11314
+ /** If the user address has sufficient funds to cover the transaction. */
11272
11315
  sufficient: boolean;
11316
+ /** The required item balance. */
11273
11317
  required: ItemBalance;
11318
+ /** The current item balance. */
11274
11319
  current: ItemBalance;
11320
+ /** The delta between the required and current balances. */
11275
11321
  delta: BalanceDelta;
11276
11322
  };
11277
11323
  /**
11278
11324
  * Represents the balance for either a native or ERC20 token.
11279
- * @property {ItemType.NATIVE | ItemType.ERC20} type - Type to indicate this is a native or ERC20 token.
11280
- * @property {BigNumber} balance - The balance of the item.
11281
- * @property {string} formattedBalance - The formatted balance of the item.
11282
- * @property {TokenInfo} token - The token info of the item.
11325
+ * @property {ItemType.NATIVE | ItemType.ERC20} type
11326
+ * @property {BigNumber} balance
11327
+ * @property {string} formattedBalanc
11328
+ * @property {TokenInfo} token
11283
11329
  */
11284
11330
  type TokenBalance = {
11331
+ /** Type to indicate this is a native or ERC20 token. */
11285
11332
  type: ItemType.NATIVE | ItemType.ERC20;
11333
+ /** The balance of the item. */
11286
11334
  balance: BigNumber;
11335
+ /** The formatted balance of the item. */
11287
11336
  formattedBalance: string;
11337
+ /** The token info of the item. */
11288
11338
  token: TokenInfo;
11289
11339
  };
11290
11340
  /**
11291
11341
  * Represents the balance for an ERC721.
11292
- * @property {ItemType.ERC721} type - Type to indicate this is an ERC721 token.
11293
- * @property {BigNumber} balance - The balance of the item.
11294
- * @property {string} formattedBalance - The formatted balance of the item.
11295
- * @property {string} contractAddress - The contract address of the ERC721 collection.
11296
- * @property {string} id - The ID of the ERC721 in the collection.
11342
+ * @property {ItemType.ERC721} type
11343
+ * @property {BigNumber} balance
11344
+ * @property {string} formattedBalance
11345
+ * @property {string} contractAddress
11346
+ * @property {string} id
11297
11347
  */
11298
11348
  type ERC721Balance = {
11349
+ /** Type to indicate this is an ERC721 token. */
11299
11350
  type: ItemType.ERC721;
11351
+ /** The balance of the item. */
11300
11352
  balance: BigNumber;
11353
+ /** The formatted balance of the item. */
11301
11354
  formattedBalance: string;
11355
+ /** The contract address of the ERC721 collection. */
11302
11356
  contractAddress: string;
11357
+ /** The ID of the ERC721 in the collection */
11303
11358
  id: string;
11304
11359
  };
11305
11360
  /**
@@ -11308,25 +11363,31 @@ type ERC721Balance = {
11308
11363
  type ItemBalance = ERC721Balance | TokenBalance;
11309
11364
  /**
11310
11365
  * Represents the delta between two balances.
11311
- * @property {BigNumber} balance - The delta of the balance.
11312
- * @property {string} formattedBalance - The formatted balance of the delta.
11366
+ * @property {BigNumber} balance
11367
+ * @property {string} formattedBalance
11313
11368
  */
11314
11369
  type BalanceDelta = {
11370
+ /** The delta of the balance. */
11315
11371
  balance: BigNumber;
11372
+ /** The formatted balance of the delta. */
11316
11373
  formattedBalance: string;
11317
11374
  };
11318
11375
  /**
11319
11376
  * A type representing the Smart Checkout routing options available for a user
11320
11377
  * if they are configured and enabled (not geo-blocked etc.)
11321
- * @property {boolean | undefined} onRamp - If the user can use onramp
11322
- * @property {boolean | undefined} swap - If the user can use swap
11323
- * @property {boolean | undefined} bridge - If the user can use bridge
11378
+ * @property {boolean | undefined} onRamp
11379
+ * @property {boolean | undefined} swap
11380
+ * @property {boolean | undefined} bridge
11324
11381
  */
11325
11382
  type AvailableRoutingOptions = {
11383
+ /** If the user can use onramp */
11326
11384
  onRamp?: boolean;
11385
+ /** If the user can use swap */
11327
11386
  swap?: boolean;
11387
+ /** If the user can use bridge */
11328
11388
  bridge?: boolean;
11329
11389
  };
11390
+
11330
11391
  /**
11331
11392
  * Interface representing the parameters for {@link Checkout.buy}
11332
11393
  * @property {Web3Provider} provider - The provider to use for the buy.
@@ -11337,6 +11398,7 @@ interface BuyParams {
11337
11398
  provider: Web3Provider;
11338
11399
  orders: Array<BuyOrder>;
11339
11400
  }
11401
+
11340
11402
  /**
11341
11403
  * Interface representing the parameters for {@link Checkout.cancel}
11342
11404
  * @property {Web3Provider} provider - The provider to use for the cancel.
@@ -11347,79 +11409,166 @@ interface CancelParams {
11347
11409
  provider: Web3Provider;
11348
11410
  orderIds: string[];
11349
11411
  }
11350
- interface CheckoutOverrides {
11351
- }
11352
- interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
11353
- isOnRampEnabled?: boolean;
11354
- isSwapEnabled?: boolean;
11355
- isBridgeEnabled?: boolean;
11356
- }
11412
+
11413
+ type ExchangeContracts = {
11414
+ multicall: string;
11415
+ coreFactory: string;
11416
+ quoterV2: string;
11417
+ peripheryRouter: string;
11418
+ secondaryFee: string;
11419
+ };
11357
11420
  /**
11358
- * A type representing various remotely defined configurations which are
11359
- * accessible via the Checkout config and configured based on the Environment.
11360
- * @property {DexConfig} dex - The config used for the DEX.
11361
- * @property {OnRampConfig} onramp - The config used for the OnRamp
11362
- * @property {AllowedNetworkConfig[]} allowedNetworks - An array representing the allowed networks.
11363
- * @property {GasEstimateTokenConfig | undefined} gasEstimateTokens - The config for the tokens used to estimate gas.
11421
+ * Type representing an ERC20 token
11422
+ * @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
11423
+ * @property {number} chainId - The chain ID
11424
+ * @property {string} address - The token address
11425
+ * @property {number} decimals - The token decimals
11426
+ * @property {string | undefined} symbol - The token symbol or undefined if it is not available
11427
+ * @property {string | undefined} name - The token name or undefined if it is not available
11364
11428
  */
11365
- type RemoteConfiguration = {
11366
- dex: DexConfig;
11367
- onramp: OnRampConfig;
11368
- bridge: BridgeConfig;
11369
- allowedNetworks: AllowedNetworkConfig[];
11370
- gasEstimateTokens?: GasEstimateTokenConfig;
11371
- imxAddressMapping?: ImxAddressConfig;
11429
+ type ERC20 = {
11430
+ type: 'erc20';
11431
+ chainId: number;
11432
+ address: string;
11433
+ decimals: number;
11434
+ symbol?: string;
11435
+ name?: string;
11372
11436
  };
11373
11437
  /**
11374
- * A type representing the fee structure for an OnRamp provider
11375
- * @property {string | undefined} minPercentage - minimum percentage fee shown if a fee range is provided
11376
- * @property {string | undefined} maxPercentage - maximum percentage fee shown if a fee range is provided
11377
- * @property {string | undefined} feePercentage - specific fee percentage shown if there is no range provided
11438
+ * Type representing a native token
11439
+ * @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
11440
+ * @property {number} chainId - The chain ID
11441
+ * @property {number} decimals - The token decimals
11442
+ * @property {string | undefined} symbol - The token symbol or undefined if it is not available
11443
+ * @property {string | undefined} name - The token name or undefined if it is not available
11378
11444
  */
11379
- type OnRampProviderFees = {
11380
- minPercentage?: string;
11381
- maxPercentage?: string;
11382
- feePercentage?: string;
11445
+ type Native = {
11446
+ type: 'native';
11447
+ chainId: number;
11448
+ decimals: number;
11449
+ symbol?: string;
11450
+ name?: string;
11383
11451
  };
11384
11452
  /**
11385
- * A type representing the configuration for the OnRamp for a specific provider.
11386
- * @property {string} publishableApiKey - on ramp provider publishable api-key
11387
- * @property {TokenInfo[]} tokens - allowed tokens for the OnRamp provider
11388
- * @property {OnRampProviderFees} fees - on ramp provider transaction fees
11453
+ * Type representing a token, either an {@link ERC20} or {@link Native}
11389
11454
  */
11390
- type OnRampProviderConfig = {
11391
- publishableApiKey: string;
11455
+ type Coin = ERC20 | Native;
11456
+ /**
11457
+ * Type representing the overrides for the {@link Exchange} module
11458
+ * @property {string} rpcURL - The RPC URL for the chain
11459
+ * @property {ExchangeContracts} exchangeContracts - The DEX contract addresses
11460
+ * @property {ERC20[]} commonRoutingTokens - The tokens used to find available pools for a swap
11461
+ * @property {Coin} nativeToken - The native token of the chain
11462
+ * @property {ERC20} wrappedNativeToken - The wrapped native token of the chain
11463
+ */
11464
+ type ExchangeOverrides = {
11465
+ rpcURL: string;
11466
+ exchangeContracts: ExchangeContracts;
11467
+ commonRoutingTokens: ERC20[];
11468
+ nativeToken: Coin;
11469
+ wrappedNativeToken: ERC20;
11470
+ };
11471
+
11472
+ interface CheckoutOverrides {
11473
+ }
11474
+ /**
11475
+ * A type representing checkout SDK configurations.
11476
+ * @property {boolean} isOnRampEnabled - To enable on-ramp feature in Checkout sdk.
11477
+ * @property {boolean} isSwapEnabled - To enable swap feature in Checkout sdk.
11478
+ * @property {boolean} isBridgeEnabled - To enable bridge feature in Checkout sdk.
11479
+ * @property {Passport} passport - To enable passport wallet with Checkout sdk.
11480
+ */
11481
+ interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
11482
+ isOnRampEnabled?: boolean;
11483
+ isSwapEnabled?: boolean;
11484
+ isBridgeEnabled?: boolean;
11485
+ passport?: Passport;
11486
+ }
11487
+ /**
11488
+ * A type representing various remotely defined configurations which are
11489
+ * accessible via the Checkout config and configured based on the Environment.
11490
+ * @property {DexConfig} dex
11491
+ * @property {OnRampConfig} onramp
11492
+ * @property {BridgeConfig} bridge
11493
+ * @property {AllowedNetworkConfig[]} allowedNetworks
11494
+ * @property {GasEstimateTokenConfig | undefined} gasEstimateTokens
11495
+ * @property {ImxAddressConfig | undefined} imxAddressMapping
11496
+ */
11497
+ type RemoteConfiguration = {
11498
+ /** The config used for the DEX. */
11499
+ dex: DexConfig;
11500
+ /** The config used for the OnRamp */
11501
+ onramp: OnRampConfig;
11502
+ /** The config used for the Bridge. */
11503
+ bridge: BridgeConfig;
11504
+ /** An array representing the allowed networks. */
11505
+ allowedNetworks: AllowedNetworkConfig[];
11506
+ /** The config for the tokens used to estimate gas. */
11507
+ gasEstimateTokens?: GasEstimateTokenConfig;
11508
+ /** The IMX address mappings across available networks. */
11509
+ imxAddressMapping?: ImxAddressConfig;
11510
+ };
11511
+ /**
11512
+ * A type representing the fee structure for an OnRamp provider
11513
+ * @property {string | undefined} minPercentage
11514
+ * @property {string | undefined} maxPercentage
11515
+ * @property {string | undefined} feePercentage
11516
+ */
11517
+ type OnRampProviderFees = {
11518
+ /** The minimum percentage fee shown if a fee range is provided */
11519
+ minPercentage?: string;
11520
+ /** The maximum percentage fee shown if a fee range is provided */
11521
+ maxPercentage?: string;
11522
+ /** The specific fee percentage shown if there is no range provided */
11523
+ feePercentage?: string;
11524
+ };
11525
+ /**
11526
+ * A type representing the configuration for the OnRamp for a specific provider.
11527
+ * @property {string} publishableApiKey
11528
+ * @property {TokenInfo[]} tokens
11529
+ * @property {OnRampProviderFees} fees
11530
+ */
11531
+ type OnRampProviderConfig = {
11532
+ /** The on ramp provider publishable api-key */
11533
+ publishableApiKey: string;
11534
+ /** The allowed tokens for the OnRamp provider */
11392
11535
  tokens: TokenInfo[];
11536
+ /** The on ramp provider transaction fees */
11393
11537
  fees: OnRampProviderFees;
11394
11538
  };
11395
11539
  /**
11396
11540
  * A type representing the configuration for the OnRamp.
11397
- * @property {OnRampProviderConfig} transak - OnRamp config for Transak provider
11541
+ * @property {OnRampProviderConfig} transak
11398
11542
  */
11399
11543
  type OnRampConfig = {
11544
+ /** OnRamp config for Transak provider */
11400
11545
  [key: string]: OnRampProviderConfig;
11401
11546
  };
11402
11547
  /**
11403
11548
  * A type representing the configuration for the DEX.
11404
- * @property {ExchangeOverrides | undefined} overrides - The DEX overrides.
11405
- * @property {TokenInfo[] | undefined} tokens - An array of tokens compatible with the DEX.
11549
+ * @property {ExchangeOverrides | undefined} overrides
11550
+ * @property {TokenInfo[] | undefined} tokens
11406
11551
  */
11407
11552
  type DexConfig = {
11553
+ /** The DEX overrides. */
11408
11554
  overrides?: ExchangeOverrides;
11555
+ /** An array of tokens compatible with the DEX. */
11409
11556
  tokens?: TokenInfo[];
11410
11557
  };
11411
11558
  /**
11412
11559
  * A type representing the configuration for the Bridge.
11413
- * @property {TokenInfo[] | undefined} tokens - An array of tokens compatible with the Bridge.
11560
+ * @property {TokenInfo[] | undefined} tokens
11414
11561
  */
11415
11562
  type BridgeConfig = {
11563
+ /** An array of tokens compatible with the Bridge. */
11416
11564
  tokens?: TokenInfo[];
11417
11565
  };
11418
11566
  /**
11419
11567
  * A type representing an allowed network.
11420
- * @property {number} chainId - The network chain id.
11568
+ * @property {number} chainId
11421
11569
  */
11422
11570
  type AllowedNetworkConfig = {
11571
+ /** The network chain id. */
11423
11572
  chainId: number;
11424
11573
  };
11425
11574
  /**
@@ -11434,42 +11583,50 @@ type ImxAddressConfig = {
11434
11583
  * @type {{ [key: string]: { bridgeToL2Addresses?: GasEstimateBridgeToL2TokenConfig, swapAddresses?: GasEstimateSwapTokenConfig } }}
11435
11584
  * - A map of addresses for estimating gas keyed by the network chain id.
11436
11585
  * @property {GasEstimateBridgeToL2TokenConfig | undefined} bridgeToL2Addresses
11437
- * - The type representing the addresses for a bridge to layer 2 gas estimate.
11438
- * @property {GasEstimateSwapTokenConfig | undefined} swapAddresses - The type representing the addresses for a swap gas estimate
11586
+ * @property {GasEstimateSwapTokenConfig | undefined} swapAddresses
11439
11587
  */
11440
11588
  type GasEstimateTokenConfig = {
11441
11589
  [key: string]: {
11590
+ /** The type representing the addresses for a bridge to layer 2 gas estimate. */
11442
11591
  bridgeToL2Addresses?: GasEstimateBridgeToL2TokenConfig;
11592
+ /** The type representing the addresses for a swap gas estimate */
11443
11593
  swapAddresses?: GasEstimateSwapTokenConfig;
11444
11594
  };
11445
11595
  };
11446
11596
  /**
11447
11597
  * A type representing the config for a bridge to layer 2 gas estimate.
11448
- * @property {string | 'NATIVE'} gasTokenAddress - The address of the gas token.
11449
- * @property {string} fromAddress - The address of the token being bridged.
11598
+ * @property {string | 'NATIVE'} gasTokenAddress
11599
+ * @property {string} fromAddress
11450
11600
  */
11451
11601
  type GasEstimateBridgeToL2TokenConfig = {
11602
+ /** The address of the gas token. */
11452
11603
  gasTokenAddress: string | 'NATIVE';
11604
+ /** The address of the token being bridged. */
11453
11605
  fromAddress: string;
11454
11606
  };
11455
11607
  /**
11456
11608
  * A type representing the config for a swap gas estimate.
11457
- * @property {string} inAddress - The in token address.
11458
- * @property {string} outAddress - The out token address.
11609
+ * @property {string} inAddress
11610
+ * @property {string} outAddress
11459
11611
  */
11460
11612
  type GasEstimateSwapTokenConfig = {
11613
+ /** The in token address. */
11461
11614
  inAddress: string;
11615
+ /** The out token address. */
11462
11616
  outAddress: string;
11463
11617
  };
11464
11618
  /**
11465
11619
  * A type representing all the feature flags available.
11466
- * @property {TokenInfo[] | undefined} allowed - List of allowed tokens for a given chain.
11467
- * @property {boolean | undefined} blockscout - Feature flag to enable/disable blockscout integration.
11620
+ * @property {TokenInfo[] | undefined} allowed -
11621
+ * @property {boolean | undefined} blockscout -
11468
11622
  */
11469
11623
  type ChainTokensConfig = {
11624
+ /** List of allowed tokens for a given chain. */
11470
11625
  allowed?: TokenInfo[];
11626
+ /** Feature flag to enable/disable blockscout integration. */
11471
11627
  blockscout?: boolean;
11472
11628
  };
11629
+
11473
11630
  /**
11474
11631
  * Interface representing the params of {@link Checkout.connect}.
11475
11632
  * @property {Web3Provider} provider - The provider used to connect to the network.
@@ -11500,6 +11657,16 @@ interface CheckConnectionResult {
11500
11657
  isConnected: boolean;
11501
11658
  walletAddress: string;
11502
11659
  }
11660
+
11661
+ /**
11662
+ * @typedef {string} Address - Represents an Ethereum address.
11663
+ */
11664
+ type Address = string;
11665
+ /**
11666
+ * @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
11667
+ */
11668
+ type FungibleToken = Address | 'NATIVE';
11669
+
11503
11670
  /**
11504
11671
  * An enum representing the type of gas estimate.
11505
11672
  * @enum {string}
@@ -11563,6 +11730,7 @@ interface TokenAmountEstimate {
11563
11730
  estimatedAmount?: BigNumber;
11564
11731
  token?: TokenInfo;
11565
11732
  }
11733
+
11566
11734
  /**
11567
11735
  * Represents information about a network.
11568
11736
  * @interface NetworkInfo
@@ -11577,6 +11745,7 @@ interface NetworkInfo {
11577
11745
  nativeCurrency: TokenInfo;
11578
11746
  isSupported: boolean;
11579
11747
  }
11748
+
11580
11749
  /**
11581
11750
  * Interface representing the parameters for {@link Checkout.switchNetwork}.
11582
11751
  * @property {Web3Provider} provider - The provider to connect to the network.
@@ -11632,6 +11801,7 @@ declare enum NetworkFilterTypes {
11632
11801
  interface NetworkFilter {
11633
11802
  chainId: ChainId;
11634
11803
  }
11804
+
11635
11805
  /**
11636
11806
  * Interface representing the parameters for {@link Checkout.sell}
11637
11807
  * @property {Web3Provider} provider - The provider to use for the sell.
@@ -11642,6 +11812,7 @@ interface SellParams {
11642
11812
  provider: Web3Provider;
11643
11813
  orders: Array<SellOrder>;
11644
11814
  }
11815
+
11645
11816
  /**
11646
11817
  * Interface representing the parameters for {@link Checkout.getTokenAllowList}.
11647
11818
  * @property {TokenFilterTypes} type - The type of token to retrieve.
@@ -11676,6 +11847,7 @@ declare enum TokenFilterTypes {
11676
11847
  interface TokenFilter {
11677
11848
  address: string;
11678
11849
  }
11850
+
11679
11851
  /**
11680
11852
  * Interface representing the parameters for {@link Checkout.sendTransaction}.
11681
11853
  * @property {Web3Provider} provider - The provider to connect to the network.
@@ -11692,6 +11864,7 @@ interface SendTransactionParams {
11692
11864
  interface SendTransactionResult {
11693
11865
  transactionResponse: TransactionResponse;
11694
11866
  }
11867
+
11695
11868
  /**
11696
11869
  * Enum representing the names of different wallet providers.
11697
11870
  */
@@ -11702,29 +11875,27 @@ declare enum WalletProviderName {
11702
11875
  /**
11703
11876
  * Interface for the parameters required to create a wallet provider {@link Checkout.createProvider}.
11704
11877
  * @interface CreateProviderParams
11705
- * @property {WalletProviderName} walletProvider - The name of the wallet provider.
11706
- * @property {Passport | undefined} passport - The Passport instance required to create a provider for passport users.
11707
- * If walletProvider is 'passport', then the passport instance must be passed in.
11878
+ * @property {WalletProviderName} walletProviderName - The wallet provider name to create a provider for.
11708
11879
  */
11709
11880
  interface CreateProviderParams {
11710
- walletProvider: WalletProviderName;
11711
- passport?: Passport;
11881
+ walletProviderName: WalletProviderName;
11712
11882
  }
11713
11883
  /**
11714
11884
  * Represents the result of creating a Web3 provider {@link Checkout.createProvider}.
11715
11885
  * @property {Web3Provider} provider - The created Web3 provider.
11716
- * @property {WalletProviderName} providerName - The name of the wallet provider.
11886
+ * @property {WalletProviderName} walletProviderName - The wallet provider name of the provider that was created.
11717
11887
  */
11718
11888
  type CreateProviderResult = {
11719
11889
  provider: Web3Provider;
11720
11890
  walletProviderName: WalletProviderName;
11721
11891
  };
11892
+
11722
11893
  /**
11723
11894
  * Interface representing a wallet filter to be used in {@link GetWalletAllowListParams}.
11724
- * @property {WalletProviderName} connectionProvider - The connection provider to filter wallets by.
11895
+ * @property {WalletProviderName} walletProviderName - The wallet provider name to filter wallets by.
11725
11896
  */
11726
11897
  interface WalletFilter {
11727
- walletProvider: WalletProviderName;
11898
+ walletProviderName: WalletProviderName;
11728
11899
  }
11729
11900
  /**
11730
11901
  * Interface representing the parameters for {@link Checkout.getWalletAllowList}.
@@ -11737,14 +11908,12 @@ interface GetWalletAllowListParams {
11737
11908
  }
11738
11909
  /**
11739
11910
  * Interface representing information about a wallet used in {@link GetWalletAllowListResult}.
11740
- * @property {WalletProviderName} walletProvider - The connection provider for the wallet.
11741
- * @property {string} name - The name of the wallet.
11911
+ * @property {WalletProviderName} walletProviderName - The wallet provider name for the wallet.
11742
11912
  * @property {string | undefined} description - A description of the wallet.
11743
11913
  * @property {string | undefined} icon - The URL/data:image of an icon for the wallet.
11744
11914
  */
11745
11915
  interface WalletInfo {
11746
- walletProvider: WalletProviderName;
11747
- name: string;
11916
+ walletProviderName: WalletProviderName;
11748
11917
  description?: string;
11749
11918
  icon?: string;
11750
11919
  }
@@ -11761,6 +11930,7 @@ interface GetWalletAllowListResult {
11761
11930
  declare enum WalletFilterTypes {
11762
11931
  ALL = "all"
11763
11932
  }
11933
+
11764
11934
  /**
11765
11935
  * Base URL for the checkout API based on the environment.
11766
11936
  * @property {string} DEVELOPMENT - The base URL for the development environment.
@@ -11780,6 +11950,7 @@ type NetworkDetails = {
11780
11950
  blockExplorerUrls?: string[];
11781
11951
  };
11782
11952
  type NetworkMap = Map<ChainId, NetworkDetails>;
11953
+
11783
11954
  /**
11784
11955
  * An enum representing the type of exchange.
11785
11956
  * @enum {string}
@@ -11801,71 +11972,27 @@ interface FiatRampParams {
11801
11972
  web3Provider: Web3Provider;
11802
11973
  tokenAmount?: string;
11803
11974
  tokenAddress?: string;
11804
- passport?: Passport;
11805
- }
11806
- /**
11807
- * Enum representing different types of errors that can occur during the checkout process.
11808
- */
11809
- declare enum CheckoutErrorType {
11810
- WEB3_PROVIDER_ERROR = "WEB3_PROVIDER_ERROR",
11811
- PROVIDER_ERROR = "PROVIDER_ERROR",
11812
- DEFAULT_PROVIDER_ERROR = "DEFAULT_PROVIDER_ERROR",
11813
- CONNECT_PROVIDER_ERROR = "CONNECT_PROVIDER_ERROR",
11814
- GET_BALANCE_ERROR = "GET_BALANCE_ERROR",
11815
- GET_INDEXER_BALANCE_ERROR = "GET_INDEXER_BALANCE_ERROR",
11816
- GET_ERC20_BALANCE_ERROR = "GET_ERC20_BALANCE_ERROR",
11817
- GET_ERC721_BALANCE_ERROR = "GET_ERC721_BALANCE_ERROR",
11818
- GET_NETWORK_INFO_ERROR = "GET_NETWORK_INFO_ERROR",
11819
- METAMASK_PROVIDER_ERROR = "METAMASK_PROVIDER_ERROR",
11820
- CHAIN_NOT_SUPPORTED_ERROR = "CHAIN_NOT_SUPPORTED_ERROR",
11821
- PROVIDER_REQUEST_MISSING_ERROR = "PROVIDER_REQUEST_MISSING_ERROR",
11822
- PROVIDER_REQUEST_FAILED_ERROR = "PROVIDER_REQUEST_FAILED_ERROR",
11823
- USER_REJECTED_REQUEST_ERROR = "USER_REJECTED_REQUEST_ERROR",
11824
- TRANSACTION_FAILED = "TRANSACTION_FAILED",
11825
- INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
11826
- UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT",
11827
- INVALID_GAS_ESTIMATE_TYPE = "INVALID_GAS_ESTIMATE_TYPE",
11828
- UNSUPPORTED_TOKEN_TYPE_ERROR = "UNSUPPORTED_TOKEN_TYPE_ERROR",
11829
- UNSUPPORTED_BALANCE_REQUIREMENT_ERROR = "UNSUPPORTED_BALANCE_REQUIREMENT_ERROR",
11830
- GET_ORDER_LISTING_ERROR = "GET_ORDER_LISTING_ERROR",
11831
- CANCEL_ORDER_LISTING_ERROR = "CANCEL_ORDER_LISTING_ERROR",
11832
- PREPARE_ORDER_LISTING_ERROR = "PREPARE_ORDER_LISTING_ERROR",
11833
- CREATE_ORDER_LISTING_ERROR = "CREATE_ORDER_LISTING_ERROR",
11834
- FULFILL_ORDER_LISTING_ERROR = "FULFILL_ORDER_LISTING_ERROR",
11835
- SWITCH_NETWORK_UNSUPPORTED = "SWITCH_NETWORK_UNSUPPORTED",
11836
- GET_ERC20_ALLOWANCE_ERROR = "GET_ERC20_ALLOWANCE_ERROR",
11837
- GET_ERC721_ALLOWANCE_ERROR = "GET_ERC721_ALLOWANCE_ERROR",
11838
- EXECUTE_APPROVAL_TRANSACTION_ERROR = "EXECUTE_APPROVAL_TRANSACTION_ERROR",
11839
- EXECUTE_FULFILLMENT_TRANSACTION_ERROR = "EXECUTE_FULFILLMENT_TRANSACTION_ERROR",
11840
- SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR",
11841
- BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR",
11842
- ORDER_FEE_ERROR = "ORDER_FEE_ERROR",
11843
- ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR",
11844
- API_ERROR = "API_ERROR",
11845
- ORDER_EXPIRED_ERROR = "ORDER_EXPIRED_ERROR"
11975
+ passport?: any;
11846
11976
  }
11847
- /**
11848
- * Represents an error object with a specific type, optional message, and optional data.
11849
- * @property {CheckoutErrorType} type - The type of the error.
11850
- * @property {string | undefined} [message] - The error message.
11851
- * @property {Object.<string, string> | undefined} [data] - Additional data associated with the error.
11852
- */
11853
- type ErrorType = {
11854
- type: CheckoutErrorType;
11855
- message?: string;
11856
- data?: {
11857
- [key: string]: string;
11858
- };
11859
- };
11977
+
11860
11978
  type RemoteConfigParams = {
11861
11979
  isDevelopment: boolean;
11862
11980
  isProduction: boolean;
11863
11981
  };
11864
11982
  declare class RemoteConfigFetcher {
11983
+ private isDevelopment;
11984
+ private isProduction;
11985
+ private configCache;
11986
+ private tokensCache;
11865
11987
  constructor(params: RemoteConfigParams);
11988
+ private static makeHttpRequest;
11989
+ private getEndpoint;
11990
+ private loadConfig;
11991
+ private loadConfigTokens;
11866
11992
  getConfig(key?: keyof RemoteConfiguration): Promise<RemoteConfiguration | RemoteConfiguration[keyof RemoteConfiguration] | undefined>;
11867
11993
  getTokensConfig(chainId: ChainId): Promise<ChainTokensConfig>;
11868
11994
  }
11995
+
11869
11996
  declare class CheckoutConfiguration {
11870
11997
  readonly isDevelopment: boolean;
11871
11998
  readonly isProduction: boolean;
@@ -11877,9 +12004,7 @@ declare class CheckoutConfiguration {
11877
12004
  readonly networkMap: NetworkMap;
11878
12005
  constructor(config: CheckoutModuleConfiguration);
11879
12006
  }
11880
- type AvailabilityService = {
11881
- checkDexAvailability: () => Promise<boolean>;
11882
- };
12007
+
11883
12008
  interface FiatRampWidgetParams {
11884
12009
  exchangeType: ExchangeType;
11885
12010
  isPassport: boolean;
@@ -11897,16 +12022,706 @@ declare class FiatRampService {
11897
12022
  constructor(config: CheckoutConfiguration);
11898
12023
  feeEstimate(): Promise<OnRampProviderFees>;
11899
12024
  createWidgetUrl(params: FiatRampWidgetParams): Promise<string>;
12025
+ private getTransakWidgetUrl;
12026
+ }
12027
+
12028
+ type AvailabilityService = {
12029
+ checkDexAvailability: () => Promise<boolean>;
12030
+ };
12031
+
12032
+ /**
12033
+ * Enum representing the themes for the widgets.
12034
+ */
12035
+ declare enum WidgetTheme {
12036
+ LIGHT = "light",
12037
+ DARK = "dark"
12038
+ }
12039
+
12040
+ /**
12041
+ * Widget Configuration represents the shared configuration options for the Checkout Widgets.
12042
+ * @property {WidgetTheme | undefined} theme
12043
+ */
12044
+ type WidgetConfiguration = {
12045
+ /** The theme of the Checkout Widget (default: "DARK") */
12046
+ theme?: WidgetTheme;
12047
+ };
12048
+
12049
+ /**
12050
+ * Enum representing the events emitted by the widgets.
12051
+ */
12052
+ declare enum IMTBLWidgetEvents {
12053
+ IMTBL_WIDGETS_PROVIDER = "imtbl-widgets-provider",
12054
+ IMTBL_CONNECT_WIDGET_EVENT = "imtbl-connect-widget",
12055
+ IMTBL_WALLET_WIDGET_EVENT = "imtbl-wallet-widget",
12056
+ IMTBL_SWAP_WIDGET_EVENT = "imtbl-swap-widget",
12057
+ IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget",
12058
+ IMTBL_ONRAMP_WIDGET_EVENT = "imtbl-onramp-widget",
12059
+ IMTBL_SALE_WIDGET_EVENT = "imtbl-sale-widget"
12060
+ }
12061
+ /**
12062
+ * Enum for events raised for about provider objects
12063
+ */
12064
+ declare enum ProviderEventType {
12065
+ PROVIDER_UPDATED = "PROVIDER_UPDATED"
12066
+ }
12067
+ /**
12068
+ * Payload type for the PROVIDER_UPDATED event
12069
+ */
12070
+ type ProviderUpdated = {
12071
+ provider: Web3Provider;
12072
+ };
12073
+
12074
+ /**
12075
+ * Enum representing possible Connect Widget event types.
12076
+ */
12077
+ declare enum ConnectEventType {
12078
+ CLOSE_WIDGET = "close-widget",
12079
+ SUCCESS = "success",
12080
+ FAILURE = "failure"
12081
+ }
12082
+ /**
12083
+ * Represents a successful connection.
12084
+ * @property {Web3Provider} provider
12085
+ * @property {WalletProviderName | undefined} walletProviderName
12086
+ */
12087
+ type ConnectionSuccess = {
12088
+ /** The connected provider. */
12089
+ provider: Web3Provider;
12090
+ /** The wallet provider name of the connected provider. */
12091
+ walletProviderName: WalletProviderName | undefined;
12092
+ };
12093
+ /**
12094
+ * Represents a connection failure with a reason.
12095
+ * @property {string} reason
12096
+ */
12097
+ type ConnectionFailed = {
12098
+ /** The reason for the failed connection. */
12099
+ reason: string;
12100
+ };
12101
+
12102
+ /**
12103
+ * Enum representing possible Wallet Widget event types.
12104
+ */
12105
+ declare enum WalletEventType {
12106
+ CLOSE_WIDGET = "close-widget",
12107
+ NETWORK_SWITCH = "network-switch",
12108
+ DISCONNECT_WALLET = "disconnect-wallet"
11900
12109
  }
12110
+ /**
12111
+ * Represents an event that is triggered when the user switches the network in their wallet.
12112
+ * @property {string} network
12113
+ * @property {number} chainId
12114
+ * @property {Web3Provider} provider
12115
+ */
12116
+ type WalletNetworkSwitch = {
12117
+ /** The name of the network that the user switched to. */
12118
+ network: string;
12119
+ /** The chain ID of the network that the user switched to. */
12120
+ chainId: number;
12121
+ /** The Web3 provider object for the switched network. */
12122
+ provider: Web3Provider;
12123
+ };
12124
+ /**
12125
+ * Represents an event that is triggered when a wallet is disconnected.
12126
+ */
12127
+ type WalletDisconnect = {};
12128
+
12129
+ /**
12130
+ * Enum representing possible Swap Widget event types.
12131
+ */
12132
+ declare enum SwapEventType {
12133
+ CLOSE_WIDGET = "close-widget",
12134
+ SUCCESS = "success",
12135
+ FAILURE = "failure",
12136
+ REJECTED = "rejected"
12137
+ }
12138
+ /**
12139
+ * Represents a successful swap transaction.
12140
+ * @property {string} transactionHash
12141
+ */
12142
+ type SwapSuccess = {
12143
+ /** The hash of the successful transaction. */
12144
+ transactionHash: string;
12145
+ };
12146
+ /**
12147
+ * Type representing a Swap Widget with type FAILURE.
12148
+ * @property {string} reason
12149
+ * @property {number} timestamp
12150
+ */
12151
+ type SwapFailed = {
12152
+ /** The reason why the swap failed. */
12153
+ reason: string;
12154
+ /** The timestamp of the failed swap. */
12155
+ timestamp: number;
12156
+ };
12157
+ /**
12158
+ * Type representing a Swap Widget with type REJECTED.
12159
+ * @property {string} reason -
12160
+ * @property {number} timestamp -
12161
+ */
12162
+ type SwapRejected = {
12163
+ /** The reason why the swap failed. */
12164
+ reason: string;
12165
+ /** The timestamp of the failed swap. */
12166
+ timestamp: number;
12167
+ };
12168
+
12169
+ /**
12170
+ * Enum representing possible Sale Widget event types.
12171
+ */
12172
+ declare enum SaleEventType {
12173
+ CLOSE_WIDGET = "close-widget",
12174
+ SUCCESS = "success",
12175
+ FAILURE = "failure",
12176
+ REJECTED = "rejected",
12177
+ TRANSACTION_SUCCESS = "transaction-success"
12178
+ }
12179
+ /**
12180
+ * Represents a successful Sale transaction.
12181
+ * @property {Array} transactions -
12182
+ */
12183
+ type SaleSuccess = {
12184
+ /** The executed transactions */
12185
+ transactions: {
12186
+ method: string;
12187
+ hash: string | undefined;
12188
+ }[];
12189
+ [key: string]: unknown;
12190
+ };
12191
+ /**
12192
+ * Type representing a Sale Widget with type FAILURE.
12193
+ * @property {string} reason
12194
+ * @property {number} timestamp
12195
+ * @property {Array} transactions
12196
+ */
12197
+ type SaleFailed = {
12198
+ /** The reason why the swap failed. */
12199
+ reason: string;
12200
+ /** The timestamp of the failed swap. */
12201
+ timestamp: number;
12202
+ /** The executed transactions */
12203
+ transactions: {
12204
+ method: string;
12205
+ hash: string | undefined;
12206
+ }[];
12207
+ };
12208
+ /**
12209
+ * Type representing a Sale Widget with type TRANSACTION_SUCCESS.
12210
+ * @property {Object} transactions
12211
+ */
12212
+ type SaleTransactionSuccess = {
12213
+ /** The executed transactions */
12214
+ transactions: {
12215
+ method: string;
12216
+ hash: string | undefined;
12217
+ }[];
12218
+ };
12219
+
12220
+ /**
12221
+ * Enum of possible Bridge Widget event types.
12222
+ */
12223
+ declare enum BridgeEventType {
12224
+ CLOSE_WIDGET = "close-widget",
12225
+ SUCCESS = "success",
12226
+ FAILURE = "failure"
12227
+ }
12228
+ /**
12229
+ * Represents a successful bridge transaction.
12230
+ * @property {string} transactionHash
12231
+ */
12232
+ type BridgeSuccess = {
12233
+ /** The hash of the successful transaction. */
12234
+ transactionHash: string;
12235
+ };
12236
+ /**
12237
+ * Represents a failed bridge transaction.
12238
+ * @property {string} reason
12239
+ * @property {number} timestamp
12240
+ */
12241
+ type BridgeFailed = {
12242
+ /** The reason for the failed transaction. */
12243
+ reason: string;
12244
+ /** The timestamp of the failed transaction. */
12245
+ timestamp: number;
12246
+ };
12247
+
12248
+ /**
12249
+ * Enum representing different types of orchestration events.
12250
+ */
12251
+ declare enum OrchestrationEventType {
12252
+ REQUEST_CONNECT = "request-connect",
12253
+ REQUEST_WALLET = "request-wallet",
12254
+ REQUEST_SWAP = "request-swap",
12255
+ REQUEST_BRIDGE = "request-bridge",
12256
+ REQUEST_ONRAMP = "request-onramp"
12257
+ }
12258
+ /**
12259
+ * Represents the connect event object when the connect widget is requested.
12260
+ * @property {string} walletProviderName
12261
+ */
12262
+ type RequestConnectEvent = {
12263
+ /** The wallet provider name. */
12264
+ walletProviderName: string;
12265
+ };
12266
+ /**
12267
+ * Represents the wallet event object when the wallet widget is requested.
12268
+ * @property {string} walletProviderName
12269
+ */
12270
+ type RequestWalletEvent = {
12271
+ /** The wallet provider name. */
12272
+ walletProviderName: string;
12273
+ };
12274
+ /**
12275
+ * Represents the swap event object when the swap widget is requested.
12276
+ * @property {string} fromTokenAddress
12277
+ * @property {string} toTokenAddress
12278
+ * @property {string} amount
12279
+ */
12280
+ type RequestSwapEvent = {
12281
+ /** The address of the token to swap from. */
12282
+ fromTokenAddress: string;
12283
+ /** The address of the token to swap to. */
12284
+ toTokenAddress: string;
12285
+ /** The amount of from tokens to swap. */
12286
+ amount: string;
12287
+ };
12288
+ /**
12289
+ * Represents the bridge event object when the bridge widget is requested.
12290
+ * @property {string} tokenAddress
12291
+ * @property {string} amount
12292
+ */
12293
+ type RequestBridgeEvent = {
12294
+ /** The address of the token to bridge. */
12295
+ tokenAddress: string;
12296
+ /** The amount of tokens to bridge. */
12297
+ amount: string;
12298
+ };
12299
+ /**
12300
+ * Represents the onramp event object when the onramp widget is requested.
12301
+ * @property {string} tokenAddress
12302
+ * @property {string} amount
12303
+ */
12304
+ type RequestOnrampEvent = {
12305
+ /** The address of the token to be used for onramp. */
12306
+ tokenAddress: string;
12307
+ /** The amount of tokens to onramp. */
12308
+ amount: string;
12309
+ };
12310
+ type OrchestrationEventData = RequestConnectEvent | RequestWalletEvent | RequestSwapEvent | RequestBridgeEvent | RequestOnrampEvent;
12311
+
12312
+ /**
12313
+ * Enum of possible OnRamp Widget event types.
12314
+ */
12315
+ declare enum OnRampEventType {
12316
+ CLOSE_WIDGET = "close-widget",
12317
+ SUCCESS = "success",
12318
+ FAILURE = "failure"
12319
+ }
12320
+ /**
12321
+ * Represents a successful on-ramp transaction.
12322
+ * @property {string} transactionHash
12323
+ */
12324
+ type OnRampSuccess = {
12325
+ /** The transaction hash of the successful transaction. */
12326
+ transactionHash: string;
12327
+ };
12328
+ /**
12329
+ * Type representing a On-ramp Widget with type FAILURE.
12330
+ * @property {string} reason
12331
+ * @property {number} timestamp
12332
+ */
12333
+ type OnRampFailed = {
12334
+ /** The reason why the on-ramp failed. */
12335
+ reason: string;
12336
+ /** The timestamp of the failed transaction. */
12337
+ timestamp: number;
12338
+ };
12339
+
12340
+ declare enum ConnectTargetLayer {
12341
+ LAYER1 = "LAYER1",
12342
+ LAYER2 = "LAYER2"
12343
+ }
12344
+ type ConnectWidgetParams = {};
12345
+
12346
+ /**
12347
+ * Bridge Widget parameters
12348
+ * @property {string | undefined} fromContractAddress
12349
+ * @property {string | undefined} amount
12350
+ * @property {WalletProviderName | undefined} walletProviderName
12351
+ */
12352
+ type BridgeWidgetParams = {
12353
+ /** The contract address of the token to bridge from, used to populate the bridge form token field */
12354
+ fromContractAddress?: string;
12355
+ /** The formatted amount to bridge, used to populate the bridge form amount field */
12356
+ amount?: string;
12357
+ /** The wallet provider name to use for the bridge widget */
12358
+ walletProviderName?: WalletProviderName;
12359
+ };
12360
+
12361
+ /**
12362
+ * Wallet Widget parameters
12363
+ * @property {WalletProviderName | undefined} walletProviderName
12364
+ */
12365
+ type WalletWidgetParams = {
12366
+ /** The wallet provider name to use for the wallet widget */
12367
+ walletProviderName?: WalletProviderName;
12368
+ };
12369
+
12370
+ /**
12371
+ * Swap Widget parameters
12372
+ * @property {string | undefined} amount
12373
+ * @property {string | undefined} fromContractAddress
12374
+ * @property {string | undefined} toContractAddress
12375
+ * @property {WalletProviderName | undefined} walletProviderName
12376
+ */
12377
+ type SwapWidgetParams = {
12378
+ /** The formatted amount to swap, used to populate the swap from amount field */
12379
+ amount?: string;
12380
+ /** The contract address of the token to swap from */
12381
+ fromContractAddress?: string;
12382
+ /** The contract address of the token to swap to */
12383
+ toContractAddress?: string;
12384
+ /** The wallet provider name to use for the swap widget */
12385
+ walletProviderName?: WalletProviderName;
12386
+ };
12387
+
12388
+ /**
12389
+ * OnRamp Widget parameters
12390
+ * @property {string | undefined} contractAddress
12391
+ * @property {string | undefined} amount
12392
+ * @property {WalletProviderName | undefined} walletProviderName
12393
+ */
12394
+ type OnRampWidgetParams = {
12395
+ /** The contract address of the token to onramp */
12396
+ contractAddress?: string;
12397
+ /** The formatted amount to onramp, used to populate the onramp form amount field */
12398
+ amount?: string;
12399
+ /** The wallet provider name to use for the onramp widget */
12400
+ walletProviderName?: WalletProviderName;
12401
+ };
12402
+
12403
+ /**
12404
+ * Sale Widget parameters
12405
+ * @property {string} amount
12406
+ * @property {string} environmentId
12407
+ * @property {string} fromContractAddress
12408
+ * @property {SaleItem[]} items
12409
+ * @property {WalletProviderName | undefined} walletProviderName
12410
+ */
12411
+ type SaleWidgetParams = {
12412
+ /** The total price to pay for the items in the sale */
12413
+ amount?: string;
12414
+ environmentId?: string;
12415
+ fromContractAddress?: string;
12416
+ /** The list of products to be purchased */
12417
+ items?: SaleItem[];
12418
+ /** The wallet provider name to default to if no web3Provider is passed */
12419
+ walletProviderName?: WalletProviderName;
12420
+ };
12421
+ /**
12422
+ * A product to be purchased
12423
+ * @property {string} productId
12424
+ * @property {number} qty
12425
+ * @property {string} name
12426
+ * @property {string} image
12427
+ * @property {string} description
12428
+ */
12429
+ type SaleItem = {
12430
+ /** The id of the product */
12431
+ productId: string;
12432
+ /** The quantity to be purchased */
12433
+ qty: number;
12434
+ /** The name of the item */
12435
+ name: string;
12436
+ /** The image url of the item */
12437
+ image: string;
12438
+ /** The description of the item */
12439
+ description: string;
12440
+ };
12441
+
12442
+ /**
12443
+ * Connect Widget Configuration represents the configuration options for the Connect Widget.
12444
+ */
12445
+ type ConnectWidgetConfiguration = {} & WidgetConfiguration;
12446
+
12447
+ /**
12448
+ * Bridge Widget Configuration represents the configuration options for the Bridge Widget.
12449
+ */
12450
+ type BridgeWidgetConfiguration = {} & WidgetConfiguration;
12451
+
12452
+ /**
12453
+ * Wallet Widget Configuration represents the configuration options for the Wallet Widget.
12454
+ */
12455
+ type WalletWidgetConfiguration = {} & WidgetConfiguration;
12456
+
12457
+ /**
12458
+ * Swap Widget Configuration represents the configuration options for the Swap Widget.
12459
+ */
12460
+ type SwapWidgetConfiguration = {} & WidgetConfiguration;
12461
+
12462
+ /**
12463
+ * Onramp Widget Configuration represents the configuration options for the Onramp Widget.
12464
+ */
12465
+ type OnrampWidgetConfiguration = {} & WidgetConfiguration;
12466
+
12467
+ /**
12468
+ * Sale Widget Configuration represents the configuration options for the Sale Widget.
12469
+ */
12470
+ type SaleWidgetConfiguration = {} & WidgetConfiguration;
12471
+
12472
+ /**
12473
+ * Enum representing the list of widget types.
12474
+ */
12475
+ declare enum WidgetType {
12476
+ CONNECT = "connect",
12477
+ WALLET = "wallet",
12478
+ SWAP = "swap",
12479
+ BRIDGE = "bridge",
12480
+ ONRAMP = "onramp",
12481
+ SALE = "sale"
12482
+ }
12483
+ /**
12484
+ * Widget properties definition for each widget. Used for creating and updating widgets
12485
+ */
12486
+ type WidgetProperties<T extends WidgetType> = {
12487
+ config?: WidgetConfigurations[T];
12488
+ provider?: Web3Provider;
12489
+ };
12490
+ type WidgetConfigurations = {
12491
+ [WidgetType.CONNECT]: ConnectWidgetConfiguration;
12492
+ [WidgetType.WALLET]: WalletWidgetConfiguration;
12493
+ [WidgetType.SWAP]: SwapWidgetConfiguration;
12494
+ [WidgetType.BRIDGE]: BridgeWidgetConfiguration;
12495
+ [WidgetType.ONRAMP]: OnrampWidgetConfiguration;
12496
+ [WidgetType.SALE]: SaleWidgetConfiguration;
12497
+ };
12498
+ type WidgetParameters = {
12499
+ [WidgetType.CONNECT]: ConnectWidgetParams;
12500
+ [WidgetType.WALLET]: WalletWidgetParams;
12501
+ [WidgetType.SWAP]: SwapWidgetParams;
12502
+ [WidgetType.BRIDGE]: BridgeWidgetParams;
12503
+ [WidgetType.ONRAMP]: OnRampWidgetParams;
12504
+ [WidgetType.SALE]: SaleWidgetParams;
12505
+ };
12506
+ /**
12507
+ * Represents all the possible event types that are emitted by the widgets.
12508
+ */
12509
+ type WidgetEventTypes = {
12510
+ [WidgetType.CONNECT]: ConnectEventType | OrchestrationEventType;
12511
+ [WidgetType.WALLET]: WalletEventType | OrchestrationEventType;
12512
+ [WidgetType.SWAP]: SwapEventType | OrchestrationEventType;
12513
+ [WidgetType.BRIDGE]: BridgeEventType | OrchestrationEventType;
12514
+ [WidgetType.ONRAMP]: OnRampEventType | OrchestrationEventType;
12515
+ [WidgetType.SALE]: SaleEventType | OrchestrationEventType;
12516
+ };
12517
+ type OrchestrationMapping = {
12518
+ [OrchestrationEventType.REQUEST_CONNECT]: RequestConnectEvent;
12519
+ [OrchestrationEventType.REQUEST_WALLET]: RequestWalletEvent;
12520
+ [OrchestrationEventType.REQUEST_SWAP]: RequestSwapEvent;
12521
+ [OrchestrationEventType.REQUEST_BRIDGE]: RequestBridgeEvent;
12522
+ [OrchestrationEventType.REQUEST_ONRAMP]: RequestOnrampEvent;
12523
+ };
12524
+ type ProviderEventMapping = {
12525
+ [ProviderEventType.PROVIDER_UPDATED]: ProviderUpdated;
12526
+ };
12527
+ /**
12528
+ * Mapping of widget type, to each of it's events and then each event's payload
12529
+ * Update this whenever a new event is created and used by a widget
12530
+ * Each widget also has all of the orchestration events
12531
+ */
12532
+ type WidgetEventData = {
12533
+ [WidgetType.CONNECT]: {
12534
+ [ConnectEventType.SUCCESS]: ConnectionSuccess;
12535
+ [ConnectEventType.FAILURE]: ConnectionFailed;
12536
+ [ConnectEventType.CLOSE_WIDGET]: {};
12537
+ } & OrchestrationMapping & ProviderEventMapping;
12538
+ [WidgetType.WALLET]: {
12539
+ [WalletEventType.NETWORK_SWITCH]: WalletNetworkSwitch;
12540
+ [WalletEventType.DISCONNECT_WALLET]: WalletDisconnect;
12541
+ [WalletEventType.CLOSE_WIDGET]: {};
12542
+ } & OrchestrationMapping & ProviderEventMapping;
12543
+ [WidgetType.SWAP]: {
12544
+ [SwapEventType.SUCCESS]: SwapSuccess;
12545
+ [SwapEventType.FAILURE]: SwapFailed;
12546
+ [SwapEventType.REJECTED]: SwapRejected;
12547
+ [SwapEventType.CLOSE_WIDGET]: {};
12548
+ } & OrchestrationMapping & ProviderEventMapping;
12549
+ [WidgetType.BRIDGE]: {
12550
+ [BridgeEventType.SUCCESS]: BridgeSuccess;
12551
+ [BridgeEventType.FAILURE]: BridgeFailed;
12552
+ [BridgeEventType.CLOSE_WIDGET]: {};
12553
+ } & OrchestrationMapping & ProviderEventMapping;
12554
+ [WidgetType.ONRAMP]: {
12555
+ [OnRampEventType.SUCCESS]: OnRampSuccess;
12556
+ [OnRampEventType.FAILURE]: OnRampFailed;
12557
+ [OnRampEventType.CLOSE_WIDGET]: {};
12558
+ } & OrchestrationMapping & ProviderEventMapping;
12559
+ [WidgetType.SALE]: {
12560
+ [SaleEventType.SUCCESS]: SaleSuccess;
12561
+ [SaleEventType.FAILURE]: SaleFailed;
12562
+ [SaleEventType.REJECTED]: any;
12563
+ [SaleEventType.CLOSE_WIDGET]: {};
12564
+ [SaleEventType.TRANSACTION_SUCCESS]: SaleTransactionSuccess;
12565
+ } & OrchestrationMapping & ProviderEventMapping;
12566
+ };
12567
+ /**
12568
+ * Represents an event emitted by a widget. The event type should match the event data
12569
+ */
12570
+ /**
12571
+ * Represents an event emitted by a widget.
12572
+ * @template T - The widget type
12573
+ * @template KEventName - The widget event name.
12574
+ * @property {KEventName} type - The type of the event.
12575
+ * @property {WidgetEventData[T][KEventName]} data - The data associated with the widget event.
12576
+ */
12577
+ type WidgetEvent<T extends WidgetType, KEventName extends keyof WidgetEventData[T]> = {
12578
+ type: KEventName;
12579
+ data: WidgetEventData[T][KEventName];
12580
+ };
12581
+ /**
12582
+ * Represents an event emitted by a widget.
12583
+ * @template KEventName - The orchestration event name.
12584
+ * @property {KEventName} type
12585
+ * @property {OrchestrationMapping[KEventName]} data
12586
+ */
12587
+ type OrchestrationEvent<KEventName extends keyof OrchestrationMapping> = {
12588
+ /** The type of the event. */
12589
+ type: KEventName;
12590
+ /** The data associated with the event. */
12591
+ data: OrchestrationMapping[KEventName];
12592
+ };
12593
+ /**
12594
+ * Represents an event emitted by a widget.
12595
+ * @template KEventName - The provider event name.
12596
+ * @property {KEventName} type
12597
+ * @property {ProviderEventMapping[KEventName]} data
12598
+ */
12599
+ type ProviderEvent<KEventName extends keyof ProviderEventMapping> = {
12600
+ /** The type of the event. */
12601
+ type: KEventName;
12602
+ /** The data associated with the event. */
12603
+ data: ProviderEventMapping[KEventName];
12604
+ };
12605
+ interface IWidgetsFactory {
12606
+ /**
12607
+ * Create a new widget instance.
12608
+ * @param type widget type to instantiate.
12609
+ * @param props widget configurations and provider.
12610
+ */
12611
+ create<T extends WidgetType>(type: T, props?: WidgetProperties<T>): Widget<T>;
12612
+ /**
12613
+ * Update the widgets provider instance.
12614
+ * @param provider the provider instance to update all widgets.
12615
+ */
12616
+ updateProvider(provider: Web3Provider): void;
12617
+ }
12618
+ /**
12619
+ * Widget interface. Every widget implements this interface.
12620
+ */
12621
+ interface Widget<T extends WidgetType> {
12622
+ /**
12623
+ * Mount a widget to a DOM ref element.
12624
+ * @param id ID of the DOM element where the widget will be mounted.
12625
+ * @param params widget parameters.
12626
+ */
12627
+ mount(id: string, params?: WidgetParameters[T]): void;
12628
+ /**
12629
+ * Unmount a widget and reset parameters
12630
+ */
12631
+ unmount(): void;
12632
+ /**
12633
+ * Update the widget properties
12634
+ * @param props Widget specific properties including configuration
12635
+ */
12636
+ update(props: WidgetProperties<T>): void;
12637
+ /**
12638
+ * Add a listener for a widget event.
12639
+ * @param event Widget specific event name.
12640
+ * @param callback function to execute when the event is received.
12641
+ */
12642
+ addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12643
+ /**
12644
+ * Removes an event listener for a widget event.
12645
+ * @param type Widget specific event name.
12646
+ */
12647
+ removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12648
+ }
12649
+ /**
12650
+ * Represents the version of the Checkout Widgets to use defaults to (0.1.9-alpha)
12651
+ * @property {number} major
12652
+ * @property {number | undefined} minor
12653
+ * @property {number | undefined} patch
12654
+ * @property {'alpha' | undefined} prerelease
12655
+ * @property {number | undefined} build
12656
+ *
12657
+ * @example
12658
+ * { major: 0 } - use default version 0.1.9-alpha
12659
+ * { major: 1 } - use version 1.x.x, pickup all new minor and patch versions released
12660
+ * { major: 1, minor: 1 } - use version 1.1.x, pickup all new patch versions released
12661
+ * { major: 1, minor: 2, patch: 3 } - use version 1.2.3 specifically
12662
+ */
12663
+ type SemanticVersion = {
12664
+ /** The major version of the widgets, must specify a major version even if it is 0. */
12665
+ major: number;
12666
+ /** The minor version of the widgets, leaving this blank will use the latest minor based on major */
12667
+ minor?: number;
12668
+ /** The patch version of the widgets, leaving this blank will use the latest minor based on minor */
12669
+ patch?: number;
12670
+ /** The prerelease version of the widgets, can only be 'alpha'. Do not use in production. */
12671
+ prerelease?: 'alpha';
12672
+ /** The build version of the widgets. Do not use in production. */
12673
+ build?: number;
12674
+ };
12675
+ /**
12676
+ * Represents the global configuration options for the Checkout Widgets.
12677
+ * @property {WidgetTheme | undefined} theme
12678
+ * @property {Environment | undefined} environment
12679
+ * @property {SemanticVersion | undefined} version
12680
+ * @property {boolean | undefined} isOnRampEnabled
12681
+ * @property {boolean | undefined} isSwapEnabled
12682
+ * @property {boolean | undefined} isBridgeEnabled
12683
+ */
12684
+ type CheckoutWidgetsConfig = {
12685
+ /** The theme of the Checkout Widget (default: "DARK") */
12686
+ theme?: WidgetTheme;
12687
+ /** The environment configuration (default: "SANDBOX") */
12688
+ environment?: Environment;
12689
+ /** The version of the checkout widgets js file to use (default: "0.1.x") */
12690
+ version?: SemanticVersion;
12691
+ /** Enable on-ramp top-up method (default: "true") */
12692
+ isOnRampEnabled?: boolean;
12693
+ /** Enable swap top-up method (default: "true") */
12694
+ isSwapEnabled?: boolean;
12695
+ /** Enable bridge top-up method (default: "true") */
12696
+ isBridgeEnabled?: boolean;
12697
+ };
12698
+
12699
+ /**
12700
+ * Represents the configuration options for instantiating the Checkout Widgets factory.
12701
+ * @property {WidgetConfiguration} config - global configuration options for the widgets.
12702
+ * @property {SemanticVersion | undefined} version - version of the Checkout widgets bundle (default latest version will be used).
12703
+ */
12704
+ type WidgetsInit = {
12705
+ config: WidgetConfiguration;
12706
+ version?: SemanticVersion;
12707
+ };
12708
+
11901
12709
  declare class Checkout {
12710
+ private readOnlyProviders;
11902
12711
  readonly config: CheckoutConfiguration;
11903
12712
  readonly fiatRampService: FiatRampService;
11904
12713
  readonly availability: AvailabilityService;
12714
+ readonly passport?: Passport;
11905
12715
  /**
11906
12716
  * Constructs a new instance of the CheckoutModule class.
11907
12717
  * @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
11908
12718
  */
11909
12719
  constructor(config?: CheckoutModuleConfiguration);
12720
+ /**
12721
+ * Loads the widgets bundle and initiate the widgets factory.
12722
+ * @param {WidgetsInit} init - The initialisation parameters for loading the widgets bundle and applying configuration
12723
+ */
12724
+ widgets(init: WidgetsInit): Promise<ImmutableCheckoutWidgets.WidgetsFactory>;
11910
12725
  /**
11911
12726
  * Creates a provider using the given parameters.
11912
12727
  * @param {CreateProviderParams} params - The parameters for creating the provider.
@@ -12026,4 +12841,126 @@ declare class Checkout {
12026
12841
  isSwapAvailable(): Promise<boolean>;
12027
12842
  }
12028
12843
 
12029
- export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BridgeFundingStep, BuyOrder, BuyParams, BuyResult, BuyResultFailed, BuyResultInsufficientFunds, BuyResultSuccess, BuyToken, CHECKOUT_API_BASE_URL, CancelParams, CancelResult, CancelResultFailed, CancelResultSuccess, ChainId, ChainName, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutStatus, ConnectParams, ConnectResult, DexConfig, ERC20ItemRequirement, ERC721Balance, ERC721ItemRequirement, ErrorType, ExchangeType, FeePercentage, FeeToken, FiatRampParams, FulfillmentTransaction, FundingItem, FundingRoute, FundingStep, FundingStepType, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, ItemBalance, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, NoRouteOptions, NoRoutesFound, OnRampFundingStep, OrderFee, RemoteConfiguration, RoutesFound, RoutingOutcome, RoutingOutcomeType, SellOrder, SellParams, SellResult, SellResultFailed, SellResultInsufficientFunds, SellResultSuccess, SellToken, SendTransactionParams, SendTransactionResult, SmartCheckoutInsufficient, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SmartCheckoutSufficient, SwapFundingStep, SwitchNetworkParams, SwitchNetworkResult, TokenBalance, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletFilter, WalletFilterTypes, WalletInfo, WalletProviderName };
12844
+ /**
12845
+ * Declares global interfaces and namespaces for the application.
12846
+ * @global
12847
+ * @namespace ImmutableCheckoutWidgets
12848
+ * */
12849
+ declare global {
12850
+ namespace ImmutableCheckoutWidgets {
12851
+ class WidgetsFactory implements IWidgetsFactory {
12852
+ constructor(sdk: Checkout, config: CheckoutWidgetsConfig);
12853
+ create<T extends WidgetType>(type: T, props?: WidgetProperties<T>): Widget<T>;
12854
+ updateProvider(provider: Web3Provider): void;
12855
+ }
12856
+ class Connect<T extends WidgetType> implements Widget<T> {
12857
+ constructor(sdk: Checkout, props: WidgetProperties<T>);
12858
+ mount(id: string, params?: WidgetParameters[T]): void;
12859
+ unmount(): void;
12860
+ update(props: WidgetProperties<T>): void;
12861
+ addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12862
+ removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12863
+ }
12864
+ class Bridge<T extends WidgetType> implements Widget<T> {
12865
+ constructor(sdk: Checkout, props: WidgetProperties<T>);
12866
+ mount(id: string, params?: WidgetParameters[T]): void;
12867
+ unmount(): void;
12868
+ update(props: WidgetProperties<T>): void;
12869
+ addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12870
+ removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12871
+ }
12872
+ class Wallet<T extends WidgetType> implements Widget<T> {
12873
+ constructor(sdk: Checkout, props: WidgetProperties<T>);
12874
+ mount(id: string, params?: WidgetParameters[T]): void;
12875
+ unmount(): void;
12876
+ update(props: WidgetProperties<T>): void;
12877
+ addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12878
+ removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12879
+ }
12880
+ class Swap<T extends WidgetType> implements Widget<T> {
12881
+ constructor(sdk: Checkout, props: WidgetProperties<T>);
12882
+ mount(id: string, params?: WidgetParameters[T]): void;
12883
+ unmount(): void;
12884
+ update(props: WidgetProperties<T>): void;
12885
+ addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12886
+ removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12887
+ }
12888
+ class OnRamp<T extends WidgetType> implements Widget<T> {
12889
+ constructor(sdk: Checkout, props: WidgetProperties<T>);
12890
+ mount(id: string, params?: WidgetParameters[T]): void;
12891
+ unmount(): void;
12892
+ update(props: WidgetProperties<T>): void;
12893
+ addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12894
+ removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12895
+ }
12896
+ class Sale<T extends WidgetType> implements Widget<T> {
12897
+ constructor(sdk: Checkout, props: WidgetProperties<T>);
12898
+ mount(id: string, params?: WidgetParameters[T]): void;
12899
+ unmount(): void;
12900
+ update(props: WidgetProperties<T>): void;
12901
+ addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12902
+ removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12903
+ }
12904
+ }
12905
+ }
12906
+
12907
+ /**
12908
+ * Enum representing different types of errors that can occur during the checkout process.
12909
+ */
12910
+ declare enum CheckoutErrorType {
12911
+ WEB3_PROVIDER_ERROR = "WEB3_PROVIDER_ERROR",
12912
+ PROVIDER_ERROR = "PROVIDER_ERROR",
12913
+ DEFAULT_PROVIDER_ERROR = "DEFAULT_PROVIDER_ERROR",
12914
+ CONNECT_PROVIDER_ERROR = "CONNECT_PROVIDER_ERROR",
12915
+ GET_BALANCE_ERROR = "GET_BALANCE_ERROR",
12916
+ GET_INDEXER_BALANCE_ERROR = "GET_INDEXER_BALANCE_ERROR",
12917
+ GET_ERC20_BALANCE_ERROR = "GET_ERC20_BALANCE_ERROR",
12918
+ GET_ERC721_BALANCE_ERROR = "GET_ERC721_BALANCE_ERROR",
12919
+ GET_NETWORK_INFO_ERROR = "GET_NETWORK_INFO_ERROR",
12920
+ METAMASK_PROVIDER_ERROR = "METAMASK_PROVIDER_ERROR",
12921
+ CHAIN_NOT_SUPPORTED_ERROR = "CHAIN_NOT_SUPPORTED_ERROR",
12922
+ PROVIDER_REQUEST_MISSING_ERROR = "PROVIDER_REQUEST_MISSING_ERROR",
12923
+ PROVIDER_REQUEST_FAILED_ERROR = "PROVIDER_REQUEST_FAILED_ERROR",
12924
+ USER_REJECTED_REQUEST_ERROR = "USER_REJECTED_REQUEST_ERROR",
12925
+ TRANSACTION_FAILED = "TRANSACTION_FAILED",
12926
+ INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
12927
+ UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT",
12928
+ INVALID_GAS_ESTIMATE_TYPE = "INVALID_GAS_ESTIMATE_TYPE",
12929
+ UNSUPPORTED_TOKEN_TYPE_ERROR = "UNSUPPORTED_TOKEN_TYPE_ERROR",
12930
+ UNSUPPORTED_BALANCE_REQUIREMENT_ERROR = "UNSUPPORTED_BALANCE_REQUIREMENT_ERROR",
12931
+ GET_ORDER_LISTING_ERROR = "GET_ORDER_LISTING_ERROR",
12932
+ CANCEL_ORDER_LISTING_ERROR = "CANCEL_ORDER_LISTING_ERROR",
12933
+ PREPARE_ORDER_LISTING_ERROR = "PREPARE_ORDER_LISTING_ERROR",
12934
+ CREATE_ORDER_LISTING_ERROR = "CREATE_ORDER_LISTING_ERROR",
12935
+ FULFILL_ORDER_LISTING_ERROR = "FULFILL_ORDER_LISTING_ERROR",
12936
+ SWITCH_NETWORK_UNSUPPORTED = "SWITCH_NETWORK_UNSUPPORTED",
12937
+ GET_ERC20_ALLOWANCE_ERROR = "GET_ERC20_ALLOWANCE_ERROR",
12938
+ GET_ERC721_ALLOWANCE_ERROR = "GET_ERC721_ALLOWANCE_ERROR",
12939
+ EXECUTE_APPROVAL_TRANSACTION_ERROR = "EXECUTE_APPROVAL_TRANSACTION_ERROR",
12940
+ EXECUTE_FULFILLMENT_TRANSACTION_ERROR = "EXECUTE_FULFILLMENT_TRANSACTION_ERROR",
12941
+ SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR",
12942
+ BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR",
12943
+ ORDER_FEE_ERROR = "ORDER_FEE_ERROR",
12944
+ ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR",
12945
+ API_ERROR = "API_ERROR",
12946
+ ORDER_EXPIRED_ERROR = "ORDER_EXPIRED_ERROR",
12947
+ WIDGETS_SCRIPT_LOAD_ERROR = "WIDGETS_SCRIPT_LOAD_ERROR"
12948
+ }
12949
+ /**
12950
+ * Represents an error object with a specific type, optional message, and optional data.
12951
+ * @property {CheckoutErrorType} type
12952
+ * @property {string | undefined} [message]
12953
+ * @property {Object.<string, string> | undefined} [data]
12954
+ */
12955
+ type ErrorType = {
12956
+ /** The type of the error. */
12957
+ type: CheckoutErrorType;
12958
+ /** The error message. */
12959
+ message?: string;
12960
+ /** Additional data associated with the error. */
12961
+ data?: {
12962
+ [key: string]: string;
12963
+ };
12964
+ };
12965
+
12966
+ export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BridgeEventType, BridgeFailed, BridgeFundingStep, BridgeSuccess, BridgeWidgetConfiguration, BridgeWidgetParams, BuyOrder, BuyParams, BuyResult, BuyResultFailed, BuyResultInsufficientFunds, BuyResultSuccess, BuyToken, CHECKOUT_API_BASE_URL, CancelParams, CancelResult, CancelResultFailed, CancelResultSuccess, ChainId, ChainName, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutConfiguration, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutStatus, CheckoutWidgetsConfig, ConnectEventType, ConnectParams, ConnectResult, ConnectTargetLayer, ConnectWidgetConfiguration, ConnectWidgetParams, ConnectionFailed, ConnectionSuccess, DexConfig, ERC20ItemRequirement, ERC721Balance, ERC721ItemRequirement, ErrorType, ExchangeType, Fee, FeePercentage, FeeToken, FiatRampParams, FulfillmentTransaction, FundingItem, FundingRoute, FundingStep, FundingStepType, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, IMTBLWidgetEvents, IWidgetsFactory, ItemBalance, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, NoRouteOptions, NoRoutesFound, OnRampEventType, OnRampFailed, OnRampFundingStep, OnRampProviderFees, OnRampSuccess, OnRampWidgetParams, OnrampWidgetConfiguration, OrchestrationEvent, OrchestrationEventData, OrchestrationEventType, OrderFee, ProviderEvent, ProviderEventType, ProviderUpdated, RemoteConfiguration, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, RoutesFound, RoutingOutcome, RoutingOutcomeType, SaleEventType, SaleFailed, SaleItem, SaleSuccess, SaleTransactionSuccess, SaleWidgetConfiguration, SaleWidgetParams, SellOrder, SellParams, SellResult, SellResultFailed, SellResultInsufficientFunds, SellResultSuccess, SellToken, SemanticVersion, SendTransactionParams, SendTransactionResult, SmartCheckoutInsufficient, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SmartCheckoutSufficient, SwapEventType, SwapFailed, SwapFundingStep, SwapRejected, SwapSuccess, SwapWidgetConfiguration, SwapWidgetParams, SwitchNetworkParams, SwitchNetworkResult, TokenAmountEstimate, TokenBalance, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletDisconnect, WalletEventType, WalletFilter, WalletFilterTypes, WalletInfo, WalletNetworkSwitch, WalletProviderName, WalletWidgetConfiguration, WalletWidgetParams, Widget, WidgetConfiguration, WidgetConfigurations, WidgetEvent, WidgetEventData, WidgetEventTypes, WidgetParameters, WidgetProperties, WidgetTheme, WidgetType };