events: Fetch metadata at arbitrary blocks (#727)

* subxt/rpc: Fetch metadata at arbitrary blocks

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

* subxt/events: Fetch metadata for events at arbitrary blocks

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

* Revert "subxt/events: Fetch metadata for events at arbitrary blocks"

This reverts commit 381409b7a8916611d7c44dc6ad58a90993b6c297.

* subxt/events: Custom constructor with metadata for events

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

* Update subxt/src/events/events_type.rs

Co-authored-by: James Wilson <james@jsdw.me>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
This commit is contained in:
Alexandru Vasile
2022-11-23 16:03:04 +02:00
committed by GitHub
parent 523534464f
commit 1c9aabf0f5
4 changed files with 68 additions and 11 deletions
+2 -2
View File
@@ -443,10 +443,10 @@ impl<T: Config> Rpc<T> {
}
/// Fetch the metadata
pub async fn metadata(&self) -> Result<Metadata, Error> {
pub async fn metadata(&self, at: Option<T::Hash>) -> Result<Metadata, Error> {
let bytes: Bytes = self
.client
.request("state_getMetadata", rpc_params![])
.request("state_getMetadata", rpc_params![at])
.await?;
let meta: RuntimeMetadataPrefixed = Decode::decode(&mut &bytes[..])?;
let metadata: Metadata = meta.try_into()?;