P5-W1: Wallet / Tax / Forensics Pack — Gold datasets, tax export, forensics view#127
Conversation
…iew (P5-W1) Prove the platform powers wallet, tax, and forensics use cases by adding Gold-tier datasets derived from existing Silver data without raw chain parsing. - Add WalletLedger and BalanceHistory variants to DatasetName enum - Add WalletLedgerRecord and BalanceSnapshot record types with counterparty tracking, fee breakdown, and nullable cost_basis/proceeds fields - Add ForensicsActivity, CounterpartySummary, NetworkActivity, TypeBreakdown types - Add SQL migrations for wallet_ledger and balance_history tables - Implement wallet_ledger materializer deriving from token_transfers, native_balance_deltas, hl_fills, and hl_funding with counterparty extraction - Implement balance_history materializer computing running balances per asset - Implement forensics activity builder with top counterparties and cross-chain summary - Add repository query/export methods for both Gold datasets - Register wallet_ledger and balance_history in dataset API (queryable + exportable) - Add GET /v1/export/tax endpoint with tax-software-friendly CSV format - Add GET /v1/forensics/activity endpoint for wallet interaction analysis - Update README.md with new datasets, endpoints, and tax export shape Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 62017c942ed3
P5-W1 Remote Review: Wallet / Tax / Forensics PackVerdict: Review pass is clear. No blocking issues. All 4 CI checks pass (fmt, clippy, test, build). Reviewed the full 2052-line diff across 7 files. Review focus findings
Non-blocking observations
Ready to merge from the PR-comment review perspective. |
Summary
Phase 5, Work Packet 1: proves the platform powers wallet, tax, and forensics use cases by adding Gold-tier datasets materialized entirely from existing Silver data — no raw chain parsing required.
wallet_ledgerdataset with counterparty tracking, derived from Silvertoken_transfersbalance_historydataset for point-in-time balance snapshotsGET /v1/export/tax— 13-column format with gain/loss computationGET /v1/forensics/activity— counterparty aggregation, cross-chain activity, and transaction type breakdownDatasetName::all(),QUERYABLE_DATASETS, andEXPORTABLE_DATASETSwallet_ledgerandbalance_historytables with appropriate indexesValidation
cargo fmt --all --checkcleancargo clippy --workspace --all-targets -- -D warningscleanFiles changed
core/src/materializer.rsadapters/src/ledger_derivation.rsadapters/src/v2_repo.rsapi/src/main.rsmigrations/20260310200000_add_wallet_ledger.sqlmigrations/20260310200001_add_balance_history.sqlREADME.mdTest plan
cargo test --workspacepasses (848 tests)cargo clippyandcargo fmtare cleanledger_derivation.rs🤖 Generated with Claude Code