Skip to content

fix: validate payment XDR account addresses#196

Open
shoaib050326 wants to merge 2 commits into0xNgoo:mainfrom
shoaib050326:fix/issue-135-validate-payment-xdr-public-keys
Open

fix: validate payment XDR account addresses#196
shoaib050326 wants to merge 2 commits into0xNgoo:mainfrom
shoaib050326:fix/issue-135-validate-payment-xdr-public-keys

Conversation

@shoaib050326
Copy link
Copy Markdown
Contributor

@shoaib050326 shoaib050326 commented Apr 2, 2026

What does this PR do?

Adds upfront validation for payment XDR account addresses in StellarUtils.buildPaymentXdr(), so invalid source and destination inputs fail early with clear errors while still accepting valid muxed (M...) addresses supported by the Stellar SDK.

How to test?

  • bun test tests/utils/stellar.test.ts
  • bun test
  • bun run lint

You can also verify manually that:

  • invalid source rejects with source must be a valid Stellar public or muxed public key
  • invalid destination rejects with destination must be a valid Stellar public or muxed public key
  • valid muxed source and destination addresses still build successfully

Checklist

  • My code follows the code style of this project.
  • I have added tests for my changes.
  • I have run bun run test and bun run lint locally.

Issue Reference

Closes #135

@shoaib050326 shoaib050326 marked this pull request as ready for review April 2, 2026 05:27
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces upfront validation for Stellar source and destination addresses in the buildPaymentXdr function, adding support for muxed accounts and corresponding unit tests. Review feedback suggests extending this validation to the issuer field for non-native assets and simplifying the sourceAccount instantiation by using MuxedAccount.fromAddress directly, as it handles both standard and muxed addresses.

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.

Validate public keys before building payment XDR

1 participant