@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,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum of possible OnRamp Widget event types.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum OnRampEventType {
|
|
5
|
+
CLOSE_WIDGET = "close-widget",
|
|
6
|
+
SUCCESS = "success",
|
|
7
|
+
FAILURE = "failure",
|
|
8
|
+
LANGUAGE_CHANGED = "language-changed"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Represents a successful on-ramp transaction.
|
|
12
|
+
* @property {string} transactionHash
|
|
13
|
+
*/
|
|
14
|
+
export type OnRampSuccess = {
|
|
15
|
+
/** The transaction hash of the successful transaction. */
|
|
16
|
+
transactionHash: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Type representing a On-ramp Widget with type FAILURE.
|
|
20
|
+
* @property {string} reason
|
|
21
|
+
* @property {number} timestamp
|
|
22
|
+
*/
|
|
23
|
+
export type OnRampFailed = {
|
|
24
|
+
/** The reason why the on-ramp failed. */
|
|
25
|
+
reason: string;
|
|
26
|
+
/** The timestamp of the failed transaction. */
|
|
27
|
+
timestamp: number;
|
|
28
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { WrappedBrowserProvider } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Enum representing different types of orchestration events.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum OrchestrationEventType {
|
|
6
|
+
REQUEST_CONNECT = "request-connect",
|
|
7
|
+
REQUEST_WALLET = "request-wallet",
|
|
8
|
+
REQUEST_SWAP = "request-swap",
|
|
9
|
+
REQUEST_BRIDGE = "request-bridge",
|
|
10
|
+
REQUEST_ONRAMP = "request-onramp",
|
|
11
|
+
REQUEST_ADD_TOKENS = "request-add-tokens",
|
|
12
|
+
REQUEST_PURCHASE = "request-purchase",
|
|
13
|
+
REQUEST_GO_BACK = "request-go-back"
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents the connect event object when the connect widget is requested.
|
|
17
|
+
* @property {string} walletProviderName
|
|
18
|
+
*/
|
|
19
|
+
export type RequestConnectEvent = {
|
|
20
|
+
/** The wallet provider name. */
|
|
21
|
+
walletProviderName: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Represents the wallet event object when the wallet widget is requested.
|
|
25
|
+
* @property {string} walletProviderName
|
|
26
|
+
*/
|
|
27
|
+
export type RequestWalletEvent = {
|
|
28
|
+
/** The wallet provider name. */
|
|
29
|
+
walletProviderName: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Represents the swap event object when the swap widget is requested.
|
|
33
|
+
* @property {string} fromTokenAddress
|
|
34
|
+
* @property {string} toTokenAddress
|
|
35
|
+
* @property {string} amount
|
|
36
|
+
*/
|
|
37
|
+
export type RequestSwapEvent = {
|
|
38
|
+
/** The address of the token to swap from. */
|
|
39
|
+
fromTokenAddress: string;
|
|
40
|
+
/** The address of the token to swap to. */
|
|
41
|
+
toTokenAddress: string;
|
|
42
|
+
/** The amount of from tokens to swap. */
|
|
43
|
+
amount: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Represents the bridge event object when the bridge widget is requested.
|
|
47
|
+
* @property {string} tokenAddress
|
|
48
|
+
* @property {string} amount
|
|
49
|
+
*/
|
|
50
|
+
export type RequestBridgeEvent = {
|
|
51
|
+
/** The address of the token to bridge. */
|
|
52
|
+
tokenAddress: string;
|
|
53
|
+
/** The amount of tokens to bridge. */
|
|
54
|
+
amount: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Represents the onramp event object when the onramp widget is requested.
|
|
58
|
+
* @property {string} tokenAddress
|
|
59
|
+
* @property {string} amount
|
|
60
|
+
*/
|
|
61
|
+
export type RequestOnrampEvent = {
|
|
62
|
+
/** The address of the token to be used for onramp. */
|
|
63
|
+
tokenAddress: string;
|
|
64
|
+
/** The amount of tokens to onramp. */
|
|
65
|
+
amount: string;
|
|
66
|
+
/** The connected provider. */
|
|
67
|
+
provider?: WrappedBrowserProvider;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Represents the add tokens event object when the add tokens widget is requested.
|
|
71
|
+
*/
|
|
72
|
+
export type RequestAddTokensEvent = {
|
|
73
|
+
/** Token address of the fund to be added */
|
|
74
|
+
toTokenAddress?: string;
|
|
75
|
+
/** Amount of the fund to be added */
|
|
76
|
+
toAmount?: string;
|
|
77
|
+
/** Whether to show a back button on the first screen, on click triggers REQUEST_GO_BACK event */
|
|
78
|
+
showBackButton?: boolean;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Represents the object provide after go back event is requested
|
|
82
|
+
*/
|
|
83
|
+
export type RequestGoBackEvent = {};
|
|
84
|
+
export type OrchestrationEventData = RequestConnectEvent | RequestWalletEvent | RequestSwapEvent | RequestBridgeEvent | RequestOnrampEvent | RequestGoBackEvent | RequestAddTokensEvent;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EIP6963ProviderInfo, WrappedBrowserProvider } from '../../../types';
|
|
2
|
+
export declare enum PurchaseEventType {
|
|
3
|
+
CLOSE_WIDGET = "close-widget",
|
|
4
|
+
CONNECT_SUCCESS = "connect-success",
|
|
5
|
+
SUCCESS = "success",
|
|
6
|
+
FAILURE = "failure"
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Represents a successful purchase.
|
|
10
|
+
*/
|
|
11
|
+
export type PurchaseSuccess = {};
|
|
12
|
+
/**
|
|
13
|
+
* Type representing a purchase failure
|
|
14
|
+
* @property {string} reason
|
|
15
|
+
*/
|
|
16
|
+
export type PurchaseFailed = {
|
|
17
|
+
reason: string;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Type representing a successful provider connection
|
|
22
|
+
* @property {WrappedBrowserProvider} provider
|
|
23
|
+
* @property {EIP6963ProviderInfo} providerInfo
|
|
24
|
+
* @property {'from' | 'to'} providerType
|
|
25
|
+
*/
|
|
26
|
+
export type PurchaseConnectSuccess = {
|
|
27
|
+
provider: WrappedBrowserProvider;
|
|
28
|
+
providerInfo: EIP6963ProviderInfo;
|
|
29
|
+
providerType: 'from' | 'to';
|
|
30
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { TokenInfo } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Enum representing possible Sale Widget event types.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum SaleEventType {
|
|
6
|
+
CLOSE_WIDGET = "close-widget",
|
|
7
|
+
SUCCESS = "success",
|
|
8
|
+
FAILURE = "failure",
|
|
9
|
+
REJECTED = "rejected",
|
|
10
|
+
TRANSACTION_SUCCESS = "transaction-success",
|
|
11
|
+
LANGUAGE_CHANGED = "language-changed",
|
|
12
|
+
PAYMENT_METHOD = "payment-method",
|
|
13
|
+
REQUEST_BRIDGE = "request-bridge",
|
|
14
|
+
REQUEST_ONRAMP = "request-onramp",
|
|
15
|
+
REQUEST_SWAP = "request-swap",
|
|
16
|
+
PAYMENT_TOKEN = "payment-token"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Represents a successful Sale transaction.
|
|
20
|
+
* @property {Array} transactions -
|
|
21
|
+
*/
|
|
22
|
+
export type SaleSuccess = {
|
|
23
|
+
/** Chosen payment method */
|
|
24
|
+
paymentMethod: SalePaymentTypes | undefined;
|
|
25
|
+
/** The minted items token ids */
|
|
26
|
+
tokenIds: string[];
|
|
27
|
+
/** The executed transactions */
|
|
28
|
+
transactions: {
|
|
29
|
+
method: string;
|
|
30
|
+
hash: string | undefined;
|
|
31
|
+
}[];
|
|
32
|
+
/** The order reference id, use it to trace order throughout flow */
|
|
33
|
+
transactionId: string;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Type representing a Sale Widget with type FAILURE.
|
|
38
|
+
* @property {string} reason
|
|
39
|
+
* @property {number} timestamp
|
|
40
|
+
* @property {Array} transactions
|
|
41
|
+
*/
|
|
42
|
+
export type SaleFailed = {
|
|
43
|
+
/** The reason why sale transaction failed. */
|
|
44
|
+
reason: string;
|
|
45
|
+
/** The error object. */
|
|
46
|
+
error: Record<string, unknown>;
|
|
47
|
+
/** The timestamp of the failed swap. */
|
|
48
|
+
timestamp: number;
|
|
49
|
+
/** Chosen payment method */
|
|
50
|
+
paymentMethod: SalePaymentTypes | undefined;
|
|
51
|
+
/** The executed transactions */
|
|
52
|
+
transactions: {
|
|
53
|
+
method: string;
|
|
54
|
+
hash: string | undefined;
|
|
55
|
+
}[];
|
|
56
|
+
/** The order reference id, use it to trace order throughout flow */
|
|
57
|
+
transactionId: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Type representing a Sale Widget with type TRANSACTION_SUCCESS.
|
|
61
|
+
* @property {Object} transactions
|
|
62
|
+
*/
|
|
63
|
+
export type SaleTransactionSuccess = {
|
|
64
|
+
paymentMethod: SalePaymentTypes | undefined;
|
|
65
|
+
/** The executed transactions */
|
|
66
|
+
transactions: {
|
|
67
|
+
method: string;
|
|
68
|
+
hash: string | undefined;
|
|
69
|
+
}[];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Type representing a Sale Widget with type PAYMENT_METHOD.
|
|
73
|
+
* @property {Object} transactions
|
|
74
|
+
*/
|
|
75
|
+
export type SalePaymentMethod = {
|
|
76
|
+
/** Chosen payment method */
|
|
77
|
+
paymentMethod: SalePaymentTypes | undefined;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Type representing a Sale Widget with type PAYMENT_TOKEN.
|
|
81
|
+
* @property {Object} transactions
|
|
82
|
+
*/
|
|
83
|
+
export type SalePaymentToken = {
|
|
84
|
+
/** Chosen payment token */
|
|
85
|
+
settlementType: string;
|
|
86
|
+
type: string;
|
|
87
|
+
token: TokenInfo;
|
|
88
|
+
amount: string;
|
|
89
|
+
balance: string;
|
|
90
|
+
fiat: {
|
|
91
|
+
amount: string;
|
|
92
|
+
balance: string;
|
|
93
|
+
symbol: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Enum representing Sale Widget available payment types.
|
|
98
|
+
*/
|
|
99
|
+
export declare enum SalePaymentTypes {
|
|
100
|
+
CRYPTO = "crypto",
|
|
101
|
+
DEBIT = "debit",
|
|
102
|
+
CREDIT = "credit"
|
|
103
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing possible Swap Widget event types.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum SwapEventType {
|
|
5
|
+
CLOSE_WIDGET = "close-widget",
|
|
6
|
+
SUCCESS = "success",
|
|
7
|
+
FAILURE = "failure",
|
|
8
|
+
REJECTED = "rejected",
|
|
9
|
+
LANGUAGE_CHANGED = "language-changed"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Represents a successful swap transaction.
|
|
13
|
+
* @property {string} transactionHash
|
|
14
|
+
*/
|
|
15
|
+
export type SwapSuccess = {
|
|
16
|
+
/** The hash of the successful transaction. */
|
|
17
|
+
transactionHash: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Type representing a Swap Widget with type FAILURE.
|
|
21
|
+
* @property {string} reason
|
|
22
|
+
* @property {number} timestamp
|
|
23
|
+
*/
|
|
24
|
+
export type SwapFailed = {
|
|
25
|
+
/** The reason why the swap failed. */
|
|
26
|
+
reason: string;
|
|
27
|
+
/** The timestamp of the failed swap. */
|
|
28
|
+
timestamp: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Type representing a Swap Widget with type REJECTED.
|
|
32
|
+
* @property {string} reason -
|
|
33
|
+
* @property {number} timestamp -
|
|
34
|
+
*/
|
|
35
|
+
export type SwapRejected = {
|
|
36
|
+
/** The reason why the swap failed. */
|
|
37
|
+
reason: string;
|
|
38
|
+
/** The timestamp of the failed swap. */
|
|
39
|
+
timestamp: number;
|
|
40
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WrappedBrowserProvider } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Enum representing possible Wallet Widget event types.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum WalletEventType {
|
|
6
|
+
CLOSE_WIDGET = "close-widget",
|
|
7
|
+
NETWORK_SWITCH = "network-switch",
|
|
8
|
+
DISCONNECT_WALLET = "disconnect-wallet",
|
|
9
|
+
LANGUAGE_CHANGED = "language-changed"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Represents an event that is triggered when the user switches the network in their wallet.
|
|
13
|
+
* @property {string} network
|
|
14
|
+
* @property {number} chainId
|
|
15
|
+
* @property {WrappedBrowserProvider} provider
|
|
16
|
+
*/
|
|
17
|
+
export type WalletNetworkSwitch = {
|
|
18
|
+
/** The name of the network that the user switched to. */
|
|
19
|
+
network: string;
|
|
20
|
+
/** The chain ID of the network that the user switched to. */
|
|
21
|
+
chainId: number;
|
|
22
|
+
/** The Web3 provider object for the switched network. */
|
|
23
|
+
provider: WrappedBrowserProvider;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Represents an event that is triggered when a wallet is disconnected.
|
|
27
|
+
*/
|
|
28
|
+
export type WalletDisconnect = {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WidgetLanguage } from '../configurations';
|
|
2
|
+
import { WrappedBrowserProvider } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the events emitted by the widgets.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum IMTBLWidgetEvents {
|
|
7
|
+
IMTBL_WIDGETS_PROVIDER = "imtbl-widgets-provider",
|
|
8
|
+
IMTBL_CONNECT_WIDGET_EVENT = "imtbl-connect-widget",
|
|
9
|
+
IMTBL_WALLET_WIDGET_EVENT = "imtbl-wallet-widget",
|
|
10
|
+
IMTBL_SWAP_WIDGET_EVENT = "imtbl-swap-widget",
|
|
11
|
+
IMTBL_BRIDGE_WIDGET_EVENT = "imtbl-bridge-widget",
|
|
12
|
+
IMTBL_ONRAMP_WIDGET_EVENT = "imtbl-onramp-widget",
|
|
13
|
+
IMTBL_SALE_WIDGET_EVENT = "imtbl-sale-widget",
|
|
14
|
+
IMTBL_COMMERCE_WIDGET_EVENT = "imtbl-commerce-widget",
|
|
15
|
+
IMTBL_ADD_TOKENS_WIDGET_EVENT = "imtbl-add-tokens-widget",
|
|
16
|
+
IMTBL_PURCHASE_WIDGET_EVENT = "imtbl-purchase-widget"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Enum for events raised for about provider objects
|
|
20
|
+
*/
|
|
21
|
+
export declare enum ProviderEventType {
|
|
22
|
+
PROVIDER_UPDATED = "PROVIDER_UPDATED"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Payload type for the PROVIDER_UPDATED event
|
|
26
|
+
*/
|
|
27
|
+
export type ProviderUpdated = {
|
|
28
|
+
provider: WrappedBrowserProvider;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Payload type for the LANGUAGE_CHANGED event
|
|
32
|
+
*/
|
|
33
|
+
export type LanguageChanged = {
|
|
34
|
+
language: WidgetLanguage;
|
|
35
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Checkout } from '../../sdk';
|
|
2
|
+
import { WrappedBrowserProvider } from '../../types';
|
|
3
|
+
import { CheckoutWidgetsConfig, WidgetParameters, IWidgetsFactory, Widget, WidgetProperties, WidgetType, WidgetEventData, IWidgetsFactoryCreate } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Declares global interfaces and namespaces for the application.
|
|
6
|
+
* @global
|
|
7
|
+
* @namespace ImmutableCheckoutWidgets
|
|
8
|
+
* */
|
|
9
|
+
declare global {
|
|
10
|
+
namespace ImmutableCheckoutWidgets {
|
|
11
|
+
class WidgetsFactory implements IWidgetsFactory {
|
|
12
|
+
constructor(sdk: Checkout, config: CheckoutWidgetsConfig);
|
|
13
|
+
create: IWidgetsFactoryCreate;
|
|
14
|
+
updateProvider(provider: WrappedBrowserProvider): void;
|
|
15
|
+
}
|
|
16
|
+
class Connect<T extends WidgetType> implements Widget<T> {
|
|
17
|
+
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
18
|
+
mount(id: string, params?: WidgetParameters[T]): void;
|
|
19
|
+
unmount(): void;
|
|
20
|
+
update(props: WidgetProperties<T>): void;
|
|
21
|
+
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
22
|
+
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
23
|
+
}
|
|
24
|
+
class Bridge<T extends WidgetType> implements Widget<T> {
|
|
25
|
+
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
26
|
+
mount(id: string, params?: WidgetParameters[T]): void;
|
|
27
|
+
unmount(): void;
|
|
28
|
+
update(props: WidgetProperties<T>): void;
|
|
29
|
+
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
30
|
+
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
31
|
+
}
|
|
32
|
+
class Wallet<T extends WidgetType> implements Widget<T> {
|
|
33
|
+
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
34
|
+
mount(id: string, params?: WidgetParameters[T]): void;
|
|
35
|
+
unmount(): void;
|
|
36
|
+
update(props: WidgetProperties<T>): void;
|
|
37
|
+
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
38
|
+
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
39
|
+
}
|
|
40
|
+
class Swap<T extends WidgetType> implements Widget<T> {
|
|
41
|
+
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
42
|
+
mount(id: string, params?: WidgetParameters[T]): void;
|
|
43
|
+
unmount(): void;
|
|
44
|
+
update(props: WidgetProperties<T>): void;
|
|
45
|
+
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
46
|
+
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
47
|
+
}
|
|
48
|
+
class OnRamp<T extends WidgetType> implements Widget<T> {
|
|
49
|
+
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
50
|
+
mount(id: string, params?: WidgetParameters[T]): void;
|
|
51
|
+
unmount(): void;
|
|
52
|
+
update(props: WidgetProperties<T>): void;
|
|
53
|
+
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
54
|
+
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
55
|
+
}
|
|
56
|
+
class Sale<T extends WidgetType> implements Widget<T> {
|
|
57
|
+
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
58
|
+
mount(id: string, params?: WidgetParameters[T]): void;
|
|
59
|
+
unmount(): void;
|
|
60
|
+
update(props: WidgetProperties<T>): void;
|
|
61
|
+
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
62
|
+
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
63
|
+
}
|
|
64
|
+
class Commerce<T extends WidgetType> implements Widget<T> {
|
|
65
|
+
constructor(sdk: Checkout, props: WidgetProperties<T>);
|
|
66
|
+
mount(id: string, params?: WidgetParameters[T]): void;
|
|
67
|
+
unmount(): void;
|
|
68
|
+
update(props: WidgetProperties<T>): void;
|
|
69
|
+
addListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName, callback: (data: WidgetEventData[T][KEventName]) => void): void;
|
|
70
|
+
removeListener<KEventName extends keyof WidgetEventData[T]>(type: KEventName): void;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WrappedBrowserProvider } from '../../../types';
|
|
2
|
+
import { WidgetLanguage } from '../configurations';
|
|
3
|
+
export type AddTokensWidgetParams = {
|
|
4
|
+
/** The language to use for the Add Tokens widget */
|
|
5
|
+
language?: WidgetLanguage;
|
|
6
|
+
/** Configure to show on-ramp option */
|
|
7
|
+
showOnrampOption?: boolean;
|
|
8
|
+
/** Configure to show swap option */
|
|
9
|
+
showSwapOption?: boolean;
|
|
10
|
+
/** Configure to show on bridge option */
|
|
11
|
+
showBridgeOption?: boolean;
|
|
12
|
+
/** Token address of the fund to be added */
|
|
13
|
+
toTokenAddress?: string;
|
|
14
|
+
/** Amount of the fund to be added */
|
|
15
|
+
toAmount?: string;
|
|
16
|
+
/** Whether to show a back button on the first screen, on click triggers REQUEST_GO_BACK event */
|
|
17
|
+
showBackButton?: boolean;
|
|
18
|
+
/** The destination wallet provider, when requiring to lock destination of funds */
|
|
19
|
+
toProvider?: WrappedBrowserProvider;
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WalletProviderName } from '../../../types';
|
|
2
|
+
import { WidgetLanguage } from '../configurations';
|
|
3
|
+
/**
|
|
4
|
+
* Bridge Widget parameters
|
|
5
|
+
* @property {string | undefined} tokenAddress
|
|
6
|
+
* @property {string | undefined} amount
|
|
7
|
+
* @property {WalletProviderName | undefined} walletProviderName
|
|
8
|
+
*/
|
|
9
|
+
export type BridgeWidgetParams = {
|
|
10
|
+
/** The contract address of the token to bridge from, used to populate the bridge form token field */
|
|
11
|
+
tokenAddress?: string;
|
|
12
|
+
/** The formatted amount to bridge, used to populate the bridge form amount field */
|
|
13
|
+
amount?: string;
|
|
14
|
+
/** The wallet provider name to use for the bridge widget */
|
|
15
|
+
walletProviderName?: WalletProviderName;
|
|
16
|
+
/** The language to use for the bridge widget */
|
|
17
|
+
language?: WidgetLanguage;
|
|
18
|
+
/** Whether to show a back button on the first screen, on click triggers REQUEST_GO_BACK event */
|
|
19
|
+
showBackButton?: boolean;
|
|
20
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { WidgetLanguage, WidgetTheme } from '../configurations';
|
|
2
|
+
import { ConnectWidgetParams } from './connect';
|
|
3
|
+
import { BridgeWidgetParams } from './bridge';
|
|
4
|
+
import { WalletWidgetParams } from './wallet';
|
|
5
|
+
import { SwapWidgetParams } from './swap';
|
|
6
|
+
import { OnRampWidgetParams } from './onramp';
|
|
7
|
+
import { SaleWidgetParams } from './sale';
|
|
8
|
+
import { AddTokensWidgetParams } from './addTokens';
|
|
9
|
+
export declare enum CommerceFlowType {
|
|
10
|
+
CONNECT = "CONNECT",
|
|
11
|
+
WALLET = "WALLET",
|
|
12
|
+
SALE = "SALE",
|
|
13
|
+
SWAP = "SWAP",
|
|
14
|
+
BRIDGE = "BRIDGE",
|
|
15
|
+
ONRAMP = "ONRAMP",
|
|
16
|
+
ADD_TOKENS = "ADD_TOKENS"
|
|
17
|
+
}
|
|
18
|
+
export type CommerceWidgetConnectFlowParams = {
|
|
19
|
+
flow: CommerceFlowType.CONNECT;
|
|
20
|
+
} & ConnectWidgetParams;
|
|
21
|
+
export type CommerceWidgetWalletFlowParams = {
|
|
22
|
+
flow: CommerceFlowType.WALLET;
|
|
23
|
+
} & WalletWidgetParams;
|
|
24
|
+
export type CommerceWidgetSwapFlowParams = {
|
|
25
|
+
flow: CommerceFlowType.SWAP;
|
|
26
|
+
} & SwapWidgetParams;
|
|
27
|
+
export type CommerceWidgetBridgeFlowParams = {
|
|
28
|
+
flow: CommerceFlowType.BRIDGE;
|
|
29
|
+
} & BridgeWidgetParams;
|
|
30
|
+
export type CommerceWidgetOnRampFlowParams = {
|
|
31
|
+
flow: CommerceFlowType.ONRAMP;
|
|
32
|
+
} & OnRampWidgetParams;
|
|
33
|
+
export type CommerceWidgetSaleFlowParams = {
|
|
34
|
+
flow: CommerceFlowType.SALE;
|
|
35
|
+
} & SaleWidgetParams;
|
|
36
|
+
export type CommerceWidgetAddTokensFlowParams = {
|
|
37
|
+
flow: CommerceFlowType.ADD_TOKENS;
|
|
38
|
+
} & AddTokensWidgetParams;
|
|
39
|
+
export type CommerceWidgetFlowParams = CommerceWidgetConnectFlowParams | CommerceWidgetWalletFlowParams | CommerceWidgetSwapFlowParams | CommerceWidgetBridgeFlowParams | CommerceWidgetOnRampFlowParams | CommerceWidgetSaleFlowParams | CommerceWidgetAddTokensFlowParams;
|
|
40
|
+
export type CommerceWidgetParams = {
|
|
41
|
+
/** The language to use for the Commerce Widget */
|
|
42
|
+
language?: WidgetLanguage;
|
|
43
|
+
theme?: WidgetTheme;
|
|
44
|
+
} & CommerceWidgetFlowParams;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChainId, WalletProviderRdns } from '../../../types';
|
|
2
|
+
import { WidgetLanguage } from '../configurations';
|
|
3
|
+
export declare enum ConnectTargetLayer {
|
|
4
|
+
LAYER1 = "LAYER1",
|
|
5
|
+
LAYER2 = "LAYER2"
|
|
6
|
+
}
|
|
7
|
+
export type ConnectWidgetParams = {
|
|
8
|
+
/** The language to use for the connect widget */
|
|
9
|
+
language?: WidgetLanguage;
|
|
10
|
+
/** The target chain to connect to as part of the connection process (defaults to Immutable zkEVM / Immutable zkEVM Testnet) */
|
|
11
|
+
targetChainId?: ChainId;
|
|
12
|
+
/** The target wallet to establish a connection with */
|
|
13
|
+
targetWalletRdns?: string | WalletProviderRdns;
|
|
14
|
+
/** List of wallets rdns to exclude from the connect widget */
|
|
15
|
+
blocklistWalletRdns?: string[];
|
|
16
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { AddTokensWidgetParams } from './addTokens';
|
|
2
|
+
export * from './connect';
|
|
3
|
+
export * from './bridge';
|
|
4
|
+
export * from './wallet';
|
|
5
|
+
export * from './swap';
|
|
6
|
+
export * from './onramp';
|
|
7
|
+
export * from './sale';
|
|
8
|
+
export * from './commerce';
|
|
9
|
+
export * from './purchase';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WalletProviderName } from '../../../types';
|
|
2
|
+
import { WidgetLanguage } from '../configurations';
|
|
3
|
+
/**
|
|
4
|
+
* OnRamp Widget parameters
|
|
5
|
+
* @property {string | undefined} tokenAddress
|
|
6
|
+
* @property {string | undefined} amount
|
|
7
|
+
* @property {WalletProviderName | undefined} walletProviderName
|
|
8
|
+
*/
|
|
9
|
+
export type OnRampWidgetParams = {
|
|
10
|
+
/** The contract address of the token to onramp */
|
|
11
|
+
tokenAddress?: string;
|
|
12
|
+
/** The formatted amount to onramp, used to populate the onramp form amount field */
|
|
13
|
+
amount?: string;
|
|
14
|
+
/** The wallet provider name to use for the onramp widget */
|
|
15
|
+
walletProviderName?: WalletProviderName;
|
|
16
|
+
/** The language to use for the onramp widget */
|
|
17
|
+
language?: WidgetLanguage;
|
|
18
|
+
/** Whether to show a back button on the first screen, on click triggers REQUEST_GO_BACK event */
|
|
19
|
+
showBackButton?: boolean;
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WidgetLanguage } from '../configurations';
|
|
2
|
+
export type PurchaseWidgetParams = {
|
|
3
|
+
/** The language to use for the Purchase widget */
|
|
4
|
+
language?: WidgetLanguage;
|
|
5
|
+
/** Environment id from Immutable Hub */
|
|
6
|
+
environmentId?: string;
|
|
7
|
+
/** Whether to show a back button on the first screen, on click triggers REQUEST_GO_BACK event */
|
|
8
|
+
showBackButton?: boolean;
|
|
9
|
+
/** The list of products to be purchased */
|
|
10
|
+
items?: PurchaseItem[];
|
|
11
|
+
};
|
|
12
|
+
export type PurchaseItem = {
|
|
13
|
+
productId: string;
|
|
14
|
+
qty: number;
|
|
15
|
+
name: string;
|
|
16
|
+
image: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { WalletProviderName } from '../../../types';
|
|
2
|
+
import { WidgetLanguage } from '../configurations';
|
|
3
|
+
import { SalePaymentTypes } from '../events/sale';
|
|
4
|
+
/**
|
|
5
|
+
* Sale Widget parameters
|
|
6
|
+
* @property {string} amount
|
|
7
|
+
* @property {string} environmentId
|
|
8
|
+
* @property {SaleItem[]} items
|
|
9
|
+
* @property {WalletProviderName | undefined} walletProviderName
|
|
10
|
+
*/
|
|
11
|
+
export type SaleWidgetParams = {
|
|
12
|
+
/** Environment id from Immutable Hub */
|
|
13
|
+
environmentId?: string;
|
|
14
|
+
/** The list of products to be purchased */
|
|
15
|
+
items?: SaleItem[];
|
|
16
|
+
/** The name of the NFT collection on sale */
|
|
17
|
+
collectionName?: string;
|
|
18
|
+
/** The wallet provider name to default to if no browserProvider is passed */
|
|
19
|
+
walletProviderName?: WalletProviderName;
|
|
20
|
+
/** The language to use for the sales widget */
|
|
21
|
+
language?: WidgetLanguage;
|
|
22
|
+
/** The disabled payment types */
|
|
23
|
+
excludePaymentTypes?: SalePaymentTypes[];
|
|
24
|
+
/** Fiat currencies excluded from on-ramp */
|
|
25
|
+
excludeFiatCurrencies?: string[];
|
|
26
|
+
/** Preferred currency, replacing the backend's base currency */
|
|
27
|
+
preferredCurrency?: string;
|
|
28
|
+
/** Custom key-value pairs to be passed to the order */
|
|
29
|
+
customOrderData?: Record<string, unknown>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A product to be purchased
|
|
33
|
+
* @property {string} productId
|
|
34
|
+
* @property {number} qty
|
|
35
|
+
* @property {string} name
|
|
36
|
+
* @property {string} image
|
|
37
|
+
* @property {string} description
|
|
38
|
+
*/
|
|
39
|
+
export type SaleItem = {
|
|
40
|
+
/** The id of the product */
|
|
41
|
+
productId: string;
|
|
42
|
+
/** The quantity to be purchased */
|
|
43
|
+
qty: number;
|
|
44
|
+
/** The name of the item */
|
|
45
|
+
name: string;
|
|
46
|
+
/** The image url of the item */
|
|
47
|
+
image: string;
|
|
48
|
+
/** The description of the item */
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { WalletProviderName } from '../../../types';
|
|
2
|
+
import { WidgetLanguage } from '../configurations';
|
|
3
|
+
export declare enum SwapDirection {
|
|
4
|
+
FROM = "FROM",
|
|
5
|
+
TO = "TO"
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Swap Widget parameters
|
|
9
|
+
* @property {string | undefined} amount
|
|
10
|
+
* @property {string | undefined} fromTokenAddress
|
|
11
|
+
* @property {string | undefined} toTokenAddress
|
|
12
|
+
* @property {WalletProviderName | undefined} walletProviderName
|
|
13
|
+
*/
|
|
14
|
+
export type SwapWidgetParams = {
|
|
15
|
+
/** The formatted amount to swap, used to populate the swap from amount field */
|
|
16
|
+
amount?: string;
|
|
17
|
+
/** The contract address of the token to swap from */
|
|
18
|
+
fromTokenAddress?: string;
|
|
19
|
+
/** The contract address of the token to swap to */
|
|
20
|
+
toTokenAddress?: string;
|
|
21
|
+
/** The wallet provider name to use for the swap widget */
|
|
22
|
+
walletProviderName?: WalletProviderName;
|
|
23
|
+
/** The language to use for the swap widget */
|
|
24
|
+
language?: WidgetLanguage;
|
|
25
|
+
/** Whether the swap widget should display the form or automatically proceed with the swap */
|
|
26
|
+
autoProceed?: boolean;
|
|
27
|
+
/** The direction of the swap */
|
|
28
|
+
direction?: SwapDirection;
|
|
29
|
+
/** Whether to show a back button on the first screen, on click triggers REQUEST_GO_BACK event */
|
|
30
|
+
showBackButton?: boolean;
|
|
31
|
+
};
|