@dodoex/widgets 2.3.4 → 2.3.5-1
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/608a45433384d12e.png +0 -0
- package/dist/b08d68f421a81726.png +0 -0
- package/dist/cjs/608a45433384d12e.png +0 -0
- package/dist/cjs/b08d68f421a81726.png +0 -0
- package/dist/cjs/e63d558f5364d137.svg +10 -0
- package/dist/cjs/index.cjs +9 -8
- package/dist/cjs/locales/en-US.js +1 -1
- package/dist/cjs/src/components/Bridge/BridgeRouteShortCard.d.ts +6 -0
- package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/BridgeSummaryDetail.d.ts +5 -0
- package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/index.d.ts +17 -0
- package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/CrossStep.d.ts +16 -0
- package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/EtherscanLinkButton.d.ts +6 -0
- package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/RouteSteps.d.ts +6 -0
- package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/SwapStep.d.ts +14 -0
- package/dist/cjs/src/components/Bridge/SelectBridgeDialog/BridgeLogo.d.ts +10 -0
- package/dist/cjs/src/components/Bridge/SelectBridgeDialog/DirectionLine.d.ts +4 -0
- package/dist/cjs/src/components/Bridge/SelectBridgeDialog/RouteCard.d.ts +21 -0
- package/dist/cjs/src/components/Bridge/SelectBridgeDialog/RouteTagList.d.ts +12 -0
- package/dist/cjs/src/components/Bridge/SelectBridgeDialog/TokenWithChain.d.ts +11 -0
- package/dist/cjs/src/components/Bridge/SelectBridgeDialog/index.d.ts +9 -0
- package/dist/cjs/src/components/Bridge/SelectBridgeDialog/productList.d.ts +5 -0
- package/dist/cjs/src/components/ErrorMessageDialog.d.ts +5 -0
- package/dist/cjs/src/components/Swap/components/SettingsDialog/index.d.ts +2 -1
- package/dist/cjs/src/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +2 -1
- package/dist/cjs/src/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +2 -1
- package/dist/cjs/src/components/Swap/components/TokenCard/index.d.ts +4 -1
- package/dist/cjs/src/components/SwitchChainDialog/index.d.ts +7 -0
- package/dist/cjs/src/components/TokenLogo.d.ts +2 -1
- package/dist/cjs/src/components/TokenPicker/SelectChainItem.d.ts +7 -0
- package/dist/cjs/src/components/TokenPicker/index.d.ts +2 -1
- package/dist/cjs/src/constants/api.d.ts +3 -0
- package/dist/cjs/src/constants/chainList.d.ts +10 -0
- package/dist/cjs/src/constants/chains.d.ts +5 -70
- package/dist/cjs/src/constants/localstorage.d.ts +2 -0
- package/dist/cjs/src/constants/swap.d.ts +1 -0
- package/dist/cjs/src/hooks/Bridge/createBridgeOrder.d.ts +24 -0
- package/dist/cjs/src/hooks/Bridge/index.d.ts +4 -0
- package/dist/cjs/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +6 -0
- package/dist/cjs/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +101 -0
- package/dist/cjs/src/hooks/Bridge/useFetchRoutePriceBridge.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Bridge/useSendRoute.d.ts +16 -0
- package/dist/cjs/src/hooks/Bridge/useSwitchBridgeOrSwapSlippage.d.ts +1 -0
- package/dist/cjs/src/hooks/ConnectWallet/useSwitchChain.d.ts +10 -0
- package/dist/cjs/src/hooks/Submission/types.d.ts +2 -1
- package/dist/cjs/src/hooks/Submission/useExecution.d.ts +1 -1
- package/dist/cjs/src/hooks/Token/type.d.ts +1 -3
- package/dist/cjs/src/hooks/Token/useFetchTokenAllowance.d.ts +13 -0
- package/dist/cjs/src/hooks/Token/useGetCGTokenList.d.ts +6 -4
- package/dist/cjs/src/hooks/Token/useInitTokenList.d.ts +1 -1
- package/dist/cjs/src/hooks/Token/useSelectChainList.d.ts +77 -0
- package/dist/cjs/src/hooks/Token/useSelectChainList.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Token/useTokenList.d.ts +5 -1
- package/dist/cjs/src/hooks/Token/useTokenListFetchBalance.d.ts +9 -0
- package/dist/cjs/src/hooks/Widget/useInitPropsToRedux.d.ts +1 -1
- package/dist/cjs/src/hooks/contract/contractConfig.d.ts +1 -26
- package/dist/cjs/src/hooks/contract/index.d.ts +1 -0
- package/dist/cjs/src/hooks/contract/token.d.ts +10 -0
- package/dist/cjs/src/hooks/contract/useFetchETHBalance.d.ts +1 -1
- package/dist/cjs/src/hooks/contract/useFetchTokens.d.ts +3 -1
- package/dist/cjs/src/hooks/contract/useMultiContract.d.ts +1 -21
- package/dist/cjs/src/store/actions/globals.d.ts +1 -0
- package/dist/cjs/src/store/actions/token.d.ts +1 -1
- package/dist/cjs/src/store/reducers/globals.d.ts +2 -0
- package/dist/cjs/src/store/reducers/token.d.ts +3 -1
- package/dist/cjs/src/store/selectors/globals.d.ts +1 -0
- package/dist/cjs/src/store/selectors/token.d.ts +3 -1
- package/dist/cjs/src/utils/address.d.ts +7 -0
- package/dist/cjs/src/utils/formatter.d.ts +2 -0
- package/dist/cjs/src/utils/time.d.ts +9 -0
- package/dist/cjs/src/utils/time.test.d.ts +1 -0
- package/dist/e63d558f5364d137.svg +10 -0
- package/dist/index.js +9 -8
- package/dist/locales/en-US.js +1 -1
- package/dist/src/components/Bridge/BridgeRouteShortCard.d.ts +6 -0
- package/dist/src/components/Bridge/BridgeSummaryDialog/BridgeSummaryDetail.d.ts +5 -0
- package/dist/src/components/Bridge/BridgeSummaryDialog/index.d.ts +17 -0
- package/dist/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/CrossStep.d.ts +16 -0
- package/dist/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/EtherscanLinkButton.d.ts +6 -0
- package/dist/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/RouteSteps.d.ts +6 -0
- package/dist/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/SwapStep.d.ts +14 -0
- package/dist/src/components/Bridge/SelectBridgeDialog/BridgeLogo.d.ts +10 -0
- package/dist/src/components/Bridge/SelectBridgeDialog/DirectionLine.d.ts +4 -0
- package/dist/src/components/Bridge/SelectBridgeDialog/RouteCard.d.ts +21 -0
- package/dist/src/components/Bridge/SelectBridgeDialog/RouteTagList.d.ts +12 -0
- package/dist/src/components/Bridge/SelectBridgeDialog/TokenWithChain.d.ts +11 -0
- package/dist/src/components/Bridge/SelectBridgeDialog/index.d.ts +9 -0
- package/dist/src/components/Bridge/SelectBridgeDialog/productList.d.ts +5 -0
- package/dist/src/components/ErrorMessageDialog.d.ts +5 -0
- package/dist/src/components/Swap/components/SettingsDialog/index.d.ts +2 -1
- package/dist/src/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +2 -1
- package/dist/src/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +2 -1
- package/dist/src/components/Swap/components/TokenCard/index.d.ts +4 -1
- package/dist/src/components/SwitchChainDialog/index.d.ts +7 -0
- package/dist/src/components/TokenLogo.d.ts +2 -1
- package/dist/src/components/TokenPicker/SelectChainItem.d.ts +7 -0
- package/dist/src/components/TokenPicker/index.d.ts +2 -1
- package/dist/src/constants/api.d.ts +3 -0
- package/dist/src/constants/chainList.d.ts +10 -0
- package/dist/src/constants/chains.d.ts +5 -70
- package/dist/src/constants/localstorage.d.ts +2 -0
- package/dist/src/constants/swap.d.ts +1 -0
- package/dist/src/hooks/Bridge/createBridgeOrder.d.ts +24 -0
- package/dist/src/hooks/Bridge/index.d.ts +4 -0
- package/dist/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +6 -0
- package/dist/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +101 -0
- package/dist/src/hooks/Bridge/useFetchRoutePriceBridge.test.d.ts +1 -0
- package/dist/src/hooks/Bridge/useSendRoute.d.ts +16 -0
- package/dist/src/hooks/Bridge/useSwitchBridgeOrSwapSlippage.d.ts +1 -0
- package/dist/src/hooks/ConnectWallet/useSwitchChain.d.ts +10 -0
- package/dist/src/hooks/Submission/types.d.ts +2 -1
- package/dist/src/hooks/Submission/useExecution.d.ts +1 -1
- package/dist/src/hooks/Token/type.d.ts +1 -3
- package/dist/src/hooks/Token/useFetchTokenAllowance.d.ts +13 -0
- package/dist/src/hooks/Token/useGetCGTokenList.d.ts +6 -4
- package/dist/src/hooks/Token/useInitTokenList.d.ts +1 -1
- package/dist/src/hooks/Token/useSelectChainList.d.ts +77 -0
- package/dist/src/hooks/Token/useSelectChainList.test.d.ts +1 -0
- package/dist/src/hooks/Token/useTokenList.d.ts +5 -1
- package/dist/src/hooks/Token/useTokenListFetchBalance.d.ts +9 -0
- package/dist/src/hooks/Widget/useInitPropsToRedux.d.ts +1 -1
- package/dist/src/hooks/contract/contractConfig.d.ts +1 -26
- package/dist/src/hooks/contract/index.d.ts +1 -0
- package/dist/src/hooks/contract/token.d.ts +10 -0
- package/dist/src/hooks/contract/useFetchETHBalance.d.ts +1 -1
- package/dist/src/hooks/contract/useFetchTokens.d.ts +3 -1
- package/dist/src/hooks/contract/useMultiContract.d.ts +1 -21
- package/dist/src/store/actions/globals.d.ts +1 -0
- package/dist/src/store/actions/token.d.ts +1 -1
- package/dist/src/store/reducers/globals.d.ts +2 -0
- package/dist/src/store/reducers/token.d.ts +3 -1
- package/dist/src/store/selectors/globals.d.ts +1 -0
- package/dist/src/store/selectors/token.d.ts +3 -1
- package/dist/src/utils/address.d.ts +7 -0
- package/dist/src/utils/formatter.d.ts +2 -0
- package/dist/src/utils/time.d.ts +9 -0
- package/dist/src/utils/time.test.d.ts +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChainId } from '../../constants/chains';
|
|
2
|
+
/**
|
|
3
|
+
* switch wallet chain
|
|
4
|
+
* @see https://docs.metamask.io/guide/rpc-api.html#usage-with-wallet-switchethereumchain
|
|
5
|
+
*/
|
|
6
|
+
export declare function registerNetworkWithMetamask({ chainId, provider, }: {
|
|
7
|
+
chainId: ChainId;
|
|
8
|
+
provider?: any;
|
|
9
|
+
}): Promise<boolean>;
|
|
10
|
+
export declare function useSwitchChain(chainId?: ChainId): (() => Promise<boolean>) | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Step as StepSpec } from './spec';
|
|
3
|
+
import { ExecutionProps } from './useExecution';
|
|
3
4
|
export declare enum State {
|
|
4
5
|
Running = 0,
|
|
5
6
|
Success = 1,
|
|
@@ -35,7 +36,7 @@ export declare type ExecutionCtx = {
|
|
|
35
36
|
* @param mixpanelProps: mixpanel properties
|
|
36
37
|
* @param submittedConfirmBack: dismiss callback
|
|
37
38
|
*/
|
|
38
|
-
execute: (brief: string, spec: StepSpec, subtitle?: string | React.ReactNode | null, early?: boolean, submittedBack?: () => void, mixpanelProps?: Record<string, any>, submittedConfirmBack?: () => void, successBack?: (tx: string) => void) => Promise<ExecutionResult>;
|
|
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>;
|
|
39
40
|
/**
|
|
40
41
|
* order
|
|
41
42
|
*/
|
|
@@ -14,7 +14,7 @@ export default function useExecution({ onTxFail, onTxSubmit, onTxSuccess, }?: Ex
|
|
|
14
14
|
setErrorMessage: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
15
15
|
closeShowing: () => void;
|
|
16
16
|
ctxVal: {
|
|
17
|
-
execute: (brief: string, spec: StepSpec, subtitle?: string | React.ReactNode | null, early?: boolean, submittedBack?: () => void, mixpanelProps?: Record<string, any>, submittedConfirmBack?: () => void, successBack?: ((tx: string) => void) | undefined) => Promise<ExecutionResult.Failed | ExecutionResult.Success | ExecutionResult.Submitted>;
|
|
17
|
+
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>;
|
|
18
18
|
requests: Map<string, [Request, State]>;
|
|
19
19
|
setShowing: import("react").Dispatch<import("react").SetStateAction<Showing | null>>;
|
|
20
20
|
waitingSubmit: boolean;
|
|
@@ -14,9 +14,7 @@ export interface DefaultTokenInfo extends TokenInfo {
|
|
|
14
14
|
}
|
|
15
15
|
export declare type TokenList = TokenInfo[];
|
|
16
16
|
export declare enum TokenListType {
|
|
17
|
-
All = "all"
|
|
18
|
-
Default = "default",
|
|
19
|
-
Coingecko = "coingecko"
|
|
17
|
+
All = "all"
|
|
20
18
|
}
|
|
21
19
|
export declare enum ApprovalState {
|
|
22
20
|
Loading = "Loading",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { TokenInfo } from './type';
|
|
3
|
+
export declare function useFetchTokenAllowance({ chainId, account, token, proxyContractAddress, }: {
|
|
4
|
+
chainId?: number;
|
|
5
|
+
account?: string;
|
|
6
|
+
token?: TokenInfo;
|
|
7
|
+
proxyContractAddress: string;
|
|
8
|
+
}): {
|
|
9
|
+
allowance: BigNumber | null;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
error: boolean;
|
|
12
|
+
refetch: () => Promise<void>;
|
|
13
|
+
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TokenInfo } from './type';
|
|
1
|
+
import { TokenList } from './type';
|
|
3
2
|
export declare enum FetchStatus {
|
|
4
3
|
Initial = "Initial",
|
|
5
4
|
Loading = "Loading",
|
|
6
5
|
Failed = "Failed",
|
|
7
6
|
Success = "Success"
|
|
8
7
|
}
|
|
9
|
-
export declare function useGetCGTokenList(
|
|
10
|
-
|
|
8
|
+
export declare function useGetCGTokenList({ chainId, skip, }: {
|
|
9
|
+
chainId: number;
|
|
10
|
+
skip?: boolean;
|
|
11
|
+
}): {
|
|
12
|
+
cgTokenList: TokenList;
|
|
11
13
|
loading: boolean;
|
|
12
14
|
refetch: () => Promise<void>;
|
|
13
15
|
};
|
|
@@ -3,4 +3,4 @@ export interface InitTokenListProps {
|
|
|
3
3
|
tokenList?: TokenList | TokenListType;
|
|
4
4
|
popularTokenList?: TokenList;
|
|
5
5
|
}
|
|
6
|
-
export default function useInitTokenList({ tokenList, popularTokenList
|
|
6
|
+
export default function useInitTokenList({ tokenList, popularTokenList, }: InitTokenListProps): void;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ChainId } from '../../constants/chains';
|
|
3
|
+
export declare function useSelectChainList(): {
|
|
4
|
+
chainList: ({
|
|
5
|
+
chainId: ChainId;
|
|
6
|
+
logo: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
7
|
+
title?: string | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
name: string;
|
|
10
|
+
mainnet?: ChainId | undefined;
|
|
11
|
+
} | {
|
|
12
|
+
chainId: ChainId;
|
|
13
|
+
logo: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
14
|
+
title?: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
name: string;
|
|
17
|
+
mainnet?: ChainId | undefined;
|
|
18
|
+
} | {
|
|
19
|
+
chainId: ChainId;
|
|
20
|
+
logo: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
21
|
+
title?: string | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
name: string;
|
|
24
|
+
mainnet?: ChainId | undefined;
|
|
25
|
+
} | {
|
|
26
|
+
chainId: ChainId;
|
|
27
|
+
logo: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
28
|
+
title?: string | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
name: string;
|
|
31
|
+
mainnet?: ChainId | undefined;
|
|
32
|
+
} | {
|
|
33
|
+
chainId: ChainId;
|
|
34
|
+
logo: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
35
|
+
title?: string | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
name: string;
|
|
38
|
+
mainnet?: ChainId | undefined;
|
|
39
|
+
} | {
|
|
40
|
+
chainId: ChainId;
|
|
41
|
+
logo: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
42
|
+
title?: string | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
name: string;
|
|
45
|
+
mainnet?: ChainId | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
chainId: ChainId;
|
|
48
|
+
logo: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
49
|
+
title?: string | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
name: string;
|
|
52
|
+
mainnet?: ChainId | undefined;
|
|
53
|
+
} | {
|
|
54
|
+
chainId: ChainId;
|
|
55
|
+
logo: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
56
|
+
title?: string | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
name: string;
|
|
59
|
+
mainnet?: ChainId | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
chainId: ChainId;
|
|
62
|
+
logo: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
63
|
+
title?: string | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
name: string;
|
|
66
|
+
mainnet?: ChainId | undefined;
|
|
67
|
+
} | {
|
|
68
|
+
chainId: ChainId;
|
|
69
|
+
logo: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
70
|
+
title?: string | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
name: string;
|
|
73
|
+
mainnet?: ChainId | undefined;
|
|
74
|
+
})[];
|
|
75
|
+
selectChainId: number;
|
|
76
|
+
setSelectChainId: import("react").Dispatch<import("react").SetStateAction<number | undefined>>;
|
|
77
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { TokenInfo, TokenList } from './type';
|
|
|
3
3
|
export declare const getFuzzySearchTokenSort: (token: TokenInfo, search: string, { matchAddress, }?: {
|
|
4
4
|
matchAddress?: boolean | undefined;
|
|
5
5
|
}) => number;
|
|
6
|
-
export default function useTokenList({ value, onChange, occupiedAddrs, hiddenAddrs, showAddrs, side, }: {
|
|
6
|
+
export default function useTokenList({ value, onChange, occupiedAddrs, hiddenAddrs, showAddrs, side, chainId: chainIdProps, visible, defaultLoadBalance, }: {
|
|
7
7
|
value?: TokenInfo | null;
|
|
8
8
|
onChange: (token: TokenInfo, isOccupied: boolean) => void;
|
|
9
9
|
/** token pair usage */
|
|
@@ -14,6 +14,10 @@ export default function useTokenList({ value, onChange, occupiedAddrs, hiddenAdd
|
|
|
14
14
|
showAddrs?: string[];
|
|
15
15
|
/** token field control */
|
|
16
16
|
side?: 'from' | 'to';
|
|
17
|
+
chainId?: number;
|
|
18
|
+
/** Token Picker visible */
|
|
19
|
+
visible?: boolean;
|
|
20
|
+
defaultLoadBalance?: boolean;
|
|
17
21
|
}): {
|
|
18
22
|
filter: string;
|
|
19
23
|
setFilter: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TokenInfo, TokenList } from './type';
|
|
2
|
+
export default function useTokenListFetchBalance({ chainId, value, tokenList, popularTokenList, visible, defaultLoadBalance, }: {
|
|
3
|
+
chainId: number;
|
|
4
|
+
value?: TokenInfo | null;
|
|
5
|
+
tokenList: TokenList;
|
|
6
|
+
popularTokenList?: TokenList;
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
defaultLoadBalance?: boolean;
|
|
9
|
+
}): 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 }: WidgetProps): void;
|
|
2
|
+
export declare function useInitPropsToRedux({ width, height, feeRate, rebateTo, colorMode, apikey, defaultChainId, defaultToToken, defaultFromToken, jsonRpcUrlMap, }: WidgetProps): void;
|
|
@@ -4,11 +4,6 @@ declare const _default: {
|
|
|
4
4
|
DODO_APPROVE: string;
|
|
5
5
|
ERC20_HELPER: string;
|
|
6
6
|
};
|
|
7
|
-
4: {
|
|
8
|
-
MULTI_CALL: string;
|
|
9
|
-
DODO_APPROVE: string;
|
|
10
|
-
ERC20_HELPER: string;
|
|
11
|
-
};
|
|
12
7
|
5: {
|
|
13
8
|
MULTI_CALL: string;
|
|
14
9
|
DODO_APPROVE: string;
|
|
@@ -19,11 +14,6 @@ declare const _default: {
|
|
|
19
14
|
DODO_APPROVE: string;
|
|
20
15
|
ERC20_HELPER: string;
|
|
21
16
|
};
|
|
22
|
-
128: {
|
|
23
|
-
MULTI_CALL: string;
|
|
24
|
-
DODO_APPROVE: string;
|
|
25
|
-
ERC20_HELPER: string;
|
|
26
|
-
};
|
|
27
17
|
137: {
|
|
28
18
|
MULTI_CALL: string;
|
|
29
19
|
DODO_APPROVE: string;
|
|
@@ -34,21 +24,11 @@ declare const _default: {
|
|
|
34
24
|
DODO_APPROVE: string;
|
|
35
25
|
ERC20_HELPER: string;
|
|
36
26
|
};
|
|
37
|
-
421611: {
|
|
38
|
-
MULTI_CALL: string;
|
|
39
|
-
DODO_APPROVE: string;
|
|
40
|
-
ERC20_HELPER: string;
|
|
41
|
-
};
|
|
42
27
|
1313161554: {
|
|
43
28
|
MULTI_CALL: string;
|
|
44
29
|
DODO_APPROVE: string;
|
|
45
30
|
ERC20_HELPER: string;
|
|
46
31
|
};
|
|
47
|
-
1285: {
|
|
48
|
-
MULTI_CALL: string;
|
|
49
|
-
DODO_APPROVE: string;
|
|
50
|
-
ERC20_HELPER: string;
|
|
51
|
-
};
|
|
52
32
|
66: {
|
|
53
33
|
MULTI_CALL: string;
|
|
54
34
|
DODO_APPROVE: string;
|
|
@@ -59,17 +39,12 @@ declare const _default: {
|
|
|
59
39
|
DODO_APPROVE: string;
|
|
60
40
|
ERC20_HELPER: string;
|
|
61
41
|
};
|
|
62
|
-
288: {
|
|
63
|
-
MULTI_CALL: string;
|
|
64
|
-
DODO_APPROVE: string;
|
|
65
|
-
ERC20_HELPER: string;
|
|
66
|
-
};
|
|
67
42
|
43114: {
|
|
68
43
|
MULTI_CALL: string;
|
|
69
44
|
DODO_APPROVE: string;
|
|
70
45
|
ERC20_HELPER: string;
|
|
71
46
|
};
|
|
72
|
-
|
|
47
|
+
1030: {
|
|
73
48
|
MULTI_CALL: string;
|
|
74
49
|
DODO_APPROVE: string;
|
|
75
50
|
ERC20_HELPER: string;
|
|
@@ -2,3 +2,4 @@ export { default as useMultiContract, getContract } from './useMultiContract';
|
|
|
2
2
|
export { default as useFetchTokens } from './useFetchTokens';
|
|
3
3
|
export { default as useFetchETHBalance } from './useFetchETHBalance';
|
|
4
4
|
export { default as useFetchBlockNumber } from './useFetchBlockNumber';
|
|
5
|
+
export * from './token';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
+
import BigNumber from 'bignumber.js';
|
|
3
|
+
export declare function fetchTokenAllowance({ account, tokenAddress, tokenDecimals, chainId, approveAddress, provider, }: {
|
|
4
|
+
account?: string;
|
|
5
|
+
tokenAddress: string;
|
|
6
|
+
tokenDecimals: number;
|
|
7
|
+
chainId: number;
|
|
8
|
+
approveAddress?: string;
|
|
9
|
+
provider: JsonRpcProvider;
|
|
10
|
+
}): Promise<BigNumber | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useFetchETHBalance(): void;
|
|
1
|
+
export default function useFetchETHBalance(chainId?: number): void;
|
|
@@ -8,10 +8,12 @@ declare type TokenResult = {
|
|
|
8
8
|
symbol?: string;
|
|
9
9
|
name?: string;
|
|
10
10
|
};
|
|
11
|
-
export default function useFetchTokens({ tokenList, addresses: addressesProps, blockNumber, }: {
|
|
11
|
+
export default function useFetchTokens({ tokenList, addresses: addressesProps, blockNumber, chainId, skip, }: {
|
|
12
12
|
tokenList?: TokenList;
|
|
13
13
|
addresses?: string[];
|
|
14
14
|
blockNumber?: number;
|
|
15
|
+
chainId?: number;
|
|
16
|
+
skip?: boolean;
|
|
15
17
|
}): {
|
|
16
18
|
data: TokenResult[] | undefined;
|
|
17
19
|
};
|
|
@@ -2,7 +2,7 @@ import { Contract } from '@ethersproject/contracts';
|
|
|
2
2
|
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
3
3
|
import { BatchThunk } from './batch';
|
|
4
4
|
export declare function getContract(address: string, ABI: any, provider: JsonRpcProvider, account?: string): Contract;
|
|
5
|
-
export default function useMultiContract(): {
|
|
5
|
+
export default function useMultiContract(chainIdProps?: number): {
|
|
6
6
|
getContract: (contractAddress: string, ABI: any) => Contract | undefined;
|
|
7
7
|
contractConfig: {
|
|
8
8
|
MULTI_CALL: string;
|
|
@@ -44,26 +44,6 @@ export default function useMultiContract(): {
|
|
|
44
44
|
MULTI_CALL: string;
|
|
45
45
|
DODO_APPROVE: string;
|
|
46
46
|
ERC20_HELPER: string;
|
|
47
|
-
} | {
|
|
48
|
-
MULTI_CALL: string;
|
|
49
|
-
DODO_APPROVE: string;
|
|
50
|
-
ERC20_HELPER: string;
|
|
51
|
-
} | {
|
|
52
|
-
MULTI_CALL: string;
|
|
53
|
-
DODO_APPROVE: string;
|
|
54
|
-
ERC20_HELPER: string;
|
|
55
|
-
} | {
|
|
56
|
-
MULTI_CALL: string;
|
|
57
|
-
DODO_APPROVE: string;
|
|
58
|
-
ERC20_HELPER: string;
|
|
59
|
-
} | {
|
|
60
|
-
MULTI_CALL: string;
|
|
61
|
-
DODO_APPROVE: string;
|
|
62
|
-
ERC20_HELPER: string;
|
|
63
|
-
} | {
|
|
64
|
-
MULTI_CALL: string;
|
|
65
|
-
DODO_APPROVE: string;
|
|
66
|
-
ERC20_HELPER: string;
|
|
67
47
|
};
|
|
68
48
|
call: <T>(thunk: BatchThunk<T>) => Promise<unknown[] | undefined> | undefined;
|
|
69
49
|
loading: boolean;
|
|
@@ -7,7 +7,7 @@ export declare const setPopularTokenList: (popularTokenList: TokenList) => AppTh
|
|
|
7
7
|
export declare const setSlippageWithTokens: (slippageWithTokens: SlippageWithToken[]) => AppThunkAction;
|
|
8
8
|
export declare const setDefaultFromToken: (token: TokenInfo) => AppThunkAction;
|
|
9
9
|
export declare const setDefaultToToken: (token: TokenInfo) => AppThunkAction;
|
|
10
|
-
export declare const setEthBalance: (balance: BigNumber) => AppThunkAction;
|
|
10
|
+
export declare const setEthBalance: (chainId: number, balance: BigNumber) => AppThunkAction;
|
|
11
11
|
export declare const setTokenBalances: (accountBalances: AccountBalances) => AppThunkAction;
|
|
12
12
|
export declare const setTokenAllowances: (allowance: BigNumber) => AppThunkAction;
|
|
13
13
|
export declare const setBalanceLoadings: (balanceLoadings: {
|
|
@@ -10,6 +10,8 @@ export declare enum ContractStatus {
|
|
|
10
10
|
export interface State extends SwapWidgetProps {
|
|
11
11
|
isReverseRouting?: boolean;
|
|
12
12
|
contractStatus?: ContractStatus;
|
|
13
|
+
autoConnectLoading?: boolean;
|
|
14
|
+
showCoingecko?: boolean;
|
|
13
15
|
}
|
|
14
16
|
export declare const initialState: State;
|
|
15
17
|
declare const _default: (state: State | undefined, action: AnyAction) => State;
|
|
@@ -15,7 +15,9 @@ export declare type SlippageWithToken = {
|
|
|
15
15
|
export declare type State = {
|
|
16
16
|
tokenList: TokenList;
|
|
17
17
|
popularTokenList: TokenList;
|
|
18
|
-
ethBalance
|
|
18
|
+
ethBalance: {
|
|
19
|
+
[key: number]: BigNumber;
|
|
20
|
+
};
|
|
19
21
|
accountBalances: AccountBalances;
|
|
20
22
|
balanceLoadings: {
|
|
21
23
|
[key in string]: boolean;
|
|
@@ -6,7 +6,9 @@ export declare const getTokenList: (state?: RootState) => import("../../hooks/To
|
|
|
6
6
|
export declare const getPopularTokenList: (chainId: ChainId, state?: RootState) => import("../../hooks/Token").TokenInfo[];
|
|
7
7
|
export declare const getSlippageWithTokens: (state?: RootState) => import("../reducers/token").SlippageWithToken[];
|
|
8
8
|
export declare const getAccountBalances: (state?: RootState) => import("../reducers/token").AccountBalances;
|
|
9
|
-
export declare const getEthBalance: (state?: RootState) =>
|
|
9
|
+
export declare const getEthBalance: (state?: RootState) => {
|
|
10
|
+
[key: number]: BigNumber;
|
|
11
|
+
};
|
|
10
12
|
export declare const getDefaultFromToken: (state?: RootState) => DefaultTokenInfo | undefined;
|
|
11
13
|
export declare const getDefaultToToken: (state?: RootState) => DefaultTokenInfo | undefined;
|
|
12
14
|
export declare const getTokenBalance: (tokenAddress: string, state?: RootState) => BigNumber;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChainId } from '../constants/chains';
|
|
1
2
|
export declare const isSameAddress: (tokenAddress1: string, tokenAddress2: string) => boolean;
|
|
2
3
|
export declare function isAddress(value: any): string | false;
|
|
3
4
|
export declare function isETHAddress(addr: string): boolean;
|
|
@@ -6,3 +7,9 @@ export declare function isETHAddress(addr: string): boolean;
|
|
|
6
7
|
* @param hexNumberString
|
|
7
8
|
*/
|
|
8
9
|
export default function isZero(hexNumberString: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* truncate pool address: 0xeBa959390016dd81419A189e5ef6F3B6720e5A90 => 0xeBa9...5A90
|
|
12
|
+
* @param address pool address
|
|
13
|
+
*/
|
|
14
|
+
export declare function truncatePoolAddress(address: string): string;
|
|
15
|
+
export declare function getEtherscanPage(path: string | undefined, chainId: ChainId): string;
|
|
@@ -20,4 +20,6 @@ export declare function formatTokenAmountNumber({ input, decimals, showPrecision
|
|
|
20
20
|
export declare const fixedString: (raw: string | number | BigNumber, showDecimals?: number) => string;
|
|
21
21
|
export declare const fixedInputStringToFormattedNumber: (inputValue: string, inputTokenShowDecimals: number) => string | null;
|
|
22
22
|
export declare const toWei: (amount: BigNumber | string | number, decimals: number, notDp?: boolean) => BigNumber;
|
|
23
|
+
export declare const byWei: (amount: BigNumber | string | number, decimals: number) => BigNumber;
|
|
23
24
|
export declare const getDecimalLimit: (decimals: number | undefined | null) => number;
|
|
25
|
+
export declare function getIntegerNumber(v: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dodoex/widgets",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5-1",
|
|
4
4
|
"description": "DODO Widgets",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@babel/runtime": "^7.17.0",
|
|
57
|
-
"@dodoex/components": "^2.0.
|
|
58
|
-
"@dodoex/icons": "^2.0.
|
|
57
|
+
"@dodoex/components": "^2.0.1",
|
|
58
|
+
"@dodoex/icons": "^2.0.1",
|
|
59
59
|
"@emotion/react": "^11.10.0",
|
|
60
60
|
"@emotion/styled": "^11.10.0",
|
|
61
61
|
"@ethersproject/bignumber": "^5.6.2",
|
|
@@ -126,4 +126,4 @@
|
|
|
126
126
|
"ts-jest": "^29.0.1",
|
|
127
127
|
"typescript": "^4.7.3"
|
|
128
128
|
}
|
|
129
|
-
}
|
|
129
|
+
}
|