substrate_api_client/
lib.rs

1/*
2   Copyright 2019 Supercomputing Systems AG
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8	   http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15
16*/
17#![cfg_attr(not(feature = "std"), no_std)]
18
19extern crate alloc;
20
21use sp_crypto_hashing::twox_128;
22use sp_storage::StorageKey;
23
24pub use ac_compose_macros;
25pub use ac_node_api;
26pub use ac_primitives;
27pub use api::*; // Re-export everything
28
29pub mod api;
30pub mod extrinsic;
31pub mod rpc;
32
33/// Returns the concatenated 128 bit hash of the given module and specific storage key
34/// as a full Substrate StorageKey.
35pub fn storage_key(module: &str, storage_key_name: &str) -> StorageKey {
36	let mut key = twox_128(module.as_bytes()).to_vec();
37	key.extend(twox_128(storage_key_name.as_bytes()));
38	StorageKey(key)
39}