From bb4de209dbeb39cc7595cb4c6b80cfef64f371fb Mon Sep 17 00:00:00 2001 From: wenty22 Date: Tue, 12 Nov 2024 10:45:48 +0800 Subject: [PATCH] fix: Fix token balance sorting issue --- .../src/modules/aggregator/shared/sortTokens.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/canonical-bridge-widget/src/modules/aggregator/shared/sortTokens.ts b/packages/canonical-bridge-widget/src/modules/aggregator/shared/sortTokens.ts index 460514b9..7162342c 100644 --- a/packages/canonical-bridge-widget/src/modules/aggregator/shared/sortTokens.ts +++ b/packages/canonical-bridge-widget/src/modules/aggregator/shared/sortTokens.ts @@ -52,13 +52,15 @@ export function sortTokens({ return 1; } - if (a.balance && b.balance) { + const aBalance = Number(a.balance); + const bBalance = Number(b.balance); + if (aBalance && bBalance) { return sortWithPredefinedOrders(); } - if (a.balance && !b.balance) { + if (aBalance && !bBalance) { return -1; } - if (!a.balance && b.balance) { + if (!aBalance && bBalance) { return 1; } }