Macro subrpcer::impl_apis

source ·
macro_rules! impl_apis {
    {
		$prefix:ident {
			$(
				$method:ident {
					params: [
						$(
							$param:ident
						),*
					],
					opt_params: [
						$(
							$opt_param:ident
						),*
					]
				}
			)+
		}
	} => { ... };
}
Expand description

Define a group of APIs.

Require serde and serde_json as the dependencies.

§Example

impl_apis! {
	state {
		call { params: [name, bytes], opt_params: [hash] }
		get_keys { params: [prefix], opt_params: [hash] }
		get_metadata { params: [], opt_params: [hash] }
		get_pairs { params: [prefix], opt_params: [hash] }
		get_read_proof { params: [keys], opt_params: [hash] }
		get_runtime_version { params: [], opt_params: [hash] }
		get_storage { params: [key], opt_params: [hash] }
		get_storage_hash { params: [key], opt_params: [hash] }
		get_storage_size { params: [key], opt_params: [hash] }
		query_storage { params: [keys, block], opt_params: [hash] }
		query_storage_at { params: [keys], opt_params: [at] }
		subscribe_runtime_version { params: [], opt_params: [] }
		subscribe_storage { params: [], opt_params: [keys] }
		trace_block { params: [block], opt_params: [targets, storage_keys, methods] }
		unsubscribe_runtime_version { params: [subscription_id], opt_params: [] }
		unsubscribe_storage { params: [subscription_id], opt_params: [] }
	}
}