mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 08:11:04 +00:00
Add Runtime API to execute runtime calls (#777)
* rpc: Add RuntimeAPI call via `state_call` method Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * subxt: Add runtime API Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Expose the RuntimeAPI client Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * tests: Test the runtime API call against the metadata Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * client: Fetch the metadata from runtime API Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * blocks: Fix doc typo Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * blocks: Use &str instead of String to identify fn names Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Update subxt/src/runtime_api/runtime_client.rs Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@ use crate::{
|
||||
},
|
||||
events,
|
||||
rpc::types::ChainBlockResponse,
|
||||
runtime_api::RuntimeApi,
|
||||
};
|
||||
use derivative::Derivative;
|
||||
use futures::lock::Mutex as AsyncMutex;
|
||||
@@ -89,6 +90,11 @@ where
|
||||
self.cached_events.clone(),
|
||||
))
|
||||
}
|
||||
|
||||
/// Execute a runtime API call at this block.
|
||||
pub async fn runtime_api(&self) -> Result<RuntimeApi<T, C>, Error> {
|
||||
Ok(RuntimeApi::new(self.client.clone(), self.hash()))
|
||||
}
|
||||
}
|
||||
|
||||
/// The body of a block.
|
||||
|
||||
Reference in New Issue
Block a user