Files
api/packages/api-contract/test/contracts/multisig_plain.json
T
Jaco GreeffandAndrew Jones 453dd9e49a Updated ABI definitions & parsing (#1662)
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* Adjust ContractAbi interface (empty rpc)

* linting

* Pull in Andrew's changes

* Cleanups

* Some more cleanups

* Update with v3 contracts

* Adjust with actual types

* Regenerate

* Update ABI parsing (#2695)

* Adjust ABI code

* Cleanup

* Merge non-code

* Type naming

* Simplify Base

* Rename 1

* rename 2

* Rename 3

* Simplify

* Add index to AbiMessage

* Pass actual message or index for call

* Rename param

* Simplify

* Expose call & exec

* s/call/read/

* Cleanup asserts

* AccountId as per spec

* displayName is path

* Update definitions

* Flatten ABIType into TypeDef

* Rewrite

* Fix tests

* Updates

Co-authored-by: Andrew Jones <ascjones@gmail.com>
2020-10-09 18:33:31 +02:00

1466 lines
36 KiB
JSON

{
"metadataVersion": "0.1.0",
"source": {
"hash": "0x3e6dbdd71e36888e06298b7b44d3c886cd4899267bffce0ac4d5795ee9d7ede5",
"language": "ink! 3.0.0",
"compiler": "rustc 1.48.0-nightly"
},
"contract": {
"name": "multisig_plain",
"version": "3.0.0",
"authors": [
"Parity Technologies <admin@parity.io>"
]
},
"spec": {
"constructors": [
{
"args": [
{
"name": "requirement",
"type": {
"displayName": [
"u32"
],
"id": 2
}
},
{
"name": "owners",
"type": {
"displayName": [
"Vec"
],
"id": 20
}
}
],
"docs": [
" The only constructor of the contract.",
"",
" A list of owners must be supplied and a number of how many of them must",
" confirm a transaction. Duplicate owners are silently dropped.",
"",
" # Panics",
"",
" If `requirement` violates our invariant."
],
"name": [
"new"
],
"selector": "0xd183512b"
}
],
"docs": [],
"events": [
{
"args": [
{
"docs": [
" The transaction that was confirmed."
],
"indexed": true,
"name": "transaction",
"type": {
"displayName": [
"TransactionId"
],
"id": 2
}
},
{
"docs": [
" The owner that sent the confirmation."
],
"indexed": true,
"name": "from",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
},
{
"docs": [
" The confirmation status after this confirmation was applied."
],
"indexed": true,
"name": "status",
"type": {
"displayName": [
"ConfirmationStatus"
],
"id": 22
}
}
],
"docs": [
" Emitted when an owner confirms a transaction."
],
"name": "Confirmation"
},
{
"args": [
{
"docs": [
" The transaction that was revoked."
],
"indexed": true,
"name": "transaction",
"type": {
"displayName": [
"TransactionId"
],
"id": 2
}
},
{
"docs": [
" The owner that sent the revokation."
],
"indexed": true,
"name": "from",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
}
],
"docs": [
" Emitted when an owner revoked a confirmation."
],
"name": "Revokation"
},
{
"args": [
{
"docs": [
" The transaction that was submitted."
],
"indexed": true,
"name": "transaction",
"type": {
"displayName": [
"TransactionId"
],
"id": 2
}
}
],
"docs": [
" Emitted when an owner submits a transaction."
],
"name": "Submission"
},
{
"args": [
{
"docs": [
" The transaction that was canceled."
],
"indexed": true,
"name": "transaction",
"type": {
"displayName": [
"TransactionId"
],
"id": 2
}
}
],
"docs": [
" Emitted when a transaction was canceled."
],
"name": "Cancelation"
},
{
"args": [
{
"docs": [
" The transaction that was executed."
],
"indexed": true,
"name": "transaction",
"type": {
"displayName": [
"TransactionId"
],
"id": 2
}
},
{
"docs": [
" Indicates whether the transaction executed successfully. If so the `Ok` value holds",
" the output in bytes. The Option is `None` when the transaction was executed through",
" `invoke_transaction` rather than `evaluate_transaction`."
],
"indexed": true,
"name": "result",
"type": {
"displayName": [
"Result"
],
"id": 25
}
}
],
"docs": [
" Emitted when a transaction was executed."
],
"name": "Execution"
},
{
"args": [
{
"docs": [
" The owner that was added."
],
"indexed": true,
"name": "owner",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
}
],
"docs": [
" Emitted when an owner is added to the wallet."
],
"name": "OwnerAddition"
},
{
"args": [
{
"docs": [
" The owner that was removed."
],
"indexed": true,
"name": "owner",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
}
],
"docs": [
" Emitted when an owner is removed from the wallet."
],
"name": "OwnerRemoval"
},
{
"args": [
{
"docs": [
" The new requirement value."
],
"indexed": false,
"name": "new_requirement",
"type": {
"displayName": [
"u32"
],
"id": 2
}
}
],
"docs": [
" Emitted when the requirement changed."
],
"name": "RequirementChange"
}
],
"messages": [
{
"args": [
{
"name": "new_owner",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
}
],
"docs": [
" Add a new owner to the contract.",
"",
" Only callable by the wallet itself.",
"",
" # Panics",
"",
" If the owner already exists.",
"",
" # Examples",
"",
" Since this message must be send by the wallet itself it has to be build as a",
" `Transaction` and dispatched through `submit_transaction` + `invoke_transaction`:",
" ```no_run",
" use ink_env::{DefaultEnvTypes as Env, AccountId, call::{CallParams, Selector}, test::CallData};",
" use multisig_plain::{Transaction, ConfirmationStatus};",
"",
" // address of an existing MultiSigPlain contract",
" let wallet_id: AccountId = [7u8; 32].into();",
"",
" // first create the transaction that adds `alice` through `add_owner`",
" let alice: AccountId = [1u8; 32].into();",
" let mut call = CallData::new(Selector::new([166, 229, 27, 154])); // add_owner",
" call.push_arg(&alice);",
" let transaction = Transaction {",
" callee: wallet_id,",
" selector: call.selector().to_bytes(),",
" input: call.params().to_owned(),",
" transferred_value: 0,",
" gas_limit: 0",
" };",
"",
" // submit the transaction for confirmation",
" let mut submit = CallParams::<Env, _, _>::eval(",
" wallet_id,",
" Selector::new([86, 244, 13, 223]) // submit_transaction",
" );",
" let (id, _): (u32, ConfirmationStatus) = submit.push_arg(&transaction)",
" .fire()",
" .expect(\"submit_transaction won't panic.\");",
"",
" // wait until all required owners have confirmed and then execute the transaction",
" let mut invoke = CallParams::<Env, _, ()>::invoke(",
" wallet_id,",
" Selector::new([185, 50, 225, 236]) // invoke_transaction",
" );",
" invoke.push_arg(&id).fire();",
" ```"
],
"mutates": true,
"name": [
"add_owner"
],
"payable": false,
"returnType": null,
"selector": "0xf3fcef36"
},
{
"args": [
{
"name": "owner",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
}
],
"docs": [
" Remove an owner from the contract.",
"",
" Only callable by the wallet itself. If by doing this the amount of owners",
" would be smaller than the requirement it is adjusted to be exactly the",
" number of owners.",
"",
" # Panics",
"",
" If `owner` is no owner of the wallet."
],
"mutates": true,
"name": [
"remove_owner"
],
"payable": false,
"returnType": null,
"selector": "0xe397f829"
},
{
"args": [
{
"name": "old_owner",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
},
{
"name": "new_owner",
"type": {
"displayName": [
"AccountId"
],
"id": 5
}
}
],
"docs": [
" Replace an owner from the contract with a new one.",
"",
" Only callable by the wallet itself.",
"",
" # Panics",
"",
" If `old_owner` is no owner or if `new_owner` already is one."
],
"mutates": true,
"name": [
"replace_owner"
],
"payable": false,
"returnType": null,
"selector": "0xab4bc64a"
},
{
"args": [
{
"name": "new_requirement",
"type": {
"displayName": [
"u32"
],
"id": 2
}
}
],
"docs": [
" Change the requirement to a new value.",
"",
" Only callable by the wallet itself.",
"",
" # Panics",
"",
" If the `new_requirement` violates our invariant."
],
"mutates": true,
"name": [
"change_requirement"
],
"payable": false,
"returnType": null,
"selector": "0x7347595d"
},
{
"args": [
{
"name": "transaction",
"type": {
"displayName": [
"Transaction"
],
"id": 14
}
}
],
"docs": [
" Add a new transaction candiate to the contract.",
"",
" This also confirms the transaction for the caller. This can be called by any owner."
],
"mutates": true,
"name": [
"submit_transaction"
],
"payable": false,
"returnType": {
"displayName": [],
"id": 21
},
"selector": "0x349db9e8"
},
{
"args": [
{
"name": "trans_id",
"type": {
"displayName": [
"TransactionId"
],
"id": 2
}
}
],
"docs": [
" Remove a transaction from the contract.",
" Only callable by the wallet itself.",
"",
" # Panics",
"",
" If `trans_id` is no valid transaction id."
],
"mutates": true,
"name": [
"cancel_transaction"
],
"payable": false,
"returnType": null,
"selector": "0xd31b7656"
},
{
"args": [
{
"name": "trans_id",
"type": {
"displayName": [
"TransactionId"
],
"id": 2
}
}
],
"docs": [
" Confirm a transaction for the sender that was submitted by any owner.",
"",
" This can be called by any owner.",
"",
" # Panics",
"",
" If `trans_id` is no valid transaction id."
],
"mutates": true,
"name": [
"confirm_transaction"
],
"payable": false,
"returnType": {
"displayName": [
"ConfirmationStatus"
],
"id": 22
},
"selector": "0xea923d30"
},
{
"args": [
{
"name": "trans_id",
"type": {
"displayName": [
"TransactionId"
],
"id": 2
}
}
],
"docs": [
" Revoke the senders confirmation.",
"",
" This can be called by any owner.",
"",
" # Panics",
"",
" If `trans_id` is no valid transaction id."
],
"mutates": true,
"name": [
"revoke_confirmation"
],
"payable": false,
"returnType": null,
"selector": "0x13ee3e97"
},
{
"args": [
{
"name": "trans_id",
"type": {
"displayName": [
"TransactionId"
],
"id": 2
}
}
],
"docs": [
" Invoke a confirmed execution without getting its output.",
"",
" Its return value indicates whether the called transaction was successful.",
" This can be called by anyone."
],
"mutates": true,
"name": [
"invoke_transaction"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"id": 23
},
"selector": "0x6131abbb"
},
{
"args": [
{
"name": "trans_id",
"type": {
"displayName": [
"TransactionId"
],
"id": 2
}
}
],
"docs": [
" Evaluate a confirmed execution and return its output as bytes.",
"",
" Its return value indicates whether the called transaction was successful and contains",
" its output when sucesful.",
" This can be called by anyone."
],
"mutates": true,
"name": [
"eval_transaction"
],
"payable": false,
"returnType": {
"displayName": [
"Result"
],
"id": 24
},
"selector": "0xe667c7ac"
}
]
},
"storage": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "header"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0100000000000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "len"
},
{
"layout": {
"array": {
"cells_per_elem": 1,
"layout": {
"cell": {
"key": "0x0100000001000000000000000000000000000000000000000000000000000000",
"ty": 3
}
},
"len": 4294967295,
"offset": "0x0200000000000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0200000001000000000000000000000000000000000000000000000000000000",
"ty": 9
}
},
"offset": "0x0100000001000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "confirmations"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0200000001000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "header"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0300000001000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "len"
},
{
"layout": {
"array": {
"cells_per_elem": 1,
"layout": {
"cell": {
"key": "0x0300000002000000000000000000000000000000000000000000000000000000",
"ty": 11
}
},
"len": 4294967295,
"offset": "0x0400000001000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0400000002000000000000000000000000000000000000000000000000000000",
"ty": 12
}
},
"offset": "0x0300000002000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "confirmation_count"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0400000002000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "header"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0500000002000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "len"
},
{
"layout": {
"array": {
"cells_per_elem": 1,
"layout": {
"cell": {
"key": "0x0500000003000000000000000000000000000000000000000000000000000000",
"ty": 13
}
},
"len": 4294967295,
"offset": "0x0600000002000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "transactions"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0500000003000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "len"
},
{
"layout": {
"array": {
"cells_per_elem": 1,
"layout": {
"cell": {
"key": "0x0500000004000000000000000000000000000000000000000000000000000000",
"ty": 5
}
},
"len": 4294967295,
"offset": "0x0600000003000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "owners"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0500000004000000000000000000000000000000000000000000000000000000",
"ty": 1
}
},
"name": "header"
},
{
"layout": {
"struct": {
"fields": [
{
"layout": {
"cell": {
"key": "0x0600000004000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "len"
},
{
"layout": {
"array": {
"cells_per_elem": 1,
"layout": {
"cell": {
"key": "0x0600000005000000000000000000000000000000000000000000000000000000",
"ty": 19
}
},
"len": 4294967295,
"offset": "0x0700000004000000000000000000000000000000000000000000000000000000"
}
},
"name": "elems"
}
]
}
},
"name": "entries"
}
]
}
},
"name": "keys"
},
{
"layout": {
"hash": {
"layout": {
"cell": {
"key": "0x0700000005000000000000000000000000000000000000000000000000000000",
"ty": 9
}
},
"offset": "0x0600000005000000000000000000000000000000000000000000000000000000",
"strategy": {
"hasher": "Blake2x256",
"postfix": "",
"prefix": "0x696e6b20686173686d6170"
}
}
},
"name": "values"
}
]
}
},
"name": "is_owner"
},
{
"layout": {
"cell": {
"key": "0x0700000005000000000000000000000000000000000000000000000000000000",
"ty": 2
}
},
"name": "requirement"
}
]
}
},
"types": [
{
"def": {
"composite": {
"fields": [
{
"name": "last_vacant",
"type": 2
},
{
"name": "len",
"type": 2
},
{
"name": "len_entries",
"type": 2
}
]
}
},
"path": [
"ink_storage",
"collections",
"stash",
"Header"
]
},
{
"def": {
"primitive": "u32"
}
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 8
}
],
"name": "Vacant"
},
{
"fields": [
{
"type": 4
}
],
"name": "Occupied"
}
]
}
},
"params": [
4
],
"path": [
"ink_storage",
"collections",
"stash",
"Entry"
]
},
{
"def": {
"tuple": [
2,
5
]
}
},
{
"def": {
"composite": {
"fields": [
{
"type": 6
}
]
}
},
"path": [
"ink_env",
"types",
"AccountId"
]
},
{
"def": {
"array": {
"len": 32,
"type": 7
}
}
},
{
"def": {
"primitive": "u8"
}
},
{
"def": {
"composite": {
"fields": [
{
"name": "next",
"type": 2
},
{
"name": "prev",
"type": 2
}
]
}
},
"path": [
"ink_storage",
"collections",
"stash",
"VacantEntry"
]
},
{
"def": {
"composite": {
"fields": [
{
"name": "value",
"type": 10
},
{
"name": "key_index",
"type": 2
}
]
}
},
"params": [
10
],
"path": [
"ink_storage",
"collections",
"hashmap",
"ValueEntry"
]
},
{
"def": {
"tuple": []
}
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 8
}
],
"name": "Vacant"
},
{
"fields": [
{
"type": 2
}
],
"name": "Occupied"
}
]
}
},
"params": [
2
],
"path": [
"ink_storage",
"collections",
"stash",
"Entry"
]
},
{
"def": {
"composite": {
"fields": [
{
"name": "value",
"type": 2
},
{
"name": "key_index",
"type": 2
}
]
}
},
"params": [
2
],
"path": [
"ink_storage",
"collections",
"hashmap",
"ValueEntry"
]
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 8
}
],
"name": "Vacant"
},
{
"fields": [
{
"type": 14
}
],
"name": "Occupied"
}
]
}
},
"params": [
14
],
"path": [
"ink_storage",
"collections",
"stash",
"Entry"
]
},
{
"def": {
"composite": {
"fields": [
{
"name": "callee",
"type": 5
},
{
"name": "selector",
"type": 15
},
{
"name": "input",
"type": 16
},
{
"name": "transferred_value",
"type": 17
},
{
"name": "gas_limit",
"type": 18
}
]
}
},
"path": [
"multisig_plain",
"multisig_plain",
"Transaction"
]
},
{
"def": {
"array": {
"len": 4,
"type": 7
}
}
},
{
"def": {
"sequence": {
"type": 7
}
}
},
{
"def": {
"primitive": "u128"
}
},
{
"def": {
"primitive": "u64"
}
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 8
}
],
"name": "Vacant"
},
{
"fields": [
{
"type": 5
}
],
"name": "Occupied"
}
]
}
},
"params": [
5
],
"path": [
"ink_storage",
"collections",
"stash",
"Entry"
]
},
{
"def": {
"sequence": {
"type": 5
}
}
},
{
"def": {
"tuple": [
2,
22
]
}
},
{
"def": {
"variant": {
"variants": [
{
"name": "Confirmed"
},
{
"fields": [
{
"type": 2
}
],
"name": "ConfirmationsNeeded"
}
]
}
},
"path": [
"multisig_plain",
"multisig_plain",
"ConfirmationStatus"
]
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 10
}
],
"name": "Ok"
},
{
"fields": [
{
"type": 10
}
],
"name": "Err"
}
]
}
},
"params": [
10,
10
],
"path": [
"Result"
]
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 16
}
],
"name": "Ok"
},
{
"fields": [
{
"type": 10
}
],
"name": "Err"
}
]
}
},
"params": [
16,
10
],
"path": [
"Result"
]
},
{
"def": {
"variant": {
"variants": [
{
"fields": [
{
"type": 26
}
],
"name": "Ok"
},
{
"fields": [
{
"type": 10
}
],
"name": "Err"
}
]
}
},
"params": [
26,
10
],
"path": [
"Result"
]
},
{
"def": {
"variant": {
"variants": [
{
"name": "None"
},
{
"fields": [
{
"type": 16
}
],
"name": "Some"
}
]
}
},
"params": [
16
],
"path": [
"Option"
]
}
]
}