@imtbl/sdk 0.28.10-alpha.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,14 +41,6 @@ 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
-
52
44
  declare type Deferrable<T> = {
53
45
  [K in keyof T]: T[K] | Promise<T[K]>;
54
46
  };
@@ -58,6 +50,14 @@ declare class Description<T = any> {
58
50
  });
59
51
  }
60
52
 
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,6 +238,43 @@ 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
+
241
278
  declare type FormatFunc = (value: any) => any;
242
279
  declare type FormatFuncs = {
243
280
  [key: string]: FormatFunc;
@@ -438,43 +475,6 @@ declare class BaseProvider extends Provider$1 implements EnsProvider {
438
475
  removeAllListeners(eventName?: EventType): this;
439
476
  }
440
477
 
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,6 +546,104 @@ 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 publishableKey?: string;
558
+ constructor(options: {
559
+ environment: Environment;
560
+ });
561
+ }
562
+ type ImmutableConfigurationWithRequireableFields<T> = ImmutableConfiguration & (T extends {
563
+ apiKey: 'required';
564
+ } ? Required<{
565
+ apiKey: string;
566
+ }> : {}) & (T extends {
567
+ publishableKey: 'required';
568
+ } ? Required<{
569
+ publishableKey: string;
570
+ }> : {});
571
+ type ImmutableConfigurationWithOmitableFields<T> = (T extends {
572
+ apiKey: 'omit';
573
+ } ? Omit<ImmutableConfigurationWithRequireableFields<T>, 'apiKey'> : ImmutableConfigurationWithRequireableFields<T>);
574
+ interface ModuleConfiguration<T> {
575
+ baseConfig: ImmutableConfigurationWithOmitableFields<T>;
576
+ overrides?: T;
577
+ }
578
+
579
+ type ExchangeContracts = {
580
+ multicall: string;
581
+ coreFactory: string;
582
+ quoterV2: string;
583
+ peripheryRouter: string;
584
+ secondaryFee: string;
585
+ };
586
+ /**
587
+ * Type representing an ERC20 token
588
+ * @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
589
+ * @property {number} chainId - The chain ID
590
+ * @property {string} address - The token address
591
+ * @property {number} decimals - The token decimals
592
+ * @property {string | undefined} symbol - The token symbol or undefined if it is not available
593
+ * @property {string | undefined} name - The token name or undefined if it is not available
594
+ */
595
+ type ERC20 = {
596
+ type: 'erc20';
597
+ chainId: number;
598
+ address: string;
599
+ decimals: number;
600
+ symbol?: string;
601
+ name?: string;
602
+ };
603
+ /**
604
+ * Type representing a native token
605
+ * @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
606
+ * @property {number} chainId - The chain ID
607
+ * @property {number} decimals - The token decimals
608
+ * @property {string | undefined} symbol - The token symbol or undefined if it is not available
609
+ * @property {string | undefined} name - The token name or undefined if it is not available
610
+ */
611
+ type Native = {
612
+ type: 'native';
613
+ chainId: number;
614
+ decimals: number;
615
+ symbol?: string;
616
+ name?: string;
617
+ };
618
+ /**
619
+ * Type representing a token, either an {@link ERC20} or {@link Native}
620
+ */
621
+ type Coin = ERC20 | Native;
622
+ /**
623
+ * Type representing the overrides for the {@link Exchange} module
624
+ * @property {string} rpcURL - The RPC URL for the chain
625
+ * @property {ExchangeContracts} exchangeContracts - The DEX contract addresses
626
+ * @property {ERC20[]} commonRoutingTokens - The tokens used to find available pools for a swap
627
+ * @property {Coin} nativeToken - The native token of the chain
628
+ * @property {ERC20} wrappedNativeToken - The wrapped native token of the chain
629
+ */
630
+ type ExchangeOverrides = {
631
+ rpcURL: string;
632
+ exchangeContracts: ExchangeContracts;
633
+ commonRoutingTokens: ERC20[];
634
+ nativeToken: Coin;
635
+ wrappedNativeToken: ERC20;
636
+ };
637
+
638
+ /**
639
+ * @typedef {string} Address - Represents an Ethereum address.
640
+ */
641
+ type Address = string;
642
+ /**
643
+ * @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
644
+ */
645
+ type FungibleToken = Address | 'NATIVE';
646
+
549
647
  // TypeScript Version: 3.0
550
648
 
551
649
  type AxiosRequestHeaders = Record<string, string | number | boolean>;
@@ -10095,27 +10193,6 @@ interface IMXProvider {
10095
10193
  completeWithdrawal(starkPublicKey: string, token: AnyToken): Promise<TransactionResponse>;
10096
10194
  }
10097
10195
 
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 clientAppId?: string;
10107
- constructor(options: {
10108
- environment: Environment;
10109
- rateLimitingKey?: string;
10110
- apiKey?: string;
10111
- clientAppId?: string;
10112
- });
10113
- }
10114
- interface ModuleConfiguration<T> {
10115
- baseConfig: ImmutableConfiguration;
10116
- overrides?: T;
10117
- }
10118
-
10119
10196
  interface ImxOverrides {
10120
10197
  immutableXConfig: ImmutableXConfiguration;
10121
10198
  }
@@ -10656,7 +10733,6 @@ declare enum ChainName {
10656
10733
  IMTBL_ZKEVM_DEVNET = "Immutable zkEVM Dev",
10657
10734
  IMTBL_ZKEVM_MAINNET = "Immutable zkEVM"
10658
10735
  }
10659
-
10660
10736
  /**
10661
10737
  * Represents information about a token.
10662
10738
  * @interface TokenInfo
@@ -10673,7 +10749,6 @@ interface TokenInfo {
10673
10749
  address?: string;
10674
10750
  icon?: string;
10675
10751
  }
10676
-
10677
10752
  /**
10678
10753
  * Interface representing the parameters for {@link Checkout.getBalance}.
10679
10754
  * @property {Web3Provider} provider - The provider used to get the balance.
@@ -10714,7 +10789,6 @@ interface GetAllBalancesParams {
10714
10789
  interface GetAllBalancesResult {
10715
10790
  balances: GetBalanceResult[];
10716
10791
  }
10717
-
10718
10792
  interface OrderFee {
10719
10793
  amount: FeeToken | FeePercentage;
10720
10794
  recipient: string;
@@ -10725,7 +10799,6 @@ interface FeeToken {
10725
10799
  interface FeePercentage {
10726
10800
  percentageDecimal: number;
10727
10801
  }
10728
-
10729
10802
  type BuyResult = BuyResultSuccess | BuyResultFailed | BuyResultInsufficientFunds;
10730
10803
  /**
10731
10804
  * Represents the result of {@link Checkout.buy}
@@ -11263,7 +11336,6 @@ type AvailableRoutingOptions = {
11263
11336
  swap?: boolean;
11264
11337
  bridge?: boolean;
11265
11338
  };
11266
-
11267
11339
  /**
11268
11340
  * Interface representing the parameters for {@link Checkout.buy}
11269
11341
  * @property {Web3Provider} provider - The provider to use for the buy.
@@ -11274,7 +11346,6 @@ interface BuyParams {
11274
11346
  provider: Web3Provider;
11275
11347
  orders: Array<BuyOrder>;
11276
11348
  }
11277
-
11278
11349
  /**
11279
11350
  * Interface representing the parameters for {@link Checkout.cancel}
11280
11351
  * @property {Web3Provider} provider - The provider to use for the cancel.
@@ -11285,102 +11356,34 @@ interface CancelParams {
11285
11356
  provider: Web3Provider;
11286
11357
  orderIds: string[];
11287
11358
  }
11288
-
11289
- type ExchangeContracts = {
11290
- multicall: string;
11291
- coreFactory: string;
11292
- quoterV2: string;
11293
- peripheryRouter: string;
11294
- secondaryFee: string;
11295
- };
11359
+ interface CheckoutOverrides {
11360
+ }
11361
+ interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
11362
+ isOnRampEnabled?: boolean;
11363
+ isSwapEnabled?: boolean;
11364
+ isBridgeEnabled?: boolean;
11365
+ }
11296
11366
  /**
11297
- * Type representing an ERC20 token
11298
- * @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
11299
- * @property {number} chainId - The chain ID
11300
- * @property {string} address - The token address
11301
- * @property {number} decimals - The token decimals
11302
- * @property {string | undefined} symbol - The token symbol or undefined if it is not available
11303
- * @property {string | undefined} name - The token name or undefined if it is not available
11367
+ * A type representing various remotely defined configurations which are
11368
+ * accessible via the Checkout config and configured based on the Environment.
11369
+ * @property {DexConfig} dex - The config used for the DEX.
11370
+ * @property {OnRampConfig} onramp - The config used for the OnRamp
11371
+ * @property {AllowedNetworkConfig[]} allowedNetworks - An array representing the allowed networks.
11372
+ * @property {GasEstimateTokenConfig | undefined} gasEstimateTokens - The config for the tokens used to estimate gas.
11304
11373
  */
