Skip to content

Commit a4c8667

Browse files
authored
Merge pull request #1599 from mars-protocol/withdraw-all-tokens-fix
Fix: Withdraw all tokens
2 parents c6d8140 + 3175b01 commit a4c8667

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/components/Modals/FundWithdraw/WithdrawFromAccount.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ interface Props {
2525
export default function WithdrawFromAccount(props: Props) {
2626
const { account } = props
2727
const { data: assets } = useAssets()
28-
const tradeEnabledAssets = useMemo(() => assets.filter((asset) => asset.isTradeEnabled), [assets])
28+
const nonPoolTokens = useMemo(() => assets.filter((asset) => !asset.isPoolToken), [assets])
2929
const sortedBalances = useMemo(
3030
() =>
3131
mergeBNCoinArrays(account.deposits, account.lends)
32-
.filter((coin) => tradeEnabledAssets.some((asset) => asset.denom === coin.denom))
32+
.filter((coin) => nonPoolTokens.some((asset) => asset.denom === coin.denom))
3333
.sort((a, b) => {
34-
const valueA = getCoinValue(a, tradeEnabledAssets)?.toNumber?.() ?? 0
35-
const valueB = getCoinValue(b, tradeEnabledAssets)?.toNumber?.() ?? 0
34+
const valueA = getCoinValue(a, nonPoolTokens)?.toNumber?.() ?? 0
35+
const valueB = getCoinValue(b, nonPoolTokens)?.toNumber?.() ?? 0
3636
return valueB - valueA
3737
}),
38-
[account.deposits, account.lends, tradeEnabledAssets],
38+
[account.deposits, account.lends, nonPoolTokens],
3939
)
4040
const defaultAsset = useMemo(
41-
() => tradeEnabledAssets.find(byDenom(sortedBalances[0]?.denom)) ?? tradeEnabledAssets[0],
42-
[tradeEnabledAssets, sortedBalances],
41+
() => nonPoolTokens.find(byDenom(sortedBalances[0]?.denom)) ?? nonPoolTokens[0],
42+
[sortedBalances, nonPoolTokens],
4343
)
4444

4545
const withdraw = useStore((s) => s.withdraw)

src/components/common/Select/Option.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function Option(props: Props) {
3434
const balance = props.amount ?? BN_ZERO
3535
const marketAsset = markets.find((market) => market.asset.denom === props.denom)
3636

37-
if (!asset || !marketAsset) return null
37+
if (!asset) return null
3838

3939
if (props.isDisplay) {
4040
return (

0 commit comments

Comments
 (0)