@dodoex/widgets 2.6.12-beta.0 → 2.6.12-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/8de9a184d4ef0a11.svg +6 -0
- package/dist/cjs/8de9a184d4ef0a11.svg +6 -0
- package/dist/cjs/components/Confirm.d.ts +3 -2
- package/dist/cjs/components/ConnectWallet/NeedConnectButton.d.ts +1 -3
- package/dist/cjs/components/Swap/components/Dialog.d.ts +1 -0
- package/dist/cjs/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +2 -1
- package/dist/cjs/components/Swap/components/TokenCard/index.d.ts +2 -2
- package/dist/cjs/components/Swap/index.d.ts +4 -1
- package/dist/cjs/components/TokenLogo.d.ts +3 -1
- package/dist/cjs/constants/chains.d.ts +1 -0
- package/dist/cjs/{helper-Cto9FLzX.cjs → helper-AUp7J6va.cjs} +1 -1
- package/dist/cjs/helper-C5SrJQaK.cjs +1 -0
- package/dist/cjs/helper-DL8TMEkQ.cjs +1 -0
- package/dist/cjs/helper-DNaeIBQY.cjs +1 -0
- package/dist/cjs/hooks/Submission/types.d.ts +2 -0
- package/dist/cjs/hooks/Submission/useExecution.d.ts +2 -1
- package/dist/cjs/hooks/Swap/useExecuteSwap.d.ts +2 -1
- package/dist/cjs/{index-LuoRf91r.cjs → index-BKylx06q.cjs} +1 -1
- package/dist/cjs/{index-BprhI-s9.cjs → index-BVjmGGMM.cjs} +1 -1
- package/dist/cjs/index-BZtt1iuv.cjs +12 -0
- package/dist/cjs/index-BeGs2DH_.cjs +78 -0
- package/dist/cjs/index-BwnUmGDp.cjs +53 -0
- package/dist/cjs/index-CULtuKOC.cjs +78 -0
- package/dist/cjs/index-CVLls_ja.cjs +53 -0
- package/dist/cjs/index-DTCQ7g1k.cjs +12 -0
- package/dist/cjs/index-DUQ8hOW2.cjs +78 -0
- package/dist/cjs/index-DWLX0NSs.cjs +53 -0
- package/dist/cjs/index-DoCc2JCv.cjs +53 -0
- package/dist/cjs/index-DsNlidLA.cjs +12 -0
- package/dist/cjs/index.cjs +7 -7
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/locales/en-US.js +1 -1
- package/dist/cjs/locales/zh-CN.js +1 -1
- package/dist/cjs/{lottie-Cw1tUn46.cjs → lottie-4VzKv4A8.cjs} +1 -1
- package/dist/cjs/lottie-DHOGwVb_.cjs +1 -0
- package/dist/cjs/lottie-DLvPIL-h.cjs +1 -0
- package/dist/cjs/lottie-TilCy8UF.cjs +1 -0
- package/dist/cjs/providers/GlobalConfigContext.d.ts +6 -2
- package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/index.d.ts +1 -1
- package/dist/cjs/src/components/Bridge/SelectBridgeDialog/RouteCard.d.ts +2 -2
- package/dist/cjs/src/components/Swap/components/ConnectWallet/ConnectWalletDialog.d.ts +2 -1
- package/dist/cjs/src/components/Swap/components/ConnectWallet/index.d.ts +2 -1
- package/dist/cjs/src/components/Swap/index.d.ts +2 -1
- package/dist/cjs/src/components/Widget/BridgeTonSummaryDialog/index.d.ts +11 -0
- package/dist/cjs/src/components/Widget/index.d.ts +3 -0
- package/dist/cjs/src/constants/chains.d.ts +1 -2
- package/dist/cjs/src/constants/tokenList.d.ts +11 -2
- package/dist/cjs/src/hooks/Bridge/createBridgeOrder.d.ts +1 -1
- package/dist/cjs/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +3 -1
- package/dist/cjs/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +25 -6
- package/dist/cjs/src/hooks/ConnectWallet/TonConnect/contract.d.ts +8 -0
- package/dist/cjs/src/hooks/ConnectWallet/TonConnect/index.d.ts +26 -0
- package/dist/cjs/src/hooks/ConnectWallet/useWalletState.d.ts +28 -0
- package/dist/cjs/src/hooks/Submission/types.d.ts +14 -0
- package/dist/cjs/src/hooks/Submission/useExecution.d.ts +14 -0
- package/dist/cjs/src/hooks/Swap/useFetchFiatPrice.d.ts +1 -1
- package/dist/cjs/src/hooks/Swap/usePriceTimer.d.ts +1 -0
- package/dist/cjs/src/hooks/Token/type.d.ts +1 -0
- package/dist/cjs/src/hooks/Token/useGetTokenStatus.d.ts +2 -1
- package/dist/cjs/src/hooks/Token/useInitTokenList.d.ts +3 -1
- package/dist/cjs/src/hooks/Widget/useInitPropsToRedux.d.ts +1 -1
- package/dist/cjs/src/hooks/contract/abis/OrbiterV3ABI.d.ts +85 -0
- package/dist/cjs/src/hooks/contract/layerswap/constants.d.ts +6 -0
- package/dist/cjs/src/hooks/contract/layerswap/data.d.ts +43 -0
- package/dist/cjs/src/hooks/contract/layerswap/types.d.ts +170 -0
- package/dist/cjs/src/hooks/contract/layerswap/useLayerswapRouters.d.ts +20 -0
- package/dist/cjs/src/hooks/contract/orbiter/constants.d.ts +3 -0
- package/dist/cjs/src/hooks/contract/orbiter/encodeOrbiterBridge.d.ts +12 -0
- package/dist/cjs/src/hooks/contract/orbiter/useOrbiterContractMap.d.ts +5 -0
- package/dist/cjs/src/hooks/contract/orbiter/useOrbiterRouters.d.ts +21 -0
- package/dist/cjs/src/hooks/contract/useFetchTokens.d.ts +1 -2
- package/dist/cjs/src/index.d.ts +2 -0
- package/dist/cjs/src/store/actions/wallet.d.ts +1 -0
- package/dist/cjs/src/store/reducers/wallet.d.ts +1 -0
- package/dist/cjs/src/store/selectors/wallet.d.ts +1 -0
- package/dist/cjs/src/utils/device.d.ts +3 -0
- package/dist/components/Confirm.d.ts +3 -2
- package/dist/components/ConnectWallet/NeedConnectButton.d.ts +1 -3
- package/dist/components/Swap/components/Dialog.d.ts +1 -0
- package/dist/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +2 -1
- package/dist/components/Swap/components/TokenCard/index.d.ts +2 -2
- package/dist/components/Swap/index.d.ts +4 -1
- package/dist/components/TokenLogo.d.ts +3 -1
- package/dist/constants/chains.d.ts +1 -0
- package/dist/{helper-ClCEnCKq.js → helper-CHqZavUq.js} +1 -1
- package/dist/helper-CPPmdUet.js +1 -0
- package/dist/helper-D1mp2p4F.js +1 -0
- package/dist/helper-Dhy5gy1p.js +1 -0
- package/dist/hooks/Submission/types.d.ts +2 -0
- package/dist/hooks/Submission/useExecution.d.ts +2 -1
- package/dist/hooks/Swap/useExecuteSwap.d.ts +2 -1
- package/dist/{index-namICBzO.js → index-0IX6JBNg.js} +1 -1
- package/dist/{index-B3zF3CfE.js → index-BgcusTMt.js} +1 -1
- package/dist/index-BlT57eKb.js +53 -0
- package/dist/index-C-UlcYP8.js +53 -0
- package/dist/index-C4JHklNK.js +12 -0
- package/dist/index-CE6izMXy.js +12 -0
- package/dist/index-CEwSZbo5.js +53 -0
- package/dist/index-CTxzesqs.js +53 -0
- package/dist/index-D0SWY6AZ.js +12 -0
- package/dist/index-Duga8SDh.js +78 -0
- package/dist/index-DxNt17fy.js +78 -0
- package/dist/index-QEEiFrZ2.js +78 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -7
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/{lottie-Cs4m17_U.js → lottie-B77ifW0u.js} +1 -1
- package/dist/lottie-C9cpjlCR.js +1 -0
- package/dist/lottie-CddNDjvd.js +1 -0
- package/dist/lottie-DMZ5X1eY.js +1 -0
- package/dist/providers/GlobalConfigContext.d.ts +6 -2
- package/dist/src/components/Bridge/BridgeSummaryDialog/index.d.ts +1 -1
- package/dist/src/components/Bridge/SelectBridgeDialog/RouteCard.d.ts +2 -2
- package/dist/src/components/Swap/components/ConnectWallet/ConnectWalletDialog.d.ts +2 -1
- package/dist/src/components/Swap/components/ConnectWallet/index.d.ts +2 -1
- package/dist/src/components/Swap/index.d.ts +2 -1
- package/dist/src/components/Widget/BridgeTonSummaryDialog/index.d.ts +11 -0
- package/dist/src/components/Widget/index.d.ts +3 -0
- package/dist/src/constants/chains.d.ts +1 -2
- package/dist/src/constants/tokenList.d.ts +11 -2
- package/dist/src/hooks/Bridge/createBridgeOrder.d.ts +1 -1
- package/dist/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +3 -1
- package/dist/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +25 -6
- package/dist/src/hooks/ConnectWallet/TonConnect/contract.d.ts +8 -0
- package/dist/src/hooks/ConnectWallet/TonConnect/index.d.ts +26 -0
- package/dist/src/hooks/ConnectWallet/useWalletState.d.ts +28 -0
- package/dist/src/hooks/Submission/types.d.ts +14 -0
- package/dist/src/hooks/Submission/useExecution.d.ts +14 -0
- package/dist/src/hooks/Swap/useFetchFiatPrice.d.ts +1 -1
- package/dist/src/hooks/Swap/usePriceTimer.d.ts +1 -0
- package/dist/src/hooks/Token/type.d.ts +1 -0
- package/dist/src/hooks/Token/useGetTokenStatus.d.ts +2 -1
- package/dist/src/hooks/Token/useInitTokenList.d.ts +3 -1
- package/dist/src/hooks/Widget/useInitPropsToRedux.d.ts +1 -1
- package/dist/src/hooks/contract/abis/OrbiterV3ABI.d.ts +85 -0
- package/dist/src/hooks/contract/layerswap/constants.d.ts +6 -0
- package/dist/src/hooks/contract/layerswap/data.d.ts +43 -0
- package/dist/src/hooks/contract/layerswap/types.d.ts +170 -0
- package/dist/src/hooks/contract/layerswap/useLayerswapRouters.d.ts +20 -0
- package/dist/src/hooks/contract/orbiter/constants.d.ts +3 -0
- package/dist/src/hooks/contract/orbiter/encodeOrbiterBridge.d.ts +12 -0
- package/dist/src/hooks/contract/orbiter/useOrbiterContractMap.d.ts +5 -0
- package/dist/src/hooks/contract/orbiter/useOrbiterRouters.d.ts +21 -0
- package/dist/src/hooks/contract/useFetchTokens.d.ts +1 -2
- package/dist/src/index.d.ts +2 -0
- package/dist/src/store/actions/wallet.d.ts +1 -0
- package/dist/src/store/reducers/wallet.d.ts +1 -0
- package/dist/src/store/selectors/wallet.d.ts +1 -0
- package/dist/src/utils/device.d.ts +3 -0
- package/package.json +11 -2
- package/dist/cjs/index-Dyz2QYJX.cjs +0 -53
- package/dist/index-CK3jgZQ5.js +0 -53
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { GraphQLRequests } from '@dodoex/api';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ConfirmProps } from '../components/Confirm';
|
|
4
|
+
import { DialogProps } from '../components/Swap/components/Dialog';
|
|
3
5
|
import { TokenInfo } from '../hooks/Token';
|
|
4
6
|
export interface GlobalFunctionConfig {
|
|
5
7
|
widgetRef?: React.RefObject<HTMLDivElement>;
|
|
@@ -18,9 +20,11 @@ export interface GlobalFunctionConfig {
|
|
|
18
20
|
chainId?: number;
|
|
19
21
|
}) => string;
|
|
20
22
|
graphQLRequests?: GraphQLRequests;
|
|
23
|
+
ConfirmComponent?: React.FunctionComponent<ConfirmProps>;
|
|
24
|
+
DialogComponent?: React.FunctionComponent<DialogProps>;
|
|
21
25
|
}
|
|
22
26
|
export declare const graphQLRequests: GraphQLRequests;
|
|
23
|
-
export declare const GlobalConfigContext:
|
|
27
|
+
export declare const GlobalConfigContext: React.Context<Omit<GlobalFunctionConfig, "graphQLRequests"> & {
|
|
24
28
|
graphQLRequests: GraphQLRequests;
|
|
25
29
|
}>;
|
|
26
30
|
export declare const useGlobalConfig: () => Omit<GlobalFunctionConfig, "graphQLRequests"> & {
|
|
@@ -6,7 +6,7 @@ export interface BridgeTXRequest {
|
|
|
6
6
|
value: string;
|
|
7
7
|
from: string;
|
|
8
8
|
chainId: number;
|
|
9
|
-
encodeId
|
|
9
|
+
encodeId?: string;
|
|
10
10
|
}
|
|
11
11
|
export default function BridgeSummaryDialog({ open, onClose, route, bridgeOrderTxRequest, clearToAmt, clearFromAmt, }: {
|
|
12
12
|
open: boolean;
|
|
@@ -10,12 +10,12 @@ export default function RouteCard({ fromToken, toToken, fromChainId, toChainId,
|
|
|
10
10
|
fromAmount?: BridgeRouteI['fromAmount'];
|
|
11
11
|
fromTokenBalance: BigNumber | null;
|
|
12
12
|
toTokenAmount?: BigNumber | null;
|
|
13
|
-
toolDetails: BridgeRouteI['step']['toolDetails'];
|
|
13
|
+
toolDetails: undefined | Exclude<BridgeRouteI['step'], undefined>['toolDetails'];
|
|
14
14
|
product: BridgeRouteI['product'];
|
|
15
15
|
executionDuration: BridgeRouteI['executionDuration'];
|
|
16
16
|
feeUSD: BridgeRouteI['feeUSD'];
|
|
17
17
|
selected: boolean;
|
|
18
18
|
setSelected: () => void;
|
|
19
|
-
spenderContractAddress: string;
|
|
19
|
+
spenderContractAddress: string | undefined;
|
|
20
20
|
isBestPrice?: boolean;
|
|
21
21
|
}): JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function ConnectWalletDialog({ open, onClose, }: {
|
|
2
|
+
export default function ConnectWalletDialog({ open, onClose, chainId: chainIdProps, }: {
|
|
3
3
|
open: boolean;
|
|
4
4
|
onClose: () => void;
|
|
5
|
+
chainId?: number;
|
|
5
6
|
}): JSX.Element;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { ChainId } from '../../../../constants/chains';
|
|
3
3
|
export interface ConnectWalletProps {
|
|
4
4
|
needSwitchChain?: ChainId;
|
|
5
|
+
needEvmChainId?: ChainId;
|
|
5
6
|
/** If true is returned, the default wallet connection logic will not be executed */
|
|
6
7
|
onConnectWalletClick?: () => boolean | Promise<boolean>;
|
|
7
8
|
}
|
|
8
|
-
export default function ConnectWallet({ needSwitchChain, onConnectWalletClick, }: ConnectWalletProps): JSX.Element;
|
|
9
|
+
export default function ConnectWallet({ needSwitchChain, needEvmChainId, onConnectWalletClick, }: ConnectWalletProps): JSX.Element;
|
|
@@ -5,5 +5,6 @@ export interface SwapProps {
|
|
|
5
5
|
/** Higher priority setting slippage */
|
|
6
6
|
getAutoSlippage?: GetAutoSlippage;
|
|
7
7
|
onConnectWalletClick?: ConnectWalletProps['onConnectWalletClick'];
|
|
8
|
+
bridgeToTonUrl?: string;
|
|
8
9
|
}
|
|
9
|
-
export declare function Swap({ getAutoSlippage, onConnectWalletClick, }?: SwapProps): JSX.Element;
|
|
10
|
+
export declare function Swap({ getAutoSlippage, onConnectWalletClick, bridgeToTonUrl, }?: SwapProps): JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export default function BridgeTonSummaryDialog({ tonAccount, fromTokenAddress, fromChainId, toTokenAddress, toChainId, fromAmt, slippage, redirectLink, }: {
|
|
3
|
+
tonAccount: string;
|
|
4
|
+
fromTokenAddress: string;
|
|
5
|
+
fromChainId: number;
|
|
6
|
+
toTokenAddress: string;
|
|
7
|
+
toChainId: number;
|
|
8
|
+
fromAmt: string;
|
|
9
|
+
slippage?: number;
|
|
10
|
+
redirectLink: string;
|
|
11
|
+
}): JSX.Element;
|
|
@@ -8,7 +8,9 @@ import { ChainId } from '../../constants/chains';
|
|
|
8
8
|
import { DefaultTokenInfo } from '../../hooks/Token/type';
|
|
9
9
|
import { APIServices } from '../../constants/api';
|
|
10
10
|
import { SwapProps } from '../Swap';
|
|
11
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
11
12
|
export declare const WIDGET_CLASS_NAME = "dodo-widget-container";
|
|
13
|
+
export declare const queryClient: QueryClient;
|
|
12
14
|
export interface WidgetProps extends Web3ConnectorsProps, InitTokenListProps, ExecutionProps, SwapProps {
|
|
13
15
|
apikey?: string;
|
|
14
16
|
theme?: ThemeOptions;
|
|
@@ -26,6 +28,7 @@ export interface WidgetProps extends Web3ConnectorsProps, InitTokenListProps, Ex
|
|
|
26
28
|
apiServices?: Partial<APIServices>;
|
|
27
29
|
crossChain?: boolean;
|
|
28
30
|
noPowerBy?: boolean;
|
|
31
|
+
tonConnect?: boolean;
|
|
29
32
|
onProviderChanged?: (provider?: any) => void;
|
|
30
33
|
}
|
|
31
34
|
export declare function Widget(props: PropsWithChildren<WidgetProps>): JSX.Element;
|
|
@@ -2,7 +2,6 @@ export declare enum ChainId {
|
|
|
2
2
|
MAINNET = 1,
|
|
3
3
|
GOERLI = 5,
|
|
4
4
|
BSC = 56,
|
|
5
|
-
SEPOLIA = 11155111,
|
|
6
5
|
POLYGON = 137,
|
|
7
6
|
ARBITRUM_ONE = 42161,
|
|
8
7
|
AURORA = 1313161554,
|
|
@@ -15,7 +14,7 @@ export declare enum ChainId {
|
|
|
15
14
|
SCROLL = 534352,
|
|
16
15
|
MANTA = 169,
|
|
17
16
|
MANTLE = 5000,
|
|
18
|
-
|
|
17
|
+
TON = -239
|
|
19
18
|
}
|
|
20
19
|
export declare const rpcServerMap: {
|
|
21
20
|
[key in ChainId]: Array<string>;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
declare const _default: {
|
|
1
|
+
declare const _default: ({
|
|
2
2
|
chainId: number;
|
|
3
3
|
address: string;
|
|
4
4
|
name: string;
|
|
5
5
|
decimals: number;
|
|
6
6
|
symbol: string;
|
|
7
7
|
logoURI: string;
|
|
8
|
-
|
|
8
|
+
canBridgeToTon?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
chainId: number;
|
|
11
|
+
address: string;
|
|
12
|
+
name: string;
|
|
13
|
+
decimals: number;
|
|
14
|
+
symbol: string;
|
|
15
|
+
logoURI: string;
|
|
16
|
+
canBridgeToTon: boolean;
|
|
17
|
+
})[];
|
|
9
18
|
export default _default;
|
|
@@ -12,7 +12,7 @@ export interface BridgeOrderCreateParams {
|
|
|
12
12
|
hash: string;
|
|
13
13
|
product: string | null;
|
|
14
14
|
extend: {
|
|
15
|
-
lifiBridge: BridgeRouteI['sourceRoute']['step']['tool'];
|
|
15
|
+
lifiBridge: Exclude<BridgeRouteI['sourceRoute'], undefined>['step']['tool'];
|
|
16
16
|
route: BridgeRouteI['sourceRoute'];
|
|
17
17
|
productParams: BridgeRouteI['productParams'];
|
|
18
18
|
encodeId: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BridgeTXRequest } from '../../components/Bridge/BridgeSummaryDialog';
|
|
2
2
|
import { BridgeRouteI } from './useFetchRoutePriceBridge';
|
|
3
|
-
|
|
3
|
+
import { ExecutionCtx } from '../Submission/types';
|
|
4
|
+
export default function useExecuteBridgeRoute({ route, bridgeOrderTxRequest, sendData, }: {
|
|
4
5
|
route?: BridgeRouteI;
|
|
5
6
|
bridgeOrderTxRequest?: BridgeTXRequest;
|
|
7
|
+
sendData?: Parameters<ExecutionCtx['executeCustom']>['0']['handler'];
|
|
6
8
|
}): () => Promise<import("../Submission/types").ExecutionResult> | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TokenInfo } from '../Token';
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
|
+
import { ExecutionCtx } from '../Submission/types';
|
|
3
4
|
export interface BridgeRouteI {
|
|
4
5
|
/** update */
|
|
5
6
|
key: string;
|
|
@@ -17,20 +18,29 @@ export interface BridgeRouteI {
|
|
|
17
18
|
toAddress: string;
|
|
18
19
|
/** from parameter */
|
|
19
20
|
product: string | null;
|
|
20
|
-
slippage
|
|
21
|
+
slippage?: number;
|
|
21
22
|
/** in seconds */
|
|
22
23
|
roundedRouteCostTime: number;
|
|
23
24
|
/** approve contract address */
|
|
24
|
-
spenderContractAddress
|
|
25
|
+
spenderContractAddress?: string;
|
|
25
26
|
/** USD */
|
|
26
27
|
feeUSD: string | null;
|
|
27
28
|
/** in seconds */
|
|
28
29
|
executionDuration: number | null;
|
|
29
30
|
/** one-click */
|
|
30
31
|
step: BridgeStep;
|
|
31
|
-
encodeParams
|
|
32
|
+
encodeParams?: any;
|
|
33
|
+
encodeResultData?: {
|
|
34
|
+
data: string;
|
|
35
|
+
to: string;
|
|
36
|
+
value: string;
|
|
37
|
+
from: string;
|
|
38
|
+
chainId: number;
|
|
39
|
+
encodeId?: string;
|
|
40
|
+
};
|
|
41
|
+
sendData?: Parameters<ExecutionCtx['executeCustom']>['0']['handler'];
|
|
32
42
|
productParams: any;
|
|
33
|
-
sourceRoute
|
|
43
|
+
sourceRoute?: {
|
|
34
44
|
toAmount: string;
|
|
35
45
|
feeUSD: string | null;
|
|
36
46
|
executionDuration: number | null;
|
|
@@ -47,6 +57,8 @@ export interface BridgeRouteI {
|
|
|
47
57
|
};
|
|
48
58
|
fee: any;
|
|
49
59
|
};
|
|
60
|
+
minAmt?: string;
|
|
61
|
+
maxAmt?: string;
|
|
50
62
|
}
|
|
51
63
|
export interface BridgeTokenI {
|
|
52
64
|
id: number;
|
|
@@ -73,7 +85,7 @@ export interface BridgeStep {
|
|
|
73
85
|
tool: string;
|
|
74
86
|
toolDetails: BridgeStepTool;
|
|
75
87
|
type: string | null;
|
|
76
|
-
includedSteps
|
|
88
|
+
includedSteps?: Array<{
|
|
77
89
|
id: string;
|
|
78
90
|
/**
|
|
79
91
|
* bridge or swap
|
|
@@ -94,9 +106,16 @@ export interface FetchRoutePrice {
|
|
|
94
106
|
fromToken: TokenInfo | null;
|
|
95
107
|
toToken: TokenInfo | null;
|
|
96
108
|
fromAmount: string;
|
|
109
|
+
fromFiatPrice: string;
|
|
110
|
+
fromAddress?: string;
|
|
111
|
+
toAddress?: string;
|
|
97
112
|
}
|
|
98
|
-
export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, }: FetchRoutePrice): {
|
|
113
|
+
export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, fromFiatPrice, fromAddress: fromAddressProps, toAddress: toAddressProps, }: FetchRoutePrice): {
|
|
99
114
|
status: RoutePriceStatus;
|
|
100
115
|
refetch: () => Promise<void>;
|
|
101
116
|
bridgeRouteList: BridgeRouteI[];
|
|
117
|
+
limit: {
|
|
118
|
+
minAmt?: number | undefined;
|
|
119
|
+
maxAmt?: number | undefined;
|
|
120
|
+
} | null;
|
|
102
121
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TonClient, Transaction } from 'ton';
|
|
2
|
+
export declare function getHashByBoc(boc: string): string;
|
|
3
|
+
export declare const waitForTransaction: (options: {
|
|
4
|
+
boc: string;
|
|
5
|
+
refetchInterval?: number;
|
|
6
|
+
refetchLimit?: number;
|
|
7
|
+
address: string;
|
|
8
|
+
}, client: TonClient) => Promise<Transaction | null>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TonConnectUI } from '@tonconnect/ui';
|
|
2
|
+
import { TonClient, TonClient4 } from 'ton';
|
|
3
|
+
import BigNumber from 'bignumber.js';
|
|
4
|
+
/**
|
|
5
|
+
* https://ton-community.github.io/ton/modules.html
|
|
6
|
+
* https://ton-org.github.io/ton-core/modules.html
|
|
7
|
+
* https://toncenter.com/api/v2/
|
|
8
|
+
*/
|
|
9
|
+
interface TonConnectState {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
client?: TonClient;
|
|
12
|
+
clientV4?: TonClient4;
|
|
13
|
+
tonConnectUI?: TonConnectUI;
|
|
14
|
+
connected?: {
|
|
15
|
+
chainId: number;
|
|
16
|
+
account: string;
|
|
17
|
+
};
|
|
18
|
+
initialize: () => void;
|
|
19
|
+
connect: () => Promise<void>;
|
|
20
|
+
getBlockNumber: () => Promise<number>;
|
|
21
|
+
getJettonWallet: (jettonMasterAddress: string) => Promise<string>;
|
|
22
|
+
getBalance: (account: string) => Promise<BigNumber>;
|
|
23
|
+
getTokenBalance: (jettonMasterAddress: string, decimals: number) => Promise<BigNumber>;
|
|
24
|
+
}
|
|
25
|
+
declare const useTonConnectStore: import("zustand").UseBoundStore<import("zustand").StoreApi<TonConnectState>>;
|
|
26
|
+
export default useTonConnectStore;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
export declare function useWalletState({ isTon, }?: {
|
|
3
|
+
isTon?: boolean;
|
|
4
|
+
}): {
|
|
5
|
+
isTon: boolean;
|
|
6
|
+
chainId: number | undefined;
|
|
7
|
+
account: string | undefined;
|
|
8
|
+
tonAccount: string | undefined;
|
|
9
|
+
evmAccount: string | undefined;
|
|
10
|
+
isMetamask: boolean;
|
|
11
|
+
autoConnect: (chainId?: number) => Promise<void>;
|
|
12
|
+
connect: () => Promise<void>;
|
|
13
|
+
getLastBlockNumber: () => Promise<number>;
|
|
14
|
+
getBalance: (account: string) => Promise<BigNumber>;
|
|
15
|
+
provider?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
isTon: boolean;
|
|
18
|
+
chainId: number | undefined;
|
|
19
|
+
account: string | undefined;
|
|
20
|
+
tonAccount: string | undefined;
|
|
21
|
+
evmAccount: string | undefined;
|
|
22
|
+
isMetamask: boolean | undefined;
|
|
23
|
+
autoConnect: (chainId?: number) => Promise<void>;
|
|
24
|
+
connect: () => void | Promise<void>;
|
|
25
|
+
provider: import("@ethersproject/providers").Web3Provider | undefined;
|
|
26
|
+
getLastBlockNumber: () => Promise<number | undefined>;
|
|
27
|
+
getBalance: ((account: string) => Promise<BigNumber | undefined>) | undefined;
|
|
28
|
+
};
|
|
@@ -37,6 +37,20 @@ export declare type ExecutionCtx = {
|
|
|
37
37
|
* @param submittedConfirmBack: dismiss callback
|
|
38
38
|
*/
|
|
39
39
|
execute: (brief: string, spec: StepSpec, subtitle?: string | React.ReactNode | null, early?: boolean, submittedBack?: () => void, mixpanelProps?: Record<string, any>, submittedConfirmBack?: () => void, successBack?: (tx: string, callback?: ExecutionProps['onTxSuccess']) => void) => Promise<ExecutionResult>;
|
|
40
|
+
executeCustom: ({ brief, subtitle, early, mixpanelProps, submittedBack, submittedConfirmBack, successBack, handler, }: {
|
|
41
|
+
brief: string;
|
|
42
|
+
subtitle?: string | React.ReactNode | null;
|
|
43
|
+
early?: boolean | undefined;
|
|
44
|
+
mixpanelProps?: Record<string, any> | undefined;
|
|
45
|
+
submittedBack?: (() => void) | undefined;
|
|
46
|
+
submittedConfirmBack?: (() => void) | undefined;
|
|
47
|
+
successBack?: ((tx: string, callback?: ExecutionProps['onTxSuccess']) => void) | undefined;
|
|
48
|
+
handler: (params: {
|
|
49
|
+
onSubmit?: (tx: string, reportInfo?: Record<string, any>) => void;
|
|
50
|
+
onSuccess?: (tx: string, reportInfo?: Record<string, any>) => Promise<void>;
|
|
51
|
+
onError?: (e: any) => void;
|
|
52
|
+
}) => Promise<any>;
|
|
53
|
+
}) => Promise<ExecutionResult>;
|
|
40
54
|
/**
|
|
41
55
|
* order
|
|
42
56
|
*/
|
|
@@ -23,6 +23,20 @@ export default function useExecution({ onTxFail, onTxSubmit, onTxSuccess, }?: Ex
|
|
|
23
23
|
closeShowing: () => void;
|
|
24
24
|
ctxVal: {
|
|
25
25
|
execute: (brief: string, spec: StepSpec, subtitle?: string | React.ReactNode | null, early?: boolean, submittedBack?: () => void, mixpanelProps?: Record<string, any>, submittedConfirmBack?: () => void, successBack?: ((tx: string, callback?: ExecutionProps['onTxSuccess']) => void) | undefined) => Promise<ExecutionResult.Failed | ExecutionResult.Success | ExecutionResult.Submitted>;
|
|
26
|
+
executeCustom: ({ brief, subtitle, early, mixpanelProps, submittedBack, submittedConfirmBack, successBack, handler, }: {
|
|
27
|
+
brief: string;
|
|
28
|
+
subtitle?: string | React.ReactNode | null;
|
|
29
|
+
early?: boolean | undefined;
|
|
30
|
+
mixpanelProps?: Record<string, any> | undefined;
|
|
31
|
+
submittedBack?: (() => void) | undefined;
|
|
32
|
+
submittedConfirmBack?: (() => void) | undefined;
|
|
33
|
+
successBack?: ((tx: string, callback?: ExecutionProps['onTxSuccess']) => void) | undefined;
|
|
34
|
+
handler: (params: {
|
|
35
|
+
onSubmit?: ((tx: string, reportInfo?: Record<string, any>) => void) | undefined;
|
|
36
|
+
onSuccess?: ((tx: string, reportInfo?: Record<string, any>) => Promise<void>) | undefined;
|
|
37
|
+
onError?: ((e: any) => void) | undefined;
|
|
38
|
+
}) => Promise<any>;
|
|
39
|
+
}) => Promise<ExecutionResult>;
|
|
26
40
|
requests: Map<string, [Request, State]>;
|
|
27
41
|
setShowing: import("react").Dispatch<import("react").SetStateAction<Showing | null>>;
|
|
28
42
|
waitingSubmit: boolean;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { TokenInfo, ApprovalState } from './type';
|
|
3
|
-
export declare const useGetTokenStatus: ({ account, chainId, offset, contractAddress, }: {
|
|
3
|
+
export declare const useGetTokenStatus: ({ account, chainId, offset, contractAddress, skip, }: {
|
|
4
4
|
account?: string | undefined;
|
|
5
5
|
chainId: number | undefined;
|
|
6
6
|
offset?: BigNumber | undefined;
|
|
7
7
|
contractAddress?: string | undefined;
|
|
8
|
+
skip?: boolean | undefined;
|
|
8
9
|
}) => {
|
|
9
10
|
getApprovalState: (token: TokenInfo | null, value: string | number | BigNumber, overrideBalance?: BigNumber) => ApprovalState;
|
|
10
11
|
getPendingRest: (token?: TokenInfo | null) => boolean;
|
|
@@ -3,4 +3,6 @@ export interface InitTokenListProps {
|
|
|
3
3
|
tokenList?: TokenList | TokenListType;
|
|
4
4
|
popularTokenList?: TokenList;
|
|
5
5
|
}
|
|
6
|
-
export default function useInitTokenList({ tokenList, popularTokenList, }: InitTokenListProps
|
|
6
|
+
export default function useInitTokenList({ tokenList, popularTokenList, isTon, }: InitTokenListProps & {
|
|
7
|
+
isTon: boolean;
|
|
8
|
+
}): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { WidgetProps } from '../../components/Widget/';
|
|
2
|
-
export declare function useInitPropsToRedux({ width, height, feeRate, rebateTo, colorMode, apikey, defaultChainId, defaultToToken, defaultFromToken, jsonRpcUrlMap, swapSlippage, bridgeSlippage, apiServices, crossChain, noPowerBy, }: WidgetProps): void;
|
|
2
|
+
export declare function useInitPropsToRedux({ width, height, feeRate, rebateTo, colorMode, apikey, defaultChainId, defaultToToken, defaultFromToken, jsonRpcUrlMap, swapSlippage, bridgeSlippage, apiServices, crossChain, noPowerBy, tonConnect, }: WidgetProps): void;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
declare const Orbiter_V3_ABI_EVM: ({
|
|
2
|
+
anonymous: boolean;
|
|
3
|
+
inputs: {
|
|
4
|
+
indexed: boolean;
|
|
5
|
+
internalType: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
}[];
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
outputs?: undefined;
|
|
12
|
+
stateMutability?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
inputs: {
|
|
15
|
+
internalType: string;
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
}[];
|
|
19
|
+
name: string;
|
|
20
|
+
outputs: never[];
|
|
21
|
+
stateMutability: string;
|
|
22
|
+
type: string;
|
|
23
|
+
anonymous?: undefined;
|
|
24
|
+
})[];
|
|
25
|
+
declare const Orbiter_V3_ABI_STARKNET_GOERLI: ({
|
|
26
|
+
members: {
|
|
27
|
+
name: string;
|
|
28
|
+
offset: number;
|
|
29
|
+
type: string;
|
|
30
|
+
}[];
|
|
31
|
+
name: string;
|
|
32
|
+
size: number;
|
|
33
|
+
type: string;
|
|
34
|
+
inputs?: undefined;
|
|
35
|
+
outputs?: undefined;
|
|
36
|
+
} | {
|
|
37
|
+
inputs: {
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
}[];
|
|
41
|
+
name: string;
|
|
42
|
+
outputs: never[];
|
|
43
|
+
type: string;
|
|
44
|
+
members?: undefined;
|
|
45
|
+
size?: undefined;
|
|
46
|
+
})[];
|
|
47
|
+
declare const Orbiter_V3_ABI_STARKNET: ({
|
|
48
|
+
members: {
|
|
49
|
+
name: string;
|
|
50
|
+
offset: number;
|
|
51
|
+
type: string;
|
|
52
|
+
}[];
|
|
53
|
+
name: string;
|
|
54
|
+
size: number;
|
|
55
|
+
type: string;
|
|
56
|
+
data?: undefined;
|
|
57
|
+
keys?: undefined;
|
|
58
|
+
inputs?: undefined;
|
|
59
|
+
outputs?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
data: {
|
|
62
|
+
name: string;
|
|
63
|
+
type: string;
|
|
64
|
+
}[];
|
|
65
|
+
keys: never[];
|
|
66
|
+
name: string;
|
|
67
|
+
type: string;
|
|
68
|
+
members?: undefined;
|
|
69
|
+
size?: undefined;
|
|
70
|
+
inputs?: undefined;
|
|
71
|
+
outputs?: undefined;
|
|
72
|
+
} | {
|
|
73
|
+
inputs: {
|
|
74
|
+
name: string;
|
|
75
|
+
type: string;
|
|
76
|
+
}[];
|
|
77
|
+
name: string;
|
|
78
|
+
outputs: never[];
|
|
79
|
+
type: string;
|
|
80
|
+
members?: undefined;
|
|
81
|
+
size?: undefined;
|
|
82
|
+
data?: undefined;
|
|
83
|
+
keys?: undefined;
|
|
84
|
+
})[];
|
|
85
|
+
export { Orbiter_V3_ABI_EVM, Orbiter_V3_ABI_STARKNET, Orbiter_V3_ABI_STARKNET_GOERLI, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const LAYERSWAP_URL = "https://api.layerswap.io/api/v2";
|
|
2
|
+
export declare const LAYERSWAP_API_KEY = "gNiGVhOddxMmWk4LFCR/5tDsdTECWCRlQBcW6yV8l+paqSVJBUth0wDXqA0jC16cv+Pz54+YeeKo54ioiR4n9Q";
|
|
3
|
+
export declare const LAYERSWAP_NETWORKS_URL: string;
|
|
4
|
+
export declare const LAYERSWAP_LIMITS_URL: string;
|
|
5
|
+
export declare const LAYERSWAP_QUOTE_URL: string;
|
|
6
|
+
export declare const LAYERSWAP_SWAPS_URL: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Web3Provider } from '@ethersproject/providers';
|
|
2
|
+
import { TokenInfo } from '../../Token';
|
|
3
|
+
import { Network, Quote } from './types';
|
|
4
|
+
export declare function getLayerSwapData<T>(url: string): Promise<T>;
|
|
5
|
+
export declare function getNetworks(): Promise<Network[]>;
|
|
6
|
+
export declare function getLimits({ fromToken, toToken, fromNetworkName, toNetworkName, }: {
|
|
7
|
+
fromToken: TokenInfo | null;
|
|
8
|
+
toToken: TokenInfo | null;
|
|
9
|
+
fromNetworkName: string | undefined | null;
|
|
10
|
+
toNetworkName: string | undefined | null;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
min_amount_in_usd: number;
|
|
13
|
+
min_amount: number;
|
|
14
|
+
max_amount_in_usd: number;
|
|
15
|
+
max_amount: number;
|
|
16
|
+
} | undefined>;
|
|
17
|
+
export declare function getQuote({ fromToken, toToken, fromNetworkName, toNetworkName, slippage, fromAmount, }: {
|
|
18
|
+
fromToken: TokenInfo | null;
|
|
19
|
+
toToken: TokenInfo | null;
|
|
20
|
+
fromNetworkName: string | undefined | null;
|
|
21
|
+
toNetworkName: string | undefined | null;
|
|
22
|
+
slippage?: number;
|
|
23
|
+
fromAmount: string;
|
|
24
|
+
}): Promise<Quote | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* @see https://github.com/layerswap/layerswapapp/blob/dev/components/Swap/Withdraw/Wallet/TonWalletWithdraw.tsx
|
|
27
|
+
*/
|
|
28
|
+
export declare function submitTonWalletWithdraw({ fromAddress, toAddress, fromToken, toToken, fromNetworkName, toNetworkName, fromAmount, slippage, provider, params, }: {
|
|
29
|
+
fromAddress: string | undefined;
|
|
30
|
+
toAddress: string | undefined;
|
|
31
|
+
fromToken: TokenInfo | null;
|
|
32
|
+
toToken: TokenInfo | null;
|
|
33
|
+
fromNetworkName: string | undefined | null;
|
|
34
|
+
toNetworkName: string | undefined | null;
|
|
35
|
+
fromAmount: string;
|
|
36
|
+
slippage?: number;
|
|
37
|
+
provider?: Web3Provider;
|
|
38
|
+
params: {
|
|
39
|
+
onSubmit?: (tx: string, reportInfo?: Record<string, any>) => void;
|
|
40
|
+
onSuccess?: (tx: string, reportInfo?: Record<string, any>) => Promise<void>;
|
|
41
|
+
onError?: (e: any) => void;
|
|
42
|
+
};
|
|
43
|
+
}): Promise<import("ton").Transaction | import("@ethersproject/abstract-provider").TransactionReceipt | null | undefined>;
|