-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: showcase available storage types #15
Conversation
there are also |
Hey @SkymanOne, can you have a look at this? Does this look okay'ish to you? Can it be a bit simpler somehow or other recommendations? Is there a way to put I get an error along theses lines if I put a mapping in a |
@statictype what do you think about this? I would consider this complete enough. Afaik it covers all types meant to be returned by contracts via messages. Stuff like If we call it complete I would add this contract as a e2e test to contracts-ui. |
Okay just realized this PR should be into the The more I learn about rust and ink, the more I can appreciate the What do you think about this @statictype ? |
haven't compiled it yet but LGTM! One thing that is missing is something like
why? the mother contract was incomplete in terms of types and not very specific in terms of naming. |
@statictype just added a
What I like about the mother contract is the fact that it's function just echo the input data. But this kind of functionality is maybe nice to have in a separate contract to test the sending of extrinsics from the contracts-ui. Whereas this contract is just focused on decoding the available return types. Will create the pr for the ink repo now. |
Closed in favor of use-ink/ink#1762. |
Adds first draft of a contract to showcase all types which can be stored. Not an ink/rust expert so happy to get some review what to improve.
Types:
u[8,16,32,64,128]
i[8,16,32,64,128]
struct
enum
bool
Hash
Balance
AccountId
Tuple
Array
Vec
(ink-prelude)String
(ink-prelude)Option
Some
Option
None
Result
Ok
Result
Error
Mapping
(ink-storage)#[ink::storage_item]
What else is available?
Even more types available via prelude => https://docs.rs/ink_prelude/latest/ink_prelude/
But afaik they are more useful for keeping internal contract state and are not exposed as returned values.
HashMap
(ink-prelude)BTreeMap
(ink-preludeLazy
(ink-storage)Origin:
We want such a contract to create some e2e tests showcasing all possible types available in ink for the
contracts-ui
. Related PR: use-ink/contracts-ui#449 .