Skip to main content

blockfrost_openapi/models/
account_content.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct AccountContent {
6    /// Bech32 stake address
7    #[serde(rename = "stake_address")]
8    pub stake_address: String,
9    /// Delegation state of the account. **Note:** For registration state, use the `registered` field instead.
10    #[serde(rename = "active")]
11    pub active: bool,
12    /// Registration state of an account
13    #[serde(rename = "registered")]
14    pub registered: bool,
15    /// Epoch of the most recent action - registration or deregistration
16    #[serde(rename = "active_epoch", deserialize_with = "Option::deserialize")]
17    pub active_epoch: Option<i32>,
18    /// Balance of the account in Lovelaces
19    #[serde(rename = "controlled_amount")]
20    pub controlled_amount: String,
21    /// Sum of all rewards for the account in the Lovelaces
22    #[serde(rename = "rewards_sum")]
23    pub rewards_sum: String,
24    /// Sum of all the withdrawals for the account in Lovelaces
25    #[serde(rename = "withdrawals_sum")]
26    pub withdrawals_sum: String,
27    /// Sum of all  funds from reserves for the account in the Lovelaces
28    #[serde(rename = "reserves_sum")]
29    pub reserves_sum: String,
30    /// Sum of all funds from treasury for the account in the Lovelaces
31    #[serde(rename = "treasury_sum")]
32    pub treasury_sum: String,
33    /// Sum of available rewards that haven't been withdrawn yet for the account in the Lovelaces
34    #[serde(rename = "withdrawable_amount")]
35    pub withdrawable_amount: String,
36    /// Bech32 pool ID to which this account is delegated
37    #[serde(rename = "pool_id", deserialize_with = "Option::deserialize")]
38    pub pool_id: Option<String>,
39    /// Bech32 drep ID to which this account is delegated
40    #[serde(rename = "drep_id", deserialize_with = "Option::deserialize")]
41    pub drep_id: Option<String>,
42}
43
44impl AccountContent {
45    pub fn new(stake_address: String, active: bool, registered: bool, active_epoch: Option<i32>, controlled_amount: String, rewards_sum: String, withdrawals_sum: String, reserves_sum: String, treasury_sum: String, withdrawable_amount: String, pool_id: Option<String>, drep_id: Option<String>) -> AccountContent {
46        AccountContent {
47            stake_address,
48            active,
49            registered,
50            active_epoch,
51            controlled_amount,
52            rewards_sum,
53            withdrawals_sum,
54            reserves_sum,
55            treasury_sum,
56            withdrawable_amount,
57            pool_id,
58            drep_id,
59        }
60    }
61}
62