Skip to content

account_mptokens

[Source]

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. New in: Clio v2.7.0

This method is only available using Clio, not xrpld.

Request Format

{
  "command": "account_mptokens",
  "account": "rLEw4taUYTNLs3ZCv3vyXGmct8PagQ9GcF",
  "ledger_index": "validated"
}
Try it!

The request contains the following parameters:

FieldTypeRequired?Description
accountString - AddressYesLook up MPTs held by this account.
ledger_indexLedger IndexNoThe Ledger Index of the ledger to use, or a shortcut string to choose a ledger automatically. See Specifying Ledgers.
ledger_hashStringNoA 32-byte hex string for the ledger version to use. See Specifying Ledgers.
markerMarkerNoUsed to continue your query where it left off in paginating.
limitNumber (positive integer)NoSpecify 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.

Response Format

{
  "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:

FieldTypeDescription
accountAddressThe account whose MPTokens were queried.
mptokensArrayAn array of MPT objects held by the account.
markerMarkerUsed to continue querying where we left off when paginating. Omitted if there are no more entries after this result.
limitNumberThe limit, as specified in the request.
ledger_hashHashThe hash of the ledger version used to generate this response.
ledger_indexLedger IndexThe index of the ledger version used to generate this response.
validatedBooleanIf 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.

MPT objects

Each MPT object has the following fields:

FieldTypeDescription
mpt_idStringThe ledger entry ID of the MPToken ledger entry for this MPT.
accountAddressThe holder of this MPT.
mpt_issuance_idStringThe 192-bit MPTokenIssuanceID, as hexadecimal, of the MPTokenIssuance entry that this MPToken is associated with.
mpt_amountNumberThe amount of tokens currently held by the account for this issuance.
locked_amountNumber(May be omitted) The amount of tokens currently held in escrow. Omitted if the MPToken has no escrowed balance.
mpt_lockedBoolean(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_authorizedBoolean(May be omitted) If true, the holder is authorized to hold this token. Omitted if not authorized.

Possible Errors

  • 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 the account field of the request is not a valid account address.
  • actNotFound - The Address specified in the account field of the request does not correspond to an account in the ledger.
  • lgrNotFound - The ledger specified by the ledger_hash or ledger_index does not exist, or the server does not have it.