The account_mptokens method returns information about the MPTs held by an account, including their balance. This method may return large data sets, so you should expect to implement pagination.
This method is only available using Clio, not xrpld.
{
"command": "account_mptokens",
"account": "rLEw4taUYTNLs3ZCv3vyXGmct8PagQ9GcF",
"ledger_index": "validated"
}The request contains the following parameters:
| Field | Type | Required? | Description |
|---|---|---|---|
account | String - Address | Yes | Look up MPTs held by this account. |
ledger_index | Ledger Index | No | The Ledger Index of the ledger to use, or a shortcut string to choose a ledger automatically. See Specifying Ledgers. |
ledger_hash | String | No | A 32-byte hex string for the ledger version to use. See Specifying Ledgers. |
marker | Marker | No | Used to continue your query where it left off in paginating. |
limit | Number (positive integer) | No | Specify a limit to the number of MPTs returned. Must be within the inclusive range 10 to 400. Positive values outside this range are replaced with the closest valid option. The default is 200. |
{
"result": {
"account": "rLEw4taUYTNLs3ZCv3vyXGmct8PagQ9GcF",
"ledger_hash": "6CAA8A6A2B5EB20B0D2C8DE5B54B63BA4D8FE54266EBB3A7DA9B3F60B009778B",
"ledger_index": 105503030,
"validated": true,
"limit": 200,
"mptokens": [
{
"mpt_id": "CC043159A7647CDB51F41C1DF4985D654CD1635A62299B2522B9E184D8A0573F",
"account": "rLEw4taUYTNLs3ZCv3vyXGmct8PagQ9GcF",
"mpt_issuance_id": "062B590488AF241E0720C1D54DD12798D8B0A05E7B147EE0",
"mpt_amount": 2412500,
"mpt_authorized": true
}
]
},
"id": "example_account_mptokens",
"status": "success",
"type": "response",
"warnings": [
{
"id": 2001,
"message": "This is a clio server. clio only serves validated data. If you want to talk to rippled, include 'ledger_index':'current' in your request"
}
]
}The response follows the standard format, with the result containing the following fields:
| Field | Type | Description |
|---|---|---|
account | Address | The account whose MPTokens were queried. |
mptokens | Array | An array of MPT objects held by the account. |
marker | Marker | Used to continue querying where we left off when paginating. Omitted if there are no more entries after this result. |
limit | Number | The limit, as specified in the request. |
ledger_hash | Hash | The hash of the ledger version used to generate this response. |
ledger_index | Ledger Index | The index of the ledger version used to generate this response. |
validated | Boolean | If true, the ledger has been validated by the consensus process and is immutable. Otherwise, the contents of the ledger are not final and may change. In Clio, this is always true as Clio stores and returns validated ledger data. |
Each MPT object has the following fields:
| Field | Type | Description |
|---|---|---|
mpt_id | String | The ledger entry ID of the MPToken ledger entry for this MPT. |
account | Address | The holder of this MPT. |
mpt_issuance_id | String | The 192-bit MPTokenIssuanceID, as hexadecimal, of the MPTokenIssuance entry that this MPToken is associated with. |
mpt_amount | Number | The amount of tokens currently held by the account for this issuance. |
locked_amount | Number | (May be omitted) The amount of tokens currently held in escrow. Omitted if the MPToken has no escrowed balance. |
mpt_locked | Boolean | (May be omitted) If true, the issuer has frozen the holder's balance of this token, so the holder can't send it. This is unrelated to locked_amount. Omitted if not frozen. |
mpt_authorized | Boolean | (May be omitted) If true, the holder is authorized to hold this token. Omitted if not authorized. |
- Any of the universal error types.
invalidParams- One or more fields are specified incorrectly, or one or more required fields are missing.actMalformed- The Address specified in theaccountfield of the request is not a valid account address.actNotFound- The Address specified in theaccountfield of the request does not correspond to an account in the ledger.lgrNotFound- The ledger specified by theledger_hashorledger_indexdoes not exist, or the server does not have it.