From 98fe00d22a52ad2c031ee0b27a009a80577c89d3 Mon Sep 17 00:00:00 2001 From: Lantt Date: Fri, 17 Dec 2021 11:36:47 +0800 Subject: [PATCH] fix: send eth can not call provider --- .../Wallets/components/Transfer/TransferERC20.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/dashboard/src/pages/Wallets/components/Transfer/TransferERC20.tsx b/packages/dashboard/src/pages/Wallets/components/Transfer/TransferERC20.tsx index 09b6b6ce44ab..a086f220fc3f 100644 --- a/packages/dashboard/src/pages/Wallets/components/Transfer/TransferERC20.tsx +++ b/packages/dashboard/src/pages/Wallets/components/Transfer/TransferERC20.tsx @@ -72,17 +72,17 @@ export const TransferERC20 = memo(({ token }) => { setSelectedToken(token) }, [token]) + // workaround: transferERC20 should support non-evm network + const isNativeToken = isSameAddress(selectedToken?.address, NATIVE_TOKEN_ADDRESS) + const tokenType = isNativeToken ? EthereumTokenType.Native : EthereumTokenType.ERC20 + // balance const { value: tokenBalance = '0', retry: tokenBalanceRetry } = useFungibleTokenBalance( - // workaround: transferERC20 should support non-evm network - isSameAddress(selectedToken?.address, NATIVE_TOKEN_ADDRESS) - ? EthereumTokenType.Native - : EthereumTokenType.ERC20, + tokenType, selectedToken?.address ?? '', ) const nativeToken = useNativeTokenDetailed() const nativeTokenPrice = useNativeTokenPrice() - const isNativeToken = selectedToken.type === EthereumTokenType.Native //#region resolve ENS domain const { @@ -120,7 +120,7 @@ export const TransferERC20 = memo(({ token }) => { }, [tokenBalance, gasPrice, selectedToken?.type, amount]) const [transferState, transferCallback, resetTransferCallback] = useTokenTransferCallback( - EthereumTokenType.ERC20, + tokenType, selectedToken.address, )