@dodoex/widgets 3.0.0-beta.31 → 3.0.0-beta.32

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 (327) hide show
  1. package/dist/cjs/e2e/connect.test.d.ts +6 -0
  2. package/dist/cjs/e2e/constants.d.ts +87 -0
  3. package/dist/cjs/e2e/default.test.d.ts +6 -0
  4. package/dist/cjs/e2e/setup.d.ts +4 -0
  5. package/dist/cjs/helper-DNaeIBQY.cjs +1 -0
  6. package/dist/cjs/index-BZtt1iuv.cjs +12 -0
  7. package/dist/cjs/index-CULtuKOC.cjs +78 -0
  8. package/dist/cjs/index-DWLX0NSs.cjs +53 -0
  9. package/dist/cjs/index.cjs +1 -1
  10. package/dist/cjs/lottie-4VzKv4A8.cjs +1 -0
  11. package/dist/cjs/src/components/Bridge/BridgeRouteShortCard.d.ts +6 -0
  12. package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/BridgeSummaryDetail.d.ts +5 -0
  13. package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/index.d.ts +18 -0
  14. package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/CrossStep.d.ts +16 -0
  15. package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/EtherscanLinkButton.d.ts +6 -0
  16. package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/RouteSteps.d.ts +6 -0
  17. package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/SwapStep.d.ts +14 -0
  18. package/dist/cjs/src/components/Bridge/SelectBridgeDialog/BridgeLogo.d.ts +10 -0
  19. package/dist/cjs/src/components/Bridge/SelectBridgeDialog/DirectionLine.d.ts +4 -0
  20. package/dist/cjs/src/components/Bridge/SelectBridgeDialog/RouteCard.d.ts +21 -0
  21. package/dist/cjs/src/components/Bridge/SelectBridgeDialog/RouteTagList.d.ts +12 -0
  22. package/dist/cjs/src/components/Bridge/SelectBridgeDialog/TokenWithChain.d.ts +11 -0
  23. package/dist/cjs/src/components/Bridge/SelectBridgeDialog/index.d.ts +9 -0
  24. package/dist/cjs/src/components/Bridge/SelectBridgeDialog/productList.d.ts +8 -0
  25. package/dist/cjs/src/components/ErrorMessageDialog.d.ts +5 -0
  26. package/dist/cjs/src/components/Swap/components/ConnectWallet/ConnectWalletDialog.d.ts +5 -0
  27. package/dist/cjs/src/components/Swap/components/ConnectWallet/index.d.ts +9 -0
  28. package/dist/cjs/src/components/Swap/components/Dialog.d.ts +14 -0
  29. package/dist/cjs/src/components/Swap/components/ReviewDialog.d.ts +22 -0
  30. package/dist/cjs/src/components/Swap/components/SettingsDialog/NumberInput.d.ts +8 -0
  31. package/dist/cjs/src/components/Swap/components/SettingsDialog/index.d.ts +7 -0
  32. package/dist/cjs/src/components/Swap/components/SwitchBox.d.ts +5 -0
  33. package/dist/cjs/src/components/Swap/components/TokenCard/BalanceText.d.ts +9 -0
  34. package/dist/cjs/src/components/Swap/components/TokenCard/NumberInput.d.ts +13 -0
  35. package/dist/cjs/src/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +7 -0
  36. package/dist/cjs/src/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +13 -0
  37. package/dist/cjs/src/components/Swap/components/TokenCard/index.d.ts +23 -0
  38. package/dist/cjs/src/components/Swap/components/TokenPairPriceWithToggle.d.ts +10 -0
  39. package/dist/cjs/src/components/Swap/index.d.ts +9 -0
  40. package/dist/cjs/src/components/SwitchChainDialog/index.d.ts +7 -0
  41. package/dist/cjs/src/components/TokenLogo.d.ts +16 -0
  42. package/dist/cjs/src/components/TokenPicker/PopularToken.d.ts +7 -0
  43. package/dist/cjs/src/components/TokenPicker/SelectChainItem.d.ts +7 -0
  44. package/dist/cjs/src/components/TokenPicker/TokenItem.d.ts +8 -0
  45. package/dist/cjs/src/components/TokenPicker/index.d.ts +19 -0
  46. package/dist/cjs/src/components/Tooltip/QuestionTooltip.d.ts +3 -0
  47. package/dist/cjs/src/components/Tooltip/index.d.ts +1 -0
  48. package/dist/cjs/src/components/Widget/i18n.d.ts +9 -0
  49. package/dist/cjs/src/components/Widget/index.d.ts +34 -0
  50. package/dist/cjs/src/components/WithExecutionDialog/index.d.ts +5 -0
  51. package/dist/cjs/src/constants/address.d.ts +1 -0
  52. package/dist/cjs/src/constants/api.d.ts +16 -0
  53. package/dist/cjs/src/constants/chainList.d.ts +9 -0
  54. package/dist/cjs/src/constants/chains.d.ts +42 -0
  55. package/dist/cjs/src/constants/locales.d.ts +3 -0
  56. package/dist/cjs/src/constants/localstorage.d.ts +12 -0
  57. package/dist/cjs/src/constants/swap.d.ts +7 -0
  58. package/dist/cjs/src/constants/testId.d.ts +10 -0
  59. package/dist/cjs/src/constants/token.d.ts +2 -0
  60. package/dist/cjs/src/constants/tokenList.d.ts +18 -0
  61. package/dist/cjs/src/constants/wallet.d.ts +23 -0
  62. package/dist/cjs/src/hooks/Bridge/createBridgeOrder.d.ts +28 -0
  63. package/dist/cjs/src/hooks/Bridge/index.d.ts +4 -0
  64. package/dist/cjs/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +6 -0
  65. package/dist/cjs/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +113 -0
  66. package/dist/cjs/src/hooks/Bridge/useFetchRoutePriceBridge.test.d.ts +1 -0
  67. package/dist/cjs/src/hooks/Bridge/useSendRoute.d.ts +16 -0
  68. package/dist/cjs/src/hooks/Bridge/useSwitchBridgeOrSwapSlippage.d.ts +1 -0
  69. package/dist/cjs/src/hooks/ConnectWallet/Connectors/JsonRpcConnector.d.ts +9 -0
  70. package/dist/cjs/src/hooks/ConnectWallet/TonConnect/index.d.ts +26 -0
  71. package/dist/cjs/src/hooks/ConnectWallet/index.d.ts +3 -0
  72. package/dist/cjs/src/hooks/ConnectWallet/useCurrentChainId.d.ts +2 -0
  73. package/dist/cjs/src/hooks/ConnectWallet/useSwitchChain.d.ts +10 -0
  74. package/dist/cjs/src/hooks/ConnectWallet/useWalletState.d.ts +24 -0
  75. package/dist/cjs/src/hooks/ConnectWallet/useWeb3Connectors.d.ts +17 -0
  76. package/dist/cjs/src/hooks/ConnectWallet/web3.d.ts +10 -0
  77. package/dist/cjs/src/hooks/Submission/getExecutionErrorMsg.d.ts +2 -0
  78. package/dist/cjs/src/hooks/Submission/index.d.ts +10 -0
  79. package/dist/cjs/src/hooks/Submission/spec.d.ts +56 -0
  80. package/dist/cjs/src/hooks/Submission/types.d.ts +50 -0
  81. package/dist/cjs/src/hooks/Submission/useExecution.d.ts +31 -0
  82. package/dist/cjs/src/hooks/Submission/useInflights.d.ts +5 -0
  83. package/dist/cjs/src/hooks/Swap/index.d.ts +5 -0
  84. package/dist/cjs/src/hooks/Swap/useExecuteSwap.d.ts +12 -0
  85. package/dist/cjs/src/hooks/Swap/useFetchFiatPrice.d.ts +13 -0
  86. package/dist/cjs/src/hooks/Swap/useFetchFiatPrice.test.d.ts +1 -0
  87. package/dist/cjs/src/hooks/Swap/useFetchRoutePrice.d.ts +37 -0
  88. package/dist/cjs/src/hooks/Swap/useFetchRoutePrice.test.d.ts +1 -0
  89. package/dist/cjs/src/hooks/Swap/useInitDefaultToken.d.ts +10 -0
  90. package/dist/cjs/src/hooks/Swap/useMarginAmount.d.ts +8 -0
  91. package/dist/cjs/src/hooks/Swap/useMarginAmount.test.d.ts +1 -0
  92. package/dist/cjs/src/hooks/Swap/usePriceTimer.d.ts +5 -0
  93. package/dist/cjs/src/hooks/Swap/useSlippageLimit.d.ts +2 -0
  94. package/dist/cjs/src/hooks/Token/index.d.ts +4 -0
  95. package/dist/cjs/src/hooks/Token/type.d.ts +26 -0
  96. package/dist/cjs/src/hooks/Token/useDisabledTokenSwitch.d.ts +5 -0
  97. package/dist/cjs/src/hooks/Token/useFetchTokenAllowance.d.ts +13 -0
  98. package/dist/cjs/src/hooks/Token/useFindTokenByAddress.d.ts +1 -0
  99. package/dist/cjs/src/hooks/Token/useFindTokenByAddress.test.d.ts +1 -0
  100. package/dist/cjs/src/hooks/Token/useGetAllowance.d.ts +3 -0
  101. package/dist/cjs/src/hooks/Token/useGetAllowance.test.d.ts +1 -0
  102. package/dist/cjs/src/hooks/Token/useGetBalance.d.ts +2 -0
  103. package/dist/cjs/src/hooks/Token/useGetBalance.test.d.ts +1 -0
  104. package/dist/cjs/src/hooks/Token/useGetCGTokenList.d.ts +15 -0
  105. package/dist/cjs/src/hooks/Token/useGetTokenStatus.d.ts +13 -0
  106. package/dist/cjs/src/hooks/Token/useGetTokenStatus.test.d.ts +1 -0
  107. package/dist/cjs/src/hooks/Token/useInitTokenList.d.ts +8 -0
  108. package/dist/cjs/src/hooks/Token/useSelectChainList.d.ts +7 -0
  109. package/dist/cjs/src/hooks/Token/useSelectChainList.test.d.ts +1 -0
  110. package/dist/cjs/src/hooks/Token/useTokenList.d.ts +30 -0
  111. package/dist/cjs/src/hooks/Token/useTokenList.test.d.ts +1 -0
  112. package/dist/cjs/src/hooks/Token/useTokenListFetchBalance.d.ts +9 -0
  113. package/dist/cjs/src/hooks/Widget/useInitPropsToRedux.d.ts +2 -0
  114. package/dist/cjs/src/hooks/contract/abis/OrbiterV3ABI.d.ts +85 -0
  115. package/dist/cjs/src/hooks/contract/abis/erc20ABI.d.ts +30 -0
  116. package/dist/cjs/src/hooks/contract/abis/erc20Helper.d.ts +16 -0
  117. package/dist/cjs/src/hooks/contract/abis/multicallABI.d.ts +34 -0
  118. package/dist/cjs/src/hooks/contract/batch.d.ts +18 -0
  119. package/dist/cjs/src/hooks/contract/contractConfig.d.ts +9 -0
  120. package/dist/cjs/src/hooks/contract/index.d.ts +5 -0
  121. package/dist/cjs/src/hooks/contract/orbiter/constants.d.ts +3 -0
  122. package/dist/cjs/src/hooks/contract/orbiter/encodeOrbiterBridge.d.ts +12 -0
  123. package/dist/cjs/src/hooks/contract/orbiter/useOrbiterContractMap.d.ts +5 -0
  124. package/dist/cjs/src/hooks/contract/orbiter/useOrbiterRouters.d.ts +21 -0
  125. package/dist/cjs/src/hooks/contract/provider.d.ts +2 -0
  126. package/dist/cjs/src/hooks/contract/token.d.ts +10 -0
  127. package/dist/cjs/src/hooks/contract/useFetchBlockNumber.d.ts +3 -0
  128. package/dist/cjs/src/hooks/contract/useFetchETHBalance.d.ts +1 -0
  129. package/dist/cjs/src/hooks/contract/useFetchTokens.d.ts +19 -0
  130. package/dist/cjs/src/hooks/contract/useMultiContract.d.ts +14 -0
  131. package/dist/cjs/src/hooks/contract/wallet.d.ts +16 -0
  132. package/dist/cjs/src/hooks/setting/useDefaultSlippage.d.ts +4 -0
  133. package/dist/cjs/src/hooks/setting/useGetAPIService.d.ts +2 -0
  134. package/dist/cjs/src/hooks/setting/useSetAutoSlippage.d.ts +13 -0
  135. package/dist/cjs/src/index.d.ts +6 -0
  136. package/dist/cjs/src/store/actions/globals.d.ts +9 -0
  137. package/dist/cjs/src/store/actions/index.d.ts +4 -0
  138. package/dist/cjs/src/store/actions/settings.d.ts +6 -0
  139. package/dist/cjs/src/store/actions/token.d.ts +15 -0
  140. package/dist/cjs/src/store/actions/wallet.d.ts +5 -0
  141. package/dist/cjs/src/store/index.d.ts +6 -0
  142. package/dist/cjs/src/store/reducers/globals.d.ts +23 -0
  143. package/dist/cjs/src/store/reducers/index.d.ts +17 -0
  144. package/dist/cjs/src/store/reducers/settings.d.ts +13 -0
  145. package/dist/cjs/src/store/reducers/token.d.ts +31 -0
  146. package/dist/cjs/src/store/reducers/wallet.d.ts +10 -0
  147. package/dist/cjs/src/store/selectors/globals.d.ts +7 -0
  148. package/dist/cjs/src/store/selectors/settings.d.ts +4 -0
  149. package/dist/cjs/src/store/selectors/token.d.ts +19 -0
  150. package/dist/cjs/src/store/selectors/wallet.d.ts +4 -0
  151. package/dist/cjs/src/utils/address.d.ts +15 -0
  152. package/dist/cjs/src/utils/address.test.d.ts +1 -0
  153. package/dist/cjs/src/utils/chains.d.ts +2 -0
  154. package/dist/cjs/src/utils/chains.test.d.ts +1 -0
  155. package/dist/cjs/src/utils/formatter.d.ts +25 -0
  156. package/dist/cjs/src/utils/formatter.test.d.ts +1 -0
  157. package/dist/cjs/src/utils/index.d.ts +5 -0
  158. package/dist/cjs/src/utils/time.d.ts +9 -0
  159. package/dist/cjs/src/utils/time.test.d.ts +1 -0
  160. package/dist/cjs/src/utils/token.d.ts +9 -0
  161. package/dist/cjs/src/utils/token.test.d.ts +1 -0
  162. package/dist/cjs/src/utils/wallet.d.ts +8 -0
  163. package/dist/cjs/src/utils/wallet.test.d.ts +1 -0
  164. package/dist/e2e/connect.test.d.ts +6 -0
  165. package/dist/e2e/constants.d.ts +87 -0
  166. package/dist/e2e/default.test.d.ts +6 -0
  167. package/dist/e2e/setup.d.ts +4 -0
  168. package/dist/helper-D1mp2p4F.js +1 -0
  169. package/dist/index-CE6izMXy.js +12 -0
  170. package/dist/index-CEwSZbo5.js +53 -0
  171. package/dist/index-Duga8SDh.js +78 -0
  172. package/dist/index.js +1 -1
  173. package/dist/lottie-DMZ5X1eY.js +1 -0
  174. package/dist/src/components/Bridge/BridgeRouteShortCard.d.ts +6 -0
  175. package/dist/src/components/Bridge/BridgeSummaryDialog/BridgeSummaryDetail.d.ts +5 -0
  176. package/dist/src/components/Bridge/BridgeSummaryDialog/index.d.ts +18 -0
  177. package/dist/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/CrossStep.d.ts +16 -0
  178. package/dist/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/EtherscanLinkButton.d.ts +6 -0
  179. package/dist/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/RouteSteps.d.ts +6 -0
  180. package/dist/src/components/Bridge/BridgeSummaryDialog/orderInfoModal/SwapStep.d.ts +14 -0
  181. package/dist/src/components/Bridge/SelectBridgeDialog/BridgeLogo.d.ts +10 -0
  182. package/dist/src/components/Bridge/SelectBridgeDialog/DirectionLine.d.ts +4 -0
  183. package/dist/src/components/Bridge/SelectBridgeDialog/RouteCard.d.ts +21 -0
  184. package/dist/src/components/Bridge/SelectBridgeDialog/RouteTagList.d.ts +12 -0
  185. package/dist/src/components/Bridge/SelectBridgeDialog/TokenWithChain.d.ts +11 -0
  186. package/dist/src/components/Bridge/SelectBridgeDialog/index.d.ts +9 -0
  187. package/dist/src/components/Bridge/SelectBridgeDialog/productList.d.ts +8 -0
  188. package/dist/src/components/ErrorMessageDialog.d.ts +5 -0
  189. package/dist/src/components/Swap/components/ConnectWallet/ConnectWalletDialog.d.ts +5 -0
  190. package/dist/src/components/Swap/components/ConnectWallet/index.d.ts +9 -0
  191. package/dist/src/components/Swap/components/Dialog.d.ts +14 -0
  192. package/dist/src/components/Swap/components/ReviewDialog.d.ts +22 -0
  193. package/dist/src/components/Swap/components/SettingsDialog/NumberInput.d.ts +8 -0
  194. package/dist/src/components/Swap/components/SettingsDialog/index.d.ts +7 -0
  195. package/dist/src/components/Swap/components/SwitchBox.d.ts +5 -0
  196. package/dist/src/components/Swap/components/TokenCard/BalanceText.d.ts +9 -0
  197. package/dist/src/components/Swap/components/TokenCard/NumberInput.d.ts +13 -0
  198. package/dist/src/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +7 -0
  199. package/dist/src/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +13 -0
  200. package/dist/src/components/Swap/components/TokenCard/index.d.ts +23 -0
  201. package/dist/src/components/Swap/components/TokenPairPriceWithToggle.d.ts +10 -0
  202. package/dist/src/components/Swap/index.d.ts +9 -0
  203. package/dist/src/components/SwitchChainDialog/index.d.ts +7 -0
  204. package/dist/src/components/TokenLogo.d.ts +16 -0
  205. package/dist/src/components/TokenPicker/PopularToken.d.ts +7 -0
  206. package/dist/src/components/TokenPicker/SelectChainItem.d.ts +7 -0
  207. package/dist/src/components/TokenPicker/TokenItem.d.ts +8 -0
  208. package/dist/src/components/TokenPicker/index.d.ts +19 -0
  209. package/dist/src/components/Tooltip/QuestionTooltip.d.ts +3 -0
  210. package/dist/src/components/Tooltip/index.d.ts +1 -0
  211. package/dist/src/components/Widget/i18n.d.ts +9 -0
  212. package/dist/src/components/Widget/index.d.ts +34 -0
  213. package/dist/src/components/WithExecutionDialog/index.d.ts +5 -0
  214. package/dist/src/constants/address.d.ts +1 -0
  215. package/dist/src/constants/api.d.ts +16 -0
  216. package/dist/src/constants/chainList.d.ts +9 -0
  217. package/dist/src/constants/chains.d.ts +42 -0
  218. package/dist/src/constants/locales.d.ts +3 -0
  219. package/dist/src/constants/localstorage.d.ts +12 -0
  220. package/dist/src/constants/swap.d.ts +7 -0
  221. package/dist/src/constants/testId.d.ts +10 -0
  222. package/dist/src/constants/token.d.ts +2 -0
  223. package/dist/src/constants/tokenList.d.ts +18 -0
  224. package/dist/src/constants/wallet.d.ts +23 -0
  225. package/dist/src/hooks/Bridge/createBridgeOrder.d.ts +28 -0
  226. package/dist/src/hooks/Bridge/index.d.ts +4 -0
  227. package/dist/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +6 -0
  228. package/dist/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +113 -0
  229. package/dist/src/hooks/Bridge/useFetchRoutePriceBridge.test.d.ts +1 -0
  230. package/dist/src/hooks/Bridge/useSendRoute.d.ts +16 -0
  231. package/dist/src/hooks/Bridge/useSwitchBridgeOrSwapSlippage.d.ts +1 -0
  232. package/dist/src/hooks/ConnectWallet/Connectors/JsonRpcConnector.d.ts +9 -0
  233. package/dist/src/hooks/ConnectWallet/TonConnect/index.d.ts +26 -0
  234. package/dist/src/hooks/ConnectWallet/index.d.ts +3 -0
  235. package/dist/src/hooks/ConnectWallet/useCurrentChainId.d.ts +2 -0
  236. package/dist/src/hooks/ConnectWallet/useSwitchChain.d.ts +10 -0
  237. package/dist/src/hooks/ConnectWallet/useWalletState.d.ts +24 -0
  238. package/dist/src/hooks/ConnectWallet/useWeb3Connectors.d.ts +17 -0
  239. package/dist/src/hooks/ConnectWallet/web3.d.ts +10 -0
  240. package/dist/src/hooks/Submission/getExecutionErrorMsg.d.ts +2 -0
  241. package/dist/src/hooks/Submission/index.d.ts +10 -0
  242. package/dist/src/hooks/Submission/spec.d.ts +56 -0
  243. package/dist/src/hooks/Submission/types.d.ts +50 -0
  244. package/dist/src/hooks/Submission/useExecution.d.ts +31 -0
  245. package/dist/src/hooks/Submission/useInflights.d.ts +5 -0
  246. package/dist/src/hooks/Swap/index.d.ts +5 -0
  247. package/dist/src/hooks/Swap/useExecuteSwap.d.ts +12 -0
  248. package/dist/src/hooks/Swap/useFetchFiatPrice.d.ts +13 -0
  249. package/dist/src/hooks/Swap/useFetchFiatPrice.test.d.ts +1 -0
  250. package/dist/src/hooks/Swap/useFetchRoutePrice.d.ts +37 -0
  251. package/dist/src/hooks/Swap/useFetchRoutePrice.test.d.ts +1 -0
  252. package/dist/src/hooks/Swap/useInitDefaultToken.d.ts +10 -0
  253. package/dist/src/hooks/Swap/useMarginAmount.d.ts +8 -0
  254. package/dist/src/hooks/Swap/useMarginAmount.test.d.ts +1 -0
  255. package/dist/src/hooks/Swap/usePriceTimer.d.ts +5 -0
  256. package/dist/src/hooks/Swap/useSlippageLimit.d.ts +2 -0
  257. package/dist/src/hooks/Token/index.d.ts +4 -0
  258. package/dist/src/hooks/Token/type.d.ts +26 -0
  259. package/dist/src/hooks/Token/useDisabledTokenSwitch.d.ts +5 -0
  260. package/dist/src/hooks/Token/useFetchTokenAllowance.d.ts +13 -0
  261. package/dist/src/hooks/Token/useFindTokenByAddress.d.ts +1 -0
  262. package/dist/src/hooks/Token/useFindTokenByAddress.test.d.ts +1 -0
  263. package/dist/src/hooks/Token/useGetAllowance.d.ts +3 -0
  264. package/dist/src/hooks/Token/useGetAllowance.test.d.ts +1 -0
  265. package/dist/src/hooks/Token/useGetBalance.d.ts +2 -0
  266. package/dist/src/hooks/Token/useGetBalance.test.d.ts +1 -0
  267. package/dist/src/hooks/Token/useGetCGTokenList.d.ts +15 -0
  268. package/dist/src/hooks/Token/useGetTokenStatus.d.ts +13 -0
  269. package/dist/src/hooks/Token/useGetTokenStatus.test.d.ts +1 -0
  270. package/dist/src/hooks/Token/useInitTokenList.d.ts +8 -0
  271. package/dist/src/hooks/Token/useSelectChainList.d.ts +7 -0
  272. package/dist/src/hooks/Token/useSelectChainList.test.d.ts +1 -0
  273. package/dist/src/hooks/Token/useTokenList.d.ts +30 -0
  274. package/dist/src/hooks/Token/useTokenList.test.d.ts +1 -0
  275. package/dist/src/hooks/Token/useTokenListFetchBalance.d.ts +9 -0
  276. package/dist/src/hooks/Widget/useInitPropsToRedux.d.ts +2 -0
  277. package/dist/src/hooks/contract/abis/OrbiterV3ABI.d.ts +85 -0
  278. package/dist/src/hooks/contract/abis/erc20ABI.d.ts +30 -0
  279. package/dist/src/hooks/contract/abis/erc20Helper.d.ts +16 -0
  280. package/dist/src/hooks/contract/abis/multicallABI.d.ts +34 -0
  281. package/dist/src/hooks/contract/batch.d.ts +18 -0
  282. package/dist/src/hooks/contract/contractConfig.d.ts +9 -0
  283. package/dist/src/hooks/contract/index.d.ts +5 -0
  284. package/dist/src/hooks/contract/orbiter/constants.d.ts +3 -0
  285. package/dist/src/hooks/contract/orbiter/encodeOrbiterBridge.d.ts +12 -0
  286. package/dist/src/hooks/contract/orbiter/useOrbiterContractMap.d.ts +5 -0
  287. package/dist/src/hooks/contract/orbiter/useOrbiterRouters.d.ts +21 -0
  288. package/dist/src/hooks/contract/provider.d.ts +2 -0
  289. package/dist/src/hooks/contract/token.d.ts +10 -0
  290. package/dist/src/hooks/contract/useFetchBlockNumber.d.ts +3 -0
  291. package/dist/src/hooks/contract/useFetchETHBalance.d.ts +1 -0
  292. package/dist/src/hooks/contract/useFetchTokens.d.ts +19 -0
  293. package/dist/src/hooks/contract/useMultiContract.d.ts +14 -0
  294. package/dist/src/hooks/contract/wallet.d.ts +16 -0
  295. package/dist/src/hooks/setting/useDefaultSlippage.d.ts +4 -0
  296. package/dist/src/hooks/setting/useGetAPIService.d.ts +2 -0
  297. package/dist/src/hooks/setting/useSetAutoSlippage.d.ts +13 -0
  298. package/dist/src/index.d.ts +6 -0
  299. package/dist/src/store/actions/globals.d.ts +9 -0
  300. package/dist/src/store/actions/index.d.ts +4 -0
  301. package/dist/src/store/actions/settings.d.ts +6 -0
  302. package/dist/src/store/actions/token.d.ts +15 -0
  303. package/dist/src/store/actions/wallet.d.ts +5 -0
  304. package/dist/src/store/index.d.ts +6 -0
  305. package/dist/src/store/reducers/globals.d.ts +23 -0
  306. package/dist/src/store/reducers/index.d.ts +17 -0
  307. package/dist/src/store/reducers/settings.d.ts +13 -0
  308. package/dist/src/store/reducers/token.d.ts +31 -0
  309. package/dist/src/store/reducers/wallet.d.ts +10 -0
  310. package/dist/src/store/selectors/globals.d.ts +7 -0
  311. package/dist/src/store/selectors/settings.d.ts +4 -0
  312. package/dist/src/store/selectors/token.d.ts +19 -0
  313. package/dist/src/store/selectors/wallet.d.ts +4 -0
  314. package/dist/src/utils/address.d.ts +15 -0
  315. package/dist/src/utils/address.test.d.ts +1 -0
  316. package/dist/src/utils/chains.d.ts +2 -0
  317. package/dist/src/utils/chains.test.d.ts +1 -0
  318. package/dist/src/utils/formatter.d.ts +25 -0
  319. package/dist/src/utils/formatter.test.d.ts +1 -0
  320. package/dist/src/utils/index.d.ts +5 -0
  321. package/dist/src/utils/time.d.ts +9 -0
  322. package/dist/src/utils/time.test.d.ts +1 -0
  323. package/dist/src/utils/token.d.ts +9 -0
  324. package/dist/src/utils/token.test.d.ts +1 -0
  325. package/dist/src/utils/wallet.d.ts +8 -0
  326. package/dist/src/utils/wallet.test.d.ts +1 -0
  327. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ import { RootState } from '../reducers';
