Skip to content

Commit 7320d8e

Browse files
committed
fix: utils derive with example
1 parent 5e5a55d commit 7320d8e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

examples/all_requests.rs

+2
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ async fn main() -> BlockfrostResult<()> {
138138
let nutlink_ticker_by_id = api.nutlink_ticker_by_id(ticker, pagination).await;
139139

140140
// Utils
141+
let derive_result = api.derive_address("d507c8f866691bd96e131334c355188b1a1d0b2fa0ab11545075aab332d77d9eb19657ad13ee581b56b0f8d744d66ca356b93d42fe176b3de007d53e9c4c4e7a", "0", "1").await;
141142

142143
println!("root: {:#?}", root);
143144
println!("health: {:#?}", health);
@@ -237,6 +238,7 @@ async fn main() -> BlockfrostResult<()> {
237238
nutlink_address_ticker_by_id
238239
);
239240
println!("nutlink_ticker_by_id: {:#?}", nutlink_ticker_by_id);
241+
println!("derive_result: {:#?}", derive_result);
240242

241243
Ok(())
242244
}

src/api/endpoints/utils.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
use crate::{request::send_request, url::Url, *};
2+
use blockfrost_openapi::models::utils_addresses_xpub::UtilsAddressesXpub;
23
use reqwest::{header::HeaderValue, Body, Method};
34
use serde_json::from_str as json_from;
45

56
impl BlockfrostAPI {
67
pub async fn derive_address(
78
&self, xpub: &str, role: &str, index: &str,
8-
) -> BlockfrostResult<String> {
9-
self.call_endpoint(format!("/utils/addresses/xpub/{}/{}/{}", xpub, role, index).as_str())
10-
.await
9+
) -> BlockfrostResult<UtilsAddressesXpub> {
10+
self.call_endpoint(&format!(
11+
"/utils/addresses/xpub/{}/{}/{}",
12+
xpub, role, index
13+
))
14+
.await
1115
}
1216

1317
pub async fn utils_tx_evaluate(&self, transaction_data: Vec<u8>) -> BlockfrostResult<String> {

0 commit comments

Comments
 (0)