Create api-contract (baseline for useful interactions) (#1007)

* Create api-contract (baseline for useful interactions)

* Add CHANGELOG entry (breaking)
This commit is contained in:
Jaco Greeff
2019-06-14 13:48:53 +02:00
committed by GitHub
parent 6e7a126f4d
commit 4cba24c134
25 changed files with 614 additions and 312 deletions
+142
View File
@@ -0,0 +1,142 @@
{
"name": "Types",
"deploy": {
"args": []
},
"messages": [
{
"name": "primitive",
"selector": 1111,
"mutates": true,
"args": [
{
"name": "bool",
"type": "bool"
},
{
"name": "u32",
"type": "u32"
}
],
"return_type": "bool"
},
{
"name": "vector",
"selector": 2222,
"mutates": false,
"args": [
{
"name": "Vec_u8",
"type": {
"Vec<T>": {
"T": "u8"
}
}
},
{
"name": "Vec_u32",
"type": {
"Vec<T>": {
"T": "u32"
}
}
}
],
"return_type": {
"Vec<T>": {
"T": "bool"
}
}
},
{
"name": "vector_fixed",
"selector": 3333,
"mutates": false,
"args": [
{
"name": "vec_u8_length_32",
"type": {
"[T;n]": {
"T": "u8",
"n": 32
}
}
}
],
"return_type": {
"[T;n]": {
"T": "u32",
"n": 8
}
}
},
{
"name": "option",
"selector": 4444,
"mutates": false,
"args": [
{
"name": "Option_u32",
"type": {
"Option<T>": {
"T": "u32"
}
}
}
],
"return_type": {
"Option<T>": {
"T": "bool"
}
}
},
{
"name": "tuple",
"selector": 5555,
"mutates": false,
"args": [
{
"name": "Tuple_u32_u64",
"type": ["u32", "u64"]
}
],
"return_type": ["bool"]
},
{
"name": "result",
"selector": 666,
"mutates": false,
"args": [],
"return_type": {
"Result<T,E>": {
"T": "u32",
"E": "u32"
}
}
},
{
"name": "nested",
"selector": 987654321,
"mutates": false,
"args": [
{
"name": "option_vec",
"type": {
"Option<T>": {
"T": {
"Vec<T>": {
"T": "u32"
}
}
}
}
}
],
"return_type": {
"Vec<T>": {
"T": ["u32", "u64"]
}
}
}
]
}
@@ -0,0 +1,100 @@
{
"name": "Erc20",
"deploy": {
"args": [
{
"name": "init_value",
"type": "Balance"
}
]
},
"messages": [
{
"name": "total_supply",
"selector": 949181842,
"mutates": false,
"args": [],
"return_type": "Balance"
},
{
"name": "balance_of",
"selector": 3827153702,
"mutates": false,
"args": [
{
"name": "owner",
"type": "Address"
}
],
"return_type": "Balance"
},
{
"name": "allowance",
"selector": 3057219184,
"mutates": false,
"args": [
{
"name": "owner",
"type": "Address"
},
{
"name": "spender",
"type": "Address"
}
],
"return_type": "Balance"
},
{
"name": "transfer",
"selector": 3374842663,
"mutates": true,
"args": [
{
"name": "to",
"type": "Address"
},
{
"name": "value",
"type": "Balance"
}
],
"return_type": "bool"
},
{
"name": "approve",
"selector": 431186122,
"mutates": true,
"args": [
{
"name": "spender",
"type": "Address"
},
{
"name": "value",
"type": "Balance"
}
],
"return_type": "bool"
},
{
"name": "transfer_from",
"selector": 197482595,
"mutates": true,
"args": [
{
"name": "from",
"type": "Address"
},
{
"name": "to",
"type": "Address"
},
{
"name": "value",
"type": "Balance"
}
],
"return_type": "bool"
}
]
}
Binary file not shown.
@@ -0,0 +1,22 @@
{
"name": "Flipper",
"deploy": {
"args": []
},
"messages": [
{
"name": "flip",
"selector": 970692492,
"mutates": true,
"args": [],
"return_type": null
},
{
"name": "get",
"selector": 4266279973,
"mutates": false,
"args": [],
"return_type": "bool"
}
]
}
@@ -0,0 +1,44 @@
{
"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,102 @@
{
"name": "SharedVec",
"deploy": {
"args": []
},
"messages": [
{
"name": "push",
"selector": 865577567,
"mutates": true,
"args": [
{
"name": "value",
"type": "i32"
}
],
"return_type": {
"Result<T,E>": {
"T": [],
"E": "u32"
}
}
},
{
"name": "register",
"selector": 572030971,
"mutates": true,
"args": [
{
"name": "mutator",
"type": "AccountId"
},
{
"name": "begin",
"type": {
"Option<T>": {
"T": "u32"
}
}
},
{
"name": "end",
"type": {
"Option<T>": {
"T": "u32"
}
}
}
],
"return_type": {
"Result<T,E>": {
"T": [],
"E": "u32"
}
}
},
{
"name": "set",
"selector": 2028185770,
"mutates": true,
"args": [
{
"name": "at",
"type": "u32"
},
{
"name": "to",
"type": "i32"
}
],
"return_type": {
"Result<T,E>": {
"T": "i32",
"E": "u32"
}
}
},
{
"name": "get",
"selector": 4266279973,
"mutates": false,
"args": [
{
"name": "at",
"type": "u32"
}
],
"return_type": {
"Option<T>": {
"T": "i32"
}
}
},
{
"name": "len",
"selector": 1403873684,
"mutates": false,
"args": [],
"return_type": "u32"
}
]
}