multiversx_sdk_http/gateway_http_proxy/
http_block.rsuse anyhow::Result;
use multiversx_sdk::{
data::hyperblock::HyperBlock,
gateway::{GetHyperBlockRequest, NetworkStatusRequest},
};
use super::GatewayHttpProxy;
impl GatewayHttpProxy {
pub async fn get_hyper_block_by_hash(&self, hash: &str) -> Result<HyperBlock> {
self.http_request(GetHyperBlockRequest::by_hash(hash)).await
}
pub async fn get_hyper_block_by_nonce(&self, nonce: u64) -> Result<HyperBlock> {
self.http_request(GetHyperBlockRequest::by_nonce(nonce))
.await
}
pub async fn get_latest_hyper_block_nonce(&self) -> Result<u64> {
let network_status = self.http_request(NetworkStatusRequest::default()).await?;
Ok(network_status.nonce)
}
}