maestro-rust-sdk 1.1.2

Rust SDK for the Maestro Dapp Platform
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use super::maestro::Maestro;
use crate::models::datum::DatumFromHash;
use std::error::Error;

impl Maestro {
    pub async fn datum_from_hash(&self, hash: &str) -> Result<DatumFromHash, Box<dyn Error>> {
        let url = format!("/data/{}", hash);
        let resp = self.get(&url).await?;
        let datum = serde_json::from_str(&resp).map_err(|e| Box::new(e) as Box<dyn Error>)?;
        Ok(datum)
    }
}