From 4bdbd683ee318737408ae451c5106799c528042e Mon Sep 17 00:00:00 2001 From: jojobyte <184880+jojobyte@users.noreply.github.com> Date: Mon, 15 Apr 2024 10:21:38 -0600 Subject: [PATCH] fix(ui): :ambulance: unpaired contact hotfix --- src/helpers/wallet.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/helpers/wallet.js b/src/helpers/wallet.js index f88d20a..7998f5c 100644 --- a/src/helpers/wallet.js +++ b/src/helpers/wallet.js @@ -1891,16 +1891,20 @@ export async function getContactsByXkeyId( let contactsXkeys = {} for await (let c of appState.contacts) { - let og = Object.values(c.outgoing)?.[0] - let ic = Object.values(c.incoming)?.[0] + let og = Object.values(c.outgoing || [])?.[0] + let ic = Object.values(c.incoming || [])?.[0] - contactsXkeys[og.xkeyId] = { - ...c, - dir: 'outgoing', + if (og) { + contactsXkeys[og.xkeyId] = { + ...c, + dir: 'outgoing', + } } - contactsXkeys[ic.xkeyId] = { - ...c, - dir: 'incoming', + if (ic) { + contactsXkeys[ic.xkeyId] = { + ...c, + dir: 'incoming', + } } } @@ -1937,8 +1941,8 @@ export async function deriveContactAddrs( let addrs = {} for await (let c of appState.contacts) { - let og = Object.values(c[dir])?.[0] - let xkey = og.xpub || og.xprv + let og = Object.values(c[dir] || [])?.[0] + let xkey = og?.xpub || og?.xprv if (xkey) { let contactWallet = await deriveWalletData(