sc_rpc_api/child_state/
mod.rs1use crate::state::{Error, ReadProof};
21use jsonrpsee::proc_macros::rpc;
22use sp_core::storage::{PrefixedStorageKey, StorageData, StorageKey};
23
24#[rpc(client, server)]
29pub trait ChildStateApi<Hash> {
30 #[method(name = "childstate_getKeys", blocking)]
32 #[deprecated(since = "2.0.0", note = "Please use `getKeysPaged` with proper paging support")]
33 fn storage_keys(
34 &self,
35 child_storage_key: PrefixedStorageKey,
36 prefix: StorageKey,
37 hash: Option<Hash>,
38 ) -> Result<Vec<StorageKey>, Error>;
39
40 #[method(name = "childstate_getKeysPaged", aliases = ["childstate_getKeysPagedAt"], blocking)]
44 fn storage_keys_paged(
45 &self,
46 child_storage_key: PrefixedStorageKey,
47 prefix: Option<StorageKey>,
48 count: u32,
49 start_key: Option<StorageKey>,
50 hash: Option<Hash>,
51 ) -> Result<Vec<StorageKey>, Error>;
52
53 #[method(name = "childstate_getStorage", blocking)]
55 fn storage(
56 &self,
57 child_storage_key: PrefixedStorageKey,
58 key: StorageKey,
59 hash: Option<Hash>,
60 ) -> Result<Option<StorageData>, Error>;
61
62 #[method(name = "childstate_getStorageEntries", blocking)]
64 fn storage_entries(
65 &self,
66 child_storage_key: PrefixedStorageKey,
67 keys: Vec<StorageKey>,
68 hash: Option<Hash>,
69 ) -> Result<Vec<Option<StorageData>>, Error>;
70
71 #[method(name = "childstate_getStorageHash", blocking)]
73 fn storage_hash(
74 &self,
75 child_storage_key: PrefixedStorageKey,
76 key: StorageKey,
77 hash: Option<Hash>,
78 ) -> Result<Option<Hash>, Error>;
79
80 #[method(name = "childstate_getStorageSize", blocking)]
82 fn storage_size(
83 &self,
84 child_storage_key: PrefixedStorageKey,
85 key: StorageKey,
86 hash: Option<Hash>,
87 ) -> Result<Option<u64>, Error>;
88
89 #[method(name = "state_getChildReadProof", blocking)]
91 fn read_child_proof(
92 &self,
93 child_storage_key: PrefixedStorageKey,
94 keys: Vec<StorageKey>,
95 hash: Option<Hash>,
96 ) -> Result<ReadProof<Hash>, Error>;
97}