From 459478036f679ba439c27b58e7a2212bea2291af Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 8 Jul 2024 05:49:54 +0200 Subject: [PATCH] Fix priority ignored when fetching enabled wallet --- components/wallet/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/wallet/index.js b/components/wallet/index.js index 25c2d64b..a05f19fb 100644 --- a/components/wallet/index.js +++ b/components/wallet/index.js @@ -246,14 +246,15 @@ export function getServerWallet (type) { } export function getEnabledWallet (me) { - // TODO: handle multiple enabled wallets return WALLET_DEFS .filter(def => !!def.sendPayment) - .find(def => { + .map(def => { const key = getStorageKey(def.name, me) const config = SSR ? null : JSON.parse(window?.localStorage.getItem(key)) - return config?.enabled + return { def, config } }) + .filter(({ config }) => config?.enabled) + .sort((w1, w2) => w1.config.priority - w2.config.priority)[0]?.def } export function useWallets () {