Skip to content

Event-sourced payout history (replace localStorage-only ledger) #9

Open

Description

@SYMBAxx

The Earnings payout ledger is built from receipts in localStorage, so it's empty on a new device. Use rpc.getEvents for the contract's withdrawn/created events filtered by the connected address (fall back gracefully beyond RPC retention).

Acceptance: history appears on a fresh browser; events decoded in a tested helper.

Activity

  1. NePreby commented on Nov 6, 2026

    @NePreby

    I have implemented event-sourced payout history using Soroban rpc.getEvents in Pull Request #26: #26

    Summary of Implementation:

    • Soroban Event Sourcing: Implemented fetchContractEvents in src/lib/events.ts querying server.getEvents across StreamRouter and CascadeSplitter contracts.
    • Contract Event Decoding: Pure decoder decodeContractEvent parses withdrawn, created, topped_up, cancelled, and distributed topics and values into typed DecodedPayoutEvent objects.
    • Deduplication & Receipt Pairing: Merges on-chain events with local RFC-8785 receipts, allowing immediate history display on fresh browsers while preserving full cryptographic audit capability.
    • Earnings Page Integration: Replaced localStorage-only hook with usePayoutLedger, providing live RPC settlement badges and explorer links.
    • Test Suite: 5 new unit tests in src/lib/__tests__/events.test.ts. 79/79 unit tests pass and TypeScript check is 100% clean.

    Bounty Payout Wallet (TRC20 TRX/USDT):
    TMqmJjRgVS21NL2eFtfyHciTxvE4BqGmEv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions