maestro-rust-sdk 1.0.0

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

impl Maestro {
    pub async fn script_by_hash(&self, hash: &str) -> Result<ScriptByHash, Box<dyn Error>> {
        let url = format!("/scripts/{}", hash);
        let resp = self.get(&url).await?;

        let script_by_hash =
            serde_json::from_str(&resp).map_err(|e| Box::new(e) as Box<dyn Error>)?;
        Ok(script_by_hash)
    }
}