@dodoex/widgets 2.0.0

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.
Files changed (227) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +69 -0
  3. package/dist/cjs/e2e/connect.test.d.ts +6 -0
  4. package/dist/cjs/e2e/constants.d.ts +79 -0
  5. package/dist/cjs/e2e/default.test.d.ts +6 -0
  6. package/dist/cjs/e2e/setup.d.ts +4 -0
  7. package/dist/cjs/index.cjs +1 -0
  8. package/dist/cjs/locales/en-US.js +5 -0
  9. package/dist/cjs/locales/zh-CN.js +5 -0
  10. package/dist/cjs/src/components/Swap/components/ConnectWallet/ConnectWalletDialog.d.ts +5 -0
  11. package/dist/cjs/src/components/Swap/components/ConnectWallet/index.d.ts +9 -0
  12. package/dist/cjs/src/components/Swap/components/Dialog.d.ts +12 -0
  13. package/dist/cjs/src/components/Swap/components/ReviewDialog.d.ts +20 -0
  14. package/dist/cjs/src/components/Swap/components/SettingsDialog/NumberInput.d.ts +8 -0
  15. package/dist/cjs/src/components/Swap/components/SettingsDialog/index.d.ts +6 -0
  16. package/dist/cjs/src/components/Swap/components/SwitchBox.d.ts +4 -0
  17. package/dist/cjs/src/components/Swap/components/TokenCard/BalanceText.d.ts +9 -0
  18. package/dist/cjs/src/components/Swap/components/TokenCard/NumberInput.d.ts +12 -0
  19. package/dist/cjs/src/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +6 -0
  20. package/dist/cjs/src/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +10 -0
  21. package/dist/cjs/src/components/Swap/components/TokenCard/index.d.ts +16 -0
  22. package/dist/cjs/src/components/Swap/components/TokenPairPriceWithToggle.d.ts +10 -0
  23. package/dist/cjs/src/components/Swap/index.d.ts +2 -0
  24. package/dist/cjs/src/components/TokenLogo.d.ts +15 -0
  25. package/dist/cjs/src/components/TokenPicker/PopularToken.d.ts +7 -0
  26. package/dist/cjs/src/components/TokenPicker/TokenItem.d.ts +8 -0
  27. package/dist/cjs/src/components/TokenPicker/index.d.ts +14 -0
  28. package/dist/cjs/src/components/Tooltip/QuestionTooltip.d.ts +3 -0
  29. package/dist/cjs/src/components/Tooltip/index.d.ts +1 -0
  30. package/dist/cjs/src/components/Widget/i18n.d.ts +9 -0
  31. package/dist/cjs/src/components/Widget/index.d.ts +23 -0
  32. package/dist/cjs/src/components/WithExecutionDialog/index.d.ts +5 -0
  33. package/dist/cjs/src/constants/address.d.ts +1 -0
  34. package/dist/cjs/src/constants/api.d.ts +4 -0
  35. package/dist/cjs/src/constants/chains.d.ts +205 -0
  36. package/dist/cjs/src/constants/locales.d.ts +3 -0
  37. package/dist/cjs/src/constants/swap.d.ts +6 -0
  38. package/dist/cjs/src/constants/testId.d.ts +10 -0
  39. package/dist/cjs/src/constants/token.d.ts +2 -0
  40. package/dist/cjs/src/constants/tokenList.d.ts +9 -0
  41. package/dist/cjs/src/constants/wallet.d.ts +23 -0
  42. package/dist/cjs/src/hooks/ConnectWallet/Connectors/JsonRpcConnector.d.ts +6 -0
  43. package/dist/cjs/src/hooks/ConnectWallet/index.d.ts +3 -0
  44. package/dist/cjs/src/hooks/ConnectWallet/useCurrentChainId.d.ts +2 -0
  45. package/dist/cjs/src/hooks/ConnectWallet/useWeb3Connectors.d.ts +14 -0
  46. package/dist/cjs/src/hooks/ConnectWallet/web3.d.ts +10 -0
  47. package/dist/cjs/src/hooks/Submission/getExecutionErrorMsg.d.ts +2 -0
  48. package/dist/cjs/src/hooks/Submission/index.d.ts +10 -0
  49. package/dist/cjs/src/hooks/Submission/spec.d.ts +56 -0
  50. package/dist/cjs/src/hooks/Submission/types.d.ts +49 -0
  51. package/dist/cjs/src/hooks/Submission/useExecution.d.ts +23 -0
  52. package/dist/cjs/src/hooks/Submission/useInflights.d.ts +5 -0
  53. package/dist/cjs/src/hooks/Swap/index.d.ts +5 -0
  54. package/dist/cjs/src/hooks/Swap/useExecuteSwap.d.ts +14 -0
  55. package/dist/cjs/src/hooks/Swap/useFetchFiatPrice.d.ts +13 -0
  56. package/dist/cjs/src/hooks/Swap/useFetchFiatPrice.test.d.ts +1 -0
  57. package/dist/cjs/src/hooks/Swap/useFetchRoutePrice.d.ts +25 -0
  58. package/dist/cjs/src/hooks/Swap/useFetchRoutePrice.test.d.ts +1 -0
  59. package/dist/cjs/src/hooks/Swap/useMarginAmount.d.ts +8 -0
  60. package/dist/cjs/src/hooks/Swap/useMarginAmount.test.d.ts +1 -0
  61. package/dist/cjs/src/hooks/Swap/usePriceTimer.d.ts +5 -0
  62. package/dist/cjs/src/hooks/Token/index.d.ts +4 -0
  63. package/dist/cjs/src/hooks/Token/type.d.ts +18 -0
  64. package/dist/cjs/src/hooks/Token/useFindTokenByAddress.d.ts +1 -0
  65. package/dist/cjs/src/hooks/Token/useFindTokenByAddress.test.d.ts +1 -0
  66. package/dist/cjs/src/hooks/Token/useGetAllowance.d.ts +3 -0
  67. package/dist/cjs/src/hooks/Token/useGetAllowance.test.d.ts +1 -0
  68. package/dist/cjs/src/hooks/Token/useGetBalance.d.ts +2 -0
  69. package/dist/cjs/src/hooks/Token/useGetBalance.test.d.ts +1 -0
  70. package/dist/cjs/src/hooks/Token/useGetTokenStatus.d.ts +13 -0
  71. package/dist/cjs/src/hooks/Token/useGetTokenStatus.test.d.ts +1 -0
  72. package/dist/cjs/src/hooks/Token/useInitTokenList.d.ts +6 -0
  73. package/dist/cjs/src/hooks/Token/useTokenList.d.ts +20 -0
  74. package/dist/cjs/src/hooks/Token/useTokenList.test.d.ts +1 -0
  75. package/dist/cjs/src/hooks/Widget/useInitPropsToRedux.d.ts +2 -0
  76. package/dist/cjs/src/hooks/contract/abis/erc20ABI.d.ts +30 -0
  77. package/dist/cjs/src/hooks/contract/abis/erc20Helper.d.ts +16 -0
  78. package/dist/cjs/src/hooks/contract/abis/multicallABI.d.ts +34 -0
  79. package/dist/cjs/src/hooks/contract/batch.d.ts +18 -0
  80. package/dist/cjs/src/hooks/contract/contractConfig.d.ts +78 -0
  81. package/dist/cjs/src/hooks/contract/index.d.ts +4 -0
  82. package/dist/cjs/src/hooks/contract/useFetchBlockNumber.d.ts +1 -0
  83. package/dist/cjs/src/hooks/contract/useFetchETHBalance.d.ts +1 -0
  84. package/dist/cjs/src/hooks/contract/useFetchTokens.d.ts +18 -0
  85. package/dist/cjs/src/hooks/contract/useMultiContract.d.ts +70 -0
  86. package/dist/cjs/src/hooks/contract/wallet.d.ts +16 -0
  87. package/dist/cjs/src/index.d.ts +5 -0
  88. package/dist/cjs/src/store/actions/globals.d.ts +3 -0
  89. package/dist/cjs/src/store/actions/index.d.ts +4 -0
  90. package/dist/cjs/src/store/actions/settings.d.ts +6 -0
  91. package/dist/cjs/src/store/actions/token.d.ts +15 -0
  92. package/dist/cjs/src/store/actions/wallet.d.ts +4 -0
  93. package/dist/cjs/src/store/index.d.ts +6 -0
  94. package/dist/cjs/src/store/reducers/globals.d.ts +6 -0
  95. package/dist/cjs/src/store/reducers/index.d.ts +17 -0
  96. package/dist/cjs/src/store/reducers/settings.d.ts +13 -0
  97. package/dist/cjs/src/store/reducers/token.d.ts +29 -0
  98. package/dist/cjs/src/store/reducers/wallet.d.ts +9 -0
  99. package/dist/cjs/src/store/selectors/globals.d.ts +2 -0
  100. package/dist/cjs/src/store/selectors/settings.d.ts +4 -0
  101. package/dist/cjs/src/store/selectors/token.d.ts +16 -0
  102. package/dist/cjs/src/store/selectors/wallet.d.ts +3 -0
  103. package/dist/cjs/src/utils/address.d.ts +7 -0
  104. package/dist/cjs/src/utils/address.test.d.ts +1 -0
  105. package/dist/cjs/src/utils/chains.d.ts +2 -0
  106. package/dist/cjs/src/utils/chains.test.d.ts +1 -0
  107. package/dist/cjs/src/utils/formatter.d.ts +23 -0
  108. package/dist/cjs/src/utils/formatter.test.d.ts +1 -0
  109. package/dist/cjs/src/utils/index.d.ts +5 -0
  110. package/dist/cjs/src/utils/token.d.ts +9 -0
  111. package/dist/cjs/src/utils/token.test.d.ts +1 -0
  112. package/dist/cjs/src/utils/wallet.d.ts +8 -0
  113. package/dist/cjs/src/utils/wallet.test.d.ts +1 -0
  114. package/dist/cjs/tokenList-ee5e15c8.cjs +1 -0
  115. package/dist/e2e/connect.test.d.ts +6 -0
  116. package/dist/e2e/constants.d.ts +79 -0
  117. package/dist/e2e/default.test.d.ts +6 -0
  118. package/dist/e2e/setup.d.ts +4 -0
  119. package/dist/index.js +1 -0
  120. package/dist/locales/en-US.js +5 -0
  121. package/dist/locales/zh-CN.js +5 -0
  122. package/dist/src/components/Swap/components/ConnectWallet/ConnectWalletDialog.d.ts +5 -0
  123. package/dist/src/components/Swap/components/ConnectWallet/index.d.ts +9 -0
  124. package/dist/src/components/Swap/components/Dialog.d.ts +12 -0
  125. package/dist/src/components/Swap/components/ReviewDialog.d.ts +20 -0
  126. package/dist/src/components/Swap/components/SettingsDialog/NumberInput.d.ts +8 -0
  127. package/dist/src/components/Swap/components/SettingsDialog/index.d.ts +6 -0
  128. package/dist/src/components/Swap/components/SwitchBox.d.ts +4 -0
  129. package/dist/src/components/Swap/components/TokenCard/BalanceText.d.ts +9 -0
  130. package/dist/src/components/Swap/components/TokenCard/NumberInput.d.ts +12 -0
  131. package/dist/src/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +6 -0
  132. package/dist/src/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +10 -0
  133. package/dist/src/components/Swap/components/TokenCard/index.d.ts +16 -0
  134. package/dist/src/components/Swap/components/TokenPairPriceWithToggle.d.ts +10 -0
  135. package/dist/src/components/Swap/index.d.ts +2 -0
  136. package/dist/src/components/TokenLogo.d.ts +15 -0
  137. package/dist/src/components/TokenPicker/PopularToken.d.ts +7 -0
  138. package/dist/src/components/TokenPicker/TokenItem.d.ts +8 -0
  139. package/dist/src/components/TokenPicker/index.d.ts +14 -0
  140. package/dist/src/components/Tooltip/QuestionTooltip.d.ts +3 -0
  141. package/dist/src/components/Tooltip/index.d.ts +1 -0
  142. package/dist/src/components/Widget/i18n.d.ts +9 -0
  143. package/dist/src/components/Widget/index.d.ts +23 -0
  144. package/dist/src/components/WithExecutionDialog/index.d.ts +5 -0
  145. package/dist/src/constants/address.d.ts +1 -0
  146. package/dist/src/constants/api.d.ts +4 -0
  147. package/dist/src/constants/chains.d.ts +205 -0
  148. package/dist/src/constants/locales.d.ts +3 -0
  149. package/dist/src/constants/swap.d.ts +6 -0
  150. package/dist/src/constants/testId.d.ts +10 -0
  151. package/dist/src/constants/token.d.ts +2 -0
  152. package/dist/src/constants/tokenList.d.ts +9 -0
  153. package/dist/src/constants/wallet.d.ts +23 -0
  154. package/dist/src/hooks/ConnectWallet/Connectors/JsonRpcConnector.d.ts +6 -0
  155. package/dist/src/hooks/ConnectWallet/index.d.ts +3 -0
  156. package/dist/src/hooks/ConnectWallet/useCurrentChainId.d.ts +2 -0
  157. package/dist/src/hooks/ConnectWallet/useWeb3Connectors.d.ts +14 -0
  158. package/dist/src/hooks/ConnectWallet/web3.d.ts +10 -0
  159. package/dist/src/hooks/Submission/getExecutionErrorMsg.d.ts +2 -0
  160. package/dist/src/hooks/Submission/index.d.ts +10 -0
  161. package/dist/src/hooks/Submission/spec.d.ts +56 -0
  162. package/dist/src/hooks/Submission/types.d.ts +49 -0
  163. package/dist/src/hooks/Submission/useExecution.d.ts +23 -0
  164. package/dist/src/hooks/Submission/useInflights.d.ts +5 -0
  165. package/dist/src/hooks/Swap/index.d.ts +5 -0
  166. package/dist/src/hooks/Swap/useExecuteSwap.d.ts +14 -0
  167. package/dist/src/hooks/Swap/useFetchFiatPrice.d.ts +13 -0
  168. package/dist/src/hooks/Swap/useFetchFiatPrice.test.d.ts +1 -0
  169. package/dist/src/hooks/Swap/useFetchRoutePrice.d.ts +25 -0
  170. package/dist/src/hooks/Swap/useFetchRoutePrice.test.d.ts +1 -0
  171. package/dist/src/hooks/Swap/useMarginAmount.d.ts +8 -0
  172. package/dist/src/hooks/Swap/useMarginAmount.test.d.ts +1 -0
  173. package/dist/src/hooks/Swap/usePriceTimer.d.ts +5 -0
  174. package/dist/src/hooks/Token/index.d.ts +4 -0
  175. package/dist/src/hooks/Token/type.d.ts +18 -0
  176. package/dist/src/hooks/Token/useFindTokenByAddress.d.ts +1 -0
  177. package/dist/src/hooks/Token/useFindTokenByAddress.test.d.ts +1 -0
  178. package/dist/src/hooks/Token/useGetAllowance.d.ts +3 -0
  179. package/dist/src/hooks/Token/useGetAllowance.test.d.ts +1 -0
  180. package/dist/src/hooks/Token/useGetBalance.d.ts +2 -0
  181. package/dist/src/hooks/Token/useGetBalance.test.d.ts +1 -0
  182. package/dist/src/hooks/Token/useGetTokenStatus.d.ts +13 -0
  183. package/dist/src/hooks/Token/useGetTokenStatus.test.d.ts +1 -0
  184. package/dist/src/hooks/Token/useInitTokenList.d.ts +6 -0
  185. package/dist/src/hooks/Token/useTokenList.d.ts +20 -0
  186. package/dist/src/hooks/Token/useTokenList.test.d.ts +1 -0
  187. package/dist/src/hooks/Widget/useInitPropsToRedux.d.ts +2 -0
  188. package/dist/src/hooks/contract/abis/erc20ABI.d.ts +30 -0
  189. package/dist/src/hooks/contract/abis/erc20Helper.d.ts +16 -0
  190. package/dist/src/hooks/contract/abis/multicallABI.d.ts +34 -0
  191. package/dist/src/hooks/contract/batch.d.ts +18 -0
  192. package/dist/src/hooks/contract/contractConfig.d.ts +78 -0
  193. package/dist/src/hooks/contract/index.d.ts +4 -0
  194. package/dist/src/hooks/contract/useFetchBlockNumber.d.ts +1 -0
  195. package/dist/src/hooks/contract/useFetchETHBalance.d.ts +1 -0
  196. package/dist/src/hooks/contract/useFetchTokens.d.ts +18 -0
  197. package/dist/src/hooks/contract/useMultiContract.d.ts +70 -0
  198. package/dist/src/hooks/contract/wallet.d.ts +16 -0
  199. package/dist/src/index.d.ts +5 -0
  200. package/dist/src/store/actions/globals.d.ts +3 -0
  201. package/dist/src/store/actions/index.d.ts +4 -0
  202. package/dist/src/store/actions/settings.d.ts +6 -0
  203. package/dist/src/store/actions/token.d.ts +15 -0
  204. package/dist/src/store/actions/wallet.d.ts +4 -0
  205. package/dist/src/store/index.d.ts +6 -0
  206. package/dist/src/store/reducers/globals.d.ts +6 -0
  207. package/dist/src/store/reducers/index.d.ts +17 -0
  208. package/dist/src/store/reducers/settings.d.ts +13 -0
  209. package/dist/src/store/reducers/token.d.ts +29 -0
  210. package/dist/src/store/reducers/wallet.d.ts +9 -0
  211. package/dist/src/store/selectors/globals.d.ts +2 -0
  212. package/dist/src/store/selectors/settings.d.ts +4 -0
  213. package/dist/src/store/selectors/token.d.ts +16 -0
  214. package/dist/src/store/selectors/wallet.d.ts +3 -0
  215. package/dist/src/utils/address.d.ts +7 -0
  216. package/dist/src/utils/address.test.d.ts +1 -0
  217. package/dist/src/utils/chains.d.ts +2 -0
  218. package/dist/src/utils/chains.test.d.ts +1 -0
  219. package/dist/src/utils/formatter.d.ts +23 -0
  220. package/dist/src/utils/formatter.test.d.ts +1 -0
  221. package/dist/src/utils/index.d.ts +5 -0
  222. package/dist/src/utils/token.d.ts +9 -0
  223. package/dist/src/utils/token.test.d.ts +1 -0
  224. package/dist/src/utils/wallet.d.ts +8 -0
  225. package/dist/src/utils/wallet.test.d.ts +1 -0
  226. package/dist/tokenList-4ef211de.js +1 -0
  227. package/package.json +128 -0
