@dodoex/widgets 2.6.12-beta.0 → 2.6.12-beta.3
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/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-CVLls_ja.cjs +53 -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-DHOGwVb_.cjs} +1 -1
- 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/index.d.ts +2 -1
- 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/useFetchRoutePriceBridge.d.ts +17 -6
- package/dist/cjs/src/hooks/ConnectWallet/TonConnect/index.d.ts +26 -0
- package/dist/cjs/src/hooks/ConnectWallet/useWalletState.d.ts +24 -0
- package/dist/cjs/src/hooks/Token/type.d.ts +1 -0
- 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/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/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-CPPmdUet.js} +1 -1
- 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-C-UlcYP8.js +53 -0
- package/dist/{index-namICBzO.js → index-C4JHklNK.js} +1 -1
- package/dist/{index-B3zF3CfE.js → index-QEEiFrZ2.js} +1 -1
- 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-CddNDjvd.js} +1 -1
- 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/index.d.ts +2 -1
- 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/useFetchRoutePriceBridge.d.ts +17 -6
- package/dist/src/hooks/ConnectWallet/TonConnect/index.d.ts +26 -0
- package/dist/src/hooks/ConnectWallet/useWalletState.d.ts +24 -0
- package/dist/src/hooks/Token/type.d.ts +1 -0
- 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/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/package.json +10 -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;
|
|
@@ -4,5 +4,6 @@ export interface ConnectWalletProps {
|
|
|
4
4
|
needSwitchChain?: ChainId;
|
|
5
5
|
/** If true is returned, the default wallet connection logic will not be executed */
|
|
6
6
|
onConnectWalletClick?: () => boolean | Promise<boolean>;
|
|
7
|
+
needConnectTwoWallet?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export default function ConnectWallet({ needSwitchChain, onConnectWalletClick, }: ConnectWalletProps): JSX.Element;
|
|
9
|
+
export default function ConnectWallet({ needSwitchChain, onConnectWalletClick, needConnectTwoWallet, }: ConnectWalletProps): 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;
|
|
@@ -17,20 +17,28 @@ export interface BridgeRouteI {
|
|
|
17
17
|
toAddress: string;
|
|
18
18
|
/** from parameter */
|
|
19
19
|
product: string | null;
|
|
20
|
-
slippage
|
|
20
|
+
slippage?: number;
|
|
21
21
|
/** in seconds */
|
|
22
22
|
roundedRouteCostTime: number;
|
|
23
23
|
/** approve contract address */
|
|
24
|
-
spenderContractAddress
|
|
24
|
+
spenderContractAddress?: string;
|
|
25
25
|
/** USD */
|
|
26
26
|
feeUSD: string | null;
|
|
27
27
|
/** in seconds */
|
|
28
28
|
executionDuration: number | null;
|
|
29
29
|
/** one-click */
|
|
30
30
|
step: BridgeStep;
|
|
31
|
-
encodeParams
|
|
31
|
+
encodeParams?: any;
|
|
32
|
+
encodeResultData?: {
|
|
33
|
+
data: string;
|
|
34
|
+
to: string;
|
|
35
|
+
value: string;
|
|
36
|
+
from: string;
|
|
37
|
+
chainId: number;
|
|
38
|
+
encodeId?: string;
|
|
39
|
+
};
|
|
32
40
|
productParams: any;
|
|
33
|
-
sourceRoute
|
|
41
|
+
sourceRoute?: {
|
|
34
42
|
toAmount: string;
|
|
35
43
|
feeUSD: string | null;
|
|
36
44
|
executionDuration: number | null;
|
|
@@ -47,6 +55,8 @@ export interface BridgeRouteI {
|
|
|
47
55
|
};
|
|
48
56
|
fee: any;
|
|
49
57
|
};
|
|
58
|
+
minAmt?: string;
|
|
59
|
+
maxAmt?: string;
|
|
50
60
|
}
|
|
51
61
|
export interface BridgeTokenI {
|
|
52
62
|
id: number;
|
|
@@ -73,7 +83,7 @@ export interface BridgeStep {
|
|
|
73
83
|
tool: string;
|
|
74
84
|
toolDetails: BridgeStepTool;
|
|
75
85
|
type: string | null;
|
|
76
|
-
includedSteps
|
|
86
|
+
includedSteps?: Array<{
|
|
77
87
|
id: string;
|
|
78
88
|
/**
|
|
79
89
|
* bridge or swap
|
|
@@ -94,8 +104,9 @@ export interface FetchRoutePrice {
|
|
|
94
104
|
fromToken: TokenInfo | null;
|
|
95
105
|
toToken: TokenInfo | null;
|
|
96
106
|
fromAmount: string;
|
|
107
|
+
fromFiatPrice: string;
|
|
97
108
|
}
|
|
98
|
-
export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, }: FetchRoutePrice): {
|
|
109
|
+
export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, fromFiatPrice, }: FetchRoutePrice): {
|
|
99
110
|
status: RoutePriceStatus;
|
|
100
111
|
refetch: () => Promise<void>;
|
|
101
112
|
bridgeRouteList: BridgeRouteI[];
|
|
@@ -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,24 @@
|
|
|
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
|
+
isMetamask: boolean;
|
|
9
|
+
autoConnect: (chainId?: number) => Promise<void>;
|
|
10
|
+
connect: () => Promise<void>;
|
|
11
|
+
getLastBlockNumber: () => Promise<number>;
|
|
12
|
+
getBalance: (account: string) => Promise<BigNumber>;
|
|
13
|
+
provider?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
isTon: boolean;
|
|
16
|
+
chainId: number | undefined;
|
|
17
|
+
account: string | undefined;
|
|
18
|
+
isMetamask: boolean | undefined;
|
|
19
|
+
autoConnect: (chainId?: number) => Promise<void>;
|
|
20
|
+
connect: () => void | Promise<void>;
|
|
21
|
+
provider: import("@ethersproject/providers").Web3Provider | undefined;
|
|
22
|
+
getLastBlockNumber: (() => Promise<number>) | undefined;
|
|
23
|
+
getBalance: ((account: string) => Promise<BigNumber | undefined>) | undefined;
|
|
24
|
+
};
|
|
@@ -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,12 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { BridgeRouteI } from '../../Bridge';
|
|
3
|
+
import { TokenInfo } from '../../Token';
|
|
4
|
+
import { useOrbiterRouters } from './useOrbiterRouters';
|
|
5
|
+
export declare function encodeOrbiterBridge({ route, fromAddress, toAddress, fromAmount, fromToken, contractAddress, }: {
|
|
6
|
+
route: Exclude<ReturnType<typeof useOrbiterRouters>['data'], undefined>[0];
|
|
7
|
+
fromAddress: string;
|
|
8
|
+
toAddress: string;
|
|
9
|
+
fromAmount: BigNumber;
|
|
10
|
+
fromToken: TokenInfo;
|
|
11
|
+
contractAddress: string;
|
|
12
|
+
}): Exclude<BridgeRouteI['encodeResultData'], undefined>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChainId } from '../../../constants/chains';
|
|
2
|
+
interface OrbiterRoute {
|
|
3
|
+
key: string;
|
|
4
|
+
id: string;
|
|
5
|
+
fromChainId: ChainId;
|
|
6
|
+
toChainId: ChainId;
|
|
7
|
+
fromTokenAddress: string;
|
|
8
|
+
toTokenAddress: string;
|
|
9
|
+
product: string;
|
|
10
|
+
endpoint: string;
|
|
11
|
+
minAmt: string;
|
|
12
|
+
maxAmt: string;
|
|
13
|
+
withholdingFee: string;
|
|
14
|
+
tradeFee: string;
|
|
15
|
+
spentTime: string;
|
|
16
|
+
vc: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function useOrbiterRouters({ skip }?: {
|
|
19
|
+
skip?: boolean;
|
|
20
|
+
}): import("@tanstack/react-query/build/legacy/types").UseQueryResult<OrbiterRoute[], Error>;
|
|
21
|
+
export {};
|
|
@@ -8,9 +8,8 @@ declare type TokenResult = {
|
|
|
8
8
|
symbol?: string;
|
|
9
9
|
name?: string;
|
|
10
10
|
};
|
|
11
|
-
export default function useFetchTokens({ tokenList,
|
|
11
|
+
export default function useFetchTokens({ tokenList, blockNumber, chainId, skip, }: {
|
|
12
12
|
tokenList?: TokenList;
|
|
13
|
-
addresses?: string[];
|
|
14
13
|
blockNumber?: number;
|
|
15
14
|
chainId?: number;
|
|
16
15
|
skip?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare type ConfirmProps = React.PropsWithChildren<{
|
|
3
3
|
open: boolean;
|
|
4
4
|
onClose: () => void;
|
|
5
5
|
title?: React.ReactNode;
|
|
@@ -12,4 +12,5 @@ export default function Confirm({ open, onClose, title, children, singleBtn, dan
|
|
|
12
12
|
confirmLoading?: boolean;
|
|
13
13
|
isManualClose?: boolean;
|
|
14
14
|
onConfirm?: () => void;
|
|
15
|
-
}
|
|
15
|
+
}>;
|
|
16
|
+
export default function Confirm(props: ConfirmProps): JSX.Element;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ButtonProps } from '@dodoex/components';
|
|
3
3
|
import { ChainId } from '@dodoex/api';
|
|
4
|
-
export default function NeedConnectButton({ chainId, includeButton,
|
|
4
|
+
export default function NeedConnectButton({ chainId, includeButton, ...props }: ButtonProps & {
|
|
5
5
|
/** chainId that needs to be connected */
|
|
6
6
|
chainId?: ChainId;
|
|
7
7
|
includeButton?: boolean;
|
|
8
|
-
showSwitchText?: boolean;
|
|
9
|
-
autoSwitch?: boolean;
|
|
10
8
|
}): JSX.Element;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export declare const transitionTime = 300;
|
|
3
3
|
export interface DialogProps {
|
|
4
4
|
open: boolean;
|
|
5
|
+
id?: 'connect-wallet' | 'submission' | 'error-message' | 'select-chain' | 'select-token' | 'swap-summary' | 'swap-settings' | 'cross-chain-summary' | 'select-cross-chain' | 'pool-operate';
|
|
5
6
|
onClose?: () => void;
|
|
6
7
|
afterClose?: () => void;
|
|
7
8
|
scope?: boolean;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TokenInfo } from '../../../../hooks/Token';
|
|
3
|
-
export declare function TokenLogoCollapse({ token, onClick, showChainLogo, readonly, }: {
|
|
3
|
+
export declare function TokenLogoCollapse({ token, onClick, showChainLogo, readonly, showChainName: showChainNameProps, }: {
|
|
4
4
|
token?: TokenInfo | null;
|
|
5
5
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
6
6
|
showChainLogo?: boolean;
|
|
7
7
|
readonly?: boolean;
|
|
8
|
+
showChainName?: boolean;
|
|
8
9
|
}): JSX.Element;
|
|
@@ -22,7 +22,7 @@ export interface TokenCardProps {
|
|
|
22
22
|
onTokenChange?: (token: TokenInfo, isOccupied: boolean) => void;
|
|
23
23
|
side?: TokenPickerProps['side'];
|
|
24
24
|
showChainLogo?: boolean;
|
|
25
|
-
|
|
25
|
+
showChainName?: boolean;
|
|
26
26
|
defaultLoadBalance?: boolean;
|
|
27
27
|
overrideBalance?: BigNumber | null;
|
|
28
28
|
overrideBalanceLoading?: boolean;
|
|
@@ -36,4 +36,4 @@ export interface TokenCardProps {
|
|
|
36
36
|
}
|
|
37
37
|
export declare function CardPlus(): JSX.Element;
|
|
38
38
|
export declare function CardPlusConnected(): JSX.Element;
|
|
39
|
-
export declare function TokenCard({ sx, amt, token, readOnly, showMaxBtn, canClickBalance, onMaxClick, fiatPriceTxt, occupiedAddrs, occupiedChainId, onInputFocus, onTokenClick, onInputChange, onTokenChange, side, showChainLogo,
|
|
39
|
+
export declare function TokenCard({ sx, amt, token, readOnly, showMaxBtn, canClickBalance, onMaxClick, fiatPriceTxt, occupiedAddrs, occupiedChainId, onInputFocus, onTokenClick, onInputChange, onTokenChange, side, showChainLogo, showChainName, defaultLoadBalance, overrideBalance, overrideBalanceLoading, balanceText, showPercentage, inputReadonlyTooltip, inputTypography, chainId, hideToken, checkLogBalance, }: TokenCardProps): JSX.Element;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { TokenInfo } from '../../hooks/Token/type';
|
|
2
3
|
import { GetAutoSlippage } from '../../hooks/setting/useSetAutoSlippage';
|
|
3
4
|
export interface SwapProps {
|
|
4
5
|
/** Higher priority setting slippage */
|
|
5
6
|
getAutoSlippage?: GetAutoSlippage;
|
|
7
|
+
onPayTokenChange?: (token: TokenInfo) => void;
|
|
8
|
+
onReceiveTokenChange?: (token: TokenInfo) => void;
|
|
6
9
|
}
|
|
7
|
-
export declare function Swap({ getAutoSlippage }?: SwapProps): JSX.Element;
|
|
10
|
+
export declare function Swap({ getAutoSlippage, onPayTokenChange, onReceiveTokenChange, }?: SwapProps): JSX.Element;
|
|
@@ -14,5 +14,7 @@ export interface TokenLogoProps {
|
|
|
14
14
|
chainId?: number;
|
|
15
15
|
noShowChain?: boolean;
|
|
16
16
|
noBorder?: boolean;
|
|
17
|
+
chainSize?: number;
|
|
18
|
+
logoOffset?: number;
|
|
17
19
|
}
|
|
18
|
-
export default function TokenLogo({ width, height, marginRight, url, zIndex, cross, address: addressProps, token: tokenProps, sx, chainId, noShowChain, noBorder, }: TokenLogoProps): React.ReactElement;
|
|
20
|
+
export default function TokenLogo({ width, height, marginRight, url, zIndex, cross, address: addressProps, token: tokenProps, sx, chainId, noShowChain, noBorder, chainSize, logoOffset: logoOffsetProps, }: TokenLogoProps): React.ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i18n as e}from"@lingui/core";import t from"bignumber.js";import{f as i}from"./index-
|
|
1
|
+
import{i18n as e}from"@lingui/core";import t from"bignumber.js";import{f as i}from"./index-C-UlcYP8.js";function o(t,i){switch(t){case"depth-chart.tips.buy":return e._({id:"q+Q952",message:"Users pay {0} {1} and receive {2} {3}\\nPrice {4} ({5}%)",values:{0:i.amountText,1:i.baseTokenSymbol,2:i.oppositeAmountText,3:i.quoteTokenSymbol,4:i.priceText,5:i.slippageText}});case"depth-chart.tips.mid-price":return e._({id:"cnbRVW",message:"Initial Price {0} {1} = {2} {3}",values:{0:i.amountText,1:i.baseTokenSymbol,2:i.oppositeAmountText,3:i.quoteTokenSymbol}});case"depth-chart.tips.sell":return e._({id:"q+Q952",message:"Users pay {0} {1} and receive {2} {3}\\nPrice {4} ({5}%)",values:{0:i.oppositeAmountText,1:i.quoteTokenSymbol,2:i.amountText,3:i.baseTokenSymbol,4:i.priceText,5:i.slippageText}});case"pool.chart.buy-amount":return e._({id:"TaScUS",message:"Users sell {0} amount:",values:{0:i.symbol}});case"pool.chart.price-impact":return e._({id:"I0LXan",message:"Price Impact: {0}",values:{0:i.amount}});case"pool.chart.sell-amount":return e._({id:"F2vX4t",message:"Users buy {0} amount:",values:{0:i.symbol}});case"pool.create.disabled-token-amount":return e._({id:"5QDjef",message:"The token amount is calculated by initial price."});case"pool.create.set-pool.emulator.title":return e._({id:"FQfStS",message:"Emulator"});case"pool.create.set-pool.emulator.title.question":return e._({id:"9D2g7k",message:"The liquidity of DODO is continuous, which is different from the discrete liquidity of UniV3. The ticks shown in the illustration are for demonstration purposes only."});case"pool.chart.liquidity-chart-tip":return e._({id:"YvXHDU",message:"The area of the chart indicates the buy/sell volume of {0} that can be carried by the market when the current price changes to the hover price.",values:{0:i.baseTokenSymbol}});case"pool.chart.liquidity-chart-buy":return e._({id:"TvH4Ym",message:"Bought {0} {1}, price in the pool decreased to {2}",values:{0:i.amount,1:i.symbol,2:i.price}});case"pool.chart.liquidity-chart-sell":return e._({id:"0O1wzf",message:"Traders sold {0} {1}, price in the pool increased to {2}",values:{0:i.amount,1:i.symbol,2:i.price}});default:throw new Error(`Unknown key ${t}`)}}const l=12,n=18;function s(e){let t=e.toLowerCase();if(t&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(4===t.length){let e="#";for(let i=1;i<4;i+=1)e+=t.slice(i,i+1).concat(t.slice(i,i+1));t=e}const e=[];for(let i=1;i<7;i+=2)e.push(parseInt(`0x${t.slice(i,i+2)}`));return e.join(",")}return t}function r({val:e,model:i}){let o=e;if(e.isNaN())return{side:"no-one",vert:new t(0),base:new t(0),quote:new t(0)};i.Q0.eq(0)&&e.lt(i.i)&&(o=i.i),i.B0.eq(0)&&e.gt(i.i)&&(o=i.i);const l=i.getPriceDepth(o),n=l.baseAmount,s=l.quoteAmount,{isBuy:r}=l;return{side:r?"ask":"bid",vert:r?n:s,base:n,quote:s}}function a({midPrice:e,q:i,q0:o,pmmModel:l}){let n=t.maximum(i,o,l.B.multipliedBy(e));return n.isNaN()&&(n=new t(10)),n.eq(0)&&(n=new t(1)),{buyBaseVert:n.multipliedBy(1.2),sellBaseVert:n.div(e).multipliedBy(1.2)}}function u(e,i=1){return new t(i).div(e/2)}function m({tooltip:e,x:o,chartWidth:l,chartHeight:n,buyBaseVert:a,sellBaseVert:m,pmmModel:p,midPrice:d,baseTokenSymbol:c,quoteTokenSymbol:h,t:b,baseMinAndZoomMultiples:f,isHover:y,color:g,leftColor:T,rightColor:x}){const{zoomMultiples:v,baseMin:w}=f,k=u(l,v),M=a.div(n),B=m.div(n),q=2*v,S=w.multipliedBy(10**k.multipliedBy(o).toNumber());let N=new t(Math.log(d.div(w).toNumber())/Math.log(10));N=t.minimum(q,N),N=t.maximum(0,N);const P=N.div(k),X=r({val:S,model:p,midPrice:d});if(X.vert.isNaN())return;const A=S.lt(d);let _=n-X.vert.div(M).toNumber();A||(_=n-X.vert.div(B).toNumber());const z=i(S),O=i(X.vert),$=S.minus(d).abs().div(d).multipliedBy(100).toFixed(2),D=P.toNumber(),H=e.findOne("#toolTipVertLine"),L=e.findOne("#toolTipHoriLine"),U=e.findOne("#joinCircle"),V=e.findOne("#toolTip"),j=e.findOne("#priceTextLabel"),W=e.findOne("#slippageTextLabel");if(!V)return;V.x(o),V.y(_-5-6);const Y=V.getText(),F=V.getTag();let I="ask"===X.side?i(X.quote):i(X.base);const Q=p.k.lte(0);Q&&(I=O);const C=i(d),Z={amountText:O,baseTokenSymbol:c,oppositeAmountText:I,quoteTokenSymbol:h,priceText:Q?C:z,slippageText:`${A?"-":"+"}${$}`};if(P.minus(4).lte(o)&&P.plus(2).gte(o)&&y)Y.text(b("depth-chart.tips.mid-price",{amountText:1,baseTokenSymbol:c,oppositeAmountText:C,quoteTokenSymbol:h})),V.x(D),V.y(n/2),null==H||H.hide(),null==L||L.hide(),null==U||U.hide(),null==j||j.hide(),null==W||W.hide();else{Y.text(A?b("depth-chart.tips.buy",{amountText:I,baseTokenSymbol:c,oppositeAmountText:O,quoteTokenSymbol:h,priceText:Q?C:z,slippageText:`${A?"-":"+"}${$}`}):b("depth-chart.tips.sell",Z));const e=g||(A?"#55f6db":"#ff4f73"),t=A?T||"#55f6db":x||"#ff4f73";Y.fill(e),V.width()/2>o?(F.pointerDirection("left"),F.pointerHeight(15),F.pointerWidth(8),V.offsetX(-11),V.offsetY(-11)):V.width()/2+o>l?(F.pointerDirection("right"),F.pointerHeight(15),F.pointerWidth(8),V.offsetX(11),V.offsetY(-11)):(F.pointerDirection("down"),F.pointerHeight(8),F.pointerWidth(15),V.offsetX(0),V.offsetY(0)),null==H||H.points([o,n,o,_]),null==H||H.stroke(t),null==L||L.points(A?[o,_,D,_]:[D,_,o,_]),null==L||L.stroke(t),null==U||U.x(o),null==U||U.y(_),null==U||U.fill(A?T||"rgb(86, 246, 218)":x||"#FF5072"),null==U||U.stroke(A?T?`rgba(${s(T)}, 0.4)`:"rgba(86, 246, 218, 0.3)":x?`rgba(${s(x)}, 0.4)`:"rgba(255, 80, 114, 0.3)"),j&&(j.x(o),j.y(n),j.offsetX(j.width()/2),j.x()-j.width()/2<0?j.x(j.width()/2):j.x()+j.width()/2>l?j.x(l-j.width()/2):j.x(o));const i=null==j?void 0:j.findOne("#priceTextLabel-text");i&&(i.fill(e),i.text(z)),W&&(W.x(A?o+(D-o)/2:o-(o-D)/2),W.y(_),W.offsetY(W.height()/2),W.offsetX(W.width()/2));const r=null==W?void 0:W.findOne("#slippageTextLabel-text");r&&(r.fill(e),r.text(`${A?"-":"+"}${$}%`)),null==H||H.show(),null==L||L.show(),null==U||U.show(),null==j||j.show(),null==W||W.show()}e.show()}function p({dragDistance:e,prevBaseMin:i,chartWidth:o,zoomMultiples:l}){const n=u(o,l);return e>0?i.multipliedBy(1-n.multipliedBy(e).toNumber()):i.multipliedBy(10**n.multipliedBy(new t(e).abs()).plus(0).toNumber())}const d=1;function c({prevZoomMultiples:e,zoomIn:t}){return!t&&e<=.1?e:t?e+.1:e-.1}function h({type:e,targetPrice:i,midPrice:o,width:l}){if("sell"===e){return{zoomMultiples:new t(Math.log10(i.div(o).toNumber())).minus(0).div(3/4).abs(),targetX:l/2*(3/4)+l/2}}const n=new t(Math.log10(i.div(o).toNumber()));return{zoomMultiples:new t(0).minus(n).div(3/4).abs(),targetX:l/2*(1/4)}}function b({currentBaseMinAndZoomMultiples:e,targetPrice:i,midPrice:o,width:l}){const{baseMin:n,zoomMultiples:s}=e,r=new t(Math.log10(n.div(o).toNumber())),a=r.plus(2*s),u=new t(o.multipliedBy(10**a.toNumber()));if(i.gte(n)&&i.lte(u)){return{isSkip:!0,targetX:new t(Math.log10(i.div(o).toNumber())).minus(r).div(2*s).multipliedBy(l).toNumber(),baseMin:new t(0),zoomMultiples:1}}const m=new t(o.multipliedBy(.1)),p=new t(o.multipliedBy(10));if(i.gte(m)&&i.lte(p)){return{isSkip:!1,targetX:new t(Math.log10(i.div(o).toNumber())).minus(-1).div(2).multipliedBy(l).toNumber(),baseMin:m,zoomMultiples:1}}return{isSkip:!1,targetX:-1,baseMin:new t(0),zoomMultiples:1}}function f({midPrice:e,zoomMultiples:t}){return e.multipliedBy(10**-t)}export{a,p as b,u as c,c as d,r as e,f,o as g,n as h,d as i,b as j,h as k,l,s as m,m as u};
|
|
@@ -5,6 +5,7 @@ export interface ExecutionProps {
|
|
|
5
5
|
onTxFail?: (error: Error, data: any) => void;
|
|
6
6
|
onTxSubmit?: (tx: string, data: any) => void;
|
|
7
7
|
onTxSuccess?: (tx: string, data: any) => void;
|
|
8
|
+
onTxReverted?: (tx: string, data: any) => void;
|
|
8
9
|
executionStatus?: {
|
|
9
10
|
showing?: Showing | null;
|
|
10
11
|
showingDone?: boolean;
|
|
@@ -14,7 +15,7 @@ export interface ExecutionProps {
|
|
|
14
15
|
closeShowing?: () => void;
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
export default function useExecution({ onTxFail, onTxSubmit, onTxSuccess, }?: ExecutionProps): {
|
|
18
|
+
export default function useExecution({ onTxFail, onTxSubmit, onTxSuccess, onTxReverted, }?: ExecutionProps): {
|
|
18
19
|
showing: Showing | null;
|
|
19
20
|
showingDone: boolean;
|
|
20
21
|
transactionTx: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BigNumber as EthersBigNumber } from '@ethersproject/bignumber';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export default function useExecuteSwap(): ({ to, data, useSource, duration, ddl, gasLimit, subtitle, value, }: {
|
|
3
|
+
export default function useExecuteSwap(): ({ to, data, useSource, duration, ddl, gasLimit, subtitle, value, mixpanelProps, }: {
|
|
4
4
|
value: string;
|
|
5
5
|
to: string;
|
|
6
6
|
data: string;
|
|
@@ -9,4 +9,5 @@ export default function useExecuteSwap(): ({ to, data, useSource, duration, ddl,
|
|
|
9
9
|
ddl: number;
|
|
10
10
|
gasLimit?: EthersBigNumber | undefined;
|
|
11
11
|
subtitle: React.ReactNode;
|
|
12
|
+
mixpanelProps?: Record<string, any> | undefined;
|
|
12
13
|
}) => void;
|