Skip to content

feat(billing): source deposit history from vault events - #1364

Merged
greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
Godgeneral9:fix/issue-1319
Oct 24, 2026
Merged

greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
Godgeneral9:fix/issue-1319

Conversation

@Godgeneral9

Copy link
Copy Markdown
Contributor

Closes #1319

Problem

The Billing History page rendered a hardcoded MOCK_TRANSACTIONS array. Its hashes were not valid hex, and the rows were labelled "Stellar Mainnet" while the app runs on testnet.

Change

  • fetchDepositEvents (src/services/vaultEvents.ts) reads the vault's deposit events with Soroban RPC getEvents. It filters by the vault contract, the deposit topic, and the connected address. It decodes (amount, new_balance) with scValToNative and keeps stroop amounts exact until the final USDC conversion.
  • The start ledger comes from getHealth, so the request never falls before the RPC's oldest ledger. When the wanted window starts earlier, the page shows a retention note.
  • useDepositHistory (src/hooks/useDepositHistory.ts) tags each result with its address. A response for a previous wallet is discarded, so rows from two addresses never mix. Retry and Load older (cursor paging, de-duplicated by id) are included.
  • BillingHistory.tsx renders loading (aria-busy), no-wallet, error with Retry (role="alert"), and empty states in place of the table. Existing filters, sort, and the live region work on the fetched rows.
  • MOCK_TRANSACTIONS moved to src/data/billingFixtures.ts, with hashes generated as valid 64-character hex, and network set to testnet.
  • docs/BillingHistoryPreview.md describes the new data source.

Also in this branch

  • be9c0bb (authored by Adejoke46) restores baseline types on main. Without it, tsc --noEmit fails on main in catalogApi.ts, mockApis.ts, and ApiDetailPage.tsx.

Not included

  • A Connect button in the no-wallet state. The state explains how to connect, but does not trigger it.
  • Explorer links on rows. Rows show the real hash.
  • The CSV export and API-call rows, both out of scope in the issue.
  • Testing against a live testnet deposit (the acceptance check in the issue).

Validation

  • npx tsc -p tsconfig.json --noEmit: passed.
  • npm run build: passed.
  • npx vitest run: 153 files, 2297 tests passed.
  • src/services/vaultEvents.test.ts and src/pages/BillingHistory.test.tsx: 80 tests passed. The new tests cover mapping, contract/topic/caller filters, retention, cursor paging, malformed events, invalid address, RPC errors, and the no-wallet, error/retry, empty, retention, and Load older states.

Limits

RPC is mocked in tests. Coverage was not measured against the 90% target.

🤖 Generated with Claude Code

Adejoke46 and others added 3 commits October 23, 2026 08:01
The Billing History page rendered a hardcoded array, with hashes that were
not valid hex and rows labelled as mainnet. Deposit rows now come from the
vault's deposit events for the connected wallet, read with Soroban RPC
getEvents and filtered by contract, topic and caller.

The page has loading, no-wallet, error with Retry, and empty states, plus
a note when history falls outside the RPC retention window. Older deposits
load with a cursor. Responses for a previous wallet are discarded. Mock
rows moved to src/data/billingFixtures.ts with valid hashes.

Closes CalloraOrg#1319

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	src/api/catalogApi.ts
#	src/data/mockApis.ts
@greatest0fallt1me
greatest0fallt1me merged commit 42951ac into CalloraOrg:main Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build Billing History from on-chain vault deposit events instead of mock transactions

3 participants