Skip to content

feat: implement @yieldstream/sdk TypeScript client and Merkle conformance - #7

Merged
CHASE3020 merged 3 commits into
mainfrom
feat/issue-17-typescript-sdk
Nov 6, 2026
Merged

CHASE3020 merged 3 commits into
mainfrom
feat/issue-17-typescript-sdk

Conversation

@CHASE3020

Copy link
Copy Markdown
Collaborator

Summary

Resolves yieldstream-contract #17, and yieldstream-sdk #1, #2, #3, #4, #5.

Implements the full typed TypeScript client and Merkle proof tooling for the YieldStream protocol:

  • Merkle Core (src/merkle.ts):
    • Pinned RFC 6962 domain separation constants (LEAF_PREFIX = 0x00, NODE_PREFIX = 0x01).
    • computeLeaf: Byte-identical to the Rust distributor contract with XDR ScVal encoding of distribution_id, index, recipient: Address, and amount: i128.
    • hashPair: Sorted sibling pair hashing (min(a,b), max(a,b)).
    • buildTree: Power-of-two padding with duplicate leaf padding and inclusion proof generation.
    • generateTree: High-level tree builder generating root, leaves, and per-recipient proofs.
    • verifyProof: Off-chain proof verification against root.
  • Typed Protocol Client (src/client.ts):
    • YieldStreamClient with contract address binding and network passphrase configuration.
    • Transaction builders for createCampaign, claim, claimMany, cancel, sweep, and upgrade.
    • RPC simulation view helpers: getDistribution, isClaimed, getDistributionCount, getAdmin, getVersion.
  • Event Decoding (src/events.ts):
    • Decoding helpers for created, claimed, cancel, swept, and upgrade events.
  • Cross-Language Conformance Suite (src/conformance.test.ts):
    • Un-skipped and passed all vector conformance tests against canonical test-vectors/merkle_v1.json.
    • 100% byte match for every leaf hash and root across all vector trees.
  • Documentation & Packaging:
    • Complete copy-paste quickstart example for issuers and frontend claimers using @stellar/stellar-sdk and Freighter.
    • Configured source maps and TypeScript declaration maps for npm publishing.

@CHASE3020
CHASE3020 merged commit 4583dfe into main Nov 6, 2026
1 check passed
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.

1 participant