Skip to content

Commit

Permalink
All transactions related GET endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospb19 committed Oct 11, 2021
1 parent 0a322ea commit 10fddf7
Show file tree
Hide file tree
Showing 6 changed files with 563 additions and 30 deletions.
25 changes: 25 additions & 0 deletions examples/all_requests.rs
Expand Up @@ -110,6 +110,20 @@ async fn main() -> blockfrost::Result<()> {
let scripts_by_id = api.scripts_by_id(script_hash).await;
let scripts_redeemers = api.scripts_redeemers(script_hash).await;

// Transactions
let transaction_hash = "cb0e7b0cd0f0edbe5c6e260c369f5f0f0069cd41f501243ab67f1052040de28f";
let transaction_by_hash = api.transaction_by_hash(transaction_hash).await;
let transactions_utxos = api.transactions_utxos(transaction_hash).await;
let transactions_stakes = api.transactions_stakes(transaction_hash).await;
let transactions_delegations = api.transactions_delegations(transaction_hash).await;
let transactions_withdrawals = api.transactions_withdrawals(transaction_hash).await;
let transactions_mirs = api.transactions_mirs(transaction_hash).await;
let transactions_pool_updates = api.transactions_pool_updates(transaction_hash).await;
let transactions_pool_retires = api.transactions_pool_retires(transaction_hash).await;
let transactions_metadata = api.transactions_metadata(transaction_hash).await;
let transactions_metadata_cbor = api.transactions_metadata_cbor(transaction_hash).await;
let transactions_redeemers = api.transactions_redeemers(transaction_hash).await;

println!("root: {:#?}", root);
println!("health: {:#?}", health);
println!("health_clock: {:#?}", health_clock);
Expand Down Expand Up @@ -170,6 +184,17 @@ async fn main() -> blockfrost::Result<()> {
println!("scripts: {:#?}", scripts);
println!("scripts_by_id: {:#?}", scripts_by_id);
println!("scripts_redeemers: {:#?}", scripts_redeemers);
println!("transaction_by_hash: {:#?}", transaction_by_hash);
println!("transactions_utxos: {:#?}", transactions_utxos);
println!("transactions_stakes: {:#?}", transactions_stakes);
println!("transactions_delegations: {:#?}", transactions_delegations);
println!("transactions_withdrawals: {:#?}", transactions_withdrawals);
println!("transactions_mirs: {:#?}", transactions_mirs);
println!("transactions_pool_updates: {:#?}", transactions_pool_updates);
println!("transactions_pool_retires: {:#?}", transactions_pool_retires);
println!("transactions_metadata: {:#?}", transactions_metadata);
println!("transactions_metadata_cbor: {:#?}", transactions_metadata_cbor);
println!("transactions_redeemers: {:#?}", transactions_redeemers);

Ok(())
}
27 changes: 0 additions & 27 deletions src/api/endpoints/addresses.rs
Expand Up @@ -74,33 +74,6 @@ pub struct AddressTransaction {
pub block_height: Integer,
}

/// Inner member of [`Address`], [`AddressTotal`] and [`AddressUtxo`].
///
/// # Format:
///
/// The `unit` String can be "lovelace" or other, in the latter case, the String will be made of
/// a concatenation of the asset `policy_id` and hex-encoded `asset_name`.
///
/// # Example:
///
/// ```
/// # use blockfrost::Amount;
/// let unit = "lovelace".to_string();
/// let quantity = "700".to_string();
///
/// // Amount: 700 lovelaces
/// let amount = Amount { unit, quantity };
/// ```
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Amount {
/// The unit of the value.
///
/// Format: "Lovelace" or concatenation of asset `policy_id` and hex-encoded `asset_name`.
pub unit: String,
/// The quantity of the unit.
pub quantity: String,
}

/// Inner enum for [`Address`].
///
/// Address era.
Expand Down
2 changes: 2 additions & 0 deletions src/api/endpoints/mod.rs
Expand Up @@ -15,6 +15,7 @@ mod metrics;
mod network;
mod pools;
mod scripts;
mod transactions;

pub use accounts::*;
pub use addresses::*;
Expand All @@ -28,3 +29,4 @@ pub use metrics::*;
pub use network::*;
pub use pools::*;
pub use scripts::*;
pub use transactions::*;
4 changes: 2 additions & 2 deletions src/api/endpoints/network.rs
Expand Up @@ -14,7 +14,7 @@ impl BlockFrostApi {
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Network {
pub supply: Supply,
pub stake: Stake,
pub stake: NetworkStake,
}

/// Inner member of [`Network`].
Expand All @@ -32,7 +32,7 @@ pub struct Supply {

/// Inner member of [`Network`].
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Stake {
pub struct NetworkStake {
/// Current live stake in Lovelaces.
pub live: String,
/// Current active stake in Lovelaces.
Expand Down

0 comments on commit 10fddf7

Please sign in to comment.