use crate::state::{Error, ReadProof};
use jsonrpsee::proc_macros::rpc;
use sp_core::storage::{PrefixedStorageKey, StorageData, StorageKey};
#[rpc(client, server)]
pub trait ChildStateApi<Hash> {
#[method(name = "childstate_getKeys", blocking)]
#[deprecated(since = "2.0.0", note = "Please use `getKeysPaged` with proper paging support")]
fn storage_keys(
&self,
child_storage_key: PrefixedStorageKey,
prefix: StorageKey,
hash: Option<Hash>,
) -> Result<Vec<StorageKey>, Error>;
#[method(name = "childstate_getKeysPaged", aliases = ["childstate_getKeysPagedAt"], blocking)]
fn storage_keys_paged(
&self,
child_storage_key: PrefixedStorageKey,
prefix: Option<StorageKey>,
count: u32,
start_key: Option<StorageKey>,
hash: Option<Hash>,
) -> Result<Vec<StorageKey>, Error>;
#[method(name = "childstate_getStorage", blocking)]
fn storage(
&self,
child_storage_key: PrefixedStorageKey,
key: StorageKey,
hash: Option<Hash>,
) -> Result<Option<StorageData>, Error>;
#[method(name = "childstate_getStorageEntries", blocking)]
fn storage_entries(
&self,
child_storage_key: PrefixedStorageKey,
keys: Vec<StorageKey>,
hash: Option<Hash>,
) -> Result<Vec<Option<StorageData>>, Error>;
#[method(name = "childstate_getStorageHash", blocking)]
fn storage_hash(
&self,
child_storage_key: PrefixedStorageKey,
key: StorageKey,
hash: Option<Hash>,
) -> Result<Option<Hash>, Error>;
#[method(name = "childstate_getStorageSize", blocking)]
fn storage_size(
&self,
child_storage_key: PrefixedStorageKey,
key: StorageKey,
hash: Option<Hash>,
) -> Result<Option<u64>, Error>;
#[method(name = "state_getChildReadProof", blocking)]
fn read_child_proof(
&self,
child_storage_key: PrefixedStorageKey,
keys: Vec<StorageKey>,
hash: Option<Hash>,
) -> Result<ReadProof<Hash>, Error>;
}