multiversx_sdk_http/gateway_http_proxy/
http_block.rs1use anyhow::Result;
2use multiversx_sdk::{
3 data::hyperblock::HyperBlock,
4 gateway::{GetHyperBlockRequest, NetworkStatusRequest},
5};
6
7use super::GatewayHttpProxy;
8
9impl GatewayHttpProxy {
10 pub async fn get_hyper_block_by_hash(&self, hash: &str) -> Result<HyperBlock> {
12 self.http_request(GetHyperBlockRequest::by_hash(hash)).await
13 }
14
15 pub async fn get_hyper_block_by_nonce(&self, nonce: u64) -> Result<HyperBlock> {
17 self.http_request(GetHyperBlockRequest::by_nonce(nonce))
18 .await
19 }
20
21 pub async fn get_latest_hyper_block_nonce(&self) -> Result<u64> {
23 let network_status = self.http_request(NetworkStatusRequest::default()).await?;
24 Ok(network_status.nonce)
25 }
26}