diff --git a/.omo/evidence/the-commons-hollow-polish/task-14-the-commons-hollow-polish-tampered.json b/.omo/evidence/the-commons-hollow-polish/task-14-the-commons-hollow-polish-tampered.json new file mode 100644 index 0000000..b9b6772 --- /dev/null +++ b/.omo/evidence/the-commons-hollow-polish/task-14-the-commons-hollow-polish-tampered.json @@ -0,0 +1,18 @@ +{ + "task": "14. Add a signature-verification affordance to transaction history", + "qa": "failure/tampered", + "description": "A WalletHistoryEntry is constructed with a deliberately corrupted payload (test-only - the real append()/appendEntry() path in src/lib/eventlog.ts rejects a mismatched signature before it is ever persisted, so this shape is NEVER reachable through the real UI). The test asserts the TransactionHistory row's signature badge (data-testid history-signature-badge-) reaches a distinct 'Not verified' text state via the exact same real, unmodified verifyEntrySignature() re-check used for genuine entries - a DOM-state assertion via a specific selector, not a visual/screenshot judgment.", + "tool": "Vitest + @testing-library/react, happy-dom environment", + "run_command": "npx vitest run src/shell/TransactionHistory.test.tsx", + "test_name": "TransactionHistory signature verification > shows a distinct not-verified state for an entry whose signature was tampered with (test-only, never reachable from the real UI)", + "not_reachable_from_real_ui_reason": "appendEntry() in src/lib/eventlog.ts independently re-verifies signature,lamportTs,payload,authorPubkey before any db.eventLog.add() write and throws SignatureVerificationError on mismatch (see eventlog.test.ts 'rejects an entry with a forged/mismatched signature at append time') - a corrupted entry can never actually reach the stored Event Log that TransactionHistory reads from.", + "timestamp": "2026-11-18T07:10:18.163Z", + "vitest_result": { + "numTotalTests": 3, + "numPassedTests": 3, + "numFailedTests": 0, + "success": true, + "tampered_case_status": "passed" + }, + "pass": true +} \ No newline at end of file diff --git a/.omo/evidence/the-commons-hollow-polish/task-14-the-commons-hollow-polish.json b/.omo/evidence/the-commons-hollow-polish/task-14-the-commons-hollow-polish.json new file mode 100644 index 0000000..f585dad --- /dev/null +++ b/.omo/evidence/the-commons-hollow-polish/task-14-the-commons-hollow-polish.json @@ -0,0 +1,43 @@ +{ + "task": "14. Add a signature-verification affordance to transaction history", + "qa": "happy", + "description": "A genuine Ed25519-signed wallet.issue event is appended for the page's own local identity via the real append() path. The wallet's TransactionHistory row for that entry is expanded via its data-testid, and the test asserts: (1) the verified-signature badge reaches a 'Verified' text state via a specific selector (not a visual/screenshot judgment), re-derived by the real independent verifyEntrySignature() re-check, and (2) the expanded detail panel displays the raw signature and author-public-key hex, byte-identical to the real stored StoredEventLogEntry fields.", + "tool": "Playwright (chromium), real Vite dev server, real app UI at '/' (WalletCard -> TransactionHistory)", + "run_command": "node e2e/transactionHistorySignature.e2e.mjs", + "selectors_used": [ + "history-entry", + "history-signature-badge-", + "history-expand-toggle-", + "history-signature-detail-", + "history-signature-value-", + "history-pubkey-value-" + ], + "timestamp": "2026-11-18T07:09:58.231Z", + "result": { + "scenario": "happy", + "steps": { + "seededGenuineEvent": { + "accountId": "a0504e26c69f55448ff2c1b3629126e5280c16646e75777fce849589a9453d7b", + "entryId": 1, + "signatureHex": "de318f1f42ad7909bb9d6717c8ffc1e05691f94d22070ce19953037a90cb4a8ee0e5a461fa4f5e98ba48b64e5de8b164c7039b1e6729c827eda7ab16ae736106", + "authorPubkeyHex": "a0504e26c69f55448ff2c1b3629126e5280c16646e75777fce849589a9453d7b" + }, + "historyRowVisible": { + "text": "Issued\nVerified\n+250\nView signature" + }, + "verifiedBadge": { + "beforeAsyncCheckResolved": "Verified", + "afterAsyncCheckResolved": "Verified", + "matchesExpected": true + }, + "expandedSignatureDetail": { + "signatureValue": "de318f1f42ad7909bb9d6717c8ffc1e05691f94d22070ce19953037a90cb4a8ee0e5a461fa4f5e98ba48b64e5de8b164c7039b1e6729c827eda7ab16ae736106", + "pubkeyValue": "a0504e26c69f55448ff2c1b3629126e5280c16646e75777fce849589a9453d7b", + "signatureMatchesRealStoredSignature": true, + "pubkeyMatchesRealStoredPubkey": true + } + }, + "pass": true + }, + "pass": true +} \ No newline at end of file diff --git a/e2e/transactionHistorySignature.e2e.mjs b/e2e/transactionHistorySignature.e2e.mjs new file mode 100644 index 0000000..1e9c47b --- /dev/null +++ b/e2e/transactionHistorySignature.e2e.mjs @@ -0,0 +1,227 @@ +// Wallet transaction-history signature-verification affordance acceptance +// test (plan todo 14). Self-contained Playwright runner, same shape as +// e2e/installShare.e2e.mjs: starts a real Vite dev server, opens a real +// browser page, and drives the real app UI through its real route. +// +// HAPPY: a genuine Ed25519-signed wallet.issue event is appended for the +// page's own local identity via the real append() path (dynamic import of +// the real src/lib/eventlog.ts from inside the page - no mock), the +// WalletCard's transaction history re-renders it live (Dexie liveQuery), +// and the test expands the row via its data-testid and asserts a real +// signature/pubkey are displayed and a "Verified" badge state is shown via +// specific selectors (not a visual/screenshot judgment). +import { chromium } from "playwright"; +import { createServer as createViteServer } from "vite"; +import * as ed from "@noble/ed25519"; +import { mkdirSync, writeFileSync } from "node:fs"; +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const ROOT = resolve(__dirname, ".."); +const VITE_PORT = 46000 + Math.floor(Math.random() * 10000); +const APP_URL = `http://127.0.0.1:${VITE_PORT}`; + +/** + * Pre-seeds the real local-identity record directly into IndexedDB (same + * schema `src/lib/db.ts` defines: Dexie database "the-commons-hollow", + * version 4, `identity` store keyed on "id") via `page.addInitScript` - + * BEFORE the page's own React tree ever mounts. This sidesteps a known, + * pre-existing, out-of-scope StrictMode double-invoke race in + * `useActiveAccountId()`/`identity.init()` (two concurrent first-time + * `db.identity.add()` calls under React 19 StrictMode's dev-mode double + * effect) rather than touching that unrelated code: with the identity row + * already present, `identity.init()`'s existing-record branch is the only + * one ever taken, so there is nothing left to race. + */ +async function seedIdentity(context) { + const { secretKey, publicKey } = await ed.keygenAsync(); + await context.addInitScript( + ({ secretKey, publicKey }) => { + const openReq = indexedDB.open("the-commons-hollow", 4); + openReq.onupgradeneeded = () => { + const db = openReq.result; + if (!db.objectStoreNames.contains("identity")) db.createObjectStore("identity", { keyPath: "id" }); + if (!db.objectStoreNames.contains("eventLog")) { + const store = db.createObjectStore("eventLog", { keyPath: "id", autoIncrement: true }); + store.createIndex("lamportTs", "lamportTs", { unique: false }); + } + if (!db.objectStoreNames.contains("miniappPackages")) { + const store = db.createObjectStore("miniappPackages", { keyPath: "id" }); + store.createIndex("sourceBlobId", "sourceBlobId", { unique: true }); + } + }; + openReq.onsuccess = () => { + const db = openReq.result; + const tx = db.transaction("identity", "readwrite"); + tx.objectStore("identity").put({ + id: "local", + publicKey: new Uint8Array(publicKey), + secretKey: new Uint8Array(secretKey), + createdAt: Date.now(), + }); + }; + }, + { secretKey: Array.from(secretKey), publicKey: Array.from(publicKey) }, + ); +} + +async function runHappyPath(browser) { + const context = await browser.newContext(); + const evidence = { scenario: "happy", steps: {} }; + try { + await seedIdentity(context); + const page = await context.newPage(); + await page.goto(`${APP_URL}/`); + + await page.waitForFunction( + () => document.querySelector('[data-testid="wallet-balance"]')?.textContent !== "--", + { timeout: 10000 }, + ); + + const seeded = await page.evaluate(async () => { + const identity = await import(/* @vite-ignore */ `${window.location.origin}/src/lib/identity.ts`); + const accountIdModule = await import(/* @vite-ignore */ `${window.location.origin}/src/shell/accountId.ts`); + const eventlog = await import(/* @vite-ignore */ `${window.location.origin}/src/lib/eventlog.ts`); + const publicKey = await identity.getPublicKey(); + const accountId = accountIdModule.toAccountId(publicKey); + const stored = await eventlog.append({ type: "wallet.issue", account: accountId, amount: 250 }); + const toHex = (bytes) => Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join(""); + return { + accountId, + entryId: stored.id, + signatureHex: toHex(stored.signature), + authorPubkeyHex: toHex(stored.authorPubkey), + }; + }); + evidence.steps.seededGenuineEvent = seeded; + + const balance = page.getByTestId("wallet-balance"); + await balance.waitFor(); + const row = page.getByTestId("history-entry").first(); + await row.waitFor(); + evidence.steps.historyRowVisible = { text: await row.innerText() }; + + const badge = page.getByTestId(`history-signature-badge-${seeded.entryId}`); + await badge.waitFor(); + const badgeTextBeforeVerified = await badge.innerText(); + + // Wait for the async verifyEntrySignature() re-check to settle to "Verified". + await page.waitForFunction( + (testid) => document.querySelector(`[data-testid="${testid}"]`)?.textContent === "Verified", + `history-signature-badge-${seeded.entryId}`, + { timeout: 10000 }, + ); + const badgeTextVerified = await badge.innerText(); + evidence.steps.verifiedBadge = { + beforeAsyncCheckResolved: badgeTextBeforeVerified, + afterAsyncCheckResolved: badgeTextVerified, + matchesExpected: badgeTextVerified === "Verified", + }; + if (badgeTextVerified !== "Verified") { + throw new Error(`happy: expected badge text "Verified", got "${badgeTextVerified}"`); + } + + const toggle = page.getByTestId(`history-expand-toggle-${seeded.entryId}`); + await toggle.click(); + const detail = page.getByTestId(`history-signature-detail-${seeded.entryId}`); + await detail.waitFor(); + const signatureValue = await page.getByTestId(`history-signature-value-${seeded.entryId}`).innerText(); + const pubkeyValue = await page.getByTestId(`history-pubkey-value-${seeded.entryId}`).innerText(); + + evidence.steps.expandedSignatureDetail = { + signatureValue, + pubkeyValue, + signatureMatchesRealStoredSignature: signatureValue === seeded.signatureHex, + pubkeyMatchesRealStoredPubkey: pubkeyValue === seeded.authorPubkeyHex, + }; + if (signatureValue !== seeded.signatureHex) { + throw new Error(`happy: displayed signature "${signatureValue}" != real stored signature "${seeded.signatureHex}"`); + } + if (pubkeyValue !== seeded.authorPubkeyHex) { + throw new Error(`happy: displayed pubkey "${pubkeyValue}" != real stored pubkey "${seeded.authorPubkeyHex}"`); + } + if (signatureValue.length !== 128 || pubkeyValue.length !== 64) { + throw new Error( + `happy: unexpected byte lengths - signature hex len=${signatureValue.length} (want 128 for 64 bytes), pubkey hex len=${pubkeyValue.length} (want 64 for 32 bytes)`, + ); + } + + evidence.pass = true; + return evidence; + } catch (err) { + evidence.pass = false; + evidence.error = String(err && err.message ? err.message : err); + throw Object.assign(err, { evidence }); + } finally { + await context.close(); + } +} + +async function main() { + const vite = await createViteServer({ + root: ROOT, + configFile: resolve(ROOT, "vite.config.ts"), + logLevel: "warn", + server: { host: "127.0.0.1", port: VITE_PORT, strictPort: true }, + }); + await vite.listen(); + + const browser = await chromium.launch({ headless: true, args: ["--no-sandbox"] }); + + let result; + let failed = false; + try { + try { + result = await runHappyPath(browser); + } catch (e) { + failed = true; + result = e.evidence ?? { scenario: "happy", pass: false, error: String(e) }; + } + } finally { + await browser.close(); + await vite.close(); + } + + const evDir = resolve(ROOT, ".omo/evidence/the-commons-hollow-polish"); + mkdirSync(evDir, { recursive: true }); + const now = new Date().toISOString(); + writeFileSync( + resolve(evDir, "task-14-the-commons-hollow-polish.json"), + JSON.stringify( + { + task: "14. Add a signature-verification affordance to transaction history", + qa: "happy", + description: + "A genuine Ed25519-signed wallet.issue event is appended for the page's own local identity via the real append() path. The wallet's TransactionHistory row for that entry is expanded via its data-testid, and the test asserts: (1) the verified-signature badge reaches a 'Verified' text state via a specific selector (not a visual/screenshot judgment), re-derived by the real independent verifyEntrySignature() re-check, and (2) the expanded detail panel displays the raw signature and author-public-key hex, byte-identical to the real stored StoredEventLogEntry fields.", + tool: "Playwright (chromium), real Vite dev server, real app UI at '/' (WalletCard -> TransactionHistory)", + run_command: "node e2e/transactionHistorySignature.e2e.mjs", + selectors_used: [ + "history-entry", + "history-signature-badge-", + "history-expand-toggle-", + "history-signature-detail-", + "history-signature-value-", + "history-pubkey-value-", + ], + timestamp: now, + result, + pass: Boolean(result && result.pass), + }, + null, + 2, + ), + ); + + console.log("\n===== e2e RESULT ====="); + console.log(JSON.stringify(result, null, 2)); + console.log(`\nSUMMARY: happy=${result && result.pass ? "PASS" : "FAIL"}`); + if (failed || !(result && result.pass)) { + process.exitCode = 1; + } +} + +main().catch((e) => { + console.error("FATAL", e); + process.exitCode = 1; +}); diff --git a/src/shell/TransactionHistory.module.css b/src/shell/TransactionHistory.module.css index 259c06a..361bc1a 100644 --- a/src/shell/TransactionHistory.module.css +++ b/src/shell/TransactionHistory.module.css @@ -8,8 +8,7 @@ .row { display: flex; - align-items: center; - justify-content: space-between; + flex-direction: column; padding: 0.6rem 0; border-bottom: 1px solid var(--color-border); } @@ -18,6 +17,20 @@ border-bottom: none; } +.rowMain { + display: flex; + align-items: center; + justify-content: space-between; + gap: var(--space-2); +} + +.rowPrimary { + display: flex; + flex-direction: column; + gap: 0.2rem; + min-width: 0; +} + .label { font-size: var(--text-body-size); color: var(--color-ink); @@ -29,6 +42,67 @@ font-variant-numeric: tabular-nums; } +.badgeVerified, +.badgeFailed, +.badgeChecking { + align-self: flex-start; + font-size: var(--text-caption-size); + font-weight: 700; + padding: 0.1rem 0.45rem; + border-radius: var(--radius-pill); +} + +.badgeVerified { + background: var(--color-positive-bg); + color: var(--color-positive); +} + +.badgeFailed { + background: var(--color-negative-bg); + color: var(--color-negative); +} + +.badgeChecking { + background: var(--color-border); + color: var(--color-ink-faint); +} + +.expandToggle { + flex-shrink: 0; + border: 1px solid var(--color-border); + background: var(--color-surface); + color: var(--color-accent); + font-size: var(--text-caption-size); + font-weight: 700; + padding: 0.3rem 0.6rem; + border-radius: var(--radius-pill); + cursor: pointer; +} + +.signatureDetail { + margin: 0.5rem 0 0; + padding: 0.6rem 0.75rem; + border-radius: var(--radius-sm); + background: var(--color-canvas); + display: grid; + grid-template-columns: auto 1fr; + gap: 0.2rem 0.6rem; +} + +.signatureLabel { + font-size: var(--text-caption-size); + color: var(--color-ink-faint); + font-weight: 700; +} + +.signatureValue { + margin: 0; + font-family: ui-monospace, SFMono-Regular, Menlo, monospace; + font-size: var(--text-caption-size); + color: var(--color-ink-soft); + word-break: break-all; +} + .amountIn { color: var(--color-accent); } diff --git a/src/shell/TransactionHistory.test.tsx b/src/shell/TransactionHistory.test.tsx new file mode 100644 index 0000000..ecf0a49 --- /dev/null +++ b/src/shell/TransactionHistory.test.tsx @@ -0,0 +1,70 @@ +// @vitest-environment happy-dom +import "@testing-library/jest-dom/vitest"; +import { cleanup, render, screen, waitFor } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { afterEach, beforeEach, describe, expect, it } from "vitest"; +import { db } from "../lib/db"; +import { append } from "../lib/eventlog"; +import { getPublicKey, init } from "../lib/identity"; +import { toAccountId } from "./accountId"; +import { TransactionHistory } from "./TransactionHistory"; +import { walletHistoryFor } from "./walletHistory"; + +afterEach(cleanup); + +beforeEach(async () => { + indexedDB.deleteDatabase(db.name); + db.close(); + await db.open(); +}); + +function toHex(bytes: Uint8Array): string { + return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join(""); +} + +describe("TransactionHistory signature verification", () => { + it("shows a verified badge for a genuinely signed transaction and reveals its real signature/pubkey on expand", async () => { + await init(); + const accountId = toAccountId(await getPublicKey()); + const stored = await append({ type: "wallet.issue", account: accountId, amount: 100 }); + const [history] = walletHistoryFor([stored], accountId); + const user = userEvent.setup(); + + render(); + + const badge = screen.getByTestId(`history-signature-badge-${history.id}`); + await waitFor(() => expect(badge).toHaveTextContent("Verified")); + + expect(screen.queryByTestId(`history-signature-detail-${history.id}`)).not.toBeInTheDocument(); + await user.click(screen.getByTestId(`history-expand-toggle-${history.id}`)); + + expect(screen.getByTestId(`history-signature-value-${history.id}`)).toHaveTextContent( + toHex(stored.signature), + ); + expect(screen.getByTestId(`history-pubkey-value-${history.id}`)).toHaveTextContent( + toHex(stored.authorPubkey), + ); + }); + + it("shows a distinct not-verified state for an entry whose signature was tampered with (test-only, never reachable from the real UI)", async () => { + await init(); + const accountId = toAccountId(await getPublicKey()); + const stored = await append({ type: "wallet.issue", account: accountId, amount: 100 }); + const [history] = walletHistoryFor([stored], accountId); + const tampered = { + ...history, + entry: { ...history.entry, payload: { type: "wallet.issue", account: accountId, amount: 999999 } }, + }; + + render(); + + const badge = screen.getByTestId(`history-signature-badge-${tampered.id}`); + await waitFor(() => expect(badge).toHaveTextContent("Not verified")); + expect(badge).not.toHaveTextContent("Verified"); + }); + + it("renders an empty state with no transactions", () => { + render(); + expect(screen.getByText("No transactions yet")).toBeInTheDocument(); + }); +}); diff --git a/src/shell/TransactionHistory.tsx b/src/shell/TransactionHistory.tsx index a6356ca..6c70761 100644 --- a/src/shell/TransactionHistory.tsx +++ b/src/shell/TransactionHistory.tsx @@ -1,3 +1,5 @@ +import { useEffect, useState } from "react"; +import { verifyEntrySignature } from "../lib/eventlog"; import styles from "./TransactionHistory.module.css"; import type { WalletHistoryEntry } from "./walletHistory"; @@ -5,6 +7,8 @@ export interface TransactionHistoryProps { entries: WalletHistoryEntry[]; } +type VerificationStatus = "checking" | "verified" | "failed"; + function describe(entry: WalletHistoryEntry): { label: string; signed: string; isCredit: boolean } { if (entry.kind === "issued") { return { label: "Issued", signed: `+${entry.amount}`, isCredit: true }; @@ -15,7 +19,43 @@ function describe(entry: WalletHistoryEntry): { label: string; signed: string; i return { label: `To ${entry.counterparty}`, signed: `-${entry.amount}`, isCredit: false }; } +function toHex(bytes: Uint8Array): string { + return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join(""); +} + +/** + * Independently re-verifies each visible row's signature via + * `verifyEntrySignature` (src/lib/eventlog.ts) - the same check + * `appendEntry` already performs before persisting - rather than letting + * the "verified" badge merely assume persistence implies validity. Mirrors + * the pattern already established in Assembly's `TestimonyBoard.tsx`. + */ +function useSignatureVerification(entries: WalletHistoryEntry[]): Record { + const [status, setStatus] = useState>({}); + + useEffect(() => { + let cancelled = false; + Promise.all( + entries.map(async (entry) => { + const ok = await verifyEntrySignature(entry.entry); + return [entry.id, ok ? "verified" : "failed"] as const; + }), + ).then((results) => { + if (cancelled) return; + setStatus(Object.fromEntries(results)); + }); + return () => { + cancelled = true; + }; + }, [entries]); + + return status; +} + export function TransactionHistory({ entries }: TransactionHistoryProps) { + const verification = useSignatureVerification(entries); + const [expandedId, setExpandedId] = useState(undefined); + if (entries.length === 0) { return

