whisky_provider/blockfrost/models/
utxo.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Deserialize, Debug, PartialEq, Clone, Serialize)]
6pub struct Asset {
7    pub unit: String,
8    pub quantity: String,
9}
10#[derive(Deserialize, Debug, Clone)]
11pub struct BlockfrostUtxo {
12    /// Bech32 encoded addresses
13    #[serde(rename = "address")]
14    pub address: String,
15    /// Transaction hash of the UTXO
16    #[serde(rename = "tx_hash")]
17    pub tx_hash: String,
18    /// UTXO index in the transaction
19    #[serde(rename = "tx_index")]
20    pub tx_index: i32,
21    /// UTXO index in the transaction
22    #[serde(rename = "output_index")]
23    pub output_index: i32,
24    #[serde(rename = "amount")]
25    pub amount: Vec<Asset>,
26    /// Block hash of the UTXO
27    #[serde(rename = "block")]
28    pub block: String,
29    /// The hash of the transaction output datum
30    #[serde(rename = "data_hash", deserialize_with = "Option::deserialize")]
31    pub data_hash: Option<String>,
32    /// CBOR encoded inline datum
33    #[serde(rename = "inline_datum", deserialize_with = "Option::deserialize")]
34    pub inline_datum: Option<String>,
35    /// The hash of the reference script of the output
36    #[serde(
37        rename = "reference_script_hash",
38        deserialize_with = "Option::deserialize"
39    )]
40    pub reference_script_hash: Option<String>,
41}
42
43#[derive(Deserialize, Debug, Clone)]
44pub struct ReferenceScript {
45    pub bytes: String,
46    pub hash: String,
47    pub json: Option<HashMap<String, serde_json::Value>>,
48    pub r#type: String,
49}