From aded5ac422722eed4baa734a194a71b96d1a74ee Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Tue, 15 Oct 2024 17:12:14 +0200 Subject: [PATCH] fixes --- wallets/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wallets/index.js b/wallets/index.js index a0987ef7..1e0b2860 100644 --- a/wallets/index.js +++ b/wallets/index.js @@ -30,12 +30,15 @@ export function useWallet (name) { if (!name) { // find best wallet in list - const bestWalletDef = bestSendWalletList?.wallets + const highestWalletDef = bestSendWalletList?.wallets // .filter(w => w.enabled && w.canSend)// filtered by the server // .sort((a, b) => b.priority - a.priority) // already priority sorted by the server .map(w => getWalletByType(w.type)) - .filter(w => !w.isAvailable || w.isAvailable()) - name = bestWalletDef?.[0]?.name + + const highestAvailableWalletDef = highestWalletDef?.filter(w => !w.isAvailable || w.isAvailable()) + // console.log('Wallets priority', bestAvailableWallet.map(w => w.name)) + // console.log('Available wallets priority', bestAvailableWallet.map(w => w.name)) + name = highestAvailableWalletDef?.[0]?.name } const walletDef = getWalletByName(name) @@ -114,8 +117,7 @@ export function useWallet (name) { const wallet = useMemo(() => { if (!walletDef) { - console.log(name) - return {} + return undefined } const wallet = { ...walletDef