@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,30 @@
|
|
|
1
|
+
import { TransactionRequest } from 'ethers';
|
|
2
|
+
import { ERC20Item, ERC721Item, ERC1155Item, ItemRequirement, ItemType } from '../../types';
|
|
3
|
+
export type ItemAllowance = {
|
|
4
|
+
sufficient: boolean;
|
|
5
|
+
allowances: Allowance[];
|
|
6
|
+
};
|
|
7
|
+
export type Allowance = SufficientAllowance | InsufficientERC20 | InsufficientERC721 | InsufficientERC1155;
|
|
8
|
+
export type SufficientAllowance = {
|
|
9
|
+
sufficient: true;
|
|
10
|
+
itemRequirement: ItemRequirement;
|
|
11
|
+
};
|
|
12
|
+
export type InsufficientERC20 = {
|
|
13
|
+
type: ItemType.ERC20;
|
|
14
|
+
sufficient: false;
|
|
15
|
+
delta: bigint;
|
|
16
|
+
itemRequirement: ERC20Item;
|
|
17
|
+
approvalTransaction: TransactionRequest | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type InsufficientERC721 = {
|
|
20
|
+
type: ItemType.ERC721;
|
|
21
|
+
sufficient: false;
|
|
22
|
+
itemRequirement: ERC721Item;
|
|
23
|
+
approvalTransaction: TransactionRequest | undefined;
|
|
24
|
+
};
|
|
25
|
+
export type InsufficientERC1155 = {
|
|
26
|
+
type: ItemType.ERC1155;
|
|
27
|
+
sufficient: false;
|
|
28
|
+
itemRequirement: ERC1155Item;
|
|
29
|
+
approvalTransaction: TransactionRequest | undefined;
|
|
30
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ItemRequirement, WrappedBrowserProvider } from '../../types';
|
|
2
|
+
import { CheckoutConfiguration } from '../../config';
|
|
3
|
+
import { BalanceCheckResult } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Checks the item requirements against the owner balances.
|
|
6
|
+
*/
|
|
7
|
+
export declare const balanceCheck: (config: CheckoutConfiguration, provider: WrappedBrowserProvider, ownerAddress: string, itemRequirements: ItemRequirement[], forceFetch?: boolean) => Promise<BalanceCheckResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ERC20Item, ERC721Item, ItemBalance, ItemRequirement, WrappedBrowserProvider, NativeItem, TokenBalance, TokenInfo } from '../../types';
|
|
2
|
+
import { BalanceERC20Requirement, BalanceERC721Requirement, BalanceNativeRequirement } from './types';
|
|
3
|
+
export declare const getTokensFromRequirements: (itemRequirements: ItemRequirement[]) => TokenInfo[];
|
|
4
|
+
/**
|
|
5
|
+
* Gets the balance requirement with delta for an ERC721 requirement.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getERC721BalanceRequirement: (itemRequirement: ERC721Item, balances: ItemBalance[]) => BalanceERC721Requirement;
|
|
8
|
+
export declare const getTokenFromBalances: (itemRequirement: ERC20Item | NativeItem, balances: ItemBalance[]) => TokenBalance | undefined;
|
|
9
|
+
type TokensInfoMap = {
|
|
10
|
+
[key: string]: TokenInfo;
|
|
11
|
+
};
|
|
12
|
+
export declare const getTokensInfo: (itemRequirements: Array<ERC20Item | NativeItem>, balances: ItemBalance[], provider: WrappedBrowserProvider) => Promise<TokensInfoMap>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the balance requirement for a NATIVE or ERC20 requirement.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getTokenBalanceRequirement: (itemRequirement: ERC20Item | NativeItem, balances: ItemBalance[], token: TokenInfo) => BalanceNativeRequirement | BalanceERC20Requirement;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './balanceCheck';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BalanceDelta, ERC721Balance, ItemType, TokenBalance } from '../../types';
|
|
2
|
+
export type BalanceNativeRequirement = {
|
|
3
|
+
type: ItemType.NATIVE;
|
|
4
|
+
sufficient: boolean;
|
|
5
|
+
delta: BalanceDelta;
|
|
6
|
+
current: TokenBalance;
|
|
7
|
+
required: TokenBalance;
|
|
8
|
+
isFee: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type BalanceERC20Requirement = {
|
|
11
|
+
type: ItemType.ERC20;
|
|
12
|
+
sufficient: boolean;
|
|
13
|
+
delta: BalanceDelta;
|
|
14
|
+
current: TokenBalance;
|
|
15
|
+
required: TokenBalance;
|
|
16
|
+
isFee: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type BalanceERC721Requirement = {
|
|
19
|
+
type: ItemType.ERC721;
|
|
20
|
+
sufficient: boolean;
|
|
21
|
+
delta: BalanceDelta;
|
|
22
|
+
current: ERC721Balance;
|
|
23
|
+
required: ERC721Balance;
|
|
24
|
+
isFee: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type BalanceRequirement = BalanceNativeRequirement | BalanceERC721Requirement | BalanceERC20Requirement;
|
|
27
|
+
export type BalanceCheckResult = {
|
|
28
|
+
sufficient: boolean;
|
|
29
|
+
balanceRequirements: BalanceRequirement[];
|
|
30
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TransactionRequest } from 'ethers';
|
|
2
|
+
import { CheckoutConfiguration } from '../../config';
|
|
3
|
+
import { ItemType, ItemRequirement, GasAmount, FulfillmentTransaction, BuyResult, BuyOrder, BuyOverrides } from '../../types/smartCheckout';
|
|
4
|
+
import { WrappedBrowserProvider } from '../../types';
|
|
5
|
+
export declare const getItemRequirement: (type: ItemType, tokenAddress: string, amount: bigint, spenderAddress: string, isFee?: boolean) => ItemRequirement;
|
|
6
|
+
export declare const getTransactionOrGas: (gasLimit: number, fulfillmentTransactions: TransactionRequest[]) => FulfillmentTransaction | GasAmount;
|
|
7
|
+
export declare const buy: (config: CheckoutConfiguration, provider: WrappedBrowserProvider, orders: Array<BuyOrder>, overrides?: BuyOverrides) => Promise<BuyResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './buy';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CheckoutConfiguration } from '../../config';
|
|
2
|
+
import { CancelOverrides, CancelResult, WrappedBrowserProvider } from '../../types';
|
|
3
|
+
export declare const cancel: (config: CheckoutConfiguration, provider: WrappedBrowserProvider, orderIds: string[], overrides?: CancelOverrides) => Promise<CancelResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cancel';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FeeValue } from '@imtbl/orderbook';
|
|
2
|
+
import { OrderFee } from '../../types/fees';
|
|
3
|
+
export declare const MAX_FEE_PERCENTAGE_DECIMAL = 1;
|
|
4
|
+
export declare const MAX_FEE_DECIMAL_PLACES = 6;
|
|
5
|
+
export declare const calculateFees: (orderFees: Array<OrderFee>, weiAmount: string, decimals?: number, tokenQuantity?: bigint) => Array<FeeValue>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TransactionRequest } from 'ethers';
|
|
2
|
+
import { FulfillmentTransaction, GasAmount, ItemRequirement, WrappedBrowserProvider } from '../../types';
|
|
3
|
+
import { InsufficientERC1155, InsufficientERC20, InsufficientERC721 } from '../allowance/types';
|
|
4
|
+
export declare const estimateGas: (provider: WrappedBrowserProvider, transaction: TransactionRequest) => Promise<bigint>;
|
|
5
|
+
export declare const getGasItemRequirement: (gas: bigint, transactionOrGas: FulfillmentTransaction | GasAmount) => ItemRequirement;
|
|
6
|
+
export declare const gasCalculator: (provider: WrappedBrowserProvider, insufficientItems: (InsufficientERC20 | InsufficientERC721 | InsufficientERC1155)[], transactionOrGas: FulfillmentTransaction | GasAmount) => Promise<ItemRequirement | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './gasCalculator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './smartCheckout';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './itemRequirements';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ERC1155ItemRequirement, ERC20ItemRequirement, ERC721ItemRequirement, ItemRequirement, WrappedBrowserProvider, NativeItemRequirement } from '../../types';
|
|
2
|
+
export declare function getItemRequirementsFromRequirements(provider: WrappedBrowserProvider, requirements: (NativeItemRequirement | ERC20ItemRequirement | ERC721ItemRequirement | ERC1155ItemRequirement)[]): Promise<ItemRequirement[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JsonRpcProvider } from 'ethers';
|
|
2
|
+
import { BridgeFundingStep, ChainId, AvailableRoutingOptions } from '../../../types';
|
|
3
|
+
import { CheckoutConfiguration } from '../../../config';
|
|
4
|
+
import { TokenBalanceResult } from '../types';
|
|
5
|
+
export declare const hasSufficientL1Eth: (tokenBalanceResult: TokenBalanceResult, totalFees: bigint) => boolean;
|
|
6
|
+
export type BridgeRequirement = {
|
|
7
|
+
amount: bigint;
|
|
8
|
+
formattedAmount: string;
|
|
9
|
+
l2address: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const bridgeRoute: (config: CheckoutConfiguration, readOnlyProviders: Map<ChainId, JsonRpcProvider>, availableRoutingOptions: AvailableRoutingOptions, bridgeRequirement: BridgeRequirement, tokenBalanceResults: Map<ChainId, TokenBalanceResult>) => Promise<BridgeFundingStep | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BridgeFeeResponse } from '@imtbl/bridge-sdk';
|
|
2
|
+
import { JsonRpcProvider } from 'ethers';
|
|
3
|
+
import { ChainId } from '../../../types';
|
|
4
|
+
import { CheckoutConfiguration } from '../../../config';
|
|
5
|
+
export declare const getBridgeFeeEstimate: (config: CheckoutConfiguration, readOnlyProviders: Map<ChainId, JsonRpcProvider>, fromChainId: ChainId, toChainId: ChainId) => Promise<BridgeFeeResponse & {
|
|
6
|
+
approvalGas: bigint;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JsonRpcProvider } from 'ethers';
|
|
2
|
+
import { CheckoutConfiguration } from '../../../config';
|
|
3
|
+
import { AvailableRoutingOptions, BridgeFundingStep, ChainId, GetBalanceResult, SwapFundingStep, TokenInfo } from '../../../types';
|
|
4
|
+
import { BalanceCheckResult, BalanceERC20Requirement, BalanceNativeRequirement } from '../../balanceCheck/types';
|
|
5
|
+
import { TokenBalanceResult } from '../types';
|
|
6
|
+
import { L1ToL2TokenAddressMapping } from '../indexer/fetchL1Representation';
|
|
7
|
+
export declare const abortBridgeAndSwap: (bridgeableTokens: string[], swappableTokens: TokenInfo[], l1balances: GetBalanceResult[], l2balances: GetBalanceResult[], availableRoutingOptions: AvailableRoutingOptions, requiredTokenAddress: string | undefined) => boolean;
|
|
8
|
+
export declare const filterSwappableTokensByBridgeableAddresses: (requiredTokenAddress: string, bridgeableTokens: string[], swappableTokens: TokenInfo[], l1tol2Addresses: L1ToL2TokenAddressMapping[]) => TokenInfo[];
|
|
9
|
+
export declare const reapplyOriginalSwapBalances: (tokenBalances: Map<ChainId, TokenBalanceResult>, swapRoutes: SwapFundingStep[]) => SwapFundingStep[];
|
|
10
|
+
export declare const constructBridgeAndSwapRoutes: (bridgeFundingSteps: (BridgeFundingStep | undefined)[], swapFundingSteps: SwapFundingStep[], l1tol2Addresses: L1ToL2TokenAddressMapping[]) => BridgeAndSwapRoute[];
|
|
11
|
+
export type BridgeAndSwapRoute = {
|
|
12
|
+
bridgeFundingStep: BridgeFundingStep;
|
|
13
|
+
swapFundingStep: SwapFundingStep;
|
|
14
|
+
};
|
|
15
|
+
export declare const bridgeAndSwapRoute: (config: CheckoutConfiguration, readOnlyProviders: Map<ChainId, JsonRpcProvider>, availableRoutingOptions: AvailableRoutingOptions, insufficientRequirement: BalanceNativeRequirement | BalanceERC20Requirement, ownerAddress: string, tokenBalances: Map<ChainId, TokenBalanceResult>, bridgeableTokens: string[], swappableTokens: TokenInfo[], balanceRequirements: BalanceCheckResult) => Promise<BridgeAndSwapRoute[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GetBalanceResult } from '../../../types';
|
|
2
|
+
import { BridgeRequirement } from '../bridge/bridgeRoute';
|
|
3
|
+
import { DexQuote, DexQuotes } from '../types';
|
|
4
|
+
import { L1ToL2TokenAddressMapping } from '../indexer/fetchL1Representation';
|
|
5
|
+
import { BalanceCheckResult } from '../../balanceCheck/types';
|
|
6
|
+
export declare const getFeesForTokenAddress: (dexQuote: DexQuote, tokenAddress: string) => bigint;
|
|
7
|
+
export declare const getAmountFromBalanceRequirement: (balanceRequirements: BalanceCheckResult, quotedTokenAddress: string) => bigint;
|
|
8
|
+
export declare const getAmountToBridge: (quotedAmountWithFees: bigint, amountFromBalanceRequirement: bigint, l2balance: GetBalanceResult | undefined) => bigint;
|
|
9
|
+
export declare const constructBridgeRequirements: (dexQuotes: DexQuotes, l1balances: GetBalanceResult[], l2balances: GetBalanceResult[], l1tol2addresses: L1ToL2TokenAddressMapping[], balanceRequirements: BalanceCheckResult) => BridgeRequirement[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CheckoutConfiguration } from '../../../config';
|
|
2
|
+
import { TokenInfo } from '../../../types';
|
|
3
|
+
import { L1ToL2TokenAddressMapping } from '../indexer/fetchL1Representation';
|
|
4
|
+
export declare const fetchL1ToL2Mappings: (config: CheckoutConfiguration, swappableTokens: TokenInfo[]) => Promise<L1ToL2TokenAddressMapping[]>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CheckoutConfiguration } from '../../../config';
|
|
2
|
+
import { ChainId, GetBalanceResult } from '../../../types';
|
|
3
|
+
import { TokenBalanceResult } from '../types';
|
|
4
|
+
export declare const getBalancesByChain: (config: CheckoutConfiguration, tokenBalances: Map<ChainId, TokenBalanceResult>) => {
|
|
5
|
+
l1balances: GetBalanceResult[];
|
|
6
|
+
l2balances: GetBalanceResult[];
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CheckoutConfiguration } from '../../../config';
|
|
2
|
+
import { DexQuotes } from '../types';
|
|
3
|
+
import { BalanceNativeRequirement, BalanceERC20Requirement } from '../../balanceCheck/types';
|
|
4
|
+
import { TokenInfo } from '../../../types';
|
|
5
|
+
export declare const getDexQuotes: (config: CheckoutConfiguration, ownerAddress: string, requiredTokenAddress: string, insufficientRequirement: BalanceNativeRequirement | BalanceERC20Requirement, filteredSwappableTokens: TokenInfo[]) => Promise<DexQuotes>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './routingOptions';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CheckoutConfiguration } from '../../../config';
|
|
2
|
+
import { ChainId } from '../../../types';
|
|
3
|
+
export declare const INDEXER_ETH_ROOT_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000000eee";
|
|
4
|
+
export declare const getImxL1Representation: (chainId: ChainId, config: CheckoutConfiguration) => Promise<string>;
|
|
5
|
+
export type L1ToL2TokenAddressMapping = {
|
|
6
|
+
l1address: string;
|
|
7
|
+
l2address: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const fetchL1Representation: (config: CheckoutConfiguration, l2address: string) => Promise<L1ToL2TokenAddressMapping | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './onRampRoute';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CheckoutConfiguration } from '../../../config';
|
|
2
|
+
import { AvailableRoutingOptions, OnRampFundingStep } from '../../../types';
|
|
3
|
+
import { BalanceRequirement } from '../../balanceCheck/types';
|
|
4
|
+
export declare const onRampRoute: (config: CheckoutConfiguration, availableRoutingOptions: AvailableRoutingOptions, balanceRequirement: BalanceRequirement) => Promise<OnRampFundingStep | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JsonRpcProvider } from 'ethers';
|
|
2
|
+
import { BalanceCheckResult, BalanceRequirement } from '../balanceCheck/types';
|
|
3
|
+
import { AvailableRoutingOptions, BridgeFundingStep, ChainId, FundingRoute, OnRampFundingStep, RoutingOutcome, SwapFundingStep, TokenInfo } from '../../types';
|
|
4
|
+
import { TokenBalanceResult } from './types';
|
|
5
|
+
import { CheckoutConfiguration } from '../../config';
|
|
6
|
+
import { RoutingTokensAllowList } from '../allowList/types';
|
|
7
|
+
import { BridgeAndSwapRoute } from './bridgeAndSwap/bridgeAndSwapRoute';
|
|
8
|
+
export declare const getInsufficientRequirement: (balanceRequirements: BalanceCheckResult) => BalanceRequirement | undefined;
|
|
9
|
+
export declare const getBridgeFundingStep: (config: CheckoutConfiguration, readOnlyProviders: Map<ChainId, JsonRpcProvider>, availableRoutingOptions: AvailableRoutingOptions, insufficientRequirement: BalanceRequirement | undefined, tokenBalances: Map<ChainId, TokenBalanceResult>) => Promise<BridgeFundingStep | undefined>;
|
|
10
|
+
export declare const getSwapFundingSteps: (config: CheckoutConfiguration, availableRoutingOptions: AvailableRoutingOptions, insufficientRequirement: BalanceRequirement | undefined, ownerAddress: string, tokenBalances: Map<ChainId, TokenBalanceResult>, swapTokenAllowList: TokenInfo[] | undefined, balanceRequirements: BalanceCheckResult) => Promise<SwapFundingStep[]>;
|
|
11
|
+
export declare const getBridgeAndSwapFundingSteps: (config: CheckoutConfiguration, readOnlyProviders: Map<ChainId, JsonRpcProvider>, availableRoutingOptions: AvailableRoutingOptions, insufficientRequirement: BalanceRequirement | undefined, ownerAddress: string, tokenBalances: Map<ChainId, TokenBalanceResult>, tokenAllowList: RoutingTokensAllowList | undefined, balanceRequirements: BalanceCheckResult) => Promise<BridgeAndSwapRoute[]>;
|
|
12
|
+
export declare const getOnRampFundingStep: (config: CheckoutConfiguration, availableRoutingOptions: AvailableRoutingOptions, insufficientRequirement: BalanceRequirement | undefined) => Promise<OnRampFundingStep | undefined>;
|
|
13
|
+
export declare const routingCalculator: (config: CheckoutConfiguration, ownerAddress: string, balanceRequirements: BalanceCheckResult, availableRoutingOptions: AvailableRoutingOptions, onFundingRoute?: (fundingRoute: FundingRoute) => void) => Promise<RoutingOutcome>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CheckoutConfiguration } from '../../config';
|
|
2
|
+
import { AvailableRoutingOptions, WrappedBrowserProvider } from '../../types';
|
|
3
|
+
export declare function isPassportProvider(provider?: WrappedBrowserProvider | null): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Determines which routing options are available.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getAvailableRoutingOptions: (config: CheckoutConfiguration, provider: WrappedBrowserProvider) => Promise<AvailableRoutingOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CheckoutConfiguration } from '../../../config';
|
|
2
|
+
import { ChainId } from '../../../types';
|
|
3
|
+
import { DexQuotes } from '../types';
|
|
4
|
+
export declare const quoteFetcher: (config: CheckoutConfiguration, chainId: ChainId, walletAddress: string, requiredToken: {
|
|
5
|
+
address: string;
|
|
6
|
+
amount: bigint;
|
|
7
|
+
}, swappableTokens: string[]) => Promise<DexQuotes>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Amount, Fee } from '@imtbl/dex-sdk';
|
|
2
|
+
import { CheckoutConfiguration } from '../../../config';
|
|
3
|
+
import { AvailableRoutingOptions, ChainId, GetBalanceResult, SwapFees, SwapFundingStep } from '../../../types';
|
|
4
|
+
import { BalanceCheckResult, BalanceRequirement } from '../../balanceCheck/types';
|
|
5
|
+
import { TokenBalanceResult } from '../types';
|
|
6
|
+
export declare const constructSwapRoute: (chainId: ChainId, fundsRequired: bigint, userBalance: GetBalanceResult, fees: SwapFees) => SwapFundingStep;
|
|
7
|
+
export declare const isBalanceRequirementTokenValid: (balanceRequirement: BalanceRequirement) => boolean;
|
|
8
|
+
export declare const getRequiredToken: (balanceRequirement: BalanceRequirement) => {
|
|
9
|
+
address: string;
|
|
10
|
+
amount: bigint;
|
|
11
|
+
};
|
|
12
|
+
type SufficientApprovalFees = {
|
|
13
|
+
sufficient: boolean;
|
|
14
|
+
approvalGasFee: bigint;
|
|
15
|
+
approvalGasTokenAddress: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const checkUserCanCoverApprovalFees: (l2Balances: GetBalanceResult[], approval: Amount | null) => SufficientApprovalFees;
|
|
18
|
+
export declare const checkUserCanCoverSwapFees: (l2Balances: GetBalanceResult[], approvalFees: SufficientApprovalFees, swapGasFee: Amount | null, swapFees: Fee[], tokenBeingSwapped: {
|
|
19
|
+
amount: bigint;
|
|
20
|
+
address: string;
|
|
21
|
+
}) => boolean;
|
|
22
|
+
export declare const checkIfUserCanCoverRequirement: (l2balance: bigint, balanceRequirements: BalanceCheckResult, quoteTokenAddress: string, amountBeingSwapped: bigint, approvalFees: SufficientApprovalFees, swapFees: Fee[]) => boolean;
|
|
23
|
+
export declare const swapRoute: (config: CheckoutConfiguration, availableRoutingOptions: AvailableRoutingOptions, walletAddress: string, balanceRequirement: BalanceRequirement, tokenBalanceResults: Map<ChainId, TokenBalanceResult>, swappableTokens: string[], balanceRequirements: BalanceCheckResult) => Promise<SwapFundingStep[]>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { JsonRpcProvider } from 'ethers';
|
|
2
|
+
import { CheckoutConfiguration } from '../../config';
|
|
3
|
+
import { ChainId, AvailableRoutingOptions } from '../../types';
|
|
4
|
+
import { TokenBalanceResult } from './types';
|
|
5
|
+
export declare const getAllTokenBalances: (config: CheckoutConfiguration, readOnlyProviders: Map<ChainId, JsonRpcProvider>, ownerAddress: string, availableRoutingOptions: AvailableRoutingOptions) => Promise<Map<ChainId, TokenBalanceResult>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Amount, Quote } from '@imtbl/dex-sdk';
|
|
2
|
+
import { ChainId, GetBalanceResult } from '../../types';
|
|
3
|
+
import { CheckoutError } from '../../errors';
|
|
4
|
+
export type TokenBalanceResult = {
|
|
5
|
+
success: boolean;
|
|
6
|
+
balances: GetBalanceResult[];
|
|
7
|
+
error?: CheckoutError;
|
|
8
|
+
};
|
|
9
|
+
export type TokenBalances = Map<ChainId, TokenBalanceResult>;
|
|
10
|
+
export type DexQuotes = Map<string, DexQuote>;
|
|
11
|
+
export type DexQuote = {
|
|
12
|
+
quote: Quote;
|
|
13
|
+
approval: Amount | null;
|
|
14
|
+
swap: Amount | null;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sell';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ERC20Item, NativeItem } from '@imtbl/orderbook';
|
|
2
|
+
import { ERC721Item, ERC1155Item, SellOrder, BuyToken, SellResult, WrappedBrowserProvider } from '../../types';
|
|
3
|
+
import { CheckoutConfiguration } from '../../config';
|
|
4
|
+
export declare const getERC721Requirement: (id: string, contractAddress: string, spenderAddress: string) => ERC721Item;
|
|
5
|
+
export declare const getERC1155Requirement: (id: string, contractAddress: string, spenderAddress: string, amount: string) => ERC1155Item;
|
|
6
|
+
export declare const getBuyToken: (buyToken: BuyToken, decimals?: number) => ERC20Item | NativeItem;
|
|
7
|
+
export declare const sell: (config: CheckoutConfiguration, provider: WrappedBrowserProvider, orders: Array<SellOrder>) => Promise<SellResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AvailableRoutingOptions, FulfillmentTransaction, FundingRoute, GasAmount, ItemRequirement, SmartCheckoutResult } from '../types/smartCheckout';
|
|
2
|
+
import { CheckoutConfiguration } from '../config';
|
|
3
|
+
import { BalanceCheckResult } from './balanceCheck/types';
|
|
4
|
+
import { WrappedBrowserProvider } from '../types';
|
|
5
|
+
export declare const overrideBalanceCheckResult: (balanceCheckResult: BalanceCheckResult) => BalanceCheckResult;
|
|
6
|
+
export declare const smartCheckout: (config: CheckoutConfiguration, provider: WrappedBrowserProvider, itemRequirements: ItemRequirement[], transactionOrGasAmount?: FulfillmentTransaction | GasAmount, routingOptions?: AvailableRoutingOptions, onComplete?: (result: SmartCheckoutResult) => void, onFundingRoute?: (fundingRoute: FundingRoute) => void, fundingRouteFullAmount?: boolean) => Promise<SmartCheckoutResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './swap';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BrowserProvider } from 'ethers';
|
|
2
|
+
import { WrappedBrowserProvider, TokenInfo } from '../types';
|
|
3
|
+
import { CheckoutConfiguration } from '../config';
|
|
4
|
+
import { SwapQuoteResult, SwapResult } from '../types/swap';
|
|
5
|
+
declare const swapQuote: (config: CheckoutConfiguration, provider: BrowserProvider, fromToken: TokenInfo, toToken: TokenInfo, fromAmount?: string, toAmount?: string, slippagePercent?: number, maxHops?: number, deadline?: number) => Promise<SwapQuoteResult>;
|
|
6
|
+
declare const swap: (config: CheckoutConfiguration, provider: WrappedBrowserProvider, fromToken: TokenInfo, toToken: TokenInfo, fromAmount?: string, toAmount?: string, slippagePercent?: number, maxHops?: number, deadline?: number) => Promise<SwapResult>;
|
|
7
|
+
export { swapQuote, swap };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tokens';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JsonRpcProvider, BrowserProvider } from 'ethers';
|
|
2
|
+
import { ChainId, GetTokenAllowListResult, TokenFilter, TokenFilterTypes, TokenInfo } from '../types';
|
|
3
|
+
import { CheckoutConfiguration } from '../config';
|
|
4
|
+
type TokenAllowListParams = {
|
|
5
|
+
type: TokenFilterTypes;
|
|
6
|
+
chainId?: ChainId;
|
|
7
|
+
exclude?: TokenFilter[];
|
|
8
|
+
};
|
|
9
|
+
export declare const getTokenAllowList: (config: CheckoutConfiguration, { type, chainId, exclude, }: TokenAllowListParams) => Promise<GetTokenAllowListResult>;
|
|
10
|
+
export declare const isNativeToken: (address: string | undefined) => boolean;
|
|
11
|
+
export declare function getERC20TokenInfo(browserProvider: BrowserProvider | JsonRpcProvider, tokenAddress: string): Promise<TokenInfo>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './transaction';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TransactionRequest } from 'ethers';
|
|
2
|
+
import { CheckoutError, CheckoutErrorType } from '../errors';
|
|
3
|
+
import { WrappedBrowserProvider, SendTransactionResult } from '../types';
|
|
4
|
+
export declare function isPassportProvider(provider?: WrappedBrowserProvider | null): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Checks conditions to operate a gas-free flow.
|
|
7
|
+
*
|
|
8
|
+
* TODO:
|
|
9
|
+
* - Phase 1 (2024): Allow all passport wallets to be gas-free.
|
|
10
|
+
* - Phase 2 & 3 (2025): Not all passport wallets will be gas-free.
|
|
11
|
+
* Therefore, the gas-free condition must be checked against the relayer's
|
|
12
|
+
* `im_getFeeOptions` endpoint, which should return zero for
|
|
13
|
+
* passport accounts with gas sponsorship enabled.
|
|
14
|
+
*
|
|
15
|
+
* Refer to the docs for more details:
|
|
16
|
+
* https://docs.immutable.com/docs/zkevm/architecture/gas-sponsorship-for-gamers/
|
|
17
|
+
*/
|
|
18
|
+
export declare function isGasFree(provider?: WrappedBrowserProvider | null): boolean;
|
|
19
|
+
export declare const setTransactionGasLimits: (browserProvider: WrappedBrowserProvider, transaction: TransactionRequest) => Promise<TransactionRequest>;
|
|
20
|
+
export declare const handleProviderError: (err: any) => CheckoutError<CheckoutErrorType>;
|
|
21
|
+
export declare const sendTransaction: (browserProvider: WrappedBrowserProvider, transaction: TransactionRequest) => Promise<SendTransactionResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Eip1193Provider } from 'ethers';
|
|
2
|
+
import { ChainId } from './chains';
|
|
3
|
+
import { TokenInfo } from './tokenInfo';
|
|
4
|
+
import { WrappedBrowserProvider } from './provider';
|
|
5
|
+
/**
|
|
6
|
+
* Interface representing the parameters for {@link Checkout.getBalance}.
|
|
7
|
+
* @property {WrappedBrowserProvider} provider - The provider used to get the balance.
|
|
8
|
+
* @property {string} walletAddress - The wallet address.
|
|
9
|
+
* @property {string | undefined} tokenAddress - The contract address of the token.
|
|
10
|
+
*/
|
|
11
|
+
export interface GetBalanceParams {
|
|
12
|
+
provider: WrappedBrowserProvider;
|
|
13
|
+
walletAddress: string;
|
|
14
|
+
tokenAddress?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Interface representing the result of {@link Checkout.getBalance}.
|
|
18
|
+
* @property {bigint} balance - The balance of the wallet for the token.
|
|
19
|
+
* @property {string} formattedBalance - The formatted balance of the wallet for the token.
|
|
20
|
+
* @property {TokenInfo} token - The token information.
|
|
21
|
+
*/
|
|
22
|
+
export interface GetBalanceResult {
|
|
23
|
+
balance: bigint;
|
|
24
|
+
formattedBalance: string;
|
|
25
|
+
token: TokenInfo;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Interface representing the parameters for {@link Checkout.getAllBalances}.
|
|
29
|
+
* @property {WrappedBrowserProvider} provider - The provider used to get the balances, it is a required parameter
|
|
30
|
+
* if no walletAddress is provided.
|
|
31
|
+
* @property {string} walletAddress - The wallet address, it is a required parameter if no provider is provided.
|
|
32
|
+
* @property {ChainId} chainId - The ID of the network.
|
|
33
|
+
*/
|
|
34
|
+
export interface GetAllBalancesParams {
|
|
35
|
+
provider?: WrappedBrowserProvider | Eip1193Provider;
|
|
36
|
+
walletAddress?: string;
|
|
37
|
+
chainId: ChainId;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Interface representing the result of {@link Checkout.getAllBalances}.
|
|
41
|
+
* @property {GetBalanceResult[]} balances - The array of balances of the wallet for every token.
|
|
42
|
+
*/
|
|
43
|
+
export interface GetAllBalancesResult {
|
|
44
|
+
balances: GetBalanceResult[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Interface representing the result of {@link Checkout.getBalances}.
|
|
48
|
+
* @property {GetBalanceResult[]} balances - The array of balances of the wallet specific tokens.
|
|
49
|
+
*/
|
|
50
|
+
export interface GetBalancesResult {
|
|
51
|
+
balances: GetBalanceResult[];
|
|
52
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Eip1193Provider } from 'ethers';
|
|
2
|
+
import { WrappedBrowserProvider } from './provider';
|
|
3
|
+
import { BuyOrder, BuyOverrides } from './smartCheckout';
|
|
4
|
+
/**
|
|
5
|
+
* Interface representing the parameters for {@link Checkout.buy}
|
|
6
|
+
* @property {WrappedBrowserProvider | Eip1193Provider} provider - The provider to use for the buy.
|
|
7
|
+
* @property {Array<BuyOrder>} orders - The orders to buy
|
|
8
|
+
* @property {BuyOverrides} overrides - The overrides to use for the buy.
|
|
9
|
+
* Currently only processes the first order in the array until batch processing is supported.
|
|
10
|
+
*/
|
|
11
|
+
export interface BuyParams {
|
|
12
|
+
provider: WrappedBrowserProvider | Eip1193Provider;
|
|
13
|
+
orders: Array<BuyOrder>;
|
|
14
|
+
overrides?: BuyOverrides;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Eip1193Provider } from 'ethers';
|
|
2
|
+
import { CancelOverrides } from './smartCheckout';
|
|
3
|
+
import { WrappedBrowserProvider } from './provider';
|
|
4
|
+
/**
|
|
5
|
+
* Interface representing the parameters for {@link Checkout.cancel}
|
|
6
|
+
* @property {WrappedBrowserProvider | Eip1193Provider} provider - The provider to use for the cancel.
|
|
7
|
+
* @property {string[]} orderIds - The order IDs to cancel.
|
|
8
|
+
* @property {CancelOverrides} overrides - The overrides to use for the cancel.
|
|
9
|
+
* Currently only processes the first order in the array until batch processing is supported.
|
|
10
|
+
*/
|
|
11
|
+
export interface CancelParams {
|
|
12
|
+
provider: WrappedBrowserProvider | Eip1193Provider;
|
|
13
|
+
orderIds: string[];
|
|
14
|
+
overrides?: CancelOverrides;
|
|
15
|
+
}
|