@imtbl/checkout-sdk 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +176 -0
- package/README.md +58 -0
- package/dist/browser/index.js +6566 -0
- package/dist/node/index.cjs +6566 -0
- package/dist/node/index.js +6566 -0
- package/dist/types/api/blockscout/blockscout.d.ts +53 -0
- package/dist/types/api/blockscout/blockscout.test.d.ts +1 -0
- package/dist/types/api/blockscout/blockscoutType.d.ts +33 -0
- package/dist/types/api/blockscout/index.d.ts +2 -0
- package/dist/types/api/http/httpClient.d.ts +14 -0
- package/dist/types/api/http/httpClient.test.d.ts +1 -0
- package/dist/types/api/http/index.d.ts +1 -0
- package/dist/types/availability/availability.d.ts +6 -0
- package/dist/types/availability/availability.test.d.ts +1 -0
- package/dist/types/availability/index.d.ts +1 -0
- package/dist/types/balances/balances.d.ts +9 -0
- package/dist/types/balances/balances.test.d.ts +1 -0
- package/dist/types/balances/index.d.ts +1 -0
- package/dist/types/blockExplorer/blockExplorer.d.ts +9 -0
- package/dist/types/blockExplorer/blockExplorer.test.d.ts +1 -0
- package/dist/types/blockExplorer/index.d.ts +1 -0
- package/dist/types/config/config.d.ts +26 -0
- package/dist/types/config/config.test.d.ts +1 -0
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/config/remoteConfigFetcher.d.ts +19 -0
- package/dist/types/config/remoteConfigFetcher.test.d.ts +1 -0
- package/dist/types/config/tokensFetcher.d.ts +23 -0
- package/dist/types/config/tokensFetcher.test.d.ts +1 -0
- package/dist/types/connect/connect.d.ts +4 -0
- package/dist/types/connect/connect.test.d.ts +1 -0
- package/dist/types/connect/index.d.ts +1 -0
- package/dist/types/env/constants.d.ts +150 -0
- package/dist/types/env/env.d.ts +3 -0
- package/dist/types/env/env.test.d.ts +1 -0
- package/dist/types/env/index.d.ts +2 -0
- package/dist/types/errors/checkoutError.d.ts +80 -0
- package/dist/types/errors/checkoutError.test.d.ts +1 -0
- package/dist/types/errors/index.d.ts +1 -0
- package/dist/types/fiatRamp/fiatRamp.d.ts +23 -0
- package/dist/types/fiatRamp/fiatRamp.test.d.ts +1 -0
- package/dist/types/fiatRamp/index.d.ts +1 -0
- package/dist/types/gasEstimate/bridgeGasEstimate.d.ts +4 -0
- package/dist/types/gasEstimate/bridgeGasEstimate.test.d.ts +1 -0
- package/dist/types/gasEstimate/bridgeGasEstimateType.d.ts +5 -0
- package/dist/types/gasEstimate/gasEstimator.d.ts +4 -0
- package/dist/types/gasEstimate/gasEstimator.test.d.ts +1 -0
- package/dist/types/gasEstimate/gasPriceInWei.d.ts +2 -0
- package/dist/types/gasEstimate/gasPriceInWei.test.d.ts +1 -0
- package/dist/types/gasEstimate/index.d.ts +3 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/instance/contract.d.ts +2 -0
- package/dist/types/instance/index.d.ts +2 -0
- package/dist/types/instance/instance.d.ts +11 -0
- package/dist/types/instance/instance.test.d.ts +1 -0
- package/dist/types/logger/debugLogger.d.ts +3 -0
- package/dist/types/logger/debugLogger.test.d.ts +1 -0
- package/dist/types/network/index.d.ts +1 -0
- package/dist/types/network/network.d.ts +7 -0
- package/dist/types/network/network.test.d.ts +1 -0
- package/dist/types/provider/getUnderlyingProvider.d.ts +8 -0
- package/dist/types/provider/getUnderlyingProvider.test.d.ts +1 -0
- package/dist/types/provider/index.d.ts +4 -0
- package/dist/types/provider/injected/index.d.ts +3 -0
- package/dist/types/provider/injected/index.test.d.ts +1 -0
- package/dist/types/provider/injected/register.d.ts +20 -0
- package/dist/types/provider/injected/store.d.ts +42 -0
- package/dist/types/provider/injected/utils.d.ts +19 -0
- package/dist/types/provider/injected/window.d.ts +8 -0
- package/dist/types/provider/injectedProvidersManager.d.ts +19 -0
- package/dist/types/provider/provider.d.ts +3 -0
- package/dist/types/provider/provider.test.d.ts +1 -0
- package/dist/types/provider/providerDetail.d.ts +5 -0
- package/dist/types/provider/validateProvider.d.ts +5 -0
- package/dist/types/provider/validateProvider.test.d.ts +1 -0
- package/dist/types/readOnlyProviders/readOnlyProvider.d.ts +4 -0
- package/dist/types/readOnlyProviders/readOnlyProviders.test.d.ts +1 -0
- package/dist/types/riskAssessment/index.d.ts +1 -0
- package/dist/types/riskAssessment/riskAssessment.d.ts +14 -0
- package/dist/types/riskAssessment/riskAssessment.test.d.ts +1 -0
- package/dist/types/sdk.d.ts +216 -0
- package/dist/types/sdk.test.d.ts +1 -0
- package/dist/types/smartCheckout/actions/getUnsignedActions.d.ts +7 -0
- package/dist/types/smartCheckout/actions/getUnsignedActions.test.d.ts +1 -0
- package/dist/types/smartCheckout/actions/index.d.ts +2 -0
- package/dist/types/smartCheckout/actions/signActions.d.ts +6 -0
- package/dist/types/smartCheckout/actions/signActions.test.d.ts +1 -0
- package/dist/types/smartCheckout/actions/types.d.ts +32 -0
- package/dist/types/smartCheckout/aggregators/allowanceAggregator.d.ts +2 -0
- package/dist/types/smartCheckout/aggregators/allowanceAggregator.test.d.ts +1 -0
- package/dist/types/smartCheckout/aggregators/balanceAggregator.d.ts +5 -0
- package/dist/types/smartCheckout/aggregators/balanceAggregator.test.d.ts +1 -0
- package/dist/types/smartCheckout/aggregators/index.d.ts +2 -0
- package/dist/types/smartCheckout/aggregators/itemAggregator.d.ts +6 -0
- package/dist/types/smartCheckout/aggregators/itemAggregator.test.d.ts +1 -0
- package/dist/types/smartCheckout/allowList/allowListCheck.d.ts +11 -0
- package/dist/types/smartCheckout/allowList/allowListCheck.test.d.ts +1 -0
- package/dist/types/smartCheckout/allowList/index.d.ts +1 -0
- package/dist/types/smartCheckout/allowList/types.d.ts +6 -0
- package/dist/types/smartCheckout/allowance/erc1155.d.ts +9 -0
- package/dist/types/smartCheckout/allowance/erc1155.test.d.ts +1 -0
- package/dist/types/smartCheckout/allowance/erc20.d.ts +9 -0
- package/dist/types/smartCheckout/allowance/erc20.test.d.ts +1 -0
- package/dist/types/smartCheckout/allowance/erc721.d.ts +12 -0
- package/dist/types/smartCheckout/allowance/erc721.test.d.ts +1 -0
- package/dist/types/smartCheckout/allowance/index.d.ts +3 -0
- package/dist/types/smartCheckout/allowance/types.d.ts +30 -0
- package/dist/types/smartCheckout/balanceCheck/balanceCheck.d.ts +7 -0
- package/dist/types/smartCheckout/balanceCheck/balanceCheck.test.d.ts +1 -0
- package/dist/types/smartCheckout/balanceCheck/balanceRequirement.d.ts +17 -0
- package/dist/types/smartCheckout/balanceCheck/balanceRequirement.test.d.ts +1 -0
- package/dist/types/smartCheckout/balanceCheck/index.d.ts +1 -0
- package/dist/types/smartCheckout/balanceCheck/types.d.ts +30 -0
- package/dist/types/smartCheckout/buy/buy.d.ts +7 -0
- package/dist/types/smartCheckout/buy/buy.test.d.ts +1 -0
- package/dist/types/smartCheckout/buy/index.d.ts +1 -0
- package/dist/types/smartCheckout/cancel/cancel.d.ts +3 -0
- package/dist/types/smartCheckout/cancel/cancel.test.d.ts +1 -0
- package/dist/types/smartCheckout/cancel/index.d.ts +1 -0
- package/dist/types/smartCheckout/fees/fees.d.ts +5 -0
- package/dist/types/smartCheckout/fees/fees.test.d.ts +1 -0
- package/dist/types/smartCheckout/gas/gasCalculator.d.ts +6 -0
- package/dist/types/smartCheckout/gas/gasCalculator.test.d.ts +1 -0
- package/dist/types/smartCheckout/gas/index.d.ts +1 -0
- package/dist/types/smartCheckout/index.d.ts +1 -0
- package/dist/types/smartCheckout/itemRequirements/index.d.ts +1 -0
- package/dist/types/smartCheckout/itemRequirements/itemRequirements.d.ts +2 -0
- package/dist/types/smartCheckout/itemRequirements/itemRequirements.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/bridge/bridgeRoute.d.ts +11 -0
- package/dist/types/smartCheckout/routing/bridge/bridgeRoute.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/bridge/getBridgeFeeEstimate.d.ts +7 -0
- package/dist/types/smartCheckout/routing/bridge/getBridgeFeeEstimate.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/bridge/getEthBalance.d.ts +2 -0
- package/dist/types/smartCheckout/routing/bridge/getEthBalance.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/bridgeAndSwap/bridgeAndSwapRoute.d.ts +15 -0
- package/dist/types/smartCheckout/routing/bridgeAndSwap/bridgeAndSwapRoute.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/bridgeAndSwap/constructBridgeRequirements.d.ts +9 -0
- package/dist/types/smartCheckout/routing/bridgeAndSwap/constructBridgeRequirements.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/bridgeAndSwap/fetchL1ToL2Mapping.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/bridgeAndSwap/fetchL1ToL2Mappings.d.ts +4 -0
- package/dist/types/smartCheckout/routing/bridgeAndSwap/getBalancesByChain.d.ts +7 -0
- package/dist/types/smartCheckout/routing/bridgeAndSwap/getBalancesByChain.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/bridgeAndSwap/getDexQuotes.d.ts +5 -0
- package/dist/types/smartCheckout/routing/bridgeAndSwap/getDexQuotes.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/geoBlocking.d.ts +3 -0
- package/dist/types/smartCheckout/routing/geoBlocking.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/index.d.ts +1 -0
- package/dist/types/smartCheckout/routing/indexer/fetchL1Representation.d.ts +9 -0
- package/dist/types/smartCheckout/routing/indexer/fetchL1Representation.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/onRamp/index.d.ts +1 -0
- package/dist/types/smartCheckout/routing/onRamp/onRampRoute.d.ts +4 -0
- package/dist/types/smartCheckout/routing/onRamp/onRampRoute.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/routingCalculator.d.ts +13 -0
- package/dist/types/smartCheckout/routing/routingCalculator.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/routingOptions.d.ts +7 -0
- package/dist/types/smartCheckout/routing/routingOptions.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/swap/quoteFetcher.d.ts +7 -0
- package/dist/types/smartCheckout/routing/swap/quoteFetcher.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/swap/swapRoute.d.ts +24 -0
- package/dist/types/smartCheckout/routing/swap/swapRoute.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/tokenBalances.d.ts +5 -0
- package/dist/types/smartCheckout/routing/tokenBalances.test.d.ts +1 -0
- package/dist/types/smartCheckout/routing/types.d.ts +15 -0
- package/dist/types/smartCheckout/sell/index.d.ts +1 -0
- package/dist/types/smartCheckout/sell/sell.d.ts +7 -0
- package/dist/types/smartCheckout/sell/sell.test.d.ts +1 -0
- package/dist/types/smartCheckout/smartCheckout.d.ts +6 -0
- package/dist/types/smartCheckout/smartCheckout.test.d.ts +1 -0
- package/dist/types/swap/index.d.ts +1 -0
- package/dist/types/swap/swap.d.ts +7 -0
- package/dist/types/swap/swap.test.d.ts +1 -0
- package/dist/types/tokens/index.d.ts +1 -0
- package/dist/types/tokens/tokens.d.ts +12 -0
- package/dist/types/tokens/tokens.test.d.ts +1 -0
- package/dist/types/transaction/index.d.ts +1 -0
- package/dist/types/transaction/transaction.d.ts +21 -0
- package/dist/types/transaction/transaction.test.d.ts +1 -0
- package/dist/types/types/balances.d.ts +52 -0
- package/dist/types/types/buy.d.ts +15 -0
- package/dist/types/types/cancel.d.ts +15 -0
- package/dist/types/types/chains.d.ts +48 -0
- package/dist/types/types/config.d.ts +265 -0
- package/dist/types/types/connect.d.ts +34 -0
- package/dist/types/types/eip1193.d.ts +47 -0
- package/dist/types/types/eip6963.d.ts +29 -0
- package/dist/types/types/fees.d.ts +10 -0
- package/dist/types/types/fiatRamp.d.ts +25 -0
- package/dist/types/types/gasEstimate.d.ts +64 -0
- package/dist/types/types/index.d.ts +20 -0
- package/dist/types/types/network.d.ts +77 -0
- package/dist/types/types/networkInfo.d.ts +15 -0
- package/dist/types/types/provider.d.ts +45 -0
- package/dist/types/types/sell.d.ts +13 -0
- package/dist/types/types/smartCheckout.d.ts +918 -0
- package/dist/types/types/swap.d.ts +47 -0
- package/dist/types/types/token.d.ts +40 -0
- package/dist/types/types/tokenInfo.d.ts +27 -0
- package/dist/types/types/transaction.d.ts +18 -0
- package/dist/types/types/wallet.d.ts +49 -0
- package/dist/types/types/widgets.d.ts +11 -0
- package/dist/types/utils/utils.d.ts +11 -0
- package/dist/types/utils/utils.test.d.ts +1 -0
- package/dist/types/wallet/index.d.ts +1 -0
- package/dist/types/wallet/wallet.d.ts +2 -0
- package/dist/types/wallet/wallet.test.d.ts +1 -0
- package/dist/types/widgets/definitions/configurations/addTokens.d.ts +5 -0
- package/dist/types/widgets/definitions/configurations/bridge.d.ts +5 -0
- package/dist/types/widgets/definitions/configurations/commerce.d.ts +17 -0
- package/dist/types/widgets/definitions/configurations/connect.d.ts +5 -0
- package/dist/types/widgets/definitions/configurations/index.d.ts +11 -0
- package/dist/types/widgets/definitions/configurations/onramp.d.ts +5 -0
- package/dist/types/widgets/definitions/configurations/purchase.d.ts +2 -0
- package/dist/types/widgets/definitions/configurations/sale.d.ts +8 -0
- package/dist/types/widgets/definitions/configurations/swap.d.ts +5 -0
- package/dist/types/widgets/definitions/configurations/theme.d.ts +7 -0
- package/dist/types/widgets/definitions/configurations/wallet.d.ts +12 -0
- package/dist/types/widgets/definitions/configurations/widget.d.ts +31 -0
- package/dist/types/widgets/definitions/events/addTokens.d.ts +41 -0
- package/dist/types/widgets/definitions/events/bridge.d.ts +52 -0
- package/dist/types/widgets/definitions/events/commerce.d.ts +134 -0
- package/dist/types/widgets/definitions/events/connect.d.ts +47 -0
- package/dist/types/widgets/definitions/events/index.d.ts +11 -0
- package/dist/types/widgets/definitions/events/onramp.d.ts +28 -0
- package/dist/types/widgets/definitions/events/orchestration.d.ts +84 -0
- package/dist/types/widgets/definitions/events/purchase.d.ts +30 -0
- package/dist/types/widgets/definitions/events/sale.d.ts +103 -0
- package/dist/types/widgets/definitions/events/swap.d.ts +40 -0
- package/dist/types/widgets/definitions/events/wallet.d.ts +28 -0
- package/dist/types/widgets/definitions/events/widgets.d.ts +35 -0
- package/dist/types/widgets/definitions/global.d.ts +73 -0
- package/dist/types/widgets/definitions/parameters/addTokens.d.ts +20 -0
- package/dist/types/widgets/definitions/parameters/bridge.d.ts +20 -0
- package/dist/types/widgets/definitions/parameters/commerce.d.ts +44 -0
- package/dist/types/widgets/definitions/parameters/connect.d.ts +16 -0
- package/dist/types/widgets/definitions/parameters/index.d.ts +9 -0
- package/dist/types/widgets/definitions/parameters/onramp.d.ts +20 -0
- package/dist/types/widgets/definitions/parameters/purchase.d.ts +18 -0
- package/dist/types/widgets/definitions/parameters/sale.d.ts +50 -0
- package/dist/types/widgets/definitions/parameters/swap.d.ts +31 -0
- package/dist/types/widgets/definitions/parameters/wallet.d.ts +12 -0
- package/dist/types/widgets/definitions/types.d.ts +282 -0
- package/dist/types/widgets/load.d.ts +2 -0
- package/dist/types/widgets/load.test.d.ts +1 -0
- package/dist/types/widgets/version.d.ts +23 -0
- package/dist/types/widgets/version.test.d.ts +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing different chain IDs.
|
|
3
|
+
* @enum {number}
|
|
4
|
+
* @property {number} IMTBL_ZKEVM_MAINNET - The chain ID for IMTBL ZKEVM Mainnet.
|
|
5
|
+
* @property {number} IMTBL_ZKEVM_TESTNET - The chain ID for IMTBL ZKEVM Testnet.
|
|
6
|
+
* @property {number} IMTBL_ZKEVM_DEVNET - The chain ID for IMTBL ZKEVM Devnet.
|
|
7
|
+
* @property {number} ETHEREUM - The chain ID for Ethereum.
|
|
8
|
+
* @property {number} SEPOLIA - The chain ID for Sepolia.
|
|
9
|
+
*/
|
|
10
|
+
export declare enum ChainId {
|
|
11
|
+
IMTBL_ZKEVM_MAINNET = 13371,
|
|
12
|
+
IMTBL_ZKEVM_TESTNET = 13473,
|
|
13
|
+
IMTBL_ZKEVM_DEVNET = 15003,
|
|
14
|
+
ETHEREUM = 1,
|
|
15
|
+
SEPOLIA = 11155111
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Enum representing different chain names.
|
|
19
|
+
* @enum {string}
|
|
20
|
+
* @property {string} IMTBL_ZKEVM_MAINNET - The chain name for IMTBL ZKEVM Mainnet.
|
|
21
|
+
* @property {string} IMTBL_ZKEVM_TESTNET - The chain name for IMTBL ZKEVM Testnet.
|
|
22
|
+
* @property {string} IMTBL_ZKEVM_DEVNET - The chain name for IMTBL ZKEVM Devnet.
|
|
23
|
+
* @property {string} ETHEREUM - The chain name for Ethereum.
|
|
24
|
+
* @property {string} SEPOLIA - The chain name for Sepolia.
|
|
25
|
+
*/
|
|
26
|
+
export declare enum ChainName {
|
|
27
|
+
ETHEREUM = "Ethereum",
|
|
28
|
+
SEPOLIA = "Sepolia",
|
|
29
|
+
IMTBL_ZKEVM_TESTNET = "Immutable zkEVM Testnet",
|
|
30
|
+
IMTBL_ZKEVM_DEVNET = "Immutable zkEVM Dev",
|
|
31
|
+
IMTBL_ZKEVM_MAINNET = "Immutable zkEVM"
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Enum representing different chain slugs.
|
|
35
|
+
* @enum {string}
|
|
36
|
+
* @property {string} IMTBL_ZKEVM_MAINNET - The chain slug for IMTBL ZKEVM Mainnet.
|
|
37
|
+
* @property {string} IMTBL_ZKEVM_TESTNET - The chain slug for IMTBL ZKEVM Testnet.
|
|
38
|
+
* @property {string} IMTBL_ZKEVM_DEVNET - The chain slug for IMTBL ZKEVM Devnet.
|
|
39
|
+
* @property {string} ETHEREUM - The chain slug for Ethereum.
|
|
40
|
+
* @property {string} SEPOLIA - The chain slug for Sepolia.
|
|
41
|
+
*/
|
|
42
|
+
export declare enum ChainSlug {
|
|
43
|
+
ETHEREUM = "ethereum",
|
|
44
|
+
SEPOLIA = "sepolia",
|
|
45
|
+
IMTBL_ZKEVM_MAINNET = "imtbl-zkevm-mainnet",
|
|
46
|
+
IMTBL_ZKEVM_TESTNET = "imtbl-zkevm-testnet",
|
|
47
|
+
IMTBL_ZKEVM_DEVNET = "imtbl-zkevm-devnet"
|
|
48
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { Environment, ModuleConfiguration } from '@imtbl/config';
|
|
2
|
+
import { ExchangeOverrides, SecondaryFee } from '@imtbl/dex-sdk';
|
|
3
|
+
import { Passport } from '@imtbl/passport';
|
|
4
|
+
import { TokenInfo } from './tokenInfo';
|
|
5
|
+
import { ChainId } from './chains';
|
|
6
|
+
export interface CheckoutOverrides {
|
|
7
|
+
environment?: Environment;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
interface CheckoutFeatureConfiguration {
|
|
11
|
+
enable: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A type representing the on-ramp configurations for the checkout SDK.
|
|
15
|
+
* @property {boolean} enable - To enable on-ramp feature in Checkout sdk.
|
|
16
|
+
*/
|
|
17
|
+
export interface CheckoutOnRampConfiguration extends CheckoutFeatureConfiguration {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A type representing the swap configurations for the checkout SDK.
|
|
21
|
+
* @property {boolean} enable - To enable swap feature in Checkout sdk.
|
|
22
|
+
*/
|
|
23
|
+
export interface CheckoutSwapConfiguration extends CheckoutFeatureConfiguration {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A type representing the bridge configurations for the checkout SDK.
|
|
27
|
+
* @property {boolean} enable - To enable bridge feature in Checkout sdk.
|
|
28
|
+
*/
|
|
29
|
+
export interface CheckoutBridgeConfiguration extends CheckoutFeatureConfiguration {
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A type representing checkout SDK configurations.
|
|
33
|
+
* @property {CheckoutOnRampConfiguration} onRamp - To configure the on-ramp feature.
|
|
34
|
+
* @property {CheckoutSwapConfiguration} swap - To configure the swap feature.
|
|
35
|
+
* @property {CheckoutBridgeConfiguration} bridge - To configure the bridge feature.
|
|
36
|
+
* @property {Passport} passport - To enable passport wallet integration.
|
|
37
|
+
* @property {string} publishableKey - To identify your integration for tracking and analytics purposes.
|
|
38
|
+
*/
|
|
39
|
+
export interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
|
|
40
|
+
onRamp?: CheckoutOnRampConfiguration;
|
|
41
|
+
swap?: CheckoutSwapConfiguration;
|
|
42
|
+
bridge?: CheckoutBridgeConfiguration;
|
|
43
|
+
passport?: Passport;
|
|
44
|
+
publishableKey?: string;
|
|
45
|
+
environment?: Environment;
|
|
46
|
+
overrides?: CheckoutOverrides;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A type representing various remotely defined configurations which are
|
|
50
|
+
* accessible via the Checkout config and configured based on the Environment.
|
|
51
|
+
* @property {ConnectConfig} connect
|
|
52
|
+
* @property {DexConfig} dex
|
|
53
|
+
* @property {OnRampConfig} onramp
|
|
54
|
+
* @property {BridgeConfig} bridge
|
|
55
|
+
* @property {AllowedNetworkConfig[]} allowedNetworks
|
|
56
|
+
* @property {GasEstimateTokenConfig | undefined} gasEstimateTokens
|
|
57
|
+
* @property {ImxAddressConfig | undefined} imxAddressMapping
|
|
58
|
+
* @property {TelemetryConfig | undefined} telemetry
|
|
59
|
+
* @property {SquidConfig | undefined} squid
|
|
60
|
+
*/
|
|
61
|
+
export type RemoteConfiguration = {
|
|
62
|
+
/** The config used for the Connect. */
|
|
63
|
+
connect: ConnectConfig;
|
|
64
|
+
/** The config used for the DEX. */
|
|
65
|
+
dex: DexConfig;
|
|
66
|
+
/** The config used for the OnRamp */
|
|
67
|
+
onramp: OnRampConfig;
|
|
68
|
+
/** The config used for the Bridge. */
|
|
69
|
+
bridge: BridgeConfig;
|
|
70
|
+
/** The config used for Add Tokens */
|
|
71
|
+
addTokens: AddTokensConfig;
|
|
72
|
+
/** An array representing the allowed networks. */
|
|
73
|
+
allowedNetworks: AllowedNetworkConfig[];
|
|
74
|
+
/** The config for the tokens used to estimate gas. */
|
|
75
|
+
gasEstimateTokens?: GasEstimateTokenConfig;
|
|
76
|
+
/** The IMX address mappings across available networks. */
|
|
77
|
+
imxAddressMapping?: ImxAddressConfig;
|
|
78
|
+
/** Telemetry config. */
|
|
79
|
+
telemetry?: TelemetryConfig;
|
|
80
|
+
/** Squid config. */
|
|
81
|
+
squid?: SquidConfig;
|
|
82
|
+
/** The checkout version info. */
|
|
83
|
+
checkoutWidgetsVersion: CheckoutWidgetsVersionConfig;
|
|
84
|
+
/** Risk assessment config. */
|
|
85
|
+
riskAssessment?: RiskAssessmentConfig;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* A type representing the configuration for the Add Tokens.
|
|
89
|
+
* @property {TokenInfo[] | undefined} tokens
|
|
90
|
+
*/
|
|
91
|
+
export type AddTokensConfig = {
|
|
92
|
+
/** A boolean value for enabling/disabling Add Tokens */
|
|
93
|
+
enabled: boolean;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* A type representing the fee structure for an OnRamp provider
|
|
97
|
+
* @property {string | undefined} minPercentage
|
|
98
|
+
* @property {string | undefined} maxPercentage
|
|
99
|
+
* @property {string | undefined} feePercentage
|
|
100
|
+
*/
|
|
101
|
+
export type OnRampProviderFees = {
|
|
102
|
+
/** The minimum percentage fee shown if a fee range is provided */
|
|
103
|
+
minPercentage?: string;
|
|
104
|
+
/** The maximum percentage fee shown if a fee range is provided */
|
|
105
|
+
maxPercentage?: string;
|
|
106
|
+
/** The specific fee percentage shown if there is no range provided */
|
|
107
|
+
feePercentage?: string;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* A type representing the configuration for the OnRamp for a specific provider.
|
|
111
|
+
* @property {string} publishableApiKey
|
|
112
|
+
* @property {TokenInfo[]} tokens
|
|
113
|
+
* @property {OnRampProviderFees} fees
|
|
114
|
+
*/
|
|
115
|
+
export type OnRampProviderConfig = {
|
|
116
|
+
/** The on ramp provider publishable api-key */
|
|
117
|
+
publishableApiKey: string;
|
|
118
|
+
/** The allowed tokens for the OnRamp provider */
|
|
119
|
+
tokens: TokenInfo[];
|
|
120
|
+
/** The on ramp provider transaction fees */
|
|
121
|
+
fees: OnRampProviderFees;
|
|
122
|
+
};
|
|
123
|
+
export declare enum OnRampProvider {
|
|
124
|
+
TRANSAK = "201811419111"
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* A type representing the configuration for the OnRamp.
|
|
128
|
+
* @property {OnRampProviderConfig} transak
|
|
129
|
+
*/
|
|
130
|
+
export type OnRampConfig = {
|
|
131
|
+
/** OnRamp config for Transak provider */
|
|
132
|
+
[key: string]: OnRampProviderConfig;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* A type representing the configuration for the Connect.
|
|
136
|
+
* @property {boolean} walletConnect
|
|
137
|
+
*/
|
|
138
|
+
export type ConnectConfig = {
|
|
139
|
+
/** A boolean value for enabling/disabling WalletConnect */
|
|
140
|
+
walletConnect: boolean;
|
|
141
|
+
/** A configuration for injected wallets */
|
|
142
|
+
injected: {
|
|
143
|
+
/** List for sorting injected wallets via wallet rdns */
|
|
144
|
+
priorityWalletRdns: string[];
|
|
145
|
+
/** List for blocking injected wallets via wallet rdns */
|
|
146
|
+
blocklistWalletRdns: string[];
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* A type representing the configuration for the DEX.
|
|
151
|
+
* @property {ExchangeOverrides | undefined} overrides
|
|
152
|
+
* @property {TokenInfo[] | undefined} tokens
|
|
153
|
+
*/
|
|
154
|
+
export type DexConfig = {
|
|
155
|
+
/** The DEX overrides. */
|
|
156
|
+
overrides?: ExchangeOverrides;
|
|
157
|
+
/** An array of tokens compatible with the DEX. */
|
|
158
|
+
tokens?: TokenInfo[];
|
|
159
|
+
/** An array of secondary fees to be applied to swaps */
|
|
160
|
+
secondaryFees?: SecondaryFee[];
|
|
161
|
+
/** An array of tokens to be blocked from the DEX */
|
|
162
|
+
blocklist?: BlockedToken[];
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* A type representing a token that is blocked from the DEX.
|
|
166
|
+
*/
|
|
167
|
+
export type BlockedToken = {
|
|
168
|
+
address: string;
|
|
169
|
+
symbol: string;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* A type representing the configuration for the Bridge for all the supported chains.
|
|
173
|
+
*/
|
|
174
|
+
export type BridgeConfig = {
|
|
175
|
+
/** An object containing the bridge configuration per chain */
|
|
176
|
+
[chainId: string]: BridgeChainConfig;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* A type representing the configuration for the Bridge.
|
|
180
|
+
* @property {TokenInfo[] | undefined} tokens
|
|
181
|
+
*/
|
|
182
|
+
export type BridgeChainConfig = {
|
|
183
|
+
/** An array of tokens compatible with the Bridge. */
|
|
184
|
+
tokens?: TokenInfo[];
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* A type representing an allowed network.
|
|
188
|
+
* @property {number} chainId
|
|
189
|
+
*/
|
|
190
|
+
export type AllowedNetworkConfig = {
|
|
191
|
+
/** The network chain id. */
|
|
192
|
+
chainId: number;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* A type representing the IMX address mappings across available networks.
|
|
196
|
+
* @type {{ [chainId: string]: string }}
|
|
197
|
+
*/
|
|
198
|
+
export type ImxAddressConfig = {
|
|
199
|
+
[chainId: string]: string;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* A type representing the telemetry configurations.
|
|
203
|
+
* @property {string} segmentPublishableKey
|
|
204
|
+
*/
|
|
205
|
+
export type TelemetryConfig = {
|
|
206
|
+
segmentPublishableKey: string;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* A type representing the squid integrator id.
|
|
210
|
+
* @property {string} integratorId
|
|
211
|
+
*/
|
|
212
|
+
export type SquidConfig = {
|
|
213
|
+
integratorId: string;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* A type representing the required information to estimate gas for a transaction.
|
|
217
|
+
* @type {{ [key: string]: { bridgeToL2Addresses?: GasEstimateBridgeToL2TokenConfig, swapAddresses?: GasEstimateSwapTokenConfig } }}
|
|
218
|
+
* - A map of addresses for estimating gas keyed by the network chain id.
|
|
219
|
+
* @property {GasEstimateBridgeToL2TokenConfig | undefined} bridgeToL2Addresses
|
|
220
|
+
* @property {GasEstimateSwapTokenConfig | undefined} swapAddresses
|
|
221
|
+
*/
|
|
222
|
+
export type GasEstimateTokenConfig = {
|
|
223
|
+
[key: string]: {
|
|
224
|
+
/** The type representing the addresses for a bridge to layer 2 gas estimate. */
|
|
225
|
+
bridgeToL2Addresses?: GasEstimateBridgeToL2TokenConfig;
|
|
226
|
+
/** The type representing the addresses for a swap gas estimate */
|
|
227
|
+
swapAddresses?: GasEstimateSwapTokenConfig;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* A type representing the config for a bridge to layer 2 gas estimate.
|
|
232
|
+
* @property {string | 'NATIVE'} gasTokenAddress
|
|
233
|
+
* @property {string} fromAddress
|
|
234
|
+
*/
|
|
235
|
+
export type GasEstimateBridgeToL2TokenConfig = {
|
|
236
|
+
/** The address of the gas token. */
|
|
237
|
+
gasTokenAddress: string | 'NATIVE';
|
|
238
|
+
/** The address of the token being bridged. */
|
|
239
|
+
fromAddress: string;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* A type representing the config for a swap gas estimate.
|
|
243
|
+
* @property {string} inAddress
|
|
244
|
+
* @property {string} outAddress
|
|
245
|
+
*/
|
|
246
|
+
export type GasEstimateSwapTokenConfig = {
|
|
247
|
+
/** The in token address. */
|
|
248
|
+
inAddress: string;
|
|
249
|
+
/** The out token address. */
|
|
250
|
+
outAddress: string;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* A type that represents the tokens configuration for chain.
|
|
254
|
+
*/
|
|
255
|
+
export type ChainTokensConfig = {
|
|
256
|
+
[key in ChainId]?: TokenInfo[];
|
|
257
|
+
};
|
|
258
|
+
export type CheckoutWidgetsVersionConfig = {
|
|
259
|
+
compatibleVersionMarkers: string[];
|
|
260
|
+
};
|
|
261
|
+
export type RiskAssessmentConfig = {
|
|
262
|
+
enabled: boolean;
|
|
263
|
+
levels: string[];
|
|
264
|
+
};
|
|
265
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Eip1193Provider } from 'ethers';
|
|
2
|
+
import { WrappedBrowserProvider } from './provider';
|
|
3
|
+
/**
|
|
4
|
+
* Interface representing the params of {@link Checkout.connect}.
|
|
5
|
+
* @property {WrappedBrowserProvider | Eip1193Provider} provider - The provider used to connect to the network.
|
|
6
|
+
* @property {boolean | undefined} requestWalletPermissions - A boolean that will trigger a permission request for wallet connection.
|
|
7
|
+
*/
|
|
8
|
+
export interface ConnectParams {
|
|
9
|
+
provider: WrappedBrowserProvider | Eip1193Provider;
|
|
10
|
+
requestWalletPermissions?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Interface representing the result of {@link Checkout.connect}.
|
|
14
|
+
* @property {WrappedBrowserProvider} provider - The provider used to connect to the network.
|
|
15
|
+
*/
|
|
16
|
+
export interface ConnectResult {
|
|
17
|
+
provider: WrappedBrowserProvider;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Interface representing the params of {@link Checkout.checkIsWalletConnected}.
|
|
21
|
+
* @property {WrappedBrowserProvider | Eip1193Provider} provider - The provider used to connect to the network.
|
|
22
|
+
*/
|
|
23
|
+
export interface CheckConnectionParams {
|
|
24
|
+
provider: WrappedBrowserProvider | Eip1193Provider;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Interface representing the result of {@link Checkout.checkIsWalletConnected}.
|
|
28
|
+
* @property {boolean} isConnected - A boolean indicating the connection status of the Web3 provider.
|
|
29
|
+
* @property {string} walletAddress - The wallet address used to check the connection.
|
|
30
|
+
*/
|
|
31
|
+
export interface CheckConnectionResult {
|
|
32
|
+
isConnected: boolean;
|
|
33
|
+
walletAddress: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Address } from '@imtbl/bridge-sdk';
|
|
2
|
+
export interface EIP1193Provider extends BaseEIP1193Provider, PassportEIP1193Provider, MetaMaskEIP1193Provider, WalletConnectEIP1193Provider {
|
|
3
|
+
}
|
|
4
|
+
export interface BaseEIP1193Provider {
|
|
5
|
+
request(args: EIP1193RequestArguments): Promise<unknown>;
|
|
6
|
+
on<TEvent extends keyof EIP1193EventMap>(event: TEvent, listener: EIP1193EventMap[TEvent]): void;
|
|
7
|
+
removeListener<TEvent extends keyof EIP1193EventMap>(event: TEvent, listener: EIP1193EventMap[TEvent]): void;
|
|
8
|
+
}
|
|
9
|
+
export interface PassportEIP1193Provider {
|
|
10
|
+
isPassport?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface MetaMaskEIP1193Provider {
|
|
13
|
+
isMetaMask?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface WalletConnectEIP1193Provider {
|
|
16
|
+
isWalletConnect?: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface EIP1193RequestArguments {
|
|
19
|
+
readonly method: string;
|
|
20
|
+
readonly params?: readonly unknown[] | object;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Errors
|
|
24
|
+
*/
|
|
25
|
+
export declare class ProviderRpcError extends Error {
|
|
26
|
+
code: number;
|
|
27
|
+
details: string;
|
|
28
|
+
constructor(code: number, message: string);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Provider Events
|
|
32
|
+
*/
|
|
33
|
+
export type ProviderConnectInfo = {
|
|
34
|
+
chainId: string;
|
|
35
|
+
};
|
|
36
|
+
export type ProviderMessage = {
|
|
37
|
+
type: string;
|
|
38
|
+
data: unknown;
|
|
39
|
+
};
|
|
40
|
+
export type EIP1193EventMap = {
|
|
41
|
+
accountsChanged(accounts: Address[]): void;
|
|
42
|
+
chainChanged(chainId: string): void;
|
|
43
|
+
connect(connectInfo: ProviderConnectInfo): void;
|
|
44
|
+
disconnect(error: ProviderRpcError): void;
|
|
45
|
+
message(message: ProviderMessage): void;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EIP1193Provider } from './eip1193';
|
|
2
|
+
/**
|
|
3
|
+
* Event detail from the `eip6963:announceProvider` event.
|
|
4
|
+
*/
|
|
5
|
+
export interface EIP6963ProviderDetail {
|
|
6
|
+
info: EIP6963ProviderInfo;
|
|
7
|
+
provider: EIP1193Provider;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Metadata of the EIP-1193 Provider.
|
|
11
|
+
*/
|
|
12
|
+
export interface EIP6963ProviderInfo {
|
|
13
|
+
icon: `data:image/${string}`;
|
|
14
|
+
name: string;
|
|
15
|
+
rdns: string;
|
|
16
|
+
uuid: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Event type to announce an EIP-1193 Provider.
|
|
20
|
+
*/
|
|
21
|
+
export interface EIP6963AnnounceProviderEvent extends CustomEvent<EIP6963ProviderDetail> {
|
|
22
|
+
type: 'eip6963:announceProvider';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Event type to request EIP-1193 Providers.
|
|
26
|
+
*/
|
|
27
|
+
export interface EIP6963RequestProviderEvent extends Event {
|
|
28
|
+
type: 'eip6963:requestProvider';
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Eip1193Provider } from 'ethers';
|
|
2
|
+
import { WrappedBrowserProvider } from './provider';
|
|
3
|
+
/**
|
|
4
|
+
* An enum representing the type of exchange.
|
|
5
|
+
* @enum {string}
|
|
6
|
+
* @property {string} ONRAMP - The exchange type for transacting.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ExchangeType {
|
|
9
|
+
ONRAMP = "onramp"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interface representing the result of {@link Checkout.createFiatRampUrl}.
|
|
13
|
+
* @property {ExchangeType} exchangeType - The ExchangeType specified.
|
|
14
|
+
* @property {WrappedBrowserProvider | Eip1193Provider} browserProvider - The WrappedBrowserProvider used to exchange.
|
|
15
|
+
* @property {string | undefined} tokenAmount - The token amount specified as input.
|
|
16
|
+
* @property {string | undefined} tokenAddress - The token address specified as input.
|
|
17
|
+
* @property {Passport | undefined} passport - The Passport instance specified as input.
|
|
18
|
+
*/
|
|
19
|
+
export interface FiatRampParams {
|
|
20
|
+
exchangeType: ExchangeType;
|
|
21
|
+
browserProvider: WrappedBrowserProvider | Eip1193Provider;
|
|
22
|
+
tokenAmount?: string;
|
|
23
|
+
tokenAddress?: string;
|
|
24
|
+
passport?: any;
|
|
25
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { BridgeFeeResponse } from '@imtbl/bridge-sdk';
|
|
2
|
+
import { TokenInfo } from './tokenInfo';
|
|
3
|
+
/**
|
|
4
|
+
* An enum representing the type of gas estimate.
|
|
5
|
+
* @enum {string}
|
|
6
|
+
* @property {string} BRIDGE_TO_L2 - The gas estimate type for a bridge to L2 transaction.
|
|
7
|
+
* @property {string} SWAP - The gas estimate type for a swap transaction.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum GasEstimateType {
|
|
10
|
+
BRIDGE_TO_L2 = "BRIDGE_TO_L2",
|
|
11
|
+
SWAP = "SWAP"
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Represents the parameters for estimating gas usage, which can be either
|
|
15
|
+
* GasEstimateBridgeToL2Params or GasEstimateSwapParams {@link Checkout.gasEstimate}.
|
|
16
|
+
* @typedef {GasEstimateBridgeToL2Params | GasEstimateSwapParams} GasEstimateParams
|
|
17
|
+
*/
|
|
18
|
+
export type GasEstimateParams = GasEstimateBridgeToL2Params | GasEstimateSwapParams;
|
|
19
|
+
/**
|
|
20
|
+
* An interface representing the parameters for estimating gas for a bridge to L2 transaction {@link Checkout.gasEstimate}.
|
|
21
|
+
* @param {GasEstimateType.BRIDGE_TO_L2} gasEstimateType - The type of gas estimate.
|
|
22
|
+
*/
|
|
23
|
+
export interface GasEstimateBridgeToL2Params {
|
|
24
|
+
gasEstimateType: GasEstimateType.BRIDGE_TO_L2;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* An interface representing the parameters for a gas estimate swap {@link Checkout.gasEstimate}.
|
|
28
|
+
* @interface
|
|
29
|
+
* @property {GasEstimateType.SWAP} gasEstimateType - The type of gas estimate, which is always "swap".
|
|
30
|
+
*/
|
|
31
|
+
export interface GasEstimateSwapParams {
|
|
32
|
+
gasEstimateType: GasEstimateType.SWAP;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* An interface representing the result of a gas estimate for a swap transaction {@link Checkout.gasEstimate}.
|
|
36
|
+
* @interface GasEstimateSwapResult
|
|
37
|
+
* @property {GasEstimateType.SWAP} gasEstimateType - The type of gas estimate, which is always "SWAP".
|
|
38
|
+
* @property {TokenAmountEstimate} fees - The estimated gas fee for the swap transaction.
|
|
39
|
+
*/
|
|
40
|
+
export interface GasEstimateSwapResult {
|
|
41
|
+
gasEstimateType: GasEstimateType.SWAP;
|
|
42
|
+
fees: TokenAmountEstimate;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An interface representing the result of a gas estimate for a bridge to L2 transaction {@link Checkout.gasEstimate}.
|
|
46
|
+
* @interface GasEstimateBridgeToL2Result
|
|
47
|
+
* @property {GasEstimateType.BRIDGE_TO_L2} gasEstimateType - The type of gas estimate.
|
|
48
|
+
* @property {BridgeFeeResponse} fees - The estimated fees for the transaction.
|
|
49
|
+
* @property {TokenInfo | undefined} token - The gas token information.
|
|
50
|
+
*/
|
|
51
|
+
export interface GasEstimateBridgeToL2Result {
|
|
52
|
+
gasEstimateType: GasEstimateType.BRIDGE_TO_L2;
|
|
53
|
+
fees: BridgeFeeResponse;
|
|
54
|
+
token?: TokenInfo;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* An interface representing the estimated fees.
|
|
58
|
+
* @property {bigint} totalFees - The estimated fees for the transaction.
|
|
59
|
+
* @property {TokenInfo | undefined} token - The gas token information.
|
|
60
|
+
*/
|
|
61
|
+
export interface TokenAmountEstimate {
|
|
62
|
+
totalFees?: bigint;
|
|
63
|
+
token?: TokenInfo;
|
|
64
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './balances';
|
|
2
|
+
export * from './buy';
|
|
3
|
+
export * from './cancel';
|
|
4
|
+
export * from './chains';
|
|
5
|
+
export * from './config';
|
|
6
|
+
export * from './connect';
|
|
7
|
+
export * from './eip1193';
|
|
8
|
+
export * from './eip6963';
|
|
9
|
+
export * from './fees';
|
|
10
|
+
export * from './gasEstimate';
|
|
11
|
+
export * from './network';
|
|
12
|
+
export * from './networkInfo';
|
|
13
|
+
export * from './sell';
|
|
14
|
+
export * from './token';
|
|
15
|
+
export * from './tokenInfo';
|
|
16
|
+
export * from './transaction';
|
|
17
|
+
export * from './wallet';
|
|
18
|
+
export * from './provider';
|
|
19
|
+
export * from './smartCheckout';
|
|
20
|
+
export * from './fiatRamp';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Eip1193Provider } from 'ethers';
|
|
2
|
+
import { ChainId } from './chains';
|
|
3
|
+
import { NetworkInfo } from './networkInfo';
|
|
4
|
+
import { TokenInfo } from './tokenInfo';
|
|
5
|
+
import { WrappedBrowserProvider } from './provider';
|
|
6
|
+
/**
|
|
7
|
+
* Interface representing the parameters for {@link Checkout.addNetwork}.
|
|
8
|
+
* @property {WrappedBrowserProvider} provider - The provider to connect to the network.
|
|
9
|
+
* @property {ChainId} chainId - The ID of the network to add. We only support adding Immutable zkEVM and Immutable zkEVM Testnet.
|
|
10
|
+
*/
|
|
11
|
+
export interface AddNetworkParams {
|
|
12
|
+
provider: WrappedBrowserProvider | Eip1193Provider;
|
|
13
|
+
chainId: ChainId;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Interface representing the parameters for {@link Checkout.switchNetwork}.
|
|
17
|
+
* @property {WrappedBrowserProvider | Eip1193Provider} provider - The provider to connect to the network.
|
|
18
|
+
* @property {ChainId} chainId - The ID of the network to switch to.
|
|
19
|
+
*/
|
|
20
|
+
export interface SwitchNetworkParams {
|
|
21
|
+
provider: WrappedBrowserProvider | Eip1193Provider;
|
|
22
|
+
chainId: ChainId;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Represents the result of switching the network in a Web3 application {@link Checkout.switchNetwork}.
|
|
26
|
+
* @interface SwitchNetworkResult
|
|
27
|
+
* @property {NetworkInfo} network - The information about the switched network.
|
|
28
|
+
* @property {WrappedBrowserProvider} provider - The Web3 provider for the switched network.
|
|
29
|
+
*/
|
|
30
|
+
export interface SwitchNetworkResult {
|
|
31
|
+
network: NetworkInfo;
|
|
32
|
+
provider: WrappedBrowserProvider;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* * Interface representing the parameters for {@link Checkout.getNetworkInfo}.
|
|
36
|
+
* @property {BrowserProvider} provider - The provider to connect to the network.
|
|
37
|
+
*/
|
|
38
|
+
export interface GetNetworkParams {
|
|
39
|
+
provider: WrappedBrowserProvider | Eip1193Provider;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* * Interface representing the parameters for {@link Checkout.getNetworkAllowList}.
|
|
43
|
+
* @property {NetworkFilterTypes} type - The type of allow list filter to apply.
|
|
44
|
+
* @property {NetworkFilter[]} [exclude] - The list of networks to exclude from the allow list.
|
|
45
|
+
*/
|
|
46
|
+
export interface GetNetworkAllowListParams {
|
|
47
|
+
type: NetworkFilterTypes;
|
|
48
|
+
exclude?: NetworkFilter[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Interface representing the result of {@link Checkout.getNetworkAllowList}.
|
|
52
|
+
* @property {NetworkInfo[]} networks - The list of allowed networks.
|
|
53
|
+
*/
|
|
54
|
+
export interface GetNetworkAllowListResult {
|
|
55
|
+
networks: NetworkInfo[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Enum representing the types of filters that can be applied to get the allow list of networks.
|
|
59
|
+
*/
|
|
60
|
+
export declare enum NetworkFilterTypes {
|
|
61
|
+
ALL = "all"
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Interface representing a filter for filtering a specific network.
|
|
65
|
+
* @property {ChainId} chainId - The ID of the network to allow or disallow.
|
|
66
|
+
*/
|
|
67
|
+
export interface NetworkFilter {
|
|
68
|
+
chainId: ChainId;
|
|
69
|
+
}
|
|
70
|
+
export type NetworkDetails = {
|
|
71
|
+
chainIdHex: string;
|
|
72
|
+
chainName: string;
|
|
73
|
+
rpcUrls: string[];
|
|
74
|
+
nativeCurrency: TokenInfo;
|
|
75
|
+
blockExplorerUrls?: string[];
|
|
76
|
+
};
|
|
77
|
+
export type NetworkMap = Map<ChainId, NetworkDetails>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TokenInfo } from './tokenInfo';
|
|
2
|
+
/**
|
|
3
|
+
* Represents information about a network.
|
|
4
|
+
* @interface NetworkInfo
|
|
5
|
+
* @property {string} name - The name of the network.
|
|
6
|
+
* @property {bigint} chainId - The chain ID of the network.
|
|
7
|
+
* @property {TokenInfo} nativeCurrency - Information about the native currency of the network.
|
|
8
|
+
* @property {boolean} isSupported - Indicates whether the network is supported.
|
|
9
|
+
*/
|
|
10
|
+
export interface NetworkInfo {
|
|
11
|
+
name: string;
|
|
12
|
+
chainId: bigint;
|
|
13
|
+
nativeCurrency: TokenInfo;
|
|
14
|
+
isSupported: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BrowserProvider, BrowserProviderOptions, Eip1193Provider as EthersEip1193Provider, Networkish } from 'ethers';
|
|
2
|
+
import { EIP1193Provider } from './eip1193';
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the names of different wallet providers.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum WalletProviderName {
|
|
7
|
+
PASSPORT = "passport",
|
|
8
|
+
METAMASK = "metamask",
|
|
9
|
+
WALLETCONNECT = "walletconnect"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Enum representing the rdns of injected wallet providers.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum WalletProviderRdns {
|
|
15
|
+
PASSPORT = "com.immutable.passport",
|
|
16
|
+
METAMASK = "io.metamask",
|
|
17
|
+
WALLETCONNECT = "walletconnect"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Interface for the parameters required to create a wallet provider {@link Checkout.createProvider}.
|
|
21
|
+
* @interface CreateProviderParams
|
|
22
|
+
* @property {WalletProviderName} walletProviderName - The wallet provider name to create a provider for.
|
|
23
|
+
*/
|
|
24
|
+
export interface CreateProviderParams {
|
|
25
|
+
walletProviderName: WalletProviderName;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Represents the result of creating a Web3 provider {@link Checkout.createProvider}.
|
|
29
|
+
* @property {WrappedBrowserProvider} provider - The created Browser provider.
|
|
30
|
+
* @property {WalletProviderName} walletProviderName - The wallet provider name of the provider that was created.
|
|
31
|
+
*/
|
|
32
|
+
export type CreateProviderResult = {
|
|
33
|
+
provider: WrappedBrowserProvider;
|
|
34
|
+
walletProviderName: WalletProviderName;
|
|
35
|
+
};
|
|
36
|
+
export type ValidateProviderOptions = {
|
|
37
|
+
allowMistmatchedChainId: boolean;
|
|
38
|
+
allowUnsupportedProvider: boolean;
|
|
39
|
+
};
|
|
40
|
+
export declare const validateProviderDefaults: ValidateProviderOptions;
|
|
41
|
+
export declare class WrappedBrowserProvider extends BrowserProvider {
|
|
42
|
+
#private;
|
|
43
|
+
ethereumProvider: EIP1193Provider | undefined;
|
|
44
|
+
constructor(ethereum: EthersEip1193Provider, network?: Networkish, _options?: BrowserProviderOptions);
|
|
45
|
+
}
|