paritytech / json-rpc-interface-spec

30 stars 3 forks source link

How do I get block hash by block number? #158

Closed f-squirrel closed 4 months ago

f-squirrel commented 4 months ago

Hi, In the older versions, there was an option to get block hash by block number as follows:

client.rpc().block_hash(block_id).await

At the moment, there is no rpc() method. How can I achieve the same functionality?

josepot commented 4 months ago

At the moment, there is no rpc() method. How can I achieve the same functionality?

https://paritytech.github.io/json-rpc-interface-spec/api/archive_unstable_hashByHeight.html

Also, this is a dup of #113 which IMO should be closed.

f-squirrel commented 4 months ago

At the moment, there is no rpc() method. How can I achieve the same functionality?

https://paritytech.github.io/json-rpc-interface-spec/api/archive_unstable_hashByHeight.html

Also, this is a dup of #113 which IMO should be closed.

Hi @josepot thank you for quick reply. Is there any example how I can make such a call via subxt? For example, the following method requires providing a hash:

    async fn call(
        &self,
        method: &str,
        call_parameters: Option<&[u8]>,
        at: T::Hash,
    ) -> Result<Vec<u8>, Error>;
josepot commented 4 months ago

Is there any example how I can make such a call via subxt?

I really don't know... Also, I don't mean to be rude, but this question belongs into the Subxt repo.

f-squirrel commented 4 months ago

@josepot, you are right! Thank you for help!