rosetta_types/
account_identifier.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/// AccountIdentifier : The account_identifier uniquely identifies an account within a network. All fields in the account_identifier are utilized to determine this uniqueness (including the metadata field, if populated).
12
13#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
14pub struct AccountIdentifier {
15    /// The address may be a cryptographic public key (or some encoding of it) or a provided username.
16    #[serde(rename = "address")]
17    pub address: String,
18    #[serde(rename = "sub_account", skip_serializing_if = "Option::is_none")]
19    pub sub_account: Option<crate::SubAccountIdentifier>,
20    /// Blockchains that utilize a username model (where the address is not a derivative of a cryptographic public key) should specify the public key(s) owned by the address in metadata.
21    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
22    pub metadata: Option<serde_json::Value>,
23}
24
25impl AccountIdentifier {
26    /// The account_identifier uniquely identifies an account within a network. All fields in the account_identifier are utilized to determine this uniqueness (including the metadata field, if populated).
27    pub fn new(address: String) -> AccountIdentifier {
28        AccountIdentifier {
29            address,
30            sub_account: None,
31            metadata: None,
32        }
33    }
34}