Skip to content

Add unit tests for XDR event decoder #27

@Miracle656

Description

@Miracle656

Background

Wraith's XDR event decoder parses raw Soroban event data into structured transfer records (from, to, amount, token). This decoder runs on every ingested ledger — a bug here silently corrupts the transfer history for all users. It currently has zero test coverage.

What to build

Add Jest unit tests for the XDR decoding logic using fixture data from real Soroban events.

Key files

  • src/decoder.ts — the XDR parsing function
  • src/__tests__/decoder.test.ts — create this

Suggested execution

git checkout -b test/xdr-decoder-unit-tests
  1. Capture 3–5 real Soroban transfer event XDR payloads from testnet (Stellar Laboratory or the Horizon events API)
  2. Store them as fixtures in src/__tests__/fixtures/events.json
  3. Write tests asserting correct from, to, amount, and contractId for each fixture
  4. Write one test with malformed XDR — decoder should throw, not return undefined

Example commit message:
test(decoder): add unit tests for XDR Soroban event decoder with fixtures

Acceptance criteria

  • At least 3 valid SAC transfer event fixtures tested
  • Malformed XDR input throws (not silent failure)
  • No live network calls in tests
  • npm test green

Drips Wave · Complexity: Medium · 150 points
Comment below to request assignment. PR must include Closes #[this issue].

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions