From 5c94a9a78d607a0bc2df8247d0cc31bacd7a8e92 Mon Sep 17 00:00:00 2001 From: Harsha <106158714+harshbaz@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:37:41 +0530 Subject: [PATCH] Fix logsd (#2220) Fix type --- .../lib/components/wallet/TransactionItem.svelte | 2 +- packages/web-client/src/lib/helpers/profile.ts | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/web-client/src/lib/components/wallet/TransactionItem.svelte b/packages/web-client/src/lib/components/wallet/TransactionItem.svelte index 91f54f07c..23a3d07dc 100644 --- a/packages/web-client/src/lib/components/wallet/TransactionItem.svelte +++ b/packages/web-client/src/lib/components/wallet/TransactionItem.svelte @@ -22,7 +22,7 @@ function getEventName() { $: deducted = item.type === 'Burn' || item.type === 'Stake' || item.type === 'Transfer' -$: eventName = getEventName() +$: eventName = item.type === 'Transfer' ? 'Transfer' : getEventName() $: timeDiff = getTimeDifference(Number(item.timestamp.secs_since_epoch) * 1000) const labels: Record = { diff --git a/packages/web-client/src/lib/helpers/profile.ts b/packages/web-client/src/lib/helpers/profile.ts index f61ad9cbb..c8a62443c 100644 --- a/packages/web-client/src/lib/helpers/profile.ts +++ b/packages/web-client/src/lib/helpers/profile.ts @@ -503,21 +503,20 @@ function transformHistoryRecords( const history: TransactionHistory[] = [] res.forEach((o) => { - console.log({ o }) const event = o[1] - console.log({ event }) + const type = Object.keys(event)[0] as UnionKeyOf - console.log({ type }) - const subType = Object.keys(event[type].details)[0] as WalletEventType - console.log({ subType }) - const details = (event[type] as WalletEvent)?.[subType] as + + const subType = + (Object.keys(event?.[type]?.details || {})?.[0] as WalletEventType) || '' + const details = ((event[type] as WalletEvent) || {})?.[subType] as | WalletEventSubDetails | undefined - console.log({ details }) + const eventOutcome = Object.keys(details?.['event_outcome'] || {})[0] as | EventOutcome | undefined - console.log({ eventOutcome }) + history.push({ id: o[0], type,