fix: preserve string return type for scSpecTypeAddress#1328
Merged
Conversation
There was a problem hiding this comment.
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
parseTypeFromTypeDefto accept anisFunctionInputparameter that controls whether Address types are typed asstring | Address(for inputs) orstring(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.
|
Size Change: +19.5 kB (+0.04%) Total Size: 45 MB
|
quietbits
approved these changes
Jan 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This fixes an oversight in binding generation that allows the
xdr.ScSpecType.scSpecTypeAddress()to be parsed universally into its typescript representation ofstring | AddressThis is not backwards compatible with the CLI's generated implementation for function return types and generated interfaces that containAddress.