Repository navigation
feat(billing): source deposit history from vault events - #1364
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1319
Problem
The Billing History page rendered a hardcoded
MOCK_TRANSACTIONSarray. 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'sdepositevents with Soroban RPCgetEvents. It filters by the vault contract, thedeposittopic, and the connected address. It decodes(amount, new_balance)withscValToNativeand keeps stroop amounts exact until the final USDC conversion.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.tsxrenders 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_TRANSACTIONSmoved tosrc/data/billingFixtures.ts, with hashes generated as valid 64-character hex, and network set to testnet.docs/BillingHistoryPreview.mddescribes the new data source.Also in this branch
be9c0bb(authored by Adejoke46) restores baseline types onmain. Without it,tsc --noEmitfails onmainincatalogApi.ts,mockApis.ts, andApiDetailPage.tsx.Not included
Validation
npx tsc -p tsconfig.json --noEmit: passed.npm run build: passed.npx vitest run: 153 files, 2297 tests passed.src/services/vaultEvents.test.tsandsrc/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