Skip to content

fix: preserve string return type for scSpecTypeAddress#1328

Merged
Ryang-21 merged 3 commits intomasterfrom
fix-binding-gen-backwards-compatibility
Jan 26, 2026
Merged

fix: preserve string return type for scSpecTypeAddress#1328
Ryang-21 merged 3 commits intomasterfrom
fix-binding-gen-backwards-compatibility

Conversation

@Ryang-21
Copy link
Copy Markdown
Contributor

@Ryang-21 Ryang-21 commented Jan 24, 2026

What

This fixes an oversight in binding generation that allows the xdr.ScSpecType.scSpecTypeAddress() to be parsed universally into its typescript representation of string | Address This is not backwards compatible with the CLI's generated implementation for function return types and generated interfaces that contain Address.

Copilot AI review requested due to automatic review settings January 24, 2026 01:58
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Jan 24, 2026
@Ryang-21 Ryang-21 requested a review from a team January 24, 2026 01:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a type generation issue for scSpecTypeAddress to maintain backwards compatibility. The binding generator now differentiates between function inputs (which can accept string | Address) and outputs/return types (which return string).

Changes:

  • Modified parseTypeFromTypeDef to accept an isFunctionInput parameter that controls whether Address types are typed as string | Address (for inputs) or string (for outputs)
  • Updated tests to separately verify input and output type expectations for all primitive types
  • Applied the input flag to all function parameters and constructor parameters in the client generator

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/integration/bindings.test.ts Updated tests to verify both input and output type mappings separately, with address inputs expecting string | Address and outputs expecting string
src/bindings/utils.ts Added isFunctionInput parameter to parseTypeFromTypeDef and propagated it through nested types, with Address/MuxedAddress returning string | Address only for inputs
src/bindings/client.ts Marked function and constructor input parameters with isFunctionInput=true to generate the appropriate union type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

Size Change: +19.5 kB (+0.04%)

Total Size: 45 MB

Filename Size Change
dist/stellar-sdk-minimal.js 5.95 MB +3.3 kB (+0.06%)
dist/stellar-sdk-minimal.min.js 5.06 MB +1.58 kB (+0.03%)
dist/stellar-sdk-no-axios.js 5.95 MB +3.3 kB (+0.06%)
dist/stellar-sdk-no-axios.min.js 5.06 MB +1.59 kB (+0.03%)
dist/stellar-sdk-no-eventsource.js 6.2 MB +3.29 kB (+0.05%)
dist/stellar-sdk-no-eventsource.min.js 5.27 MB +1.58 kB (+0.03%)
dist/stellar-sdk.js 6.2 MB +3.29 kB (+0.05%)
dist/stellar-sdk.min.js 5.27 MB +1.59 kB (+0.03%)

compressed-size-action

@Ryang-21 Ryang-21 requested review from Shaptic and quietbits January 26, 2026 20:10
@Ryang-21 Ryang-21 merged commit cafa3e6 into master Jan 26, 2026
10 checks passed
@Ryang-21 Ryang-21 deleted the fix-binding-gen-backwards-compatibility branch January 26, 2026 21:04
@github-project-automation github-project-automation bot moved this from Backlog (Not Ready) to Done in DevX Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants