From 237b942970065b7d08805dcec91834bdbc40981b Mon Sep 17 00:00:00 2001 From: naturexie <786281870@qq.com> Date: Tue, 21 Jan 2025 21:47:04 +0800 Subject: [PATCH] fix: btc withdraw all issue --- components/Modal/Action.tsx | 3 +++ components/Modal/index.tsx | 1 + store/actions/withdraw.ts | 13 ++++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/components/Modal/Action.tsx b/components/Modal/Action.tsx index ec8e6b1d..a47308a6 100644 --- a/components/Modal/Action.tsx +++ b/components/Modal/Action.tsx @@ -31,6 +31,7 @@ export default function Action({ collateralType, poolAsset, isDisabled, + maxWithdrawAmount, }) { const [loading, setLoading] = useState(false); const { amount, useAsCollateral, isMax } = useAppSelector(getSelectedValues); @@ -45,6 +46,7 @@ export default function Action({ const { available, canUseAsCollateral, extraDecimals, collateral, disabled, decimals } = getModalData({ ...asset, + maxWithdrawAmount, maxBorrowAmount, healthFactor, amount, @@ -117,6 +119,7 @@ export default function Action({ amount, isMax, isMeme, + available, }); break; } diff --git a/components/Modal/index.tsx b/components/Modal/index.tsx index f104b4ec..3a7191ca 100644 --- a/components/Modal/index.tsx +++ b/components/Modal/index.tsx @@ -230,6 +230,7 @@ const Modal = () => { 0; const maxAmount = computeWithdrawMaxAmount(tokenId, assets, account.portfolio!); - const expandedAmount = isMax - ? maxAmount + ? decimalMin(maxAmount, expandTokenDecimal(available, decimals + extraDecimals)) : decimalMin(maxAmount, expandTokenDecimal(amount, decimals + extraDecimals)); const transactions: Transaction[] = [];