Open tamirms opened 1 year ago
@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!
https://github.com/stellar/stellar-xdr/pull/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 🤷
Should add to this page too: https://developers.stellar.org/docs/tools/sdks/build-your-own
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.