stellar / rs-stellar-xdr

Rust lib for Stellar XDR.
Apache License 2.0
20 stars 27 forks source link

Add conversion from references of tuples to ScVal #318

Closed brson closed 1 year ago

brson commented 1 year ago

What

Add impls of TryFrom for references of tuples to ScVec and ScVal.

Why

Per https://github.com/stellar/rs-soroban-sdk/issues/1124, UDTs currently don't work with tuple fields because the #[contracttype] macro generates code that expects the From implementation on references of the types it is converting.

Known limitations

None, but because this enables more forms of UDTs to work, this will impose more requirements on client bindings for non-Rust languages.


I have tested the SDK with this patch applied, that UDTs with tuple fields work. After the SDK is updated for these changes I will land corresponding test cases in the SDK based on this patch: https://github.com/brson/rs-soroban-sdk/commit/bcda4faadadabec7f5f0796e341bb84111bbd6b2