Skip to content

fix(builder): validate C... contract recipient addresses in StreamBuilder (closes #609) - #697

Open
Ranjeet2063 wants to merge 1 commit into
conduit-protocol:mainfrom
Ranjeet2063:fix/issue-609-streambuilder-contract-recipient
Open

fix(builder): validate C... contract recipient addresses in StreamBuilder (closes #609)#697
Ranjeet2063 wants to merge 1 commit into
conduit-protocol:mainfrom
Ranjeet2063:fix/issue-609-streambuilder-contract-recipient

Conversation

@Ranjeet2063

Copy link
Copy Markdown

Summary

Closes #609

Ensures full parity with #587 by validating Soroban contract ID (C...) recipient addresses using isValidAddress in StreamBuilder and ConduitBatcher.

Key Changes

  • src/builder.ts:
    • Imported and used isValidAddress for StreamBuilder._validateAddress and validatePayload address validation.
    • Ensures valid Soroban contract IDs (C...) are accepted and cleanly encoded into contract arguments via Address.toScVal().
    • Rejects malformed or invalid contract IDs with clear, actionable error messages.
  • src/tests/builder-contract-recipient.test.ts:
    • Added unit tests validating:
      1. Valid C... contract recipient acceptance in StreamBuilder.build().
      2. Correct encoding as ScAddressTypeContract inside StreamBuilder.toContractArgs().
      3. Rejection of malformed checksum C... addresses.
      4. Rejection of empty or whitespace recipient strings.
      5. Validation of contract recipients within ConduitBatcher.execute.

Verification

  • 5/5 new unit tests pass in src/tests/builder-contract-recipient.test.ts.
  • All existing builder tests (55/55) pass without regression.
  • npm run build generates clean ESM and CJS bundles.

Copilot AI lite review requested due to automatic review settings September 6, 2026 13:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

StreamBuilder: validate C… contract recipient addresses

2 participants