Skip to content

Commit

Permalink
Merge pull request #110 from bnb-chain/wenty/sorting
Browse files Browse the repository at this point in the history
fix: Convert balance to number and then sorting
  • Loading branch information
wenty22 authored Nov 8, 2024
2 parents a79bdd2 + d38a258 commit b3281e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export interface IBridgeToken extends IBridgeTokenBaseInfo {
}

export interface IBridgeTokenWithBalance extends IBridgeToken {
balance?: number;
balance?: string;
value?: number;
}

Expand Down

0 comments on commit b3281e6

Please sign in to comment.