@dodoex/widgets 3.0.0-beta.34 → 3.0.0-beta.35
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/cjs/helper-BYlVZIoD.cjs +1 -0
- package/dist/cjs/index-BfpsZhht.cjs +53 -0
- package/dist/cjs/index-D7H_RrAc.cjs +12 -0
- package/dist/cjs/index-z-Q7UNom.cjs +78 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/lottie-BpUuS5q9.cjs +1 -0
- 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 -2
- 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/hooks/Bridge/useExecuteBridgeRoute.d.ts +3 -1
- package/dist/cjs/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +9 -1
- package/dist/cjs/src/hooks/ConnectWallet/TonConnect/contract.d.ts +8 -0
- package/dist/cjs/src/hooks/ConnectWallet/useWalletState.d.ts +5 -1
- 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/useGetTokenStatus.d.ts +2 -1
- 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/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/helper-BPAb-D4D.js +1 -0
- package/dist/index-BIQtzxL9.js +78 -0
- package/dist/index-Bbuw1I9-.js +12 -0
- package/dist/index-C-2UnSDv.js +53 -0
- package/dist/index.js +1 -1
- package/dist/lottie-DLUL4WjE.js +1 -0
- package/dist/src/components/Swap/components/ConnectWallet/ConnectWalletDialog.d.ts +2 -1
- package/dist/src/components/Swap/components/ConnectWallet/index.d.ts +2 -2
- package/dist/src/components/Swap/index.d.ts +2 -1
- package/dist/src/components/Widget/BridgeTonSummaryDialog/index.d.ts +11 -0
- package/dist/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +3 -1
- package/dist/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +9 -1
- package/dist/src/hooks/ConnectWallet/TonConnect/contract.d.ts +8 -0
- package/dist/src/hooks/ConnectWallet/useWalletState.d.ts +5 -1
- 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/useGetTokenStatus.d.ts +2 -1
- 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/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 +2 -2
|
@@ -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,8 +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
|
-
needConnectTwoWallet?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export default function ConnectWallet({ needSwitchChain,
|
|
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;
|
|
@@ -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;
|
|
@@ -37,6 +38,7 @@ export interface BridgeRouteI {
|
|
|
37
38
|
chainId: number;
|
|
38
39
|
encodeId?: string;
|
|
39
40
|
};
|
|
41
|
+
sendData?: Parameters<ExecutionCtx['executeCustom']>['0']['handler'];
|
|
40
42
|
productParams: any;
|
|
41
43
|
sourceRoute?: {
|
|
42
44
|
toAmount: string;
|
|
@@ -105,9 +107,15 @@ export interface FetchRoutePrice {
|
|
|
105
107
|
toToken: TokenInfo | null;
|
|
106
108
|
fromAmount: string;
|
|
107
109
|
fromFiatPrice: string;
|
|
110
|
+
fromAddress?: string;
|
|
111
|
+
toAddress?: string;
|
|
108
112
|
}
|
|
109
|
-
export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, fromFiatPrice, }: FetchRoutePrice): {
|
|
113
|
+
export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, fromFiatPrice, fromAddress: fromAddressProps, toAddress: toAddressProps, }: FetchRoutePrice): {
|
|
110
114
|
status: RoutePriceStatus;
|
|
111
115
|
refetch: () => Promise<void>;
|
|
112
116
|
bridgeRouteList: BridgeRouteI[];
|
|
117
|
+
limit: {
|
|
118
|
+
minAmt?: number | undefined;
|
|
119
|
+
maxAmt?: number | undefined;
|
|
120
|
+
} | null;
|
|
113
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>;
|
|
@@ -5,6 +5,8 @@ export declare function useWalletState({ isTon, }?: {
|
|
|
5
5
|
isTon: boolean;
|
|
6
6
|
chainId: number | undefined;
|
|
7
7
|
account: string | undefined;
|
|
8
|
+
tonAccount: string | undefined;
|
|
9
|
+
evmAccount: string | undefined;
|
|
8
10
|
isMetamask: boolean;
|
|
9
11
|
autoConnect: (chainId?: number) => Promise<void>;
|
|
10
12
|
connect: () => Promise<void>;
|
|
@@ -15,10 +17,12 @@ export declare function useWalletState({ isTon, }?: {
|
|
|
15
17
|
isTon: boolean;
|
|
16
18
|
chainId: number | undefined;
|
|
17
19
|
account: string | undefined;
|
|
20
|
+
tonAccount: string | undefined;
|
|
21
|
+
evmAccount: string | undefined;
|
|
18
22
|
isMetamask: boolean | undefined;
|
|
19
23
|
autoConnect: (chainId?: number) => Promise<void>;
|
|
20
24
|
connect: () => void | Promise<void>;
|
|
21
25
|
provider: import("@ethersproject/providers").Web3Provider | undefined;
|
|
22
|
-
getLastBlockNumber: (
|
|
26
|
+
getLastBlockNumber: () => Promise<number | undefined>;
|
|
23
27
|
getBalance: ((account: string) => Promise<BigNumber | undefined>) | undefined;
|
|
24
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;
|
|
@@ -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>;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
export declare enum NetworkType {
|
|
2
|
+
EVM = "evm",
|
|
3
|
+
Starknet = "starknet",
|
|
4
|
+
Solana = "solana",
|
|
5
|
+
Cosmos = "cosmos",
|
|
6
|
+
StarkEx = "starkex",
|
|
7
|
+
ZkSyncLite = "zksynclite",
|
|
8
|
+
TON = "ton"
|
|
9
|
+
}
|
|
10
|
+
export interface Token {
|
|
11
|
+
symbol: string;
|
|
12
|
+
logo: string;
|
|
13
|
+
contract: string | null | undefined;
|
|
14
|
+
decimals: number;
|
|
15
|
+
price_in_usd: number;
|
|
16
|
+
precision: number;
|
|
17
|
+
listing_date: string;
|
|
18
|
+
status?: 'active' | 'inactive' | 'not_found';
|
|
19
|
+
}
|
|
20
|
+
export interface Metadata {
|
|
21
|
+
evm_oracle_contract?: `0x${string}` | null;
|
|
22
|
+
evm_multicall_contract?: string | null;
|
|
23
|
+
listing_date: string;
|
|
24
|
+
}
|
|
25
|
+
export interface Network {
|
|
26
|
+
name: string;
|
|
27
|
+
display_name: string;
|
|
28
|
+
logo: string;
|
|
29
|
+
chain_id: string | null;
|
|
30
|
+
node_url: string;
|
|
31
|
+
type: NetworkType;
|
|
32
|
+
transaction_explorer_template: string;
|
|
33
|
+
account_explorer_template: string;
|
|
34
|
+
metadata: Metadata;
|
|
35
|
+
deposit_methods: string[];
|
|
36
|
+
token?: Token;
|
|
37
|
+
}
|
|
38
|
+
export interface Exchange {
|
|
39
|
+
display_name: string;
|
|
40
|
+
name: string;
|
|
41
|
+
logo: string;
|
|
42
|
+
token_groups: ExchangeToken[];
|
|
43
|
+
metadata: {
|
|
44
|
+
o_auth: {
|
|
45
|
+
connect_url: string;
|
|
46
|
+
authorize_url: string;
|
|
47
|
+
} | null;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface ExchangeNetwork {
|
|
51
|
+
token: Token;
|
|
52
|
+
network: Network;
|
|
53
|
+
fee: {
|
|
54
|
+
total_fee: number;
|
|
55
|
+
total_fee_in_usd: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface ExchangeToken {
|
|
59
|
+
symbol: string;
|
|
60
|
+
logo: string;
|
|
61
|
+
status: 'active' | 'inactive' | 'not_found';
|
|
62
|
+
}
|
|
63
|
+
export declare enum SwapStatus {
|
|
64
|
+
Created = "created",
|
|
65
|
+
UserTransferPending = "user_transfer_pending",
|
|
66
|
+
UserTransferDelayed = "user_transfer_delayed",
|
|
67
|
+
LsTransferPending = "ls_transfer_pending",
|
|
68
|
+
Completed = "completed",
|
|
69
|
+
Failed = "failed",
|
|
70
|
+
Expired = "expired",
|
|
71
|
+
Cancelled = "cancelled"
|
|
72
|
+
}
|
|
73
|
+
export declare enum TransactionType {
|
|
74
|
+
Input = "input",
|
|
75
|
+
Output = "output",
|
|
76
|
+
Refuel = "refuel"
|
|
77
|
+
}
|
|
78
|
+
export declare enum BackendTransactionStatus {
|
|
79
|
+
Completed = "completed",
|
|
80
|
+
Failed = "failed",
|
|
81
|
+
Initiated = "initiated",
|
|
82
|
+
Pending = "pending"
|
|
83
|
+
}
|
|
84
|
+
export declare type Transaction = {
|
|
85
|
+
type: TransactionType;
|
|
86
|
+
from: string;
|
|
87
|
+
to: string;
|
|
88
|
+
created_date: string;
|
|
89
|
+
amount: number;
|
|
90
|
+
transaction_hash: string;
|
|
91
|
+
confirmations: number;
|
|
92
|
+
max_confirmations: number;
|
|
93
|
+
usd_value: number;
|
|
94
|
+
usd_price: number;
|
|
95
|
+
status: BackendTransactionStatus;
|
|
96
|
+
timestamp?: string;
|
|
97
|
+
};
|
|
98
|
+
export declare type SwapItem = {
|
|
99
|
+
id: string;
|
|
100
|
+
created_date: string;
|
|
101
|
+
source_network: Network;
|
|
102
|
+
source_token: Token;
|
|
103
|
+
source_exchange?: Exchange;
|
|
104
|
+
destination_network: Network;
|
|
105
|
+
destination_token: Token;
|
|
106
|
+
destination_exchange?: Exchange;
|
|
107
|
+
status: SwapStatus;
|
|
108
|
+
source_address: `0x${string}`;
|
|
109
|
+
destination_address: `0x${string}`;
|
|
110
|
+
requested_amount: number;
|
|
111
|
+
use_deposit_address: boolean;
|
|
112
|
+
transactions: Transaction[];
|
|
113
|
+
exchange_account_connected: boolean;
|
|
114
|
+
exchange_account_name?: string;
|
|
115
|
+
fail_reason?: string;
|
|
116
|
+
metadata: {
|
|
117
|
+
reference_id: string | null;
|
|
118
|
+
app: string | null;
|
|
119
|
+
sequence_number: number;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
export declare type SwapQuote = {
|
|
123
|
+
source_network?: Network;
|
|
124
|
+
source_token?: Token;
|
|
125
|
+
destination_network?: Network;
|
|
126
|
+
destination_token?: Token;
|
|
127
|
+
receive_amount: number;
|
|
128
|
+
min_receive_amount: number;
|
|
129
|
+
total_fee: number;
|
|
130
|
+
total_fee_in_usd: number;
|
|
131
|
+
blockchain_fee: number;
|
|
132
|
+
service_fee: number;
|
|
133
|
+
avg_completion_time: string;
|
|
134
|
+
refuel_in_source?: number;
|
|
135
|
+
slippage?: number;
|
|
136
|
+
};
|
|
137
|
+
export declare type Refuel = {
|
|
138
|
+
network: Network;
|
|
139
|
+
token: Token;
|
|
140
|
+
amount: number;
|
|
141
|
+
amount_in_usd: number;
|
|
142
|
+
};
|
|
143
|
+
export declare type SwapResponse = {
|
|
144
|
+
swap: SwapItem;
|
|
145
|
+
quote: SwapQuote;
|
|
146
|
+
refuel?: Refuel;
|
|
147
|
+
};
|
|
148
|
+
export declare type DepositAction = {
|
|
149
|
+
amount: number;
|
|
150
|
+
amount_in_base_units: string;
|
|
151
|
+
call_data: `0x${string}` | string;
|
|
152
|
+
fee: any | null;
|
|
153
|
+
network: Network;
|
|
154
|
+
order: number;
|
|
155
|
+
to_address?: `0x${string}`;
|
|
156
|
+
token: Token;
|
|
157
|
+
fee_token: Token;
|
|
158
|
+
type: 'transfer' | 'manual_transfer';
|
|
159
|
+
};
|
|
160
|
+
export declare type QuoteReward = {
|
|
161
|
+
amount: number;
|
|
162
|
+
amount_in_usd: number;
|
|
163
|
+
token: Token;
|
|
164
|
+
network: Network;
|
|
165
|
+
};
|
|
166
|
+
export declare type Quote = {
|
|
167
|
+
quote: SwapQuote;
|
|
168
|
+
refuel: Refuel;
|
|
169
|
+
reward: QuoteReward;
|
|
170
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BridgeRouteI, RoutePriceStatus } from '../../Bridge/useFetchRoutePriceBridge';
|
|
2
|
+
import { TokenInfo } from '../../Token';
|
|
3
|
+
export declare function useLayerswapRouters({ skip, data: { fromToken, toToken, fromAmount, fromAddress, toAddress, slippage }, }: {
|
|
4
|
+
skip?: boolean;
|
|
5
|
+
data: {
|
|
6
|
+
fromToken: TokenInfo | null;
|
|
7
|
+
toToken: TokenInfo | null;
|
|
8
|
+
fromAmount: string;
|
|
9
|
+
fromAddress: string | undefined;
|
|
10
|
+
toAddress: string | undefined;
|
|
11
|
+
slippage?: number;
|
|
12
|
+
};
|
|
13
|
+
}): {
|
|
14
|
+
status: RoutePriceStatus;
|
|
15
|
+
router: BridgeRouteI | null;
|
|
16
|
+
limit: {
|
|
17
|
+
minAmt: number;
|
|
18
|
+
maxAmt: number;
|
|
19
|
+
} | null;
|
|
20
|
+
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
import { WidgetProps } from './components/Widget';
|
|
3
3
|
export declare type SwapWidgetProps = WidgetProps;
|
|
4
4
|
export type { TokenInfo } from './hooks/Token/type';
|
|
5
|
+
export { default as BridgeTonSummaryDialog } from './components/Widget/BridgeTonSummaryDialog';
|
|
6
|
+
export { Widget } from './components/Widget';
|
|
5
7
|
export declare function SwapWidget(props: SwapWidgetProps): JSX.Element;
|
|
6
8
|
export declare function InitSwapWidget(props: SwapWidgetProps): void;
|
|
@@ -2,4 +2,5 @@ import { AppThunkAction } from '.';
|
|
|
2
2
|
import { ChainId } from '../../constants/chains';
|
|
3
3
|
export declare const setDefaultChainId: (chainId: ChainId) => AppThunkAction;
|
|
4
4
|
export declare const setFromTokenChainId: (chainId: ChainId | undefined) => AppThunkAction;
|
|
5
|
+
export declare const setToTokenChainId: (chainId: ChainId | undefined) => AppThunkAction;
|
|
5
6
|
export declare const setBlockNumber: (blockNumber: number) => AppThunkAction;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../reducers';
|
|
2
2
|
export declare const getDefaultChainId: (state?: RootState) => import("../../constants/chains").ChainId;
|
|
3
3
|
export declare const getFromTokenChainId: (state?: RootState) => import("../../constants/chains").ChainId | undefined;
|
|
4
|
+
export declare const getToTokenChainId: (state?: RootState) => import("../../constants/chains").ChainId | undefined;
|
|
4
5
|
export declare const getLatestBlockNumber: (state?: RootState) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dodoex/widgets",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.35",
|
|
4
4
|
"description": "DODO Widgets",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@babel/runtime": "^7.17.0",
|
|
60
|
-
"@dodoex/api": ">=3.0.0-beta.
|
|
60
|
+
"@dodoex/api": ">=3.0.0-beta.4",
|
|
61
61
|
"@dodoex/components": ">=3.0.0-beta.0",
|
|
62
62
|
"@dodoex/icons": "^2.0.1",
|
|
63
63
|
"@emotion/react": "^11.10.0",
|