Files
api/packages/api-contract/src/v2.test.json
T
kwingram25 05ec4964fe Generate types from new contract ABI JSON (#1320)
* generate types from registry

* cleanup

* merge, rearrange

* lint

* built out

* abi v2 creation

* throw on unions

* linting

* version handling

* split functions

* cleanup

* drop v1 support

* special types

* changes

* requested changes

* formatTYpe

* rv outdated test

* rv union test

* codeclimate

* codeclimate

* codeclimate

* codeclimate

* codeclimate

* review

* cleanup encodeTypes

* fix option sub

* TypeDefInfo.Result
2019-10-08 16:31:48 +02:00

1414 lines
33 KiB
JSON

[
{
"info": 7,
"type": "{\"my_tuple_struct\": {\"cell\": {\"cell\": ([u8;32])}}, \"my_struct\": {\"cell\": {\"cell\": ([u8;32])}}, \"my_clike_enum\": {\"cell\": {\"cell\": ([u8;32])}}, \"my_enum\": {\"cell\": {\"cell\": ([u8;32])}}, \"my_union\": {\"cell\": {\"cell\": ([u8;32])}}}",
"name": "RustStructures",
"namespace": "structures::normal",
"sub": [
{
"info": 7,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "my_tuple_struct",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 8,
"type": "(u8, u16)",
"name": "TupleStruct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
}
],
"sub": [
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 8,
"type": "(u8, u16)",
"name": "TupleStruct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
},
{
"info": 7,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "my_struct",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 7,
"type": "{\"first\": u8, \"seconds\": u16}",
"name": "Struct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "seconds"
}
]
}
],
"sub": [
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 7,
"type": "{\"first\": u8, \"seconds\": u16}",
"name": "Struct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "seconds"
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
},
{
"info": 7,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "my_clike_enum",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 2,
"type": "[\"FirstVariant\", \"SecondVariant\", \"ThirdVariant\"]",
"name": "ClikeEnum",
"namespace": "structures",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 5,
"name": "FirstVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 5,
"name": "SecondVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 42
},
"info": 5,
"name": "ThirdVariant",
"type": "Null"
}
]
}
],
"sub": [
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 2,
"type": "[\"FirstVariant\", \"SecondVariant\", \"ThirdVariant\"]",
"name": "ClikeEnum",
"namespace": "structures",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 5,
"name": "FirstVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 5,
"name": "SecondVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 42
},
"info": 5,
"name": "ThirdVariant",
"type": "Null"
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
},
{
"info": 7,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "my_enum",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 2,
"type": "{\"NoData\": Null, \"TupleVariant\": (u8, u16), \"StructVariant\": {\"first\": u8, \"second\": u16}}",
"name": "RustEnum",
"namespace": "structures",
"sub": [
{
"info": 5,
"name": "NoData",
"type": "Null"
},
{
"info": 8,
"name": "TupleVariant",
"type": "(u8, u16)",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
},
{
"info": 7,
"name": "StructVariant",
"type": "{\"first\": u8, \"second\": u16}",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
]
}
],
"sub": [
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 2,
"type": "{\"NoData\": Null, \"TupleVariant\": (u8, u16), \"StructVariant\": {\"first\": u8, \"second\": u16}}",
"name": "RustEnum",
"namespace": "structures",
"sub": [
{
"info": 5,
"name": "NoData",
"type": "Null"
},
{
"info": 8,
"name": "TupleVariant",
"type": "(u8, u16)",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
},
{
"info": 7,
"name": "StructVariant",
"type": "{\"first\": u8, \"second\": u16}",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
},
{
"info": 7,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "my_union",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 9,
"type": "{\"first\": u8, \"second\": u16}",
"name": "Union",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
],
"sub": [
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 9,
"type": "{\"first\": u8, \"second\": u16}",
"name": "Union",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
}
]
},
{
"info": 7,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "Value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 8,
"type": "(u8, u16)",
"name": "TupleStruct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
}
],
"sub": [
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 8,
"type": "(u8, u16)",
"name": "TupleStruct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
},
{
"info": 8,
"type": "(u8, u16)",
"name": "TupleStruct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
},
{
"info": 5,
"type": "u8"
},
{
"info": 5,
"type": "u16"
},
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "SyncCell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 8,
"type": "(u8, u16)",
"name": "TupleStruct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
},
{
"info": 8,
"type": "([u8;32])",
"name": "Key",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
},
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
}
},
{
"info": 7,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "Value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 7,
"type": "{\"first\": u8, \"seconds\": u16}",
"name": "Struct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "seconds"
}
]
}
],
"sub": [
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 7,
"type": "{\"first\": u8, \"seconds\": u16}",
"name": "Struct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "seconds"
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
},
{
"info": 7,
"type": "{\"first\": u8, \"seconds\": u16}",
"name": "Struct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "seconds"
}
]
},
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "SyncCell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 7,
"type": "{\"first\": u8, \"seconds\": u16}",
"name": "Struct",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "seconds"
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
},
{
"info": 7,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "Value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 2,
"type": "[\"FirstVariant\", \"SecondVariant\", \"ThirdVariant\"]",
"name": "ClikeEnum",
"namespace": "structures",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 5,
"name": "FirstVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 5,
"name": "SecondVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 42
},
"info": 5,
"name": "ThirdVariant",
"type": "Null"
}
]
}
],
"sub": [
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 2,
"type": "[\"FirstVariant\", \"SecondVariant\", \"ThirdVariant\"]",
"name": "ClikeEnum",
"namespace": "structures",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 5,
"name": "FirstVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 5,
"name": "SecondVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 42
},
"info": 5,
"name": "ThirdVariant",
"type": "Null"
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
},
{
"info": 2,
"type": "[\"FirstVariant\", \"SecondVariant\", \"ThirdVariant\"]",
"name": "ClikeEnum",
"namespace": "structures",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 5,
"name": "FirstVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 5,
"name": "SecondVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 42
},
"info": 5,
"name": "ThirdVariant",
"type": "Null"
}
]
},
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "SyncCell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 2,
"type": "[\"FirstVariant\", \"SecondVariant\", \"ThirdVariant\"]",
"name": "ClikeEnum",
"namespace": "structures",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 5,
"name": "FirstVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 1
},
"info": 5,
"name": "SecondVariant",
"type": "Null"
},
{
"ext": {
"discriminant": 42
},
"info": 5,
"name": "ThirdVariant",
"type": "Null"
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
},
{
"info": 7,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "Value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 2,
"type": "{\"NoData\": Null, \"TupleVariant\": (u8, u16), \"StructVariant\": {\"first\": u8, \"second\": u16}}",
"name": "RustEnum",
"namespace": "structures",
"sub": [
{
"info": 5,
"name": "NoData",
"type": "Null"
},
{
"info": 8,
"name": "TupleVariant",
"type": "(u8, u16)",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
},
{
"info": 7,
"name": "StructVariant",
"type": "{\"first\": u8, \"second\": u16}",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
]
}
],
"sub": [
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 2,
"type": "{\"NoData\": Null, \"TupleVariant\": (u8, u16), \"StructVariant\": {\"first\": u8, \"second\": u16}}",
"name": "RustEnum",
"namespace": "structures",
"sub": [
{
"info": 5,
"name": "NoData",
"type": "Null"
},
{
"info": 8,
"name": "TupleVariant",
"type": "(u8, u16)",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
},
{
"info": 7,
"name": "StructVariant",
"type": "{\"first\": u8, \"second\": u16}",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
},
{
"info": 2,
"type": "{\"NoData\": Null, \"TupleVariant\": (u8, u16), \"StructVariant\": {\"first\": u8, \"second\": u16}}",
"name": "RustEnum",
"namespace": "structures",
"sub": [
{
"info": 5,
"name": "NoData",
"type": "Null"
},
{
"info": 8,
"name": "TupleVariant",
"type": "(u8, u16)",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
},
{
"info": 7,
"name": "StructVariant",
"type": "{\"first\": u8, \"second\": u16}",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
]
},
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "SyncCell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 2,
"type": "{\"NoData\": Null, \"TupleVariant\": (u8, u16), \"StructVariant\": {\"first\": u8, \"second\": u16}}",
"name": "RustEnum",
"namespace": "structures",
"sub": [
{
"info": 5,
"name": "NoData",
"type": "Null"
},
{
"info": 8,
"name": "TupleVariant",
"type": "(u8, u16)",
"sub": [
{
"info": 5,
"type": "u8",
"index": 0
},
{
"info": 5,
"type": "u16",
"index": 1
}
]
},
{
"info": 7,
"name": "StructVariant",
"type": "{\"first\": u8, \"second\": u16}",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
},
{
"info": 7,
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
"name": "Value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 9,
"type": "{\"first\": u8, \"second\": u16}",
"name": "Union",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
],
"sub": [
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 9,
"type": "{\"first\": u8, \"second\": u16}",
"name": "Union",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]
},
{
"info": 9,
"type": "{\"first\": u8, \"second\": u16}",
"name": "Union",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
},
{
"info": 7,
"type": "{\"cell\": ([u8;32])}",
"name": "SyncCell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 9,
"type": "{\"first\": u8, \"second\": u16}",
"name": "Union",
"namespace": "structures",
"sub": [
{
"info": 5,
"type": "u8",
"name": "first"
},
{
"info": 5,
"type": "u16",
"name": "second"
}
]
}
],
"sub": [
{
"info": 8,
"type": "([u8;32])",
"name": "cell",
"namespace": "ink_core::storage::key",
"sub": [
{
"info": 11,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": ""
},
"sub": {
"info": 5,
"type": "u8"
},
"index": 0
}
]
}
]
}
]