Implements json_metadata RPC call (#692)

* Adds `impl_json_metadata!` for generating all metadata of a runtime

* Adds `json_metadata` RPC call

* Adds simple test for the `json_metadata` RPC call

* Implements json metadata in the demo runtime

* Fix indent

* Adds missing copyright headers

* Dispatch json metadata renamings and improvements

* Replaces `format!` & `String` with `Vec<JSONMetadata`

* Implements `Encode` and `Decode` for JSONMetadata

* Make `impl_json_metadata!` compileable on `no_std`

* Adapt the client to decode the correct type for `json_metadata`

* Fixes compile error and warning

* Whitespace
This commit is contained in:
Bastian Köcher
2018-09-10 18:34:17 +02:00
committed by Gav Wood
parent fea750511e
commit ba23d033a1
13 changed files with 470 additions and 10 deletions
+13
View File
@@ -270,9 +270,22 @@ pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Index, Call>;
pub type Executive = executive::Executive<Runtime, Block, Balances, Balances,
(((((((), Treasury), Council), Democracy), Staking), Session), Timestamp)>;
impl_json_metadata!(
for Runtime with modules
system::Module with Storage,
balances::Module with Storage,
consensus::Module with Storage,
timestamp::Module with Storage,
session::Module with Storage,
staking::Module with Storage,
democracy::Module with Storage,
council::Module with Storage
);
pub mod api {
impl_stubs!(
version => |()| super::VERSION,
json_metadata => |()| super::Runtime::json_metadata(),
authorities => |()| super::Consensus::authorities(),
initialise_block => |header| super::Executive::initialise_block(&header),
apply_extrinsic => |extrinsic| super::Executive::apply_extrinsic(extrinsic),