1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use alloc::borrow::Cow;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use crate::models::{requests::RequestMethod, Model};
use super::{CommonFields, LedgerIndex, LookupByLedgerRequest, Request};
/// This request retrieves information about an account, its
/// activity, and its XRP balance. All information retrieved
/// is relative to a particular version of the ledger.
///
/// See Account Info:
/// `<https://xrpl.org/account_info.html>`
#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
pub struct AccountInfo<'a> {
/// The common fields shared by all requests.
#[serde(flatten)]
pub common_fields: CommonFields<'a>,
/// A unique identifier for the account, most commonly the
/// account's Address.
pub account: Cow<'a, str>,
/// The unique identifier of a ledger.
#[serde(flatten)]
pub ledger_lookup: Option<LookupByLedgerRequest<'a>>,
/// If true, then the account field only accepts a public
/// key or XRP Ledger address. Otherwise, account can be
/// a secret or passphrase (not recommended).
/// The default is false.
pub strict: Option<bool>,
/// If true, and the FeeEscalation amendment is enabled,
/// also returns stats about queued transactions associated
/// with this account. Can only be used when querying for the
/// data from the current open ledger. New in: rippled 0.33.0
/// Not available from servers in Reporting Mode.
pub queue: Option<bool>,
/// If true, and the MultiSign amendment is enabled, also
/// returns any SignerList objects associated with this account.
pub signer_lists: Option<bool>,
}
impl<'a> Model for AccountInfo<'a> {}
impl<'a> Request<'a> for AccountInfo<'a> {
fn get_common_fields(&self) -> &CommonFields<'a> {
&self.common_fields
}
fn get_common_fields_mut(&mut self) -> &mut CommonFields<'a> {
&mut self.common_fields
}
}
impl<'a> AccountInfo<'a> {
pub fn new(
id: Option<Cow<'a, str>>,
account: Cow<'a, str>,
ledger_hash: Option<Cow<'a, str>>,
ledger_index: Option<LedgerIndex<'a>>,
strict: Option<bool>,
queue: Option<bool>,
signer_lists: Option<bool>,
) -> Self {
Self {
common_fields: CommonFields {
command: RequestMethod::AccountInfo,
id,
},
account,
ledger_lookup: Some(LookupByLedgerRequest {
ledger_hash,
ledger_index,
}),
strict,
queue,
signer_lists,
}
}
}