Skip to content

Commit

Permalink
fix: missing utils functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvolek committed May 29, 2024
1 parent c254a8d commit 5e5a55d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 2 additions & 0 deletions examples/all_requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ async fn main() -> BlockfrostResult<()> {
.await;
let nutlink_ticker_by_id = api.nutlink_ticker_by_id(ticker, pagination).await;

// Utils

println!("root: {:#?}", root);
println!("health: {:#?}", health);
println!("health_clock: {:#?}", health_clock);
Expand Down
1 change: 1 addition & 0 deletions src/api/endpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ mod nutlink;
mod pools;
mod scripts;
mod transactions;
mod utils;
21 changes: 7 additions & 14 deletions src/api/endpoints/utils.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
use crate::*;
use blockfrost_openapi::models::{
pool::Pool, pool_delegators_inner::PoolDelegatorsInner, pool_history_inner::PoolHistoryInner,
pool_list_retire_inner::PoolListRetireInner, pool_metadata::PoolMetadata,
pool_updates_inner::PoolUpdatesInner,
tx_content_pool_certs_inner_relays_inner::TxContentPoolCertsInnerRelaysInner,
};
use crate::{request::send_request, url::Url, *};
use reqwest::{header::HeaderValue, Body, Method};
use serde_json::from_str as json_from;

impl BlockfrostAPI {
pub async fn derive_address(
&self,
xpub: &str,
role: &str,
index: &str,
) -> BlockfrostResult<Derive> {
&self, xpub: &str, role: &str, index: &str,
) -> BlockfrostResult<String> {
self.call_endpoint(format!("/utils/addresses/xpub/{}/{}/{}", xpub, role, index).as_str())
.await
}
Expand All @@ -37,12 +30,12 @@ impl BlockfrostAPI {
if !status.is_success() {
return Err(process_error_response(&text, status, &url));
}

json_from(&text).map_err(|reason| json_error(url, text, reason))
}

pub async fn utils_tx_evaluate_utxos(
&self,
transaction_data: Vec<u8>,
&self, transaction_data: Vec<u8>,
) -> BlockfrostResult<String> {
let body = Body::from(transaction_data);
let url = Url::from_endpoint(self.base_url.as_str(), "/utils/txs/evaluate/utxos")?;
Expand Down

0 comments on commit 5e5a55d

Please sign in to comment.