Skip to content

Option type missing from docs #485

Closed

Description

@tamirms

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.

Activity

  1. Julian-dev28 commented on May 17, 2023

    @Julian-dev28
    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!

  2. paulbellamy commented on May 22, 2023

    @paulbellamy
    Contributor

    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 🤷

  3. added
    bug
    and removed
    bug
    on Sep 20, 2023
  4. moved this from Backlog to To Do in Dev Docson Jan 7, 2025
  5. moved this from To Do to In Progress in Dev Docson Jan 21, 2025
  6. moved this from In Progress to In Review in Dev Docson Jan 28, 2025
  7. added a commit that references this issue on Feb 7, 2025
  8. carstenjacobsen commented on Feb 10, 2025

    @carstenjacobsen
    Contributor

    Closed by #1232

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

  • Status
    In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions