-
Notifications
You must be signed in to change notification settings - Fork 248
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 Runtime API to execute runtime calls #777
Conversation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
subxt/src/client/online_client.rs
Outdated
async fn fetch_metadata(rpc: &Rpc<T>) -> Result<Metadata, Error> { | ||
let bytes = rpc | ||
.state_call("Metadata_metadata".into(), None, None) | ||
.await?; | ||
let cursor = &mut &*bytes; | ||
let _ = <Compact<u32>>::decode(cursor)?; | ||
let meta: RuntimeMetadataPrefixed = Decode::decode(cursor)?; | ||
Ok(meta.try_into()?) | ||
} |
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.
Cool! :)
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.
Looks awesome! Just one wee comment :)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
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.
looks clean, one question regarding an expect :P
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
This PR adds the ability to call into the runtime API of the subxt.
At this moment, the subxt utilises the
state_call
method.This work lays the ground for transitioning to the
chainHead
andarchive
methods of the RPC SpecV2.The API is exposed both at the root level via, as well at the blocks level (block-centric approach).
Part of #732 .