Skip to content

test(sdk): XDR roundtrip tests for transaction builder helpers#404

Open
blockchain-maxis wants to merge 1 commit into
Miracle656:mainfrom
blockchain-maxis:feat/issue-257-xdr-roundtrip
Open

test(sdk): XDR roundtrip tests for transaction builder helpers#404
blockchain-maxis wants to merge 1 commit into
Miracle656:mainfrom
blockchain-maxis:feat/issue-257-xdr-roundtrip

Conversation

@blockchain-maxis

Copy link
Copy Markdown
Contributor

Summary

  • Adds sdk/tests/xdr-roundtrip.test.ts with 6 tests covering every transaction builder helper in sdk/src/claimableBalance.ts
  • Tests encode → decode → assert deep equality on the operations array for:
    • createEscrowOperation.createClaimableBalance (native XLM + non-native asset variants)
    • claimEscrowOperation.claimClaimableBalance
    • reclaimEscrowOperation.claimClaimableBalance
    • Full envelope stability (tx.toXDR()fromXDR()toXDR() is idempotent)
  • Uses the real @stellar/stellar-sdk — no mocking of TransactionBuilder or operations
  • Uses hardcoded valid Stellar public keys to avoid crypto.getRandomValues issues in jsdom

closes #257

Test results

PASS tests/xdr-roundtrip.test.ts
  XDR roundtrip — createEscrow (createClaimableBalance)
    ✓ operations survive encode → decode unchanged
    ✓ non-native asset roundtrips without data loss
  XDR roundtrip — claimEscrow (claimClaimableBalance)
    ✓ operations survive encode → decode unchanged
  XDR roundtrip — reclaimEscrow (claimClaimableBalance by sender after deadline)
    ✓ operations survive encode → decode unchanged
  XDR envelope stability
    ✓ re-encoding the decoded TX produces the same XDR (full envelope roundtrip)
    ✓ claimClaimableBalance re-encoding is stable

Tests: 6 passed, 6 total

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@blockchain-maxis is attempting to deploy a commit to the miracle656's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@blockchain-maxis Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Stellar XDR roundtrip tests

1 participant