11305
- type ERC20 = {
11306
- type: 'erc20';
11307
- chainId: number;
11308
- address: string;
11309
- decimals: number;
11310
- symbol?: string;
11311
- name?: string;
11374
+ type RemoteConfiguration = {
11375
+ dex: DexConfig;
11376
+ onramp: OnRampConfig;
11377
+ bridge: BridgeConfig;
11378
+ allowedNetworks: AllowedNetworkConfig[];
11379
+ gasEstimateTokens?: GasEstimateTokenConfig;
11380
+ imxAddressMapping?: ImxAddressConfig;
11312
11381
  };
11313
11382
  /**
11314
- * Type representing a native token
11315
- * @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
11316
- * @property {number} chainId - The chain ID
11317
- * @property {number} decimals - The token decimals
11318
- * @property {string | undefined} symbol - The token symbol or undefined if it is not available
11319
- * @property {string | undefined} name - The token name or undefined if it is not available
11320
- */
11321
- type Native = {
11322
- type: 'native';
11323
- chainId: number;
11324
- decimals: number;
11325
- symbol?: string;
11326
- name?: string;
11327
- };
11328
- /**
11329
- * Type representing a token, either an {@link ERC20} or {@link Native}
11330
- */
11331
- type Coin = ERC20 | Native;
11332
- /**
11333
- * Type representing the overrides for the {@link Exchange} module
11334
- * @property {string} rpcURL - The RPC URL for the chain
11335
- * @property {ExchangeContracts} exchangeContracts - The DEX contract addresses
11336
- * @property {ERC20[]} commonRoutingTokens - The tokens used to find available pools for a swap
11337
- * @property {Coin} nativeToken - The native token of the chain
11338
- * @property {ERC20} wrappedNativeToken - The wrapped native token of the chain
11339
- */
11340
- type ExchangeOverrides = {
11341
- rpcURL: string;
11342
- exchangeContracts: ExchangeContracts;
11343
- commonRoutingTokens: ERC20[];
11344
- nativeToken: Coin;
11345
- wrappedNativeToken: ERC20;
11346
- };
11347
-
11348
- interface CheckoutOverrides {
11349
- }
11350
- /**
11351
- * A type representing checkout SDK configurations.
11352
- * @property {boolean} isOnRampEnabled - To enable on-ramp feature in Checkout sdk.
11353
- * @property {boolean} isSwapEnabled - To enable swap feature in Checkout sdk.
11354
- * @property {boolean} isBridgeEnabled - To enable bridge feature in Checkout sdk.
11355
- * @property {Passport} passport - To enable passport wallet with Checkout sdk.
11356
- */
11357
- interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
11358
- isOnRampEnabled?: boolean;
11359
- isSwapEnabled?: boolean;
11360
- isBridgeEnabled?: boolean;
11361
- passport?: Passport;
11362
- }
11363
- /**
11364
- * A type representing various remotely defined configurations which are
11365
- * accessible via the Checkout config and configured based on the Environment.
11366
- * @property {DexConfig} dex - The config used for the DEX.
11367
- * @property {OnRampConfig} onramp - The config used for the OnRamp
11368
- * @property {AllowedNetworkConfig[]} allowedNetworks - An array representing the allowed networks.
11369
- * @property {GasEstimateTokenConfig | undefined} gasEstimateTokens - The config for the tokens used to estimate gas.
11370
- */
11371
- type RemoteConfiguration = {
11372
- dex: DexConfig;
11373
- onramp: OnRampConfig;
11374
- bridge: BridgeConfig;
11375
- allowedNetworks: AllowedNetworkConfig[];
11376
- gasEstimateTokens?: GasEstimateTokenConfig;
11377
- imxAddressMapping?: ImxAddressConfig;
11378
- };
11379
- /**
11380
- * A type representing the fee structure for an OnRamp provider
11381
- * @property {string | undefined} minPercentage - minimum percentage fee shown if a fee range is provided
11382
- * @property {string | undefined} maxPercentage - maximum percentage fee shown if a fee range is provided
11383
- * @property {string | undefined} feePercentage - specific fee percentage shown if there is no range provided
11383
+ * A type representing the fee structure for an OnRamp provider
11384
+ * @property {string | undefined} minPercentage - minimum percentage fee shown if a fee range is provided
11385
+ * @property {string | undefined} maxPercentage - maximum percentage fee shown if a fee range is provided
11386
+ * @property {string | undefined} feePercentage - specific fee percentage shown if there is no range provided
11384
11387
  */
