use std::sync::Arc;
use celestia_rpc::blobstream::BlobstreamClient;
use crate::client::Context;
use crate::types::hash::Hash;
use crate::types::MerkleProof;
use crate::Result;
pub struct BlobstreamApi {
ctx: Arc<Context>,
}
impl BlobstreamApi {
pub(crate) fn new(ctx: Arc<Context>) -> BlobstreamApi {
BlobstreamApi { ctx }
}
pub async fn get_data_root_tuple_root(&self, start: u64, end: u64) -> Result<Hash> {
Ok(self
.ctx
.rpc
.blobstream_get_data_root_tuple_root(start, end)
.await?)
}
pub async fn get_data_root_tuple_inclusion_proof(
&self,
height: u64,
start: u64,
end: u64,
) -> Result<MerkleProof> {
Ok(self
.ctx
.rpc
.blobstream_get_data_root_tuple_inclusion_proof(height, start, end)
.await?)
}
}