Skip to content

fix: throw clear error when buildPaymentXdr() issuer is missing#191

Open
shoaib050326 wants to merge 2 commits into0xNgoo:mainfrom
shoaib050326:fix/issue-134-missing-issuer
Open

fix: throw clear error when buildPaymentXdr() issuer is missing#191
shoaib050326 wants to merge 2 commits into0xNgoo:mainfrom
shoaib050326:fix/issue-134-missing-issuer

Conversation

@shoaib050326
Copy link
Copy Markdown
Contributor

Summary

Add an explicit guard in StellarUtils.buildPaymentXdr() so non-native asset payments fail with a clear error when issuer is missing.

Changes

  • throw a deterministic error for non-XLM payments without issuer
  • keep native XLM payments unchanged
  • add a focused regression test for the missing-issuer case

Root cause

buildPaymentXdr() passed issuer directly to the lower-level Stellar SDK for non-native assets. When issuer was omitted, the SDK threw Issuer cannot be null, which was less clear and less deterministic than an explicit Anchor Kit guard.

Testing

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

Impact

Contributors and SDK consumers now get a clear, immediate error when constructing non-native asset payments incorrectly, while native XLM behavior remains unchanged.

Closes #134

@shoaib050326 shoaib050326 marked this pull request as ready for review April 2, 2026 04:51
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 a validation check to ensure an issuer is provided for non-native Stellar asset payments and adds a corresponding unit test. The reviewer suggested further improving this by validating that the issuer is a valid Stellar public key using a code suggestion.

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.

Throw a clear error when buildPaymentXdr() is missing an issuer

1 participant