@dodoex/widgets 2.6.12-beta.2 → 2.6.12-beta.4
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-C5SrJQaK.cjs +1 -0
- package/dist/cjs/helper-DL8TMEkQ.cjs +1 -0
- package/dist/cjs/helper-DNaeIBQY.cjs +1 -0
- 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-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/locales/en-US.js +1 -1
- package/dist/cjs/locales/zh-CN.js +1 -1
- package/dist/cjs/lottie-4VzKv4A8.cjs +1 -0
- package/dist/cjs/lottie-DLvPIL-h.cjs +1 -0
- package/dist/cjs/lottie-TilCy8UF.cjs +1 -0
- 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 +2 -0
- 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 +23 -6
- package/dist/cjs/src/hooks/ConnectWallet/TonConnect/contract.d.ts +8 -0
- package/dist/cjs/src/hooks/ConnectWallet/useWalletState.d.ts +4 -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/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/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 +41 -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/helper-CHqZavUq.js +1 -0
- package/dist/helper-D1mp2p4F.js +1 -0
- package/dist/helper-Dhy5gy1p.js +1 -0
- package/dist/index-0IX6JBNg.js +12 -0
- package/dist/index-BgcusTMt.js +78 -0
- package/dist/index-BlT57eKb.js +53 -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.js +7 -7
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/lottie-B77ifW0u.js +1 -0
- package/dist/lottie-C9cpjlCR.js +1 -0
- package/dist/lottie-DMZ5X1eY.js +1 -0
- 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 +2 -0
- 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 +23 -6
- package/dist/src/hooks/ConnectWallet/TonConnect/contract.d.ts +8 -0
- package/dist/src/hooks/ConnectWallet/useWalletState.d.ts +4 -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/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/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 +41 -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/package.json +3 -1
|
@@ -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;
|
|
@@ -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,14 @@ export interface FetchRoutePrice {
|
|
|
94
106
|
fromToken: TokenInfo | null;
|
|
95
107
|
toToken: TokenInfo | null;
|
|
96
108
|
fromAmount: string;
|
|
109
|
+
fromFiatPrice: string;
|
|
97
110
|
}
|
|
98
|
-
export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, }: FetchRoutePrice): {
|
|
111
|
+
export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, fromFiatPrice, }: FetchRoutePrice): {
|
|
99
112
|
status: RoutePriceStatus;
|
|
100
113
|
refetch: () => Promise<void>;
|
|
101
114
|
bridgeRouteList: BridgeRouteI[];
|
|
115
|
+
limit: {
|
|
116
|
+
minAmt?: number | undefined;
|
|
117
|
+
maxAmt?: number | undefined;
|
|
118
|
+
} | null;
|
|
102
119
|
};
|
|
@@ -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,6 +17,8 @@ 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>;
|
|
@@ -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,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,41 @@
|
|
|
1
|
+
import { TokenInfo } from '../../Token';
|
|
2
|
+
import { Network, Quote } from './types';
|
|
3
|
+
export declare function getLayerSwapData<T>(url: string): Promise<T>;
|
|
4
|
+
export declare function getNetworks(): Promise<Network[]>;
|
|
5
|
+
export declare function getLimits({ fromToken, toToken, fromNetworkName, toNetworkName, }: {
|
|
6
|
+
fromToken: TokenInfo | null;
|
|
7
|
+
toToken: TokenInfo | null;
|
|
8
|
+
fromNetworkName: string | undefined | null;
|
|
9
|
+
toNetworkName: string | undefined | null;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
min_amount_in_usd: number;
|
|
12
|
+
min_amount: number;
|
|
13
|
+
max_amount_in_usd: number;
|
|
14
|
+
max_amount: number;
|
|
15
|
+
} | undefined>;
|
|
16
|
+
export declare function getQuote({ fromToken, toToken, fromNetworkName, toNetworkName, slippage, fromAmount, }: {
|
|
17
|
+
fromToken: TokenInfo | null;
|
|
18
|
+
toToken: TokenInfo | null;
|
|
19
|
+
fromNetworkName: string | undefined | null;
|
|
20
|
+
toNetworkName: string | undefined | null;
|
|
21
|
+
slippage: number;
|
|
22
|
+
fromAmount: string;
|
|
23
|
+
}): Promise<Quote | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* @see https://github.com/layerswap/layerswapapp/blob/dev/components/Swap/Withdraw/Wallet/TonWalletWithdraw.tsx
|
|
26
|
+
*/
|
|
27
|
+
export declare function submitTonWalletWithdraw({ fromAddress, toAddress, fromToken, toToken, fromNetworkName, toNetworkName, fromAmount, slippage, params, }: {
|
|
28
|
+
fromAddress: string | undefined;
|
|
29
|
+
toAddress: string | undefined;
|
|
30
|
+
fromToken: TokenInfo | null;
|
|
31
|
+
toToken: TokenInfo | null;
|
|
32
|
+
fromNetworkName: string | undefined | null;
|
|
33
|
+
toNetworkName: string | undefined | null;
|
|
34
|
+
fromAmount: string;
|
|
35
|
+
slippage?: number;
|
|
36
|
+
params: {
|
|
37
|
+
onSubmit?: (tx: string, reportInfo?: Record<string, any>) => void;
|
|
38
|
+
onSuccess?: (tx: string, reportInfo?: Record<string, any>) => Promise<void>;
|
|
39
|
+
onError?: (e: any) => void;
|
|
40
|
+
};
|
|
41
|
+
}): Promise<import("ton").Transaction | 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, evmAccount, tonAccount, slippage }, }: {
|
|
4
|
+
skip?: boolean;
|
|
5
|
+
data: {
|
|
6
|
+
fromToken: TokenInfo | null;
|
|
7
|
+
toToken: TokenInfo | null;
|
|
8
|
+
fromAmount: string;
|
|
9
|
+
evmAccount: string | undefined;
|
|
10
|
+
tonAccount: 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
|
+
};
|
|
@@ -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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i18n as e}from"@lingui/core";import t from"bignumber.js";import{f as i}from"./index-CTxzesqs.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};
|