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

Allow use of Option in contracttype #444

Closed
sisuresh opened this issue Sep 15, 2022 · 2 comments · Fixed by stellar/rs-soroban-sdk#1145, stellar/rs-stellar-xdr#320 or #1198
Closed

Allow use of Option in contracttype #444

sisuresh opened this issue Sep 15, 2022 · 2 comments · Fixed by stellar/rs-soroban-sdk#1145, stellar/rs-stellar-xdr#320 or #1198
Assignees

Comments

@sisuresh
Copy link
Contributor

What problem does your feature solve?

We should be able to include an Option member in a contracttype. Limiting it to Option<RawVal> should be fine because doing this generically might not be possible.

The error if you try to use the following struct -

the trait `From<&core::option::Option<RawVal>>` is not implemented for `ScVal`
#[derive(Clone)]
#[contracttype)]
pub struct CustomStruct {
    pub name: Symbol,
    pub salt: Option<RawVal>,
}
@leighmcculloch leighmcculloch transferred this issue from stellar/rs-soroban-sdk Sep 16, 2022
@leighmcculloch leighmcculloch self-assigned this Sep 24, 2022
@leighmcculloch leighmcculloch removed their assignment Nov 11, 2022
@graydon
Copy link
Contributor

graydon commented Feb 6, 2023

I believe this is done now, @leighmcculloch ?

@leighmcculloch
Copy link
Member

I'm not sure. Can you test it? If it works then we're good.

@leighmcculloch leighmcculloch self-assigned this Nov 11, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 14, 2023
### What
Update stellar-xdr.

### Why
To get changes in stellar-xdr that fix Option<T> <> ScVal for:
- Close stellar/rs-soroban-sdk#877
- Close #444

Dependent on:
- stellar/rs-stellar-xdr#320
github-merge-queue bot pushed a commit to stellar/rs-soroban-sdk that referenced this issue Nov 14, 2023
### What
Try to make Option<T> work with contracttype

### Why
Close stellar/rs-soroban-env#444
Close #877

Dependent on:
- stellar/rs-stellar-xdr#320
- stellar/rs-soroban-env#1198
github-merge-queue bot pushed a commit to stellar/rs-soroban-sdk that referenced this issue Nov 14, 2023
### What
Try to make Option<T> work with contracttype

### Why
Close stellar/rs-soroban-env#444
Close #877

Dependent on:
- stellar/rs-stellar-xdr#320
- stellar/rs-soroban-env#1198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants