@imtbl/sdk 0.28.7-alpha → 0.28.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockchain_data.js +1 -1
- package/dist/browser/checkout.js +2 -0
- package/dist/checkout_sdk.d.ts +205 -885
- package/dist/checkout_sdk.js +2406 -2896
- package/dist/checkout_widgets.d.ts +25605 -0
- package/dist/checkout_widgets.js +450 -0
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +21 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +2903 -2936
- package/dist/index.d.ts +15431 -1163
- package/dist/index.js +2903 -2937
- package/dist/orderbook.js +10 -7
- package/dist/passport.js +2 -2
- package/dist/provider.d.ts +26 -28
- package/package.json +6 -17
- package/dist/browser/checkout/sdk.js +0 -35
- package/dist/browser/checkout/widgets.js +0 -890
package/dist/checkout_sdk.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ExchangeContracts } from 'config';
|
|
3
|
-
|
|
4
2
|
declare type Bytes = ArrayLike<number>;
|
|
5
3
|
declare type BytesLike = Bytes | string;
|
|
6
4
|
interface Hexable {
|
|
@@ -43,14 +41,6 @@ declare class BigNumber implements Hexable {
|
|
|
43
41
|
static isBigNumber(value: any): value is BigNumber;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
declare type Network = {
|
|
47
|
-
name: string;
|
|
48
|
-
chainId: number;
|
|
49
|
-
ensAddress?: string;
|
|
50
|
-
_defaultProvider?: (providers: any, options?: any) => any;
|
|
51
|
-
};
|
|
52
|
-
declare type Networkish = Network | string | number;
|
|
53
|
-
|
|
54
44
|
declare type Deferrable<T> = {
|
|
55
45
|
[K in keyof T]: T[K] | Promise<T[K]>;
|
|
56
46
|
};
|
|
@@ -60,6 +50,14 @@ declare class Description<T = any> {
|
|
|
60
50
|
});
|
|
61
51
|
}
|
|
62
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
|
+
|
|
63
61
|
declare type AccessList = Array<{
|
|
64
62
|
address: string;
|
|
65
63
|
storageKeys: Array<string>;
|
|
@@ -240,6 +238,43 @@ declare abstract class Provider$1 implements OnceBlockable {
|
|
|
240
238
|
static isProvider(value: any): value is Provider$1;
|
|
241
239
|
}
|
|
242
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
|
+
|
|
243
278
|
declare type FormatFunc = (value: any) => any;
|
|
244
279
|
declare type FormatFuncs = {
|
|
245
280
|
[key: string]: FormatFunc;
|
|
@@ -440,43 +475,6 @@ declare class BaseProvider extends Provider$1 implements EnsProvider {
|
|
|
440
475
|
removeAllListeners(eventName?: EventType): this;
|
|
441
476
|
}
|
|
442
477
|
|
|
443
|
-
interface TypedDataDomain {
|
|
444
|
-
name?: string;
|
|
445
|
-
version?: string;
|
|
446
|
-
chainId?: BigNumberish;
|
|
447
|
-
verifyingContract?: string;
|
|
448
|
-
salt?: BytesLike;
|
|
449
|
-
}
|
|
450
|
-
interface TypedDataField {
|
|
451
|
-
name: string;
|
|
452
|
-
type: string;
|
|
453
|
-
}
|
|
454
|
-
interface TypedDataSigner {
|
|
455
|
-
_signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
|
|
456
|
-
}
|
|
457
|
-
declare abstract class Signer {
|
|
458
|
-
readonly provider?: Provider$1;
|
|
459
|
-
abstract getAddress(): Promise<string>;
|
|
460
|
-
abstract signMessage(message: Bytes | string): Promise<string>;
|
|
461
|
-
abstract signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
|
|
462
|
-
abstract connect(provider: Provider$1): Signer;
|
|
463
|
-
readonly _isSigner: boolean;
|
|
464
|
-
constructor();
|
|
465
|
-
getBalance(blockTag?: BlockTag): Promise<BigNumber>;
|
|
466
|
-
getTransactionCount(blockTag?: BlockTag): Promise<number>;
|
|
467
|
-
estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
|
|
468
|
-
call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag): Promise<string>;
|
|
469
|
-
sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
|
|
470
|
-
getChainId(): Promise<number>;
|
|
471
|
-
getGasPrice(): Promise<BigNumber>;
|
|
472
|
-
getFeeData(): Promise<FeeData$1>;
|
|
473
|
-
resolveName(name: string): Promise<string>;
|
|
474
|
-
checkTransaction(transaction: Deferrable<TransactionRequest>): Deferrable<TransactionRequest>;
|
|
475
|
-
populateTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionRequest>;
|
|
476
|
-
_checkProvider(operation?: string): void;
|
|
477
|
-
static isSigner(value: any): value is Signer;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
478
|
declare class JsonRpcSigner extends Signer implements TypedDataSigner {
|
|
481
479
|
readonly provider: JsonRpcProvider;
|
|
482
480
|
_index: number;
|
|
@@ -548,6 +546,95 @@ declare class Web3Provider extends JsonRpcProvider {
|
|
|
548
546
|
send(method: string, params: Array<any>): Promise<any>;
|
|
549
547
|
}
|
|
550
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
|
+
|
|
551
638
|
// TypeScript Version: 3.0
|
|
552
639
|
|
|
553
640
|
type AxiosRequestHeaders = Record<string, string | number | boolean>;
|
|
@@ -10097,27 +10184,6 @@ interface IMXProvider {
|
|
|
10097
10184
|
completeWithdrawal(starkPublicKey: string, token: AnyToken): Promise<TransactionResponse>;
|
|
10098
10185
|
}
|
|
10099
10186
|
|
|
10100
|
-
declare enum Environment {
|
|
10101
|
-
PRODUCTION = "production",
|
|
10102
|
-
SANDBOX = "sandbox"
|
|
10103
|
-
}
|
|
10104
|
-
declare class ImmutableConfiguration {
|
|
10105
|
-
readonly environment: Environment;
|
|
10106
|
-
readonly rateLimitingKey?: string;
|
|
10107
|
-
readonly apiKey?: string;
|
|
10108
|
-
readonly clientAppId?: string;
|
|
10109
|
-
constructor(options: {
|
|
10110
|
-
environment: Environment;
|
|
10111
|
-
rateLimitingKey?: string;
|
|
10112
|
-
apiKey?: string;
|
|
10113
|
-
clientAppId?: string;
|
|
10114
|
-
});
|
|
10115
|
-
}
|
|
10116
|
-
interface ModuleConfiguration<T> {
|
|
10117
|
-
baseConfig: ImmutableConfiguration;
|
|
10118
|
-
overrides?: T;
|
|
10119
|
-
}
|
|
10120
|
-
|
|
10121
10187
|
interface ImxOverrides {
|
|
10122
10188
|
immutableXConfig: ImmutableXConfiguration;
|
|
10123
10189
|
}
|
|
@@ -10658,7 +10724,6 @@ declare enum ChainName {
|
|
|
10658
10724
|
IMTBL_ZKEVM_DEVNET = "Immutable zkEVM Dev",
|
|
10659
10725
|
IMTBL_ZKEVM_MAINNET = "Immutable zkEVM"
|
|
10660
10726
|
}
|
|
10661
|
-
|
|
10662
10727
|
/**
|
|
10663
10728
|
* Represents information about a token.
|
|
10664
10729
|
* @interface TokenInfo
|
|
@@ -10675,7 +10740,6 @@ interface TokenInfo {
|
|
|
10675
10740
|
address?: string;
|
|
10676
10741
|
icon?: string;
|
|
10677
10742
|
}
|
|
10678
|
-
|
|
10679
10743
|
/**
|
|
10680
10744
|
* Interface representing the parameters for {@link Checkout.getBalance}.
|
|
10681
10745
|
* @property {Web3Provider} provider - The provider used to get the balance.
|
|
@@ -10716,7 +10780,6 @@ interface GetAllBalancesParams {
|
|
|
10716
10780
|
interface GetAllBalancesResult {
|
|
10717
10781
|
balances: GetBalanceResult[];
|
|
10718
10782
|
}
|
|
10719
|
-
|
|
10720
10783
|
interface OrderFee {
|
|
10721
10784
|
amount: FeeToken | FeePercentage;
|
|
10722
10785
|
recipient: string;
|
|
@@ -10727,7 +10790,6 @@ interface FeeToken {
|
|
|
10727
10790
|
interface FeePercentage {
|
|
10728
10791
|
percentageDecimal: number;
|
|
10729
10792
|
}
|
|
10730
|
-
|
|
10731
10793
|
type BuyResult = BuyResultSuccess | BuyResultFailed | BuyResultInsufficientFunds;
|
|
10732
10794
|
/**
|
|
10733
10795
|
* Represents the result of {@link Checkout.buy}
|
|
@@ -11265,7 +11327,6 @@ type AvailableRoutingOptions = {
|
|
|
11265
11327
|
swap?: boolean;
|
|
11266
11328
|
bridge?: boolean;
|
|
11267
11329
|
};
|
|
11268
|
-
|
|
11269
11330
|
/**
|
|
11270
11331
|
* Interface representing the parameters for {@link Checkout.buy}
|
|
11271
11332
|
* @property {Web3Provider} provider - The provider to use for the buy.
|
|
@@ -11276,7 +11337,6 @@ interface BuyParams {
|
|
|
11276
11337
|
provider: Web3Provider;
|
|
11277
11338
|
orders: Array<BuyOrder>;
|
|
11278
11339
|
}
|
|
11279
|
-
|
|
11280
11340
|
/**
|
|
11281
11341
|
* Interface representing the parameters for {@link Checkout.cancel}
|
|
11282
11342
|
* @property {Web3Provider} provider - The provider to use for the cancel.
|
|
@@ -11287,73 +11347,12 @@ interface CancelParams {
|
|
|
11287
11347
|
provider: Web3Provider;
|
|
11288
11348
|
orderIds: string[];
|
|
11289
11349
|
}
|
|
11290
|
-
|
|
11291
|
-
/**
|
|
11292
|
-
* Type representing an ERC20 token
|
|
11293
|
-
* @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
|
|
11294
|
-
* @property {number} chainId - The chain ID
|
|
11295
|
-
* @property {string} address - The token address
|
|
11296
|
-
* @property {number} decimals - The token decimals
|
|
11297
|
-
* @property {string | undefined} symbol - The token symbol or undefined if it is not available
|
|
11298
|
-
* @property {string | undefined} name - The token name or undefined if it is not available
|
|
11299
|
-
*/
|
|
11300
|
-
type ERC20 = {
|
|
11301
|
-
type: 'erc20';
|
|
11302
|
-
chainId: number;
|
|
11303
|
-
address: string;
|
|
11304
|
-
decimals: number;
|
|
11305
|
-
symbol?: string;
|
|
11306
|
-
name?: string;
|
|
11307
|
-
};
|
|
11308
|
-
/**
|
|
11309
|
-
* Type representing a native token
|
|
11310
|
-
* @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
|
|
11311
|
-
* @property {number} chainId - The chain ID
|
|
11312
|
-
* @property {number} decimals - The token decimals
|
|
11313
|
-
* @property {string | undefined} symbol - The token symbol or undefined if it is not available
|
|
11314
|
-
* @property {string | undefined} name - The token name or undefined if it is not available
|
|
11315
|
-
*/
|
|
11316
|
-
type Native = {
|
|
11317
|
-
type: 'native';
|
|
11318
|
-
chainId: number;
|
|
11319
|
-
decimals: number;
|
|
11320
|
-
symbol?: string;
|
|
11321
|
-
name?: string;
|
|
11322
|
-
};
|
|
11323
|
-
/**
|
|
11324
|
-
* Type representing a token, either an {@link ERC20} or {@link Native}
|
|
11325
|
-
*/
|
|
11326
|
-
type Coin = ERC20 | Native;
|
|
11327
|
-
/**
|
|
11328
|
-
* Type representing the overrides for the {@link Exchange} module
|
|
11329
|
-
* @property {string} rpcURL - The RPC URL for the chain
|
|
11330
|
-
* @property {ExchangeContracts} exchangeContracts - The DEX contract addresses
|
|
11331
|
-
* @property {ERC20[]} commonRoutingTokens - The tokens used to find available pools for a swap
|
|
11332
|
-
* @property {Coin} nativeToken - The native token of the chain
|
|
11333
|
-
* @property {ERC20} wrappedNativeToken - The wrapped native token of the chain
|
|
11334
|
-
*/
|
|
11335
|
-
type ExchangeOverrides = {
|
|
11336
|
-
rpcURL: string;
|
|
11337
|
-
exchangeContracts: ExchangeContracts;
|
|
11338
|
-
commonRoutingTokens: ERC20[];
|
|
11339
|
-
nativeToken: Coin;
|
|
11340
|
-
wrappedNativeToken: ERC20;
|
|
11341
|
-
};
|
|
11342
|
-
|
|
11343
11350
|
interface CheckoutOverrides {
|
|
11344
11351
|
}
|
|
11345
|
-
/**
|
|
11346
|
-
* A type representing checkout SDK configurations.
|
|
11347
|
-
* @property {boolean} isOnRampEnabled - To enable on-ramp feature in Checkout sdk.
|
|
11348
|
-
* @property {boolean} isSwapEnabled - To enable swap feature in Checkout sdk.
|
|
11349
|
-
* @property {boolean} isBridgeEnabled - To enable bridge feature in Checkout sdk.
|
|
11350
|
-
* @property {Passport} passport - To enable passport wallet with Checkout sdk.
|
|
11351
|
-
*/
|
|
11352
11352
|
interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
|
|
11353
11353
|
isOnRampEnabled?: boolean;
|
|
11354
11354
|
isSwapEnabled?: boolean;
|
|
11355
11355
|
isBridgeEnabled?: boolean;
|
|
11356
|
-
passport?: Passport;
|
|
11357
11356
|
}
|
|
11358
11357
|
/**
|
|
11359
11358
|
* A type representing various remotely defined configurations which are
|
|
@@ -11471,7 +11470,6 @@ type ChainTokensConfig = {
|
|
|
11471
11470
|
allowed?: TokenInfo[];
|
|
11472
11471
|
blockscout?: boolean;
|
|
11473
11472
|
};
|
|
11474
|
-
|
|
11475
11473
|
/**
|
|
11476
11474
|
* Interface representing the params of {@link Checkout.connect}.
|
|
11477
11475
|
* @property {Web3Provider} provider - The provider used to connect to the network.
|
|
@@ -11502,16 +11500,6 @@ interface CheckConnectionResult {
|
|
|
11502
11500
|
isConnected: boolean;
|
|
11503
11501
|
walletAddress: string;
|
|
11504
11502
|
}
|
|
11505
|
-
|
|
11506
|
-
/**
|
|
11507
|
-
* @typedef {string} Address - Represents an Ethereum address.
|
|
11508
|
-
*/
|
|
11509
|
-
type Address = string;
|
|
11510
|
-
/**
|
|
11511
|
-
* @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
|
|
11512
|
-
*/
|
|
11513
|
-
type FungibleToken = Address | 'NATIVE';
|
|
11514
|
-
|
|
11515
11503
|
/**
|
|
11516
11504
|
* An enum representing the type of gas estimate.
|
|
11517
11505
|
* @enum {string}
|
|
@@ -11575,7 +11563,6 @@ interface TokenAmountEstimate {
|
|
|
11575
11563
|
estimatedAmount?: BigNumber;
|
|
11576
11564
|
token?: TokenInfo;
|
|
11577
11565
|
}
|
|
11578
|
-
|
|
11579
11566
|
/**
|
|
11580
11567
|
* Represents information about a network.
|
|
11581
11568
|
* @interface NetworkInfo
|
|
@@ -11590,7 +11577,6 @@ interface NetworkInfo {
|
|
|
11590
11577
|
nativeCurrency: TokenInfo;
|
|
11591
11578
|
isSupported: boolean;
|
|
11592
11579
|
}
|
|
11593
|
-
|
|
11594
11580
|
/**
|
|
11595
11581
|
* Interface representing the parameters for {@link Checkout.switchNetwork}.
|
|
11596
11582
|
* @property {Web3Provider} provider - The provider to connect to the network.
|
|
@@ -11646,7 +11632,6 @@ declare enum NetworkFilterTypes {
|
|
|
11646
11632
|
interface NetworkFilter {
|
|
11647
11633
|
chainId: ChainId;
|
|
11648
11634
|
}
|
|
11649
|
-
|
|
11650
11635
|
/**
|
|
11651
11636
|
* Interface representing the parameters for {@link Checkout.sell}
|
|
11652
11637
|
* @property {Web3Provider} provider - The provider to use for the sell.
|
|
@@ -11657,7 +11642,6 @@ interface SellParams {
|
|
|
11657
11642
|
provider: Web3Provider;
|
|
11658
11643
|
orders: Array<SellOrder>;
|
|
11659
11644
|
}
|
|
11660
|
-
|
|
11661
11645
|
/**
|
|
11662
11646
|
* Interface representing the parameters for {@link Checkout.getTokenAllowList}.
|
|
11663
11647
|
* @property {TokenFilterTypes} type - The type of token to retrieve.
|
|
@@ -11692,7 +11676,6 @@ declare enum TokenFilterTypes {
|
|
|
11692
11676
|
interface TokenFilter {
|
|
11693
11677
|
address: string;
|
|
11694
11678
|
}
|
|
11695
|
-
|
|
11696
11679
|
/**
|
|
11697
11680
|
* Interface representing the parameters for {@link Checkout.sendTransaction}.
|
|
11698
11681
|
* @property {Web3Provider} provider - The provider to connect to the network.
|
|
@@ -11709,7 +11692,6 @@ interface SendTransactionParams {
|
|
|
11709
11692
|
interface SendTransactionResult {
|
|
11710
11693
|
transactionResponse: TransactionResponse;
|
|
11711
11694
|
}
|
|
11712
|
-
|
|
11713
11695
|
/**
|
|
11714
11696
|
* Enum representing the names of different wallet providers.
|
|
11715
11697
|
*/
|
|
@@ -11720,27 +11702,29 @@ declare enum WalletProviderName {
|
|
|
11720
11702
|
/**
|
|
11721
11703
|
* Interface for the parameters required to create a wallet provider {@link Checkout.createProvider}.
|
|
11722
11704
|
* @interface CreateProviderParams
|
|
11723
|
-
* @property {WalletProviderName}
|
|
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.
|
|
11724
11708
|
*/
|
|
11725
11709
|
interface CreateProviderParams {
|
|
11726
|
-
|
|
11710
|
+
walletProvider: WalletProviderName;
|
|
11711
|
+
passport?: Passport;
|
|
11727
11712
|
}
|
|
11728
11713
|
/**
|
|
11729
11714
|
* Represents the result of creating a Web3 provider {@link Checkout.createProvider}.
|
|
11730
11715
|
* @property {Web3Provider} provider - The created Web3 provider.
|
|
11731
|
-
* @property {WalletProviderName}
|
|
11716
|
+
* @property {WalletProviderName} providerName - The name of the wallet provider.
|
|
11732
11717
|
*/
|
|
11733
11718
|
type CreateProviderResult = {
|
|
11734
11719
|
provider: Web3Provider;
|
|
11735
11720
|
walletProviderName: WalletProviderName;
|
|
11736
11721
|
};
|
|
11737
|
-
|
|
11738
11722
|
/**
|
|
11739
11723
|
* Interface representing a wallet filter to be used in {@link GetWalletAllowListParams}.
|
|
11740
|
-
* @property {WalletProviderName}
|
|
11724
|
+
* @property {WalletProviderName} connectionProvider - The connection provider to filter wallets by.
|
|
11741
11725
|
*/
|
|
11742
11726
|
interface WalletFilter {
|
|
11743
|
-
|
|
11727
|
+
walletProvider: WalletProviderName;
|
|
11744
11728
|
}
|
|
11745
11729
|
/**
|
|
11746
11730
|
* Interface representing the parameters for {@link Checkout.getWalletAllowList}.
|
|
@@ -11753,12 +11737,14 @@ interface GetWalletAllowListParams {
|
|
|
11753
11737
|
}
|
|
11754
11738
|
/**
|
|
11755
11739
|
* Interface representing information about a wallet used in {@link GetWalletAllowListResult}.
|
|
11756
|
-
* @property {WalletProviderName}
|
|
11740
|
+
* @property {WalletProviderName} walletProvider - The connection provider for the wallet.
|
|
11741
|
+
* @property {string} name - The name of the wallet.
|
|
11757
11742
|
* @property {string | undefined} description - A description of the wallet.
|
|
11758
11743
|
* @property {string | undefined} icon - The URL/data:image of an icon for the wallet.
|
|
11759
11744
|
*/
|
|
11760
11745
|
interface WalletInfo {
|
|
11761
|
-
|
|
11746
|
+
walletProvider: WalletProviderName;
|
|
11747
|
+
name: string;
|
|
11762
11748
|
description?: string;
|
|
11763
11749
|
icon?: string;
|
|
11764
11750
|
}
|
|
@@ -11775,7 +11761,6 @@ interface GetWalletAllowListResult {
|
|
|
11775
11761
|
declare enum WalletFilterTypes {
|
|
11776
11762
|
ALL = "all"
|
|
11777
11763
|
}
|
|
11778
|
-
|
|
11779
11764
|
/**
|
|
11780
11765
|
* Base URL for the checkout API based on the environment.
|
|
11781
11766
|
* @property {string} DEVELOPMENT - The base URL for the development environment.
|
|
@@ -11795,7 +11780,6 @@ type NetworkDetails = {
|
|
|
11795
11780
|
blockExplorerUrls?: string[];
|
|
11796
11781
|
};
|
|
11797
11782
|
type NetworkMap = Map<ChainId, NetworkDetails>;
|
|
11798
|
-
|
|
11799
11783
|
/**
|
|
11800
11784
|
* An enum representing the type of exchange.
|
|
11801
11785
|
* @enum {string}
|
|
@@ -11817,27 +11801,71 @@ interface FiatRampParams {
|
|
|
11817
11801
|
web3Provider: Web3Provider;
|
|
11818
11802
|
tokenAmount?: string;
|
|
11819
11803
|
tokenAddress?: string;
|
|
11820
|
-
passport?:
|
|
11804
|
+
passport?: Passport;
|
|
11821
11805
|
}
|
|
11822
|
-
|
|
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"
|
|
11846
|
+
}
|
|
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
|
+
};
|
|
11823
11860
|
type RemoteConfigParams = {
|
|
11824
11861
|
isDevelopment: boolean;
|
|
11825
11862
|
isProduction: boolean;
|
|
11826
11863
|
};
|
|
11827
11864
|
declare class RemoteConfigFetcher {
|
|
11828
|
-
private isDevelopment;
|
|
11829
|
-
private isProduction;
|
|
11830
|
-
private configCache;
|
|
11831
|
-
private tokensCache;
|
|
11832
11865
|
constructor(params: RemoteConfigParams);
|
|
11833
|
-
private static makeHttpRequest;
|
|
11834
|
-
private getEndpoint;
|
|
11835
|
-
private loadConfig;
|
|
11836
|
-
private loadConfigTokens;
|
|
11837
11866
|
getConfig(key?: keyof RemoteConfiguration): Promise<RemoteConfiguration | RemoteConfiguration[keyof RemoteConfiguration] | undefined>;
|
|
11838
11867
|
getTokensConfig(chainId: ChainId): Promise<ChainTokensConfig>;
|
|
11839
11868
|
}
|
|
11840
|
-
|
|
11841
11869
|
declare class CheckoutConfiguration {
|
|
11842
11870
|
readonly isDevelopment: boolean;
|
|
11843
11871
|
readonly isProduction: boolean;
|
|
@@ -11849,7 +11877,9 @@ declare class CheckoutConfiguration {
|
|
|
11849
11877
|
readonly networkMap: NetworkMap;
|
|
11850
11878
|
constructor(config: CheckoutModuleConfiguration);
|
|
11851
11879
|
}
|
|
11852
|
-
|
|
11880
|
+
type AvailabilityService = {
|
|
11881
|
+
checkDexAvailability: () => Promise<boolean>;
|
|
11882
|
+
};
|
|
11853
11883
|
interface FiatRampWidgetParams {
|
|
11854
11884
|
exchangeType: ExchangeType;
|
|
11855
11885
|
isPassport: boolean;
|
|
@@ -11867,607 +11897,16 @@ declare class FiatRampService {
|
|
|
11867
11897
|
constructor(config: CheckoutConfiguration);
|
|
11868
11898
|
feeEstimate(): Promise<OnRampProviderFees>;
|
|
11869
11899
|
createWidgetUrl(params: FiatRampWidgetParams): Promise<string>;
|
|
11870
|
-
private getTransakWidgetUrl;
|
|
11871
|
-
}
|
|
11872
|
-
|
|
11873
|
-
type AvailabilityService = {
|
|
11874
|
-
checkDexAvailability: () => Promise<boolean>;
|
|
11875
|
-
};
|
|
11876
|
-
|
|
11877
|
-
/**
|
|
11878
|
-
* Enum representing the themes for the widgets.
|
|
11879
|
-
*/
|
|
11880
|
-
declare enum WidgetTheme {
|
|
11881
|
-
LIGHT = "light",
|
|
11882
|
-
DARK = "dark"
|
|
11883
|
-
}
|
|
11884
|
-
|
|
11885
|
-
/**
|
|
11886
|
-
* Represents the local configuration options for the Checkout Widgets.
|
|
11887
|
-
* @property {WidgetTheme | undefined} theme - The theme of the Checkout Widget (default: "DARK")
|
|
11888
|
-
*/
|
|
11889
|
-
type WidgetConfiguration = {
|
|
11890
|
-
theme?: WidgetTheme;
|
|
11891
|
-
};
|
|
11892
|
-
|
|
11893
|
-
/**
|
|
11894
|
-
* Enum representing the events emitted by the widgets.
|
|
11895
|
-
*/
|
|
11896
|
-
declare enum IMTBLWidgetEvents {
|
|
11897
|
-
IMTBL_WIDGETS_PROVIDER = "imtbl-widgets-provider",
|
|
11898
|
-
IMTBL_CONNECT_WIDGET_EVENT = "imtbl-connect-widget",
|
|
11899
|
-
IMTBL_WALLET_WIDGET_EVENT = "imtbl-wallet-widget",
|
|
11900
|
-
IMTBL_SWAP_WIDGET_EVENT = "imtbl-swap-widget",
|
|
11901
|
-
IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget",
|
|
11902
|
-
IMTBL_ONRAMP_WIDGET_EVENT = "imtbl-onramp-widget",
|
|
11903
|
-
IMTBL_SALE_WIDGET_EVENT = "imtbl-sale-widget"
|
|
11904
|
-
}
|
|
11905
|
-
/**
|
|
11906
|
-
* Enum for events raised for about provider objects
|
|
11907
|
-
*/
|
|
11908
|
-
declare enum ProviderEventType {
|
|
11909
|
-
PROVIDER_UPDATED = "PROVIDER_UPDATED"
|
|
11910
|
-
}
|
|
11911
|
-
/**
|
|
11912
|
-
* Payload type for the PROVIDER_UPDATED event
|
|
11913
|
-
*/
|
|
11914
|
-
type ProviderUpdated = {
|
|
11915
|
-
provider: Web3Provider;
|
|
11916
|
-
};
|
|
11917
|
-
|
|
11918
|
-
/**
|
|
11919
|
-
* Enum representing possible Connect Widget event types.
|
|
11920
|
-
*/
|
|
11921
|
-
declare enum ConnectEventType {
|
|
11922
|
-
CLOSE_WIDGET = "close-widget",
|
|
11923
|
-
SUCCESS = "success",
|
|
11924
|
-
FAILURE = "failure"
|
|
11925
|
-
}
|
|
11926
|
-
/**
|
|
11927
|
-
* Represents a successful connection.
|
|
11928
|
-
* @property {Web3Provider} provider - The connected provider.
|
|
11929
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name of the connected provider.
|
|
11930
|
-
*/
|
|
11931
|
-
type ConnectionSuccess = {
|
|
11932
|
-
provider: Web3Provider;
|
|
11933
|
-
walletProviderName: WalletProviderName | undefined;
|
|
11934
|
-
};
|
|
11935
|
-
/**
|
|
11936
|
-
* Represents a connection failure with a reason.
|
|
11937
|
-
* @property {string} reason - The reason for the failed connection.
|
|
11938
|
-
*/
|
|
11939
|
-
type ConnectionFailed = {
|
|
11940
|
-
reason: string;
|
|
11941
|
-
};
|
|
11942
|
-
|
|
11943
|
-
/**
|
|
11944
|
-
* Enum representing possible Wallet Widget event types.
|
|
11945
|
-
*/
|
|
11946
|
-
declare enum WalletEventType {
|
|
11947
|
-
CLOSE_WIDGET = "close-widget",
|
|
11948
|
-
NETWORK_SWITCH = "network-switch",
|
|
11949
|
-
DISCONNECT_WALLET = "disconnect-wallet"
|
|
11950
|
-
}
|
|
11951
|
-
/**
|
|
11952
|
-
* Represents an event that is triggered when the user switches the network in their wallet.
|
|
11953
|
-
* @property {string} network - The name of the network that the user switched to.
|
|
11954
|
-
* @property {number} chainId - The chain ID of the network that the user switched to.
|
|
11955
|
-
* @property {Web3Provider} provider - The Web3 provider object for the switched network.
|
|
11956
|
-
*/
|
|
11957
|
-
type WalletNetworkSwitchEvent = {
|
|
11958
|
-
network: string;
|
|
11959
|
-
chainId: number;
|
|
11960
|
-
provider: Web3Provider;
|
|
11961
|
-
};
|
|
11962
|
-
/**
|
|
11963
|
-
* Represents an event that is triggered when a wallet is disconnected.
|
|
11964
|
-
*/
|
|
11965
|
-
type WalletDisconnectWalletEvent = {};
|
|
11966
|
-
|
|
11967
|
-
/**
|
|
11968
|
-
* Enum representing possible Swap Widget event types.
|
|
11969
|
-
*/
|
|
11970
|
-
declare enum SwapEventType {
|
|
11971
|
-
CLOSE_WIDGET = "close-widget",
|
|
11972
|
-
SUCCESS = "success",
|
|
11973
|
-
FAILURE = "failure",
|
|
11974
|
-
REJECTED = "rejected"
|
|
11975
|
-
}
|
|
11976
|
-
/**
|
|
11977
|
-
* Represents a successful swap transaction.
|
|
11978
|
-
* @property {string} transactionHash - The hash of the successful transaction.
|
|
11979
|
-
*/
|
|
11980
|
-
type SwapSuccess = {
|
|
11981
|
-
transactionHash: string;
|
|
11982
|
-
};
|
|
11983
|
-
/**
|
|
11984
|
-
* Type representing a Swap Widget with type FAILURE.
|
|
11985
|
-
* @property {string} reason - The reason why the swap failed.
|
|
11986
|
-
* @property {number} timestamp - The timestamp of the failed swap.
|
|
11987
|
-
*/
|
|
11988
|
-
type SwapFailed = {
|
|
11989
|
-
reason: string;
|
|
11990
|
-
timestamp: number;
|
|
11991
|
-
};
|
|
11992
|
-
/**
|
|
11993
|
-
* Type representing a Swap Widget with type FAILURE.
|
|
11994
|
-
* @property {string} reason - The reason why the swap failed.
|
|
11995
|
-
* @property {number} timestamp - The timestamp of the failed swap.
|
|
11996
|
-
*/
|
|
11997
|
-
type SwapRejected = {
|
|
11998
|
-
reason: string;
|
|
11999
|
-
timestamp: number;
|
|
12000
|
-
};
|
|
12001
|
-
|
|
12002
|
-
/**
|
|
12003
|
-
* Enum representing possible Sale Widget event types.
|
|
12004
|
-
*/
|
|
12005
|
-
declare enum SaleEventType {
|
|
12006
|
-
CLOSE_WIDGET = "close-widget",
|
|
12007
|
-
SUCCESS = "success",
|
|
12008
|
-
FAILURE = "failure",
|
|
12009
|
-
REJECTED = "rejected",
|
|
12010
|
-
TRANSACTION_SUCCESS = "transaction-success"
|
|
12011
|
-
}
|
|
12012
|
-
/**
|
|
12013
|
-
* Represents a successful Sale transaction.
|
|
12014
|
-
* @property {Array} transactions - The executed transactions
|
|
12015
|
-
*/
|
|
12016
|
-
type SaleSuccess = {
|
|
12017
|
-
transactions: {
|
|
12018
|
-
method: string;
|
|
12019
|
-
hash: string | undefined;
|
|
12020
|
-
}[];
|
|
12021
|
-
[key: string]: unknown;
|
|
12022
|
-
};
|
|
12023
|
-
/**
|
|
12024
|
-
* Type representing a Sale Widget with type FAILURE.
|
|
12025
|
-
* @property {string} reason - The reason why the swap failed.
|
|
12026
|
-
* @property {number} timestamp - The timestamp of the failed swap.
|
|
12027
|
-
* @property {Array} transactions - The executed transactions
|
|
12028
|
-
*/
|
|
12029
|
-
type SaleFailed = {
|
|
12030
|
-
reason: string;
|
|
12031
|
-
timestamp: number;
|
|
12032
|
-
transactions: {
|
|
12033
|
-
method: string;
|
|
12034
|
-
hash: string | undefined;
|
|
12035
|
-
}[];
|
|
12036
|
-
};
|
|
12037
|
-
/**
|
|
12038
|
-
* Type representing a Sale Widget with type TRANSACTION_SUCCESS.
|
|
12039
|
-
* @property {Object} transactions - The executed transactions
|
|
12040
|
-
*/
|
|
12041
|
-
type SaleTransactionSuccess = {
|
|
12042
|
-
transactions: {
|
|
12043
|
-
method: string;
|
|
12044
|
-
hash: string | undefined;
|
|
12045
|
-
}[];
|
|
12046
|
-
};
|
|
12047
|
-
|
|
12048
|
-
/**
|
|
12049
|
-
* Enum of possible Bridge Widget event types.
|
|
12050
|
-
*/
|
|
12051
|
-
declare enum BridgeEventType {
|
|
12052
|
-
CLOSE_WIDGET = "close-widget",
|
|
12053
|
-
SUCCESS = "success",
|
|
12054
|
-
FAILURE = "failure"
|
|
12055
|
-
}
|
|
12056
|
-
/**
|
|
12057
|
-
* Represents a successful bridge transaction.
|
|
12058
|
-
* @property {string} transactionHash - The hash of the successful transaction.
|
|
12059
|
-
*/
|
|
12060
|
-
type BridgeSuccess = {
|
|
12061
|
-
transactionHash: string;
|
|
12062
|
-
};
|
|
12063
|
-
/**
|
|
12064
|
-
* Represents a failed bridge transaction.
|
|
12065
|
-
* @property {string} reason - The reason for the failed transaction.
|
|
12066
|
-
* @property {number} timestamp - The timestamp of the failed transaction.
|
|
12067
|
-
*/
|
|
12068
|
-
type BridgeFailed = {
|
|
12069
|
-
reason: string;
|
|
12070
|
-
timestamp: number;
|
|
12071
|
-
};
|
|
12072
|
-
|
|
12073
|
-
/**
|
|
12074
|
-
* Enum representing different types of orchestration events.
|
|
12075
|
-
*/
|
|
12076
|
-
declare enum OrchestrationEventType {
|
|
12077
|
-
REQUEST_CONNECT = "request-connect",
|
|
12078
|
-
REQUEST_WALLET = "request-wallet",
|
|
12079
|
-
REQUEST_SWAP = "request-swap",
|
|
12080
|
-
REQUEST_BRIDGE = "request-bridge",
|
|
12081
|
-
REQUEST_ONRAMP = "request-onramp"
|
|
12082
|
-
}
|
|
12083
|
-
/**
|
|
12084
|
-
* Represents the connect event object when the connect widget is requested.
|
|
12085
|
-
* @property {string} walletProviderName - The wallet provider name.
|
|
12086
|
-
*/
|
|
12087
|
-
type RequestConnectEvent = {
|
|
12088
|
-
walletProviderName: string;
|
|
12089
|
-
};
|
|
12090
|
-
/**
|
|
12091
|
-
* Represents the wallet event object when the wallet widget is requested.
|
|
12092
|
-
* @property {string} walletProviderName - The wallet provider name.
|
|
12093
|
-
*/
|
|
12094
|
-
type RequestWalletEvent = {
|
|
12095
|
-
walletProviderName: string;
|
|
12096
|
-
};
|
|
12097
|
-
/**
|
|
12098
|
-
* Represents the swap event object when the swap widget is requested.
|
|
12099
|
-
* @property {string} fromTokenAddress - The address of the token to swap from.
|
|
12100
|
-
* @property {string} toTokenAddress - The address of the token to swap to.
|
|
12101
|
-
* @property {string} amount - The amount of from tokens to swap.
|
|
12102
|
-
*/
|
|
12103
|
-
type RequestSwapEvent = {
|
|
12104
|
-
fromTokenAddress: string;
|
|
12105
|
-
toTokenAddress: string;
|
|
12106
|
-
amount: string;
|
|
12107
|
-
};
|
|
12108
|
-
/**
|
|
12109
|
-
* Represents the bridge event object when the bridge widget is requested.
|
|
12110
|
-
* @property {string} tokenAddress - The address of the token to bridge.
|
|
12111
|
-
* @property {string} amount - The amount of tokens to bridge.
|
|
12112
|
-
*/
|
|
12113
|
-
type RequestBridgeEvent = {
|
|
12114
|
-
tokenAddress: string;
|
|
12115
|
-
amount: string;
|
|
12116
|
-
};
|
|
12117
|
-
/**
|
|
12118
|
-
* Represents the onramp event object when the onramp widget is requested.
|
|
12119
|
-
* @property {string} tokenAddress - The address of the token to be used for onramp.
|
|
12120
|
-
* @property {string} amount - The amount of tokens to onramp.
|
|
12121
|
-
*/
|
|
12122
|
-
type RequestOnrampEvent = {
|
|
12123
|
-
tokenAddress: string;
|
|
12124
|
-
amount: string;
|
|
12125
|
-
};
|
|
12126
|
-
type OrchestrationEventData = RequestConnectEvent | RequestWalletEvent | RequestSwapEvent | RequestBridgeEvent | RequestOnrampEvent;
|
|
12127
|
-
|
|
12128
|
-
/**
|
|
12129
|
-
* Enum of possible OnRamp Widget event types.
|
|
12130
|
-
*/
|
|
12131
|
-
declare enum OnRampEventType {
|
|
12132
|
-
CLOSE_WIDGET = "close-widget",
|
|
12133
|
-
SUCCESS = "success",
|
|
12134
|
-
FAILURE = "failure"
|
|
12135
|
-
}
|
|
12136
|
-
/**
|
|
12137
|
-
* Represents a successful on-ramp transaction.
|
|
12138
|
-
* @property {string} transactionHash - The transaction hash of the successful transaction.
|
|
12139
|
-
*/
|
|
12140
|
-
type OnRampSuccess = {
|
|
12141
|
-
transactionHash: string;
|
|
12142
|
-
};
|
|
12143
|
-
/**
|
|
12144
|
-
* Type representing a On-ramp Widget with type FAILURE.
|
|
12145
|
-
* @property {string} reason - The reason why the on-ramp failed.
|
|
12146
|
-
* @property {number} timestamp - The timestamp of the failed transaction.
|
|
12147
|
-
*/
|
|
12148
|
-
type OnRampFailed = {
|
|
12149
|
-
reason: string;
|
|
12150
|
-
timestamp: number;
|
|
12151
|
-
};
|
|
12152
|
-
|
|
12153
|
-
declare enum ConnectTargetLayer {
|
|
12154
|
-
LAYER1 = "LAYER1",
|
|
12155
|
-
LAYER2 = "LAYER2"
|
|
12156
|
-
}
|
|
12157
|
-
type ConnectWidgetParams = {};
|
|
12158
|
-
|
|
12159
|
-
/**
|
|
12160
|
-
* Bridge Widget parameters
|
|
12161
|
-
* @property {string | undefined} fromContractAddress - The contract address of the token to bridge from, used to populate the bridge form token field
|
|
12162
|
-
* @property {string | undefined} amount - The formatted amount to bridge, used to populate the bridge form amount field
|
|
12163
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the bridge widget
|
|
12164
|
-
*/
|
|
12165
|
-
type BridgeWidgetParams = {
|
|
12166
|
-
fromContractAddress?: string;
|
|
12167
|
-
amount?: string;
|
|
12168
|
-
walletProviderName?: WalletProviderName;
|
|
12169
|
-
};
|
|
12170
|
-
|
|
12171
|
-
/**
|
|
12172
|
-
* Wallet Widget parameters
|
|
12173
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the wallet widget
|
|
12174
|
-
* @property {Web3Provider | undefined} web3Provider - The ethers Web3Provider
|
|
12175
|
-
*/
|
|
12176
|
-
type WalletWidgetParams = {
|
|
12177
|
-
walletProviderName?: WalletProviderName;
|
|
12178
|
-
};
|
|
12179
|
-
|
|
12180
|
-
/**
|
|
12181
|
-
* Swap Widget parameters
|
|
12182
|
-
* @property {string | undefined} amount - The formatted amount to swap, used to populate the swap from amount field
|
|
12183
|
-
* @property {string | undefined} fromContractAddress - The contract address of the token to swap from
|
|
12184
|
-
* @property {string | undefined} toContractAddress - The contract address of the token to swap to
|
|
12185
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the swap widget
|
|
12186
|
-
*/
|
|
12187
|
-
interface SwapWidgetParams {
|
|
12188
|
-
amount?: string;
|
|
12189
|
-
fromContractAddress?: string;
|
|
12190
|
-
toContractAddress?: string;
|
|
12191
|
-
walletProviderName?: WalletProviderName;
|
|
12192
|
-
}
|
|
12193
|
-
|
|
12194
|
-
/**
|
|
12195
|
-
* OnRamp Widget parameters
|
|
12196
|
-
* @property {string | undefined} contractAddress - The contract address of the token to onramp
|
|
12197
|
-
* @property {string | undefined} amount - The formatted amount to onramp, used to populate the onramp form amount field
|
|
12198
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the onramp widget
|
|
12199
|
-
*/
|
|
12200
|
-
type OnRampWidgetParams = {
|
|
12201
|
-
contractAddress?: string;
|
|
12202
|
-
amount?: string;
|
|
12203
|
-
walletProviderName?: WalletProviderName;
|
|
12204
|
-
};
|
|
12205
|
-
|
|
12206
|
-
/**
|
|
12207
|
-
* Sale Widget parameters
|
|
12208
|
-
* @property {string} amount - The total price to pay for the items in the sale
|
|
12209
|
-
* @property {SaleItem[]} items - The list of products to be purchased
|
|
12210
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to default to if no web3Provider is passed
|
|
12211
|
-
*/
|
|
12212
|
-
type SaleWidgetParams = {
|
|
12213
|
-
amount?: string;
|
|
12214
|
-
environmentId?: string;
|
|
12215
|
-
fromContractAddress?: string;
|
|
12216
|
-
items?: SaleItem[];
|
|
12217
|
-
walletProviderName?: WalletProviderName;
|
|
12218
|
-
};
|
|
12219
|
-
type SaleItem = {
|
|
12220
|
-
productId: string;
|
|
12221
|
-
qty: number;
|
|
12222
|
-
name: string;
|
|
12223
|
-
image: string;
|
|
12224
|
-
description: string;
|
|
12225
|
-
};
|
|
12226
|
-
|
|
12227
|
-
type ConnectWidgetConfiguration = {} & WidgetConfiguration;
|
|
12228
|
-
|
|
12229
|
-
type BridgeWidgetConfiguration = {} & WidgetConfiguration;
|
|
12230
|
-
|
|
12231
|
-
type WalletWidgetConfiguration = {} & WidgetConfiguration;
|
|
12232
|
-
|
|
12233
|
-
type SwapWidgetConfiguration = {} & WidgetConfiguration;
|
|
12234
|
-
|
|
12235
|
-
type OnrampWidgetConfiguration = {} & WidgetConfiguration;
|
|
12236
|
-
|
|
12237
|
-
type SaleWidgetConfiguration = {} & WidgetConfiguration;
|
|
12238
|
-
|
|
12239
|
-
/**
|
|
12240
|
-
* Enum representing the list of widget types.
|
|
12241
|
-
*/
|
|
12242
|
-
declare enum WidgetType {
|
|
12243
|
-
CONNECT = "connect",
|
|
12244
|
-
WALLET = "wallet",
|
|
12245
|
-
SWAP = "swap",
|
|
12246
|
-
BRIDGE = "bridge",
|
|
12247
|
-
ONRAMP = "onramp",
|
|
12248
|
-
SALE = "sale"
|
|
12249
11900
|
}
|
|
12250
|
-
/**
|
|
12251
|
-
* Widget properties definition for each widget. Used for creating and updating widgets
|
|
12252
|
-
*/
|
|
12253
|
-
type WidgetProperties<T extends WidgetType> = {
|
|
12254
|
-
config?: WidgetConfigurations[T];
|
|
12255
|
-
provider?: Web3Provider;
|
|
12256
|
-
};
|
|
12257
|
-
type WidgetConfigurations = {
|
|
12258
|
-
[WidgetType.CONNECT]: ConnectWidgetConfiguration;
|
|
12259
|
-
[WidgetType.WALLET]: WalletWidgetConfiguration;
|
|
12260
|
-
[WidgetType.SWAP]: SwapWidgetConfiguration;
|
|
12261
|
-
[WidgetType.BRIDGE]: BridgeWidgetConfiguration;
|
|
12262
|
-
[WidgetType.ONRAMP]: OnrampWidgetConfiguration;
|
|
12263
|
-
[WidgetType.SALE]: SaleWidgetConfiguration;
|
|
12264
|
-
};
|
|
12265
|
-
type WidgetParameters = {
|
|
12266
|
-
[WidgetType.CONNECT]: ConnectWidgetParams;
|
|
12267
|
-
[WidgetType.WALLET]: WalletWidgetParams;
|
|
12268
|
-
[WidgetType.SWAP]: SwapWidgetParams;
|
|
12269
|
-
[WidgetType.BRIDGE]: BridgeWidgetParams;
|
|
12270
|
-
[WidgetType.ONRAMP]: OnRampWidgetParams;
|
|
12271
|
-
[WidgetType.SALE]: SaleWidgetParams;
|
|
12272
|
-
};
|
|
12273
|
-
/**
|
|
12274
|
-
* Represents all the possible event types that are emitted by the widgets.
|
|
12275
|
-
*/
|
|
12276
|
-
type WidgetEventTypes = {
|
|
12277
|
-
[WidgetType.CONNECT]: ConnectEventType | OrchestrationEventType;
|
|
12278
|
-
[WidgetType.WALLET]: WalletEventType | OrchestrationEventType;
|
|
12279
|
-
[WidgetType.SWAP]: SwapEventType | OrchestrationEventType;
|
|
12280
|
-
[WidgetType.BRIDGE]: BridgeEventType | OrchestrationEventType;
|
|
12281
|
-
[WidgetType.ONRAMP]: OnRampEventType | OrchestrationEventType;
|
|
12282
|
-
[WidgetType.SALE]: SaleEventType | OrchestrationEventType;
|
|
12283
|
-
};
|
|
12284
|
-
type OrchestrationMapping = {
|
|
12285
|
-
[OrchestrationEventType.REQUEST_CONNECT]: RequestConnectEvent;
|
|
12286
|
-
[OrchestrationEventType.REQUEST_WALLET]: RequestWalletEvent;
|
|
12287
|
-
[OrchestrationEventType.REQUEST_SWAP]: RequestSwapEvent;
|
|
12288
|
-
[OrchestrationEventType.REQUEST_BRIDGE]: RequestBridgeEvent;
|
|
12289
|
-
[OrchestrationEventType.REQUEST_ONRAMP]: RequestOnrampEvent;
|
|
12290
|
-
};
|
|
12291
|
-
type ProviderEventMapping = {
|
|
12292
|
-
[ProviderEventType.PROVIDER_UPDATED]: ProviderUpdated;
|
|
12293
|
-
};
|
|
12294
|
-
/**
|
|
12295
|
-
* Mapping of widget type, to each of it's events and then each event's payload
|
|
12296
|
-
* Update this whenever a new event is created and used by a widget
|
|
12297
|
-
* Each widget also has all of the orchestration events
|
|
12298
|
-
*/
|
|
12299
|
-
type WidgetEventData = {
|
|
12300
|
-
[WidgetType.CONNECT]: {
|
|
12301
|
-
[ConnectEventType.SUCCESS]: ConnectionSuccess;
|
|
12302
|
-
[ConnectEventType.FAILURE]: ConnectionFailed;
|
|
12303
|
-
[ConnectEventType.CLOSE_WIDGET]: {};
|
|
12304
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12305
|
-
[WidgetType.WALLET]: {
|
|
12306
|
-
[WalletEventType.NETWORK_SWITCH]: WalletNetworkSwitchEvent;
|
|
12307
|
-
[WalletEventType.DISCONNECT_WALLET]: WalletDisconnectWalletEvent;
|
|
12308
|
-
[WalletEventType.CLOSE_WIDGET]: {};
|
|
12309
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12310
|
-
[WidgetType.SWAP]: {
|
|
12311
|
-
[SwapEventType.SUCCESS]: SwapSuccess;
|
|
12312
|
-
[SwapEventType.FAILURE]: SwapFailed;
|
|
12313
|
-
[SwapEventType.REJECTED]: SwapRejected;
|
|
12314
|
-
[SwapEventType.CLOSE_WIDGET]: {};
|
|
12315
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12316
|
-
[WidgetType.BRIDGE]: {
|
|
12317
|
-
[BridgeEventType.SUCCESS]: BridgeSuccess;
|
|
12318
|
-
[BridgeEventType.FAILURE]: BridgeFailed;
|
|
12319
|
-
[BridgeEventType.CLOSE_WIDGET]: {};
|
|
12320
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12321
|
-
[WidgetType.ONRAMP]: {
|
|
12322
|
-
[OnRampEventType.SUCCESS]: OnRampSuccess;
|
|
12323
|
-
[OnRampEventType.FAILURE]: OnRampFailed;
|
|
12324
|
-
[OnRampEventType.CLOSE_WIDGET]: {};
|
|
12325
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12326
|
-
[WidgetType.SALE]: {
|
|
12327
|
-
[SaleEventType.SUCCESS]: SaleSuccess;
|
|
12328
|
-
[SaleEventType.FAILURE]: SaleFailed;
|
|
12329
|
-
[SaleEventType.REJECTED]: any;
|
|
12330
|
-
[SaleEventType.CLOSE_WIDGET]: {};
|
|
12331
|
-
[SaleEventType.TRANSACTION_SUCCESS]: SaleTransactionSuccess;
|
|
12332
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12333
|
-
};
|
|
12334
|
-
/**
|
|
12335
|
-
* Represents an event emitted by a widget. The event type should match the event data
|
|
12336
|
-
*/
|
|
12337
|
-
/**
|
|
12338
|
-
* Represents an event emitted by a widget.
|
|
12339
|
-
* @template T - The widget type
|
|
12340
|
-
* @template KEventName - The widget event name.
|
|
12341
|
-
* @property {KEventName} type - The type of the event.
|
|
12342
|
-
* @property {WidgetEventData[T][KEventName]} data - The data associated with the widget event.
|
|
12343
|
-
*/
|
|
12344
|
-
type WidgetEvent<T extends WidgetType, KEventName extends keyof WidgetEventData[T]> = {
|
|
12345
|
-
type: KEventName;
|
|
12346
|
-
data: WidgetEventData[T][KEventName];
|
|
12347
|
-
};
|
|
12348
|
-
/**
|
|
12349
|
-
* Represents an event emitted by a widget.
|
|
12350
|
-
* @template KEventName - The orchestration event name.
|
|
12351
|
-
* @property {KEventName} type - The type of the event.
|
|
12352
|
-
* @property {OrchestrationMapping[KEventName]} data - The data associated with the event.
|
|
12353
|
-
*/
|
|
12354
|
-
type OrchestrationEvent<KEventName extends keyof OrchestrationMapping> = {
|
|
12355
|
-
type: KEventName;
|
|
12356
|
-
data: OrchestrationMapping[KEventName];
|
|
12357
|
-
};
|
|
12358
|
-
/**
|
|
12359
|
-
* Represents an event emitted by a widget.
|
|
12360
|
-
* @template KEventName - The provider event name.
|
|
12361
|
-
* @property {KEventName} type - The type of the event.
|
|
12362
|
-
* @property {ProviderEventMapping[KEventName]} data - The data associated with the event.
|
|
12363
|
-
*/
|
|
12364
|
-
type ProviderEvent<KEventName extends keyof ProviderEventMapping> = {
|
|
12365
|
-
type: KEventName;
|
|
12366
|
-
data: ProviderEventMapping[KEventName];
|
|
12367
|
-
};
|
|
12368
|
-
interface IWidgetsFactory {
|
|
12369
|
-
/**
|
|
12370
|
-
* Create a new widget instance.
|
|
12371
|
-
* @param type widget type to instantiate.
|
|
12372
|
-
*/
|
|
12373
|
-
create<T extends WidgetType>(type: T, config?: WidgetConfigurations[T], provider?: Web3Provider): Widget<T>;
|
|
12374
|
-
updateProvider(provider: Web3Provider): void;
|
|
12375
|
-
}
|
|
12376
|
-
/**
|
|
12377
|
-
* Widget interface. Every widget implements this interface.
|
|
12378
|
-
*/
|
|
12379
|
-
interface Widget<T extends WidgetType> {
|
|
12380
|
-
/**
|
|
12381
|
-
* Mount a widget to a DOM ref element.
|
|
12382
|
-
* @param id ID of the DOM element where the widget will be mounted.
|
|
12383
|
-
*/
|
|
12384
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12385
|
-
/**
|
|
12386
|
-
* Unmount a widget and reset parameters
|
|
12387
|
-
*/
|
|
12388
|
-
unmount(): void;
|
|
12389
|
-
/**
|
|
12390
|
-
* Update the widget properties
|
|
12391
|
-
* @param props Widget specific properties including configuration
|
|
12392
|
-
*/
|
|
12393
|
-
update(props: WidgetProperties<T>): void;
|
|
12394
|
-
/**
|
|
12395
|
-
* Add a listener for a widget event.
|
|
12396
|
-
* @param event Widget specific event name.
|
|
12397
|
-
* @param callback function to execute when the event is received.
|
|
12398
|
-
*/
|
|
12399
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12400
|
-
/**
|
|
12401
|
-
* Removes an event listener for a widget event.
|
|
12402
|
-
* @param type Widget specific event name.
|
|
12403
|
-
*/
|
|
12404
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12405
|
-
}
|
|
12406
|
-
/**
|
|
12407
|
-
* Represents the version of the Checkout Widgets to use defaults to (0.1.9-alpha)
|
|
12408
|
-
* @property {number} major - The major version of the widgets, must specify a major version even if it is 0.
|
|
12409
|
-
* @property {number | undefined} minor - The minor version of the widgets, leaving this blank will use the latest minor based on major
|
|
12410
|
-
* @property {number | undefined} patch - The patch version of the widgets, leaving this blank will use the latest minor based on minor
|
|
12411
|
-
* @property {'alpha' | undefined} prerelease - The prerelease version of the widgets, can only be 'alpha'. Do not use in production.
|
|
12412
|
-
* @property {number | undefined} build - The build version of the widgets. Do not use in production.
|
|
12413
|
-
*
|
|
12414
|
-
* @example
|
|
12415
|
-
* { major: 0 } - use default version 0.1.9-alpha
|
|
12416
|
-
* { major: 1 } - use version 1.x.x, pickup all new minor and patch versions released
|
|
12417
|
-
* { major: 1, minor: 1 } - use version 1.1.x, pickup all new patch versions released
|
|
12418
|
-
* { major: 1, minor: 2, patch: 3 } - use version 1.2.3 specifically
|
|
12419
|
-
*/
|
|
12420
|
-
type SemanticVersion = {
|
|
12421
|
-
major: number;
|
|
12422
|
-
minor?: number;
|
|
12423
|
-
patch?: number;
|
|
12424
|
-
prerelease?: 'alpha';
|
|
12425
|
-
build?: number;
|
|
12426
|
-
};
|
|
12427
|
-
/**
|
|
12428
|
-
* Represents the global configuration options for the Checkout Widgets.
|
|
12429
|
-
* @property {WidgetTheme | undefined} theme - The theme of the Checkout Widget (default: "DARK")
|
|
12430
|
-
* @property {Environment | undefined} environment - The environment configuration (default: "SANDBOX")
|
|
12431
|
-
* @property {SemanticVersion | undefined} version - The version of the checkout widgets js file to use (default: "0.1.x")
|
|
12432
|
-
* @property {boolean | undefined} isOnRampEnabled - Enable on-ramp top-up method (default: "true")
|
|
12433
|
-
* @property {boolean | undefined} isSwapEnabled - Enable swap top-up method (default: "true")
|
|
12434
|
-
* @property {boolean | undefined} isBridgeEnabled - Enable bridge top-up method (default: "true")
|
|
12435
|
-
*/
|
|
12436
|
-
type CheckoutWidgetsConfig = {
|
|
12437
|
-
theme?: WidgetTheme;
|
|
12438
|
-
environment?: Environment;
|
|
12439
|
-
version?: SemanticVersion;
|
|
12440
|
-
isOnRampEnabled?: boolean;
|
|
12441
|
-
isSwapEnabled?: boolean;
|
|
12442
|
-
isBridgeEnabled?: boolean;
|
|
12443
|
-
};
|
|
12444
|
-
|
|
12445
|
-
/**
|
|
12446
|
-
* Represents the configuration options for instantiating the Checkout Widgets factory.
|
|
12447
|
-
* @property {WidgetConfiguration} config - global configuration options for the widgets.
|
|
12448
|
-
* @property {SemanticVersion | undefined} version - version of the Checkout widgets bundle (default latest version will be used).
|
|
12449
|
-
*/
|
|
12450
|
-
type WidgetsInit = {
|
|
12451
|
-
config: WidgetConfiguration;
|
|
12452
|
-
version?: SemanticVersion;
|
|
12453
|
-
};
|
|
12454
|
-
|
|
12455
11901
|
declare class Checkout {
|
|
12456
|
-
private readOnlyProviders;
|
|
12457
11902
|
readonly config: CheckoutConfiguration;
|
|
12458
11903
|
readonly fiatRampService: FiatRampService;
|
|
12459
11904
|
readonly availability: AvailabilityService;
|
|
12460
|
-
readonly passport?: Passport;
|
|
12461
11905
|
/**
|
|
12462
11906
|
* Constructs a new instance of the CheckoutModule class.
|
|
12463
11907
|
* @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
|
|
12464
11908
|
*/
|
|
12465
11909
|
constructor(config?: CheckoutModuleConfiguration);
|
|
12466
|
-
/**
|
|
12467
|
-
* Loads the widgets bundle and initiate the widgets factory.
|
|
12468
|
-
* @param {WidgetsInit} init - The initialisation parameters for loading the widgets bundle and applying configuration
|
|
12469
|
-
*/
|
|
12470
|
-
widgets(init: WidgetsInit): Promise<ImmutableCheckoutWidgets.WidgetsFactory>;
|
|
12471
11910
|
/**
|
|
12472
11911
|
* Creates a provider using the given parameters.
|
|
12473
11912
|
* @param {CreateProviderParams} params - The parameters for creating the provider.
|
|
@@ -12587,123 +12026,4 @@ declare class Checkout {
|
|
|
12587
12026
|
isSwapAvailable(): Promise<boolean>;
|
|
12588
12027
|
}
|
|
12589
12028
|
|
|
12590
|
-
|
|
12591
|
-
* Declares global interfaces and namespaces for the application.
|
|
12592
|
-
* @global
|
|
12593
|
-
* @namespace ImmutableCheckoutWidgets
|
|
12594
|
-
* */
|
|
12595
|
-
declare global {
|
|
12596
|
-
namespace ImmutableCheckoutWidgets {
|
|
12597
|
-
class WidgetsFactory implements IWidgetsFactory {
|
|
12598
|
-
constructor(sdk: Checkout, config: CheckoutWidgetsConfig);
|
|
12599
|
-
create<T extends WidgetType>(type: T, config?: WidgetConfigurations[T], provider?: Web3Provider): Widget<T>;
|
|
12600
|
-
updateProvider(provider: Web3Provider): void;
|
|
12601
|
-
}
|
|
12602
|
-
class Connect<T extends WidgetType> implements Widget<T> {
|
|
12603
|
-
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
12604
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12605
|
-
unmount(): void;
|
|
12606
|
-
update(props: WidgetProperties<T>): void;
|
|
12607
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12608
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12609
|
-
}
|
|
12610
|
-
class Bridge<T extends WidgetType> implements Widget<T> {
|
|
12611
|
-
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
12612
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12613
|
-
unmount(): void;
|
|
12614
|
-
update(props: WidgetProperties<T>): void;
|
|
12615
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12616
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12617
|
-
}
|
|
12618
|
-
class Wallet<T extends WidgetType> implements Widget<T> {
|
|
12619
|
-
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
12620
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12621
|
-
unmount(): void;
|
|
12622
|
-
update(props: WidgetProperties<T>): void;
|
|
12623
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12624
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12625
|
-
}
|
|
12626
|
-
class Swap<T extends WidgetType> implements Widget<T> {
|
|
12627
|
-
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
12628
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12629
|
-
unmount(): void;
|
|
12630
|
-
update(props: WidgetProperties<T>): void;
|
|
12631
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12632
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12633
|
-
}
|
|
12634
|
-
class OnRamp<T extends WidgetType> implements Widget<T> {
|
|
12635
|
-
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
12636
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12637
|
-
unmount(): void;
|
|
12638
|
-
update(props: WidgetProperties<T>): void;
|
|
12639
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12640
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12641
|
-
}
|
|
12642
|
-
class Sale<T extends WidgetType> implements Widget<T> {
|
|
12643
|
-
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
12644
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12645
|
-
unmount(): void;
|
|
12646
|
-
update(props: WidgetProperties<T>): void;
|
|
12647
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12648
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12649
|
-
}
|
|
12650
|
-
}
|
|
12651
|
-
}
|
|
12652
|
-
|
|
12653
|
-
/**
|
|
12654
|
-
* Enum representing different types of errors that can occur during the checkout process.
|
|
12655
|
-
*/
|
|
12656
|
-
declare enum CheckoutErrorType {
|
|
12657
|
-
WEB3_PROVIDER_ERROR = "WEB3_PROVIDER_ERROR",
|
|
12658
|
-
PROVIDER_ERROR = "PROVIDER_ERROR",
|
|
12659
|
-
DEFAULT_PROVIDER_ERROR = "DEFAULT_PROVIDER_ERROR",
|
|
12660
|
-
CONNECT_PROVIDER_ERROR = "CONNECT_PROVIDER_ERROR",
|
|
12661
|
-
GET_BALANCE_ERROR = "GET_BALANCE_ERROR",
|
|
12662
|
-
GET_INDEXER_BALANCE_ERROR = "GET_INDEXER_BALANCE_ERROR",
|
|
12663
|
-
GET_ERC20_BALANCE_ERROR = "GET_ERC20_BALANCE_ERROR",
|
|
12664
|
-
GET_ERC721_BALANCE_ERROR = "GET_ERC721_BALANCE_ERROR",
|
|
12665
|
-
GET_NETWORK_INFO_ERROR = "GET_NETWORK_INFO_ERROR",
|
|
12666
|
-
METAMASK_PROVIDER_ERROR = "METAMASK_PROVIDER_ERROR",
|
|
12667
|
-
CHAIN_NOT_SUPPORTED_ERROR = "CHAIN_NOT_SUPPORTED_ERROR",
|
|
12668
|
-
PROVIDER_REQUEST_MISSING_ERROR = "PROVIDER_REQUEST_MISSING_ERROR",
|
|
12669
|
-
PROVIDER_REQUEST_FAILED_ERROR = "PROVIDER_REQUEST_FAILED_ERROR",
|
|
12670
|
-
USER_REJECTED_REQUEST_ERROR = "USER_REJECTED_REQUEST_ERROR",
|
|
12671
|
-
TRANSACTION_FAILED = "TRANSACTION_FAILED",
|
|
12672
|
-
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
|
|
12673
|
-
UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT",
|
|
12674
|
-
INVALID_GAS_ESTIMATE_TYPE = "INVALID_GAS_ESTIMATE_TYPE",
|
|
12675
|
-
UNSUPPORTED_TOKEN_TYPE_ERROR = "UNSUPPORTED_TOKEN_TYPE_ERROR",
|
|
12676
|
-
UNSUPPORTED_BALANCE_REQUIREMENT_ERROR = "UNSUPPORTED_BALANCE_REQUIREMENT_ERROR",
|
|
12677
|
-
GET_ORDER_LISTING_ERROR = "GET_ORDER_LISTING_ERROR",
|
|
12678
|
-
CANCEL_ORDER_LISTING_ERROR = "CANCEL_ORDER_LISTING_ERROR",
|
|
12679
|
-
PREPARE_ORDER_LISTING_ERROR = "PREPARE_ORDER_LISTING_ERROR",
|
|
12680
|
-
CREATE_ORDER_LISTING_ERROR = "CREATE_ORDER_LISTING_ERROR",
|
|
12681
|
-
FULFILL_ORDER_LISTING_ERROR = "FULFILL_ORDER_LISTING_ERROR",
|
|
12682
|
-
SWITCH_NETWORK_UNSUPPORTED = "SWITCH_NETWORK_UNSUPPORTED",
|
|
12683
|
-
GET_ERC20_ALLOWANCE_ERROR = "GET_ERC20_ALLOWANCE_ERROR",
|
|
12684
|
-
GET_ERC721_ALLOWANCE_ERROR = "GET_ERC721_ALLOWANCE_ERROR",
|
|
12685
|
-
EXECUTE_APPROVAL_TRANSACTION_ERROR = "EXECUTE_APPROVAL_TRANSACTION_ERROR",
|
|
12686
|
-
EXECUTE_FULFILLMENT_TRANSACTION_ERROR = "EXECUTE_FULFILLMENT_TRANSACTION_ERROR",
|
|
12687
|
-
SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR",
|
|
12688
|
-
BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR",
|
|
12689
|
-
ORDER_FEE_ERROR = "ORDER_FEE_ERROR",
|
|
12690
|
-
ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR",
|
|
12691
|
-
API_ERROR = "API_ERROR",
|
|
12692
|
-
ORDER_EXPIRED_ERROR = "ORDER_EXPIRED_ERROR",
|
|
12693
|
-
WIDGETS_SCRIPT_LOAD_ERROR = "WIDGETS_SCRIPT_LOAD_ERROR"
|
|
12694
|
-
}
|
|
12695
|
-
/**
|
|
12696
|
-
* Represents an error object with a specific type, optional message, and optional data.
|
|
12697
|
-
* @property {CheckoutErrorType} type - The type of the error.
|
|
12698
|
-
* @property {string | undefined} [message] - The error message.
|
|
12699
|
-
* @property {Object.<string, string> | undefined} [data] - Additional data associated with the error.
|
|
12700
|
-
*/
|
|
12701
|
-
type ErrorType = {
|
|
12702
|
-
type: CheckoutErrorType;
|
|
12703
|
-
message?: string;
|
|
12704
|
-
data?: {
|
|
12705
|
-
[key: string]: string;
|
|
12706
|
-
};
|
|
12707
|
-
};
|
|
12708
|
-
|
|
12709
|
-
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, WalletDisconnectWalletEvent, WalletEventType, WalletFilter, WalletFilterTypes, WalletInfo, WalletNetworkSwitchEvent, WalletProviderName, WalletWidgetConfiguration, WalletWidgetParams, Widget, WidgetConfiguration, WidgetConfigurations, WidgetEvent, WidgetEventData, WidgetEventTypes, WidgetParameters, WidgetProperties, WidgetTheme, WidgetType };
|
|
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 };
|