mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
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:
@@ -173,6 +173,25 @@ impl<T: Config> Rpc<T> {
|
||||
Ok(metadata)
|
||||
}
|
||||
|
||||
/// Execute a runtime API call.
|
||||
pub async fn call(
|
||||
&self,
|
||||
function: String,
|
||||
call_parameters: Option<&[u8]>,
|
||||
at: Option<T::Hash>,
|
||||
) -> Result<types::Bytes, Error> {
|
||||
let call_parameters = call_parameters.unwrap_or_default();
|
||||
|
||||
let bytes: types::Bytes = self
|
||||
.client
|
||||
.request(
|
||||
"state_call",
|
||||
rpc_params![function, to_hex(call_parameters), at],
|
||||
)
|
||||
.await?;
|
||||
Ok(bytes)
|
||||
}
|
||||
|
||||
/// Fetch system properties
|
||||
pub async fn system_properties(&self) -> Result<types::SystemProperties, Error> {
|
||||
self.client
|
||||
|
||||
Reference in New Issue
Block a user