Skip to content

Commit

Permalink
Merge pull request #46 from the-Minister-0001/master
Browse files Browse the repository at this point in the history
Adjust return types for asset and tx endpoints
  • Loading branch information
vladimirvolek authored Dec 31, 2023
2 parents eab2fe7 + cd1dc12 commit 48e0f75
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/api/endpoints/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ use crate::*;
use blockfrost_openapi::models::{
asset_addresses_inner::AssetAddressesInner, asset_history_inner::AssetHistoryInner,
asset_policy_inner::AssetPolicyInner, asset_transactions_inner::AssetTransactionsInner,
asset::Asset,
assets_inner::AssetsInner,
};

impl BlockfrostAPI {
pub async fn assets_by_id(&self, asset: &str) -> BlockfrostResult<AssetsInner> {
pub async fn assets_by_id(&self, asset: &str) -> BlockfrostResult<Asset> {
self.call_endpoint(format!("/assets/{}", asset).as_str())
.await
}
Expand Down Expand Up @@ -51,7 +52,9 @@ impl BlockfrostAPI {
mod tests {
use super::*;
use blockfrost_openapi::models::{
asset::Asset, asset_transactions_inner::AssetTransactionsInner,
asset::Asset,
asset_transactions_inner::AssetTransactionsInner,
assets_inner::AssetsInner,
};
use serde_json::json;

Expand Down
7 changes: 4 additions & 3 deletions src/api/endpoints/transactions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{request::send_request, url::Url, *};
use blockfrost_openapi::models::{
address_transactions_content_inner::AddressTransactionsContentInner, tx_content::TxContent,
tx_content::TxContent,
tx_content_utxo::TxContentUtxo,
tx_content_delegations_inner::TxContentDelegationsInner,
tx_content_metadata_cbor_inner::TxContentMetadataCborInner,
tx_content_metadata_inner::TxContentMetadataInner, tx_content_mirs_inner::TxContentMirsInner,
Expand Down Expand Up @@ -44,11 +45,11 @@ impl BlockfrostAPI {

pub async fn transaction_by_hash(
&self, hash: &str,
) -> BlockfrostResult<AddressTransactionsContentInner> {
) -> BlockfrostResult<TxContent> {
self.call_endpoint(format!("/txs/{}", hash).as_str()).await
}

pub async fn transactions_utxos(&self, hash: &str) -> BlockfrostResult<TxContent> {
pub async fn transactions_utxos(&self, hash: &str) -> BlockfrostResult<TxContentUtxo> {
self.call_endpoint(format!("/txs/{}/utxos", hash).as_str())
.await
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub use api::*;
pub use error::*;
pub use ipfs::BlockfrostIPFS;
pub use pagination::Pagination;
pub use pagination::Order;
pub use settings::*;
pub use types::*;

Expand Down

0 comments on commit 48e0f75

Please sign in to comment.