This commit is contained in:
Riccardo Balbo 2024-10-15 17:12:14 +02:00 committed by k00b
parent 87c5634b55
commit aded5ac422
1 changed files with 7 additions and 5 deletions

View File

@ -30,12 +30,15 @@ export function useWallet (name) {
if (!name) { if (!name) {
// find best wallet in list // find best wallet in list
const bestWalletDef = bestSendWalletList?.wallets const highestWalletDef = bestSendWalletList?.wallets
// .filter(w => w.enabled && w.canSend)// filtered by the server // .filter(w => w.enabled && w.canSend)// filtered by the server
// .sort((a, b) => b.priority - a.priority) // already priority sorted by the server // .sort((a, b) => b.priority - a.priority) // already priority sorted by the server
.map(w => getWalletByType(w.type)) .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) const walletDef = getWalletByName(name)
@ -114,8 +117,7 @@ export function useWallet (name) {
const wallet = useMemo(() => { const wallet = useMemo(() => {
if (!walletDef) { if (!walletDef) {
console.log(name) return undefined
return {}
} }
const wallet = { const wallet = {
...walletDef ...walletDef