2
+ export declare const getGlobalProps: (state?: RootState) => import("../reducers/globals").State;
3
+ export declare const getAutoConnectLoading: (state?: RootState) => boolean | undefined;
4
+ export declare const getAutoSlippage: (state?: RootState) => {
5
+ loading: boolean;
6
+ value: number | null;
7
+ } | undefined;
@@ -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,19 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { ChainId } from '../../constants/chains';
3
+ import type { DefaultTokenInfo } from '../../hooks/Token';
4
+ import { RootState } from '../reducers';
5
+ export declare const getTokenList: (state?: RootState) => import("../../hooks/Token").TokenList;
6
+ export declare const getAllTokenList: (state?: RootState) => import("../../hooks/Token").TokenInfo[];
7
+ export declare const getPopularTokenList: (chainId: ChainId, state?: RootState) => import("../../hooks/Token").TokenInfo[];
8
+ export declare const getSlippageWithTokens: (state?: RootState) => import("../reducers/token").SlippageWithToken[];
9
+ export declare const getAccountBalances: (state?: RootState) => import("../reducers/token").AccountBalances;
10
+ export declare const getEthBalance: (state?: RootState) => {
11
+ [key: number]: BigNumber;
12
+ };
13
+ export declare const getDefaultFromToken: (state?: RootState) => DefaultTokenInfo | undefined;
14
+ export declare const getDefaultToToken: (state?: RootState) => DefaultTokenInfo | undefined;
15
+ export declare const getTokenBalance: (tokenAddress: string, state?: RootState) => BigNumber;
16
+ export declare const getTokenAllowance: (tokenAddress: string, state?: RootState) => void;
17
+ export declare const getBalanceLoadings: (state?: RootState) => {
18
+ [x: string]: boolean;
19
+ };
@@ -0,0 +1,4 @@
1
+ import { RootState } from '../reducers';
2
+ export declare const getDefaultChainId: (state?: RootState) => import("../../constants/chains").ChainId;
3
+ export declare const getFromTokenChainId: (state?: RootState) => import("../../constants/chains").ChainId | undefined;
4
+ export declare const getLatestBlockNumber: (state?: RootState) => number;
@@ -0,0 +1,15 @@
1
+ import { ChainId } from '../constants/chains';
2
+ export declare const isSameAddress: (tokenAddress1: string, tokenAddress2: string) => boolean;
3
+ export declare function isAddress(value: any): string | false;
4
+ export declare function isETHAddress(addr: string): boolean;
5
+ /**
6
+ * Returns true if the string value is zero in hex
7
+ * @param hexNumberString
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;
@@ -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,25 @@
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 byWei: (amount: BigNumber | string | number, decimals: number) => BigNumber;
24
+ export declare const getDecimalLimit: (decimals: number | undefined | null) => number;
25
+ export declare function getIntegerNumber(v: number): 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
+ /**
2
+ * time formatter
3
+ * output => 17mins54s or 17 Minutes
4
+ */
5
+ export declare function formatReadableTimeDuration({ start, end, showSecondUnit, }: {
6
+ start?: number;
7
+ end?: number;
8
+ showSecondUnit?: boolean;
9
+ }): string | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -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 {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @jest-environment hardhat/dist/jsdom
3
+ */
4
+ import '@ethersproject/providers';
5
+ import 'jest-environment-hardhat/dist/jsdom';
6
+ import '@testing-library/jest-dom';
@@ -0,0 +1,87 @@
1
+ export declare const tokenListMap: {
2
+ ETH: {
3
+ chainId: number;
4
+ address: string;
5
+ name: string;
6
+ decimals: number;
7
+ symbol: string;
8
+ logoURI: string;
9
+ };
10
+ DODO: {
11
+ chainId: number;
12
+ address: string;
13
+ name: string;
14
+ decimals: number;
15
+ symbol: string;
16
+ logoURI: string;
17
+ };
18
+ USDC: {
19
+ chainId: number;
20
+ address: string;
21
+ name: string;
22
+ decimals: number;
23
+ symbol: string;
24
+ logoURI: string;
25
+ };
26
+ };
27
+ export declare const tokenList: ({
28
+ chainId: number;
29
+ address: string;
30
+ name: string;
31
+ decimals: number;
32
+ symbol: string;
33
+ logoURI: string;
34
+ } | {
35
+ chainId: number;
36
+ address: string;
37
+ name: string;
38
+ decimals: number;
39
+ symbol: string;
40
+ logoURI: string;
41
+ } | {
42
+ chainId: number;
43
+ address: string;
44
+ name: string;
45
+ decimals: number;
46
+ symbol: string;
47
+ logoURI: string;
48
+ })[];
49
+ export declare const routeRes: {
50
+ data: {
51
+ resAmount: number;
52
+ resPricePerToToken: number;
53
+ resPricePerFromToken: number;
54
+ priceImpact: number;
55
+ useSource: string;
56
+ targetDecimals: number;
57
+ targetApproveAddr: string;
58
+ to: string;
59
+ data: string;
60
+ value: string;
61
+ resCostGas: number;
62
+ duration: number;
63
+ networkDelay: number;
64
+ routeData: string;
65
+ msgError: string;
66
+ totalDuration: number;
67
+ };
68
+ };
69
+ export declare const tokenListRes: {
70
+ keywords: string[];
71
+ logoURI: string;
72
+ name: string;
73
+ timestamp: string;
74
+ tokens: never[];
75
+ message: string;
76
+ };
77
+ export declare const fiatPriceBatchRes: {
78
+ code: number;
79
+ data: {
80
+ network: string;
81
+ address: string;
82
+ symbol: string;
83
+ price: string;
84
+ serial: number;
85
+ }[];
86
+ message: string;
87
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @jest-environment hardhat/jsdom
3
+ */
4
+ import '@ethersproject/providers';
5
+ import 'jest-environment-hardhat/dist/jsdom';
6
+ import '@testing-library/jest-dom';
@@ -0,0 +1,4 @@
1
+ declare const error: {
2
+ (...data: any[]): void;
3
+ (message?: any, ...optionalParams: any[]): void;
4
+ };
@@ -0,0 +1 @@
1
+ import{i18n as e}from"@lingui/core";import t from"bignumber.js";import{f as i}from"./index-CEwSZbo5.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};
@@ -0,0 +1,12 @@
1
+ import t from"@emotion/styled";import{merge as e}from"lodash";import{useMemo as i,useRef as n}from"react";import{l as r,g as o,m as l}from"./helper-D1mp2p4F.js";import{Line as a,Text as s,Stage as d,Layer as g,Rect as m,Circle as u,Label as h,Tag as p}from"react-konva";import{j as c,f}from"./index-CEwSZbo5.js";import x from"bignumber.js";import{solveQuadraticFunctionForTarget as L,PMMState as w,PMMHelper as A}from"@dodoex/api";import"@lingui/core";import"@lingui/react";import"react-dom";import"react-redux";import"identicon.js";import"@web3-react/core";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"@reduxjs/toolkit";import"redux";import"@tanstack/react-query";import"react-window";import"@ethersproject/bignumber";import"dayjs";import"axios";import"zustand";import"react-infinite-scroller";import"recharts";const b=t.div`
2
+ height: 100%;
3
+ position: relative;
4
+ `,y=t.div`
5
+ text-align: center;
6
+ margin-top: 17.1px;
7
+ margin-bottom: 88.41px;
8
+ color: #606066;
9
+ font-size: 12px;
10
+ line-height: 17px;
11
+ font-weight: 400;
12
+ `,N=36;function P({maxHeight:t,gridAreaHeight:e,value:i}){const n=new x(e).minus(N),r=n.div(t);return n.minus(i.multipliedBy(r)).plus(N).toNumber()}function v({targetPrice:t,areaPoints:e,isLeft:i}){for(let n=0;n<e.length;n++){const r=e[n],o=n<e.length-1?e[n+1]:null;if(!o)return{targetAreaStatPoint:r,targetAreaStatPoints:e};if(i){if(t.lte(r.middlePrice)&&t.gte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:e.slice(0,n+1)}}else if(t.gte(r.middlePrice)&&t.lte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:e.slice(0,n+1)}}return{targetAreaStatPoint:null,targetAreaStatPoints:[]}}function j({x:t,width:e,minXLN10:i,maxXLN10:n}){const r=new x(t).div(e).multipliedBy(n.minus(i)).plus(i);return new x(10**r.toNumber())}function H({width:t,targetLN10:e,minXLN10:i,maxXLN10:n}){return e.minus(i).div(n.minus(i)).multipliedBy(t).toNumber()}function S({target:t}){return new x(Math.log10(t.toNumber()))}const X="rgba(38, 39, 41, 0.3)";function k({width:t,height:b,params:y,baseTokenSymbol:N,quoteTokenSymbol:k,colorMap:B}){const{maxLeftHeight:C,maxRightHeight:F,leftStatAreaPoints:M,rightStatAreaPoints:W,minXLN10:T,maxXLN10:J}=function({params:t}){return i((()=>{const e=new x(t.b),i=new x(t.q);let n=new x(t.b0);const r=new x(t.q0),o=new x(t.i),l=new x(t.k),{R:a}=t;1===a&&n.eq(e)&&(n=L(e,i.minus(r),new x(1).div(o),l));const s=new w({i:o,K:l,B:e,Q:i,B0:n,Q0:r,R:a,mtFeeRate:new x(0),lpFeeRate:new x(0)}),d=new A,g=new x(s.B),m=[],u=[];let h=new x(0),p=new x(0);const c=d.GetMidPrice(s),f=i.gt(0)?e.div(i):new x(1);for(let t=0;t<=250;t++){let e=g.multipliedBy(t/100).multipliedBy(c.multipliedBy(f).multipliedBy(4));0===t&&(e=g.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellBase(e,s);if(i.isNaN()||!i.gt(0))m.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=i.div(e);m.push({giveAmount:e,getAmount:i,price:t})}}for(let t=0;t<=250;t++){let e=g.multipliedBy(t/100).multipliedBy(c.multipliedBy(4));0===t&&(e=g.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellQuote(e,s);if(i.isNaN()||!i.gt(0))u.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=e.dividedBy(i);u.push({giveAmount:e,getAmount:i,price:t})}}if(m.length<2&&u.length<2)return{leftStatAreaPoints:[],rightStatAreaPoints:[],maxLeftHeight:new x(10).multipliedBy(1.2),maxRightHeight:new x(10).multipliedBy(1.2),middlePriceLN10:new x(0),minXLN10:new x(-1),maxXLN10:new x(1)};const b=[];for(let t=1;t<m.length;t++){const e=m[t],{giveAmount:i,getAmount:n,price:r}=e,o=m[t-1];if(!r.isNaN()&&r.gt(0)&&o){const e=r.minus(o.price).abs(),l=i.minus(o.giveAmount).abs(),a=n.minus(o.getAmount).abs().multipliedBy(l);1===t&&b.push({area:n,price:r,middlePrice:r.plus(e.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),b.push({area:n,price:r,middlePrice:r.plus(e.div(2)),rectangleHeight:a}),h=x.max(a,h)}}const y=[];for(let t=1;t<u.length;t++){const e=u[t],{giveAmount:i,getAmount:n,price:r}=e,o=u[t-1],l=o.price,a=o.giveAmount,s=o.getAmount;if(!r.isNaN()&&r.gt(0)&&o){const e=r.minus(l).abs(),o=i.minus(a).abs(),d=n.minus(s).abs().multipliedBy(o);1===t&&y.push({area:n,price:r,middlePrice:r.minus(e.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),y.push({area:n,price:r,middlePrice:r.minus(e.div(2)),rectangleHeight:d}),p=x.max(d,p)}}const N=m.length>0?m[m.length-1]:u[0],P=u.length>0?u[0]:m[0],v=u.length>0?u[u.length-1]:m[0],j=N.price,H=v.price,S=P.price,X=new x(Math.log10(S.toNumber()));let k=j.gt(0)?new x(Math.log10(j.toNumber())):new x(-Math.log10(H.toNumber())),B=H.gt(0)?new x(Math.log10(H.toNumber())):new x(-Math.log10(j.toNumber()));const C=x.max(X.minus(k).abs(),B.minus(X).abs());return k=X.minus(C),B=X.plus(C),{leftStatAreaPoints:b,rightStatAreaPoints:y,maxLeftHeight:h.multipliedBy(1.2),maxRightHeight:p.multipliedBy(1.2),minXLN10:k,maxXLN10:B,middlePriceLN10:X}}),[t])}({params:y}),q=b-30.13,O=n(null),R=e({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,X,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,X,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0,textColor:"#606066"},B),D=e=>{var i;const{current:n}=O,r=e.target;if(r&&n){const e=null===(i=r.getStage())||void 0===i?void 0:i.getPointerPosition();if(e){const{x:i}=e,r=t/2;if(Math.abs(i-r)<=2)return;if(i<=2||t-i<=2)return;const a=j({x:i,width:t,minXLN10:T,maxXLN10:J});let s=null,d=[];const g=i<r;if(g){const t=v({areaPoints:M,targetPrice:a,isLeft:g});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}else{const t=v({areaPoints:W,targetPrice:a,isLeft:g});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}if(s){const e=S({target:s.middlePrice}),r=H({minXLN10:T,maxXLN10:J,width:t,targetLN10:e}),a=P({maxHeight:g?C:F,gridAreaHeight:q,value:s.rectangleHeight}),m=n.findOne("#tooltip"),u=n.findOne("#toolTipVertLine"),h=n.findOne("#joinCircle"),p=n.findOne("#tooltip-Text"),c=n.findOne("#tooltip-tag"),x=n.findOne("#priceTextLabel"),L=null==x?void 0:x.findOne("#priceTextLabel-text"),w=n.findOne("#area");null==m||m.position({x:r,y:a-5-6}),null==p||p.fill(R.tooltipColor||(g?"#00FAD9":"#FF5072")),null==p||p.text(g?o("pool.chart.liquidity-chart-buy",{amount:f(s.area),symbol:N,price:f(s.price)}):o("pool.chart.liquidity-chart-sell",{amount:f(s.area),symbol:k,price:f(s.price)})),m&&c&&(m.width()/2>i?(c.pointerDirection("left"),c.pointerHeight(15),c.pointerWidth(8),m.offsetX(-11),m.offsetY(-11)):m.width()/2+i>t?(c.pointerDirection("right"),c.pointerHeight(15),c.pointerWidth(8),m.offsetX(11),m.offsetY(-11)):(c.pointerDirection("down"),c.pointerHeight(8),c.pointerWidth(15),m.offsetX(0),m.offsetY(0))),null==u||u.points([r,q,r,a]),null==u||u.stroke(g?"#55f6db":"#ff4f73");let A=g?"rgb(86, 246, 218)":"#FF5072",b=g?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";R.leftLine&&R.rightLine&&(A=g?R.leftLine:R.rightLine,b=g?`rgba(${l(R.leftLine)}, 0.4)`:`rgba(${l(R.rightLine)}, 0.4)`),h&&(h.x(r),h.y(a),h.fill(A),h.stroke(b)),x&&(x.x(r),x.y(q+8.08+1),x.offsetX(x.width()/2),x.x()-x.width()/2<0?x.x(x.width()/2):x.x()+x.width()/2>t?x.x(t-x.width()/2):x.x(i)),L&&(L.fill(R.tooltipColor||(g?"#00FAD9":"#FF5072")),L.text(f(s.price)));const y=[];for(const e of d){const{middlePrice:i,rectangleHeight:n}=e,r=S({target:i}),o=H({minXLN10:T,maxXLN10:J,width:t,targetLN10:r}),l=P({maxHeight:g?C:F,gridAreaHeight:q,value:n});y.push(o,l+1)}const v=y.slice(),[j,X]=v;g?(v.push(r,a),v.push(r,q),v.push(j,q),v.push(j,X)):(v.unshift(j,q),v.unshift(r,q),v.unshift(r,a)),w&&(w.points(v),w.fill(g?R.leftLine||"#2c5b56":R.rightLine||"#7b3a48")),n.show()}}}},z=function({gridAreaHeight:t,gridAreaWidth:e,horizontalLineCount:n,verticalLineCount:r,color:o="#2A2A2D"}){return i((()=>{const i=[],l=t/(n+1),s=[],d=e/(r+1);for(let t=0;t<n;t++){const n=l*(t+1);i.push([0,n,e,n])}for(let e=0;e<r;e++){const i=d*(e+1);s.push([i,0,i,t])}return c.jsxs(c.Fragment,{children:[i.map(((t,e)=>c.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e))),s.map(((t,e)=>c.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e)))]})}),[t,e,n,r,o])}({gridAreaHeight:q,gridAreaWidth:t,horizontalLineCount:9,verticalLineCount:7,color:R.grid}),G=function({minXLN10:t,maxXLN10:e,labelCount:n,gridAreaHeight:r,gridAreaWidth:o,color:l="#606066"}){return i((()=>{const i=o/(n+1),d=[],g=[];for(let l=0;l<n;l++){const n=i/2+i*l;d.push({x:n,y:r+10.08+1,text:f(j({x:i*(l+1),width:o,minXLN10:t,maxXLN10:e}))});const a=i*(l+1);g.push([a,r+1,a,r+4+1])}return c.jsxs(c.Fragment,{children:[d.map(((t,e)=>c.jsx(s,{x:t.x,y:t.y,text:t.text,fontSize:14,fontFamily:"Manrope",fill:l,width:i,padding:0,align:"center",verticalAlign:"bottom",listening:!1},e))),g.map(((t,e)=>c.jsx(a,{points:t,stroke:l,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},e)))]})}),[t,e,r,o,n])}({gridAreaHeight:q,gridAreaWidth:t,labelCount:7,minXLN10:T,maxXLN10:J,color:R.textColor}),Q=function({gridAreaHeight:t,gridAreaWidth:e,color:n="#606066"}){return i((()=>{const i=e/2;return c.jsx(a,{points:[i,0,i,t-1],stroke:n,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1})}),[t,e,n])}({gridAreaHeight:q,gridAreaWidth:t,color:R.midPriceLine}),{leftLine:E,rightLine:Y}=function({leftStatAreaPoints:t,rightStatAreaPoints:e,minXLN10:n,maxXLN10:r,maxLeftHeight:o,maxRightHeight:l,gridAreaWidth:s,gridAreaHeight:d,colorMap:g}){return{leftLine:i((()=>{if(t.length<1)return c.jsx(c.Fragment,{});const e=[];let i=d;for(const l of t){const{middlePrice:t,rectangleHeight:a}=l,g=S({target:t}),m=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:g}),u=P({maxHeight:o,gridAreaHeight:d,value:a});e.push(m,u),u<i&&(i=u)}const l=e.slice(),[m,u]=l,h=l[l.length-1],p=l[l.length-2];return l.push(p,h),l.push(p,d),l.push(m,d),l.push(m,u),c.jsxs(c.Fragment,{children:[c.jsx(a,{points:l,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:g.leftBg}),c.jsx(a,{points:e,stroke:g.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[t,s,n,r,d,o]),rightLine:i((()=>{if(e.length<1)return c.jsx(c.Fragment,{});const t=[];let i=d;for(const o of e){const{middlePrice:e,rectangleHeight:a}=o,g=S({target:e}),m=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:g}),u=P({maxHeight:l,gridAreaHeight:d,value:a});t.push(m,u),u<i&&(i=u)}const o=t.slice(),[m]=o;return o.unshift(m,d),o.unshift(s,d),c.jsxs(c.Fragment,{children:[c.jsx(a,{points:o,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:g.rightBg}),c.jsx(a,{points:t,stroke:g.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[e,s,n,r,d,l])}}({leftStatAreaPoints:M,rightStatAreaPoints:W,minXLN10:T,maxXLN10:J,maxLeftHeight:C,maxRightHeight:F,gridAreaWidth:t,gridAreaHeight:q,colorMap:R});return c.jsxs(d,{width:t,height:b,onMouseMove:D,onMouseOver:D,onMouseEnter:D,onMouseOut:()=>{const{current:t}=O;t&&t.hide()},children:[c.jsxs(g,{children:[c.jsx(m,{x:0,y:0,width:t,height:q,stroke:R.grid,strokeWidth:1}),z,G,E,Y,Q]}),c.jsxs(g,{ref:O,visible:!1,children:[c.jsx(a,{points:[],closed:!0,listening:!1,lineCap:"round",lineJoin:"round",id:"area"}),c.jsx(a,{points:[],strokeWidth:1,stroke:"#ff4f73",lineJoin:"round",lineCap:"round",dash:[4,6],id:"toolTipVertLine"}),c.jsx(u,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),c.jsxs(h,{listening:!1,x:0,y:0,id:"priceTextLabel",children:[c.jsx(p,{fill:R.tooltipBg,id:"priceTextLabel-tag"}),c.jsx(s,{text:"-",fontSize:14,fontFamily:"Manrope",padding:2,fill:"#FF5072",id:"priceTextLabel-text"})]}),c.jsxs(h,{listening:!1,id:"tooltip",children:[c.jsx(p,{fill:R.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"tooltip-tag"}),c.jsx(s,{text:"",fontFamily:"Manrope",fontSize:12,lineHeight:17/12,padding:r,fill:"#FF5072",id:"tooltip-Text"})]})]})]})}const B=({width:t=834,height:e=462,baseTokenSymbol:i,quoteTokenSymbol:n,pmmModel:r,pmmParams:l,midPrice:a,notShowTipText:s,colorMap:d})=>c.jsxs(b,{children:[void 0!==l&&void 0!==a&&void 0!==r&&void 0!==a&&c.jsx(k,{width:t,height:e,params:l,midPrice:a,pmmModel:r,baseTokenSymbol:i,quoteTokenSymbol:n,colorMap:d}),s?"":c.jsxs(y,{children:["* ",o("pool.chart.liquidity-chart-tip",{baseTokenSymbol:i})]})]});export{B as default};