No transactions yet

; } @@ -24,12 +64,51 @@ export function TransactionHistory({ entries }: TransactionHistoryProps) {
    {entries.map((entry) => { const { label, signed, isCredit } = describe(entry); + const status = verification[entry.id] ?? "checking"; + const expanded = expandedId === entry.id; + const badgeClass = + status === "verified" + ? styles.badgeVerified + : status === "failed" + ? styles.badgeFailed + : styles.badgeChecking; + const badgeText = + status === "verified" ? "Verified" : status === "failed" ? "Not verified" : "Checking…"; + return (
  • - {label} - - {signed} - +
    +
    + {label} + + {badgeText} + +
    + + {signed} + + +
    + {expanded && ( +
    +
    Signature
    +
    + {toHex(entry.entry.signature)} +
    +
    Author public key
    +
    + {toHex(entry.entry.authorPubkey)} +
    +
    + )}
  • ); })} diff --git a/src/shell/walletHistory.test.ts b/src/shell/walletHistory.test.ts index e0109ff..22ef87d 100644 --- a/src/shell/walletHistory.test.ts +++ b/src/shell/walletHistory.test.ts @@ -27,6 +27,10 @@ describe("walletHistoryFor", () => { expect(history).toHaveLength(2); expect(history[0]).toMatchObject({ kind: "sent", amount: 40, counterparty: "B", lamportTs: 1 }); expect(history[1]).toMatchObject({ kind: "issued", amount: 100, lamportTs: 0 }); + // Carries the underlying signed entry so a caller can independently + // re-verify its signature (e.g. the transaction history UI). + expect(history[0].entry).toBe(entries[1]); + expect(history[1].entry).toBe(entries[0]); }); it("classifies a transfer as received when the account is the recipient", () => { @@ -35,7 +39,14 @@ describe("walletHistoryFor", () => { const history = walletHistoryFor(entries, "A"); expect(history).toEqual([ - { id: entries[0].id, lamportTs: 0, kind: "received", amount: 10, counterparty: "X" }, + { + id: entries[0].id, + lamportTs: 0, + kind: "received", + amount: 10, + counterparty: "X", + entry: entries[0], + }, ]); }); diff --git a/src/shell/walletHistory.ts b/src/shell/walletHistory.ts index 3abb192..6c378d1 100644 --- a/src/shell/walletHistory.ts +++ b/src/shell/walletHistory.ts @@ -9,6 +9,11 @@ export interface WalletHistoryEntry { kind: WalletHistoryKind; amount: number; counterparty?: string; + /** The underlying signed Event Log entry, kept so a caller (e.g. the + * wallet's transaction history UI) can independently re-verify its + * signature via `verifyEntrySignature` (src/lib/eventlog.ts) rather than + * merely trusting it was already validated at append time. */ + entry: StoredEventLogEntry; } function entryFor( @@ -24,7 +29,7 @@ function entryFor( p.account === accountId && typeof p.amount === "number" ) { - return { id: entry.id, lamportTs: entry.lamportTs, kind: "issued", amount: p.amount }; + return { id: entry.id, lamportTs: entry.lamportTs, kind: "issued", amount: p.amount, entry }; } if (p.type === "wallet.transfer" && typeof p.amount === "number") { @@ -35,6 +40,7 @@ function entryFor( kind: "sent", amount: p.amount, counterparty: p.to, + entry, }; } if (p.to === accountId && typeof p.from === "string") { @@ -44,6 +50,7 @@ function entryFor( kind: "received", amount: p.amount, counterparty: p.from, + entry, }; } }