@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.
- package/dist/cjs/e2e/connect.test.d.ts +6 -0
- package/dist/cjs/e2e/constants.d.ts +87 -0
- package/dist/cjs/e2e/default.test.d.ts +6 -0
- package/dist/cjs/e2e/setup.d.ts +4 -0
- package/dist/cjs/helper-DNaeIBQY.cjs +1 -0
- package/dist/cjs/index-BZtt1iuv.cjs +12 -0
- package/dist/cjs/index-CULtuKOC.cjs +78 -0
- package/dist/cjs/index-DWLX0NSs.cjs +53 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/lottie-4VzKv4A8.cjs +1 -0
- 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 +18 -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 +8 -0
- package/dist/cjs/src/components/ErrorMessageDialog.d.ts +5 -0
- package/dist/cjs/src/components/Swap/components/ConnectWallet/ConnectWalletDialog.d.ts +5 -0
- package/dist/cjs/src/components/Swap/components/ConnectWallet/index.d.ts +9 -0
- package/dist/cjs/src/components/Swap/components/Dialog.d.ts +14 -0
- package/dist/cjs/src/components/Swap/components/ReviewDialog.d.ts +22 -0
- package/dist/cjs/src/components/Swap/components/SettingsDialog/NumberInput.d.ts +8 -0
- package/dist/cjs/src/components/Swap/components/SettingsDialog/index.d.ts +7 -0
- package/dist/cjs/src/components/Swap/components/SwitchBox.d.ts +5 -0
- package/dist/cjs/src/components/Swap/components/TokenCard/BalanceText.d.ts +9 -0
- package/dist/cjs/src/components/Swap/components/TokenCard/NumberInput.d.ts +13 -0
- package/dist/cjs/src/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +7 -0
- package/dist/cjs/src/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +13 -0
- package/dist/cjs/src/components/Swap/components/TokenCard/index.d.ts +23 -0
- package/dist/cjs/src/components/Swap/components/TokenPairPriceWithToggle.d.ts +10 -0
- package/dist/cjs/src/components/Swap/index.d.ts +9 -0
- package/dist/cjs/src/components/SwitchChainDialog/index.d.ts +7 -0
- package/dist/cjs/src/components/TokenLogo.d.ts +16 -0
- package/dist/cjs/src/components/TokenPicker/PopularToken.d.ts +7 -0
- package/dist/cjs/src/components/TokenPicker/SelectChainItem.d.ts +7 -0
- package/dist/cjs/src/components/TokenPicker/TokenItem.d.ts +8 -0
- package/dist/cjs/src/components/TokenPicker/index.d.ts +19 -0
- package/dist/cjs/src/components/Tooltip/QuestionTooltip.d.ts +3 -0
- package/dist/cjs/src/components/Tooltip/index.d.ts +1 -0
- package/dist/cjs/src/components/Widget/i18n.d.ts +9 -0
- package/dist/cjs/src/components/Widget/index.d.ts +34 -0
- package/dist/cjs/src/components/WithExecutionDialog/index.d.ts +5 -0
- package/dist/cjs/src/constants/address.d.ts +1 -0
- package/dist/cjs/src/constants/api.d.ts +16 -0
- package/dist/cjs/src/constants/chainList.d.ts +9 -0
- package/dist/cjs/src/constants/chains.d.ts +42 -0
- package/dist/cjs/src/constants/locales.d.ts +3 -0
- package/dist/cjs/src/constants/localstorage.d.ts +12 -0
- package/dist/cjs/src/constants/swap.d.ts +7 -0
- package/dist/cjs/src/constants/testId.d.ts +10 -0
- package/dist/cjs/src/constants/token.d.ts +2 -0
- package/dist/cjs/src/constants/tokenList.d.ts +18 -0
- package/dist/cjs/src/constants/wallet.d.ts +23 -0
- package/dist/cjs/src/hooks/Bridge/createBridgeOrder.d.ts +28 -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 +113 -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/Connectors/JsonRpcConnector.d.ts +9 -0
- package/dist/cjs/src/hooks/ConnectWallet/TonConnect/index.d.ts +26 -0
- package/dist/cjs/src/hooks/ConnectWallet/index.d.ts +3 -0
- package/dist/cjs/src/hooks/ConnectWallet/useCurrentChainId.d.ts +2 -0
- package/dist/cjs/src/hooks/ConnectWallet/useSwitchChain.d.ts +10 -0
- package/dist/cjs/src/hooks/ConnectWallet/useWalletState.d.ts +24 -0
- package/dist/cjs/src/hooks/ConnectWallet/useWeb3Connectors.d.ts +17 -0
- package/dist/cjs/src/hooks/ConnectWallet/web3.d.ts +10 -0
- package/dist/cjs/src/hooks/Submission/getExecutionErrorMsg.d.ts +2 -0
- package/dist/cjs/src/hooks/Submission/index.d.ts +10 -0
- package/dist/cjs/src/hooks/Submission/spec.d.ts +56 -0
- package/dist/cjs/src/hooks/Submission/types.d.ts +50 -0
- package/dist/cjs/src/hooks/Submission/useExecution.d.ts +31 -0
- package/dist/cjs/src/hooks/Submission/useInflights.d.ts +5 -0
- package/dist/cjs/src/hooks/Swap/index.d.ts +5 -0
- package/dist/cjs/src/hooks/Swap/useExecuteSwap.d.ts +12 -0
- package/dist/cjs/src/hooks/Swap/useFetchFiatPrice.d.ts +13 -0
- package/dist/cjs/src/hooks/Swap/useFetchFiatPrice.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Swap/useFetchRoutePrice.d.ts +37 -0
- package/dist/cjs/src/hooks/Swap/useFetchRoutePrice.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Swap/useInitDefaultToken.d.ts +10 -0
- package/dist/cjs/src/hooks/Swap/useMarginAmount.d.ts +8 -0
- package/dist/cjs/src/hooks/Swap/useMarginAmount.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Swap/usePriceTimer.d.ts +5 -0
- package/dist/cjs/src/hooks/Swap/useSlippageLimit.d.ts +2 -0
- package/dist/cjs/src/hooks/Token/index.d.ts +4 -0
- package/dist/cjs/src/hooks/Token/type.d.ts +26 -0
- package/dist/cjs/src/hooks/Token/useDisabledTokenSwitch.d.ts +5 -0
- package/dist/cjs/src/hooks/Token/useFetchTokenAllowance.d.ts +13 -0
- package/dist/cjs/src/hooks/Token/useFindTokenByAddress.d.ts +1 -0
- package/dist/cjs/src/hooks/Token/useFindTokenByAddress.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Token/useGetAllowance.d.ts +3 -0
- package/dist/cjs/src/hooks/Token/useGetAllowance.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Token/useGetBalance.d.ts +2 -0
- package/dist/cjs/src/hooks/Token/useGetBalance.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Token/useGetCGTokenList.d.ts +15 -0
- package/dist/cjs/src/hooks/Token/useGetTokenStatus.d.ts +13 -0
- package/dist/cjs/src/hooks/Token/useGetTokenStatus.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Token/useInitTokenList.d.ts +8 -0
- package/dist/cjs/src/hooks/Token/useSelectChainList.d.ts +7 -0
- package/dist/cjs/src/hooks/Token/useSelectChainList.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Token/useTokenList.d.ts +30 -0
- package/dist/cjs/src/hooks/Token/useTokenList.test.d.ts +1 -0
- package/dist/cjs/src/hooks/Token/useTokenListFetchBalance.d.ts +9 -0
- package/dist/cjs/src/hooks/Widget/useInitPropsToRedux.d.ts +2 -0
- package/dist/cjs/src/hooks/contract/abis/OrbiterV3ABI.d.ts +85 -0
- package/dist/cjs/src/hooks/contract/abis/erc20ABI.d.ts +30 -0
- package/dist/cjs/src/hooks/contract/abis/erc20Helper.d.ts +16 -0
- package/dist/cjs/src/hooks/contract/abis/multicallABI.d.ts +34 -0
- package/dist/cjs/src/hooks/contract/batch.d.ts +18 -0
- package/dist/cjs/src/hooks/contract/contractConfig.d.ts +9 -0
- package/dist/cjs/src/hooks/contract/index.d.ts +5 -0
- package/dist/cjs/src/hooks/contract/orbiter/constants.d.ts +3 -0
- package/dist/cjs/src/hooks/contract/orbiter/encodeOrbiterBridge.d.ts +12 -0
- package/dist/cjs/src/hooks/contract/orbiter/useOrbiterContractMap.d.ts +5 -0
- package/dist/cjs/src/hooks/contract/orbiter/useOrbiterRouters.d.ts +21 -0
- package/dist/cjs/src/hooks/contract/provider.d.ts +2 -0
- package/dist/cjs/src/hooks/contract/token.d.ts +10 -0
- package/dist/cjs/src/hooks/contract/useFetchBlockNumber.d.ts +3 -0
- package/dist/cjs/src/hooks/contract/useFetchETHBalance.d.ts +1 -0
- package/dist/cjs/src/hooks/contract/useFetchTokens.d.ts +19 -0
- package/dist/cjs/src/hooks/contract/useMultiContract.d.ts +14 -0
- package/dist/cjs/src/hooks/contract/wallet.d.ts +16 -0
- package/dist/cjs/src/hooks/setting/useDefaultSlippage.d.ts +4 -0
- package/dist/cjs/src/hooks/setting/useGetAPIService.d.ts +2 -0
- package/dist/cjs/src/hooks/setting/useSetAutoSlippage.d.ts +13 -0
- package/dist/cjs/src/index.d.ts +6 -0
- package/dist/cjs/src/store/actions/globals.d.ts +9 -0
- package/dist/cjs/src/store/actions/index.d.ts +4 -0
- package/dist/cjs/src/store/actions/settings.d.ts +6 -0
- package/dist/cjs/src/store/actions/token.d.ts +15 -0
- package/dist/cjs/src/store/actions/wallet.d.ts +5 -0
- package/dist/cjs/src/store/index.d.ts +6 -0
- package/dist/cjs/src/store/reducers/globals.d.ts +23 -0
- package/dist/cjs/src/store/reducers/index.d.ts +17 -0
- package/dist/cjs/src/store/reducers/settings.d.ts +13 -0
- package/dist/cjs/src/store/reducers/token.d.ts +31 -0
- package/dist/cjs/src/store/reducers/wallet.d.ts +10 -0
- package/dist/cjs/src/store/selectors/globals.d.ts +7 -0
- package/dist/cjs/src/store/selectors/settings.d.ts +4 -0
- package/dist/cjs/src/store/selectors/token.d.ts +19 -0
- package/dist/cjs/src/store/selectors/wallet.d.ts +4 -0
- package/dist/cjs/src/utils/address.d.ts +15 -0
- package/dist/cjs/src/utils/address.test.d.ts +1 -0
- package/dist/cjs/src/utils/chains.d.ts +2 -0
- package/dist/cjs/src/utils/chains.test.d.ts +1 -0
- package/dist/cjs/src/utils/formatter.d.ts +25 -0
- package/dist/cjs/src/utils/formatter.test.d.ts +1 -0
- package/dist/cjs/src/utils/index.d.ts +5 -0
- package/dist/cjs/src/utils/time.d.ts +9 -0
- package/dist/cjs/src/utils/time.test.d.ts +1 -0
- package/dist/cjs/src/utils/token.d.ts +9 -0
- package/dist/cjs/src/utils/token.test.d.ts +1 -0
- package/dist/cjs/src/utils/wallet.d.ts +8 -0
- package/dist/cjs/src/utils/wallet.test.d.ts +1 -0
- package/dist/e2e/connect.test.d.ts +6 -0
- package/dist/e2e/constants.d.ts +87 -0
- package/dist/e2e/default.test.d.ts +6 -0
- package/dist/e2e/setup.d.ts +4 -0
- package/dist/helper-D1mp2p4F.js +1 -0
- package/dist/index-CE6izMXy.js +12 -0
- package/dist/index-CEwSZbo5.js +53 -0
- package/dist/index-Duga8SDh.js +78 -0
- package/dist/index.js +1 -1
- package/dist/lottie-DMZ5X1eY.js +1 -0
- 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 +18 -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 +8 -0
- package/dist/src/components/ErrorMessageDialog.d.ts +5 -0
- package/dist/src/components/Swap/components/ConnectWallet/ConnectWalletDialog.d.ts +5 -0
- package/dist/src/components/Swap/components/ConnectWallet/index.d.ts +9 -0
- package/dist/src/components/Swap/components/Dialog.d.ts +14 -0
- package/dist/src/components/Swap/components/ReviewDialog.d.ts +22 -0
- package/dist/src/components/Swap/components/SettingsDialog/NumberInput.d.ts +8 -0
- package/dist/src/components/Swap/components/SettingsDialog/index.d.ts +7 -0
- package/dist/src/components/Swap/components/SwitchBox.d.ts +5 -0
- package/dist/src/components/Swap/components/TokenCard/BalanceText.d.ts +9 -0
- package/dist/src/components/Swap/components/TokenCard/NumberInput.d.ts +13 -0
- package/dist/src/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +7 -0
- package/dist/src/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +13 -0
- package/dist/src/components/Swap/components/TokenCard/index.d.ts +23 -0
- package/dist/src/components/Swap/components/TokenPairPriceWithToggle.d.ts +10 -0
- package/dist/src/components/Swap/index.d.ts +9 -0
- package/dist/src/components/SwitchChainDialog/index.d.ts +7 -0
- package/dist/src/components/TokenLogo.d.ts +16 -0
- package/dist/src/components/TokenPicker/PopularToken.d.ts +7 -0
- package/dist/src/components/TokenPicker/SelectChainItem.d.ts +7 -0
- package/dist/src/components/TokenPicker/TokenItem.d.ts +8 -0
- package/dist/src/components/TokenPicker/index.d.ts +19 -0
- package/dist/src/components/Tooltip/QuestionTooltip.d.ts +3 -0
- package/dist/src/components/Tooltip/index.d.ts +1 -0
- package/dist/src/components/Widget/i18n.d.ts +9 -0
- package/dist/src/components/Widget/index.d.ts +34 -0
- package/dist/src/components/WithExecutionDialog/index.d.ts +5 -0
- package/dist/src/constants/address.d.ts +1 -0
- package/dist/src/constants/api.d.ts +16 -0
- package/dist/src/constants/chainList.d.ts +9 -0
- package/dist/src/constants/chains.d.ts +42 -0
- package/dist/src/constants/locales.d.ts +3 -0
- package/dist/src/constants/localstorage.d.ts +12 -0
- package/dist/src/constants/swap.d.ts +7 -0
- package/dist/src/constants/testId.d.ts +10 -0
- package/dist/src/constants/token.d.ts +2 -0
- package/dist/src/constants/tokenList.d.ts +18 -0
- package/dist/src/constants/wallet.d.ts +23 -0
- package/dist/src/hooks/Bridge/createBridgeOrder.d.ts +28 -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 +113 -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/Connectors/JsonRpcConnector.d.ts +9 -0
- package/dist/src/hooks/ConnectWallet/TonConnect/index.d.ts +26 -0
- package/dist/src/hooks/ConnectWallet/index.d.ts +3 -0
- package/dist/src/hooks/ConnectWallet/useCurrentChainId.d.ts +2 -0
- package/dist/src/hooks/ConnectWallet/useSwitchChain.d.ts +10 -0
- package/dist/src/hooks/ConnectWallet/useWalletState.d.ts +24 -0
- package/dist/src/hooks/ConnectWallet/useWeb3Connectors.d.ts +17 -0
- package/dist/src/hooks/ConnectWallet/web3.d.ts +10 -0
- package/dist/src/hooks/Submission/getExecutionErrorMsg.d.ts +2 -0
- package/dist/src/hooks/Submission/index.d.ts +10 -0
- package/dist/src/hooks/Submission/spec.d.ts +56 -0
- package/dist/src/hooks/Submission/types.d.ts +50 -0
- package/dist/src/hooks/Submission/useExecution.d.ts +31 -0
- package/dist/src/hooks/Submission/useInflights.d.ts +5 -0
- package/dist/src/hooks/Swap/index.d.ts +5 -0
- package/dist/src/hooks/Swap/useExecuteSwap.d.ts +12 -0
- package/dist/src/hooks/Swap/useFetchFiatPrice.d.ts +13 -0
- package/dist/src/hooks/Swap/useFetchFiatPrice.test.d.ts +1 -0
- package/dist/src/hooks/Swap/useFetchRoutePrice.d.ts +37 -0
- package/dist/src/hooks/Swap/useFetchRoutePrice.test.d.ts +1 -0
- package/dist/src/hooks/Swap/useInitDefaultToken.d.ts +10 -0
- package/dist/src/hooks/Swap/useMarginAmount.d.ts +8 -0
- package/dist/src/hooks/Swap/useMarginAmount.test.d.ts +1 -0
- package/dist/src/hooks/Swap/usePriceTimer.d.ts +5 -0
- package/dist/src/hooks/Swap/useSlippageLimit.d.ts +2 -0
- package/dist/src/hooks/Token/index.d.ts +4 -0
- package/dist/src/hooks/Token/type.d.ts +26 -0
- package/dist/src/hooks/Token/useDisabledTokenSwitch.d.ts +5 -0
- package/dist/src/hooks/Token/useFetchTokenAllowance.d.ts +13 -0
- package/dist/src/hooks/Token/useFindTokenByAddress.d.ts +1 -0
- package/dist/src/hooks/Token/useFindTokenByAddress.test.d.ts +1 -0
- package/dist/src/hooks/Token/useGetAllowance.d.ts +3 -0
- package/dist/src/hooks/Token/useGetAllowance.test.d.ts +1 -0
- package/dist/src/hooks/Token/useGetBalance.d.ts +2 -0
- package/dist/src/hooks/Token/useGetBalance.test.d.ts +1 -0
- package/dist/src/hooks/Token/useGetCGTokenList.d.ts +15 -0
- package/dist/src/hooks/Token/useGetTokenStatus.d.ts +13 -0
- package/dist/src/hooks/Token/useGetTokenStatus.test.d.ts +1 -0
- package/dist/src/hooks/Token/useInitTokenList.d.ts +8 -0
- package/dist/src/hooks/Token/useSelectChainList.d.ts +7 -0
- package/dist/src/hooks/Token/useSelectChainList.test.d.ts +1 -0
- package/dist/src/hooks/Token/useTokenList.d.ts +30 -0
- package/dist/src/hooks/Token/useTokenList.test.d.ts +1 -0
- package/dist/src/hooks/Token/useTokenListFetchBalance.d.ts +9 -0
- package/dist/src/hooks/Widget/useInitPropsToRedux.d.ts +2 -0
- package/dist/src/hooks/contract/abis/OrbiterV3ABI.d.ts +85 -0
- package/dist/src/hooks/contract/abis/erc20ABI.d.ts +30 -0
- package/dist/src/hooks/contract/abis/erc20Helper.d.ts +16 -0
- package/dist/src/hooks/contract/abis/multicallABI.d.ts +34 -0
- package/dist/src/hooks/contract/batch.d.ts +18 -0
- package/dist/src/hooks/contract/contractConfig.d.ts +9 -0
- package/dist/src/hooks/contract/index.d.ts +5 -0
- package/dist/src/hooks/contract/orbiter/constants.d.ts +3 -0
- package/dist/src/hooks/contract/orbiter/encodeOrbiterBridge.d.ts +12 -0
- package/dist/src/hooks/contract/orbiter/useOrbiterContractMap.d.ts +5 -0
- package/dist/src/hooks/contract/orbiter/useOrbiterRouters.d.ts +21 -0
- package/dist/src/hooks/contract/provider.d.ts +2 -0
- package/dist/src/hooks/contract/token.d.ts +10 -0
- package/dist/src/hooks/contract/useFetchBlockNumber.d.ts +3 -0
- package/dist/src/hooks/contract/useFetchETHBalance.d.ts +1 -0
- package/dist/src/hooks/contract/useFetchTokens.d.ts +19 -0
- package/dist/src/hooks/contract/useMultiContract.d.ts +14 -0
- package/dist/src/hooks/contract/wallet.d.ts +16 -0
- package/dist/src/hooks/setting/useDefaultSlippage.d.ts +4 -0
- package/dist/src/hooks/setting/useGetAPIService.d.ts +2 -0
- package/dist/src/hooks/setting/useSetAutoSlippage.d.ts +13 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/store/actions/globals.d.ts +9 -0
- package/dist/src/store/actions/index.d.ts +4 -0
- package/dist/src/store/actions/settings.d.ts +6 -0
- package/dist/src/store/actions/token.d.ts +15 -0
- package/dist/src/store/actions/wallet.d.ts +5 -0
- package/dist/src/store/index.d.ts +6 -0
- package/dist/src/store/reducers/globals.d.ts +23 -0
- package/dist/src/store/reducers/index.d.ts +17 -0
- package/dist/src/store/reducers/settings.d.ts +13 -0
- package/dist/src/store/reducers/token.d.ts +31 -0
- package/dist/src/store/reducers/wallet.d.ts +10 -0
- package/dist/src/store/selectors/globals.d.ts +7 -0
- package/dist/src/store/selectors/settings.d.ts +4 -0
- package/dist/src/store/selectors/token.d.ts +19 -0
- package/dist/src/store/selectors/wallet.d.ts +4 -0
- package/dist/src/utils/address.d.ts +15 -0
- package/dist/src/utils/address.test.d.ts +1 -0
- package/dist/src/utils/chains.d.ts +2 -0
- package/dist/src/utils/chains.test.d.ts +1 -0
- package/dist/src/utils/formatter.d.ts +25 -0
- package/dist/src/utils/formatter.test.d.ts +1 -0
- package/dist/src/utils/index.d.ts +5 -0
- package/dist/src/utils/time.d.ts +9 -0
- package/dist/src/utils/time.test.d.ts +1 -0
- package/dist/src/utils/token.d.ts +9 -0
- package/dist/src/utils/token.test.d.ts +1 -0
- package/dist/src/utils/wallet.d.ts +8 -0
- package/dist/src/utils/wallet.test.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare enum WalletType {
|
|
3
|
+
INTEGRATOR = "integrator",
|
|
4
|
+
METAMASK = "metamask",
|
|
5
|
+
WALLET_CONNECT = "walletConnect"
|
|
6
|
+
}
|
|
7
|
+
export declare const WalletMap: {
|
|
8
|
+
metamask: {
|
|
9
|
+
name: string;
|
|
10
|
+
type: WalletType;
|
|
11
|
+
icon: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
12
|
+
title?: string | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
link: string;
|
|
15
|
+
};
|
|
16
|
+
walletConnect: {
|
|
17
|
+
name: string;
|
|
18
|
+
type: WalletType;
|
|
19
|
+
icon: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
20
|
+
title?: string | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BridgeRouteI } from './useFetchRoutePriceBridge';
|
|
2
|
+
export interface BridgeOrderCreateParams {
|
|
3
|
+
fromChainId: number;
|
|
4
|
+
fromAmount: string;
|
|
5
|
+
fromTokenAddress: string;
|
|
6
|
+
toChainId: number;
|
|
7
|
+
toAmount: string;
|
|
8
|
+
toTokenAddress: string;
|
|
9
|
+
fromAddress: string;
|
|
10
|
+
toAddress: string;
|
|
11
|
+
slippage: number;
|
|
12
|
+
hash: string;
|
|
13
|
+
product: string | null;
|
|
14
|
+
extend: {
|
|
15
|
+
lifiBridge: Exclude<BridgeRouteI['sourceRoute'], undefined>['step']['tool'];
|
|
16
|
+
route: BridgeRouteI['sourceRoute'];
|
|
17
|
+
productParams: BridgeRouteI['productParams'];
|
|
18
|
+
encodeId: string;
|
|
19
|
+
source: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare function createBridgeOrder({ apikey, tx, route, bridgeCreateRouteAPI, encodeId, }: {
|
|
23
|
+
apikey?: string;
|
|
24
|
+
tx: string;
|
|
25
|
+
route: BridgeRouteI;
|
|
26
|
+
bridgeCreateRouteAPI: string;
|
|
27
|
+
encodeId: string;
|
|
28
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BridgeTXRequest } from '../../components/Bridge/BridgeSummaryDialog';
|
|
2
|
+
import { BridgeRouteI } from './useFetchRoutePriceBridge';
|
|
3
|
+
export default function useExecuteBridgeRoute({ route, bridgeOrderTxRequest, }: {
|
|
4
|
+
route?: BridgeRouteI;
|
|
5
|
+
bridgeOrderTxRequest?: BridgeTXRequest;
|
|
6
|
+
}): () => Promise<import("../Submission/types").ExecutionResult> | undefined;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { TokenInfo } from '../Token';
|
|
2
|
+
import BigNumber from 'bignumber.js';
|
|
3
|
+
export interface BridgeRouteI {
|
|
4
|
+
/** update */
|
|
5
|
+
key: string;
|
|
6
|
+
/** only one */
|
|
7
|
+
id: string;
|
|
8
|
+
fromToken: TokenInfo;
|
|
9
|
+
toToken: TokenInfo;
|
|
10
|
+
fromChainId: number;
|
|
11
|
+
toChainId: number;
|
|
12
|
+
/** from parameter */
|
|
13
|
+
fromAmount: string;
|
|
14
|
+
toTokenAmount: BigNumber;
|
|
15
|
+
/** from parameter */
|
|
16
|
+
fromAddress: string;
|
|
17
|
+
toAddress: string;
|
|
18
|
+
/** from parameter */
|
|
19
|
+
product: string | null;
|
|
20
|
+
slippage?: number;
|
|
21
|
+
/** in seconds */
|
|
22
|
+
roundedRouteCostTime: number;
|
|
23
|
+
/** approve contract address */
|
|
24
|
+
spenderContractAddress?: string;
|
|
25
|
+
/** USD */
|
|
26
|
+
feeUSD: string | null;
|
|
27
|
+
/** in seconds */
|
|
28
|
+
executionDuration: number | null;
|
|
29
|
+
/** one-click */
|
|
30
|
+
step: BridgeStep;
|
|
31
|
+
encodeParams?: any;
|
|
32
|
+
encodeResultData?: {
|
|
33
|
+
data: string;
|
|
34
|
+
to: string;
|
|
35
|
+
value: string;
|
|
36
|
+
from: string;
|
|
37
|
+
chainId: number;
|
|
38
|
+
encodeId?: string;
|
|
39
|
+
};
|
|
40
|
+
productParams: any;
|
|
41
|
+
sourceRoute?: {
|
|
42
|
+
toAmount: string;
|
|
43
|
+
feeUSD: string | null;
|
|
44
|
+
executionDuration: number | null;
|
|
45
|
+
step: {
|
|
46
|
+
tool: string;
|
|
47
|
+
toolDetails: {
|
|
48
|
+
logoURI: string | null;
|
|
49
|
+
name: string | null;
|
|
50
|
+
key: string | null;
|
|
51
|
+
};
|
|
52
|
+
type: string | null;
|
|
53
|
+
approvalAddress: string;
|
|
54
|
+
includedSteps: any;
|
|
55
|
+
};
|
|
56
|
+
fee: any;
|
|
57
|
+
};
|
|
58
|
+
minAmt?: string;
|
|
59
|
+
maxAmt?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface BridgeTokenI {
|
|
62
|
+
id: number;
|
|
63
|
+
symbol: string;
|
|
64
|
+
name: string;
|
|
65
|
+
address: string;
|
|
66
|
+
decimals: number;
|
|
67
|
+
logoUrl: string;
|
|
68
|
+
chainId: number;
|
|
69
|
+
stableCurrencyToken: boolean;
|
|
70
|
+
mainCurrencyToken: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface BridgeStepTool {
|
|
73
|
+
name: string;
|
|
74
|
+
logoURI: string;
|
|
75
|
+
}
|
|
76
|
+
export interface BridgeStepEstimate {
|
|
77
|
+
fromToken: Pick<BridgeTokenI, 'address' | 'symbol' | 'chainId' | 'decimals'>;
|
|
78
|
+
toToken: Pick<BridgeTokenI, 'address' | 'symbol' | 'chainId' | 'decimals'>;
|
|
79
|
+
fromTokenAmount: BigNumber;
|
|
80
|
+
toTokenAmount: BigNumber;
|
|
81
|
+
}
|
|
82
|
+
export interface BridgeStep {
|
|
83
|
+
tool: string;
|
|
84
|
+
toolDetails: BridgeStepTool;
|
|
85
|
+
type: string | null;
|
|
86
|
+
includedSteps?: Array<{
|
|
87
|
+
id: string;
|
|
88
|
+
/**
|
|
89
|
+
* bridge or swap
|
|
90
|
+
*/
|
|
91
|
+
tool: string;
|
|
92
|
+
toolDetails: BridgeStepTool;
|
|
93
|
+
type: string;
|
|
94
|
+
estimate: BridgeStepEstimate;
|
|
95
|
+
}>;
|
|
96
|
+
}
|
|
97
|
+
export declare enum RoutePriceStatus {
|
|
98
|
+
Initial = "Initial",
|
|
99
|
+
Loading = "Loading",
|
|
100
|
+
Failed = "Failed",
|
|
101
|
+
Success = "Success"
|
|
102
|
+
}
|
|
103
|
+
export interface FetchRoutePrice {
|
|
104
|
+
fromToken: TokenInfo | null;
|
|
105
|
+
toToken: TokenInfo | null;
|
|
106
|
+
fromAmount: string;
|
|
107
|
+
fromFiatPrice: string;
|
|
108
|
+
}
|
|
109
|
+
export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, fromFiatPrice, }: FetchRoutePrice): {
|
|
110
|
+
status: RoutePriceStatus;
|
|
111
|
+
refetch: () => Promise<void>;
|
|
112
|
+
bridgeRouteList: BridgeRouteI[];
|
|
113
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import BigNumber from 'bignumber.js';
|
|
3
|
+
import { BridgeRouteI } from './useFetchRoutePriceBridge';
|
|
4
|
+
import { BridgeTXRequest } from '../../components/Bridge/BridgeSummaryDialog';
|
|
5
|
+
export declare function useSendRoute(): {
|
|
6
|
+
apikey: string | undefined;
|
|
7
|
+
sendRouteLoading: boolean;
|
|
8
|
+
sendRouteError: string;
|
|
9
|
+
setSendRouteError: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
10
|
+
bridgeOrderTxRequest: BridgeTXRequest | undefined;
|
|
11
|
+
handleClickSend: ({ selectedRoute, fromEtherTokenBalance, goNext, }: {
|
|
12
|
+
selectedRoute?: BridgeRouteI | undefined;
|
|
13
|
+
fromEtherTokenBalance: BigNumber | null;
|
|
14
|
+
goNext: () => void;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useSwitchBridgeOrSwapSlippage(isBridge: boolean | undefined): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
+
import { Actions, Connector } from '@web3-react/types';
|
|
3
|
+
export default class JsonRpcConnector extends Connector {
|
|
4
|
+
customProvider: JsonRpcProvider;
|
|
5
|
+
constructor(actions: Actions, customProvider: JsonRpcProvider, onError?: (error: Error) => void);
|
|
6
|
+
private activateAccounts;
|
|
7
|
+
connectEagerly(): Promise<void>;
|
|
8
|
+
activate(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TonConnectUI } from '@tonconnect/ui';
|
|
2
|
+
import { TonClient, TonClient4 } from 'ton';
|
|
3
|
+
import BigNumber from 'bignumber.js';
|
|
4
|
+
/**
|
|
5
|
+
* https://ton-community.github.io/ton/modules.html
|
|
6
|
+
* https://ton-org.github.io/ton-core/modules.html
|
|
7
|
+
* https://toncenter.com/api/v2/
|
|
8
|
+
*/
|
|
9
|
+
interface TonConnectState {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
client?: TonClient;
|
|
12
|
+
clientV4?: TonClient4;
|
|
13
|
+
tonConnectUI?: TonConnectUI;
|
|
14
|
+
connected?: {
|
|
15
|
+
chainId: number;
|
|
16
|
+
account: string;
|
|
17
|
+
};
|
|
18
|
+
initialize: () => void;
|
|
19
|
+
connect: () => Promise<void>;
|
|
20
|
+
getBlockNumber: () => Promise<number>;
|
|
21
|
+
getJettonWallet: (jettonMasterAddress: string) => Promise<string>;
|
|
22
|
+
getBalance: (account: string) => Promise<BigNumber>;
|
|
23
|
+
getTokenBalance: (jettonMasterAddress: string, decimals: number) => Promise<BigNumber>;
|
|
24
|
+
}
|
|
25
|
+
declare const useTonConnectStore: import("zustand").UseBoundStore<import("zustand").StoreApi<TonConnectState>>;
|
|
26
|
+
export default useTonConnectStore;
|
|
@@ -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;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
export declare function useWalletState({ isTon, }?: {
|
|
3
|
+
isTon?: boolean;
|
|
4
|
+
}): {
|
|
5
|
+
isTon: boolean;
|
|
6
|
+
chainId: number | undefined;
|
|
7
|
+
account: string | undefined;
|
|
8
|
+
isMetamask: boolean;
|
|
9
|
+
autoConnect: (chainId?: number) => Promise<void>;
|
|
10
|
+
connect: () => Promise<void>;
|
|
11
|
+
getLastBlockNumber: () => Promise<number>;
|
|
12
|
+
getBalance: (account: string) => Promise<BigNumber>;
|
|
13
|
+
provider?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
isTon: boolean;
|
|
16
|
+
chainId: number | undefined;
|
|
17
|
+
account: string | undefined;
|
|
18
|
+
isMetamask: boolean | undefined;
|
|
19
|
+
autoConnect: (chainId?: number) => Promise<void>;
|
|
20
|
+
connect: () => void | Promise<void>;
|
|
21
|
+
provider: import("@ethersproject/providers").Web3Provider | undefined;
|
|
22
|
+
getLastBlockNumber: (() => Promise<number>) | undefined;
|
|
23
|
+
getBalance: ((account: string) => Promise<BigNumber | undefined>) | undefined;
|
|
24
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Provider as Eip1193Provider } from '@web3-react/types';
|
|
2
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
3
|
+
import { ChainId } from '../../constants/chains';
|
|
4
|
+
import { Web3Connection } from './web3';
|
|
5
|
+
import { WalletType } from '../../constants/wallet';
|
|
6
|
+
export interface Web3ConnectorsProps {
|
|
7
|
+
provider?: Eip1193Provider | JsonRpcProvider;
|
|
8
|
+
jsonRpcUrlMap?: {
|
|
9
|
+
[chainId: number]: string[];
|
|
10
|
+
};
|
|
11
|
+
defaultChainId?: ChainId;
|
|
12
|
+
}
|
|
13
|
+
export declare function useWeb3Connectors({ provider, jsonRpcUrlMap: jsonRpcUrlMapProps, defaultChainId, }: Web3ConnectorsProps): {
|
|
14
|
+
connectors: Web3Connection[];
|
|
15
|
+
key: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function connectToWallet(type: WalletType, chainId: number | undefined, onError: (error: Error) => void): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Web3ReactHooks } from '@web3-react/core';
|
|
2
|
+
import { Connector, Provider as Eip1193Provider } from '@web3-react/types';
|
|
3
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
4
|
+
import type { ChainId } from '../../constants/chains';
|
|
5
|
+
export declare type Web3Connection = [Connector, Web3ReactHooks];
|
|
6
|
+
export declare function getConnectionFromProvider(onError: (error: Error) => void, provider?: JsonRpcProvider | Eip1193Provider): Web3Connection | undefined;
|
|
7
|
+
export declare function getConnectionFromWalletConnect(useDefault: boolean, jsonRpcUrlMap: {
|
|
8
|
+
[chainId: number]: string[];
|
|
9
|
+
}, defaultChainId: ChainId | undefined, onError: (error: Error) => void): Web3Connection;
|
|
10
|
+
export declare function getConnectionFromMetaMask(onError: (error: Error) => void): Web3Connection;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ExecutionCtx } from './types';
|
|
3
|
+
export { default as useExecution } from './useExecution';
|
|
4
|
+
export type { ExecutionProps } from './useExecution';
|
|
5
|
+
export { default as useInflights } from './useInflights';
|
|
6
|
+
export declare const ExecutionContext: import("react").Context<ExecutionCtx>;
|
|
7
|
+
/**
|
|
8
|
+
* Get the submission context
|
|
9
|
+
*/
|
|
10
|
+
export declare function useSubmission(): ExecutionCtx;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Let's pretend that typescript has ADT
|
|
3
|
+
*/
|
|
4
|
+
import { BigNumber } from 'bignumber.js';
|
|
5
|
+
import { BigNumber as EthersBigNumber } from '@ethersproject/bignumber';
|
|
6
|
+
/**
|
|
7
|
+
* All supported opcodes, as tagged union discriminants
|
|
8
|
+
*/
|
|
9
|
+
export declare enum OpCode {
|
|
10
|
+
Approval = "APPROVAL",
|
|
11
|
+
TX = "TX",
|
|
12
|
+
TypedSign = "TypedSign"
|
|
13
|
+
}
|
|
14
|
+
export declare enum SwapType {
|
|
15
|
+
Normal = "Normal",
|
|
16
|
+
Privacy = "Privacy",
|
|
17
|
+
LimitOrder = "LimitOrder",
|
|
18
|
+
RFQ = "RFQ"
|
|
19
|
+
}
|
|
20
|
+
export declare type TokenData = {
|
|
21
|
+
address: string;
|
|
22
|
+
};
|
|
23
|
+
export declare type ApprovalStep = {
|
|
24
|
+
opcode: OpCode.Approval;
|
|
25
|
+
/**
|
|
26
|
+
* The address of the token
|
|
27
|
+
*/
|
|
28
|
+
token: TokenData;
|
|
29
|
+
/**
|
|
30
|
+
* The approved contract address
|
|
31
|
+
*/
|
|
32
|
+
contract: string;
|
|
33
|
+
/**
|
|
34
|
+
* The amount to set the allowance to, in Wei, in base-10. If omitted, a (very) big constants is used
|
|
35
|
+
* TODO(meow): bigint shows a 87% support rate. Can we use it here?
|
|
36
|
+
*/
|
|
37
|
+
amt?: BigNumber;
|
|
38
|
+
};
|
|
39
|
+
export declare type TXStep = {
|
|
40
|
+
opcode: OpCode.TX;
|
|
41
|
+
value: number | string;
|
|
42
|
+
to: string;
|
|
43
|
+
data: string;
|
|
44
|
+
swapType?: SwapType;
|
|
45
|
+
gasLimit?: EthersBigNumber;
|
|
46
|
+
gasPrice?: number;
|
|
47
|
+
ddlSecRel?: number;
|
|
48
|
+
};
|
|
49
|
+
export declare type TypedSignStep = {
|
|
50
|
+
opcode: OpCode.TypedSign;
|
|
51
|
+
swapType?: SwapType;
|
|
52
|
+
signer?: string;
|
|
53
|
+
typedData: Record<string, unknown>;
|
|
54
|
+
};
|
|
55
|
+
export declare type Step = ApprovalStep | TXStep | TypedSignStep;
|
|
56
|
+
export declare type Steps = Step[];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Step as StepSpec } from './spec';
|
|
3
|
+
import { ExecutionProps } from './useExecution';
|
|
4
|
+
export declare enum State {
|
|
5
|
+
Running = 0,
|
|
6
|
+
Success = 1,
|
|
7
|
+
Failed = 2,
|
|
8
|
+
Warning = 3
|
|
9
|
+
}
|
|
10
|
+
export declare type Request = {
|
|
11
|
+
brief: string;
|
|
12
|
+
spec: StepSpec;
|
|
13
|
+
subtitle?: string | React.ReactNode | null;
|
|
14
|
+
tx: string;
|
|
15
|
+
nonce?: number;
|
|
16
|
+
};
|
|
17
|
+
export declare type Requests = Map<string, [Request, State]>;
|
|
18
|
+
export declare enum ExecutionResult {
|
|
19
|
+
Canceled = "canceled",
|
|
20
|
+
Failed = "failed",
|
|
21
|
+
Success = "success",
|
|
22
|
+
Submitted = "submitted"
|
|
23
|
+
}
|
|
24
|
+
export interface Showing {
|
|
25
|
+
brief: string;
|
|
26
|
+
subtitle?: string | React.ReactNode;
|
|
27
|
+
spec: StepSpec;
|
|
28
|
+
}
|
|
29
|
+
export declare type ExecutionCtx = {
|
|
30
|
+
/**
|
|
31
|
+
* Execute an on-chain operation
|
|
32
|
+
* @param breif: TX title. e.g.: "Swap"
|
|
33
|
+
* @param spec: TX specification.
|
|
34
|
+
* @param subtitle: Additional hint text. e.g.: "10 USDT to 10 USDC"
|
|
35
|
+
* @param early: When given, the returned promise resolves when user confirmed in their wallet.
|
|
36
|
+
* @param mixpanelProps: mixpanel properties
|
|
37
|
+
* @param submittedConfirmBack: dismiss callback
|
|
38
|
+
*/
|
|
39
|
+
execute: (brief: string, spec: StepSpec, subtitle?: string | React.ReactNode | null, early?: boolean, submittedBack?: () => void, mixpanelProps?: Record<string, any>, submittedConfirmBack?: () => void, successBack?: (tx: string, callback?: ExecutionProps['onTxSuccess']) => void) => Promise<ExecutionResult>;
|
|
40
|
+
/**
|
|
41
|
+
* order
|
|
42
|
+
*/
|
|
43
|
+
requests?: Requests;
|
|
44
|
+
setShowing?: React.Dispatch<React.SetStateAction<Showing | null>>;
|
|
45
|
+
waitingSubmit: boolean;
|
|
46
|
+
};
|
|
47
|
+
export declare enum WatchResult {
|
|
48
|
+
Failed = 0,
|
|
49
|
+
Success = 1
|
|
50
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Step as StepSpec } from './spec';
|
|
3
|
+
import { ExecutionResult, State, Request, Showing } from './types';
|
|
4
|
+
export interface ExecutionProps {
|
|
5
|
+
onTxFail?: (error: Error, data: any) => void;
|
|
6
|
+
onTxSubmit?: (tx: string, data: any) => void;
|
|
7
|
+
onTxSuccess?: (tx: string, data: any) => void;
|
|
8
|
+
executionStatus?: {
|
|
9
|
+
showing?: Showing | null;
|
|
10
|
+
showingDone?: boolean;
|
|
11
|
+
transactionTx?: string;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
setErrorMessage?: (msg?: string | null) => void;
|
|
14
|
+
closeShowing?: () => void;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export default function useExecution({ onTxFail, onTxSubmit, onTxSuccess, }?: ExecutionProps): {
|
|
18
|
+
showing: Showing | null;
|
|
19
|
+
showingDone: boolean;
|
|
20
|
+
transactionTx: string;
|
|
21
|
+
errorMessage: string | null;
|
|
22
|
+
setErrorMessage: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
23
|
+
closeShowing: () => void;
|
|
24
|
+
ctxVal: {
|
|
25
|
+
execute: (brief: string, spec: StepSpec, subtitle?: string | React.ReactNode | null, early?: boolean, submittedBack?: () => void, mixpanelProps?: Record<string, any>, submittedConfirmBack?: () => void, successBack?: ((tx: string, callback?: ExecutionProps['onTxSuccess']) => void) | undefined) => Promise<ExecutionResult.Failed | ExecutionResult.Success | ExecutionResult.Submitted>;
|
|
26
|
+
requests: Map<string, [Request, State]>;
|
|
27
|
+
setShowing: import("react").Dispatch<import("react").SetStateAction<Showing | null>>;
|
|
28
|
+
waitingSubmit: boolean;
|
|
29
|
+
};
|
|
30
|
+
requests: Map<string, [Request, State]>;
|
|
31
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BigNumber as EthersBigNumber } from '@ethersproject/bignumber';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export default function useExecuteSwap(): ({ to, data, useSource, duration, ddl, gasLimit, subtitle, value, }: {
|
|
4
|
+
value: string;
|
|
5
|
+
to: string;
|
|
6
|
+
data: string;
|
|
7
|
+
useSource?: string | undefined;
|
|
8
|
+
duration?: number | undefined;
|
|
9
|
+
ddl: number;
|
|
10
|
+
gasLimit?: EthersBigNumber | undefined;
|
|
11
|
+
subtitle: React.ReactNode;
|
|
12
|
+
}) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChainId } from '../../constants/chains';
|
|
2
|
+
import { TokenInfo } from '../Token';
|
|
3
|
+
export interface FetchFiatPriceProps {
|
|
4
|
+
chainId: ChainId | undefined;
|
|
5
|
+
fromToken: TokenInfo | null;
|
|
6
|
+
toToken: TokenInfo | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function useFetchFiatPrice({ fromToken, toToken, chainId, }: FetchFiatPriceProps): {
|
|
9
|
+
loading: boolean;
|
|
10
|
+
refetch: () => void;
|
|
11
|
+
toFiatPrice: string;
|
|
12
|
+
fromFiatPrice: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TokenInfo } from '../Token';
|
|
3
|
+
export declare enum RoutePriceStatus {
|
|
4
|
+
Initial = "Initial",
|
|
5
|
+
Loading = "Loading",
|
|
6
|
+
Failed = "Failed",
|
|
7
|
+
Success = "Success"
|
|
8
|
+
}
|
|
9
|
+
export interface FetchRoutePrice {
|
|
10
|
+
fromToken: TokenInfo | null;
|
|
11
|
+
toToken: TokenInfo | null;
|
|
12
|
+
marginAmount?: string;
|
|
13
|
+
fromAmount: string;
|
|
14
|
+
toAmount: string;
|
|
15
|
+
estimateGas?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface IRouteResponse {
|
|
18
|
+
resAmount: number;
|
|
19
|
+
priceImpact: number;
|
|
20
|
+
baseFeeAmount: number;
|
|
21
|
+
additionalFeeAmount: number;
|
|
22
|
+
resPricePerToToken: number;
|
|
23
|
+
resPricePerFromToken: number;
|
|
24
|
+
to: string;
|
|
25
|
+
data: string;
|
|
26
|
+
value: string;
|
|
27
|
+
useSource: string;
|
|
28
|
+
duration: number;
|
|
29
|
+
}
|
|
30
|
+
export declare function useFetchRoutePrice({ toToken, fromToken, fromAmount, toAmount, marginAmount, estimateGas, }: FetchRoutePrice): {
|
|
31
|
+
status: RoutePriceStatus;
|
|
32
|
+
rawBrief: IRouteResponse | null;
|
|
33
|
+
refetch: () => Promise<void>;
|
|
34
|
+
executeSwap: (subtitle: React.ReactNode) => void;
|
|
35
|
+
reset: () => void;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TokenInfo } from '../Token';
|
|
3
|
+
export declare function useInitDefaultToken({ fromToken, toToken, setFromToken, setToToken, updateFromAmt, updateToAmt, }: {
|
|
4
|
+
fromToken: TokenInfo | null;
|
|
5
|
+
toToken: TokenInfo | null;
|
|
6
|
+
setFromToken: (value: React.SetStateAction<TokenInfo | null>) => void;
|
|
7
|
+
setToToken: (value: React.SetStateAction<TokenInfo | null>) => void;
|
|
8
|
+
updateFromAmt: (v: string | number) => void;
|
|
9
|
+
updateToAmt: (v: string | number) => void;
|
|
10
|
+
}): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as useInitTokenList } from './useInitTokenList';
|
|
2
|
+
export { default as useFindTokenByAddress } from './useFindTokenByAddress';
|
|
3
|
+
export { default as useTokenList } from './useTokenList';
|
|
4
|
+
export type { TokenList, TokenInfo, DefaultTokenInfo } from './type';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface TokenInfo {
|
|
2
|
+
readonly chainId: number;
|
|
3
|
+
readonly address: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly decimals: number;
|
|
6
|
+
readonly symbol: string;
|
|
7
|
+
readonly logoURI?: string;
|
|
8
|
+
readonly tags?: string[];
|
|
9
|
+
readonly extensions?: any;
|
|
10
|
+
readonly side?: 'from' | 'to';
|
|
11
|
+
readonly canBridgeToTon?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface DefaultTokenInfo extends TokenInfo {
|
|
14
|
+
amount?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare type TokenList = TokenInfo[];
|
|
17
|
+
export declare enum TokenListType {
|
|
18
|
+
All = "all"
|
|
19
|
+
}
|
|
20
|
+
export declare enum ApprovalState {
|
|
21
|
+
Loading = "Loading",
|
|
22
|
+
Insufficient = "ApprovalInsufficient",
|
|
23
|
+
Approving = "Approving",
|
|
24
|
+
Sufficient = "Sufficient",
|
|
25
|
+
Unchecked = "Unchecked"
|
|
26
|
+
}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useFindTokenByAddress(address?: string): import("./type").TokenInfo | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|