rosetta_types/account_balance_response.rs
1/*
2 * Rosetta
3 *
4 * Build Once. Integrate Your Blockchain Everywhere.
5 *
6 * The version of the OpenAPI document: 1.4.13
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// AccountBalanceResponse : An AccountBalanceResponse is returned on the /account/balance endpoint. If an account has a balance for each AccountIdentifier describing it (ex: an ERC-20 token balance on a few smart contracts), an account balance request must be made with each AccountIdentifier. The `coins` field was removed and replaced by by `/account/coins` in `v1.4.7`.
12
13#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
14pub struct AccountBalanceResponse {
15 #[serde(rename = "block_identifier")]
16 pub block_identifier: crate::BlockIdentifier,
17 /// A single account may have a balance in multiple currencies.
18 #[serde(rename = "balances")]
19 pub balances: Vec<crate::Amount>,
20 /// Account-based blockchains that utilize a nonce or sequence number should include that number in the metadata. This number could be unique to the identifier or global across the account address.
21 #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
22 pub metadata: Option<serde_json::Value>,
23}
24
25impl AccountBalanceResponse {
26 /// An AccountBalanceResponse is returned on the /account/balance endpoint. If an account has a balance for each AccountIdentifier describing it (ex: an ERC-20 token balance on a few smart contracts), an account balance request must be made with each AccountIdentifier. The `coins` field was removed and replaced by by `/account/coins` in `v1.4.7`.
27 pub fn new(
28 block_identifier: crate::BlockIdentifier,
29 balances: Vec<crate::Amount>,
30 ) -> AccountBalanceResponse {
31 AccountBalanceResponse {
32 block_identifier,
33 balances,
34 metadata: None,
35 }
36 }
37}