|
| 1 | +--- |
| 2 | +blurb: Get the holders for a given `MPTokenIssuanceID` and ledger sequence. |
| 3 | +labels: |
| 4 | + - Accounts |
| 5 | + - XRP |
| 6 | +--- |
| 7 | + |
| 8 | +# mpt_holders |
| 9 | + |
| 10 | +_(Requires the [MPToken amendment][] {% not-enabled /%})_ |
| 11 | + |
| 12 | +For a given `MPTokenIssuanceID` and ledger sequence, `mpt_holders` returns all holders of that MPT and their balance. This method likely returns very large data sets, so you should expect to implement paging via the `marker` field. This API is only available using Clio, not rippled. |
| 13 | + |
| 14 | +## Request Format |
| 15 | + |
| 16 | +*Websocket* |
| 17 | + |
| 18 | +```json |
| 19 | +{ |
| 20 | + "command": "mpt_holders", |
| 21 | + "mpt_issuance_id": "00070C4495F14B0E44F78A264E41713C64B5F89242540EE255534400000000000000", |
| 22 | + "ledger_index": "validated" |
| 23 | +} |
| 24 | +``` |
| 25 | + |
| 26 | +*JSON-RPC* |
| 27 | + |
| 28 | +```json |
| 29 | +{ |
| 30 | + "method": "mpt_holders", |
| 31 | + "params": [ |
| 32 | + { |
| 33 | + "mpt_issuance_id": "00070C4495F14B0E44F78A264E41713C64B5F89242540EE255534400000000000000", |
| 34 | + "ledger_index": "validated" |
| 35 | + } |
| 36 | + ] |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | + |
| 41 | +The request contains the following parameters: |
| 42 | + |
| 43 | +| Field | Type | Required? | Description | |
| 44 | +|:------------------|:---------------------|:----------|-------------| |
| 45 | +| `mpt_issuance_id` | string | Yes | The `MPTokenIssuance` to query. | |
| 46 | +| `ledger_index` | string or number (positive integer) | No | The ledger index of the max ledger to use, ora shortcut string to choose a ledger automatically. You must specify either ledger_index or ledger_hash. | |
| 47 | +| `ledger_hash` | string | No | A 32-byte hex string for the ledger version to use. You must specify either ledger_index or ledger_hash. | |
| 48 | +| `marker` | string | No | Used to continue your query where it left off in paginating. | |
| 49 | +| `limit` | number (positive integer) | No | Specify a limit to the number of MPTs returned. | |
| 50 | + |
| 51 | +## Response Format |
| 52 | + |
| 53 | +```json |
| 54 | +{ |
| 55 | + "mpt_issuance_id": "000004C463C52827307480341125DA0577DEFC38405B0E3E", |
| 56 | + "limit":50, |
| 57 | + "ledger_index": 2, |
| 58 | + "mptokens": [{ |
| 59 | + "account": "rEiNkzogdHEzUxPfsri5XSMqtXUixf2Yx", |
| 60 | + "flags": 0, |
| 61 | + "mpt_amount": "20", |
| 62 | + "mptoken_index": "36D91DEE5EFE4A93119A8B84C944A528F2B444329F3846E49FE921040DE17E65" |
| 63 | + }, |
| 64 | + { |
| 65 | + "account": "rrnAZCqMahreZrKMcZU3t2DZ6yUndT4ubN", |
| 66 | + "flags": 0, |
| 67 | + "mpt_amount": "1", |
| 68 | + "mptoken_index": "D137F2E5A5767A06CB7A8F060ADE442A30CFF95028E1AF4B8767E3A56877205A" |
| 69 | + }], |
| 70 | + "validated": true |
| 71 | +} |
| 72 | +``` |
| 73 | + |
| 74 | +### Response Fields |
| 75 | + |
| 76 | +The response follows the [standard format][], with the result containing the following fields: |
| 77 | + |
| 78 | +| Field | Type | Description | |
| 79 | +|:-----------------------|:--------|:------------------------------------------| |
| 80 | +| `mpt_issuance_id` | string | The `MPTokenIssuance` queried | |
| 81 | +| `mptokens` | array | An array of mptokens. Includes all relevant fields in the underlying MPToken object. | |
| 82 | +| `marker` | string | Used to continue querying where we left off when paginating. Omitted if there are no more entries after this result. | |
| 83 | +| `limit` | number | The limit, as specfied in the request |
| 84 | +| `ledger_index` | number | The index of the ledger used. | |
| 85 | + |
| 86 | +An `mptoken` object has the following parameters: |
| 87 | + |
| 88 | +| Field | Type | Description | |
| 89 | +|:-----------------------|:--------|:------------------------------------------| |
| 90 | +| `account` | string | The account address of the holder who owns the `MPToken`. | |
| 91 | +| `flags` | number | The flags assigned to the`MPToken` object. | |
| 92 | +| `mpt_amount` | string | Base 10-encoded amount of the holder's balance. | |
| 93 | +| `mptoken_index` | string | Key of the `MPToken` object. | |
| 94 | + |
| 95 | +##### Example |
| 96 | +Example of a `tx` response: |
| 97 | + |
| 98 | +```json |
| 99 | +{ |
| 100 | + "result": { |
| 101 | + "Account": "rBT9cUqK6UvpvZhPFNQ2qpUTin8rDokBeL", |
| 102 | + "AssetScale": 2, |
| 103 | + "Fee": "10", |
| 104 | + "Flags": 64, |
| 105 | + "Sequence": 303, |
| 106 | + "SigningPubKey": "ED39955DEA2D083C6CBE459951A0A84DB337925389ACA057645EE6E6BA99D4B2AE", |
| 107 | + "TransactionType": "MPTokenIssuanceCreate", |
| 108 | + "TxnSignature": "80D7B7409980BE9854F7217BB8E836C8A2A191E766F24B5EF2EA7609E1420AABE6A1FDB3038468679081A45563B4D0B49C08F4F70F64E41B578F288A208E4206", |
| 109 | + "ctid": "C000013100000000", |
| 110 | + "date": 760643692, |
| 111 | + "hash": "E563D7942E3E4A79AD73EC12E9E4C44B7C9950DF7BF5FDB75FAD0F5CE0554DB3", |
| 112 | + "inLedger": 305, |
| 113 | + "ledger_index": 305, |
| 114 | + "meta": { |
| 115 | + "AffectedNodes": [...], |
| 116 | + "TransactionIndex": 0, |
| 117 | + "TransactionResult": "tesSUCCESS", |
| 118 | + "mpt_issuance_id": "0000012F72A341F09A988CDAEA4FF5BE31F25B402C550ABE" |
| 119 | + }, |
| 120 | + "status": "success", |
| 121 | + "validated": true |
| 122 | + } |
| 123 | +} |
| 124 | +``` |
| 125 | + |
| 126 | +##### Object |
| 127 | +An `mpt_issuance_id` field is provided in JSON MPTokenIssuance objects (not available for binary). The following APIs are impacted: `ledger_data` and `account_objects`. |
| 128 | + |
| 129 | +##### Example |
| 130 | +Example of an `account_objects` response: |
| 131 | + |
| 132 | +```json |
| 133 | +{ |
| 134 | + "result": { |
| 135 | + "account": "rBT9cUqK6UvpvZhPFNQ2qpUTin8rDokBeL", |
| 136 | + "account_objects": [ |
| 137 | + { |
| 138 | + "AssetScale": 2, |
| 139 | + "Flags": 64, |
| 140 | + "Issuer": "rBT9cUqK6UvpvZhPFNQ2qpUTin8rDokBeL", |
| 141 | + "LedgerEntryType": "MPTokenIssuance", |
| 142 | + "OutstandingAmount": "100", |
| 143 | + "OwnerNode": "0", |
| 144 | + "PreviousTxnID": "BDC5ECA6B115C74BF4DA83E36325A2F55DF9E2C968A5CC15EB4D009D87D5C7CA", |
| 145 | + "PreviousTxnLgrSeq": 308, |
| 146 | + "Sequence": 303, |
| 147 | + "index": "75EC6F2939ED6C5798A5F369A0221BC4F6DDC50F8614ECF72E3B976351057A63", |
| 148 | + "mpt_issuance_id": "0000012F72A341F09A988CDAEA4FF5BE31F25B402C550ABE" |
| 149 | + } |
| 150 | + ], |
| 151 | + "ledger_current_index": 309, |
| 152 | + "status": "success", |
| 153 | + "validated": false |
| 154 | + } |
| 155 | +} |
| 156 | +``` |
| 157 | + |
| 158 | +{% raw-partial file="/docs/_snippets/common-links.md" /%} |
0 commit comments