Add block-centric Storage API (#774)

* blocks: Add storage method

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Add support for runtime API calls and expose it to the blocks API

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* storage: Add storage type for block centric API

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust subxt to the new Storage interface

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2023-01-20 12:49:19 +02:00
committed by GitHub
parent 4155850063
commit e4e9562b45
17 changed files with 608 additions and 388 deletions
+12 -2
View File
@@ -126,7 +126,10 @@ async fn fetch_keys() {
let addr = node_runtime::storage().system().account_root();
let keys = api
.storage()
.fetch_keys(&addr.to_root_bytes(), 4, None, None)
.at(None)
.await
.unwrap()
.fetch_keys(&addr.to_root_bytes(), 4, None)
.await
.unwrap();
assert_eq!(keys.len(), 4)
@@ -138,7 +141,14 @@ async fn test_iter() {
let api = ctx.client();
let addr = node_runtime::storage().system().account_root();
let mut iter = api.storage().iter(addr, 10, None).await.unwrap();
let mut iter = api
.storage()
.at(None)
.await
.unwrap()
.iter(addr, 10)
.await
.unwrap();
let mut i = 0;
while iter.next().await.unwrap().is_some() {
i += 1;