@dodoex/widgets 2.6.5 → 2.6.6
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/index-1904ef51.cjs +50 -0
- package/dist/cjs/index-19cf4c6e.cjs +50 -0
- package/dist/cjs/index-246a9973.cjs +50 -0
- package/dist/cjs/index-5eca89d2.cjs +50 -0
- package/dist/cjs/index-64af8ffd.cjs +45 -0
- package/dist/cjs/index-f2a80623.cjs +45 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/lottie-01f67a00.cjs +1 -0
- package/dist/cjs/lottie-09dbe581.cjs +1 -0
- package/dist/cjs/lottie-7e742196.cjs +1 -0
- package/dist/cjs/lottie-924a2436.cjs +1 -0
- package/dist/cjs/lottie-b9cf6aee.cjs +1 -0
- package/dist/cjs/lottie-ed4f1473.cjs +1 -0
- package/dist/cjs/src/components/AutoButton.d.ts +7 -0
- package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/index.d.ts +1 -0
- package/dist/cjs/src/constants/pool.d.ts +2 -0
- package/dist/cjs/src/hooks/Bridge/createBridgeOrder.d.ts +4 -1
- package/dist/cjs/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +1 -0
- package/dist/cjs/src/hooks/ConnectWallet/useWalletInfo.d.ts +6 -0
- package/dist/cjs/src/hooks/Submission/useBalanceUpdateLoading.d.ts +15 -0
- package/dist/cjs/src/hooks/Token/useTokenStatus.d.ts +17 -0
- package/dist/cjs/src/hooks/Token/useTokenStatus.test.d.ts +1 -0
- package/dist/cjs/src/hooks/usePrevious.d.ts +1 -0
- package/dist/cjs/src/providers/queryClient/index.d.ts +2 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/AddPoolOperate.d.ts +3 -1
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/Footer.d.ts +18 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/LiquidityInfo.d.ts +3 -9
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/PoolOperateInner.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/Ratio.d.ts +8 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/SlippageSetting.d.ts +18 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/hooks/useLiquidityOperateAmount.d.ts +44 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/hooks/usePoolOperateTabs.d.ts +3 -3
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/hooks/usePoolOrMiningTabs.d.ts +12 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/index.d.ts +3 -7
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/types.d.ts +19 -0
- package/dist/cjs/src/widgets/PoolWidget/hooks/usePoolBalanceInfo.d.ts +43 -0
- package/dist/cjs/src/widgets/PoolWidget/utils.d.ts +5 -8
- package/dist/index-b07aac90.js +45 -0
- package/dist/index-c1a581ca.js +50 -0
- package/dist/index-c9dbe645.js +50 -0
- package/dist/index-cdf23d80.js +50 -0
- package/dist/index-e58d24e5.js +50 -0
- package/dist/index-ee546021.js +45 -0
- package/dist/index.js +1 -1
- package/dist/lottie-449d7c9a.js +1 -0
- package/dist/lottie-9678ebc9.js +1 -0
- package/dist/lottie-9b618308.js +1 -0
- package/dist/lottie-baaed8fa.js +1 -0
- package/dist/lottie-d6631244.js +1 -0
- package/dist/lottie-ed5a9dfd.js +1 -0
- package/dist/src/components/AutoButton.d.ts +7 -0
- package/dist/src/components/Bridge/BridgeSummaryDialog/index.d.ts +1 -0
- package/dist/src/constants/pool.d.ts +2 -0
- package/dist/src/hooks/Bridge/createBridgeOrder.d.ts +4 -1
- package/dist/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +1 -0
- package/dist/src/hooks/ConnectWallet/useWalletInfo.d.ts +6 -0
- package/dist/src/hooks/Submission/useBalanceUpdateLoading.d.ts +15 -0
- package/dist/src/hooks/Token/useTokenStatus.d.ts +17 -0
- package/dist/src/hooks/Token/useTokenStatus.test.d.ts +1 -0
- package/dist/src/hooks/usePrevious.d.ts +1 -0
- package/dist/src/providers/queryClient/index.d.ts +2 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/AddPoolOperate.d.ts +3 -1
- package/dist/src/widgets/PoolWidget/PoolOperate/Footer.d.ts +18 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/LiquidityInfo.d.ts +3 -9
- package/dist/src/widgets/PoolWidget/PoolOperate/PoolOperateInner.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/Ratio.d.ts +8 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/SlippageSetting.d.ts +18 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/hooks/useLiquidityOperateAmount.d.ts +44 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/hooks/usePoolOperateTabs.d.ts +3 -3
- package/dist/src/widgets/PoolWidget/PoolOperate/hooks/usePoolOrMiningTabs.d.ts +12 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/index.d.ts +3 -7
- package/dist/src/widgets/PoolWidget/PoolOperate/types.d.ts +19 -0
- package/dist/src/widgets/PoolWidget/hooks/usePoolBalanceInfo.d.ts +43 -0
- package/dist/src/widgets/PoolWidget/utils.d.ts +5 -8
- package/package.json +1 -1
|
@@ -15,11 +15,14 @@ export interface BridgeOrderCreateParams {
|
|
|
15
15
|
lifiBridge: BridgeRouteI['sourceRoute']['step']['tool'];
|
|
16
16
|
route: BridgeRouteI['sourceRoute'];
|
|
17
17
|
productParams: BridgeRouteI['productParams'];
|
|
18
|
+
encodeId: string;
|
|
19
|
+
source: string;
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
|
-
export declare function createBridgeOrder({ apikey, tx, route, bridgeCreateRouteAPI, }: {
|
|
22
|
+
export declare function createBridgeOrder({ apikey, tx, route, bridgeCreateRouteAPI, encodeId, }: {
|
|
21
23
|
apikey?: string;
|
|
22
24
|
tx: string;
|
|
23
25
|
route: BridgeRouteI;
|
|
24
26
|
bridgeCreateRouteAPI: string;
|
|
27
|
+
encodeId: string;
|
|
25
28
|
}): Promise<any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
declare type BalanceData = {
|
|
3
|
+
[address: string]: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Record the loading status of the balance waiting to be updated after the chain is successfully uploaded
|
|
7
|
+
* Insert token data into logBalance in metadata when uploading, within 5 minutes after successful uploading. If the newly passed in balance is consistent with the previously recorded balance, loading will be returned
|
|
8
|
+
* After the balance is updated, or after 5 minutes, loading will return false. And delete the recorded metadata information to avoid calculating this data next time
|
|
9
|
+
* The 5-minute time limit is to avoid operations on other terminals or other tabs, which will cause the balance comparison to be invalid and keep loading.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useBalanceUpdateLoading: () => {
|
|
12
|
+
balanceData: BalanceData;
|
|
13
|
+
isTokenLoading: (address: string, balance: BigNumber | number | string) => boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { TokenInfo } from './type';
|
|
3
|
+
export declare function useTokenStatus(token: TokenInfo | undefined | null, { amount, contractAddress, offset, overrideBalance, }?: {
|
|
4
|
+
amount?: string | number | BigNumber;
|
|
5
|
+
contractAddress?: string;
|
|
6
|
+
offset?: BigNumber;
|
|
7
|
+
overrideBalance?: BigNumber | null;
|
|
8
|
+
}): {
|
|
9
|
+
isApproving: boolean;
|
|
10
|
+
isGetApproveLoading: boolean;
|
|
11
|
+
needApprove: boolean;
|
|
12
|
+
needReset: boolean | undefined;
|
|
13
|
+
insufficientBalance: boolean;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
submitApprove: () => Promise<void>;
|
|
16
|
+
getMaxBalance: () => string;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function usePrevious<Value>(value: Value): Value | undefined;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { OperatePool } from './types';
|
|
3
|
+
export declare function AddPoolOperate({ refetch, submittedBack, onlyShowSide, pool, }: {
|
|
3
4
|
refetch?: () => void;
|
|
4
5
|
submittedBack?: () => void;
|
|
5
6
|
onlyShowSide?: 'base' | 'quote';
|
|
7
|
+
pool?: OperatePool;
|
|
6
8
|
}): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import BigNumber from 'bignumber.js';
|
|
3
|
+
import { OperatePool } from './types';
|
|
4
|
+
declare type InputStatus = any;
|
|
5
|
+
export default function Footer({ pool, onSubmit, lqAndDodoCompare, midPrice, isShowCompare, isWarnCompare, disabled, baseInputStatus, quoteInputStatus, submitBtnText, hasFeeTokenSymbol, }: {
|
|
6
|
+
pool?: OperatePool;
|
|
7
|
+
onSubmit: () => void;
|
|
8
|
+
lqAndDodoCompare: number;
|
|
9
|
+
midPrice?: BigNumber;
|
|
10
|
+
isShowCompare: boolean;
|
|
11
|
+
isWarnCompare: boolean;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
baseInputStatus: InputStatus;
|
|
14
|
+
quoteInputStatus: InputStatus;
|
|
15
|
+
submitBtnText: string;
|
|
16
|
+
hasFeeTokenSymbol: string;
|
|
17
|
+
}): JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { OperatePool } from './types';
|
|
3
3
|
export interface LiquidityInfoProps {
|
|
4
4
|
loading?: boolean;
|
|
5
5
|
hidePoolInfo?: boolean;
|
|
6
|
-
pool
|
|
7
|
-
chainId?: number;
|
|
8
|
-
address?: string;
|
|
9
|
-
baseToken?: TokenInfo;
|
|
10
|
-
quoteToken?: TokenInfo;
|
|
11
|
-
};
|
|
12
|
-
myPoolInfoLoading?: boolean;
|
|
6
|
+
pool: OperatePool;
|
|
13
7
|
}
|
|
14
|
-
export default function LiquidityInfo({ loading, hidePoolInfo, pool,
|
|
8
|
+
export default function LiquidityInfo({ loading, hidePoolInfo, pool, }: LiquidityInfoProps): JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import BigNumber from 'bignumber.js';
|
|
3
|
+
import { OperatePool } from './types';
|
|
4
|
+
export default function Ratio({ pool, addPortion, midPrice, }: {
|
|
5
|
+
pool?: OperatePool;
|
|
6
|
+
addPortion?: BigNumber;
|
|
7
|
+
midPrice?: BigNumber;
|
|
8
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AUTO_SWAP_SLIPPAGE_PROTECTION } from '../../../constants/pool';
|
|
3
|
+
interface Props {
|
|
4
|
+
value: number | typeof AUTO_SWAP_SLIPPAGE_PROTECTION;
|
|
5
|
+
onChange: (val: number | typeof AUTO_SWAP_SLIPPAGE_PROTECTION) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const useSlipper: ({ address }: {
|
|
8
|
+
address?: string | undefined;
|
|
9
|
+
}) => {
|
|
10
|
+
slipper: number | "auto";
|
|
11
|
+
setSlipper: import("react").Dispatch<import("react").SetStateAction<number | "auto">>;
|
|
12
|
+
slipperValue: number;
|
|
13
|
+
resetSlipper: () => void;
|
|
14
|
+
};
|
|
15
|
+
export default function SlippageSetting({ disabled, ...attrs }: Props & {
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}): JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { OperatePool } from '../types';
|
|
3
|
+
export declare function useLiquidityOperateAmount({ pool, maxBaseAmount, maxQuoteAmount, }: {
|
|
4
|
+
pool: OperatePool;
|
|
5
|
+
maxBaseAmount?: BigNumber;
|
|
6
|
+
maxQuoteAmount?: BigNumber;
|
|
7
|
+
}): {
|
|
8
|
+
baseAmount: string;
|
|
9
|
+
quoteAmount: string;
|
|
10
|
+
handleChangeBaseAmount: () => void;
|
|
11
|
+
handleChangeQuoteAmount: () => void;
|
|
12
|
+
reset: () => void;
|
|
13
|
+
addPortion?: undefined;
|
|
14
|
+
amountLoading?: undefined;
|
|
15
|
+
amountError?: undefined;
|
|
16
|
+
amountRefetch?: undefined;
|
|
17
|
+
midPrice?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
baseAmount: string;
|
|
20
|
+
quoteAmount: string;
|
|
21
|
+
handleChangeBaseAmount: (newValue: string) => void;
|
|
22
|
+
handleChangeQuoteAmount: (newValue: string) => void;
|
|
23
|
+
reset: () => void;
|
|
24
|
+
addPortion: BigNumber;
|
|
25
|
+
amountLoading: false;
|
|
26
|
+
amountError: boolean;
|
|
27
|
+
amountRefetch: (options?: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa")._ | undefined) => Promise<import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").ae<{
|
|
28
|
+
midPrice: BigNumber | undefined;
|
|
29
|
+
pmmParamsBG: {
|
|
30
|
+
q: BigNumber;
|
|
31
|
+
b: BigNumber;
|
|
32
|
+
k: BigNumber;
|
|
33
|
+
i: BigNumber;
|
|
34
|
+
b0: BigNumber;
|
|
35
|
+
q0: BigNumber;
|
|
36
|
+
R: number;
|
|
37
|
+
lpFeeRate: BigNumber | undefined;
|
|
38
|
+
mtFeeRate: BigNumber | undefined;
|
|
39
|
+
};
|
|
40
|
+
baseReserve: BigNumber;
|
|
41
|
+
quoteReserve: BigNumber;
|
|
42
|
+
} | null, Error>>;
|
|
43
|
+
midPrice: BigNumber | undefined;
|
|
44
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum PoolOrMiningTab {
|
|
2
|
+
Liquidity = 1,
|
|
3
|
+
Mining = 2
|
|
4
|
+
}
|
|
5
|
+
export declare function usePoolOrMiningTabs(): {
|
|
6
|
+
poolOrMiningTab: PoolOrMiningTab;
|
|
7
|
+
poolOrMiningTabs: {
|
|
8
|
+
key: PoolOrMiningTab;
|
|
9
|
+
value: string;
|
|
10
|
+
}[];
|
|
11
|
+
handleChangeTab: (poolTab: PoolOrMiningTab) => void;
|
|
12
|
+
};
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { PoolOperateInnerProps } from './PoolOperateInner';
|
|
3
3
|
export interface PoolOperateProps {
|
|
4
4
|
onClose: () => void;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
chainId: number;
|
|
8
|
-
baseToken?: TokenInfo;
|
|
9
|
-
quoteToken?: TokenInfo;
|
|
10
|
-
};
|
|
5
|
+
account: string | undefined;
|
|
6
|
+
pool: PoolOperateInnerProps['pool'];
|
|
11
7
|
}
|
|
12
8
|
export default function PoolOperate({ onClose, pool }: PoolOperateProps): JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PoolType } from '@dodoex/api';
|
|
2
|
+
import { TokenInfo } from '../../../hooks/Token';
|
|
3
|
+
export declare type OperatePool = {
|
|
4
|
+
address: string;
|
|
5
|
+
chainId: number;
|
|
6
|
+
baseToken: TokenInfo;
|
|
7
|
+
quoteToken: TokenInfo;
|
|
8
|
+
baseLpToken?: {
|
|
9
|
+
id: string;
|
|
10
|
+
decimals: number;
|
|
11
|
+
};
|
|
12
|
+
quoteLpToken?: {
|
|
13
|
+
id: string;
|
|
14
|
+
decimals: number;
|
|
15
|
+
};
|
|
16
|
+
type: PoolType;
|
|
17
|
+
owner?: string;
|
|
18
|
+
creator: string;
|
|
19
|
+
} | undefined;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PoolType } from '@dodoex/api';
|
|
2
|
+
import { BigNumber } from 'bignumber.js';
|
|
3
|
+
import { ChainId } from '../../../constants/chains';
|
|
4
|
+
import { TokenInfo } from '../../../hooks/Token';
|
|
5
|
+
declare type Balance = BigNumber | null | undefined;
|
|
6
|
+
export declare function usePoolBalanceInfo({ chainId, account, pool, }: {
|
|
7
|
+
chainId: ChainId;
|
|
8
|
+
account?: string;
|
|
9
|
+
pool?: {
|
|
10
|
+
address: string;
|
|
11
|
+
chainId: number;
|
|
12
|
+
baseToken: TokenInfo;
|
|
13
|
+
quoteToken: TokenInfo;
|
|
14
|
+
type: PoolType;
|
|
15
|
+
};
|
|
16
|
+
}): {
|
|
17
|
+
/** existing base lp balance */
|
|
18
|
+
totalBaseLpBalance: BigNumber | null | undefined;
|
|
19
|
+
/** existing quote lp balance */
|
|
20
|
+
totalQuoteLpBalance: BigNumber | null | undefined;
|
|
21
|
+
/** the total deposited base lp balance */
|
|
22
|
+
baseReserve: BigNumber | undefined;
|
|
23
|
+
/** the total deposited quote lp balance */
|
|
24
|
+
quoteReserve: BigNumber | undefined;
|
|
25
|
+
/** classical base equilibrium target */
|
|
26
|
+
classicalBaseTarget: BigNumber | undefined;
|
|
27
|
+
/** classical quote equilibrium target */
|
|
28
|
+
classicalQuoteTarget: BigNumber | undefined;
|
|
29
|
+
/** the user's existing base lp balance */
|
|
30
|
+
userBaseLpBalance: Balance;
|
|
31
|
+
/** the user's existing quote lp balance */
|
|
32
|
+
userQuoteLpBalance: Balance;
|
|
33
|
+
/** The number of base that can be obtained when a user withdraws from the pool */
|
|
34
|
+
userBaseLpToTokenBalance: BigNumber | null | undefined;
|
|
35
|
+
/** The number of quote that can be obtained when a user withdraws from the pool */
|
|
36
|
+
userQuoteLpToTokenBalance: BigNumber | null | undefined;
|
|
37
|
+
userLpBalanceLoading: boolean;
|
|
38
|
+
userLpToTokenBalanceLoading: boolean;
|
|
39
|
+
userLpBalanceError: boolean;
|
|
40
|
+
userLpToTokenBalanceError: boolean;
|
|
41
|
+
userLpToTokenBalanceRefetch: () => void;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { PoolApi, ExcludeNone } from '@dodoex/api';
|
|
1
|
+
import { PoolApi, ExcludeNone, PoolType } from '@dodoex/api';
|
|
2
2
|
import { ChainId } from '../../constants/chains';
|
|
3
3
|
import { TokenInfo } from '../../hooks/Token';
|
|
4
|
-
import {
|
|
4
|
+
import { OperatePool } from './PoolOperate/types';
|
|
5
5
|
export declare const poolApi: PoolApi;
|
|
6
|
-
export declare type FetchLiquidityListLqList = ExcludeNone<ReturnType<Exclude<typeof PoolApi.fetchLiquidityList['__apiType'], undefined>>['liquidity_list']>['lqList'];
|
|
7
|
-
/** Actually more than that, but the api has filtering */
|
|
8
|
-
export declare type LqPoolType = 'DPP' | 'DVM' | 'DSP' | 'CLASSICAL';
|
|
6
|
+
export declare type FetchLiquidityListLqList = ExcludeNone<ReturnType<Exclude<typeof PoolApi.graphql.fetchLiquidityList['__apiType'], undefined>>['liquidity_list']>['lqList'];
|
|
9
7
|
export declare function convertLiquidityTokenToTokenInfo(token: {
|
|
10
8
|
id: string;
|
|
11
9
|
symbol: string;
|
|
@@ -14,10 +12,9 @@ export declare function convertLiquidityTokenToTokenInfo(token: {
|
|
|
14
12
|
usdPrice: number;
|
|
15
13
|
logoImg?: string | null;
|
|
16
14
|
} | undefined, chainId: ChainId | number): TokenInfo | undefined;
|
|
17
|
-
export declare function hasQuoteApy(type: string): boolean;
|
|
18
15
|
export declare function canOperatePool(account: string | undefined, { owner, creator, type, }: {
|
|
19
16
|
owner?: string | null;
|
|
20
17
|
creator?: string | null;
|
|
21
|
-
type?:
|
|
18
|
+
type?: PoolType;
|
|
22
19
|
}): boolean;
|
|
23
|
-
export declare function convertFetchLiquidityToOperateData(lqData: ExcludeNone<FetchLiquidityListLqList>[0]):
|
|
20
|
+
export declare function convertFetchLiquidityToOperateData(lqData: ExcludeNone<FetchLiquidityListLqList>[0]): OperatePool;
|