@imtbl/sdk 0.28.6-alpha.1 → 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 +250 -909
- package/dist/checkout_sdk.js +2432 -2909
- 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 +3017 -2971
- package/dist/index.d.ts +15295 -1001
- package/dist/index.js +3018 -2973
- package/dist/orderbook.js +10 -7
- package/dist/passport.d.ts +7 -1
- package/dist/passport.js +67 -21
- package/dist/provider.d.ts +32 -27
- package/dist/provider.js +22 -2
- package/package.json +8 -19
- 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>;
|
|
@@ -10019,6 +10106,12 @@ interface IMXProvider {
|
|
|
10019
10106
|
* @return {Promise<RegisterUserResponse>} Returns a promise that resolves with the user registration response
|
|
10020
10107
|
*/
|
|
10021
10108
|
registerOffchain(): Promise<RegisterUserResponse>;
|
|
10109
|
+
/**
|
|
10110
|
+
* Checks if a User is registered off-chain
|
|
10111
|
+
*
|
|
10112
|
+
* @return {Promise<boolean>} Returns a promise that resolves with true if the User is registered with IMX, false otherwise
|
|
10113
|
+
*/
|
|
10114
|
+
isRegisteredOffchain(): Promise<boolean>;
|
|
10022
10115
|
/**
|
|
10023
10116
|
* Checks if a User is registered on-chain
|
|
10024
10117
|
*
|
|
@@ -10091,27 +10184,6 @@ interface IMXProvider {
|
|
|
10091
10184
|
completeWithdrawal(starkPublicKey: string, token: AnyToken): Promise<TransactionResponse>;
|
|
10092
10185
|
}
|
|
10093
10186
|
|
|
10094
|
-
declare enum Environment {
|
|
10095
|
-
PRODUCTION = "production",
|
|
10096
|
-
SANDBOX = "sandbox"
|
|
10097
|
-
}
|
|
10098
|
-
declare class ImmutableConfiguration {
|
|
10099
|
-
readonly environment: Environment;
|
|
10100
|
-
readonly rateLimitingKey?: string;
|
|
10101
|
-
readonly apiKey?: string;
|
|
10102
|
-
readonly clientAppId?: string;
|
|
10103
|
-
constructor(options: {
|
|
10104
|
-
environment: Environment;
|
|
10105
|
-
rateLimitingKey?: string;
|
|
10106
|
-
apiKey?: string;
|
|
10107
|
-
clientAppId?: string;
|
|
10108
|
-
});
|
|
10109
|
-
}
|
|
10110
|
-
interface ModuleConfiguration<T> {
|
|
10111
|
-
baseConfig: ImmutableConfiguration;
|
|
10112
|
-
overrides?: T;
|
|
10113
|
-
}
|
|
10114
|
-
|
|
10115
10187
|
interface ImxOverrides {
|
|
10116
10188
|
immutableXConfig: ImmutableXConfiguration;
|
|
10117
10189
|
}
|
|
@@ -10471,7 +10543,7 @@ type UserProfile = {
|
|
|
10471
10543
|
};
|
|
10472
10544
|
declare enum Networks {
|
|
10473
10545
|
PRODUCTION = "mainnet",
|
|
10474
|
-
SANDBOX = "
|
|
10546
|
+
SANDBOX = "sepolia"
|
|
10475
10547
|
}
|
|
10476
10548
|
interface OidcConfiguration {
|
|
10477
10549
|
clientId: string;
|
|
@@ -10652,7 +10724,6 @@ declare enum ChainName {
|
|
|
10652
10724
|
IMTBL_ZKEVM_DEVNET = "Immutable zkEVM Dev",
|
|
10653
10725
|
IMTBL_ZKEVM_MAINNET = "Immutable zkEVM"
|
|
10654
10726
|
}
|
|
10655
|
-
|
|
10656
10727
|
/**
|
|
10657
10728
|
* Represents information about a token.
|
|
10658
10729
|
* @interface TokenInfo
|
|
@@ -10669,7 +10740,6 @@ interface TokenInfo {
|
|
|
10669
10740
|
address?: string;
|
|
10670
10741
|
icon?: string;
|
|
10671
10742
|
}
|
|
10672
|
-
|
|
10673
10743
|
/**
|
|
10674
10744
|
* Interface representing the parameters for {@link Checkout.getBalance}.
|
|
10675
10745
|
* @property {Web3Provider} provider - The provider used to get the balance.
|
|
@@ -10710,7 +10780,6 @@ interface GetAllBalancesParams {
|
|
|
10710
10780
|
interface GetAllBalancesResult {
|
|
10711
10781
|
balances: GetBalanceResult[];
|
|
10712
10782
|
}
|
|
10713
|
-
|
|
10714
10783
|
interface OrderFee {
|
|
10715
10784
|
amount: FeeToken | FeePercentage;
|
|
10716
10785
|
recipient: string;
|
|
@@ -10721,7 +10790,6 @@ interface FeeToken {
|
|
|
10721
10790
|
interface FeePercentage {
|
|
10722
10791
|
percentageDecimal: number;
|
|
10723
10792
|
}
|
|
10724
|
-
|
|
10725
10793
|
type BuyResult = BuyResultSuccess | BuyResultFailed | BuyResultInsufficientFunds;
|
|
10726
10794
|
/**
|
|
10727
10795
|
* Represents the result of {@link Checkout.buy}
|
|
@@ -11259,7 +11327,6 @@ type AvailableRoutingOptions = {
|
|
|
11259
11327
|
swap?: boolean;
|
|
11260
11328
|
bridge?: boolean;
|
|
11261
11329
|
};
|
|
11262
|
-
|
|
11263
11330
|
/**
|
|
11264
11331
|
* Interface representing the parameters for {@link Checkout.buy}
|
|
11265
11332
|
* @property {Web3Provider} provider - The provider to use for the buy.
|
|
@@ -11270,7 +11337,6 @@ interface BuyParams {
|
|
|
11270
11337
|
provider: Web3Provider;
|
|
11271
11338
|
orders: Array<BuyOrder>;
|
|
11272
11339
|
}
|
|
11273
|
-
|
|
11274
11340
|
/**
|
|
11275
11341
|
* Interface representing the parameters for {@link Checkout.cancel}
|
|
11276
11342
|
* @property {Web3Provider} provider - The provider to use for the cancel.
|
|
@@ -11281,95 +11347,34 @@ interface CancelParams {
|
|
|
11281
11347
|
provider: Web3Provider;
|
|
11282
11348
|
orderIds: string[];
|
|
11283
11349
|
}
|
|
11284
|
-
|
|
11350
|
+
interface CheckoutOverrides {
|
|
11351
|
+
}
|
|
11352
|
+
interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
|
|
11353
|
+
isOnRampEnabled?: boolean;
|
|
11354
|
+
isSwapEnabled?: boolean;
|
|
11355
|
+
isBridgeEnabled?: boolean;
|
|
11356
|
+
}
|
|
11285
11357
|
/**
|
|
11286
|
-
*
|
|
11287
|
-
*
|
|
11288
|
-
* @property {
|
|
11289
|
-
* @property {
|
|
11290
|
-
* @property {
|
|
11291
|
-
* @property {
|
|
11292
|
-
* @property {string | undefined} name - The token name or undefined if it is not available
|
|
11358
|
+
* A type representing various remotely defined configurations which are
|
|
11359
|
+
* accessible via the Checkout config and configured based on the Environment.
|
|
11360
|
+
* @property {DexConfig} dex - The config used for the DEX.
|
|
11361
|
+
* @property {OnRampConfig} onramp - The config used for the OnRamp
|
|
11362
|
+
* @property {AllowedNetworkConfig[]} allowedNetworks - An array representing the allowed networks.
|
|
11363
|
+
* @property {GasEstimateTokenConfig | undefined} gasEstimateTokens - The config for the tokens used to estimate gas.
|
|
11293
11364
|
*/
|
|
11294
|
-
type
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
11300
|
-
|
|
11365
|
+
type RemoteConfiguration = {
|
|
11366
|
+
dex: DexConfig;
|
|
11367
|
+
onramp: OnRampConfig;
|
|
11368
|
+
bridge: BridgeConfig;
|
|
11369
|
+
allowedNetworks: AllowedNetworkConfig[];
|
|
11370
|
+
gasEstimateTokens?: GasEstimateTokenConfig;
|
|
11371
|
+
imxAddressMapping?: ImxAddressConfig;
|
|
11301
11372
|
};
|
|
11302
11373
|
/**
|
|
11303
|
-
*
|
|
11304
|
-
* @property {string}
|
|
11305
|
-
* @property {
|
|
11306
|
-
* @property {
|
|
11307
|
-
* @property {string | undefined} symbol - The token symbol or undefined if it is not available
|
|
11308
|
-
* @property {string | undefined} name - The token name or undefined if it is not available
|
|
11309
|
-
*/
|
|
11310
|
-
type Native = {
|
|
11311
|
-
type: 'native';
|
|
11312
|
-
chainId: number;
|
|
11313
|
-
decimals: number;
|
|
11314
|
-
symbol?: string;
|
|
11315
|
-
name?: string;
|
|
11316
|
-
};
|
|
11317
|
-
/**
|
|
11318
|
-
* Type representing a token, either an {@link ERC20} or {@link Native}
|
|
11319
|
-
*/
|
|
11320
|
-
type Coin = ERC20 | Native;
|
|
11321
|
-
/**
|
|
11322
|
-
* Type representing the overrides for the {@link Exchange} module
|
|
11323
|
-
* @property {string} rpcURL - The RPC URL for the chain
|
|
11324
|
-
* @property {ExchangeContracts} exchangeContracts - The DEX contract addresses
|
|
11325
|
-
* @property {ERC20[]} commonRoutingTokens - The tokens used to find available pools for a swap
|
|
11326
|
-
* @property {Coin} nativeToken - The native token of the chain
|
|
11327
|
-
* @property {ERC20} wrappedNativeToken - The wrapped native token of the chain
|
|
11328
|
-
*/
|
|
11329
|
-
type ExchangeOverrides = {
|
|
11330
|
-
rpcURL: string;
|
|
11331
|
-
exchangeContracts: ExchangeContracts;
|
|
11332
|
-
commonRoutingTokens: ERC20[];
|
|
11333
|
-
nativeToken: Coin;
|
|
11334
|
-
wrappedNativeToken: ERC20;
|
|
11335
|
-
};
|
|
11336
|
-
|
|
11337
|
-
interface CheckoutOverrides {
|
|
11338
|
-
}
|
|
11339
|
-
/**
|
|
11340
|
-
* A type representing checkout SDK configurations.
|
|
11341
|
-
* @property {boolean} isOnRampEnabled - To enable on-ramp feature in Checkout sdk.
|
|
11342
|
-
* @property {boolean} isSwapEnabled - To enable swap feature in Checkout sdk.
|
|
11343
|
-
* @property {boolean} isBridgeEnabled - To enable bridge feature in Checkout sdk.
|
|
11344
|
-
* @property {Passport} passport - To enable passport wallet with Checkout sdk.
|
|
11345
|
-
*/
|
|
11346
|
-
interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
|
|
11347
|
-
isOnRampEnabled?: boolean;
|
|
11348
|
-
isSwapEnabled?: boolean;
|
|
11349
|
-
isBridgeEnabled?: boolean;
|
|
11350
|
-
passport?: Passport;
|
|
11351
|
-
}
|
|
11352
|
-
/**
|
|
11353
|
-
* A type representing various remotely defined configurations which are
|
|
11354
|
-
* accessible via the Checkout config and configured based on the Environment.
|
|
11355
|
-
* @property {DexConfig} dex - The config used for the DEX.
|
|
11356
|
-
* @property {OnRampConfig} onramp - The config used for the OnRamp
|
|
11357
|
-
* @property {AllowedNetworkConfig[]} allowedNetworks - An array representing the allowed networks.
|
|
11358
|
-
* @property {GasEstimateTokenConfig | undefined} gasEstimateTokens - The config for the tokens used to estimate gas.
|
|
11359
|
-
*/
|
|
11360
|
-
type RemoteConfiguration = {
|
|
11361
|
-
dex: DexConfig;
|
|
11362
|
-
onramp: OnRampConfig;
|
|
11363
|
-
bridge: BridgeConfig;
|
|
11364
|
-
allowedNetworks: AllowedNetworkConfig[];
|
|
11365
|
-
gasEstimateTokens?: GasEstimateTokenConfig;
|
|
11366
|
-
imxAddressMapping?: ImxAddressConfig;
|
|
11367
|
-
};
|
|
11368
|
-
/**
|
|
11369
|
-
* A type representing the fee structure for an OnRamp provider
|
|
11370
|
-
* @property {string | undefined} minPercentage - minimum percentage fee shown if a fee range is provided
|
|
11371
|
-
* @property {string | undefined} maxPercentage - maximum percentage fee shown if a fee range is provided
|
|
11372
|
-
* @property {string | undefined} feePercentage - specific fee percentage shown if there is no range provided
|
|
11374
|
+
* A type representing the fee structure for an OnRamp provider
|
|
11375
|
+
* @property {string | undefined} minPercentage - minimum percentage fee shown if a fee range is provided
|
|
11376
|
+
* @property {string | undefined} maxPercentage - maximum percentage fee shown if a fee range is provided
|
|
11377
|
+
* @property {string | undefined} feePercentage - specific fee percentage shown if there is no range provided
|
|
11373
11378
|
*/
|
|
11374
11379
|
type OnRampProviderFees = {
|
|
11375
11380
|
minPercentage?: string;
|
|
@@ -11465,22 +11470,6 @@ type ChainTokensConfig = {
|
|
|
11465
11470
|
allowed?: TokenInfo[];
|
|
11466
11471
|
blockscout?: boolean;
|
|
11467
11472
|
};
|
|
11468
|
-
|
|
11469
|
-
/**
|
|
11470
|
-
* Represents information about a network.
|
|
11471
|
-
* @interface NetworkInfo
|
|
11472
|
-
* @property {string} name - The name of the network.
|
|
11473
|
-
* @property {number} chainId - The chain ID of the network.
|
|
11474
|
-
* @property {TokenInfo} nativeCurrency - Information about the native currency of the network.
|
|
11475
|
-
* @property {boolean} isSupported - Indicates whether the network is supported.
|
|
11476
|
-
*/
|
|
11477
|
-
interface NetworkInfo {
|
|
11478
|
-
name: string;
|
|
11479
|
-
chainId: number;
|
|
11480
|
-
nativeCurrency: TokenInfo;
|
|
11481
|
-
isSupported: boolean;
|
|
11482
|
-
}
|
|
11483
|
-
|
|
11484
11473
|
/**
|
|
11485
11474
|
* Interface representing the params of {@link Checkout.connect}.
|
|
11486
11475
|
* @property {Web3Provider} provider - The provider used to connect to the network.
|
|
@@ -11491,11 +11480,9 @@ interface ConnectParams {
|
|
|
11491
11480
|
/**
|
|
11492
11481
|
* Interface representing the result of {@link Checkout.connect}.
|
|
11493
11482
|
* @property {Web3Provider} provider - The provider used to connect to the network.
|
|
11494
|
-
* @property {NetworkInfo} network - Information about the connected network.
|
|
11495
11483
|
*/
|
|
11496
11484
|
interface ConnectResult {
|
|
11497
11485
|
provider: Web3Provider;
|
|
11498
|
-
network: NetworkInfo;
|
|
11499
11486
|
}
|
|
11500
11487
|
/**
|
|
11501
11488
|
* Interface representing the params of {@link Checkout.checkIsWalletConnected}.
|
|
@@ -11513,16 +11500,6 @@ interface CheckConnectionResult {
|
|
|
11513
11500
|
isConnected: boolean;
|
|
11514
11501
|
walletAddress: string;
|
|
11515
11502
|
}
|
|
11516
|
-
|
|
11517
|
-
/**
|
|
11518
|
-
* @typedef {string} Address - Represents an Ethereum address.
|
|
11519
|
-
*/
|
|
11520
|
-
type Address = string;
|
|
11521
|
-
/**
|
|
11522
|
-
* @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
|
|
11523
|
-
*/
|
|
11524
|
-
type FungibleToken = Address | 'NATIVE';
|
|
11525
|
-
|
|
11526
11503
|
/**
|
|
11527
11504
|
* An enum representing the type of gas estimate.
|
|
11528
11505
|
* @enum {string}
|
|
@@ -11586,7 +11563,20 @@ interface TokenAmountEstimate {
|
|
|
11586
11563
|
estimatedAmount?: BigNumber;
|
|
11587
11564
|
token?: TokenInfo;
|
|
11588
11565
|
}
|
|
11589
|
-
|
|
11566
|
+
/**
|
|
11567
|
+
* Represents information about a network.
|
|
11568
|
+
* @interface NetworkInfo
|
|
11569
|
+
* @property {string} name - The name of the network.
|
|
11570
|
+
* @property {number} chainId - The chain ID of the network.
|
|
11571
|
+
* @property {TokenInfo} nativeCurrency - Information about the native currency of the network.
|
|
11572
|
+
* @property {boolean} isSupported - Indicates whether the network is supported.
|
|
11573
|
+
*/
|
|
11574
|
+
interface NetworkInfo {
|
|
11575
|
+
name: string;
|
|
11576
|
+
chainId: number;
|
|
11577
|
+
nativeCurrency: TokenInfo;
|
|
11578
|
+
isSupported: boolean;
|
|
11579
|
+
}
|
|
11590
11580
|
/**
|
|
11591
11581
|
* Interface representing the parameters for {@link Checkout.switchNetwork}.
|
|
11592
11582
|
* @property {Web3Provider} provider - The provider to connect to the network.
|
|
@@ -11642,7 +11632,6 @@ declare enum NetworkFilterTypes {
|
|
|
11642
11632
|
interface NetworkFilter {
|
|
11643
11633
|
chainId: ChainId;
|
|
11644
11634
|
}
|
|
11645
|
-
|
|
11646
11635
|
/**
|
|
11647
11636
|
* Interface representing the parameters for {@link Checkout.sell}
|
|
11648
11637
|
* @property {Web3Provider} provider - The provider to use for the sell.
|
|
@@ -11653,7 +11642,6 @@ interface SellParams {
|
|
|
11653
11642
|
provider: Web3Provider;
|
|
11654
11643
|
orders: Array<SellOrder>;
|
|
11655
11644
|
}
|
|
11656
|
-
|
|
11657
11645
|
/**
|
|
11658
11646
|
* Interface representing the parameters for {@link Checkout.getTokenAllowList}.
|
|
11659
11647
|
* @property {TokenFilterTypes} type - The type of token to retrieve.
|
|
@@ -11688,7 +11676,6 @@ declare enum TokenFilterTypes {
|
|
|
11688
11676
|
interface TokenFilter {
|
|
11689
11677
|
address: string;
|
|
11690
11678
|
}
|
|
11691
|
-
|
|
11692
11679
|
/**
|
|
11693
11680
|
* Interface representing the parameters for {@link Checkout.sendTransaction}.
|
|
11694
11681
|
* @property {Web3Provider} provider - The provider to connect to the network.
|
|
@@ -11705,7 +11692,6 @@ interface SendTransactionParams {
|
|
|
11705
11692
|
interface SendTransactionResult {
|
|
11706
11693
|
transactionResponse: TransactionResponse;
|
|
11707
11694
|
}
|
|
11708
|
-
|
|
11709
11695
|
/**
|
|
11710
11696
|
* Enum representing the names of different wallet providers.
|
|
11711
11697
|
*/
|
|
@@ -11716,27 +11702,29 @@ declare enum WalletProviderName {
|
|
|
11716
11702
|
/**
|
|
11717
11703
|
* Interface for the parameters required to create a wallet provider {@link Checkout.createProvider}.
|
|
11718
11704
|
* @interface CreateProviderParams
|
|
11719
|
-
* @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.
|
|
11720
11708
|
*/
|
|
11721
11709
|
interface CreateProviderParams {
|
|
11722
|
-
|
|
11710
|
+
walletProvider: WalletProviderName;
|
|
11711
|
+
passport?: Passport;
|
|
11723
11712
|
}
|
|
11724
11713
|
/**
|
|
11725
11714
|
* Represents the result of creating a Web3 provider {@link Checkout.createProvider}.
|
|
11726
11715
|
* @property {Web3Provider} provider - The created Web3 provider.
|
|
11727
|
-
* @property {WalletProviderName}
|
|
11716
|
+
* @property {WalletProviderName} providerName - The name of the wallet provider.
|
|
11728
11717
|
*/
|
|
11729
11718
|
type CreateProviderResult = {
|
|
11730
11719
|
provider: Web3Provider;
|
|
11731
11720
|
walletProviderName: WalletProviderName;
|
|
11732
11721
|
};
|
|
11733
|
-
|
|
11734
11722
|
/**
|
|
11735
11723
|
* Interface representing a wallet filter to be used in {@link GetWalletAllowListParams}.
|
|
11736
|
-
* @property {WalletProviderName}
|
|
11724
|
+
* @property {WalletProviderName} connectionProvider - The connection provider to filter wallets by.
|
|
11737
11725
|
*/
|
|
11738
11726
|
interface WalletFilter {
|
|
11739
|
-
|
|
11727
|
+
walletProvider: WalletProviderName;
|
|
11740
11728
|
}
|
|
11741
11729
|
/**
|
|
11742
11730
|
* Interface representing the parameters for {@link Checkout.getWalletAllowList}.
|
|
@@ -11749,12 +11737,14 @@ interface GetWalletAllowListParams {
|
|
|
11749
11737
|
}
|
|
11750
11738
|
/**
|
|
11751
11739
|
* Interface representing information about a wallet used in {@link GetWalletAllowListResult}.
|
|
11752
|
-
* @property {WalletProviderName}
|
|
11740
|
+
* @property {WalletProviderName} walletProvider - The connection provider for the wallet.
|
|
11741
|
+
* @property {string} name - The name of the wallet.
|
|
11753
11742
|
* @property {string | undefined} description - A description of the wallet.
|
|
11754
11743
|
* @property {string | undefined} icon - The URL/data:image of an icon for the wallet.
|
|
11755
11744
|
*/
|
|
11756
11745
|
interface WalletInfo {
|
|
11757
|
-
|
|
11746
|
+
walletProvider: WalletProviderName;
|
|
11747
|
+
name: string;
|
|
11758
11748
|
description?: string;
|
|
11759
11749
|
icon?: string;
|
|
11760
11750
|
}
|
|
@@ -11771,7 +11761,6 @@ interface GetWalletAllowListResult {
|
|
|
11771
11761
|
declare enum WalletFilterTypes {
|
|
11772
11762
|
ALL = "all"
|
|
11773
11763
|
}
|
|
11774
|
-
|
|
11775
11764
|
/**
|
|
11776
11765
|
* Base URL for the checkout API based on the environment.
|
|
11777
11766
|
* @property {string} DEVELOPMENT - The base URL for the development environment.
|
|
@@ -11791,7 +11780,6 @@ type NetworkDetails = {
|
|
|
11791
11780
|
blockExplorerUrls?: string[];
|
|
11792
11781
|
};
|
|
11793
11782
|
type NetworkMap = Map<ChainId, NetworkDetails>;
|
|
11794
|
-
|
|
11795
11783
|
/**
|
|
11796
11784
|
* An enum representing the type of exchange.
|
|
11797
11785
|
* @enum {string}
|
|
@@ -11813,27 +11801,71 @@ interface FiatRampParams {
|
|
|
11813
11801
|
web3Provider: Web3Provider;
|
|
11814
11802
|
tokenAmount?: string;
|
|
11815
11803
|
tokenAddress?: string;
|
|
11816
|
-
passport?:
|
|
11804
|
+
passport?: Passport;
|
|
11817
11805
|
}
|
|
11818
|
-
|
|
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
|
+
};
|
|
11819
11860
|
type RemoteConfigParams = {
|
|
11820
11861
|
isDevelopment: boolean;
|
|
11821
11862
|
isProduction: boolean;
|
|
11822
11863
|
};
|
|
11823
11864
|
declare class RemoteConfigFetcher {
|
|
11824
|
-
private isDevelopment;
|
|
11825
|
-
private isProduction;
|
|
11826
|
-
private configCache;
|
|
11827
|
-
private tokensCache;
|
|
11828
11865
|
constructor(params: RemoteConfigParams);
|
|
11829
|
-
private static makeHttpRequest;
|
|
11830
|
-
private getEndpoint;
|
|
11831
|
-
private loadConfig;
|
|
11832
|
-
private loadConfigTokens;
|
|
11833
11866
|
getConfig(key?: keyof RemoteConfiguration): Promise<RemoteConfiguration | RemoteConfiguration[keyof RemoteConfiguration] | undefined>;
|
|
11834
11867
|
getTokensConfig(chainId: ChainId): Promise<ChainTokensConfig>;
|
|
11835
11868
|
}
|
|
11836
|
-
|
|
11837
11869
|
declare class CheckoutConfiguration {
|
|
11838
11870
|
readonly isDevelopment: boolean;
|
|
11839
11871
|
readonly isProduction: boolean;
|
|
@@ -11845,7 +11877,9 @@ declare class CheckoutConfiguration {
|
|
|
11845
11877
|
readonly networkMap: NetworkMap;
|
|
11846
11878
|
constructor(config: CheckoutModuleConfiguration);
|
|
11847
11879
|
}
|
|
11848
|
-
|
|
11880
|
+
type AvailabilityService = {
|
|
11881
|
+
checkDexAvailability: () => Promise<boolean>;
|
|
11882
|
+
};
|
|
11849
11883
|
interface FiatRampWidgetParams {
|
|
11850
11884
|
exchangeType: ExchangeType;
|
|
11851
11885
|
isPassport: boolean;
|
|
@@ -11863,590 +11897,16 @@ declare class FiatRampService {
|
|
|
11863
11897
|
constructor(config: CheckoutConfiguration);
|
|
11864
11898
|
feeEstimate(): Promise<OnRampProviderFees>;
|
|
11865
11899
|
createWidgetUrl(params: FiatRampWidgetParams): Promise<string>;
|
|
11866
|
-
private getTransakWidgetUrl;
|
|
11867
|
-
}
|
|
11868
|
-
|
|
11869
|
-
type AvailabilityService = {
|
|
11870
|
-
checkDexAvailability: () => Promise<boolean>;
|
|
11871
|
-
};
|
|
11872
|
-
|
|
11873
|
-
/**
|
|
11874
|
-
* Enum representing the themes for the widgets.
|
|
11875
|
-
*/
|
|
11876
|
-
declare enum WidgetTheme {
|
|
11877
|
-
LIGHT = "light",
|
|
11878
|
-
DARK = "dark"
|
|
11879
|
-
}
|
|
11880
|
-
|
|
11881
|
-
/**
|
|
11882
|
-
* Represents the local configuration options for the Checkout Widgets.
|
|
11883
|
-
* @property {WidgetTheme | undefined} theme - The theme of the Checkout Widget (default: "DARK")
|
|
11884
|
-
*/
|
|
11885
|
-
type WidgetConfiguration = {
|
|
11886
|
-
theme?: WidgetTheme;
|
|
11887
|
-
};
|
|
11888
|
-
|
|
11889
|
-
/**
|
|
11890
|
-
* Enum representing the events emitted by the widgets.
|
|
11891
|
-
*/
|
|
11892
|
-
declare enum IMTBLWidgetEvents {
|
|
11893
|
-
IMTBL_WIDGETS_PROVIDER = "imtbl-widgets-provider",
|
|
11894
|
-
IMTBL_CONNECT_WIDGET_EVENT = "imtbl-connect-widget",
|
|
11895
|
-
IMTBL_WALLET_WIDGET_EVENT = "imtbl-wallet-widget",
|
|
11896
|
-
IMTBL_SWAP_WIDGET_EVENT = "imtbl-swap-widget",
|
|
11897
|
-
IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget",
|
|
11898
|
-
IMTBL_ONRAMP_WIDGET_EVENT = "imtbl-onramp-widget",
|
|
11899
|
-
IMTBL_SALE_WIDGET_EVENT = "imtbl-sale-widget"
|
|
11900
|
-
}
|
|
11901
|
-
/**
|
|
11902
|
-
* Enum for events raised for about provider objects
|
|
11903
|
-
*/
|
|
11904
|
-
declare enum ProviderEventType {
|
|
11905
|
-
PROVIDER_UPDATED = "PROVIDER_UPDATED"
|
|
11906
|
-
}
|
|
11907
|
-
/**
|
|
11908
|
-
* Payload type for the PROVIDER_UPDATED event
|
|
11909
|
-
*/
|
|
11910
|
-
type ProviderUpdated = {
|
|
11911
|
-
provider: Web3Provider;
|
|
11912
|
-
};
|
|
11913
|
-
|
|
11914
|
-
/**
|
|
11915
|
-
* Enum representing possible Connect Widget event types.
|
|
11916
|
-
*/
|
|
11917
|
-
declare enum ConnectEventType {
|
|
11918
|
-
CLOSE_WIDGET = "close-widget",
|
|
11919
|
-
SUCCESS = "success",
|
|
11920
|
-
FAILURE = "failure"
|
|
11921
11900
|
}
|
|
11922
|
-
/**
|
|
11923
|
-
* Represents a successful connection.
|
|
11924
|
-
* @property {Web3Provider} provider - The connected provider.
|
|
11925
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name of the connected provider.
|
|
11926
|
-
*/
|
|
11927
|
-
type ConnectionSuccess = {
|
|
11928
|
-
provider: Web3Provider;
|
|
11929
|
-
walletProviderName: WalletProviderName | undefined;
|
|
11930
|
-
};
|
|
11931
|
-
/**
|
|
11932
|
-
* Represents a connection failure with a reason.
|
|
11933
|
-
* @property {string} reason - The reason for the failed connection.
|
|
11934
|
-
*/
|
|
11935
|
-
type ConnectionFailed = {
|
|
11936
|
-
reason: string;
|
|
11937
|
-
};
|
|
11938
|
-
|
|
11939
|
-
/**
|
|
11940
|
-
* Enum representing possible Wallet Widget event types.
|
|
11941
|
-
*/
|
|
11942
|
-
declare enum WalletEventType {
|
|
11943
|
-
CLOSE_WIDGET = "close-widget",
|
|
11944
|
-
NETWORK_SWITCH = "network-switch",
|
|
11945
|
-
DISCONNECT_WALLET = "disconnect-wallet"
|
|
11946
|
-
}
|
|
11947
|
-
/**
|
|
11948
|
-
* Represents an event that is triggered when the user switches the network in their wallet.
|
|
11949
|
-
* @property {string} network - The name of the network that the user switched to.
|
|
11950
|
-
* @property {number} chainId - The chain ID of the network that the user switched to.
|
|
11951
|
-
* @property {Web3Provider} provider - The Web3 provider object for the switched network.
|
|
11952
|
-
*/
|
|
11953
|
-
type WalletNetworkSwitchEvent = {
|
|
11954
|
-
network: string;
|
|
11955
|
-
chainId: number;
|
|
11956
|
-
provider: Web3Provider;
|
|
11957
|
-
};
|
|
11958
|
-
/**
|
|
11959
|
-
* Represents an event that is triggered when a wallet is disconnected.
|
|
11960
|
-
*/
|
|
11961
|
-
type WalletDisconnectWalletEvent = {};
|
|
11962
|
-
|
|
11963
|
-
/**
|
|
11964
|
-
* Enum representing possible Swap Widget event types.
|
|
11965
|
-
*/
|
|
11966
|
-
declare enum SwapEventType {
|
|
11967
|
-
CLOSE_WIDGET = "close-widget",
|
|
11968
|
-
SUCCESS = "success",
|
|
11969
|
-
FAILURE = "failure",
|
|
11970
|
-
REJECTED = "rejected"
|
|
11971
|
-
}
|
|
11972
|
-
/**
|
|
11973
|
-
* Represents a successful swap transaction.
|
|
11974
|
-
* @property {string} transactionHash - The hash of the successful transaction.
|
|
11975
|
-
*/
|
|
11976
|
-
type SwapSuccess = {
|
|
11977
|
-
transactionHash: string;
|
|
11978
|
-
};
|
|
11979
|
-
/**
|
|
11980
|
-
* Type representing a Swap Widget with type FAILURE.
|
|
11981
|
-
* @property {string} reason - The reason why the swap failed.
|
|
11982
|
-
* @property {number} timestamp - The timestamp of the failed swap.
|
|
11983
|
-
*/
|
|
11984
|
-
type SwapFailed = {
|
|
11985
|
-
reason: string;
|
|
11986
|
-
timestamp: number;
|
|
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 SwapRejected = {
|
|
11994
|
-
reason: string;
|
|
11995
|
-
timestamp: number;
|
|
11996
|
-
};
|
|
11997
|
-
|
|
11998
|
-
/**
|
|
11999
|
-
* Enum representing possible Sale Widget event types.
|
|
12000
|
-
*/
|
|
12001
|
-
declare enum SaleEventType {
|
|
12002
|
-
CLOSE_WIDGET = "close-widget",
|
|
12003
|
-
SUCCESS = "success",
|
|
12004
|
-
FAILURE = "failure",
|
|
12005
|
-
REJECTED = "rejected"
|
|
12006
|
-
}
|
|
12007
|
-
/**
|
|
12008
|
-
* Represents a successful Sale transaction.
|
|
12009
|
-
* @property {string} transactionHash - The hash of the successful transaction.
|
|
12010
|
-
*/
|
|
12011
|
-
type SaleSuccess = {
|
|
12012
|
-
transactions: {
|
|
12013
|
-
method: string;
|
|
12014
|
-
hash: string | undefined;
|
|
12015
|
-
}[];
|
|
12016
|
-
[key: string]: unknown;
|
|
12017
|
-
};
|
|
12018
|
-
/**
|
|
12019
|
-
* Type representing a Sale Widget with type FAILURE.
|
|
12020
|
-
* @property {string} reason - The reason why the swap failed.
|
|
12021
|
-
* @property {number} timestamp - The timestamp of the failed swap.
|
|
12022
|
-
*/
|
|
12023
|
-
type SaleFailed = {
|
|
12024
|
-
reason: string;
|
|
12025
|
-
timestamp: number;
|
|
12026
|
-
};
|
|
12027
|
-
|
|
12028
|
-
/**
|
|
12029
|
-
* Enum of possible Bridge Widget event types.
|
|
12030
|
-
*/
|
|
12031
|
-
declare enum BridgeEventType {
|
|
12032
|
-
CLOSE_WIDGET = "close-widget",
|
|
12033
|
-
SUCCESS = "success",
|
|
12034
|
-
FAILURE = "failure"
|
|
12035
|
-
}
|
|
12036
|
-
/**
|
|
12037
|
-
* Represents a successful bridge transaction.
|
|
12038
|
-
* @property {string} transactionHash - The hash of the successful transaction.
|
|
12039
|
-
*/
|
|
12040
|
-
type BridgeSuccess = {
|
|
12041
|
-
transactionHash: string;
|
|
12042
|
-
};
|
|
12043
|
-
/**
|
|
12044
|
-
* Represents a failed bridge transaction.
|
|
12045
|
-
* @property {string} reason - The reason for the failed transaction.
|
|
12046
|
-
* @property {number} timestamp - The timestamp of the failed transaction.
|
|
12047
|
-
*/
|
|
12048
|
-
type BridgeFailed = {
|
|
12049
|
-
reason: string;
|
|
12050
|
-
timestamp: number;
|
|
12051
|
-
};
|
|
12052
|
-
|
|
12053
|
-
/**
|
|
12054
|
-
* Enum representing different types of orchestration events.
|
|
12055
|
-
*/
|
|
12056
|
-
declare enum OrchestrationEventType {
|
|
12057
|
-
REQUEST_CONNECT = "request-connect",
|
|
12058
|
-
REQUEST_WALLET = "request-wallet",
|
|
12059
|
-
REQUEST_SWAP = "request-swap",
|
|
12060
|
-
REQUEST_BRIDGE = "request-bridge",
|
|
12061
|
-
REQUEST_ONRAMP = "request-onramp"
|
|
12062
|
-
}
|
|
12063
|
-
/**
|
|
12064
|
-
* Represents the connect event object when the connect widget is requested.
|
|
12065
|
-
* @property {string} walletProviderName - The wallet provider name.
|
|
12066
|
-
*/
|
|
12067
|
-
type RequestConnectEvent = {
|
|
12068
|
-
walletProviderName: string;
|
|
12069
|
-
};
|
|
12070
|
-
/**
|
|
12071
|
-
* Represents the wallet event object when the wallet widget is requested.
|
|
12072
|
-
* @property {string} walletProviderName - The wallet provider name.
|
|
12073
|
-
*/
|
|
12074
|
-
type RequestWalletEvent = {
|
|
12075
|
-
walletProviderName: string;
|
|
12076
|
-
};
|
|
12077
|
-
/**
|
|
12078
|
-
* Represents the swap event object when the swap widget is requested.
|
|
12079
|
-
* @property {string} fromTokenAddress - The address of the token to swap from.
|
|
12080
|
-
* @property {string} toTokenAddress - The address of the token to swap to.
|
|
12081
|
-
* @property {string} amount - The amount of from tokens to swap.
|
|
12082
|
-
*/
|
|
12083
|
-
type RequestSwapEvent = {
|
|
12084
|
-
fromTokenAddress: string;
|
|
12085
|
-
toTokenAddress: string;
|
|
12086
|
-
amount: string;
|
|
12087
|
-
};
|
|
12088
|
-
/**
|
|
12089
|
-
* Represents the bridge event object when the bridge widget is requested.
|
|
12090
|
-
* @property {string} tokenAddress - The address of the token to bridge.
|
|
12091
|
-
* @property {string} amount - The amount of tokens to bridge.
|
|
12092
|
-
*/
|
|
12093
|
-
type RequestBridgeEvent = {
|
|
12094
|
-
tokenAddress: string;
|
|
12095
|
-
amount: string;
|
|
12096
|
-
};
|
|
12097
|
-
/**
|
|
12098
|
-
* Represents the onramp event object when the onramp widget is requested.
|
|
12099
|
-
* @property {string} tokenAddress - The address of the token to be used for onramp.
|
|
12100
|
-
* @property {string} amount - The amount of tokens to onramp.
|
|
12101
|
-
*/
|
|
12102
|
-
type RequestOnrampEvent = {
|
|
12103
|
-
tokenAddress: string;
|
|
12104
|
-
amount: string;
|
|
12105
|
-
};
|
|
12106
|
-
type OrchestrationEventData = RequestConnectEvent | RequestWalletEvent | RequestSwapEvent | RequestBridgeEvent | RequestOnrampEvent;
|
|
12107
|
-
|
|
12108
|
-
/**
|
|
12109
|
-
* Enum of possible OnRamp Widget event types.
|
|
12110
|
-
*/
|
|
12111
|
-
declare enum OnRampEventType {
|
|
12112
|
-
CLOSE_WIDGET = "close-widget",
|
|
12113
|
-
SUCCESS = "success",
|
|
12114
|
-
FAILURE = "failure"
|
|
12115
|
-
}
|
|
12116
|
-
/**
|
|
12117
|
-
* Represents a successful on-ramp transaction.
|
|
12118
|
-
* @property {string} transactionHash - The transaction hash of the successful transaction.
|
|
12119
|
-
*/
|
|
12120
|
-
type OnRampSuccess = {
|
|
12121
|
-
transactionHash: string;
|
|
12122
|
-
};
|
|
12123
|
-
/**
|
|
12124
|
-
* Type representing a On-ramp Widget with type FAILURE.
|
|
12125
|
-
* @property {string} reason - The reason why the on-ramp failed.
|
|
12126
|
-
* @property {number} timestamp - The timestamp of the failed transaction.
|
|
12127
|
-
*/
|
|
12128
|
-
type OnRampFailed = {
|
|
12129
|
-
reason: string;
|
|
12130
|
-
timestamp: number;
|
|
12131
|
-
};
|
|
12132
|
-
|
|
12133
|
-
declare enum ConnectTargetLayer {
|
|
12134
|
-
LAYER1 = "LAYER1",
|
|
12135
|
-
LAYER2 = "LAYER2"
|
|
12136
|
-
}
|
|
12137
|
-
type ConnectWidgetParams = {};
|
|
12138
|
-
|
|
12139
|
-
/**
|
|
12140
|
-
* Bridge Widget parameters
|
|
12141
|
-
* @property {string | undefined} fromContractAddress - The contract address of the token to bridge from, used to populate the bridge form token field
|
|
12142
|
-
* @property {string | undefined} amount - The formatted amount to bridge, used to populate the bridge form amount field
|
|
12143
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the bridge widget
|
|
12144
|
-
*/
|
|
12145
|
-
type BridgeWidgetParams = {
|
|
12146
|
-
fromContractAddress?: string;
|
|
12147
|
-
amount?: string;
|
|
12148
|
-
walletProviderName?: WalletProviderName;
|
|
12149
|
-
};
|
|
12150
|
-
|
|
12151
|
-
/**
|
|
12152
|
-
* Wallet Widget parameters
|
|
12153
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the wallet widget
|
|
12154
|
-
* @property {Web3Provider | undefined} web3Provider - The ethers Web3Provider
|
|
12155
|
-
*/
|
|
12156
|
-
type WalletWidgetParams = {
|
|
12157
|
-
walletProviderName?: WalletProviderName;
|
|
12158
|
-
};
|
|
12159
|
-
|
|
12160
|
-
/**
|
|
12161
|
-
* Swap Widget parameters
|
|
12162
|
-
* @property {string | undefined} amount - The formatted amount to swap, used to populate the swap from amount field
|
|
12163
|
-
* @property {string | undefined} fromContractAddress - The contract address of the token to swap from
|
|
12164
|
-
* @property {string | undefined} toContractAddress - The contract address of the token to swap to
|
|
12165
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the swap widget
|
|
12166
|
-
*/
|
|
12167
|
-
interface SwapWidgetParams {
|
|
12168
|
-
amount?: string;
|
|
12169
|
-
fromContractAddress?: string;
|
|
12170
|
-
toContractAddress?: string;
|
|
12171
|
-
walletProviderName?: WalletProviderName;
|
|
12172
|
-
}
|
|
12173
|
-
|
|
12174
|
-
/**
|
|
12175
|
-
* OnRamp Widget parameters
|
|
12176
|
-
* @property {string | undefined} contractAddress - The contract address of the token to onramp
|
|
12177
|
-
* @property {string | undefined} amount - The formatted amount to onramp, used to populate the onramp form amount field
|
|
12178
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the onramp widget
|
|
12179
|
-
*/
|
|
12180
|
-
type OnRampWidgetParams = {
|
|
12181
|
-
contractAddress?: string;
|
|
12182
|
-
amount?: string;
|
|
12183
|
-
walletProviderName?: WalletProviderName;
|
|
12184
|
-
};
|
|
12185
|
-
|
|
12186
|
-
/**
|
|
12187
|
-
* Sale Widget parameters
|
|
12188
|
-
* @property {string} amount - The total price to pay for the items in the sale
|
|
12189
|
-
* @property {SaleItem[]} items - The list of products to be purchased
|
|
12190
|
-
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to default to if no web3Provider is passed
|
|
12191
|
-
*/
|
|
12192
|
-
type SaleWidgetParams = {
|
|
12193
|
-
amount?: string;
|
|
12194
|
-
environmentId?: string;
|
|
12195
|
-
fromContractAddress?: string;
|
|
12196
|
-
items?: SaleItem[];
|
|
12197
|
-
walletProviderName?: WalletProviderName;
|
|
12198
|
-
};
|
|
12199
|
-
type SaleItem = {
|
|
12200
|
-
productId: string;
|
|
12201
|
-
qty: number;
|
|
12202
|
-
name: string;
|
|
12203
|
-
image: string;
|
|
12204
|
-
description: string;
|
|
12205
|
-
};
|
|
12206
|
-
|
|
12207
|
-
type ConnectWidgetConfiguration = {} & WidgetConfiguration;
|
|
12208
|
-
|
|
12209
|
-
type BridgeWidgetConfiguration = {} & WidgetConfiguration;
|
|
12210
|
-
|
|
12211
|
-
type WalletWidgetConfiguration = {} & WidgetConfiguration;
|
|
12212
|
-
|
|
12213
|
-
type SwapWidgetConfiguration = {} & WidgetConfiguration;
|
|
12214
|
-
|
|
12215
|
-
type OnrampWidgetConfiguration = {} & WidgetConfiguration;
|
|
12216
|
-
|
|
12217
|
-
type SaleWidgetConfiguration = {} & WidgetConfiguration;
|
|
12218
|
-
|
|
12219
|
-
/**
|
|
12220
|
-
* Enum representing the list of widget types.
|
|
12221
|
-
*/
|
|
12222
|
-
declare enum WidgetType {
|
|
12223
|
-
CONNECT = "connect",
|
|
12224
|
-
WALLET = "wallet",
|
|
12225
|
-
SWAP = "swap",
|
|
12226
|
-
BRIDGE = "bridge",
|
|
12227
|
-
ONRAMP = "onramp",
|
|
12228
|
-
SALE = "sale"
|
|
12229
|
-
}
|
|
12230
|
-
/**
|
|
12231
|
-
* Widget properties definition for each widget. Used for creating and updating widgets
|
|
12232
|
-
*/
|
|
12233
|
-
type WidgetProperties<T extends WidgetType> = {
|
|
12234
|
-
config?: WidgetConfigurations[T];
|
|
12235
|
-
provider?: Web3Provider;
|
|
12236
|
-
};
|
|
12237
|
-
type WidgetConfigurations = {
|
|
12238
|
-
[WidgetType.CONNECT]: ConnectWidgetConfiguration;
|
|
12239
|
-
[WidgetType.WALLET]: WalletWidgetConfiguration;
|
|
12240
|
-
[WidgetType.SWAP]: SwapWidgetConfiguration;
|
|
12241
|
-
[WidgetType.BRIDGE]: BridgeWidgetConfiguration;
|
|
12242
|
-
[WidgetType.ONRAMP]: OnrampWidgetConfiguration;
|
|
12243
|
-
[WidgetType.SALE]: SaleWidgetConfiguration;
|
|
12244
|
-
};
|
|
12245
|
-
type WidgetParameters = {
|
|
12246
|
-
[WidgetType.CONNECT]: ConnectWidgetParams;
|
|
12247
|
-
[WidgetType.WALLET]: WalletWidgetParams;
|
|
12248
|
-
[WidgetType.SWAP]: SwapWidgetParams;
|
|
12249
|
-
[WidgetType.BRIDGE]: BridgeWidgetParams;
|
|
12250
|
-
[WidgetType.ONRAMP]: OnRampWidgetParams;
|
|
12251
|
-
[WidgetType.SALE]: SaleWidgetParams;
|
|
12252
|
-
};
|
|
12253
|
-
/**
|
|
12254
|
-
* Represents all the possible event types that are emitted by the widgets.
|
|
12255
|
-
*/
|
|
12256
|
-
type WidgetEventTypes = {
|
|
12257
|
-
[WidgetType.CONNECT]: ConnectEventType | OrchestrationEventType;
|
|
12258
|
-
[WidgetType.WALLET]: WalletEventType | OrchestrationEventType;
|
|
12259
|
-
[WidgetType.SWAP]: SwapEventType | OrchestrationEventType;
|
|
12260
|
-
[WidgetType.BRIDGE]: BridgeEventType | OrchestrationEventType;
|
|
12261
|
-
[WidgetType.ONRAMP]: OnRampEventType | OrchestrationEventType;
|
|
12262
|
-
[WidgetType.SALE]: SaleEventType | OrchestrationEventType;
|
|
12263
|
-
};
|
|
12264
|
-
type OrchestrationMapping = {
|
|
12265
|
-
[OrchestrationEventType.REQUEST_CONNECT]: RequestConnectEvent;
|
|
12266
|
-
[OrchestrationEventType.REQUEST_WALLET]: RequestWalletEvent;
|
|
12267
|
-
[OrchestrationEventType.REQUEST_SWAP]: RequestSwapEvent;
|
|
12268
|
-
[OrchestrationEventType.REQUEST_BRIDGE]: RequestBridgeEvent;
|
|
12269
|
-
[OrchestrationEventType.REQUEST_ONRAMP]: RequestOnrampEvent;
|
|
12270
|
-
};
|
|
12271
|
-
type ProviderEventMapping = {
|
|
12272
|
-
[ProviderEventType.PROVIDER_UPDATED]: ProviderUpdated;
|
|
12273
|
-
};
|
|
12274
|
-
/**
|
|
12275
|
-
* Mapping of widget type, to each of it's events and then each event's payload
|
|
12276
|
-
* Update this whenever a new event is created and used by a widget
|
|
12277
|
-
* Each widget also has all of the orchestration events
|
|
12278
|
-
*/
|
|
12279
|
-
type WidgetEventData = {
|
|
12280
|
-
[WidgetType.CONNECT]: {
|
|
12281
|
-
[ConnectEventType.SUCCESS]: ConnectionSuccess;
|
|
12282
|
-
[ConnectEventType.FAILURE]: ConnectionFailed;
|
|
12283
|
-
[ConnectEventType.CLOSE_WIDGET]: {};
|
|
12284
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12285
|
-
[WidgetType.WALLET]: {
|
|
12286
|
-
[WalletEventType.NETWORK_SWITCH]: WalletNetworkSwitchEvent;
|
|
12287
|
-
[WalletEventType.DISCONNECT_WALLET]: WalletDisconnectWalletEvent;
|
|
12288
|
-
[WalletEventType.CLOSE_WIDGET]: {};
|
|
12289
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12290
|
-
[WidgetType.SWAP]: {
|
|
12291
|
-
[SwapEventType.SUCCESS]: SwapSuccess;
|
|
12292
|
-
[SwapEventType.FAILURE]: SwapFailed;
|
|
12293
|
-
[SwapEventType.REJECTED]: SwapRejected;
|
|
12294
|
-
[SwapEventType.CLOSE_WIDGET]: {};
|
|
12295
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12296
|
-
[WidgetType.BRIDGE]: {
|
|
12297
|
-
[BridgeEventType.SUCCESS]: BridgeSuccess;
|
|
12298
|
-
[BridgeEventType.FAILURE]: BridgeFailed;
|
|
12299
|
-
[BridgeEventType.CLOSE_WIDGET]: {};
|
|
12300
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12301
|
-
[WidgetType.ONRAMP]: {
|
|
12302
|
-
[OnRampEventType.SUCCESS]: OnRampSuccess;
|
|
12303
|
-
[OnRampEventType.FAILURE]: OnRampFailed;
|
|
12304
|
-
[OnRampEventType.CLOSE_WIDGET]: {};
|
|
12305
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12306
|
-
[WidgetType.SALE]: {
|
|
12307
|
-
[SaleEventType.SUCCESS]: SaleSuccess;
|
|
12308
|
-
[SaleEventType.FAILURE]: SaleFailed;
|
|
12309
|
-
[SaleEventType.REJECTED]: any;
|
|
12310
|
-
[SaleEventType.CLOSE_WIDGET]: {};
|
|
12311
|
-
} & OrchestrationMapping & ProviderEventMapping;
|
|
12312
|
-
};
|
|
12313
|
-
/**
|
|
12314
|
-
* Represents an event emitted by a widget. The event type should match the event data
|
|
12315
|
-
*/
|
|
12316
|
-
/**
|
|
12317
|
-
* Represents an event emitted by a widget.
|
|
12318
|
-
* @template T - The widget type
|
|
12319
|
-
* @template KEventName - The widget event name.
|
|
12320
|
-
* @property {KEventName} type - The type of the event.
|
|
12321
|
-
* @property {WidgetEventData[T][KEventName]} data - The data associated with the widget event.
|
|
12322
|
-
*/
|
|
12323
|
-
type WidgetEvent<T extends WidgetType, KEventName extends keyof WidgetEventData[T]> = {
|
|
12324
|
-
type: KEventName;
|
|
12325
|
-
data: WidgetEventData[T][KEventName];
|
|
12326
|
-
};
|
|
12327
|
-
/**
|
|
12328
|
-
* Represents an event emitted by a widget.
|
|
12329
|
-
* @template KEventName - The orchestration event name.
|
|
12330
|
-
* @property {KEventName} type - The type of the event.
|
|
12331
|
-
* @property {OrchestrationMapping[KEventName]} data - The data associated with the event.
|
|
12332
|
-
*/
|
|
12333
|
-
type OrchestrationEvent<KEventName extends keyof OrchestrationMapping> = {
|
|
12334
|
-
type: KEventName;
|
|
12335
|
-
data: OrchestrationMapping[KEventName];
|
|
12336
|
-
};
|
|
12337
|
-
/**
|
|
12338
|
-
* Represents an event emitted by a widget.
|
|
12339
|
-
* @template KEventName - The provider event name.
|
|
12340
|
-
* @property {KEventName} type - The type of the event.
|
|
12341
|
-
* @property {ProviderEventMapping[KEventName]} data - The data associated with the event.
|
|
12342
|
-
*/
|
|
12343
|
-
type ProviderEvent<KEventName extends keyof ProviderEventMapping> = {
|
|
12344
|
-
type: KEventName;
|
|
12345
|
-
data: ProviderEventMapping[KEventName];
|
|
12346
|
-
};
|
|
12347
|
-
interface IWidgetsFactory {
|
|
12348
|
-
/**
|
|
12349
|
-
* Create a new widget instance.
|
|
12350
|
-
* @param type widget type to instantiate.
|
|
12351
|
-
*/
|
|
12352
|
-
create<T extends WidgetType>(type: T, config?: WidgetConfigurations[T], provider?: Web3Provider): Widget<T>;
|
|
12353
|
-
updateProvider(provider: Web3Provider): void;
|
|
12354
|
-
}
|
|
12355
|
-
/**
|
|
12356
|
-
* Widget interface. Every widget implements this interface.
|
|
12357
|
-
*/
|
|
12358
|
-
interface Widget<T extends WidgetType> {
|
|
12359
|
-
/**
|
|
12360
|
-
* Mount a widget to a DOM ref element.
|
|
12361
|
-
* @param id ID of the DOM element where the widget will be mounted.
|
|
12362
|
-
*/
|
|
12363
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12364
|
-
/**
|
|
12365
|
-
* Unmount a widget and reset parameters
|
|
12366
|
-
*/
|
|
12367
|
-
unmount(): void;
|
|
12368
|
-
/**
|
|
12369
|
-
* Update the widget properties
|
|
12370
|
-
* @param props Widget specific properties including configuration
|
|
12371
|
-
*/
|
|
12372
|
-
update(props: WidgetProperties<T>): void;
|
|
12373
|
-
/**
|
|
12374
|
-
* Add a listener for a widget event.
|
|
12375
|
-
* @param event Widget specific event name.
|
|
12376
|
-
* @param callback function to execute when the event is received.
|
|
12377
|
-
*/
|
|
12378
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12379
|
-
/**
|
|
12380
|
-
* Removes an event listener for a widget event.
|
|
12381
|
-
* @param type Widget specific event name.
|
|
12382
|
-
*/
|
|
12383
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12384
|
-
}
|
|
12385
|
-
/**
|
|
12386
|
-
* Represents the version of the Checkout Widgets to use defaults to (0.1.9-alpha)
|
|
12387
|
-
* @property {number} major - The major version of the widgets, must specify a major version even if it is 0.
|
|
12388
|
-
* @property {number | undefined} minor - The minor version of the widgets, leaving this blank will use the latest minor based on major
|
|
12389
|
-
* @property {number | undefined} patch - The patch version of the widgets, leaving this blank will use the latest minor based on minor
|
|
12390
|
-
* @property {'alpha' | undefined} prerelease - The prerelease version of the widgets, can only be 'alpha'. Do not use in production.
|
|
12391
|
-
* @property {number | undefined} build - The build version of the widgets. Do not use in production.
|
|
12392
|
-
*
|
|
12393
|
-
* @example
|
|
12394
|
-
* { major: 0 } - use default version 0.1.9-alpha
|
|
12395
|
-
* { major: 1 } - use version 1.x.x, pickup all new minor and patch versions released
|
|
12396
|
-
* { major: 1, minor: 1 } - use version 1.1.x, pickup all new patch versions released
|
|
12397
|
-
* { major: 1, minor: 2, patch: 3 } - use version 1.2.3 specifically
|
|
12398
|
-
*/
|
|
12399
|
-
type SemanticVersion = {
|
|
12400
|
-
major: number;
|
|
12401
|
-
minor?: number;
|
|
12402
|
-
patch?: number;
|
|
12403
|
-
prerelease?: 'alpha';
|
|
12404
|
-
build?: number;
|
|
12405
|
-
};
|
|
12406
|
-
/**
|
|
12407
|
-
* Represents the global configuration options for the Checkout Widgets.
|
|
12408
|
-
* @property {WidgetTheme | undefined} theme - The theme of the Checkout Widget (default: "DARK")
|
|
12409
|
-
* @property {Environment | undefined} environment - The environment configuration (default: "SANDBOX")
|
|
12410
|
-
* @property {SemanticVersion | undefined} version - The version of the checkout widgets js file to use (default: "0.1.x")
|
|
12411
|
-
* @property {boolean | undefined} isOnRampEnabled - Enable on-ramp top-up method (default: "true")
|
|
12412
|
-
* @property {boolean | undefined} isSwapEnabled - Enable swap top-up method (default: "true")
|
|
12413
|
-
* @property {boolean | undefined} isBridgeEnabled - Enable bridge top-up method (default: "true")
|
|
12414
|
-
*/
|
|
12415
|
-
type CheckoutWidgetsConfig = {
|
|
12416
|
-
theme?: WidgetTheme;
|
|
12417
|
-
environment?: Environment;
|
|
12418
|
-
version?: SemanticVersion;
|
|
12419
|
-
isOnRampEnabled?: boolean;
|
|
12420
|
-
isSwapEnabled?: boolean;
|
|
12421
|
-
isBridgeEnabled?: boolean;
|
|
12422
|
-
};
|
|
12423
|
-
|
|
12424
|
-
/**
|
|
12425
|
-
* Represents the configuration options for instantiating the Checkout Widgets factory.
|
|
12426
|
-
* @property {WidgetConfiguration} config - global configuration options for the widgets.
|
|
12427
|
-
* @property {SemanticVersion | undefined} version - version of the Checkout widgets bundle (default latest version will be used).
|
|
12428
|
-
*/
|
|
12429
|
-
type WidgetsInit = {
|
|
12430
|
-
config: WidgetConfiguration;
|
|
12431
|
-
version?: SemanticVersion;
|
|
12432
|
-
};
|
|
12433
|
-
|
|
12434
11901
|
declare class Checkout {
|
|
12435
|
-
private readOnlyProviders;
|
|
12436
11902
|
readonly config: CheckoutConfiguration;
|
|
12437
11903
|
readonly fiatRampService: FiatRampService;
|
|
12438
11904
|
readonly availability: AvailabilityService;
|
|
12439
|
-
readonly passport?: Passport;
|
|
12440
11905
|
/**
|
|
12441
11906
|
* Constructs a new instance of the CheckoutModule class.
|
|
12442
11907
|
* @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
|
|
12443
11908
|
*/
|
|
12444
11909
|
constructor(config?: CheckoutModuleConfiguration);
|
|
12445
|
-
/**
|
|
12446
|
-
* Loads the widgets bundle and initiate the widgets factory.
|
|
12447
|
-
* @param {WidgetsInit} init - The initialisation parameters for loading the widgets bundle and applying configuration
|
|
12448
|
-
*/
|
|
12449
|
-
widgets(init: WidgetsInit): Promise<ImmutableCheckoutWidgets.WidgetsFactory>;
|
|
12450
11910
|
/**
|
|
12451
11911
|
* Creates a provider using the given parameters.
|
|
12452
11912
|
* @param {CreateProviderParams} params - The parameters for creating the provider.
|
|
@@ -12566,123 +12026,4 @@ declare class Checkout {
|
|
|
12566
12026
|
isSwapAvailable(): Promise<boolean>;
|
|
12567
12027
|
}
|
|
12568
12028
|
|
|
12569
|
-
|
|
12570
|
-
* Declares global interfaces and namespaces for the application.
|
|
12571
|
-
* @global
|
|
12572
|
-
* @namespace ImmutableCheckoutWidgets
|
|
12573
|
-
* */
|
|
12574
|
-
declare global {
|
|
12575
|
-
namespace ImmutableCheckoutWidgets {
|
|
12576
|
-
class WidgetsFactory implements IWidgetsFactory {
|
|
12577
|
-
constructor(sdk: Checkout, config: CheckoutWidgetsConfig);
|
|
12578
|
-
create<T extends WidgetType>(type: T, config?: WidgetConfigurations[T], provider?: Web3Provider): Widget<T>;
|
|
12579
|
-
updateProvider(provider: Web3Provider): void;
|
|
12580
|
-
}
|
|
12581
|
-
class Connect<T extends WidgetType> implements Widget<T> {
|
|
12582
|
-
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
12583
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12584
|
-
unmount(): void;
|
|
12585
|
-
update(props: WidgetProperties<T>): void;
|
|
12586
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12587
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12588
|
-
}
|
|
12589
|
-
class Bridge<T extends WidgetType> implements Widget<T> {
|
|
12590
|
-
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
12591
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12592
|
-
unmount(): void;
|
|
12593
|
-
update(props: WidgetProperties<T>): void;
|
|
12594
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12595
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12596
|
-
}
|
|
12597
|
-
class Wallet<T extends WidgetType> implements Widget<T> {
|
|
12598
|
-
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
12599
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12600
|
-
unmount(): void;
|
|
12601
|
-
update(props: WidgetProperties<T>): void;
|
|
12602
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12603
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12604
|
-
}
|
|
12605
|
-
class Swap<T extends WidgetType> implements Widget<T> {
|
|
12606
|
-
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
12607
|
-
mount(id: string, params?: WidgetParameters[T]): void;
|
|
12608
|
-
unmount(): void;
|
|
12609
|
-
update(props: WidgetProperties<T>): void;
|
|
12610
|
-
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
12611
|
-
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
12612
|
-
}
|
|
12613
|
-
class OnRamp<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 Sale<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
|
-
}
|
|
12630
|
-
}
|
|
12631
|
-
|
|
12632
|
-
/**
|
|
12633
|
-
* Enum representing different types of errors that can occur during the checkout process.
|
|
12634
|
-
*/
|
|
12635
|
-
declare enum CheckoutErrorType {
|
|
12636
|
-
WEB3_PROVIDER_ERROR = "WEB3_PROVIDER_ERROR",
|
|
12637
|
-
PROVIDER_ERROR = "PROVIDER_ERROR",
|
|
12638
|
-
DEFAULT_PROVIDER_ERROR = "DEFAULT_PROVIDER_ERROR",
|
|
12639
|
-
CONNECT_PROVIDER_ERROR = "CONNECT_PROVIDER_ERROR",
|
|
12640
|
-
GET_BALANCE_ERROR = "GET_BALANCE_ERROR",
|
|
12641
|
-
GET_INDEXER_BALANCE_ERROR = "GET_INDEXER_BALANCE_ERROR",
|
|
12642
|
-
GET_ERC20_BALANCE_ERROR = "GET_ERC20_BALANCE_ERROR",
|
|
12643
|
-
GET_ERC721_BALANCE_ERROR = "GET_ERC721_BALANCE_ERROR",
|
|
12644
|
-
GET_NETWORK_INFO_ERROR = "GET_NETWORK_INFO_ERROR",
|
|
12645
|
-
METAMASK_PROVIDER_ERROR = "METAMASK_PROVIDER_ERROR",
|
|
12646
|
-
CHAIN_NOT_SUPPORTED_ERROR = "CHAIN_NOT_SUPPORTED_ERROR",
|
|
12647
|
-
PROVIDER_REQUEST_MISSING_ERROR = "PROVIDER_REQUEST_MISSING_ERROR",
|
|
12648
|
-
PROVIDER_REQUEST_FAILED_ERROR = "PROVIDER_REQUEST_FAILED_ERROR",
|
|
12649
|
-
USER_REJECTED_REQUEST_ERROR = "USER_REJECTED_REQUEST_ERROR",
|
|
12650
|
-
TRANSACTION_FAILED = "TRANSACTION_FAILED",
|
|
12651
|
-
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
|
|
12652
|
-
UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT",
|
|
12653
|
-
INVALID_GAS_ESTIMATE_TYPE = "INVALID_GAS_ESTIMATE_TYPE",
|
|
12654
|
-
UNSUPPORTED_TOKEN_TYPE_ERROR = "UNSUPPORTED_TOKEN_TYPE_ERROR",
|
|
12655
|
-
UNSUPPORTED_BALANCE_REQUIREMENT_ERROR = "UNSUPPORTED_BALANCE_REQUIREMENT_ERROR",
|
|
12656
|
-
GET_ORDER_LISTING_ERROR = "GET_ORDER_LISTING_ERROR",
|
|
12657
|
-
CANCEL_ORDER_LISTING_ERROR = "CANCEL_ORDER_LISTING_ERROR",
|
|
12658
|
-
PREPARE_ORDER_LISTING_ERROR = "PREPARE_ORDER_LISTING_ERROR",
|
|
12659
|
-
CREATE_ORDER_LISTING_ERROR = "CREATE_ORDER_LISTING_ERROR",
|
|
12660
|
-
FULFILL_ORDER_LISTING_ERROR = "FULFILL_ORDER_LISTING_ERROR",
|
|
12661
|
-
SWITCH_NETWORK_UNSUPPORTED = "SWITCH_NETWORK_UNSUPPORTED",
|
|
12662
|
-
GET_ERC20_ALLOWANCE_ERROR = "GET_ERC20_ALLOWANCE_ERROR",
|
|
12663
|
-
GET_ERC721_ALLOWANCE_ERROR = "GET_ERC721_ALLOWANCE_ERROR",
|
|
12664
|
-
EXECUTE_APPROVAL_TRANSACTION_ERROR = "EXECUTE_APPROVAL_TRANSACTION_ERROR",
|
|
12665
|
-
EXECUTE_FULFILLMENT_TRANSACTION_ERROR = "EXECUTE_FULFILLMENT_TRANSACTION_ERROR",
|
|
12666
|
-
SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR",
|
|
12667
|
-
BRIDGE_GAS_ESTIMATE_ERROR = "BRIDGE_GAS_ESTIMATE_ERROR",
|
|
12668
|
-
ORDER_FEE_ERROR = "ORDER_FEE_ERROR",
|
|
12669
|
-
ITEM_REQUIREMENTS_ERROR = "ITEM_REQUIREMENTS_ERROR",
|
|
12670
|
-
API_ERROR = "API_ERROR",
|
|
12671
|
-
ORDER_EXPIRED_ERROR = "ORDER_EXPIRED_ERROR",
|
|
12672
|
-
WIDGETS_SCRIPT_LOAD_ERROR = "WIDGETS_SCRIPT_LOAD_ERROR"
|
|
12673
|
-
}
|
|
12674
|
-
/**
|
|
12675
|
-
* Represents an error object with a specific type, optional message, and optional data.
|
|
12676
|
-
* @property {CheckoutErrorType} type - The type of the error.
|
|
12677
|
-
* @property {string | undefined} [message] - The error message.
|
|
12678
|
-
* @property {Object.<string, string> | undefined} [data] - Additional data associated with the error.
|
|
12679
|
-
*/
|
|
12680
|
-
type ErrorType = {
|
|
12681
|
-
type: CheckoutErrorType;
|
|
12682
|
-
message?: string;
|
|
12683
|
-
data?: {
|
|
12684
|
-
[key: string]: string;
|
|
12685
|
-
};
|
|
12686
|
-
};
|
|
12687
|
-
|
|
12688
|
-
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, 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, 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 };
|