Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option type missing from docs #485

Open
tamirms opened this issue Jan 22, 2023 · 4 comments
Open

Option type missing from docs #485

tamirms opened this issue Jan 22, 2023 · 4 comments
Assignees

Comments

@tamirms
Copy link
Contributor

tamirms commented Jan 22, 2023

It is not clear how to represent a Rust Option type in XDR. The custom-types documentation does not include any information about Option types.

Also, it would be helpful to have more tooling or at least a link to a reference implementation which converts Soroban types into their corresponding XDR structures. Otherwise, you are left guessing at how values should be encoded as SCVals.

@Julian-dev28
Copy link
Contributor

@tamirms @paulbellamy

How is the status on this Issue? We have had some updates since it was opened and I'm thinking that things may have changed or it this issue has been resolved.

I would appreciate an update when you get a chance

Thanks!

@paulbellamy
Copy link
Contributor

paulbellamy commented May 22, 2023

stellar/stellar-xdr#70 completely overhauled the scval system since this issue was written. There are two ways Option is represented in xdr.

In the ContractSpec (what you get if you do a soroban contract inspect), there is an ScSpecTypeOption type, which acts like rust's Option<T>

In the actual invocation xdr, there is no explicit Option type. Instead there is an ScVoid value, which you can pass for any value that should be None. This roughly means that in the arguments every argument is implicitly optional. But if you make the wrong one optional the transaction will be rejected.

We should probably think of a good way to explain this to people.

Good luck 🤷

@ElliotFriend ElliotFriend added bug Something isn't working and removed bug Something isn't working labels Sep 20, 2023
@janewang janewang transferred this issue from stellar-deprecated/soroban-docs Apr 16, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Dev Docs Apr 16, 2024
@janewang
Copy link
Contributor

@leighmcculloch
Copy link
Member

Should add to this page too: https://developers.stellar.org/docs/tools/sdks/build-your-own

@leighmcculloch leighmcculloch self-assigned this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

7 participants
@paulbellamy @leighmcculloch @janewang @tamirms @ElliotFriend @Julian-dev28 and others