Contract API for Rx/promises (#1520)

* wip with rxjs/promise

* add outcome process

* contract call decoding solved

* restore messages as dict, cleanup

* linting

* linting

* type fixes
This commit is contained in:
Keith Ingram
2019-10-31 19:47:14 +02:00
committed by GitHub
parent 64bc3fbffa
commit cf01c41b33
39 changed files with 1080 additions and 386 deletions
@@ -0,0 +1,188 @@
[
{
"info": 9,
"type": "{ \"value\": \"{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }<u32>\"} }",
"sub": [
{
"info": 9,
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
"sub": [
{
"info": 9,
"type": "{ \"cell\": \"([u8;32])\"} }",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": "u8"
},
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 6,
"type": "u32"
}
]
}
],
"name": "value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 6,
"type": "u32"
}
]
}
],
"name": "Incrementer",
"namespace": "incrementer::normal"
},
{
"info": 9,
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
"sub": [
{
"info": 9,
"type": "{ \"cell\": \"([u8;32])\"} }",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": "u8"
},
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "cell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 6,
"type": "u32"
}
]
}
],
"name": "Value",
"namespace": "ink_core::storage::value",
"params": [
{
"info": 6,
"type": "u32"
}
]
},
{
"info": 6,
"type": "u32"
},
{
"info": 9,
"type": "{ \"cell\": \"([u8;32])\"} }",
"sub": [
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": "u8"
},
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "cell",
"namespace": "ink_core::storage::key"
}
],
"name": "SyncCell",
"namespace": "ink_core::storage::cell::sync_cell",
"params": [
{
"info": 6,
"type": "u32"
}
]
},
{
"info": 10,
"type": "([u8;32])",
"sub": [
{
"info": 12,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": "u8"
},
"sub": {
"info": 6,
"type": "u8"
},
"index": 0
}
],
"name": "Key",
"namespace": "ink_core::storage::key"
},
{
"info": 12,
"type": "[u8;32]",
"ext": {
"length": 32,
"type": "u8"
},
"sub": {
"info": 6,
"type": "u8"
}
},
{
"info": 6,
"type": "u8"
},
{
"info": 6,
"type": "bool"
}
]
@@ -1 +0,0 @@
{"name":"Incrementer","deploy":{"args":[{"name":"init_value","type":"u32"}]},"messages":[{"name":"inc","selector":257544423,"mutates":true,"args":[{"name":"by","type":"u32"}],"return_type":null},{"name":"get","selector":4266279973,"mutates":false,"args":[],"return_type":"u32"},{"name":"compare","selector":363906316,"mutates":false,"args":[{"name":"with","type":"u32"}],"return_type":"bool"}]}
@@ -0,0 +1,233 @@
{
"registry": {
"strings": [
"Incrementer",
"incrementer",
"normal",
"value",
"Value",
"ink_core",
"storage",
"cell",
"SyncCell",
"sync_cell",
"Key",
"key",
"on_deploy",
"init_value",
"u32",
"inc",
"by",
"get",
"compare",
"with",
"bool"
],
"types": [
{
"id": {
"custom.name": 1,
"custom.namespace": [
2,
3
],
"custom.params": []
},
"def": {
"struct.fields": [
{
"name": 4,
"type": 2
}
]
}
},
{
"id": {
"custom.name": 5,
"custom.namespace": [
6,
7,
4
],
"custom.params": [
3
]
},
"def": {
"struct.fields": [
{
"name": 8,
"type": 4
}
]
}
},
{
"id": "u32",
"def": "builtin"
},
{
"id": {
"custom.name": 9,
"custom.namespace": [
6,
7,
8,
10
],
"custom.params": [
3
]
},
"def": {
"struct.fields": [
{
"name": 8,
"type": 5
}
]
}
},
{
"id": {
"custom.name": 11,
"custom.namespace": [
6,
7,
12
],
"custom.params": []
},
"def": {
"tuple_struct.types": [
6
]
}
},
{
"id": {
"array.len": 32,
"array.type": 7
},
"def": "builtin"
},
{
"id": "u8",
"def": "builtin"
},
{
"id": "bool",
"def": "builtin"
}
]
},
"storage": {
"struct.type": 1,
"struct.fields": [
{
"name": 4,
"layout": {
"struct.type": 2,
"struct.fields": [
{
"name": 8,
"layout": {
"range.offset": "0x0000000000000000000000000000000000000000000000000000000000000000",
"range.len": 1,
"range.elem_type": 3
}
}
]
}
}
]
},
"contract": {
"name": 1,
"constructors": [
{
"name": 13,
"selector": "[\"0x00\",\"0x00\",\"0x00\",\"0x00\"]",
"args": [
{
"name": 14,
"type": {
"ty": 3,
"display_name": [
15
]
}
}
],
"docs": [
"Initializes the value to the initial value."
]
}
],
"messages": [
{
"name": 16,
"selector": "[\"0x0F\",\"0x59\",\"0xD0\",\"0xE7\"]",
"mutates": true,
"args": [
{
"name": 17,
"type": {
"ty": 3,
"display_name": [
15
]
}
}
],
"return_type": null,
"docs": [
"Flips the current state of our smart contract."
]
},
{
"name": 18,
"selector": "[\"0xFE\",\"0x4A\",\"0x44\",\"0x25\"]",
"mutates": false,
"args": [],
"return_type": {
"ty": 3,
"display_name": [
15
]
},
"docs": [
"Returns the current state."
]
},
{
"name": 19,
"selector": "[\"0x15\",\"0xB0\",\"0xC5\",\"0x0C\"]",
"mutates": false,
"args": [
{
"name": 20,
"type": {
"ty": 3,
"display_name": [
15
]
}
}
],
"return_type": {
"ty": 8,
"display_name": [
21
]
},
"docs": [
"Returns `true` if the internal value is greater than or equal to the provided value."
]
}
],
"events": [],
"docs": []
}
}