From 1886a484cba208a64f6d30e43b17e6b7c8a73af4 Mon Sep 17 00:00:00 2001 From: Armani Ferrante Date: Fri, 11 Jun 2021 16:21:51 -0700 Subject: [PATCH] fix: Sort token accounts by balances (#42) --- package.json | 2 +- src/context/Token.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9578632..7b43249 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@project-serum/swap-ui", - "version": "0.1.2", + "version": "0.1.3", "main": "dist/index.js", "types": "dist/index.d.ts", "homepage": "https://github.com/project-serum/swap-ui", diff --git a/src/context/Token.tsx b/src/context/Token.tsx index 523a3fe..4984387 100644 --- a/src/context/Token.tsx +++ b/src/context/Token.tsx @@ -69,9 +69,9 @@ export function useOwnedTokenAccount( // Take the account with the most tokens in it. tokenAccounts.sort((a, b) => - a.account.amount < b.account.amount + a.account.amount > b.account.amount ? -1 - : a.account.amount > b.account.amount + : a.account.amount < b.account.amount ? 1 : 0 );