From 7baeea035282b1676def29940b56c2aaf74639dc Mon Sep 17 00:00:00 2001 From: DMY <147dmy@gmail.com> Date: Thu, 19 Dec 2024 16:52:19 +0800 Subject: [PATCH] fix: reset bridge gasprice --- src/ui/views/Bridge/Component/BridgeToken.tsx | 8 +++++++- src/ui/views/Bridge/hooks/token.tsx | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ui/views/Bridge/Component/BridgeToken.tsx b/src/ui/views/Bridge/Component/BridgeToken.tsx index 2f020dc29be..dc397411779 100644 --- a/src/ui/views/Bridge/Component/BridgeToken.tsx +++ b/src/ui/views/Bridge/Component/BridgeToken.tsx @@ -5,7 +5,7 @@ import { CHAINS_ENUM } from '@debank/common'; import { TokenItem } from '@rabby-wallet/rabby-api/dist/types'; import { Input } from 'antd'; import clsx from 'clsx'; -import React, { useLayoutEffect, useMemo, useRef } from 'react'; +import React, { useEffect, useLayoutEffect, useMemo, useRef } from 'react'; import { useTranslation } from 'react-i18next'; import { TokenRender } from '../../Swap/Component/TokenRender'; import { @@ -121,6 +121,12 @@ export const BridgeToken = ({ [chain] ); + useEffect(() => { + if (!fromTokenIsNativeToken) { + handleSetGasPrice?.(); + } + }, [fromTokenIsNativeToken]); + const gasLimit = useMemo( () => (chain === CHAINS_ENUM.ETH ? 1000000 : 2000000), [chain] diff --git a/src/ui/views/Bridge/hooks/token.tsx b/src/ui/views/Bridge/hooks/token.tsx index 3775f721fa8..fbf60bdea2c 100644 --- a/src/ui/views/Bridge/hooks/token.tsx +++ b/src/ui/views/Bridge/hooks/token.tsx @@ -229,6 +229,7 @@ export const useBridge = () => { switchToChain(fromChain, false); setFromToken(toToken); setToToken(fromToken); + setAmount(''); }, [ setFromToken, toToken,