mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31:10 +00:00
new state api state_getKeys to expose storage keys (#1380)
This commit is contained in:
@@ -265,6 +265,12 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
|
||||
&self.backend
|
||||
}
|
||||
|
||||
/// Return storage entry keys in state in a block of given hash with given prefix.
|
||||
pub fn storage_keys(&self, id: &BlockId<Block>, key_prefix: &StorageKey) -> error::Result<Vec<StorageKey>> {
|
||||
let keys = self.state_at(id)?.keys(&key_prefix.0).into_iter().map(StorageKey).collect();
|
||||
Ok(keys)
|
||||
}
|
||||
|
||||
/// Return single storage entry of contract under given address in state in a block of given hash.
|
||||
pub fn storage(&self, id: &BlockId<Block>, key: &StorageKey) -> error::Result<Option<StorageData>> {
|
||||
Ok(self.state_at(id)?
|
||||
|
||||
@@ -279,6 +279,11 @@ where
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
fn keys(&self, _prefix: &Vec<u8>) -> Vec<Vec<u8>> {
|
||||
// whole state is not available on light node
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
fn try_into_trie_backend(self) -> Option<TrieBackend<Self::TrieBackendStorage, H>> {
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user