Skip to content

Commit 4bdbd68

Browse files
committed
fix(ui): 🚑 unpaired contact hotfix
1 parent 348a6e8 commit 4bdbd68

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/helpers/wallet.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,16 +1891,20 @@ export async function getContactsByXkeyId(
18911891
let contactsXkeys = {}
18921892

18931893
for await (let c of appState.contacts) {
1894-
let og = Object.values(c.outgoing)?.[0]
1895-
let ic = Object.values(c.incoming)?.[0]
1894+
let og = Object.values(c.outgoing || [])?.[0]
1895+
let ic = Object.values(c.incoming || [])?.[0]
18961896

1897-
contactsXkeys[og.xkeyId] = {
1898-
...c,
1899-
dir: 'outgoing',
1897+
if (og) {
1898+
contactsXkeys[og.xkeyId] = {
1899+
...c,
1900+
dir: 'outgoing',
1901+
}
19001902
}
1901-
contactsXkeys[ic.xkeyId] = {
1902-
...c,
1903-
dir: 'incoming',
1903+
if (ic) {
1904+
contactsXkeys[ic.xkeyId] = {
1905+
...c,
1906+
dir: 'incoming',
1907+
}
19041908
}
19051909
}
19061910

@@ -1937,8 +1941,8 @@ export async function deriveContactAddrs(
19371941
let addrs = {}
19381942

19391943
for await (let c of appState.contacts) {
1940-
let og = Object.values(c[dir])?.[0]
1941-
let xkey = og.xpub || og.xprv
1944+
let og = Object.values(c[dir] || [])?.[0]
1945+
let xkey = og?.xpub || og?.xprv
19421946

19431947
if (xkey) {
19441948
let contactWallet = await deriveWalletData(

0 commit comments

Comments
 (0)