mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
References general file structure (methods)
This commit is contained in:
@@ -0,0 +1,196 @@
|
||||
## ledger
|
||||
[[Source]<br>](https://github.com/ripple/rippled/blob/master/src/ripple/rpc/handlers/LedgerHandler.cpp "Source")
|
||||
|
||||
Retrieve information about the public ledger.
|
||||
|
||||
#### Request Format
|
||||
An example of the request format:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```
|
||||
{
|
||||
"id": 14,
|
||||
"command": "ledger",
|
||||
"ledger_index": "validated",
|
||||
"full": false,
|
||||
"accounts": false,
|
||||
"transactions": false,
|
||||
"expand": false,
|
||||
"owner_funds": false
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```
|
||||
{
|
||||
"method": "ledger",
|
||||
"params": [
|
||||
{
|
||||
"ledger_index": "validated",
|
||||
"accounts": false,
|
||||
"full": false,
|
||||
"transactions": false,
|
||||
"expand": false,
|
||||
"owner_funds": false
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
*Commandline*
|
||||
|
||||
```
|
||||
#Syntax: ledger ledger_index|ledger_hash [full|tx]
|
||||
# "full" is equivalent to "full": true
|
||||
# "tx" is equivalent to "transactions": true
|
||||
rippled ledger current
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
[Try it! >](ripple-api-tool.html#ledger)
|
||||
|
||||
The request can contain the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------------|:-------------------------------|
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying a Ledger](#specifying-ledgers)). |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The sequence number of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying a Ledger](#specifying-ledgers)) |
|
||||
| `full` | Boolean | _(Optional)_ **Admin required** If `true`, return full information on the entire ledger. Ignored if you did not specify a ledger version. Defaults to `false`. (Equivalent to enabling `transactions`, `accounts`, and `expand`.) **Caution:** This is a very large amount of data -- on the order of several hundred megabytes! |
|
||||
| `accounts` | Boolean | _(Optional)_ **Admin required.** If `true`, return information on accounts in the ledger. Ignored if you did not specify a ledger version. Defaults to `false`. **Caution:** This returns a very large amount of data! |
|
||||
| `transactions` | Boolean | _(Optional)_ If `true`, return information on transactions in the specified ledger version. Defaults to `false`. Ignored if you did not specify a ledger version. |
|
||||
| `expand` | Boolean | _(Optional)_ Provide full JSON-formatted information for transaction/account information instead of only hashes. Defaults to `false`. Ignored unless you request transactions, accounts, or both. |
|
||||
| `owner_funds` | Boolean | _(Optional)_ If `true`, include `owner_funds` field in the metadata of OfferCreate transactions in the response. Defaults to `false`. Ignored unless transactions are included and `expand` is true. |
|
||||
| `binary` | Boolean | _(Optional)_ If `true`, and `transactions` and `expand` are both also `true`, return transaction information in binary format (hexadecimal string) instead of JSON format. [New in: rippled 0.28.0][] |
|
||||
| `queue` | Boolean | _(Optional)_ If `true`, and the command is requesting the `current` ledger, includes an array of [queued transactions](concept-transaction-cost.html#queued-transactions) in the results.
|
||||
|
||||
The `ledger` field is deprecated and may be removed without further notice.
|
||||
|
||||
#### Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```
|
||||
{
|
||||
"id": 4,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"ledger": {
|
||||
"accepted": true,
|
||||
"account_hash": "FD2709F6C07284C3EE85EDE32AC452D9013A89D9B9E781D67D9784457E86A9BB",
|
||||
"close_flags": 0,
|
||||
"close_time": 508541181,
|
||||
"close_time_human": "2016-Feb-11 21:26:21",
|
||||
"close_time_resolution": 10,
|
||||
"closed": true,
|
||||
"hash": "F1433E9D15F33E746B8820DEEE4879F48181704364E459332561DF8E52E4EB7E",
|
||||
"ledger_hash": "F1433E9D15F33E746B8820DEEE4879F48181704364E459332561DF8E52E4EB7E",
|
||||
"ledger_index": "18851530",
|
||||
"parent_close_time": 508541180,
|
||||
"parent_hash": "8300B70AA5A865961DED7DAC5B88047028762D5946ECA887D09D32DE442E2305",
|
||||
"seqNum": "18851530",
|
||||
"totalCoins": "99998102799411646",
|
||||
"total_coins": "99998102799411646",
|
||||
"transaction_hash": "E0DB0471A1D198611E1C050ADA4AE74EEB38CEC26E0550663E0FCB1364212A3B"
|
||||
},
|
||||
"ledger_hash": "F1433E9D15F33E746B8820DEEE4879F48181704364E459332561DF8E52E4EB7E",
|
||||
"ledger_index": 18851530,
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```
|
||||
200 OK
|
||||
{
|
||||
"result": {
|
||||
"ledger": {
|
||||
"accepted": true,
|
||||
"account_hash": "B089E7CD4F5167249951611AAEC863D4BF84FF098500E9CB50561F1A89EED825",
|
||||
"close_flags": 0,
|
||||
"close_time": 508541222,
|
||||
"close_time_human": "2016-Feb-11 21:27:02",
|
||||
"close_time_resolution": 10,
|
||||
"closed": true,
|
||||
"hash": "85E6D422F1A3AE0BEA315C4F09CD0B45022312A4BBF0D308246E901536B61157",
|
||||
"ledger_hash": "85E6D422F1A3AE0BEA315C4F09CD0B45022312A4BBF0D308246E901536B61157",
|
||||
"ledger_index": "18851543",
|
||||
"parent_close_time": 508541221,
|
||||
"parent_hash": "C382DB117F2D5AAECFBFB43EA509F8E56D6E1D1297CE00C0D02A3EE695ABB78F",
|
||||
"seqNum": "18851543",
|
||||
"totalCoins": "99998102795090646",
|
||||
"total_coins": "99998102795090646",
|
||||
"transaction_hash": "BEC71A3CAD11BFC4E4013CD109F220E0850E9A3808B15FAA6DAE4D898970EFAF"
|
||||
},
|
||||
"ledger_hash": "85E6D422F1A3AE0BEA315C4F09CD0B45022312A4BBF0D308246E901536B61157",
|
||||
"ledger_index": 18851543,
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
The response follows the [standard format](#response-formatting), with a successful result containing information about the ledger, including the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------------------------|:--------|:----------------------------------|
|
||||
| `ledger` | Object | The complete header data of this ledger. |
|
||||
| `ledger.account_hash` | String | Hash of all account state information in this ledger, as hex |
|
||||
| `ledger.accountState` | Array | (Omitted unless requested) All the [account-state information](reference-ledger-format.html) in this ledger. |
|
||||
| `ledger.close_flags` | Integer | A bit-map of flags relating to the closing of this ledger. Currently, the ledger has only one flag defined for `close_flags`: **sLCF_NoConsensusTime** (value 1). If this flag is enabled, it means that validators were in conflict regarding the correct close time for the ledger, but build otherwise the same ledger, so they declared consensus while "agreeing to disagree" on the close time. In this case, the consensus ledger contains a `close_time` that is 1 second after that of the previous ledger. (In this case, there is no official close time, but the actual real-world close time is probably 3-6 seconds later than the specified `close_time`.) |
|
||||
| `ledger.close_time` | Integer | The time this ledger was closed, in seconds since the [Ripple Epoch](#specifying-time) |
|
||||
| `ledger.close_time_human` | String | The time this ledger was closed, in human-readable format |
|
||||
| `ledger.close_time_resolution` | Integer | Ledger close times are rounded to within this many seconds. |
|
||||
| `ledger.closed` | Boolean | Whether or not this ledger has been closed |
|
||||
| `ledger.ledger_hash` | String | Unique identifying hash of the entire ledger. |
|
||||
| `ledger.ledger_index` | String | The [Ledger Index][] of this ledger, as a quoted integer |
|
||||
| `ledger.parent_close_time` | Integer | The time at which the previous ledger was closed. |
|
||||
| `ledger.parent_hash` | String | Unique identifying hash of the ledger that came immediately before this one. |
|
||||
| `ledger.total_coins` | String | Total number of XRP drops in the network, as a quoted integer. (This decreases as transaction costs destroy XRP.) |
|
||||
| `ledger.transaction_hash` | String | Hash of the transaction information included in this ledger, as hex |
|
||||
| `ledger.transactions` | Array | (Omitted unless requested) Transactions applied in this ledger version. By default, members are the transactions' identifying [Hash][] strings. If the request specified `expand` as true, members are full representations of the transactions instead, in either JSON or binary depending on whether the request specified `binary` as true. |
|
||||
| `ledger_hash` | String | Unique identifying hash of the entire ledger. |
|
||||
| `ledger_index` | Number | The [Ledger Index][] of this ledger. |
|
||||
| `queue_data` | Array | (Omitted unless requested with the `queue` parameter) Array of objects describing queued transactions, in the same order as the queue. If the request specified `expand` as true, members contain full representations of the transactions, in either JSON or binary depending on whether the request specified `binary` as true. Requires the [FeeEscalation amendment](reference-amendments.html#feeescalation). [New in: rippled 0.70.0][] |
|
||||
|
||||
The following fields are deprecated and may be removed without further notice: `accepted`, `hash` (use `ledger_hash` instead), `seqNum` (use `ledger_index` instead), `totalCoins` (use `total_coins` instead).
|
||||
|
||||
Each member of the `queue_data` array represents one transaction in the queue. Some fields of this object may be omitted because they have not yet been calculated. The fields of this object are as follows:
|
||||
|
||||
| Field | Value | Description |
|
||||
|:--------------------|:-----------------|:------------------------------------|
|
||||
| `account` | String | The [Address][] of the sender for this queued transaction. |
|
||||
| `tx` | String or Object | By default, this is a String containing the [identifying hash](#hashes) of the transaction. If transactions are expanded in binary format, this is an object whose only field is `tx_blob`, containing the binary form of the transaction as a decimal string. If transactions are expanded in JSON format, this is an object containing the [transaction object](reference-transaction-format.html) including the transaction's identifying hash in the `hash` field. |
|
||||
| `retries_remaining` | Number | How many times this transaction can be retried before being dropped. |
|
||||
| `preflight_result` | String | The tentative result from preliminary transaction checking. This is always `tesSUCCESS`. |
|
||||
| `last_result` | String | _(May be omitted)_ If this transaction was left in the queue after getting a [retriable (`ter`) result](reference-transaction-format.html#result-categories), this is the exact `ter` result code it got. |
|
||||
| `auth_change` | Boolean | _(May be omitted)_ Whether this transaction changes this address's [ways of authorizing transactions](reference-transaction-format.html#authorizing-transactions). |
|
||||
| `fee` | String | _(May be omitted)_ The [Transaction Cost](concept-transaction-cost.html) of this transaction, in [drops of XRP](#specifying-currency-amounts). |
|
||||
| `fee_level` | String | _(May be omitted)_ The transaction cost of this transaction, relative to the minimum cost for this type of transaction, in [fee levels][]. |
|
||||
| `max_spend_drops` | String | _(May be omitted)_ The maximum amount of XRP, [in drops](#specifying-currency-amounts), this transaction could potentially send or destroy. |
|
||||
|
||||
If the request specified `"owner_funds": true` and expanded transactions, the response has a field `owner_funds` in the `metaData` object of each [OfferCreate-type transaction](reference-transaction-format.html#offercreate). The purpose of this field is to make it easier to track the [funding status of offers](reference-transaction-format.html#lifecycle-of-an-offer) with each new validated ledger. This field is defined slightly differently than the version of this field in [Order Book subscription streams](#order-book-streams):
|
||||
|
||||
| `Field` | Value | Description |
|
||||
|:--------------|:-------|:----------------------------------------------------|
|
||||
| `owner_funds` | String | Numeric amount of the `TakerGets` currency that the `Account` sending this OfferCreate transaction has after the execution of all transactions in this ledger. This does not check whether the currency amount is [frozen](concept-freeze.html). |
|
||||
|
||||
#### Possible Errors
|
||||
|
||||
* Any of the [universal error types](#universal-errors).
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `lgrNotFound` - The ledger specified by the `ledger_hash` or `ledger_index` does not exist, or it does exist but the server does not have it.
|
||||
* `noPermission` - If you specified `full` or `accounts` as true, but are not connected to the server as an admin (usually, admin requires connecting on a local port).
|
||||
@@ -0,0 +1,87 @@
|
||||
## ledger_closed
|
||||
[[Source]<br>](https://github.com/ripple/rippled/blob/master/src/ripple/rpc/handlers/LedgerClosed.cpp "Source")
|
||||
|
||||
The `ledger_closed` method returns the unique identifiers of the most recently closed ledger. (This ledger is not necessarily validated and immutable yet.)
|
||||
|
||||
#### Request Format
|
||||
An example of the request format:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```
|
||||
{
|
||||
"id": 2,
|
||||
"command": "ledger_closed"
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```
|
||||
{
|
||||
"method": "ledger_closed",
|
||||
"params": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
*Commandline*
|
||||
|
||||
```
|
||||
#Syntax: ledger_closed
|
||||
rippled ledger_closed
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
[Try it! >](ripple-api-tool.html#ledger_closed)
|
||||
|
||||
This method accepts no parameters.
|
||||
|
||||
#### Response Format
|
||||
An example of a successful response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```
|
||||
{
|
||||
"id": 1,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"ledger_hash": "17ACB57A0F73B5160713E81FE72B2AC9F6064541004E272BD09F257D57C30C02",
|
||||
"ledger_index": 6643099
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```
|
||||
200 OK
|
||||
{
|
||||
"result": {
|
||||
"ledger_hash": "8B5A0C5F6B198254A6E411AF55C29EE40AA86251D2E78DD0BB17647047FA9C24",
|
||||
"ledger_index": 8696231,
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
The response follows the [standard format](#response-formatting), with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:-----------------|:-----------------------------------------|
|
||||
| `ledger_hash` | String | 20-byte hex string with a unique hash of the ledger |
|
||||
| `ledger_index` | Unsigned Integer | Sequence number of this ledger |
|
||||
|
||||
#### Possible Errors
|
||||
|
||||
* Any of the [universal error types](#universal-errors).
|
||||
@@ -0,0 +1,88 @@
|
||||
## ledger_current
|
||||
[[Source]<br>](https://github.com/ripple/rippled/blob/master/src/ripple/rpc/handlers/LedgerCurrent.cpp "Source")
|
||||
|
||||
The `ledger_current` method returns the unique identifiers of the current in-progress ledger. This command is mostly useful for testing, because the ledger returned is still in flux.
|
||||
|
||||
#### Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```
|
||||
{
|
||||
"id": 2,
|
||||
"command": "ledger_current"
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```
|
||||
{
|
||||
"method": "ledger_current",
|
||||
"params": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
*Commandline*
|
||||
|
||||
```
|
||||
#Syntax: ledger_current
|
||||
rippled ledger_current
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
[Try it! >](ripple-api-tool.html#ledger_current)
|
||||
|
||||
The request contains no parameters.
|
||||
|
||||
|
||||
#### Response Format
|
||||
An example of a successful response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```
|
||||
{
|
||||
"id": 2,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"ledger_current_index": 6643240
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```
|
||||
200 OK
|
||||
{
|
||||
"result": {
|
||||
"ledger_current_index": 8696233,
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
The response follows the [standard format](#response-formatting), with a successful result containing the following field:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------------|:-----------------|:-------------------------------|
|
||||
| `ledger_current_index` | Unsigned Integer | Sequence number of this ledger |
|
||||
|
||||
A `ledger_hash` field is not provided, because the hash of the current ledger is constantly changing along with its contents.
|
||||
|
||||
#### Possible Errors
|
||||
|
||||
* Any of the [universal error types](#universal-errors).
|
||||
@@ -0,0 +1,257 @@
|
||||
## ledger_data
|
||||
[[Source]<br>](https://github.com/ripple/rippled/blob/master/src/ripple/rpc/handlers/LedgerData.cpp "Source")
|
||||
|
||||
The `ledger_data` method retrieves contents of the specified ledger. You can iterate through several calls to retrieve the entire contents of a single ledger version.
|
||||
|
||||
#### Request Format
|
||||
An example of the request format:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```
|
||||
{
|
||||
"id": 2,
|
||||
"ledger_hash": "842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8",
|
||||
"command": "ledger_data",
|
||||
"limit": 5,
|
||||
"binary": true
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```
|
||||
{
|
||||
"method": "ledger_data",
|
||||
"params": [
|
||||
{
|
||||
"binary": true,
|
||||
"ledger_hash": "842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8",
|
||||
"limit": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
**Note:** There is no commandline syntax for `ledger_data`. You can use the [`json` command](#json) to access this method from the commandline instead.
|
||||
|
||||
A request can include the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:-------------------------------------------|:---------------|
|
||||
| `id` | (Arbitrary) | (WebSocket only) Any identifier to separate this request from others in case the responses are delayed or out of order. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying a Ledger](#specifying-ledgers)) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The sequence number of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying a Ledger](#specifying-ledgers)) |
|
||||
| `binary` | Boolean | (Optional, defaults to False) If set to true, return ledger objects as hashed hex strings instead of JSON. |
|
||||
| `limit` | Integer | (Optional, default varies) Limit the number of ledger objects to retrieve. The server is not required to honor this value. |
|
||||
| `marker` | [(Not Specified)](#markers-and-pagination) | Value from a previous paginated response. Resume retrieving data where that response left off. |
|
||||
|
||||
The `ledger` field is deprecated and may be removed without further notice.
|
||||
|
||||
#### Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket (binary:true)*
|
||||
|
||||
```
|
||||
{
|
||||
"id": 2,
|
||||
"result": {
|
||||
"ledger_hash": "842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8",
|
||||
"ledger_index": "6885842",
|
||||
"marker": "0002A590029B53BE7857EFF9985F770EC792CE483720EB5E963C4D6A607D43DF",
|
||||
"state": [
|
||||
{
|
||||
"data": "11006122000000002400000001250062FEA42D0000000055C204A65CF2542946289A3358C67D991B5E135FABFA89F271DBA7A150C08CA0466240000000354540208114C909F42250CFE8F12A7A1A0DFBD3CBD20F32CD79",
|
||||
"index": "00001A2969BE1FC85F1D7A55282FA2E6D95C71D2E4B9C0FDD3D9994F3C00FF8F"
|
||||
},
|
||||
{
|
||||
"data": "11006F22000000002400000003250035788533000000000000000034000000000000000055555B93628BF3EC318892BB7C7CDCB6732FF53D12B6EEC4FAF60DD1AEE1C6101F501071633D7DE1B6AEB32F87F1A73258B13FC8CC32942D53A66D4F038D7EA4C6800064D4838D7EA4C68000000000000000000000000000425443000000000035DD7DF146893456296BF4061FBE68735D28F3286540000000000F42408114A4B8F5F7B644AEDC3447F9459C132EEB016A133B",
|
||||
"index": "000037C6659BB98F8D09F2F4CFEB27DE8EFEAFE54DD9E1C13AECDF5794B0C0F5"
|
||||
},
|
||||
{
|
||||
"data": "11006F2200020000240000000A250067395C33000000000000000034000000000000000055A160BC41A45B6BB118DF23D77E4FF23C723431B917F50DCB41319ECC2821F34C5010DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4C1AA535D3D0C00064D554C88B43EFA00000000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D165400000B59B9F780081148366FB9ACD2A0FD822E31112D2EB6F98C317C2C1",
|
||||
"index": "0000A8791F78CC9B39200E12A9BDAACCF40A72A512FA815525CFC9BA772990F7"
|
||||
},
|
||||
{
|
||||
"data": "1100612200000000240000000125003E742F2D0000000055286498B513710CFEB2D723A554C7557983D1952DF4DEE342C40DCB43067C9A21624000000306DC42008114225BAB89C4A4B94624BB069D6DB3C819F934991C",
|
||||
"index": "0000B717320558E2DE1A3B9FDB24E9A695BF05D1A44E4A4683212BB1DD0FBA23"
|
||||
},
|
||||
{
|
||||
"data": "110072220002000025000B65783700000000000000003800000000000000005587591A63051645F37B85D1FBA55EE69B1C96BFF16904F5C99F03FB93D42D03756280000000000000000000000000000000000000004254430000000000000000000000000000000000000000000000000166800000000000000000000000000000000000000042544300000000000A20B3C85F482532A9578DBB3950B85CA06594D167D4C38D7EA4C680000000000000000000000000004254430000000000C795FDF8A637BCAAEDAD1C434033506236C82A2D",
|
||||
"index": "000103996A3BAD918657F86E12A67D693E8FC8A814DA4B958A244B5F14D93E58"
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
|
||||
*WebSocket (binary:false)*
|
||||
|
||||
```
|
||||
{
|
||||
"id": 2,
|
||||
"result": {
|
||||
"ledger_hash": "842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8",
|
||||
"ledger_index": "6885842",
|
||||
"marker": "0002A590029B53BE7857EFF9985F770EC792CE483720EB5E963C4D6A607D43DF",
|
||||
"state": [
|
||||
{
|
||||
"Account": "rKKzk9ghA2iuy3imqMXUHJqdRPMtNDGf4c",
|
||||
"Balance": "893730848",
|
||||
"Flags": 0,
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"OwnerCount": 0,
|
||||
"PreviousTxnID": "C204A65CF2542946289A3358C67D991B5E135FABFA89F271DBA7A150C08CA046",
|
||||
"PreviousTxnLgrSeq": 6487716,
|
||||
"Sequence": 1,
|
||||
"index": "00001A2969BE1FC85F1D7A55282FA2E6D95C71D2E4B9C0FDD3D9994F3C00FF8F"
|
||||
},
|
||||
{
|
||||
"Account": "rGryPmNWFognBgMtr9k4quqPbbEcCrhNmD",
|
||||
"BookDirectory": "71633D7DE1B6AEB32F87F1A73258B13FC8CC32942D53A66D4F038D7EA4C68000",
|
||||
"BookNode": "0000000000000000",
|
||||
"Flags": 0,
|
||||
"LedgerEntryType": "Offer",
|
||||
"OwnerNode": "0000000000000000",
|
||||
"PreviousTxnID": "555B93628BF3EC318892BB7C7CDCB6732FF53D12B6EEC4FAF60DD1AEE1C6101F",
|
||||
"PreviousTxnLgrSeq": 3504261,
|
||||
"Sequence": 3,
|
||||
"TakerGets": "1000000",
|
||||
"TakerPays": {
|
||||
"currency": "BTC",
|
||||
"issuer": "rnuF96W4SZoCJmbHYBFoJZpR8eCaxNvekK",
|
||||
"value": "1"
|
||||
},
|
||||
"index": "000037C6659BB98F8D09F2F4CFEB27DE8EFEAFE54DD9E1C13AECDF5794B0C0F5"
|
||||
},
|
||||
{
|
||||
"Account": "rUy8tW38MW9ma7kSjRgB2GHtTkQAFRyrN8",
|
||||
"BookDirectory": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4C1AA535D3D0C000",
|
||||
"BookNode": "0000000000000000",
|
||||
"Flags": 131072,
|
||||
"LedgerEntryType": "Offer",
|
||||
"OwnerNode": "0000000000000000",
|
||||
"PreviousTxnID": "A160BC41A45B6BB118DF23D77E4FF23C723431B917F50DCB41319ECC2821F34C",
|
||||
"PreviousTxnLgrSeq": 6764892,
|
||||
"Sequence": 10,
|
||||
"TakerGets": "780000000000",
|
||||
"TakerPays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "5850"
|
||||
},
|
||||
"index": "0000A8791F78CC9B39200E12A9BDAACCF40A72A512FA815525CFC9BA772990F7"
|
||||
},
|
||||
{
|
||||
"Account": "rh3C81VfNDhhWPQWCU8ZGgknvdgNUvRtM9",
|
||||
"Balance": "13000000000",
|
||||
"Flags": 0,
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"OwnerCount": 0,
|
||||
"PreviousTxnID": "286498B513710CFEB2D723A554C7557983D1952DF4DEE342C40DCB43067C9A21",
|
||||
"PreviousTxnLgrSeq": 4092975,
|
||||
"Sequence": 1,
|
||||
"index": "0000B717320558E2DE1A3B9FDB24E9A695BF05D1A44E4A4683212BB1DD0FBA23"
|
||||
},
|
||||
{
|
||||
"Balance": {
|
||||
"currency": "BTC",
|
||||
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
|
||||
"value": "0"
|
||||
},
|
||||
"Flags": 131072,
|
||||
"HighLimit": {
|
||||
"currency": "BTC",
|
||||
"issuer": "rKUK9omZqVEnraCipKNFb5q4tuNTeqEDZS",
|
||||
"value": "10"
|
||||
},
|
||||
"HighNode": "0000000000000000",
|
||||
"LedgerEntryType": "RippleState",
|
||||
"LowLimit": {
|
||||
"currency": "BTC",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "0"
|
||||
},
|
||||
"LowNode": "0000000000000000",
|
||||
"PreviousTxnID": "87591A63051645F37B85D1FBA55EE69B1C96BFF16904F5C99F03FB93D42D0375",
|
||||
"PreviousTxnLgrSeq": 746872,
|
||||
"index": "000103996A3BAD918657F86E12A67D693E8FC8A814DA4B958A244B5F14D93E58"
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC (binary:true)*
|
||||
|
||||
```
|
||||
200 OK
|
||||
{
|
||||
"result": {
|
||||
"ledger_hash": "842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8",
|
||||
"ledger_index": "6885842",
|
||||
"marker": "0002A590029B53BE7857EFF9985F770EC792CE483720EB5E963C4D6A607D43DF",
|
||||
"state": [
|
||||
{
|
||||
"data": "11006122000000002400000001250062FEA42D0000000055C204A65CF2542946289A3358C67D991B5E135FABFA89F271DBA7A150C08CA0466240000000354540208114C909F42250CFE8F12A7A1A0DFBD3CBD20F32CD79",
|
||||
"index": "00001A2969BE1FC85F1D7A55282FA2E6D95C71D2E4B9C0FDD3D9994F3C00FF8F"
|
||||
},
|
||||
{
|
||||
"data": "11006F22000000002400000003250035788533000000000000000034000000000000000055555B93628BF3EC318892BB7C7CDCB6732FF53D12B6EEC4FAF60DD1AEE1C6101F501071633D7DE1B6AEB32F87F1A73258B13FC8CC32942D53A66D4F038D7EA4C6800064D4838D7EA4C68000000000000000000000000000425443000000000035DD7DF146893456296BF4061FBE68735D28F3286540000000000F42408114A4B8F5F7B644AEDC3447F9459C132EEB016A133B",
|
||||
"index": "000037C6659BB98F8D09F2F4CFEB27DE8EFEAFE54DD9E1C13AECDF5794B0C0F5"
|
||||
},
|
||||
{
|
||||
"data": "11006F2200020000240000000A250067395C33000000000000000034000000000000000055A160BC41A45B6BB118DF23D77E4FF23C723431B917F50DCB41319ECC2821F34C5010DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4C1AA535D3D0C00064D554C88B43EFA00000000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D165400000B59B9F780081148366FB9ACD2A0FD822E31112D2EB6F98C317C2C1",
|
||||
"index": "0000A8791F78CC9B39200E12A9BDAACCF40A72A512FA815525CFC9BA772990F7"
|
||||
},
|
||||
{
|
||||
"data": "1100612200000000240000000125003E742F2D0000000055286498B513710CFEB2D723A554C7557983D1952DF4DEE342C40DCB43067C9A21624000000306DC42008114225BAB89C4A4B94624BB069D6DB3C819F934991C",
|
||||
"index": "0000B717320558E2DE1A3B9FDB24E9A695BF05D1A44E4A4683212BB1DD0FBA23"
|
||||
},
|
||||
{
|
||||
"data": "110072220002000025000B65783700000000000000003800000000000000005587591A63051645F37B85D1FBA55EE69B1C96BFF16904F5C99F03FB93D42D03756280000000000000000000000000000000000000004254430000000000000000000000000000000000000000000000000166800000000000000000000000000000000000000042544300000000000A20B3C85F482532A9578DBB3950B85CA06594D167D4C38D7EA4C680000000000000000000000000004254430000000000C795FDF8A637BCAAEDAD1C434033506236C82A2D",
|
||||
"index": "000103996A3BAD918657F86E12A67D693E8FC8A814DA4B958A244B5F14D93E58"
|
||||
}
|
||||
],
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
The response follows the [standard format](#response-formatting), with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:-------------------------------------------|:---------------|
|
||||
| `ledger_index` | Unsigned Integer | Sequence number of this ledger |
|
||||
| `ledger_hash` | String | Unique identifying hash of the entire ledger. |
|
||||
| `state` | Array | Array of JSON objects containing data from the tree, as defined below |
|
||||
| `marker` | [(Not Specified)](#markers-and-pagination) | Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. |
|
||||
|
||||
The format of each object in the `state` array depends on whether `binary` was set to true or not in the request. Each `state` object may include the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:--------------------|:----------|:-------------------------------------------|
|
||||
| `data` | String | (Only included if `"binary":true`) Hex representation of the requested data |
|
||||
| `LedgerEntryType` | String | (Only included if `"binary":false`) String indicating what type of ledger object this object represents. See [ledger format][] for the full list. |
|
||||
| (Additional fields) | (Various) | (Only included if `"binary":false`) Additional fields describing this object, depending on which LedgerEntryType it is. |
|
||||
| `index` | String | Unique identifier for this ledger entry, as hex. |
|
||||
|
||||
#### Possible Errors
|
||||
|
||||
* Any of the [universal error types](#universal-errors)
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `lgrNotFound` - The ledger specified by the `ledger_hash` or `ledger_index` does not exist, or it does exist but the server does not have it.
|
||||
@@ -0,0 +1,147 @@
|
||||
## ledger_entry
|
||||
[[Source]<br>](https://github.com/ripple/rippled/blob/master/src/ripple/rpc/handlers/LedgerEntry.cpp "Source")
|
||||
|
||||
The `ledger_entry` method returns a single ledger object from the XRP Ledger in its raw format. See [ledger format][] for information on the different types of objects you can retrieve.
|
||||
|
||||
**Note:** There is no commandline version of this method. You can use the [`json` command](#json) to access this method from the commandline instead.
|
||||
|
||||
#### Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```
|
||||
{
|
||||
"id": 3,
|
||||
"command": "ledger_entry",
|
||||
"type": "account_root",
|
||||
"account_root": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [
|
||||
{
|
||||
"account_root": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"ledger_index": "validated",
|
||||
"type": "account_root"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
[Try it! >](ripple-api-tool.html#ledger_entry)
|
||||
|
||||
This method can retrieve several different types of data. You can select which type of item to retrieve by passing the appropriate parameters. Specifically, you should provide exactly one of the following fields:
|
||||
|
||||
1. `index` - Retrieve any type of ledger object by its unique ID
|
||||
2. `account_root` - Retrieve an [AccountRoot object](reference-ledger-format.html#accountroot). This is roughly equivalent to the [account_info](#account-info) command.
|
||||
3. `directory` - Retrieve a [DirectoryNode](reference-ledger-format.html#directorynode), which contains a list of other ledger objects
|
||||
4. `offer` - Retrieve an [Offer object](reference-ledger-format.html#offer), which defines an offer to exchange currency
|
||||
5. `ripple_state` - Retrieve a [RippleState object](reference-ledger-format.html#ripplestate), which tracks a (non-XRP) currency balance between two accounts.
|
||||
|
||||
If you specify more than one of the above items, the server retrieves only of them; it is undefined which it chooses.
|
||||
|
||||
The full list of parameters recognized by this method is as follows:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------------|:---------------------------|:----------------------|
|
||||
| `index` | String | _(Optional)_ Specify the unique identifier of a single ledger entry to retrieve. |
|
||||
| `account_root` | String - [Address][] | _(Optional)_ Specify an [AccountRoot object](reference-ledger-format.html#accountroot) to retrieve. |
|
||||
| `directory` | Object or String | _(Optional)_ Specify a [DirectoryNode](reference-ledger-format.html#directorynode). (DirectoryNode objects each contain a list of IDs for things contained in them.) If a string, interpret as the [unique index](reference-ledger-format.html#tree-format) to the directory, in hex. If an object, requires either `dir_root` or `owner` as a sub-field, plus optionally a `sub_index` sub-field. |
|
||||
| `directory.sub_index` | Unsigned Integer | _(Optional)_ If provided, jumps to a later "page" of the [Directory](reference-ledger-format.html#directorynode). |
|
||||
| `directory.dir_root` | String | (Required if `directory` is specified as an object and `directory.owner` is not provided) Unique index identifying the directory to retrieve, as a hex string. |
|
||||
| `directory.owner` | String | (Required if `directory` is specified as an object and `directory.dir_root` is not provided) Unique address of the account associated with this directory |
|
||||
| `offer` | Object or String | _(Optional)_ Specify an [Offer object](reference-ledger-format.html#offer) to retrieve. If a string, interpret as the [unique index](reference-ledger-format.html#tree-format) to the Offer. If an object, requires the sub-fields `account` and `seq` to uniquely identify the offer. |
|
||||
| `offer.account` | String - [Address][] | (Required if `offer` specified) The account that placed the offer. |
|
||||
| `offer.seq` | Unsigned Integer | (Required if `offer` specified) The sequence number of the transaction that created the Offer object. |
|
||||
| `ripple_state` | Object | _(Optional)_ Object specifying the RippleState (trust line) object to retrieve. The `accounts` and `currency` sub-fields are required to uniquely specify the RippleState entry to retrieve. |
|
||||
| `ripple_state.accounts` | Array | (Required if `ripple_state` specified) 2-length array of account [Address][]es, defining the two accounts linked by this [RippleState object](reference-ledger-format.html#ripplestate) |
|
||||
| `ripple_state.currency` | String | (Required if `ripple_state` specified) [Currency Code][] of the [RippleState object](reference-ledger-format.html#ripplestate) to retrieve. |
|
||||
| `binary` | Boolean | _(Optional)_ If true, return the requested ledger object's contents as a hex string. Otherwise, return data in JSON format. The default is `true` if searching by `index` and `false` otherwise. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying a Ledger](#specifying-ledgers)) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The sequence number of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying a Ledger](#specifying-ledgers)) |
|
||||
|
||||
The `generator` and `ledger` parameters are deprecated and may be removed without further notice.
|
||||
|
||||
#### Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```{
|
||||
"id": 3,
|
||||
"result": {
|
||||
"index": "4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05",
|
||||
"ledger_index": 6889347,
|
||||
"node": {
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Balance": "27389517749",
|
||||
"Flags": 0,
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"OwnerCount": 18,
|
||||
"PreviousTxnID": "B6B410172C0B65575D89E464AF5B99937CC568822929ABF87DA75CBD11911932",
|
||||
"PreviousTxnLgrSeq": 6592159,
|
||||
"Sequence": 1400,
|
||||
"index": "4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05"
|
||||
}
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```
|
||||
200 OK
|
||||
{
|
||||
"result": {
|
||||
"index": "4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05",
|
||||
"ledger_index": 8696234,
|
||||
"node": {
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Balance": "13176802787",
|
||||
"Flags": 0,
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"OwnerCount": 17,
|
||||
"PreviousTxnID": "E5D0235A236F7CD162C1AB87A0325056AE61CFC63D92D1494AB5D826AAD0CDCA",
|
||||
"PreviousTxnLgrSeq": 8554742,
|
||||
"Sequence": 1406,
|
||||
"index": "4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05"
|
||||
},
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
The response follows the [standard format](#response-formatting), with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:-----------------|:-----------------------------------------|
|
||||
| `index` | String | Unique identifying key for this ledger_entry |
|
||||
| `ledger_index` | Unsigned Integer | Unique sequence number of the ledger from which this data was retrieved |
|
||||
| `node` | Object | (Omitted if `"binary": true` specified.) Object containing the data of this ledger object, according to the [ledger format][]. |
|
||||
| `node_binary` | String | (Omitted unless `"binary":true` specified) Binary data of the ledger object, as hex. |
|
||||
|
||||
#### Possible Errors
|
||||
|
||||
* Any of the [universal error types](#universal-errors).
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `lgrNotFound` - The ledger specified by the `ledger_hash` or `ledger_index` does not exist, or it does exist but the server does not have it.
|
||||
Reference in New Issue
Block a user