11385
11388
  type OnRampProviderFees = {
11386
11389
  minPercentage?: string;
@@ -11476,7 +11479,6 @@ type ChainTokensConfig = {
11476
11479
  allowed?: TokenInfo[];
11477
11480
  blockscout?: boolean;
11478
11481
  };
11479
-
11480
11482
  /**
11481
11483
  * Interface representing the params of {@link Checkout.connect}.
11482
11484
  * @property {Web3Provider} provider - The provider used to connect to the network.
@@ -11507,16 +11509,6 @@ interface CheckConnectionResult {
11507
11509
  isConnected: boolean;
11508
11510
  walletAddress: string;
11509
11511
  }
11510
-
11511
- /**
11512
- * @typedef {string} Address - Represents an Ethereum address.
11513
- */
11514
- type Address = string;
11515
- /**
11516
- * @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
11517
- */
11518
- type FungibleToken = Address | 'NATIVE';
11519
-
11520
11512
  /**
11521
11513
  * An enum representing the type of gas estimate.
11522
11514
  * @enum {string}
@@ -11580,7 +11572,6 @@ interface TokenAmountEstimate {
11580
11572
  estimatedAmount?: BigNumber;
11581
11573
  token?: TokenInfo;
11582
11574
  }
11583
-
11584
11575
  /**
11585
11576
  * Represents information about a network.
11586
11577
  * @interface NetworkInfo
@@ -11595,7 +11586,6 @@ interface NetworkInfo {
11595
11586
  nativeCurrency: TokenInfo;
11596
11587
  isSupported: boolean;
11597
11588
  }
11598
-
11599
11589
  /**
11600
11590
  * Interface representing the parameters for {@link Checkout.switchNetwork}.
11601
11591
  * @property {Web3Provider} provider - The provider to connect to the network.
@@ -11651,7 +11641,6 @@ declare enum NetworkFilterTypes {
11651
11641
  interface NetworkFilter {
11652
11642
  chainId: ChainId;
11653
11643
  }
11654
-
11655
11644
  /**
11656
11645
  * Interface representing the parameters for {@link Checkout.sell}
11657
11646
  * @property {Web3Provider} provider - The provider to use for the sell.
@@ -11662,7 +11651,6 @@ interface SellParams {
11662
11651
  provider: Web3Provider;
11663
11652
  orders: Array<SellOrder>;
11664
11653
  }
11665
-
11666
11654
  /**
11667
11655
  * Interface representing the parameters for {@link Checkout.getTokenAllowList}.
11668
11656
  * @property {TokenFilterTypes} type - The type of token to retrieve.
@@ -11697,7 +11685,6 @@ declare enum TokenFilterTypes {
11697
11685
  interface TokenFilter {
11698
11686
  address: string;
11699
11687
  }
11700
-
11701
11688
  /**
11702
11689
  * Interface representing the parameters for {@link Checkout.sendTransaction}.
11703
11690
  * @property {Web3Provider} provider - The provider to connect to the network.
@@ -11714,7 +11701,6 @@ interface SendTransactionParams {
11714
11701
  interface SendTransactionResult {
11715
11702
  transactionResponse: TransactionResponse;
11716
11703
  }
11717
-
11718
11704
  /**
11719
11705
  * Enum representing the names of different wallet providers.
11720
11706
  */
@@ -11725,27 +11711,29 @@ declare enum WalletProviderName {
11725
11711
  /**
11726
11712
  * Interface for the parameters required to create a wallet provider {@link Checkout.createProvider}.
11727
11713
  * @interface CreateProviderParams
11728
- * @property {WalletProviderName} walletProviderName - The wallet provider name to create a provider for.
11714
+ * @property {WalletProviderName} walletProvider - The name of the wallet provider.
11715
+ * @property {Passport | undefined} passport - The Passport instance required to create a provider for passport users.
11716
+ * If walletProvider is 'passport', then the passport instance must be passed in.
11729
11717
  */
11730
11718
  interface CreateProviderParams {
11731
- walletProviderName: WalletProviderName;
11719
+ walletProvider: WalletProviderName;
11720
+ passport?: Passport;
11732
11721
  }
11733
11722
  /**
11734
11723
  * Represents the result of creating a Web3 provider {@link Checkout.createProvider}.
11735
11724
  * @property {Web3Provider} provider - The created Web3 provider.
11736
- * @property {WalletProviderName} walletProviderName - The wallet provider name of the provider that was created.
11725
+ * @property {WalletProviderName} providerName - The name of the wallet provider.
11737
11726
  */
11738
11727
  type CreateProviderResult = {
11739
11728
  provider: Web3Provider;
11740
11729
  walletProviderName: WalletProviderName;
11741
11730
  };
11742
-
11743
11731
  /**
11744
11732
  * Interface representing a wallet filter to be used in {@link GetWalletAllowListParams}.
11745
- * @property {WalletProviderName} walletProviderName - The wallet provider name to filter wallets by.
11733
+ * @property {WalletProviderName} connectionProvider - The connection provider to filter wallets by.
11746
11734
  */
11747
11735
  interface WalletFilter {
11748
- walletProviderName: WalletProviderName;
11736
+ walletProvider: WalletProviderName;
11749
11737
  }
11750
11738
  /**
11751
11739
  * Interface representing the parameters for {@link Checkout.getWalletAllowList}.
@@ -11758,12 +11746,14 @@ interface GetWalletAllowListParams {
11758
11746
  }
11759
11747
  /**
11760
11748
  * Interface representing information about a wallet used in {@link GetWalletAllowListResult}.
11761
- * @property {WalletProviderName} walletProviderName - The wallet provider name for the wallet.
11749
+ * @property {WalletProviderName} walletProvider - The connection provider for the wallet.
11750
+ * @property {string} name - The name of the wallet.
11762
11751
  * @property {string | undefined} description - A description of the wallet.
11763
11752
  * @property {string | undefined} icon - The URL/data:image of an icon for the wallet.
11764
11753
  */
11765
11754
  interface WalletInfo {
11766
- walletProviderName: WalletProviderName;
11755
+ walletProvider: WalletProviderName;
11756
+ name: string;
11767
11757
  description?: string;
11768
11758
  icon?: string;
11769
11759
  }
@@ -11780,7 +11770,6 @@ interface GetWalletAllowListResult {
11780
11770
  declare enum WalletFilterTypes {
11781
11771
  ALL = "all"
11782
11772
  }
11783
-
11784
11773
  /**
11785
11774
  * Base URL for the checkout API based on the environment.
11786
11775
  * @property {string} DEVELOPMENT - The base URL for the development environment.
@@ -11800,7 +11789,6 @@ type NetworkDetails = {
11800
11789
  blockExplorerUrls?: string[];
11801
11790
  };
11802
11791
  type NetworkMap = Map<ChainId, NetworkDetails>;
11803
-
11804
11792
  /**
11805
11793
  * An enum representing the type of exchange.
11806
11794
  * @enum {string}
@@ -11822,27 +11810,71 @@ interface FiatRampParams {
11822
11810
  web3Provider: Web3Provider;
11823
11811
  tokenAmount?: string;
11824
11812
  tokenAddress?: string;
11825
- passport?: any;
11813
+ passport?: Passport;
11826
11814
  }
11827
-
11815
+ /**
11816
+ * Enum representing different types of errors that can occur during the checkout process.
11817
+ */
11818
+ declare enum CheckoutErrorType {
11819
+ WEB3_PROVIDER_ERROR = "WEB3_PROVIDER_ERROR",
11820
+ PROVIDER_ERROR = "PROVIDER_ERROR",
11821
+ DEFAULT_PROVIDER_ERROR = "DEFAULT_PROVIDER_ERROR",
11822
+ CONNECT_PROVIDER_ERROR = "CONNECT_PROVIDER_ERROR",
11823
+ GET_BALANCE_ERROR = "GET_BALANCE_ERROR",
11824
+ GET_INDEXER_BALANCE_ERROR = "GET_INDEXER_BALANCE_ERROR",
11825
+ GET_ERC20_BALANCE_ERROR = "GET_ERC20_BALANCE_ERROR",
11826
+ GET_ERC721_BALANCE_ERROR = "GET_ERC721_BALANCE_ERROR",
11827
+ GET_NETWORK_INFO_ERROR = "GET_NETWORK_INFO_ERROR",
11828
+ METAMASK_PROVIDER_ERROR = "METAMASK_PROVIDER_ERROR",
11829
+ CHAIN_NOT_SUPPORTED_ERROR = "CHAIN_NOT_SUPPORTED_ERROR",
11830
+ PROVIDER_REQUEST_MISSING_ERROR = "PROVIDER_REQUEST_MISSING_ERROR",
11831
+ PROVIDER_REQUEST_FAILED_ERROR = "PROVIDER_REQUEST_FAILED_ERROR",
11832
+ USER_REJECTED_REQUEST_ERROR = "USER_REJECTED_REQUEST_ERROR",
11833
+ TRANSACTION_FAILED = "TRANSACTION_FAILED",
11834
+ INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
11835
+ UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT",
11836
+ INVALID_GAS_ESTIMATE_TYPE = "INVALID_GAS_ESTIMATE_TYPE",
11837
+ UNSUPPORTED_TOKEN_TYPE_ERROR = "UNSUPPORTED_TOKEN_TYPE_ERROR",
11838
+ UNSUPPORTED_BALANCE_REQUIREMENT_ERROR = "UNSUPPORTED_BALANCE_REQUIREMENT_ERROR",
11839
+ GET_ORDER_LISTING_ERROR = "GET_ORDER_LISTING_ERROR",
11840
+ CANCEL_ORDER_LISTING_ERROR = "CANCEL_ORDER_LISTING_ERROR",
11841
+ PREPARE_ORDER_LISTING_ERROR = "PREPARE_ORDER_LISTING_ERROR",
11842
+ CREATE_ORDER_LISTING_ERROR = "CREATE_ORDER_LISTING_ERROR",
11843
+ FULFILL_ORDER_LISTING_ERROR = "FULFILL_ORDER_LISTING_ERROR",
11844
+ SWITCH_NETWORK_UNSUPPORTED = "SWITCH_NETWORK_UNSUPPORTED",
11845
+ GET_ERC20_ALLOWANCE_ERROR = "GET_ERC20_ALLOWANCE_ERROR",
11846
+ GET_ERC721_ALLOWANCE_ERROR = "GET_ERC721_ALLOWANCE_ERROR",
11847
+ EXECUTE_APPROVAL_TRANSACTION_ERROR = "EXECUTE_APPROVAL_TRANSACTION_ERROR",
11848
+ EXECUTE_FULFILLMENT_TRANSACTION_ERROR = "EXECUTE_FULFILLMENT_TRANSACTION_ERROR",
11849
+ SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR",
11850
+ BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR",
11851
+ ORDER_FEE_ERROR = "ORDER_FEE_ERROR",
11852
+ ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR",
11853
+ API_ERROR = "API_ERROR",
11854
+ ORDER_EXPIRED_ERROR = "ORDER_EXPIRED_ERROR"
11855
+ }
11856
+ /**
11857
+ * Represents an error object with a specific type, optional message, and optional data.
11858
+ * @property {CheckoutErrorType} type - The type of the error.
11859
+ * @property {string | undefined} [message] - The error message.
11860
+ * @property {Object.<string, string> | undefined} [data] - Additional data associated with the error.
11861
+ */
11862
+ type ErrorType = {
11863
+ type: CheckoutErrorType;
11864
+ message?: string;
11865
+ data?: {
11866
+ [key: string]: string;
11867
+ };
11868
+ };
11828
11869
  type RemoteConfigParams = {
11829
11870
  isDevelopment: boolean;
11830
11871
  isProduction: boolean;
11831
11872
  };
11832
11873
  declare class RemoteConfigFetcher {
11833
- private isDevelopment;
11834
- private isProduction;
11835
- private configCache;
11836
- private tokensCache;
11837
11874
  constructor(params: RemoteConfigParams);
11838
- private static makeHttpRequest;
11839
- private getEndpoint;
11840
- private loadConfig;
11841
- private loadConfigTokens;
11842
11875
  getConfig(key?: keyof RemoteConfiguration): Promise<RemoteConfiguration | RemoteConfiguration[keyof RemoteConfiguration] | undefined>;
11843
11876
  getTokensConfig(chainId: ChainId): Promise<ChainTokensConfig>;
11844
11877
  }
11845
-
11846
11878
  declare class CheckoutConfiguration {
11847
11879
  readonly isDevelopment: boolean;
11848
11880
  readonly isProduction: boolean;
@@ -11854,7 +11886,9 @@ declare class CheckoutConfiguration {
11854
11886
  readonly networkMap: NetworkMap;
11855
11887
  constructor(config: CheckoutModuleConfiguration);
11856
11888
  }
11857
-
11889
+ type AvailabilityService = {
11890
+ checkDexAvailability: () => Promise<boolean>;
11891
+ };
11858
11892
  interface FiatRampWidgetParams {
11859
11893
  exchangeType: ExchangeType;
11860
11894
  isPassport: boolean;
@@ -11872,613 +11906,16 @@ declare class FiatRampService {
11872
11906
  constructor(config: CheckoutConfiguration);
11873
11907
  feeEstimate(): Promise<OnRampProviderFees>;
11874
11908
  createWidgetUrl(params: FiatRampWidgetParams): Promise<string>;
11875
- private getTransakWidgetUrl;
11876
- }
11877
-
11878
- type AvailabilityService = {
11879
- checkDexAvailability: () => Promise<boolean>;
11880
- };
11881
-
11882
- /**
11883
- * Enum representing the themes for the widgets.
11884
- */
11885
- declare enum WidgetTheme {
11886
- LIGHT = "light",
11887
- DARK = "dark"
11888
- }
11889
-
11890
- /**
11891
- * Represents the local configuration options for the Checkout Widgets.
11892
- * @property {WidgetTheme | undefined} theme - The theme of the Checkout Widget (default: "DARK")
11893
- */
11894
- type WidgetConfiguration = {
11895
- theme?: WidgetTheme;
11896
- };
11897
-
11898
- /**
11899
- * Enum representing the events emitted by the widgets.
11900
- */
11901
- declare enum IMTBLWidgetEvents {
11902
- IMTBL_WIDGETS_PROVIDER = "imtbl-widgets-provider",
11903
- IMTBL_CONNECT_WIDGET_EVENT = "imtbl-connect-widget",
11904
- IMTBL_WALLET_WIDGET_EVENT = "imtbl-wallet-widget",
11905
- IMTBL_SWAP_WIDGET_EVENT = "imtbl-swap-widget",
11906
- IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget",
11907
- IMTBL_ONRAMP_WIDGET_EVENT = "imtbl-onramp-widget",
11908
- IMTBL_SALE_WIDGET_EVENT = "imtbl-sale-widget"
11909
- }
11910
- /**
11911
- * Enum for events raised for about provider objects
11912
- */
11913
- declare enum ProviderEventType {
11914
- PROVIDER_UPDATED = "PROVIDER_UPDATED"
11915
- }
11916
- /**
11917
- * Payload type for the PROVIDER_UPDATED event
11918
- */
11919
- type ProviderUpdated = {
11920
- provider: Web3Provider;
11921
- };
11922
-
11923
- /**
11924
- * Enum representing possible Connect Widget event types.
11925
- */
11926
- declare enum ConnectEventType {
11927
- CLOSE_WIDGET = "close-widget",
11928
- SUCCESS = "success",
11929
- FAILURE = "failure"
11930
- }
11931
- /**
11932
- * Represents a successful connection.
11933
- * @property {Web3Provider} provider - The connected provider.
11934
- * @property {WalletProviderName | undefined} walletProviderName - The wallet provider name of the connected provider.
11935
- */
11936
- type ConnectionSuccess = {
11937
- provider: Web3Provider;
11938
- walletProviderName: WalletProviderName | undefined;
11939
- };
11940
- /**
11941
- * Represents a connection failure with a reason.
11942
- * @property {string} reason - The reason for the failed connection.
11943
- */
11944
- type ConnectionFailed = {
11945
- reason: string;
11946
- };
11947
-
11948
- /**
11949
- * Enum representing possible Wallet Widget event types.
11950
- */
11951
- declare enum WalletEventType {
11952
- CLOSE_WIDGET = "close-widget",
11953
- NETWORK_SWITCH = "network-switch",
11954
- DISCONNECT_WALLET = "disconnect-wallet"
11955
- }
11956
- /**
11957
- * Represents an event that is triggered when the user switches the network in their wallet.
11958
- * @property {string} network - The name of the network that the user switched to.
11959
- * @property {number} chainId - The chain ID of the network that the user switched to.
11960
- * @property {Web3Provider} provider - The Web3 provider object for the switched network.
11961
- */
11962
- type WalletNetworkSwitch = {
11963
- network: string;
11964
- chainId: number;
11965
- provider: Web3Provider;
11966
- };
11967
- /**
11968
- * Represents an event that is triggered when a wallet is disconnected.
11969
- */
11970
- type WalletDisconnect = {};
11971
-
11972
- /**
11973
- * Enum representing possible Swap Widget event types.
11974
- */
11975
- declare enum SwapEventType {
11976
- CLOSE_WIDGET = "close-widget",
11977
- SUCCESS = "success",
11978
- FAILURE = "failure",
11979
- REJECTED = "rejected"
11980
- }
11981
- /**
11982
- * Represents a successful swap transaction.
11983
- * @property {string} transactionHash - The hash of the successful transaction.
11984
- */
11985
- type SwapSuccess = {
11986
- transactionHash: string;
11987
- };
11988
- /**
11989
- * Type representing a Swap Widget with type FAILURE.
11990
- * @property {string} reason - The reason why the swap failed.
11991
- * @property {number} timestamp - The timestamp of the failed swap.
11992
- */
11993
- type SwapFailed = {
11994
- reason: string;
11995
- timestamp: number;
11996
- };
11997
- /**
11998
- * Type representing a Swap Widget with type REJECTED.
11999
- * @property {string} reason - The reason why the swap failed.
12000
- * @property {number} timestamp - The timestamp of the failed swap.
12001
- */
12002
- type SwapRejected = {
12003
- reason: string;
12004
- timestamp: number;
12005
- };
12006
-
12007
- /**
12008
- * Enum representing possible Sale Widget event types.
12009
- */
12010
- declare enum SaleEventType {
12011
- CLOSE_WIDGET = "close-widget",
12012
- SUCCESS = "success",
12013
- FAILURE = "failure",
12014
- REJECTED = "rejected",
12015
- TRANSACTION_SUCCESS = "transaction-success"
12016
- }
12017
- /**
12018
- * Represents a successful Sale transaction.
12019
- * @property {Array} transactions - The executed transactions
12020
- */
12021
- type SaleSuccess = {
12022
- transactions: {
12023
- method: string;
12024
- hash: string | undefined;
12025
- }[];
12026
- [key: string]: unknown;
12027
- };
12028
- /**
12029
- * Type representing a Sale Widget with type FAILURE.
12030
- * @property {string} reason - The reason why the swap failed.
12031
- * @property {number} timestamp - The timestamp of the failed swap.
12032
- * @property {Array} transactions - The executed transactions
12033
- */
12034
- type SaleFailed = {
12035
- reason: string;
12036
- timestamp: number;
12037
- transactions: {
12038
- method: string;
12039
- hash: string | undefined;
12040
- }[];
12041
- };
12042
- /**
12043
- * Type representing a Sale Widget with type TRANSACTION_SUCCESS.
12044
- * @property {Object} transactions - The executed transactions
12045
- */
12046
- type SaleTransactionSuccess = {
12047
- transactions: {
12048
- method: string;
12049
- hash: string | undefined;
12050
- }[];
12051
- };
12052
-
12053
- /**
12054
- * Enum of possible Bridge Widget event types.
12055
- */
12056
- declare enum BridgeEventType {
12057
- CLOSE_WIDGET = "close-widget",
12058
- SUCCESS = "success",
12059
- FAILURE = "failure"
12060
11909
  }
12061
- /**
12062
- * Represents a successful bridge transaction.
12063
- * @property {string} transactionHash - The hash of the successful transaction.
12064
- */
12065
- type BridgeSuccess = {
12066
- transactionHash: string;
12067
- };
12068
- /**
12069
- * Represents a failed bridge transaction.
12070
- * @property {string} reason - The reason for the failed transaction.
12071
- * @property {number} timestamp - The timestamp of the failed transaction.
12072
- */
12073
- type BridgeFailed = {
12074
- reason: string;
12075
- timestamp: number;
12076
- };
12077
-
12078
- /**
12079
- * Enum representing different types of orchestration events.
12080
- */
12081
- declare enum OrchestrationEventType {
12082
- REQUEST_CONNECT = "request-connect",
12083
- REQUEST_WALLET = "request-wallet",
12084
- REQUEST_SWAP = "request-swap",
12085
- REQUEST_BRIDGE = "request-bridge",
12086
- REQUEST_ONRAMP = "request-onramp"
12087
- }
12088
- /**
12089
- * Represents the connect event object when the connect widget is requested.
12090
- * @property {string} walletProviderName - The wallet provider name.
12091
- */
12092
- type RequestConnectEvent = {
12093
- walletProviderName: string;
12094
- };
12095
- /**
12096
- * Represents the wallet event object when the wallet widget is requested.
12097
- * @property {string} walletProviderName - The wallet provider name.
12098
- */
12099
- type RequestWalletEvent = {
12100
- walletProviderName: string;
12101
- };
12102
- /**
12103
- * Represents the swap event object when the swap widget is requested.
12104
- * @property {string} fromTokenAddress - The address of the token to swap from.
12105
- * @property {string} toTokenAddress - The address of the token to swap to.
12106
- * @property {string} amount - The amount of from tokens to swap.
12107
- */
12108
- type RequestSwapEvent = {
12109
- fromTokenAddress: string;
12110
- toTokenAddress: string;
12111
- amount: string;
12112
- };
12113
- /**
12114
- * Represents the bridge event object when the bridge widget is requested.
12115
- * @property {string} tokenAddress - The address of the token to bridge.
12116
- * @property {string} amount - The amount of tokens to bridge.
12117
- */
12118
- type RequestBridgeEvent = {
12119
- tokenAddress: string;
12120
- amount: string;
12121
- };
12122
- /**
12123
- * Represents the onramp event object when the onramp widget is requested.
12124
- * @property {string} tokenAddress - The address of the token to be used for onramp.
12125
- * @property {string} amount - The amount of tokens to onramp.
12126
- */
12127
- type RequestOnrampEvent = {
12128
- tokenAddress: string;
12129
- amount: string;
12130
- };
12131
- type OrchestrationEventData = RequestConnectEvent | RequestWalletEvent | RequestSwapEvent | RequestBridgeEvent | RequestOnrampEvent;
12132
-
12133
- /**
12134
- * Enum of possible OnRamp Widget event types.
12135
- */
12136
- declare enum OnRampEventType {
12137
- CLOSE_WIDGET = "close-widget",
12138
- SUCCESS = "success",
12139
- FAILURE = "failure"
12140
- }
12141
- /**
12142
- * Represents a successful on-ramp transaction.
12143
- * @property {string} transactionHash - The transaction hash of the successful transaction.
12144
- */
12145
- type OnRampSuccess = {
12146
- transactionHash: string;
12147
- };
12148
- /**
12149
- * Type representing a On-ramp Widget with type FAILURE.
12150
- * @property {string} reason - The reason why the on-ramp failed.
12151
- * @property {number} timestamp - The timestamp of the failed transaction.
12152
- */
12153
- type OnRampFailed = {
12154
- reason: string;
12155
- timestamp: number;
12156
- };
12157
-
12158
- declare enum ConnectTargetLayer {
12159
- LAYER1 = "LAYER1",
12160
- LAYER2 = "LAYER2"
12161
- }
12162
- type ConnectWidgetParams = {};
12163
-
12164
- /**
12165
- * Bridge Widget parameters
12166
- * @property {string | undefined} fromContractAddress - The contract address of the token to bridge from, used to populate the bridge form token field
12167
- * @property {string | undefined} amount - The formatted amount to bridge, used to populate the bridge form amount field
12168
- * @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the bridge widget
12169
- */
12170
- type BridgeWidgetParams = {
12171
- fromContractAddress?: string;
12172
- amount?: string;
12173
- walletProviderName?: WalletProviderName;
12174
- };
12175
-
12176
- /**
12177
- * Wallet Widget parameters
12178
- * @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the wallet widget
12179
- * @property {Web3Provider | undefined} web3Provider - The ethers Web3Provider
12180
- */
12181
- type WalletWidgetParams = {
12182
- walletProviderName?: WalletProviderName;
12183
- };
12184
-
12185
- /**
12186
- * Swap Widget parameters
12187
- * @property {string | undefined} amount - The formatted amount to swap, used to populate the swap from amount field
12188
- * @property {string | undefined} fromContractAddress - The contract address of the token to swap from
12189
- * @property {string | undefined} toContractAddress - The contract address of the token to swap to
12190
- * @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the swap widget
12191
- */
12192
- interface SwapWidgetParams {
12193
- amount?: string;
12194
- fromContractAddress?: string;
12195
- toContractAddress?: string;
12196
- walletProviderName?: WalletProviderName;
12197
- }
12198
-
12199
- /**
12200
- * OnRamp Widget parameters
12201
- * @property {string | undefined} contractAddress - The contract address of the token to onramp
12202
- * @property {string | undefined} amount - The formatted amount to onramp, used to populate the onramp form amount field
12203
- * @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the onramp widget
12204
- */
12205
- type OnRampWidgetParams = {
12206
- contractAddress?: string;
12207
- amount?: string;
12208
- walletProviderName?: WalletProviderName;
12209
- };
12210
-
12211
- /**
12212
- * Sale Widget parameters
12213
- * @property {string} amount - The total price to pay for the items in the sale
12214
- * @property {SaleItem[]} items - The list of products to be purchased
12215
- * @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to default to if no web3Provider is passed
12216
- */
12217
- type SaleWidgetParams = {
12218
- amount?: string;
12219
- environmentId?: string;
12220
- fromContractAddress?: string;
12221
- items?: SaleItem[];
12222
- walletProviderName?: WalletProviderName;
12223
- };
12224
- type SaleItem = {
12225
- productId: string;
12226
- qty: number;
12227
- name: string;
12228
- image: string;
12229
- description: string;
12230
- };
12231
-
12232
- type ConnectWidgetConfiguration = {} & WidgetConfiguration;
12233
-
12234
- type BridgeWidgetConfiguration = {} & WidgetConfiguration;
12235
-
12236
- type WalletWidgetConfiguration = {} & WidgetConfiguration;
12237
-
12238
- type SwapWidgetConfiguration = {} & WidgetConfiguration;
12239
-
12240
- type OnrampWidgetConfiguration = {} & WidgetConfiguration;
12241
-
12242
- type SaleWidgetConfiguration = {} & WidgetConfiguration;
12243
-
12244
- /**
12245
- * Enum representing the list of widget types.
12246
- */
12247
- declare enum WidgetType {
12248
- CONNECT = "connect",
12249
- WALLET = "wallet",
12250
- SWAP = "swap",
12251
- BRIDGE = "bridge",
12252
- ONRAMP = "onramp",
12253
- SALE = "sale"
12254
- }
12255
- /**
12256
- * Widget properties definition for each widget. Used for creating and updating widgets
12257
- */
12258
- type WidgetProperties<T extends WidgetType> = {
12259
- config?: WidgetConfigurations[T];
12260
- provider?: Web3Provider;
12261
- };
12262
- type WidgetConfigurations = {
12263
- [WidgetType.CONNECT]: ConnectWidgetConfiguration;
12264
- [WidgetType.WALLET]: WalletWidgetConfiguration;
12265
- [WidgetType.SWAP]: SwapWidgetConfiguration;
12266
- [WidgetType.BRIDGE]: BridgeWidgetConfiguration;
12267
- [WidgetType.ONRAMP]: OnrampWidgetConfiguration;
12268
- [WidgetType.SALE]: SaleWidgetConfiguration;
12269
- };
12270
- type WidgetParameters = {
12271
- [WidgetType.CONNECT]: ConnectWidgetParams;
12272
- [WidgetType.WALLET]: WalletWidgetParams;
12273
- [WidgetType.SWAP]: SwapWidgetParams;
12274
- [WidgetType.BRIDGE]: BridgeWidgetParams;
12275
- [WidgetType.ONRAMP]: OnRampWidgetParams;
12276
- [WidgetType.SALE]: SaleWidgetParams;
12277
- };
12278
- /**
12279
- * Represents all the possible event types that are emitted by the widgets.
12280
- */
12281
- type WidgetEventTypes = {
12282
- [WidgetType.CONNECT]: ConnectEventType | OrchestrationEventType;
12283
- [WidgetType.WALLET]: WalletEventType | OrchestrationEventType;
12284
- [WidgetType.SWAP]: SwapEventType | OrchestrationEventType;
12285
- [WidgetType.BRIDGE]: BridgeEventType | OrchestrationEventType;
12286
- [WidgetType.ONRAMP]: OnRampEventType | OrchestrationEventType;
12287
- [WidgetType.SALE]: SaleEventType | OrchestrationEventType;
12288
- };
12289
- type OrchestrationMapping = {
12290
- [OrchestrationEventType.REQUEST_CONNECT]: RequestConnectEvent;
12291
- [OrchestrationEventType.REQUEST_WALLET]: RequestWalletEvent;
12292
- [OrchestrationEventType.REQUEST_SWAP]: RequestSwapEvent;
12293
- [OrchestrationEventType.REQUEST_BRIDGE]: RequestBridgeEvent;
12294
- [OrchestrationEventType.REQUEST_ONRAMP]: RequestOnrampEvent;
12295
- };
12296
- type ProviderEventMapping = {
12297
- [ProviderEventType.PROVIDER_UPDATED]: ProviderUpdated;
12298
- };
12299
- /**
12300
- * Mapping of widget type, to each of it's events and then each event's payload
12301
- * Update this whenever a new event is created and used by a widget
12302
- * Each widget also has all of the orchestration events
12303
- */
12304
- type WidgetEventData = {
12305
- [WidgetType.CONNECT]: {
12306
- [ConnectEventType.SUCCESS]: ConnectionSuccess;
12307
- [ConnectEventType.FAILURE]: ConnectionFailed;
12308
- [ConnectEventType.CLOSE_WIDGET]: {};
12309
- } & OrchestrationMapping & ProviderEventMapping;
12310
- [WidgetType.WALLET]: {
12311
- [WalletEventType.NETWORK_SWITCH]: WalletNetworkSwitch;
12312
- [WalletEventType.DISCONNECT_WALLET]: WalletDisconnect;
12313
- [WalletEventType.CLOSE_WIDGET]: {};
12314
- } & OrchestrationMapping & ProviderEventMapping;
12315
- [WidgetType.SWAP]: {
12316
- [SwapEventType.SUCCESS]: SwapSuccess;
12317
- [SwapEventType.FAILURE]: SwapFailed;
12318
- [SwapEventType.REJECTED]: SwapRejected;
12319
- [SwapEventType.CLOSE_WIDGET]: {};
12320
- } & OrchestrationMapping & ProviderEventMapping;
12321
- [WidgetType.BRIDGE]: {
12322
- [BridgeEventType.SUCCESS]: BridgeSuccess;
12323
- [BridgeEventType.FAILURE]: BridgeFailed;
12324
- [BridgeEventType.CLOSE_WIDGET]: {};
12325
- } & OrchestrationMapping & ProviderEventMapping;
12326
- [WidgetType.ONRAMP]: {
12327
- [OnRampEventType.SUCCESS]: OnRampSuccess;
12328
- [OnRampEventType.FAILURE]: OnRampFailed;
12329
- [OnRampEventType.CLOSE_WIDGET]: {};
12330
- } & OrchestrationMapping & ProviderEventMapping;
12331
- [WidgetType.SALE]: {
12332
- [SaleEventType.SUCCESS]: SaleSuccess;
12333
- [SaleEventType.FAILURE]: SaleFailed;
12334
- [SaleEventType.REJECTED]: any;
12335
- [SaleEventType.CLOSE_WIDGET]: {};
12336
- [SaleEventType.TRANSACTION_SUCCESS]: SaleTransactionSuccess;
12337
- } & OrchestrationMapping & ProviderEventMapping;
12338
- };
12339
- /**
12340
- * Represents an event emitted by a widget. The event type should match the event data
12341
- */
12342
- /**
12343
- * Represents an event emitted by a widget.
12344
- * @template T - The widget type
12345
- * @template KEventName - The widget event name.
12346
- * @property {KEventName} type - The type of the event.
12347
- * @property {WidgetEventData[T][KEventName]} data - The data associated with the widget event.
12348
- */
12349
- type WidgetEvent<T extends WidgetType, KEventName extends keyof WidgetEventData[T]> = {
12350
- type: KEventName;
12351
- data: WidgetEventData[T][KEventName];
12352
- };
12353
- /**
12354
- * Represents an event emitted by a widget.
12355
- * @template KEventName - The orchestration event name.
12356
- * @property {KEventName} type - The type of the event.
12357
- * @property {OrchestrationMapping[KEventName]} data - The data associated with the event.
12358
- */
12359
- type OrchestrationEvent<KEventName extends keyof OrchestrationMapping> = {
12360
- type: KEventName;
12361
- data: OrchestrationMapping[KEventName];
12362
- };
12363
- /**
12364
- * Represents an event emitted by a widget.
12365
- * @template KEventName - The provider event name.
12366
- * @property {KEventName} type - The type of the event.
12367
- * @property {ProviderEventMapping[KEventName]} data - The data associated with the event.
12368
- */
12369
- type ProviderEvent<KEventName extends keyof ProviderEventMapping> = {
12370
- type: KEventName;
12371
- data: ProviderEventMapping[KEventName];
12372
- };
12373
- interface IWidgetsFactory {
12374
- /**
12375
- * Create a new widget instance.
12376
- * @param type widget type to instantiate.
12377
- * @param props widget configurations and provider.
12378
- */
12379
- create<T extends WidgetType>(type: T, props?: WidgetProperties<T>): Widget<T>;
12380
- /**
12381
- * Update the widgets provider instance.
12382
- * @param provider provider instantiate.
12383
- */
12384
- updateProvider(provider: Web3Provider): void;
12385
- }
12386
- /**
12387
- * Widget interface. Every widget implements this interface.
12388
- */
12389
- interface Widget<T extends WidgetType> {
12390
- /**
12391
- * Mount a widget to a DOM ref element.
12392
- * @param id ID of the DOM element where the widget will be mounted.
12393
- * @param params widget parameters.
12394
- */
12395
- mount(id: string, params?: WidgetParameters[T]): void;
12396
- /**
12397
- * Unmount a widget and reset parameters
12398
- */
12399
- unmount(): void;
12400
- /**
12401
- * Update the widget properties
12402
- * @param props Widget specific properties including configuration
12403
- */
12404
- update(props: WidgetProperties<T>): void;
12405
- /**
12406
- * Add a listener for a widget event.
12407
- * @param event Widget specific event name.
12408
- * @param callback function to execute when the event is received.
12409
- */
12410
- addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12411
- /**
12412
- * Removes an event listener for a widget event.
12413
- * @param type Widget specific event name.
12414
- */
12415
- removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12416
- }
12417
- /**
12418
- * Represents the version of the Checkout Widgets to use defaults to (0.1.9-alpha)
12419
- * @property {number} major - The major version of the widgets, must specify a major version even if it is 0.
12420
- * @property {number | undefined} minor - The minor version of the widgets, leaving this blank will use the latest minor based on major
12421
- * @property {number | undefined} patch - The patch version of the widgets, leaving this blank will use the latest minor based on minor
12422
- * @property {'alpha' | undefined} prerelease - The prerelease version of the widgets, can only be 'alpha'. Do not use in production.
12423
- * @property {number | undefined} build - The build version of the widgets. Do not use in production.
12424
- *
12425
- * @example
12426
- * { major: 0 } - use default version 0.1.9-alpha
12427
- * { major: 1 } - use version 1.x.x, pickup all new minor and patch versions released
12428
- * { major: 1, minor: 1 } - use version 1.1.x, pickup all new patch versions released
12429
- * { major: 1, minor: 2, patch: 3 } - use version 1.2.3 specifically
12430
- */
12431
- type SemanticVersion = {
12432
- major: number;
12433
- minor?: number;
12434
- patch?: number;
12435
- prerelease?: 'alpha';
12436
- build?: number;
12437
- };
12438
- /**
12439
- * Represents the global configuration options for the Checkout Widgets.
12440
- * @property {WidgetTheme | undefined} theme - The theme of the Checkout Widget (default: "DARK")
12441
- * @property {Environment | undefined} environment - The environment configuration (default: "SANDBOX")
12442
- * @property {SemanticVersion | undefined} version - The version of the checkout widgets js file to use (default: "0.1.x")
12443
- * @property {boolean | undefined} isOnRampEnabled - Enable on-ramp top-up method (default: "true")
12444
- * @property {boolean | undefined} isSwapEnabled - Enable swap top-up method (default: "true")
12445
- * @property {boolean | undefined} isBridgeEnabled - Enable bridge top-up method (default: "true")
12446
- */
12447
- type CheckoutWidgetsConfig = {
12448
- theme?: WidgetTheme;
12449
- environment?: Environment;
12450
- version?: SemanticVersion;
12451
- isOnRampEnabled?: boolean;
12452
- isSwapEnabled?: boolean;
12453
- isBridgeEnabled?: boolean;
12454
- };
12455
-
12456
- /**
12457
- * Represents the configuration options for instantiating the Checkout Widgets factory.
12458
- * @property {WidgetConfiguration} config - global configuration options for the widgets.
12459
- * @property {SemanticVersion | undefined} version - version of the Checkout widgets bundle (default latest version will be used).
12460
- */
12461
- type WidgetsInit = {
12462
- config: WidgetConfiguration;
12463
- version?: SemanticVersion;
12464
- };
12465
-
12466
11910
  declare class Checkout {
12467
- private readOnlyProviders;
12468
11911
  readonly config: CheckoutConfiguration;
12469
11912
  readonly fiatRampService: FiatRampService;
12470
11913
  readonly availability: AvailabilityService;
12471
- readonly passport?: Passport;
12472
11914
  /**
12473
11915
  * Constructs a new instance of the CheckoutModule class.
12474
11916
  * @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
12475
11917
  */
12476
11918
  constructor(config?: CheckoutModuleConfiguration);
12477
- /**
12478
- * Loads the widgets bundle and initiate the widgets factory.
12479
- * @param {WidgetsInit} init - The initialisation parameters for loading the widgets bundle and applying configuration
12480
- */
12481
- widgets(init: WidgetsInit): Promise<ImmutableCheckoutWidgets.WidgetsFactory>;
12482
11919
  /**
12483
11920
  * Creates a provider using the given parameters.
12484
11921
  * @param {CreateProviderParams} params - The parameters for creating the provider.
@@ -12598,123 +12035,4 @@ declare class Checkout {
12598
12035
  isSwapAvailable(): Promise<boolean>;
12599
12036
  }
12600
12037
 
12601
- /**
12602
- * Declares global interfaces and namespaces for the application.
12603
- * @global
12604
- * @namespace ImmutableCheckoutWidgets
12605
- * */
12606
- declare global {
12607
- namespace ImmutableCheckoutWidgets {
12608
- class WidgetsFactory implements IWidgetsFactory {
12609
- constructor(sdk: Checkout, config: CheckoutWidgetsConfig);
12610
- create<T extends WidgetType>(type: T, props?: WidgetProperties<T>): Widget<T>;
12611
- updateProvider(provider: Web3Provider): void;
12612
- }
12613
- class Connect<T extends WidgetType> implements Widget<T> {
12614
- constructor(sdk: Checkout, props: WidgetProperties<T>);
12615
- mount(id: string, params?: WidgetParameters[T]): void;
12616
- unmount(): void;
12617
- update(props: WidgetProperties<T>): void;
12618
- addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12619
- removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12620
- }
12621
- class Bridge<T extends WidgetType> implements Widget<T> {
12622
- constructor(sdk: Checkout, props: WidgetProperties<T>);
12623
- mount(id: string, params?: WidgetParameters[T]): void;
12624
- unmount(): void;
12625
- update(props: WidgetProperties<T>): void;
12626
- addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12627
- removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12628
- }
12629
- class Wallet<T extends WidgetType> implements Widget<T> {
12630
- constructor(sdk: Checkout, props: WidgetProperties<T>);
12631
- mount(id: string, params?: WidgetParameters[T]): void;
12632
- unmount(): void;
12633
- update(props: WidgetProperties<T>): void;
12634
- addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12635
- removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12636
- }
12637
- class Swap<T extends WidgetType> implements Widget<T> {
12638
- constructor(sdk: Checkout, props: WidgetProperties<T>);
12639
- mount(id: string, params?: WidgetParameters[T]): void;
12640
- unmount(): void;
12641
- update(props: WidgetProperties<T>): void;
12642
- addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12643
- removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12644
- }
12645
- class OnRamp<T extends WidgetType> implements Widget<T> {
12646
- constructor(sdk: Checkout, props: WidgetProperties<T>);
12647
- mount(id: string, params?: WidgetParameters[T]): void;
12648
- unmount(): void;
12649
- update(props: WidgetProperties<T>): void;
12650
- addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12651
- removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12652
- }
12653
- class Sale<T extends WidgetType> implements Widget<T> {
12654
- constructor(sdk: Checkout, props: WidgetProperties<T>);
12655
- mount(id: string, params?: WidgetParameters[T]): void;
12656
- unmount(): void;
12657
- update(props: WidgetProperties<T>): void;
12658
- addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
12659
- removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
12660
- }
12661
- }
12662
- }
12663
-
12664
- /**
12665
- * Enum representing different types of errors that can occur during the checkout process.
12666
- */
12667
- declare enum CheckoutErrorType {
12668
- WEB3_PROVIDER_ERROR = "WEB3_PROVIDER_ERROR",
12669
- PROVIDER_ERROR = "PROVIDER_ERROR",
12670
- DEFAULT_PROVIDER_ERROR = "DEFAULT_PROVIDER_ERROR",
12671
- CONNECT_PROVIDER_ERROR = "CONNECT_PROVIDER_ERROR",
12672
- GET_BALANCE_ERROR = "GET_BALANCE_ERROR",
12673
- GET_INDEXER_BALANCE_ERROR = "GET_INDEXER_BALANCE_ERROR",
12674
- GET_ERC20_BALANCE_ERROR = "GET_ERC20_BALANCE_ERROR",
12675
- GET_ERC721_BALANCE_ERROR = "GET_ERC721_BALANCE_ERROR",
12676
- GET_NETWORK_INFO_ERROR = "GET_NETWORK_INFO_ERROR",
12677
- METAMASK_PROVIDER_ERROR = "METAMASK_PROVIDER_ERROR",
12678
- CHAIN_NOT_SUPPORTED_ERROR = "CHAIN_NOT_SUPPORTED_ERROR",
12679
- PROVIDER_REQUEST_MISSING_ERROR = "PROVIDER_REQUEST_MISSING_ERROR",
12680
- PROVIDER_REQUEST_FAILED_ERROR = "PROVIDER_REQUEST_FAILED_ERROR",
12681
- USER_REJECTED_REQUEST_ERROR = "USER_REJECTED_REQUEST_ERROR",
12682
- TRANSACTION_FAILED = "TRANSACTION_FAILED",
12683
- INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
12684
- UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT",
12685
- INVALID_GAS_ESTIMATE_TYPE = "INVALID_GAS_ESTIMATE_TYPE",
12686
- UNSUPPORTED_TOKEN_TYPE_ERROR = "UNSUPPORTED_TOKEN_TYPE_ERROR",
12687
- UNSUPPORTED_BALANCE_REQUIREMENT_ERROR = "UNSUPPORTED_BALANCE_REQUIREMENT_ERROR",
12688
- GET_ORDER_LISTING_ERROR = "GET_ORDER_LISTING_ERROR",
12689
- CANCEL_ORDER_LISTING_ERROR = "CANCEL_ORDER_LISTING_ERROR",
12690
- PREPARE_ORDER_LISTING_ERROR = "PREPARE_ORDER_LISTING_ERROR",
12691
- CREATE_ORDER_LISTING_ERROR = "CREATE_ORDER_LISTING_ERROR",
12692
- FULFILL_ORDER_LISTING_ERROR = "FULFILL_ORDER_LISTING_ERROR",
12693
- SWITCH_NETWORK_UNSUPPORTED = "SWITCH_NETWORK_UNSUPPORTED",
12694
- GET_ERC20_ALLOWANCE_ERROR = "GET_ERC20_ALLOWANCE_ERROR",
12695
- GET_ERC721_ALLOWANCE_ERROR = "GET_ERC721_ALLOWANCE_ERROR",
12696
- EXECUTE_APPROVAL_TRANSACTION_ERROR = "EXECUTE_APPROVAL_TRANSACTION_ERROR",
12697
- EXECUTE_FULFILLMENT_TRANSACTION_ERROR = "EXECUTE_FULFILLMENT_TRANSACTION_ERROR",
12698
- SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR",
12699
- BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR",
12700
- ORDER_FEE_ERROR = "ORDER_FEE_ERROR",
12701
- ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR",
12702
- API_ERROR = "API_ERROR",
12703
- ORDER_EXPIRED_ERROR = "ORDER_EXPIRED_ERROR",
12704
- WIDGETS_SCRIPT_LOAD_ERROR = "WIDGETS_SCRIPT_LOAD_ERROR"
12705
- }
12706
- /**
12707
- * Represents an error object with a specific type, optional message, and optional data.
12708
- * @property {CheckoutErrorType} type - The type of the error.
12709
- * @property {string | undefined} [message] - The error message.
12710
- * @property {Object.<string, string> | undefined} [data] - Additional data associated with the error.
12711
- */
12712
- type ErrorType = {
12713
- type: CheckoutErrorType;
12714
- message?: string;
12715
- data?: {
12716
- [key: string]: string;
12717
- };
12718
- };
12719
-
12720
- 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 };
12038
+ 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 };