Skip to content

feat: add TransactionContext for optimistic wallet transaction tracking (#123) - #230

Closed
bbkenny wants to merge 2 commits into
AudioBitsStellar:mainfrom
bbkenny:fix/audio-blocks-123-transaction-tracking
Closed

feat: add TransactionContext for optimistic wallet transaction tracking (#123)#230
bbkenny wants to merge 2 commits into
AudioBitsStellar:mainfrom
bbkenny:fix/audio-blocks-123-transaction-tracking

Conversation

@bbkenny

@bbkenny bbkenny commented Aug 3, 2026

Copy link
Copy Markdown

Closes #123

Summary

Added a TransactionContext that tracks pending, confirmed, and failed blockchain transactions, providing real-time status updates to the UI without polling.

What changed

  • New context/TransactionContext.tsx:

    • Tracks transactions with { id, hash, type, status, timestamp }
    • addTransaction(hash, type) — adds a pending transaction and starts polling
    • updateTransactionStatus(id, status) — manually update a transaction's status
    • clearTransaction(id) — remove a single transaction and stop its poll
    • clearAllTransactions() — remove all transactions and stop all polls
    • Auto-polls transaction status every 2 seconds via /api/transactions/{hash}/status
    • Shows toast notifications: "Transaction pending", "Transaction confirmed", "Transaction failed"
    • Auto-clears confirmed transactions after 60 seconds
    • Transaction history limited to the last 20 entries
  • Updated context/provider.tsx:

    • Added TransactionProvider to the provider chain between WalletProvider and LoadingProvider

Acceptance Criteria

  • ✅ Add transaction with hash and type (buy, stake, vote)
  • ✅ Poll for confirmation every 2 seconds
  • ✅ Show toast: "Transaction pending", "Transaction confirmed", "Transaction failed"
  • ✅ Transaction history (last 20)
  • ✅ Clear individual or all transactions
  • ✅ Auto-clear confirmed transactions after 60 seconds

Verification

  • npm run lint — no new warnings or errors
  • npm run test — 170/170 tests pass
  • npm run build — builds successfully (pre-existing TS errors in unrelated files remain unchanged)

…ioBitsStellar#124)

- Add hooks/useSearchHistory.ts hook for managing search history in localStorage
- Max 20 unique searches stored, deduplicated, sorted by recency
- Integrate useSearchHistory into SearchOverlay component
- Show recent searches as dropdown when search input is empty
- Allow clicking on a suggestion to populate and submit the search
- Add clear history button with Trash2 icon
- Each search query saved with timestamp
…ng (AudioBitsStellar#123)

- Create context/TransactionContext.tsx with transaction state management
- Track transactions with { id, hash, type, status, timestamp }
- Support addTransaction, updateTransactionStatus, clearTransaction, clearAllTransactions
- Auto-poll transaction status every 2 seconds
- Show toast notifications for pending, confirmed, and failed transactions
- Auto-clear confirmed transactions after 60 seconds
- Transaction history limited to last 20 entries
- Add TransactionProvider to the provider chain in provider.tsx
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

@thebabalola is attempting to deploy a commit to the akatenvictor's projects Team on Vercel.

A member of the Team first needs to authorize it.

@bbkenny bbkenny closed this Aug 3, 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.

Implement optimistic wallet transaction state tracking

2 participants