Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/czyczk/exp-ink-struct
ink! contract experiment. Dealing with structs.
https://github.com/czyczk/exp-ink-struct
Last synced: 3 months ago
JSON representation
ink! contract experiment. Dealing with structs.
- Host: GitHub
- URL: https://github.com/czyczk/exp-ink-struct
- Owner: czyczk
- Created: 2022-01-26T11:22:52.000Z (almost 3 years ago)
- Default Branch: exp-no-json
- Last Pushed: 2022-05-23T08:21:12.000Z (over 2 years ago)
- Last Synced: 2024-07-31T15:03:57.171Z (6 months ago)
- Language: Rust
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-phat-contracts - Nested Structs Example - a boilerplate example of using nested structs for ink! smart contracts. (Ink Smart Contract Examples / Consumer Contract Examples)
README
# Experiment of ink! Smart Contract: Struct
This example smart contract is for testing purpose.
- Nested structs as parameter (`Inner`, `Outer`): Normal nested JSON object passed in through the API.
- Enum as parameter (`Shape::Circle`, `Shape::Rectangle`): Take `Shape::Rectangle` as example:```
[
{
"Rectangle": [
3,
4
]
}
]
```or
```
[
{
"Rectangle": {
"x": 3,
"y": 4
}
}
]
```**Explanation:** Specify the name of the enum variant in the JSON object's top-level entry. Then either pass in the fields in order or name the fields and specify the values in any order.