maestro_rust_sdk/client/scripts.rs
1use super::maestro::Maestro;
2use crate::models::scripts::ScriptByHash;
3use std::error::Error;
4
5impl Maestro {
6 pub async fn script_by_hash(&self, hash: &str) -> Result<ScriptByHash, Box<dyn Error>> {
7 let url = format!("/scripts/{}", hash);
8 let resp = self.get(&url).await?;
9
10 let script_by_hash =
11 serde_json::from_str(&resp).map_err(|e| Box::new(e) as Box<dyn Error>)?;
12 Ok(script_by_hash)
13 }
14}