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
//! The account_nfts method returns a list of NFToken objects for the specified
//! account.
//!
//! <https://xrpl.org/account_nfts.html>
use crate::Request;
use serde::{Deserialize, Serialize};
#[derive(Default, Debug, Clone, Serialize)]
pub struct AccountNftsRequest {
/// The unique identifier of an account, typically the account's Address.
/// The request returns a list of NFTs owned by this account.
account: String,
#[serde(skip_serializing_if = "Option::is_none")]
ledger_hash: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
ledger_index: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<u32>,
/// Value from a previous paginated response. Resume retrieving data where
/// that response left off.
#[serde(skip_serializing_if = "Option::is_none")]
marker: Option<String>,
}
impl Request for AccountNftsRequest {
type Response = AccountNftsResponse;
fn method(&self) -> String {
"account_nfts".to_owned()
}
}
impl AccountNftsRequest {
pub fn new(account: &str) -> Self {
Self {
account: account.to_owned(),
..Default::default()
}
}
}
// #todo consider extracting as a type.
/// The NFToken object represents a single non-fungible token (NFT). It is not
/// stored on its own, but is contained in a NFTokenPage object alongside other
/// NFTs.
#[derive(Debug, Serialize, Deserialize)]
pub struct NFToken {
/// A bit-map of boolean flags enabled for this NFToken.
#[serde(rename = "Flags")]
pub flags: u32,
/// The account that issued this NFToken.
#[serde(rename = "Issuer")]
pub issuer: String,
/// The unique identifier of this NFToken, in hexadecimal.
#[serde(rename = "NFTokenID")]
pub nftoken_id: String,
/// The unscrambled version of this token's taxon. Several tokens with the
/// same taxon might represent instances of a limited series.
#[serde(rename = "NFTokenTaxon")]
pub nftoken_taxon: u32,
/// The URI data associated with this NFToken, in hexadecimal.
#[serde(rename = "URI")]
pub uri: String,
/// The token sequence number of this NFToken, which is unique for its issuer.
pub nft_serial: u32,
}
#[derive(Debug, Deserialize)]
pub struct AccountNftsResponse {
pub account: String,
pub account_nfts: Vec<NFToken>,
pub validated: bool,
// #TODO add missing fields
}