Skip to content

feat(transactions): wallet transaction history via Horizon#161

Open
aunysillyme wants to merge 1 commit into
sorosave-protocol:mainfrom
aunysillyme:feat/wallet-transaction-history-issue-63
Open

feat(transactions): wallet transaction history via Horizon#161
aunysillyme wants to merge 1 commit into
sorosave-protocol:mainfrom
aunysillyme:feat/wallet-transaction-history-issue-63

Conversation

@aunysillyme
Copy link
Copy Markdown

Summary

Closes #63.

Adds a new /transactions page that fetches on-chain transaction history for the SoroSave contract directly from the Stellar Horizon API.

  • src/lib/horizon.tsfetch()-based Horizon client (no extra SDK pulled in). Exposes:
    • fetchTransactionsForAccount(address, { limit, cursor, order })
    • fetchOperationsForAccount(address, { limit, cursor, order }) (includes failed ops)
    • Typed models for transactions / operations and a formatOperationType + summarizeOperation pair for rendering payments, contract invocations, path payments, trustline changes, offers, TTL extensions, etc.
    • 30s in-memory response cache keyed by URL to keep repeated paging cheap.
  • src/app/transactions/page.tsx — paginated transaction list. Reads NEXT_PUBLIC_CONTRACT_ID from the env (with an inline address override input for ad-hoc browsing), shows operation type, summary, relative timestamp, success/failure, and a deep link to the Horizon tx page. ← Newer / Older → buttons walk forward and back through cursor pages.
  • Navbar — adds a Transactions link.

Horizon URL defaults to https://horizon-testnet.stellar.org and is overridable via NEXT_PUBLIC_HORIZON_URL.

Acceptance criteria (from issue)

  • Query Horizon API for transactions involving the contract
  • Parse operation types (payments, contract invocations, …)
  • Display in a formatted transaction list
  • Add pagination for large histories
  • Cache results to reduce API calls

Test plan

  • pnpm dev and navigate to /transactions — list renders, pagination works, deep links open Horizon
  • Without NEXT_PUBLIC_CONTRACT_ID set, the page prompts for an address and the inline input loads it
  • Set NEXT_PUBLIC_HORIZON_URL to mainnet Horizon and confirm it queries the right host
  • Repeated page visits within 30s do not re-hit Horizon (cache verified via network panel)

Notes

This PR is AI-assisted (Claude Code). Author reviewed the diff before opening.

/claim #63

…protocol#63)

Adds a new /transactions page that fetches on-chain operations for the
SoroSave contract from the Stellar Horizon API. Implements:

- src/lib/horizon.ts: fetch()-based Horizon client with typed transaction
  and operation models, cursor-based pagination, and a 30s in-memory
  response cache to limit API hits.
- src/app/transactions/page.tsx: paginated, filterable transaction list
  with operation-type labels, success/failure status, relative times,
  and deep links to Horizon for each tx.
- Navbar: link to /transactions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 wallet transaction history with Stellar Horizon

1 participant