@@ -0,0 +1,3 @@
1
+ import { TokenInfo } from './type';
2
+ import BigNumber from 'bignumber.js';
3
+ export default function useGetAllowance(contract: string | null): (token: TokenInfo) => BigNumber | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { TokenInfo } from './type';
2
+ export default function useGetBalance(): (token: TokenInfo) => import("bignumber.js").BigNumber | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { TokenInfo, ApprovalState } from './type';
3
+ export declare const useGetTokenStatus: ({ account, chainId, offset, contractAddress, }: {
4
+ account?: string | undefined;
5
+ chainId: number | undefined;
6
+ offset?: BigNumber | undefined;
7
+ contractAddress?: string | undefined;
8
+ }) => {
9
+ getApprovalState: (token: TokenInfo | null, value: string | number | BigNumber, overrideBalance?: BigNumber) => ApprovalState;
10
+ getPendingRest: (token?: TokenInfo | null) => boolean;
11
+ getMaxBalance: (token: TokenInfo | null) => number;
12
+ submitApprove: (token: TokenInfo | null, isReset?: boolean) => Promise<void>;
13
+ };
@@ -0,0 +1,6 @@
1
+ import { TokenList } from './type';
2
+ export interface InitTokenListProps {
3
+ tokenList?: TokenList;
4
+ popularTokenList?: TokenList;
5
+ }
6
+ export default function useInitTokenList({ tokenList, popularTokenList: popularTokenListProps, }: InitTokenListProps): void;
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { TokenInfo, TokenList } from './type';
3
+ export declare const getFuzzySearchTokenSort: (token: TokenInfo, search: string, { matchAddress, }?: {
4
+ matchAddress?: boolean | undefined;
5
+ }) => number;
6
+ export default function useTokenList({ value, onChange, occupiedAddrs, hiddenAddrs, showAddrs, }: {
7
+ value?: TokenInfo | null;
8
+ onChange: (token: TokenInfo, isOccupied: boolean) => void;
9
+ /** token pair usage */
10
+ occupiedAddrs?: string[];
11
+ /** hide props */
12
+ hiddenAddrs?: string[];
13
+ /** only show props */
14
+ showAddrs?: string[];
15
+ }): {
16
+ filter: string;
17
+ setFilter: import("react").Dispatch<import("react").SetStateAction<string>>;
18
+ showTokenList: TokenList;
19
+ onSelectToken: (token: TokenInfo) => void;
20
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { WidgetProps } from '../../components/Widget/';
2
+ export declare function useInitPropsToRedux({ width, height, feeRate, rebateTo, colorMode, accessToken, defaultChainId, defaultToToken, defaultFromToken }: WidgetProps): void;
@@ -0,0 +1,30 @@
1
+ declare const _default: ({
2
+ constant: boolean;
3
+ inputs: {
4
+ name: string;
5
+ type: string;
6
+ }[];
7
+ name: string;
8
+ outputs: {
9
+ name: string;
10
+ type: string;
11
+ }[];
12
+ payable: boolean;
13
+ stateMutability: "nonpayable";
14
+ type: "function";
15
+ } | {
16
+ constant: boolean;
17
+ inputs: {
18
+ name: string;
19
+ type: string;
20
+ }[];
21
+ name: string;
22
+ outputs: {
23
+ name: string;
24
+ type: string;
25
+ }[];
26
+ payable: boolean;
27
+ stateMutability: "view";
28
+ type: "function";
29
+ })[];
30
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare const _default: {
2
+ inputs: {
3
+ internalType: string;
4
+ name: string;
5
+ type: string;
6
+ }[];
7
+ name: string;
8
+ outputs: {
9
+ internalType: string;
10
+ name: string;
11
+ type: string;
12
+ }[];
13
+ stateMutability: string;
14
+ type: string;
15
+ }[];
16
+ export default _default;
@@ -0,0 +1,34 @@
1
+ declare const _default: ({
2
+ constant: boolean;
3
+ inputs: {
4
+ components: {
5
+ name: string;
6
+ type: string;
7
+ }[];
8
+ name: string;
9
+ type: string;
10
+ }[];
11
+ name: string;
12
+ outputs: {
13
+ name: string;
14
+ type: string;
15
+ }[];
16
+ payable: boolean;
17
+ stateMutability: string;
18
+ type: string;
19
+ } | {
20
+ constant: boolean;
21
+ inputs: {
22
+ name: string;
23
+ type: string;
24
+ }[];
25
+ name: string;
26
+ outputs: {
27
+ name: string;
28
+ type: string;
29
+ }[];
30
+ payable: boolean;
31
+ stateMutability: string;
32
+ type: string;
33
+ })[];
34
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import { Contract } from '@ethersproject/contracts';
2
+ interface Web3CallData {
3
+ to: string;
4
+ data: string;
5
+ }
6
+ interface RequestThunk<T> {
7
+ callData: Web3CallData | null;
8
+ processor: (_: any, index: number) => T;
9
+ }
10
+ export declare type BatchThunk<T> = RequestThunk<T>[];
11
+ declare type BatchThunkAll<Ts extends any[]> = {
12
+ [Tidx in keyof Ts]: Ts[Tidx] extends Ts[number] ? BatchThunk<Ts[Tidx]> : never;
13
+ };
14
+ declare type BatchThunkAllResult<Ts extends any[]> = {
15
+ [Tidx in keyof Ts]: Ts[Tidx] extends Ts[number] ? Array<Ts[Tidx]> : never;
16
+ };
17
+ export declare function runAll<Ts extends any[]>(contract: Contract, contractAddress: string, ...batches: BatchThunkAll<Ts>): Promise<BatchThunkAllResult<Ts>>;
18
+ export {};
@@ -0,0 +1,78 @@
1
+ declare const _default: {
2
+ 1: {
3
+ MULTI_CALL: string;
4
+ DODO_APPROVE: string;
5
+ ERC20_HELPER: string;
6
+ };
7
+ 4: {
8
+ MULTI_CALL: string;
9
+ DODO_APPROVE: string;
10
+ ERC20_HELPER: string;
11
+ };
12
+ 5: {
13
+ MULTI_CALL: string;
14
+ DODO_APPROVE: string;
15
+ ERC20_HELPER: string;
16
+ };
17
+ 56: {
18
+ MULTI_CALL: string;
19
+ DODO_APPROVE: string;
20
+ ERC20_HELPER: string;
21
+ };
22
+ 128: {
23
+ MULTI_CALL: string;
24
+ DODO_APPROVE: string;
25
+ ERC20_HELPER: string;
26
+ };
27
+ 137: {
28
+ MULTI_CALL: string;
29
+ DODO_APPROVE: string;
30
+ ERC20_HELPER: string;
31
+ };
32
+ 42161: {
33
+ MULTI_CALL: string;
34
+ DODO_APPROVE: string;
35
+ ERC20_HELPER: string;
36
+ };
37
+ 421611: {
38
+ MULTI_CALL: string;
39
+ DODO_APPROVE: string;
40
+ ERC20_HELPER: string;
41
+ };
42
+ 1313161554: {
43
+ MULTI_CALL: string;
44
+ DODO_APPROVE: string;
45
+ ERC20_HELPER: string;
46
+ };
47
+ 1285: {
48
+ MULTI_CALL: string;
49
+ DODO_APPROVE: string;
50
+ ERC20_HELPER: string;
51
+ };
52
+ 66: {
53
+ MULTI_CALL: string;
54
+ DODO_APPROVE: string;
55
+ ERC20_HELPER: string;
56
+ };
57
+ 10: {
58
+ MULTI_CALL: string;
59
+ DODO_APPROVE: string;
60
+ ERC20_HELPER: string;
61
+ };
62
+ 288: {
63
+ MULTI_CALL: string;
64
+ DODO_APPROVE: string;
65
+ ERC20_HELPER: string;
66
+ };
67
+ 43114: {
68
+ MULTI_CALL: string;
69
+ DODO_APPROVE: string;
70
+ ERC20_HELPER: string;
71
+ };
72
+ 25: {
73
+ MULTI_CALL: string;
74
+ DODO_APPROVE: string;
75
+ ERC20_HELPER: string;
76
+ };
77
+ };
78
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export { default as useMultiContract, getContract } from './useMultiContract';
2
+ export { default as useFetchTokens } from './useFetchTokens';
3
+ export { default as useFetchETHBalance } from './useFetchETHBalance';
4
+ export { default as useFetchBlockNumber } from './useFetchBlockNumber';
@@ -0,0 +1 @@
1
+ export default function useFetchBlockNumber(): void;
@@ -0,0 +1 @@
1
+ export default function useFetchETHBalance(): void;
@@ -0,0 +1,18 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { TokenList } from '../Token';
3
+ declare type TokenResult = {
4
+ address: string;
5
+ balance: BigNumber;
6
+ allowance: BigNumber;
7
+ decimals?: number;
8
+ symbol?: string;
9
+ name?: string;
10
+ };
11
+ export default function useFetchTokens({ tokenList, addresses: addressesProps, blockNumber, }: {
12
+ tokenList?: TokenList;
13
+ addresses?: string[];
14
+ blockNumber?: number;
15
+ }): {
16
+ data: TokenResult[] | undefined;
17
+ };
18
+ export {};
@@ -0,0 +1,70 @@
1
+ import { Contract } from '@ethersproject/contracts';
2
+ import { JsonRpcProvider } from '@ethersproject/providers';
3
+ import { BatchThunk } from './batch';
4
+ export declare function getContract(address: string, ABI: any, provider: JsonRpcProvider, account?: string): Contract;
5
+ export default function useMultiContract(): {
6
+ getContract: (contractAddress: string, ABI: any) => Contract | undefined;
7
+ contractConfig: {
8
+ MULTI_CALL: string;
9
+ DODO_APPROVE: string;
10
+ ERC20_HELPER: string;
11
+ } | {
12
+ MULTI_CALL: string;
13
+ DODO_APPROVE: string;
14
+ ERC20_HELPER: string;
15
+ } | {
16
+ MULTI_CALL: string;
17
+ DODO_APPROVE: string;
18
+ ERC20_HELPER: string;
19
+ } | {
20
+ MULTI_CALL: string;
21
+ DODO_APPROVE: string;
22
+ ERC20_HELPER: string;
23
+ } | {
24
+ MULTI_CALL: string;
25
+ DODO_APPROVE: string;
26
+ ERC20_HELPER: string;
27
+ } | {
28
+ MULTI_CALL: string;
29
+ DODO_APPROVE: string;
30
+ ERC20_HELPER: string;
31
+ } | {
32
+ MULTI_CALL: string;
33
+ DODO_APPROVE: string;
34
+ ERC20_HELPER: string;
35
+ } | {
36
+ MULTI_CALL: string;
37
+ DODO_APPROVE: string;
38
+ ERC20_HELPER: string;
39
+ } | {
40
+ MULTI_CALL: string;
41
+ DODO_APPROVE: string;
42
+ ERC20_HELPER: string;
43
+ } | {
44
+ MULTI_CALL: string;
45
+ DODO_APPROVE: string;
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
+ };
68
+ call: <T>(thunk: BatchThunk<T>) => Promise<unknown[] | undefined> | undefined;
69
+ loading: boolean;
70
+ };
@@ -0,0 +1,16 @@
1
+ import { JsonRpcProvider } from '@ethersproject/providers';
2
+ import type { TransactionRequest } from '@ethersproject/abstract-provider';
3
+ import { BigNumber as EthersBigNumber } from '@ethersproject/bignumber';
4
+ import BigNumber from 'bignumber.js';
5
+ export declare type Deferrable<T> = {
6
+ [K in keyof T]: T[K] | Promise<T[K]>;
7
+ };
8
+ export declare enum WatchResult {
9
+ Failed = 0,
10
+ Success = 1,
11
+ Warning = 2
12
+ }
13
+ export declare const getEstimateGas: (params: any, provider: JsonRpcProvider) => Promise<EthersBigNumber | null>;
14
+ export declare const getGasPrice: (provider: JsonRpcProvider) => Promise<EthersBigNumber | null>;
15
+ export declare const sendTransaction: (params: Deferrable<TransactionRequest>, provider: JsonRpcProvider) => Promise<import("@ethersproject/abstract-provider").TransactionResponse>;
16
+ export declare const approve: (tokenAddress: string, accountAddress: string, contractAddress: string, allowance: BigNumber, provider: JsonRpcProvider, account?: string) => Promise<import("@ethersproject/abstract-provider").TransactionResponse>;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { WidgetProps } from './components/Widget';
3
+ export declare type SwapWidgetProps = WidgetProps;
4
+ export declare function SwapWidget(props: SwapWidgetProps): JSX.Element;
5
+ export declare function InitSwapWidget(props: SwapWidgetProps): void;
@@ -0,0 +1,3 @@
1
+ import { AppThunkAction } from '.';
2
+ import { State } from '../reducers/globals';
3
+ export declare const setGlobalProps: (globalProps: Partial<State>) => AppThunkAction;
@@ -0,0 +1,4 @@
1
+ import { Action, ThunkAction, ThunkDispatch } from '@reduxjs/toolkit';
2
+ import { RootState } from '../reducers';
3
+ export declare type AppThunkAction<Ret = void> = ThunkAction<Ret, RootState, unknown, Action<string>>;
4
+ export declare type AppThunkDispatch = ThunkDispatch<RootState, unknown, Action<string>>;
@@ -0,0 +1,6 @@
1
+ import { AppThunkAction } from '.';
2
+ import { Slippage, TxDdl } from '../reducers/settings';
3
+ import { ColorMode } from '../reducers/settings';
4
+ export declare const setColorMode: (colorMode: ColorMode) => AppThunkAction;
5
+ export declare const setSlippage: (slippage: Slippage) => AppThunkAction;
6
+ export declare const setTxDdl: (ddl: TxDdl) => AppThunkAction;
@@ -0,0 +1,15 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { AppThunkAction } from '.';
3
+ import { TokenList, TokenInfo } from '../../hooks/Token';
4
+ import { AccountBalances, SlippageWithToken } from '../reducers/token';
5
+ export declare const setTokenList: (tokenList: TokenList) => AppThunkAction;
6
+ export declare const setPopularTokenList: (popularTokenList: TokenList) => AppThunkAction;
7
+ export declare const setSlippageWithTokens: (slippageWithTokens: SlippageWithToken[]) => AppThunkAction;
8
+ export declare const setDefaultFromToken: (token: TokenInfo) => AppThunkAction;
9
+ export declare const setDefaultToToken: (token: TokenInfo) => AppThunkAction;
10
+ export declare const setEthBalance: (balance: BigNumber) => AppThunkAction;
11
+ export declare const setTokenBalances: (accountBalances: AccountBalances) => AppThunkAction;
12
+ export declare const setTokenAllowances: (allowance: BigNumber) => AppThunkAction;
13
+ export declare const setBalanceLoadings: (balanceLoadings: {
14
+ [x: string]: boolean;
15
+ }) => AppThunkAction;
@@ -0,0 +1,4 @@
1
+ import { AppThunkAction } from '.';
2
+ import { ChainId } from '../../constants/chains';
3
+ export declare const setDefaultChainId: (chainId: ChainId) => AppThunkAction;
4
+ export declare const setBlockNumber: (blockNumber: number) => AppThunkAction;
@@ -0,0 +1,6 @@
1
+ export declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").CombinedState<{
2
+ settings: import("./reducers/settings").State;
3
+ wallet: import("./reducers/wallet").State;
4
+ token: import("./reducers/token").State;
5
+ globals: import("../components/Widget").WidgetProps;
6
+ }>, import("redux").AnyAction, any>;
@@ -0,0 +1,6 @@
1
+ import { AnyAction } from 'redux';
2
+ import { SwapWidgetProps } from '../..';
3
+ export declare type State = SwapWidgetProps;
4
+ export declare const initialState: State;
5
+ declare const _default: (state: import("../../components/Widget").WidgetProps | undefined, action: AnyAction) => State;
6
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { State as settingsState } from './settings';
2
+ import { State as walletState } from './wallet';
3
+ import { State as tokenState } from './token';
4
+ import { State as globalState } from './globals';
5
+ export interface RootState {
6
+ settings: settingsState;
7
+ wallet: walletState;
8
+ token: tokenState;
9
+ globals: globalState;
10
+ }
11
+ declare const _default: () => import("redux").Reducer<import("redux").CombinedState<{
12
+ settings: settingsState;
13
+ wallet: walletState;
14
+ token: tokenState;
15
+ globals: import("../../components/Widget").WidgetProps;
16
+ }>, import("redux").AnyAction>;
17
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import { AnyAction } from 'redux';
2
+ import { PaletteMode } from '@dodoex/components';
3
+ export declare type ColorMode = PaletteMode | 'system';
4
+ export declare type Slippage = string | null;
5
+ export declare type TxDdl = number | '';
6
+ export declare type State = {
7
+ colorMode: ColorMode;
8
+ slippage: Slippage;
9
+ ddl: TxDdl;
10
+ };
11
+ export declare const initialState: State;
12
+ declare const _default: (state: State | undefined, action: AnyAction) => State;
13
+ export default _default;
@@ -0,0 +1,29 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { AnyAction } from 'redux';
3
+ import type { TokenList, TokenInfo } from '../../hooks/Token';
4
+ export declare type AccountBalance = {
5
+ tokenBalances?: BigNumber;
6
+ tokenAllowances?: BigNumber;
7
+ };
8
+ export declare type AccountBalances = {
9
+ [key in string]: AccountBalance;
10
+ };
11
+ export declare type SlippageWithToken = {
12
+ slippage: string;
13
+ tokens: string[];
14
+ };
15
+ export declare type State = {
16
+ tokenList: TokenList;
17
+ popularTokenList: TokenList;
18
+ ethBalance?: BigNumber;
19
+ accountBalances: AccountBalances;
20
+ balanceLoadings: {
21
+ [key in string]: boolean;
22
+ };
23
+ slippageWithTokens: SlippageWithToken[];
24
+ defaultFromToken?: TokenInfo;
25
+ defaultToToken?: TokenInfo;
26
+ };
27
+ export declare const initialState: State;
28
+ declare const _default: (state: State | undefined, action: AnyAction) => State;
29
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { AnyAction } from 'redux';
2
+ import { ChainId } from '../../constants/chains';
3
+ export declare type State = {
4
+ chainId: ChainId;
5
+ latestBlockNumber: number;
6
+ };
7
+ export declare const initialState: State;
8
+ declare const _default: (state: State | undefined, action: AnyAction) => State;
9
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { RootState } from '../reducers';
2
+ export declare const getGlobalProps: (state?: RootState) => import("../../components/Widget").WidgetProps;
@@ -0,0 +1,4 @@
1
+ import { RootState } from '../reducers';
2
+ export declare const getColorMode: (state?: RootState) => import("../reducers/settings").ColorMode;
3
+ export declare const getSlippage: (state?: RootState) => import("../reducers/settings").Slippage;
4
+ export declare const getTxDdl: (state?: RootState) => import("../reducers/settings").TxDdl;
@@ -0,0 +1,16 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { ChainId } from '../../constants/chains';
3
+ import { TokenInfo } from '../../hooks/Token/type';
4
+ import { RootState } from '../reducers';
5
+ export declare const getTokenList: (state?: RootState) => import("../../hooks/Token/type").TokenList;
6
+ export declare const getPopularTokenList: (chainId: ChainId, state?: RootState) => TokenInfo[];
7
+ export declare const getSlippageWithTokens: (state?: RootState) => import("../reducers/token").SlippageWithToken[];
8
+ export declare const getAccountBalances: (state?: RootState) => import("../reducers/token").AccountBalances;
9
+ export declare const getEthBalance: (state?: RootState) => BigNumber;
10
+ export declare const getDefaultFromToken: (state?: RootState) => TokenInfo | undefined;
11
+ export declare const getDefaultToToken: (state?: RootState) => TokenInfo | undefined;
12
+ export declare const getTokenBalance: (tokenAddress: string, state?: RootState) => BigNumber;
13
+ export declare const getTokenAllowance: (tokenAddress: string, state?: RootState) => void;
14
+ export declare const getBalanceLoadings: (state?: RootState) => {
15
+ [x: string]: boolean;
16
+ };
@@ -0,0 +1,3 @@
1
+ import { RootState } from '../reducers';
2
+ export declare const getDefaultChainId: (state?: RootState) => import("../../constants/chains").ChainId;
3
+ export declare const getLatestBlockNumber: (state?: RootState) => number;
@@ -0,0 +1,7 @@
1
+ export declare const isSameAddress: (tokenAddress1: string, tokenAddress2: string) => boolean;
2
+ export declare function isAddress(value: any): string | false;
3
+ /**
4
+ * Returns true if the string value is zero in hex
5
+ * @param hexNumberString
6
+ */
7
+ export default function isZero(hexNumberString: string): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { ChainId } from '../constants/chains';
2
+ export declare const getPlatformId: (chainId: ChainId) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import { BigNumber } from 'bignumber.js';
2
+ /**
3
+ * format to readable number, like: 0.00 -> 0, 1.00 -> 1, 1.235 -> 1.23, 1.230 -> 1.23
4
+ * @param input
5
+ */
6
+ export declare function formatReadableNumber({ input, showDecimals, showPrecisionDecimals, showIntegerOnly, showDecimalsOnly, noGroupSeparator, }: {
7
+ input: BigNumber | number | string;
8
+ showDecimals?: number;
9
+ showIntegerOnly?: boolean;
10
+ showDecimalsOnly?: boolean;
11
+ showPrecisionDecimals?: number;
12
+ noGroupSeparator?: boolean;
13
+ }): string;
14
+ export declare function formatTokenAmountNumber({ input, decimals, showPrecisionDecimals, noGroupSeparator, }: {
15
+ input?: BigNumber | number | string | null;
16
+ decimals?: number;
17
+ showPrecisionDecimals?: number;
18
+ noGroupSeparator?: boolean;
19
+ }): string;
20
+ export declare const fixedString: (raw: string | number | BigNumber, showDecimals?: number) => string;
21
+ export declare const fixedInputStringToFormattedNumber: (inputValue: string, inputTokenShowDecimals: number) => string | null;
22
+ export declare const toWei: (amount: BigNumber | string | number, decimals: number, notDp?: boolean) => BigNumber;
23
+ export declare const getDecimalLimit: (decimals: number | undefined | null) => number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export * from './formatter';
2
+ export * from './address';
3
+ export * from './wallet';
4
+ export * from './chains';
5
+ export * from './token';
@@ -0,0 +1,9 @@
1
+ import { TokenInfo } from '../hooks/Token';
2
+ import { ChainId } from '../constants/chains';
3
+ import BigNumber from 'bignumber.js';
4
+ export declare const getTokenSymbolDisplay: (baseToken: TokenInfo) => string;
5
+ export declare const getSwapTxValue: ({ tokenAmount, tokenAddress, chainId, }: {
6
+ tokenAmount: string | number | BigNumber;
7
+ tokenAddress: string;
8
+ chainId: ChainId;
9
+ }) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export declare const isETHChain: (chainId?: number) => {
2
+ /** ETH mainnet */
3
+ isMainnet: boolean;
4
+ isRinkeby: boolean;
5
+ isETH: boolean;
6
+ isGor: boolean;
7
+ };
8
+ export declare const reloadWindow: (interval?: number) => void;
@@ -0,0 +1 @@
1
+ export {};