-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add block-centric Storage API #774
Changes from all commits
82c7744
fb46e99
7281630
7d1057d
60f4274
e0d9ca4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,25 @@ impl<T: Config> Rpc<T> { | |
Ok(metadata) | ||
} | ||
|
||
/// Execute a runtime API call. | ||
pub async fn call( | ||
&self, | ||
function: String, | ||
call_parameters: Option<&[u8]>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this assumes that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we should provide the parameters scale-encoded concatenated and then apply |
||
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, I like this new API better it's easier to read with
fn at
👍There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!