Files
api/packages/api-contract/test/contracts/Erc20.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

1008 lines
19 KiB
JSON

{
"registry": {
"strings": [
"Erc20",
"erc20",
"normal",
"total_supply",
"Value",
"ink_core",
"storage",
"value",
"cell",
"SyncCell",
"sync_cell",
"Key",
"key",
"balances",
"HashMap",
"collections",
"hash_map",
"impls",
"AccountId",
"env",
"srml",
"types",
"len",
"entries",
"SyncChunk",
"chunk",
"sync_chunk",
"Entry",
"Occupied",
"OccupiedEntry",
"val",
"Removed",
"cells_key",
"allowances",
"on_deploy",
"init_value",
"Balance",
"balance_of",
"owner",
"allowance",
"spender",
"transfer",
"to",
"bool",
"approve",
"transfer_from",
"from",
"Approval",
"Transfer",
"Option",
"None",
"Some"
],
"types": [
{
"id": {
"custom.name": 1,
"custom.namespace": [
2,
3
],
"custom.params": []
},
"def": {
"struct.fields": [
{
"name": 4,
"type": 2
},
{
"name": 14,
"type": 8
},
{
"name": 34,
"type": 16
}
]
}
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
8
],
"custom.params": [
3
]
},
"def": {
"struct.fields": [
{
"name": 9,
"type": 4
}
]
}
},
{
"id": "u128",
"def": "builtin"
},
{
"id": {
"custom.name": 10,
"custom.namespace": [
6,
7,
9,
11
],
"custom.params": [
3
]
},
"def": {
"struct.fields": [
{
"name": 9,
"type": 5
}
]
}
},
{
"id": {
"custom.name": 12,
"custom.namespace": [
6,
7,
13
],
"custom.params": []
},
"def": {
"tuple_struct.types": [
6
]
}
},
{
"id": {
"array.len": 32,
"array.type": 7
},
"def": "builtin"
},
{
"id": "u8",
"def": "builtin"
},
{
"id": {
"custom.name": 15,
"custom.namespace": [
6,
7,
16,
17,
18
],
"custom.params": [
9,
3
]
},
"def": {
"struct.fields": [
{
"name": 23,
"type": 10
},
{
"name": 24,
"type": 13
}
]
}
},
{
"id": {
"custom.name": 19,
"custom.namespace": [
6,
20,
21,
22
],
"custom.params": []
},
"def": {
"tuple_struct.types": [
6
]
}
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
8
],
"custom.params": [
11
]
},
"def": {
"struct.fields": [
{
"name": 9,
"type": 12
}
]
}
},
{
"id": "u32",
"def": "builtin"
},
{
"id": {
"custom.name": 10,
"custom.namespace": [
6,
7,
9,
11
],
"custom.params": [
11
]
},
"def": {
"struct.fields": [
{
"name": 9,
"type": 5
}
]
}
},
{
"id": {
"custom.name": 25,
"custom.namespace": [
6,
7,
26,
27,
26
],
"custom.params": [
14
]
},
"def": {
"struct.fields": [
{
"name": 33,
"type": 5
}
]
}
},
{
"id": {
"custom.name": 28,
"custom.namespace": [
6,
7,
16,
17,
18
],
"custom.params": [
9,
3
]
},
"def": {
"enum.variants": [
{
"tuple_struct_variant.name": 29,
"tuple_struct_variant.types": [
15
]
},
{
"unit_variant.name": 32
}
]
}
},
{
"id": {
"custom.name": 30,
"custom.namespace": [
6,
7,
16,
17,
18
],
"custom.params": [
9,
3
]
},
"def": {
"struct.fields": [
{
"name": 13,
"type": 9
},
{
"name": 31,
"type": 3
}
]
}
},
{
"id": {
"custom.name": 15,
"custom.namespace": [
6,
7,
16,
17,
18
],
"custom.params": [
17,
3
]
},
"def": {
"struct.fields": [
{
"name": 23,
"type": 10
},
{
"name": 24,
"type": 18
}
]
}
},
{
"id": [
9,
9
],
"def": "builtin"
},
{
"id": {
"custom.name": 25,
"custom.namespace": [
6,
7,
26,
27,
26
],
"custom.params": [
19
]
},
"def": {
"struct.fields": [
{
"name": 33,
"type": 5
}
]
}
},
{
"id": {
"custom.name": 28,
"custom.namespace": [
6,
7,
16,
17,
18
],
"custom.params": [
17,
3
]
},
"def": {
"enum.variants": [
{
"tuple_struct_variant.name": 29,
"tuple_struct_variant.types": [
20
]
},
{
"unit_variant.name": 32
}
]
}
},
{
"id": {
"custom.name": 30,
"custom.namespace": [
6,
7,
16,
17,
18
],
"custom.params": [
17,
3
]
},
"def": {
"struct.fields": [
{
"name": 13,
"type": 17
},
{
"name": 31,
"type": 3
}
]
}
},
{
"id": "bool",
"def": "builtin"
},
{
"id": {
"custom.name": 50,
"custom.namespace": [],
"custom.params": [
9
]
},
"def": {
"enum.variants": [
{
"unit_variant.name": 51
},
{
"tuple_struct_variant.name": 52,
"tuple_struct_variant.types": [
9
]
}
]
}
}
]
},
"storage": {
"struct.type": 1,
"struct.fields": [
{
"name": 4,
"layout": {
"struct.type": 2,
"struct.fields": [
{
"name": 9,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"range.len": 1,
"range.elem_type": 3
}
}
]
}
},
{
"name": 14,
"layout": {
"struct.type": 8,
"struct.fields": [
{
"name": 23,
"layout": {
"struct.type": 10,
"struct.fields": [
{
"name": 9,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
"range.len": 1,
"range.elem_type": 11
}
}
]
}
},
{
"name": 24,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
"range.len": 4294967295,
"range.elem_type": 14
}
}
]
}
},
{
"name": 34,
"layout": {
"struct.type": 16,
"struct.fields": [
{
"name": 23,
"layout": {
"struct.type": 10,
"struct.fields": [
{
"name": 9,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
1
],
"range.len": 1,
"range.elem_type": 11
}
}
]
}
},
{
"name": 24,
"layout": {
"range.offset": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
2
],
"range.len": 4294967295,
"range.elem_type": 19
}
}
]
}
}
]
},
"contract": {
"name": 1,
"constructors": [
{
"name": 35,
"selector": 0,
"args": [
{
"name": 36,
"type": {
"ty": 3,
"display_name": [
37
]
}
}
],
"docs": []
}
],
"messages": [
{
"name": 4,
"selector": 949181842,
"mutates": false,
"args": [],
"return_type": {
"ty": 3,
"display_name": [
37
]
},
"docs": [
"Returns the total number of tokens in existence."
]
},
{
"name": 38,
"selector": 3827153702,
"mutates": false,
"args": [
{
"name": 39,
"type": {
"ty": 9,
"display_name": [
19
]
}
}
],
"return_type": {
"ty": 3,
"display_name": [
37
]
},
"docs": [
"Returns the balance of the given AccountId."
]
},
{
"name": 40,
"selector": 3057219184,
"mutates": false,
"args": [
{
"name": 39,
"type": {
"ty": 9,
"display_name": [
19
]
}
},
{
"name": 41,
"type": {
"ty": 9,
"display_name": [
19
]
}
}
],
"return_type": {
"ty": 3,
"display_name": [
37
]
},
"docs": [
"Returns the amount of tokens that an owner allowed to a spender."
]
},
{
"name": 42,
"selector": 3374842663,
"mutates": true,
"args": [
{
"name": 43,
"type": {
"ty": 9,
"display_name": [
19
]
}
},
{
"name": 8,
"type": {
"ty": 3,
"display_name": [
37
]
}
}
],
"return_type": {
"ty": 21,
"display_name": [
44
]
},
"docs": [
"Transfers token from the sender to the `to` AccountId."
]
},
{
"name": 45,
"selector": 431186122,
"mutates": true,
"args": [
{
"name": 41,
"type": {
"ty": 9,
"display_name": [
19
]
}
},
{
"name": 8,
"type": {
"ty": 3,
"display_name": [
37
]
}
}
],
"return_type": {
"ty": 21,
"display_name": [
44
]
},
"docs": [
"Approve the passed AccountId to spend the specified amount of tokens",
"on the behalf of the message\\'s sender."
]
},
{
"name": 46,
"selector": 197482595,
"mutates": true,
"args": [
{
"name": 47,
"type": {
"ty": 9,
"display_name": [
19
]
}
},
{
"name": 43,
"type": {
"ty": 9,
"display_name": [
19
]
}
},
{
"name": 8,
"type": {
"ty": 3,
"display_name": [
37
]
}
}
],
"return_type": {
"ty": 21,
"display_name": [
44
]
},
"docs": [
"Transfer tokens from one AccountId to another."
]
}
],
"events": [
{
"name": 48,
"args": [
{
"name": 39,
"indexed": false,
"type": {
"ty": 9,
"display_name": [
19
]
}
},
{
"name": 41,
"indexed": false,
"type": {
"ty": 9,
"display_name": [
19
]
}
},
{
"name": 8,
"indexed": false,
"type": {
"ty": 3,
"display_name": [
37
]
}
}
],
"docs": []
},
{
"name": 49,
"args": [
{
"name": 47,
"indexed": false,
"type": {
"ty": 22,
"display_name": [
50
]
}
},
{
"name": 43,
"indexed": false,
"type": {
"ty": 22,
"display_name": [
50
]
}
},
{
"name": 8,
"indexed": false,
"type": {
"ty": 3,
"display_name": [
37
]
}
}
],
"docs": []
}
],
"docs": []
}
}