mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-21 04:05:49 +00:00
Re-level non-docs content to top of repo and rename content→docs
This commit is contained in:
@@ -0,0 +1,194 @@
|
||||
---
|
||||
html: account_channels.html
|
||||
parent: account-methods.html
|
||||
seo:
|
||||
description: Get a list of payment channels where the account is the source of the channel.
|
||||
labels:
|
||||
- Payment Channels
|
||||
---
|
||||
# account_channels
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/AccountChannels.cpp "Source")
|
||||
|
||||
_(Added by the [PayChan amendment][].)_
|
||||
|
||||
The `account_channels` method returns information about an account's Payment Channels. This includes only channels where the specified account is the channel's source, not the destination. (A channel's "source" and "owner" are the same.) All information retrieved is relative to a particular version of the ledger.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "account_channels",
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "account_channels",
|
||||
"params": [{
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"ledger_index": "validated"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```bash
|
||||
#Syntax: account_channels <account> [<destination_account>] [<ledger>]
|
||||
rippled account_channels rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn ra5nK24KXen9AHvsdFTKHSANinZseWnPcX validated
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| Field | Type | Required? | Description |
|
||||
|:----------------------|:---------------------|:----------|-------------|
|
||||
| `account` | String - [Address][] | Yes | Look up channels where this account is the channel's owner/source. |
|
||||
| `destination_account` | String - [Address][] | No | A second account; if provided, filter results to payment channels whose destination is this account. |
|
||||
| `ledger_hash` | String | No | A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | Number or String | No | The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
| `limit` | Number | No | Limit the number of transactions to retrieve. Cannot be less than 10 or more than 400. Positive values outside this range are replaced with the closest valid option. The default is 200. |
|
||||
| `marker` | [Marker][] | No | Value from a previous paginated response. Resume retrieving data where that response left off. |
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"result": {
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"channels": [
|
||||
{
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"amount": "1000",
|
||||
"balance": "0",
|
||||
"channel_id": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7",
|
||||
"destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"public_key": "aBR7mdD75Ycs8DRhMgQ4EMUEmBArF8SEh1hfjrT2V9DQTLNbJVqw",
|
||||
"public_key_hex": "03CFD18E689434F032A4E84C63E2A3A6472D684EAF4FD52CA67742F3E24BAE81B2",
|
||||
"settle_delay": 60
|
||||
}
|
||||
],
|
||||
"ledger_hash": "1EDBBA3C793863366DF5B31C2174B6B5E6DF6DB89A7212B86838489148E2A581",
|
||||
"ledger_index": 71766314,
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"channels": [
|
||||
{
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"amount": "1000",
|
||||
"balance": "0",
|
||||
"channel_id": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7",
|
||||
"destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"public_key": "aBR7mdD75Ycs8DRhMgQ4EMUEmBArF8SEh1hfjrT2V9DQTLNbJVqw",
|
||||
"public_key_hex": "03CFD18E689434F032A4E84C63E2A3A6472D684EAF4FD52CA67742F3E24BAE81B2",
|
||||
"settle_delay": 60
|
||||
}
|
||||
],
|
||||
"ledger_hash": "27F530E5C93ED5C13994812787C1ED073C822BAEC7597964608F2C049C2ACD2D",
|
||||
"ledger_index": 71766343,
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"channels": [
|
||||
{
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"amount": "1000",
|
||||
"balance": "0",
|
||||
"channel_id": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7",
|
||||
"destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"public_key": "aBR7mdD75Ycs8DRhMgQ4EMUEmBArF8SEh1hfjrT2V9DQTLNbJVqw",
|
||||
"public_key_hex": "03CFD18E689434F032A4E84C63E2A3A6472D684EAF4FD52CA67742F3E24BAE81B2",
|
||||
"settle_delay": 60
|
||||
}
|
||||
],
|
||||
"ledger_hash": "27F530E5C93ED5C13994812787C1ED073C822BAEC7597964608F2C049C2ACD2D",
|
||||
"ledger_index": 71766343,
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------------|:-------------------------|:---------------------------------|
|
||||
| `account` | String | The address of the source/owner of the payment channels. This corresponds to the `account` field of the request. |
|
||||
| `channels` | Array of Channel Objects | Payment channels owned by this `account`. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.5.0" %}Updated in: rippled 1.5.0{% /badge %} |
|
||||
| `ledger_hash` | String | _(May be omitted)_ The identifying [Hash][] of the ledger version used to generate this response. |
|
||||
| `ledger_index` | Number | The [Ledger Index][] of the ledger version used to generate this response. |
|
||||
| `validated` | Boolean | _(May be omitted)_ If `true`, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change. |
|
||||
| `limit` | Number | _(May be omitted)_ The limit to how many channel objects were actually returned by this request. |
|
||||
| `marker` | [Marker][] | _(May be omitted)_ Server-defined value for pagination. Pass this to the next call to resume getting results where this call left off. Omitted when there are no additional pages after this one. |
|
||||
|
||||
Each Channel Object has the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:----------------------|:-----------------|:----------------------------------|
|
||||
| `account` | String | The owner of the channel, as an [Address][]. |
|
||||
| `amount` | String | The total amount of [XRP, in drops][] allocated to this channel. |
|
||||
| `balance` | String | The total amount of [XRP, in drops][], paid out from this channel, as of the ledger version used. (You can calculate the amount of XRP left in the channel by subtracting `balance` from `amount`.) |
|
||||
| `channel_id` | String | A unique ID for this channel, as a 64-character hexadecimal string. This is also the [ID of the channel object](../../../protocol/ledger-data/ledger-entry-types/paychannel.md#paychannel-id-format) in the ledger's state data. |
|
||||
| `destination_account` | String | The destination account of the channel, as an [Address][]. Only this account can receive the XRP in the channel while it is open. |
|
||||
| `settle_delay` | Unsigned Integer | The number of seconds the payment channel must stay open after the owner of the channel requests to close it. |
|
||||
| `public_key` | String | _(May be omitted)_ The public key for the payment channel in the XRP Ledger's [base58][] format. Signed claims against this channel must be redeemed with the matching key pair. |
|
||||
| `public_key_hex` | String | _(May be omitted)_ The public key for the payment channel in hexadecimal format, if one was specified at channel creation. Signed claims against this channel must be redeemed with the matching key pair. |
|
||||
| `expiration` | Unsigned Integer | _(May be omitted)_ Time, in [seconds since the Ripple Epoch][], when this channel is set to expire. This expiration date is mutable. If this is before the close time of the most recent validated ledger, the channel is expired. |
|
||||
| `cancel_after` | Unsigned Integer | _(May be omitted)_ Time, in [seconds since the Ripple Epoch][], of this channel's immutable expiration, if one was specified at channel creation. If this is before the close time of the most recent validated ledger, the channel is expired. |
|
||||
| `source_tag` | Unsigned Integer | _(May be omitted)_ A 32-bit unsigned integer to use as a [source tag](../../../../concepts/transactions/source-and-destination-tags.md) for payments through this payment channel, if one was specified at channel creation. This indicates the payment channel's originator or other purpose at the source account. Conventionally, if you bounce payments from this channel, you should specify this value in the `DestinationTag` of the return payment. |
|
||||
| `destination_tag` | Unsigned Integer | _(May be omitted)_ A 32-bit unsigned integer to use as a [destination tag](../../../../concepts/transactions/source-and-destination-tags.md) for payments through this channel, if one was specified at channel creation. This indicates the payment channel's beneficiary or other purpose at the destination account. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `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 it does exist but the server does not have it.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,177 @@
|
||||
---
|
||||
html: account_currencies.html
|
||||
parent: account-methods.html
|
||||
seo:
|
||||
description: Get a list of currencies an account can send or receive.
|
||||
labels:
|
||||
- Tokens
|
||||
---
|
||||
# account_currencies
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/df966a9ac6dd986585ecccb206aff24452e41a30/src/ripple/rpc/handlers/AccountCurrencies.cpp "Source")
|
||||
|
||||
The `account_currencies` command retrieves a list of currencies that an account can send or receive, based on its trust lines. (This is not a thoroughly confirmed list, but it can be used to populate user interfaces.)
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"command": "account_currencies",
|
||||
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "account_currencies",
|
||||
"params": [
|
||||
{
|
||||
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"account_index": 0,
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: account_currencies account [ledger_index|ledger_hash]
|
||||
rippled account_currencies rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn validated
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#account_currencies)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Required? | Description |
|
||||
|:---------------|:---------------------|:----------|-------------|
|
||||
| `account` | String - [Address][] | Yes | Look up currencies this account can send or receive. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.11.0" %}Updated in: rippled 1.11.0{% /badge %} |
|
||||
| `ledger_hash` | String | No | A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | Number or String | No | The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
|
||||
The following fields are deprecated and should not be provided: `account_index`, `strict`.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"ledger_index": 11775844,
|
||||
"receive_currencies": [
|
||||
"BTC",
|
||||
"CNY",
|
||||
"DYM",
|
||||
"EUR",
|
||||
"JOE",
|
||||
"MXN",
|
||||
"USD",
|
||||
"015841551A748AD2C1F76FF6ECB0CCCD00000000"
|
||||
],
|
||||
"send_currencies": [
|
||||
"ASP",
|
||||
"BTC",
|
||||
"CHF",
|
||||
"CNY",
|
||||
"DYM",
|
||||
"EUR",
|
||||
"JOE",
|
||||
"JPY",
|
||||
"MXN",
|
||||
"USD"
|
||||
],
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
{
|
||||
"result": {
|
||||
"ledger_index": 11775823,
|
||||
"receive_currencies": [
|
||||
"BTC",
|
||||
"CNY",
|
||||
"DYM",
|
||||
"EUR",
|
||||
"JOE",
|
||||
"MXN",
|
||||
"USD",
|
||||
"015841551A748AD2C1F76FF6ECB0CCCD00000000"
|
||||
],
|
||||
"send_currencies": [
|
||||
"ASP",
|
||||
"BTC",
|
||||
"CHF",
|
||||
"CNY",
|
||||
"DYM",
|
||||
"EUR",
|
||||
"JOE",
|
||||
"JPY",
|
||||
"MXN",
|
||||
"USD"
|
||||
],
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"ledger_hash" : "F43A801ED4562FA744A35755B86BE898D91C5643BF499924EA3C69491B8C28D1",
|
||||
"ledger_index" : 56843649,
|
||||
"receive_currencies" : [ "USD" ],
|
||||
"send_currencies" : [ "NGN", "TRC" ],
|
||||
"status" : "success",
|
||||
"validated" : true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------------|:---------------------------|:-------------------------|
|
||||
| `ledger_hash` | String - [Hash][] | (May be omitted) The identifying hash of the ledger version used to retrieve this data, as hex. |
|
||||
| `ledger_index` | Integer - [Ledger Index][] | The ledger index of the ledger version used to retrieve this data. |
|
||||
| `receive_currencies` | Array of Strings | Array of [Currency Code][]s for currencies that this account can receive. |
|
||||
| `send_currencies` | Array of Strings | Array of [Currency Code][]s for currencies that this account can send. |
|
||||
| `validated` | Boolean | If `true`, this data comes from a validated ledger. |
|
||||
|
||||
**Note:** The currencies that an account can send or receive are defined based on a check of its trust lines. If an account has a trust line for a currency and enough room to increase its balance, it can receive that currency. If the trust line's balance can go down, the account can send that currency. This method _doesn't_ check whether the trust line is [frozen](../../../../concepts/tokens/fungible-tokens/freezes.md) or 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.
|
||||
* `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 it does exist but the server does not have it.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,262 @@
|
||||
---
|
||||
html: account_info.html
|
||||
parent: account-methods.html
|
||||
seo:
|
||||
description: Get basic data about an account.
|
||||
labels:
|
||||
- Accounts
|
||||
- XRP
|
||||
---
|
||||
# account_info
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/AccountInfo.cpp "Source")
|
||||
|
||||
The `account_info` command retrieves information about an account, its activity, and its XRP balance. All information retrieved is relative to a particular version of the ledger.
|
||||
|
||||
## Request Format
|
||||
|
||||
An example of an account_info request:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"command": "account_info",
|
||||
"account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
|
||||
"ledger_index": "current",
|
||||
"queue": true
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "account_info",
|
||||
"params": [
|
||||
{
|
||||
"account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
|
||||
"ledger_index": "current",
|
||||
"queue": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: account_info account [ledger_index|ledger_hash]
|
||||
rippled account_info rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn validated
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#account_info)
|
||||
|
||||
The request contains the following parameters:
|
||||
|
||||
| `Field` | Type | Required? | Description |
|
||||
|:---------------|:---------------------|:----------|-------------|
|
||||
| `account` | String - [Address][] | Yes | The account to look up. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.11.0" %}Updated in: rippled 1.11.0{% /badge %} |
|
||||
| `ledger_hash` | String | No | A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | Number or String | No | The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
| `queue` | Boolean | No | If `true`, return stats about [queued transactions](../../../../concepts/transactions/transaction-queue.md) sent by this account. Can only be used when querying for the data from the current open ledger. Not available from servers in [Reporting Mode][]. |
|
||||
| `signer_lists` | Boolean | No | [API v1][]: If `true`, return any [SignerList objects](../../../protocol/ledger-data/ledger-entry-types/signerlist.md) associated with this account.<br>[API v2][]: Identical to v1, but also returns an `invalidParams` error if you provide a non-boolean value. |
|
||||
|
||||
The following fields are deprecated and should not be provided: `ident`, `ledger`, `strict`.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 5,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"account_data": {
|
||||
"Account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
|
||||
"Balance": "999999999960",
|
||||
"Flags": 8388608,
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"OwnerCount": 0,
|
||||
"PreviousTxnID": "4294BEBE5B569A18C0A2702387C9B1E7146DC3A5850C1E87204951C6FDAA4C42",
|
||||
"PreviousTxnLgrSeq": 3,
|
||||
"Sequence": 6,
|
||||
"index": "92FA6A9FC8EA6018D5D16532D7795C91BFB0831355BDFDA177E86C8BF997985F"
|
||||
},
|
||||
"ledger_current_index": 4,
|
||||
"queue_data": {
|
||||
"auth_change_queued": true,
|
||||
"highest_sequence": 10,
|
||||
"lowest_sequence": 6,
|
||||
"max_spend_drops_total": "500",
|
||||
"transactions": [
|
||||
{
|
||||
"auth_change": false,
|
||||
"fee": "100",
|
||||
"fee_level": "2560",
|
||||
"max_spend_drops": "100",
|
||||
"seq": 6
|
||||
},
|
||||
... (trimmed for length) ...
|
||||
{
|
||||
"LastLedgerSequence": 10,
|
||||
"auth_change": true,
|
||||
"fee": "100",
|
||||
"fee_level": "2560",
|
||||
"max_spend_drops": "100",
|
||||
"seq": 10
|
||||
}
|
||||
],
|
||||
"txn_count": 5
|
||||
},
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"account_data": {
|
||||
"Account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
|
||||
"Balance": "999999999960",
|
||||
"Flags": 8388608,
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"OwnerCount": 0,
|
||||
"PreviousTxnID": "4294BEBE5B569A18C0A2702387C9B1E7146DC3A5850C1E87204951C6FDAA4C42",
|
||||
"PreviousTxnLgrSeq": 3,
|
||||
"Sequence": 6,
|
||||
"index": "92FA6A9FC8EA6018D5D16532D7795C91BFB0831355BDFDA177E86C8BF997985F"
|
||||
},
|
||||
"ledger_current_index": 4,
|
||||
"queue_data": {
|
||||
"auth_change_queued": true,
|
||||
"highest_sequence": 10,
|
||||
"lowest_sequence": 6,
|
||||
"max_spend_drops_total": "500",
|
||||
"transactions": [
|
||||
{
|
||||
"auth_change": false,
|
||||
"fee": "100",
|
||||
"fee_level": "2560",
|
||||
"max_spend_drops": "100",
|
||||
"seq": 6
|
||||
},
|
||||
... (trimmed for length) ...
|
||||
{
|
||||
"LastLedgerSequence": 10,
|
||||
"auth_change": true,
|
||||
"fee": "100",
|
||||
"fee_level": "2560",
|
||||
"max_spend_drops": "100",
|
||||
"seq": 10
|
||||
}
|
||||
],
|
||||
"txn_count": 5
|
||||
},
|
||||
"status": "success",
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"account_data" : {
|
||||
"Account" : "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
|
||||
"Balance" : "9986",
|
||||
"Flags" : 1114112,
|
||||
"LedgerEntryType" : "AccountRoot",
|
||||
"OwnerCount" : 0,
|
||||
"PreviousTxnID" : "0705FE3F52057924C288296EF0EBF668E0C1A3646FBA8FAF9B73DCC0A797B4B2",
|
||||
"PreviousTxnLgrSeq" : 51948740,
|
||||
"RegularKey" : "rhLkGGNZdjSpnHJw4XAFw1Jy7PD8TqxoET",
|
||||
"Sequence" : 192220,
|
||||
"index" : "92FA6A9FC8EA6018D5D16532D7795C91BFB0831355BDFDA177E86C8BF997985F"
|
||||
},
|
||||
"ledger_hash" : "8169428EDF7F046F817CE44F5F1DF23AD9FAEFFA2CBA7645C3254D66AA79B46E",
|
||||
"ledger_index" : 56843712,
|
||||
"status" : "success",
|
||||
"validated" : true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with the result containing the requested account, its data, and a ledger to which it applies, as the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------------|:--------|:------------------------------------------|
|
||||
| `account_data` | Object | The [AccountRoot ledger object](../../../protocol/ledger-data/ledger-entry-types/accountroot.md) with this account's information, as stored in the ledger. |
|
||||
| `account_flags` | Object | The account's flag statuses (see below), based on the `Flags` field of the account. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.11.0" %}New in: rippled 1.11.0{% /badge %} |
|
||||
| `signer_lists` | Array | [API v1][]: _(Omitted unless the request specified `signer_lists` and at least one SignerList is associated with the account.)_ Array of [SignerList ledger objects](../../../protocol/ledger-data/ledger-entry-types/signerlist.md) associated with this account for [Multi-Signing](../../../../concepts/accounts/multi-signing.md). Since an account can own at most one SignerList, this array must have exactly one member if it is present. The field is nested under `account_data`.<br>[API v2][]: Identical to API v1, but the field is returned in the root response instead. [Clio](https://github.com/XRPLF/clio) implements the API v2 behavior in all cases. |
|
||||
| `ledger_current_index` | Integer | _(Omitted if `ledger_index` is provided instead)_ The [ledger index][] of the current in-progress ledger, which was used when retrieving this information. |
|
||||
| `ledger_index` | Integer | _(Omitted if `ledger_current_index` is provided instead)_ The [ledger index][] of the ledger version used when retrieving this information. The information does not contain any changes from ledger versions newer than this one. |
|
||||
| `queue_data` | Object | _(Omitted unless `queue` specified as `true` and querying the current open ledger.)_ Information about [queued transactions](../../../../concepts/transactions/transaction-cost.md#queued-transactions) sent by this account. This information describes the state of the local `rippled` server, which may be different from other servers in the [peer-to-peer XRP Ledger network](../../../../concepts/networks-and-servers/peer-protocol.md). Some fields may be omitted because the values are calculated "lazily" by the queuing mechanism. |
|
||||
| `validated` | Boolean | True if this data is from a validated ledger version; if omitted or set to false, this data is not final. |
|
||||
|
||||
The `account_flags` field contains the following nested fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------------|:--------|:------------------------------------------|
|
||||
| `defaultRipple` | Boolean | If `true`, the account allows [rippling](../../../../concepts/tokens/fungible-tokens/rippling.md) on its trust lines by default. |
|
||||
| `depositAuth` | Boolean | If `true`, the account is using [Deposit Authorization](../../../../concepts/accounts/depositauth.md) and does not accept any payments from unknown parties. |
|
||||
| `disableMasterKey` | Boolean | If `true`, the account's [master key pair](../../../../concepts/accounts/cryptographic-keys.md) is disabled. |
|
||||
| `disallowIncomingCheck` | Boolean | If `true`, the account does not allow others to send [Checks](../../../../concepts/payment-types/checks.md) to it. _(Requires the [DisallowIncoming amendment][])_ |
|
||||
| `disallowIncomingNFTokenOffer` | Boolean | If `true`, the account does not allow others to make [NFT buy or sell offers](../../../../concepts/tokens/nfts/trading.md) to it. _(Requires the [DisallowIncoming amendment][])_ |
|
||||
| `disallowIncomingPayChan` | Boolean | If `true`, the account does not allow others to make [Payment Channels](../../../../concepts/payment-types/payment-channels.md) to it. _(Requires the [DisallowIncoming amendment][])_ |
|
||||
| `disallowIncomingTrustline` | Boolean | If `true`, the account does not allow others to make [trust lines](../../../../concepts/tokens/fungible-tokens/index.md) to it. _(Requires the [DisallowIncoming amendment][])_ |
|
||||
| `disallowIncomingXRP` | Boolean | If `true`, the account does not want to receive XRP from others. (This is advisory, and not enforced at a protocol level.) |
|
||||
| `globalFreeze` | Boolean | If `true`, all tokens issued by the account are currently frozen. |
|
||||
| `noFreeze` | Boolean | If `true`, the account has permanently given up the abilities to freeze individual trust lines or end a global freeze. See [No Freeze](../../../../concepts/tokens/fungible-tokens/freezes.md#no-freeze) for details. |
|
||||
| `passwordSpent` | Boolean | If `false`, the account can send a special [key reset transaction](../../../../concepts/transactions/transaction-cost.md#key-reset-transaction) with a transaction cost of 0. The protocol turns this flag on and off automatically; it is not controlled by a user-facing setting. |
|
||||
| `requireAuthorization` | Boolean | If `true`, the account is using [Authorized Trust Lines](../../../../concepts/tokens/fungible-tokens/authorized-trust-lines.md) to limit who can hold the tokens it issues. |
|
||||
| `requireDestinationTag` | Boolean | If `true`, the account [requires a destination tag](../../../../tutorials/manage-account-settings/require-destination-tags.md) on all payments it receives. |
|
||||
|
||||
The `queue_data` field, if present, contains the following nested fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------------|:--------|:-----------------------------------------|
|
||||
| `txn_count` | Integer | Number of queued transactions from this address. |
|
||||
| `auth_change_queued` | Boolean | (May be omitted) Whether a transaction in the queue changes this address's [ways of authorizing transactions](../../../../concepts/transactions/index.md#authorizing-transactions). If `true`, this address can queue no further transactions until that transaction has been executed or dropped from the queue. |
|
||||
| `lowest_sequence` | Integer | (May be omitted) The lowest [Sequence Number][] among transactions queued by this address. |
|
||||
| `highest_sequence` | Integer | (May be omitted) The highest [Sequence Number][] among transactions queued by this address. |
|
||||
| `max_spend_drops_total` | String | (May be omitted) Integer amount of [drops of XRP][] that could be debited from this address if every transaction in the queue consumes the maximum amount of XRP possible. |
|
||||
| `transactions` | Array | (May be omitted) Information about each queued transaction from this address. |
|
||||
|
||||
Each object in the `transactions` array of `queue_data`, if present, may contain any or all of the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------|:--------|:-----------------------------------------------|
|
||||
| `auth_change` | Boolean | Whether this transaction changes this address's [ways of authorizing transactions](../../../../concepts/transactions/index.md#authorizing-transactions). |
|
||||
| `fee` | String | The [Transaction Cost](../../../../concepts/transactions/transaction-cost.md) of this transaction, in [drops of XRP][]. |
|
||||
| `fee_level` | String | The transaction cost of this transaction, relative to the minimum cost for this type of transaction, in [fee levels][]. |
|
||||
| `max_spend_drops` | String | The maximum amount of [XRP, in drops][], this transaction could send or destroy. |
|
||||
| `seq` | Integer | The [Sequence Number][] of this transaction. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing. For example, the request specified `queue` as `true` but specified a `ledger_index` that is not the current open ledger.
|
||||
* `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 it does exist but the server does not have it.
|
||||
|
||||
[fee levels]: ../../../../concepts/transactions/transaction-cost.md#fee-levels
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,449 @@
|
||||
---
|
||||
html: account_lines.html
|
||||
parent: account-methods.html
|
||||
seo:
|
||||
description: Get info about an account's trust lines.
|
||||
labels:
|
||||
- Tokens
|
||||
---
|
||||
# account_lines
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/AccountLines.cpp "Source")
|
||||
|
||||
The `account_lines` method returns information about an account's trust lines, which contain balances in all non-XRP currencies and assets. All information retrieved is relative to a particular version of the ledger.
|
||||
|
||||
## Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "account_lines",
|
||||
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "account_lines",
|
||||
"params": [
|
||||
{
|
||||
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: account_lines <account> [<peer>] [<ledger_index>|<ledger_hash>]
|
||||
rippled account_lines r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#account_lines)
|
||||
|
||||
The request accepts the following parameters: /Users/peterchen/xrpl-dev-portal/content/references/http-websocket-apis/public-api-methods/account-methods/account_lines.md
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------|:---------------|
|
||||
| `account` | String - [Address][] | Look up trust lines connected to this account. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | Number or String | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
| `peer` | String - [Address][] | _(Optional)_ A second account; if provided, filter results to trust lines connecting the two accounts. |
|
||||
| `limit` | Number | _(Optional)_ Limit the number of trust lines to retrieve. The server may return less than the specified limit, even if there are more pages of results. 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. |
|
||||
| `marker` | [Marker][] | _(Optional)_ Value from a previous paginated response. Resume retrieving data where that response left off. |
|
||||
|
||||
The following parameters are deprecated and may be removed without further notice: `ledger` and `peer_index`.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"lines": [
|
||||
{
|
||||
"account": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"balance": "0",
|
||||
"currency": "ASP",
|
||||
"limit": "0",
|
||||
"limit_peer": "10",
|
||||
"quality_in": 0,
|
||||
"quality_out": 0
|
||||
},
|
||||
{
|
||||
"account": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"balance": "0",
|
||||
"currency": "XAU",
|
||||
"limit": "0",
|
||||
"limit_peer": "0",
|
||||
"no_ripple": true,
|
||||
"no_ripple_peer": true,
|
||||
"quality_in": 0,
|
||||
"quality_out": 0
|
||||
},
|
||||
{
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"balance": "3.497605752725159",
|
||||
"currency": "USD",
|
||||
"limit": "5",
|
||||
"limit_peer": "0",
|
||||
"no_ripple": true,
|
||||
"quality_in": 0,
|
||||
"quality_out": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"lines": [
|
||||
{
|
||||
"account": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"balance": "0",
|
||||
"currency": "ASP",
|
||||
"limit": "0",
|
||||
"limit_peer": "10",
|
||||
"quality_in": 0,
|
||||
"quality_out": 0
|
||||
},
|
||||
{
|
||||
"account": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"balance": "0",
|
||||
"currency": "XAU",
|
||||
"limit": "0",
|
||||
"limit_peer": "0",
|
||||
"no_ripple": true,
|
||||
"no_ripple_peer": true,
|
||||
"quality_in": 0,
|
||||
"quality_out": 0
|
||||
},
|
||||
{
|
||||
"account": "rs9M85karFkCRjvc6KMWn8Coigm9cbcgcx",
|
||||
"balance": "0",
|
||||
"currency": "015841551A748AD2C1F76FF6ECB0CCCD00000000",
|
||||
"limit": "10.01037626125837",
|
||||
"limit_peer": "0",
|
||||
"no_ripple": true,
|
||||
"quality_in": 0,
|
||||
"quality_out": 0
|
||||
}
|
||||
],
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"account" : "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"ledger_current_index" : 56867265,
|
||||
"lines" : [
|
||||
{
|
||||
"account" : "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"balance" : "0",
|
||||
"currency" : "ASP",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "10",
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"balance" : "0",
|
||||
"currency" : "XAU",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"no_ripple_peer" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"balance" : "5",
|
||||
"currency" : "USD",
|
||||
"limit" : "5",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rHpXfibHgSb64n8kK9QWDpdbfqSpYbM9a4",
|
||||
"balance" : "481.992867407479",
|
||||
"currency" : "MXN",
|
||||
"limit" : "1000",
|
||||
"limit_peer" : "0",
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"balance" : "0.793598266778297",
|
||||
"currency" : "EUR",
|
||||
"limit" : "1",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rnuF96W4SZoCJmbHYBFoJZpR8eCaxNvekK",
|
||||
"balance" : "0",
|
||||
"currency" : "CNY",
|
||||
"limit" : "3",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rGwUWgN5BEg3QGNY3RX2HfYowjUTZdid3E",
|
||||
"balance" : "1.336889190631542",
|
||||
"currency" : "DYM",
|
||||
"limit" : "3",
|
||||
"limit_peer" : "0",
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"balance" : "0.3488146605801446",
|
||||
"currency" : "CHF",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "0",
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"balance" : "0",
|
||||
"currency" : "BTC",
|
||||
"limit" : "3",
|
||||
"limit_peer" : "0",
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"balance" : "11.68225001668339",
|
||||
"currency" : "USD",
|
||||
"limit" : "5000",
|
||||
"limit_peer" : "0",
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rpgKWEmNqSDAGFhy5WDnsyPqfQxbWxKeVd",
|
||||
"balance" : "-0.00111",
|
||||
"currency" : "BTC",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "10",
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rBJ3YjwXi2MGbg7GVLuTXUWQ8DjL7tDXh4",
|
||||
"balance" : "-0.0008744482690504699",
|
||||
"currency" : "BTC",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "10",
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"balance" : "0",
|
||||
"currency" : "USD",
|
||||
"limit" : "1",
|
||||
"limit_peer" : "0",
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "razqQKzJRdB4UxFPWf5NEpEG3WMkmwgcXA",
|
||||
"balance" : "9.07619790068559",
|
||||
"currency" : "CNY",
|
||||
"limit" : "100",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"balance" : "7.292695098901099",
|
||||
"currency" : "JPY",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"balance" : "0",
|
||||
"currency" : "AUX",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"no_ripple_peer" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X",
|
||||
"balance" : "0.0004557360418801623",
|
||||
"currency" : "USD",
|
||||
"limit" : "1",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"balance" : "12.41688780720394",
|
||||
"currency" : "EUR",
|
||||
"limit" : "100",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rfF3PNkwkq1DygW2wum2HK3RGfgkJjdPVD",
|
||||
"balance" : "35",
|
||||
"currency" : "USD",
|
||||
"limit" : "500",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rwUVoVMSURqNyvocPCcvLu3ygJzZyw8qwp",
|
||||
"balance" : "-5",
|
||||
"currency" : "JOE",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "50",
|
||||
"no_ripple_peer" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rE6R3DWF9fBD7CyiQciePF9SqK58Ubp8o2",
|
||||
"balance" : "0",
|
||||
"currency" : "USD",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "100",
|
||||
"no_ripple_peer" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rE6R3DWF9fBD7CyiQciePF9SqK58Ubp8o2",
|
||||
"balance" : "0",
|
||||
"currency" : "JOE",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "100",
|
||||
"no_ripple_peer" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rs9M85karFkCRjvc6KMWn8Coigm9cbcgcx",
|
||||
"balance" : "0",
|
||||
"currency" : "015841551A748AD2C1F76FF6ECB0CCCD00000000",
|
||||
"limit" : "10.01037626125837",
|
||||
"limit_peer" : "0",
|
||||
"no_ripple" : true,
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
},
|
||||
{
|
||||
"account" : "rEhDDUUNxpXgEHVJtC2cjXAgyx5VCFxdMF",
|
||||
"balance" : "0",
|
||||
"currency" : "USD",
|
||||
"limit" : "0",
|
||||
"limit_peer" : "1",
|
||||
"quality_in" : 0,
|
||||
"quality_out" : 0
|
||||
}
|
||||
],
|
||||
"status" : "success",
|
||||
"validated" : false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the address of the account and an array of trust line objects. Specifically, the result object contains the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------------|:---------------------------|:-----------------------|
|
||||
| `account` | String | Unique [Address][] of the account this request corresponds to. This is the "perspective account" for purpose of the trust lines. |
|
||||
| `lines` | Array | Array of trust line objects, as described below. If the number of trust lines is large, only returns up to the `limit` at a time. |
|
||||
| `ledger_current_index` | Integer - [Ledger Index][] | _(Omitted if `ledger_hash` or `ledger_index` provided)_ The ledger index of the current open ledger, which was used when retrieving this information. |
|
||||
| `ledger_index` | Integer - [Ledger Index][] | _(Omitted if `ledger_current_index` provided instead)_ The ledger index of the ledger version that was used when retrieving this data. |
|
||||
| `ledger_hash` | String - [Hash][] | _(May be omitted)_ The identifying hash the ledger version that was used when retrieving this data. |
|
||||
| `marker` | [Marker][] | Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. Omitted when there are no additional pages after this one. |
|
||||
|
||||
Each trust line object has some combination of the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------|:-----------------|:---------------------------------------|
|
||||
| `account` | String | The unique [Address][] of the counterparty to this trust line. |
|
||||
| `balance` | String | Representation of the numeric balance currently held against this line. A positive balance means that the perspective account holds value; a negative balance means that the perspective account owes value. |
|
||||
| `currency` | String | A [Currency Code][] identifying what currency this trust line can hold. |
|
||||
| `limit` | String | The maximum amount of the given currency that this account is willing to owe the peer account |
|
||||
| `limit_peer` | String | The maximum amount of currency that the counterparty account is willing to owe the perspective account |
|
||||
| `quality_in` | Unsigned Integer | Rate at which the account values incoming balances on this trust line, as a ratio of this value per 1 billion units. (For example, a value of 500 million represents a 0.5:1 ratio.) As a special case, 0 is treated as a 1:1 ratio. |
|
||||
| `quality_out` | Unsigned Integer | Rate at which the account values outgoing balances on this trust line, as a ratio of this value per 1 billion units. (For example, a value of 500 million represents a 0.5:1 ratio.) As a special case, 0 is treated as a 1:1 ratio. |
|
||||
| `no_ripple` | Boolean | _(May be omitted)_ If `true`, this account has enabled the [No Ripple flag](../../../../concepts/tokens/fungible-tokens/rippling.md) for this trust line. If present and `false`, this account has disabled the No Ripple flag, but, because the account also has the Default Ripple flag disabled, that is not considered [the default state](../../../protocol/ledger-data/ledger-entry-types/ripplestate.md#contributing-to-the-owner-reserve). If omitted, the account has the No Ripple flag disabled for this trust line and Default Ripple enabled. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.7.0" %}Updated in: rippled 1.7.0{% /badge %} |
|
||||
| `no_ripple_peer` | Boolean | _(May be omitted)_ If `true`, the peer account has enabled the [No Ripple flag](../../../../concepts/tokens/fungible-tokens/rippling.md) for this trust line. If present and `false`, this account has disabled the No Ripple flag, but, because the account also has the Default Ripple flag disabled, that is not considered [the default state](../../../protocol/ledger-data/ledger-entry-types/ripplestate.md#contributing-to-the-owner-reserve). If omitted, the account has the No Ripple flag disabled for this trust line and Default Ripple enabled. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.7.0" %}Updated in: rippled 1.7.0{% /badge %} |
|
||||
| `authorized` | Boolean | _(May be omitted)_ If `true`, this account has [authorized this trust line](../../../../concepts/tokens/fungible-tokens/authorized-trust-lines.md). The default is `false`. |
|
||||
| `peer_authorized`| Boolean | _(May be omitted)_ If `true`, the peer account has [authorized this trust line](../../../../concepts/tokens/fungible-tokens/authorized-trust-lines.md). The default is `false`. |
|
||||
| `freeze` | Boolean | _(May be omitted)_ If `true`, this account has [frozen](../../../../concepts/tokens/fungible-tokens/freezes.md) this trust line. The default is `false`. |
|
||||
| `freeze_peer` | Boolean | _(May be omitted)_ If `true`, the peer account has [frozen](../../../../concepts/tokens/fungible-tokens/freezes.md) this trust line. The default is `false`. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `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 it does exist but the server does not have it.
|
||||
* `actMalformed` - If the `marker` field provided is not acceptable.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,163 @@
|
||||
---
|
||||
html: account_nfts.html
|
||||
parent: account-methods.html
|
||||
seo:
|
||||
description: Get a list of all NFTs for an account.
|
||||
labels:
|
||||
- Non-fungible Tokens, NFTs
|
||||
---
|
||||
# account_nfts
|
||||
[[Source]](https://github.com/xrplf/rippled/blob/master/src/ripple/rpc/handlers/AccountObjects.cpp "Source")
|
||||
|
||||
The `account_nfts` method returns a list of `NFToken` objects for the specified account.
|
||||
|
||||
_(Added by the [NonFungibleTokensV1_1 amendment][].)_
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% raw-partial file="/_snippets/no-cli-syntax.md" /%}
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"command": "account_nfts",
|
||||
"account": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "account_nfts",
|
||||
"params": [{
|
||||
"account": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx",
|
||||
"ledger_index": "validated"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#account_nfts)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------------|:-----------------|:-----------------------------------------|
|
||||
| `account` | String | The unique identifier of an account, typically the account's [Address][]. The request returns a list of NFTs owned by this account. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Number | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
| `limit` | Integer | _(Optional)_ Limit the number of [token pages][NFTokenPage object] to retrieve. Each page can contain up to 32 NFTs. The `limit` value cannot be lower than 20 or more than 400. Positive values outside this range are replaced with the closest valid option. The default is 100. |
|
||||
| `marker` | [Marker][] | _(Optional)_ Value from a previous paginated response. Resume retrieving data where that response left off. |
|
||||
|
||||
|
||||
## Response Format
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"account": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx",
|
||||
"account_nfts": [
|
||||
{
|
||||
"Flags": 1,
|
||||
"Issuer": "rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm",
|
||||
"NFTokenID": "00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE0875B974D9F00000004",
|
||||
"NFTokenTaxon": 0,
|
||||
"URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469",
|
||||
"nft_serial": 4
|
||||
},
|
||||
{
|
||||
"Flags": 1,
|
||||
"Issuer": "rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm",
|
||||
"NFTokenID": "00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE087727D1EA000000005",
|
||||
"NFTokenTaxon": 0,
|
||||
"URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469",
|
||||
"nft_serial": 5
|
||||
}
|
||||
],
|
||||
"ledger_hash": "7971093E67341E325251268A5B7CD665EF450B126F67DF8384D964DF834961E8",
|
||||
"ledger_index": 2380540,
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"account": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx",
|
||||
"account_nfts": [
|
||||
{
|
||||
"Flags": 1,
|
||||
"Issuer": "rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm",
|
||||
"NFTokenID": "00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE0875B974D9F00000004",
|
||||
"NFTokenTaxon": 0,
|
||||
"URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469",
|
||||
"nft_serial": 4
|
||||
},
|
||||
{
|
||||
"Flags": 1,
|
||||
"Issuer": "rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm",
|
||||
"NFTokenID": "00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE087727D1EA000000005",
|
||||
"NFTokenTaxon": 0,
|
||||
"URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469",
|
||||
"nft_serial": 5
|
||||
}
|
||||
],
|
||||
"ledger_hash": "46497E9FF17A993324F1A0A693DC068B467184023C7FD162812265EAAFEB97CB",
|
||||
"ledger_index": 2380559,
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:-----------------|:-----------------------------------------|
|
||||
| `account` | String | The account that owns the list of NFTs. |
|
||||
| `account_nfts` | Array | A list of NFTs owned by the account, formatted as **NFT Objects** (see below). |
|
||||
| `ledger_hash` | String | _(May be omitted)_ The identifying hash of the ledger that was used to generate this response. |
|
||||
| `ledger_index` | Number - [Ledger Index][] | _(May be omitted)_ The ledger index of the ledger that was used to generate this response. |
|
||||
| `ledger_current_index` | Number - [Ledger Index][] | _(May be omitted)_ The ledger index of the current in-progress ledger version, which was used to generate this response. |
|
||||
| `validated` | Boolean | If included and set to `true`, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change. |
|
||||
|
||||
### NFT Objects
|
||||
|
||||
Each object in the `account_nfts` array represents one [NFToken][] and has the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------|:-------------------------------------|
|
||||
| `Flags` | Number | A bit-map of boolean flags enabled for this NFToken. See [NFToken Flags](../../../protocol/data-types/nftoken.md#nftoken-flags) for possible values. |
|
||||
| `Issuer` | String - [Address][] | The account that issued this NFToken. |
|
||||
| `NFTokenID` | String | The unique identifier of this NFToken, in hexadecimal. |
|
||||
| `NFTokenTaxon` | Number | The unscrambled version of this token's [taxon](../../../protocol/data-types/nftoken.md#nftokentaxon). Several tokens with the same taxon might represent instances of a limited series. |
|
||||
| `URI` | String | The URI data associated with this NFToken, in hexadecimal. |
|
||||
| `nft_serial` | Number | The token sequence number of this NFToken, which is unique for its issuer. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `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 it does exist but the server does not have it.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,221 @@
|
||||
---
|
||||
html: account_offers.html
|
||||
parent: account-methods.html
|
||||
seo:
|
||||
description: Get info about an account's currency exchange offers.
|
||||
labels:
|
||||
- Decentralized Exchange
|
||||
---
|
||||
# account_offers
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/AccountOffers.cpp "Source")
|
||||
|
||||
The `account_offers` method retrieves a list of [offers](../../../../concepts/tokens/decentralized-exchange/offers.md) made by a given [account](../../../../concepts/accounts/accounts.md) that are outstanding as of a particular [ledger version](../../../../concepts/ledgers/index.md).
|
||||
|
||||
## Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 9,
|
||||
"command": "account_offers",
|
||||
"account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "account_offers",
|
||||
"params": [
|
||||
{
|
||||
"account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: account_offers account [ledger_index]
|
||||
rippled account_offers rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM current
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#account_offers)
|
||||
|
||||
A request can include the following parameters:
|
||||
|
||||
| Field | Type | Required? | Description |
|
||||
|:---------------|:---------------------|:----------|-------------|
|
||||
| `account` | String - [Address][] | Yes | Look up Offers placed by this account. |
|
||||
| `ledger_hash` | [Hash][] | No | A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `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][]) |
|
||||
| `limit` | Number | No | Limit the number of Offers to retrieve. The server may return fewer than this number of results. 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. |
|
||||
| `marker` | [Marker][] | No | Value from a previous paginated response. Resume retrieving data where that response left off. |
|
||||
|
||||
The following parameters are deprecated should not be provided: `ledger`, `strict`.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 9,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM",
|
||||
"ledger_current_index": 18539550,
|
||||
"offers": [
|
||||
{
|
||||
"flags": 0,
|
||||
"quality": "0.00000000574666765650638",
|
||||
"seq": 6577664,
|
||||
"taker_gets": "33687728098",
|
||||
"taker_pays": {
|
||||
"currency": "EUR",
|
||||
"issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
|
||||
"value": "193.5921774819578"
|
||||
}
|
||||
},
|
||||
{
|
||||
"flags": 0,
|
||||
"quality": "7989247009094510e-27",
|
||||
"seq": 6572128,
|
||||
"taker_gets": "2361918758",
|
||||
"taker_pays": {
|
||||
"currency": "XAU",
|
||||
"issuer": "rrh7rf1gV2pXAoqA8oYbpHd8TKv5ZQeo67",
|
||||
"value": "0.01886995237307572"
|
||||
}
|
||||
},
|
||||
... trimmed for length ...
|
||||
],
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM",
|
||||
"ledger_current_index": 18539596,
|
||||
"offers": [{
|
||||
"flags": 0,
|
||||
"quality": "0.000000007599140009999998",
|
||||
"seq": 6578020,
|
||||
"taker_gets": "29740867287",
|
||||
"taker_pays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"value": "226.0050145327418"
|
||||
}
|
||||
}, {
|
||||
"flags": 0,
|
||||
"quality": "7989247009094510e-27",
|
||||
"seq": 6572128,
|
||||
"taker_gets": "2361918758",
|
||||
"taker_pays": {
|
||||
"currency": "XAU",
|
||||
"issuer": "rrh7rf1gV2pXAoqA8oYbpHd8TKv5ZQeo67",
|
||||
"value": "0.01886995237307572"
|
||||
}
|
||||
}, {
|
||||
"flags": 0,
|
||||
"quality": "0.00000004059594001318974",
|
||||
"seq": 6576905,
|
||||
"taker_gets": "3892952574",
|
||||
"taker_pays": {
|
||||
"currency": "CNY",
|
||||
"issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value": "158.0380691682966"
|
||||
}
|
||||
},
|
||||
|
||||
...
|
||||
|
||||
],
|
||||
"status": "success",
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"account" : "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM",
|
||||
"ledger_current_index" : 57110969,
|
||||
"offers" : [
|
||||
{
|
||||
"flags" : 0,
|
||||
"quality" : "1499850014.892974",
|
||||
"seq" : 7916201,
|
||||
"taker_gets" : {
|
||||
"currency" : "BCH",
|
||||
"issuer" : "rcyS4CeCZVYvTiKcxj6Sx32ibKwcDHLds",
|
||||
"value" : "0.5268598580881351"
|
||||
},
|
||||
"taker_pays" : "790210766"
|
||||
}
|
||||
],
|
||||
"status" : "success",
|
||||
"validated" : false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------------|:--------------------------|:------------------------|
|
||||
| `account` | String | Unique [Address][] identifying the account that made the offers |
|
||||
| `offers` | Array | Array of objects, where each object represents an offer made by this account that is outstanding as of the requested ledger version. If the number of offers is large, only returns up to `limit` at a time. |
|
||||
| `ledger_current_index` | Number - [Ledger Index][] | _(Omitted if `ledger_hash` or `ledger_index` provided)_ The ledger index of the current in-progress ledger version, which was used when retrieving this data. |
|
||||
| `ledger_index` | Number - [Ledger Index][] | _(Omitted if `ledger_current_index` provided instead)_ The ledger index of the ledger version that was used when retrieving this data, as requested. |
|
||||
| `ledger_hash` | String - [Hash][] | _(May be omitted)_ The identifying hash of the ledger version that was used when retrieving this data. |
|
||||
| `marker` | [Marker][] | _(May be omitted)_ Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. Omitted when there are no pages of information after this one. |
|
||||
|
||||
|
||||
Each offer object contains the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------|:-----------------|:-------------------------------------------|
|
||||
| `flags` | Unsigned integer | Options set for this offer entry as bit-flags. |
|
||||
| `seq` | Unsigned integer | Sequence number of the transaction that created this entry. (Transaction [sequence numbers](../../../protocol/data-types/basic-data-types.md#account-sequence) are relative to accounts.) |
|
||||
| `taker_gets` | String or Object | The amount the account accepting the offer receives, as a String representing an amount in XRP, or a currency specification object. (See [Specifying Currency Amounts][Currency Amount]) |
|
||||
| `taker_pays` | String or Object | The amount the account accepting the offer provides, as a String representing an amount in XRP, or a currency specification object. (See [Specifying Currency Amounts][Currency Amount]) |
|
||||
| `quality` | String | The exchange rate of the offer, as the ratio of the original `taker_pays` divided by the original `taker_gets`. When executing offers, the offer with the most favorable (lowest) quality is consumed first; offers with the same quality are executed from oldest to newest. |
|
||||
| `expiration` | Unsigned integer | (May be omitted) A time after which this offer is considered unfunded, as the number of [seconds since the Ripple Epoch][]. See also: [Offer Expiration](../../../../concepts/tokens/decentralized-exchange/offers.md#offer-expiration). |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `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 it does exist but the server does not have it.
|
||||
* `actMalformed` - The `marker` field provided is incorrect.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,464 @@
|
||||
---
|
||||
html: account_tx.html
|
||||
parent: account-methods.html
|
||||
seo:
|
||||
description: Get a list of transactions affecting an account.
|
||||
labels:
|
||||
- Payments
|
||||
- Accounts
|
||||
---
|
||||
# account_tx
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/AccountTx.cpp "Source")
|
||||
|
||||
The `account_tx` method retrieves a list of validated transactions that involve a given account.
|
||||
|
||||
## Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"command": "account_tx",
|
||||
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"ledger_index_min": -1,
|
||||
"ledger_index_max": -1,
|
||||
"binary": false,
|
||||
"limit": 2,
|
||||
"forward": false
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "account_tx",
|
||||
"params": [
|
||||
{
|
||||
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"binary": false,
|
||||
"forward": false,
|
||||
"ledger_index_max": -1,
|
||||
"ledger_index_min": -1,
|
||||
"limit": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
# Syntax: account_tx account [ledger_index_min [ledger_index_max]] [limit] [offset] [binary] [count] [descending]
|
||||
# For binary/count/descending, use the parameter name for true and omit for false.
|
||||
rippled -- account_tx rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w -1 -1 2 0 binary descending
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#account_tx)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------------|:-------------------------------------------|:-----------|
|
||||
| `account` | String | A unique identifier for the account, most commonly the account's address. |
|
||||
| `tx_type` | String | _(Optional)_ **Clio Only** Return only transactions of a specific type, such as "Clawback", "AccountSet", "AccountDelete", et al. Case-insensitive. Supports any transaction type except `AMM*` (See [Transaction Types](../../../protocol/transactions/types/index.md).) {% badge href="https://github.com/XRPLF/clio/releases/tag/2.0.0" %}New in: Clio v2.0{% /badge %} |
|
||||
| `ledger_index_min` | Integer | [API v1][]: _(Optional)_ Use to specify the earliest ledger to include transactions from. A value of `-1` instructs the server to use the earliest validated ledger version available.<br>[API v2][]: Identical to v1, but also returns a `lgrIdxMalformed` error if a value is specified beyond the range of ledgers the server has. |
|
||||
| `ledger_index_max` | Integer | [API v1][]: _(Optional)_ Use to specify the most recent ledger to include transactions from. A value of `-1` instructs the server to use the most recent validated ledger version available.<br>[API v2][]: Identical to v1, but also returns a `lgrIdxMalformed` error if a value is specified beyond the range of ledgers the server has. |
|
||||
| `ledger_hash` | String | _(Optional)_ Use to look for transactions from a single ledger only. (See [Specifying Ledgers][].) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ Use to look for transactions from a single ledger only. (See [Specifying Ledgers][].) |
|
||||
| `binary` | Boolean | [API v1][]: _(Optional)_ Defaults to `false`. If set to `true`, returns transactions as hex strings instead of JSON.<br>[API v2][]: Identical to v1, but also returns an `invalidParams` error if you provide a non-boolean value. |
|
||||
| `forward` | Boolean | [API v1][]: _(Optional)_ Defaults to `false`. If set to `true`, returns values indexed with the oldest ledger first. Otherwise, the results are indexed with the newest ledger first. (Each page of results may not be internally ordered, but the pages are overall ordered.)<br>[API v2][]: Identical to v1, but also returns an `invalidParams` error if you provide a non-boolean value. |
|
||||
| `limit` | Integer | _(Optional)_ Default varies. Limit the number of transactions to retrieve. The server is not required to honor this value. |
|
||||
| `marker` | [Marker][] | Value from a previous paginated response. Resume retrieving data where that response left off. This value is stable even if there is a change in the server's range of available ledgers. |
|
||||
|
||||
- You must use at least one of the following fields in your request: `ledger_index`, `ledger_hash`, `ledger_index_min`, or `ledger_index_max`.
|
||||
- [API v2]: If you specify either `ledger_index` or `ledger_hash`, including `ledger_index_min` and `ledger_index_max` returns an `invalidParams` error.
|
||||
|
||||
|
||||
### Iterating over queried data
|
||||
|
||||
As with other paginated methods, you can use the `marker` field to return multiple pages of data.
|
||||
|
||||
In the time between requests, `"ledger_index_min": -1` and `"ledger_index_max": -1` may change to refer to different ledger versions than they did before. The `marker` field can safely paginate even if there are changes in the ledger range from the request, so long as the marker does not indicate a point outside the range of ledgers specified in the request.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"result": {
|
||||
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"ledger_index_max": 57111999,
|
||||
"ledger_index_min": 55886305,
|
||||
"limit": 2,
|
||||
"marker": {
|
||||
"ledger": 57111981,
|
||||
"seq": 16
|
||||
},
|
||||
"transactions": [
|
||||
{
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"Balance": "3732969177079",
|
||||
"Flags": 131072,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 702817
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "140FA03FE8C39540CA8189BC7A7956795C712BC0A542C6409C041150703C8574",
|
||||
"PreviousFields": {
|
||||
"Balance": "3713891690008"
|
||||
},
|
||||
"PreviousTxnID": "D58864C16344ADCC15995C7986CFC607CB693E88F84D2E019F0A35FB29749202",
|
||||
"PreviousTxnLgrSeq": 57111994
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg",
|
||||
"Balance": "40010160",
|
||||
"Flags": 131072,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 466334
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "CC20FEBEA6D2AF969EC46F2BD92684D9FBABC3F238E841B5E056FE4EBF4379A9",
|
||||
"PreviousFields": {
|
||||
"Balance": "19117497271",
|
||||
"Sequence": 466333
|
||||
},
|
||||
"PreviousTxnID": "F6B8274D3D419A95A59681E5F55578084C395FF9051924360CA3EA745F5581E8",
|
||||
"PreviousTxnLgrSeq": 57111993
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 25,
|
||||
"TransactionResult": "tesSUCCESS",
|
||||
"delivered_amount": "19077487071"
|
||||
},
|
||||
"tx": {
|
||||
"Account": "rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg",
|
||||
"Amount": "19077487071",
|
||||
"Destination": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"DestinationTag": 1,
|
||||
"Fee": "40",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57112020,
|
||||
"Sequence": 466333,
|
||||
"SigningPubKey": "0381575032E254BF4D699C3D8D6EFDB63B3A71F97475C6F6885BC7DAEEE55D9A01",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022100CFC5FD057C7C685C690637AD1E639E2642BBC00EFD8E06E3F6C72FA924BC99D40220317D0708E814F69F874D641B6732E37A53B1220B493B2B8390D9EF51E8062515",
|
||||
"date": 649200260,
|
||||
"hash": "46BF0B576677B0DEA2D94591424A57A2DE8E3D89383631E16F40D09A513C656C",
|
||||
"inLedger": 57111998,
|
||||
"ledger_index": 57111998
|
||||
},
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"Balance": "3713891690008",
|
||||
"Flags": 131072,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 702817
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "140FA03FE8C39540CA8189BC7A7956795C712BC0A542C6409C041150703C8574",
|
||||
"PreviousFields": {
|
||||
"Balance": "3714441690048",
|
||||
"Sequence": 702816
|
||||
},
|
||||
"PreviousTxnID": "FDD5007913B39027BAF10B31144DBC1F7DC147528DF31FF048A06DC5D3108BD6",
|
||||
"PreviousTxnLgrSeq": 57111981
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "r9dU6Z7P2i7MrDi1VUZ7uyq6J77eg86YtB",
|
||||
"Balance": "2629998983",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 10
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "27B96FE681B33825CC95DA197358B30D3A1721F2125F2D76022D46B2418ABA0A",
|
||||
"PreviousFields": {
|
||||
"Balance": "2079998983"
|
||||
},
|
||||
"PreviousTxnID": "44A47AC04C0C7237C32BE9A532B578D07641705D3A59DB9B3C5B6225001E39B7",
|
||||
"PreviousTxnLgrSeq": 56613857
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 16,
|
||||
"TransactionResult": "tesSUCCESS",
|
||||
"delivered_amount": "550000000"
|
||||
},
|
||||
"tx": {
|
||||
"Account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"Amount": "550000000",
|
||||
"Destination": "r9dU6Z7P2i7MrDi1VUZ7uyq6J77eg86YtB",
|
||||
"Fee": "40",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57112016,
|
||||
"Sequence": 702816,
|
||||
"SigningPubKey": "020A46D8D02AC780C59853ACA309EAA92E7D8E02DD72A0B6AC315A7D18A6C3276A",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022100D589029EF63F9E528F6100C7A36D26AFFF84085EC9AC16DA8E30E11F390D4E87022011466E0FE4A90B89142EE47E535545EEA4A2D65E0BD234DFB447721218B59C9B",
|
||||
"date": 649200241,
|
||||
"hash": "D58864C16344ADCC15995C7986CFC607CB693E88F84D2E019F0A35FB29749202",
|
||||
"inLedger": 57111994,
|
||||
"ledger_index": 57111994
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
{
|
||||
"result": {
|
||||
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"ledger_index_max": 57112019,
|
||||
"ledger_index_min": 56248229,
|
||||
"limit": 2,
|
||||
"marker": {
|
||||
"ledger": 57112007,
|
||||
"seq": 13
|
||||
},
|
||||
"status": "success",
|
||||
"transactions": [
|
||||
{
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"Balance": "3732290013101",
|
||||
"Flags": 131072,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 702820
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "140FA03FE8C39540CA8189BC7A7956795C712BC0A542C6409C041150703C8574",
|
||||
"PreviousFields": {
|
||||
"Balance": "3732745656171",
|
||||
"Sequence": 702819
|
||||
},
|
||||
"PreviousTxnID": "7C031FD5B710E3C048EEF31254089BEEC505900BCC9A842257A0319453333998",
|
||||
"PreviousTxnLgrSeq": 57112010
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "raLPjTYeGezfdb6crXZzcC8RkLBEwbBHJ5",
|
||||
"Balance": "4231510602153",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 96486
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "39DC5D448DECEFC3CD20818788E3DA891CA943935E8D7B12FCB5B5871FCB1638",
|
||||
"PreviousFields": {
|
||||
"Balance": "4231054959123"
|
||||
},
|
||||
"PreviousTxnID": "33D2014C832610293730028CA37857AC183BFCE3E42B9979C491FB8B82B3E9DC",
|
||||
"PreviousTxnLgrSeq": 57112004
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 12,
|
||||
"TransactionResult": "tesSUCCESS",
|
||||
"delivered_amount": "455643030"
|
||||
},
|
||||
"tx": {
|
||||
"Account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"Amount": "455643030",
|
||||
"Destination": "raLPjTYeGezfdb6crXZzcC8RkLBEwbBHJ5",
|
||||
"DestinationTag": 18240312,
|
||||
"Fee": "40",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57112037,
|
||||
"Sequence": 702819,
|
||||
"SigningPubKey": "020A46D8D02AC780C59853ACA309EAA92E7D8E02DD72A0B6AC315A7D18A6C3276A",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "30450221008602B2E390C0C7B65182C6DBC86292052C1961B2BEFB79C2C8431722C0ADB911022024B74DCF910A4C8C95572CF662EB7F5FF67E1AC4D7B9B7BFE2A8EE851EC16576",
|
||||
"date": 649200322,
|
||||
"hash": "08EF5BDA2825D7A28099219621CDBECCDECB828FEA202DEB6C7ACD5222D36C2C",
|
||||
"inLedger": 57112015,
|
||||
"ledger_index": 57112015
|
||||
},
|
||||
"validated": true
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"Balance": "3732745656171",
|
||||
"Flags": 131072,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 702819
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "140FA03FE8C39540CA8189BC7A7956795C712BC0A542C6409C041150703C8574",
|
||||
"PreviousFields": {
|
||||
"Balance": "3732246155784"
|
||||
},
|
||||
"PreviousTxnID": "CCBCCB528F602007C937C496F0828C118E073DF180084CCD3646EC1E414844E4",
|
||||
"PreviousTxnLgrSeq": 57112007
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg",
|
||||
"Balance": "236476361",
|
||||
"Flags": 131072,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 466335
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "CC20FEBEA6D2AF969EC46F2BD92684D9FBABC3F238E841B5E056FE4EBF4379A9",
|
||||
"PreviousFields": {
|
||||
"Balance": "735976788",
|
||||
"Sequence": 466334
|
||||
},
|
||||
"PreviousTxnID": "C528B32DD588EFAE2FE833E8AA92E6AE2DF2C8DB3DB8C6C4F334AD37B253D72A",
|
||||
"PreviousTxnLgrSeq": 57112010
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 33,
|
||||
"TransactionResult": "tesSUCCESS",
|
||||
"delivered_amount": "499500387"
|
||||
},
|
||||
"tx": {
|
||||
"Account": "rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg",
|
||||
"Amount": "499500387",
|
||||
"Destination": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"DestinationTag": 1,
|
||||
"Fee": "40",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 57112032,
|
||||
"Sequence": 466334,
|
||||
"SigningPubKey": "0381575032E254BF4D699C3D8D6EFDB63B3A71F97475C6F6885BC7DAEEE55D9A01",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022100C7EA1701FE48C75508EEBADBC9864CD3FFEDCEB48AB99AEA960BFA360AE163ED0220453C9577502924C9E1A9A450D4B950A44016813BC70E1F16A65A402528D730B7",
|
||||
"date": 649200302,
|
||||
"hash": "7C031FD5B710E3C048EEF31254089BEEC505900BCC9A842257A0319453333998",
|
||||
"inLedger": 57112010,
|
||||
"ledger_index": 57112010
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"account" : "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
|
||||
"ledger_index_max" : 57112094,
|
||||
"ledger_index_min" : 57105464,
|
||||
"limit" : 2,
|
||||
"marker" : {
|
||||
"ledger" : 57112074,
|
||||
"seq" : 9
|
||||
},
|
||||
"status" : "success",
|
||||
"transactions" : [
|
||||
{
|
||||
"ledger_index" : 57112090,
|
||||
"meta" : "201C0000002EF8E51100612503677617551E0297F38EF4FED7004E074D246B4EA3E550D9AE0F61BE40E08D3432091D52CE56140FA03FE8C39540CA8189BC7A7956795C712BC0A542C6409C041150703C8574E624000AB96E624000037771BFD270E1E7220002000024000AB96F2D0000000062400003776C784A418114D2E44C9FAF7BE9C536219800A6E698E4C7D2C911E1E1E311006156F7D315E0E992B1F1AC66B309C9D68961AA327FE770101B74D4C975F8C5DEC96AE8240367761A624000000005478807811403C95DC0C7CE402E8044A5F13304108013CE9963E1E1F1031000",
|
||||
"tx_blob" : "120000228000000024000AB96E201B036776306140000000054788076840000000000000287321020A46D8D02AC780C59853ACA309EAA92E7D8E02DD72A0B6AC315A7D18A6C3276A74463044022054811EEF61ACCFA1B5FC6BB05D2FA49CF5174062740370328382E6EA557C0E6A0220480584D487638C333A87CA37100354BD36209E355E8DB9FE79791A56E24C1F268114D2E44C9FAF7BE9C536219800A6E698E4C7D2C911831403C95DC0C7CE402E8044A5F13304108013CE9963",
|
||||
"validated" : true
|
||||
},
|
||||
{
|
||||
"ledger_index" : 57112087,
|
||||
"meta" : "201C00000026F8E5110061250367760A556B80EE9A9AD3FC40F471F29DCB80C678375137CE36220718902EF1EDCD375E7156140FA03FE8C39540CA8189BC7A7956795C712BC0A542C6409C041150703C8574E66240000376DEB77118E1E7220002000024000AB96E2D00000000624000037771BFD2708114D2E44C9FAF7BE9C536219800A6E698E4C7D2C911E1E1E511006125036776155591DA498D40AFD90670555F3D719883B48D224B4E4E906C634DEFA21163E8197756CC20FEBEA6D2AF969EC46F2BD92684D9FBABC3F238E841B5E056FE4EBF4379A9E62400071DA26240000001C0D849F8E1E722000200002400071DA32D0000000062400000012DCFE87881146914CB622B8E41E150DE431F48DA244A69809366E1E1F1031000",
|
||||
"tx_blob" : "12000022800000002400071DA22E00000001201B0367762D61400000009308615868400000000000002873210381575032E254BF4D699C3D8D6EFDB63B3A71F97475C6F6885BC7DAEEE55D9A0174473045022100E592BCCFD85CCE0B39075EFC66D6BCA594EBB451F12AD5AD9EE533A267F1381B02203635AB46AC110848FC44E797BD19D77A19E10A0F463AA5540B1C62E5D48C81F081146914CB622B8E41E150DE431F48DA244A698093668314D2E44C9FAF7BE9C536219800A6E698E4C7D2C911",
|
||||
"validated" : true
|
||||
}
|
||||
],
|
||||
"validated" : true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------------|:---------------------------|:---------------------------|
|
||||
| `account` | String | Unique [Address][] identifying the related account |
|
||||
| `ledger_index_min` | Integer - [Ledger Index][] | The ledger index of the earliest ledger actually searched for transactions. |
|
||||
| `ledger_index_max` | Integer - [Ledger Index][] | The ledger index of the most recent ledger actually searched for transactions. |
|
||||
| `limit` | Integer | The `limit` value used in the request. (This may differ from the actual limit value enforced by the server.) |
|
||||
| `marker` | [Marker][] | Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. |
|
||||
| `transactions` | Array | Array of transactions matching the request's criteria, as explained below. |
|
||||
| `validated` | Boolean | If included and set to `true`, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change. |
|
||||
|
||||
**Note:** The server may respond with different values of `ledger_index_min` and `ledger_index_max` than you provided in the request, for example if it did not have the versions you specified on hand.
|
||||
|
||||
Each transaction object includes the following fields, depending on whether it was requested in JSON or hex string (`"binary":true`) format.
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------------------|:-------------------------|
|
||||
| `ledger_index` | Integer | The [ledger index][] of the ledger version that included this transaction. |
|
||||
| `meta` | Object (JSON) or String (Binary) | If `binary` is True, then this is a hex string of the transaction metadata. Otherwise, the transaction metadata is included in JSON format. |
|
||||
| `tx` | Object | (JSON mode only) JSON object defining the transaction |
|
||||
| `tx_blob` | String | (Binary mode only) Unique hashed String representing the transaction. |
|
||||
| `validated` | Boolean | Whether or not the transaction is included in a validated ledger. Any transaction not yet in a validated ledger is subject to change. |
|
||||
|
||||
## 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 formatted properly.
|
||||
* `lgrIdxMalformed` - The ledger specified by the `ledger_index_min` or `ledger_index_max` does not exist, or if it does exist but the server does not have it.
|
||||
* `lgrIdxsInvalid` - Either the request specifies a `ledger_index_max` that is before the `ledger_index_min`, or the server does not have a validated ledger range because it is [not synced with the network](../../../../infrastructure/troubleshooting/server-doesnt-sync.md).
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,305 @@
|
||||
---
|
||||
html: gateway_balances.html
|
||||
parent: account-methods.html
|
||||
seo:
|
||||
description: Calculate total amounts issued by an account.
|
||||
labels:
|
||||
- Tokens
|
||||
- Accounts
|
||||
---
|
||||
# gateway_balances
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/9111ad1a9dc37d49d085aa317712625e635197c0/src/ripple/rpc/handlers/GatewayBalances.cpp "Source")
|
||||
|
||||
The `gateway_balances` command calculates the total balances issued by a given account, optionally excluding amounts held by [operational addresses](../../../../concepts/accounts/account-types.md).
|
||||
|
||||
**Caution:** Some public servers disable this API method because it can require a large amount of processing.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% raw-partial file="/_snippets/no-cli-syntax.md" /%}
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_gateway_balances_1",
|
||||
"command": "gateway_balances",
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"strict": true,
|
||||
"hotwallet": ["rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ","ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt"],
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "gateway_balances",
|
||||
"params": [
|
||||
{
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"hotwallet": [
|
||||
"rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ",
|
||||
"ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt"
|
||||
],
|
||||
"ledger_index": "validated",
|
||||
"strict": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json gateway_balances ' {"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", "hotwallet": ["rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ", "ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt"],"ledger_index": "validated","strict": true} '
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------------|:-------------------------------|
|
||||
| `account` | String | The [Address][] to check. This should be the [issuing address](../../../../concepts/accounts/account-types.md) |
|
||||
| `strict` | Boolean | _(Optional)_ If true, only accept an address or public key for the account parameter. Defaults to false. |
|
||||
| `hotwallet` | String or Array | _(Optional)_ An [operational address](../../../../concepts/accounts/account-types.md) to exclude from the balances issued, or an array of such addresses. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The [ledger index][] of the ledger version to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 3,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"assets": {
|
||||
"r9F6wk8HkXrgYWoJ7fsv4VrUBVoqDVtzkH": [
|
||||
{
|
||||
"currency": "BTC",
|
||||
"value": "5444166510000000e-26"
|
||||
}
|
||||
],
|
||||
"rPFLkxQk6xUGdGYEykqe7PR25Gr7mLHDc8": [
|
||||
{
|
||||
"currency": "EUR",
|
||||
"value": "4000000000000000e-27"
|
||||
}
|
||||
],
|
||||
"rPU6VbckqCLW4kb51CWqZdxvYyQrQVsnSj": [
|
||||
{
|
||||
"currency": "BTC",
|
||||
"value": "1029900000000000e-26"
|
||||
}
|
||||
],
|
||||
"rpR95n1iFkTqpoy1e878f4Z1pVHVtWKMNQ": [
|
||||
{
|
||||
"currency": "BTC",
|
||||
"value": "4000000000000000e-30"
|
||||
}
|
||||
],
|
||||
"rwmUaXsWtXU4Z843xSYwgt1is97bgY8yj6": [
|
||||
{
|
||||
"currency": "BTC",
|
||||
"value": "8700000000000000e-30"
|
||||
}
|
||||
]
|
||||
},
|
||||
"balances": {
|
||||
"rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ": [
|
||||
{
|
||||
"currency": "EUR",
|
||||
"value": "29826.1965999999"
|
||||
}
|
||||
],
|
||||
"ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt": [
|
||||
{
|
||||
"currency": "USD",
|
||||
"value": "13857.70416"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ledger_hash": "61DDBF304AF6E8101576BF161D447CA8E4F0170DDFBEAFFD993DC9383D443388",
|
||||
"ledger_index": 14483195,
|
||||
"obligations": {
|
||||
"BTC": "5908.324927635318",
|
||||
"EUR": "992471.7419793958",
|
||||
"GBP": "4991.38706013193",
|
||||
"USD": "1997134.20229482"
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
{
|
||||
"result": {
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"assets": {
|
||||
"r9F6wk8HkXrgYWoJ7fsv4VrUBVoqDVtzkH": [
|
||||
{
|
||||
"currency": "BTC",
|
||||
"value": "5444166510000000e-26"
|
||||
}
|
||||
],
|
||||
"rPFLkxQk6xUGdGYEykqe7PR25Gr7mLHDc8": [
|
||||
{
|
||||
"currency": "EUR",
|
||||
"value": "4000000000000000e-27"
|
||||
}
|
||||
],
|
||||
"rPU6VbckqCLW4kb51CWqZdxvYyQrQVsnSj": [
|
||||
{
|
||||
"currency": "BTC",
|
||||
"value": "1029900000000000e-26"
|
||||
}
|
||||
],
|
||||
"rpR95n1iFkTqpoy1e878f4Z1pVHVtWKMNQ": [
|
||||
{
|
||||
"currency": "BTC",
|
||||
"value": "4000000000000000e-30"
|
||||
}
|
||||
],
|
||||
"rwmUaXsWtXU4Z843xSYwgt1is97bgY8yj6": [
|
||||
{
|
||||
"currency": "BTC",
|
||||
"value": "8700000000000000e-30"
|
||||
}
|
||||
]
|
||||
},
|
||||
"balances": {
|
||||
"rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ": [
|
||||
{
|
||||
"currency": "EUR",
|
||||
"value": "29826.1965999999"
|
||||
}
|
||||
],
|
||||
"ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt": [
|
||||
{
|
||||
"currency": "USD",
|
||||
"value": "13857.70416"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ledger_hash": "980FECF48CA4BFDEC896692C31A50D484BDFE865EC101B00259C413AA3DBD672",
|
||||
"ledger_index": 14483212,
|
||||
"obligations": {
|
||||
"BTC": "5908.324927635318",
|
||||
"EUR": "992471.7419793958",
|
||||
"GBP": "4991.38706013193",
|
||||
"USD": "1997134.20229482"
|
||||
},
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"account" : "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"assets" : {
|
||||
"r9F6wk8HkXrgYWoJ7fsv4VrUBVoqDVtzkH" : [
|
||||
{
|
||||
"currency" : "BTC",
|
||||
"value" : "5444166510000000e-26"
|
||||
}
|
||||
],
|
||||
"rPU6VbckqCLW4kb51CWqZdxvYyQrQVsnSj" : [
|
||||
{
|
||||
"currency" : "BTC",
|
||||
"value" : "1029900000000000e-26"
|
||||
}
|
||||
],
|
||||
"rpR95n1iFkTqpoy1e878f4Z1pVHVtWKMNQ" : [
|
||||
{
|
||||
"currency" : "BTC",
|
||||
"value" : "4000000000000000e-30"
|
||||
}
|
||||
],
|
||||
"rwmUaXsWtXU4Z843xSYwgt1is97bgY8yj6" : [
|
||||
{
|
||||
"currency" : "BTC",
|
||||
"value" : "8700000000000000e-30"
|
||||
}
|
||||
]
|
||||
},
|
||||
"balances" : {
|
||||
"rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ" : [
|
||||
{
|
||||
"currency" : "EUR",
|
||||
"value" : "144816.1965999999"
|
||||
}
|
||||
],
|
||||
"ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt" : [
|
||||
{
|
||||
"currency" : "USD",
|
||||
"value" : "6677.38614"
|
||||
}
|
||||
]
|
||||
},
|
||||
"frozen_balances" : {
|
||||
"r4keXr5myiU4iTLh68ZqZ2CgsJ8dM9FSW6" : [
|
||||
{
|
||||
"currency" : "BTC",
|
||||
"value" : "0.091207822800868"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ledger_hash" : "6C789EAF25A931565E5936042EED037F287F3348B61A70777649552E0385B0E4",
|
||||
"ledger_index" : 57111383,
|
||||
"obligations" : {
|
||||
"BTC" : "1762.700511879441",
|
||||
"EUR" : "813792.4267005104",
|
||||
"GBP" : "4974.337212333351",
|
||||
"USD" : "6739710.218284974"
|
||||
},
|
||||
"status" : "success",
|
||||
"validated" : true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------------|:--------------------------|:------------------------|
|
||||
| `account` | String - [Address][] | The address of the account that issued the balances. |
|
||||
| `obligations` | Object | (Omitted if empty) Total amounts issued to addresses not excluded, as a map of currencies to the total value issued. |
|
||||
| `balances` | Object | _(Omitted if empty)_ Amounts issued to the `hotwallet` addresses from the request. The keys are addresses and the values are arrays of currency amounts they hold. |
|
||||
| `assets` | Object | _(Omitted if empty)_ Total amounts held that are issued by others. In the recommended configuration, the [issuing address](../../../../concepts/accounts/account-types.md) should have none. |
|
||||
| `ledger_hash` | String - [Hash][] | _(May be omitted)_ The identifying hash of the ledger version that was used to generate this response. |
|
||||
| `ledger_index` | Number - [Ledger Index][] | _(May be omitted)_ The ledger index of the ledger version that was used to generate this response. |
|
||||
| `ledger_current_index` | Number - [Ledger Index][] | _(Omitted if `ledger_current_index` is provided)_ The [ledger index][] of the current in-progress ledger version, which was used to retrieve this information. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `invalidHotWallet` - One or more of the addresses specified in the `hotwallet` field is not the [Address][] of an account holding currency issued by the account from the request.
|
||||
* `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 it does exist but the server does not have it.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
html: account-methods.html
|
||||
parent: public-api-methods.html
|
||||
metadata:
|
||||
indexPage: true
|
||||
---
|
||||
# Account Methods
|
||||
|
||||
An account in the XRP Ledger represents a holder of XRP and a sender of transactions. Use these methods to work with account info.
|
||||
|
||||
|
||||
{% child-pages /%}
|
||||
@@ -0,0 +1,194 @@
|
||||
---
|
||||
html: noripple_check.html
|
||||
parent: account-methods.html
|
||||
seo:
|
||||
description: Get recommended changes to an account's Default Ripple and No Ripple settings.
|
||||
labels:
|
||||
- Tokens
|
||||
---
|
||||
# noripple_check
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/9111ad1a9dc37d49d085aa317712625e635197c0/src/ripple/rpc/handlers/NoRippleCheck.cpp "Source")
|
||||
|
||||
The `noripple_check` command provides a quick way to check the status of [the Default Ripple field for an account and the No Ripple flag of its trust lines](../../../../concepts/tokens/fungible-tokens/rippling.md), compared with the recommended settings.
|
||||
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% raw-partial file="/_snippets/no-cli-syntax.md" /%}
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 0,
|
||||
"command": "noripple_check",
|
||||
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"role": "gateway",
|
||||
"ledger_index": "current",
|
||||
"limit": 2,
|
||||
"transactions": true
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "noripple_check",
|
||||
"params": [
|
||||
{
|
||||
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"ledger_index": "current",
|
||||
"limit": 2,
|
||||
"role": "gateway",
|
||||
"transactions": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------------|:-------------------------------|
|
||||
| `account` | String | A unique identifier for the account, most commonly the account's address. |
|
||||
| `role` | String | Whether the address refers to a `gateway` or `user`. Recommendations depend on the role of the account. Issuers must have Default Ripple enabled and must disable No Ripple on all trust lines. Users should have Default Ripple disabled, and should enable No Ripple on all trust lines. |
|
||||
| `transactions` | Boolean | [API v1][]: _(Optional)_ If `true`, include an array of suggested [transactions](../../../protocol/transactions/index.md), as JSON objects, that you can sign and submit to fix the problems. The default is `false`.<br>[API v2][]: Identical to v1, but also returns an `invalidParams` error if you use a non-boolean value. |
|
||||
| `limit` | Unsigned Integer | _(Optional)_ The maximum number of trust line problems to include in the results. Defaults to 300. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 0,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"ledger_current_index": 14342939,
|
||||
"problems": [
|
||||
"You should immediately set your default ripple flag",
|
||||
"You should clear the no ripple flag on your XAU line to r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"You should clear the no ripple flag on your USD line to rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q"
|
||||
],
|
||||
"transactions": [
|
||||
{
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Fee": 10000,
|
||||
"Sequence": 1406,
|
||||
"SetFlag": 8,
|
||||
"TransactionType": "AccountSet"
|
||||
},
|
||||
{
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Fee": 10000,
|
||||
"Flags": 262144,
|
||||
"LimitAmount": {
|
||||
"currency": "XAU",
|
||||
"issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"value": "0"
|
||||
},
|
||||
"Sequence": 1407,
|
||||
"TransactionType": "TrustSet"
|
||||
},
|
||||
{
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Fee": 10000,
|
||||
"Flags": 262144,
|
||||
"LimitAmount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"value": "5"
|
||||
},
|
||||
"Sequence": 1408,
|
||||
"TransactionType": "TrustSet"
|
||||
}
|
||||
],
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"ledger_current_index": 14380381,
|
||||
"problems": [
|
||||
"You should immediately set your default ripple flag",
|
||||
"You should clear the no ripple flag on your XAU line to r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"You should clear the no ripple flag on your USD line to rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q"
|
||||
],
|
||||
"status": "success",
|
||||
"transactions": [
|
||||
{
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Fee": 10000,
|
||||
"Sequence": 1406,
|
||||
"SetFlag": 8,
|
||||
"TransactionType": "AccountSet"
|
||||
},
|
||||
{
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Fee": 10000,
|
||||
"Flags": 262144,
|
||||
"LimitAmount": {
|
||||
"currency": "XAU",
|
||||
"issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
|
||||
"value": "0"
|
||||
},
|
||||
"Sequence": 1407,
|
||||
"TransactionType": "TrustSet"
|
||||
},
|
||||
{
|
||||
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"Fee": 10000,
|
||||
"Flags": 262144,
|
||||
"LimitAmount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"value": "5"
|
||||
},
|
||||
"Sequence": 1408,
|
||||
"TransactionType": "TrustSet"
|
||||
}
|
||||
],
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------------|:-------|:-------------------------------------------|
|
||||
| `ledger_current_index` | Number | The [ledger index][] of the ledger used to calculate these results. |
|
||||
| `problems` | Array | Array of strings with human-readable descriptions of the problems. This includes up to one entry if the account's Default Ripple setting is not as recommended, plus up to `limit` entries for trust lines whose No Ripple setting is not as recommended. |
|
||||
| `transactions` | Array | (May be omitted) If the request specified `transactions` as `true`, this is an array of JSON objects, each of which is the JSON form of a [transaction](../../../protocol/transactions/index.md) that should fix one of the described problems. The length of this array is the same as the `problems` array, and each entry is intended to fix the problem described at the same index into that array. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `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 it does exist but the server does not have it.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,121 @@
|
||||
---
|
||||
html: ledger-clio.html # Watch carefully for clashes w/ this filename
|
||||
parent: clio-methods.html
|
||||
seo:
|
||||
description: Get info about a ledger version.
|
||||
labels:
|
||||
- Blockchain
|
||||
---
|
||||
# ledger
|
||||
[[Source]](https://github.com/XRPLF/clio/blob/master/src/rpc/handlers/Ledger.cpp "Source")
|
||||
|
||||
The `ledger` command retrieves information about the public [ledger](../../../../concepts/ledgers/index.md). {% badge href="https://github.com/XRPLF/clio/releases/tag/1.0.0" %}New in: Clio v1.0.0{% /badge %}
|
||||
|
||||
Note that the Clio server returns validated ledger data by default.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
{% code-snippet file="/_api-examples/ledger-clio/wsrpc-request.json" language="json" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
{% code-snippet file="/_api-examples/ledger-clio/jsonrpc-request.json" language="json" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
<!-- [Try it! >](websocket-api-tool.html#ledger) -->
|
||||
|
||||
The request can contain the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------------|:-------------------------------|
|
||||
| `ledger_hash` | [Hash][] | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]). |
|
||||
| `ledger_index` | [Ledger Index][] | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
| `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. |
|
||||
| `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. |
|
||||
| `diff` | Boolean | _(Optional)_ If `true`, returns all objects that were added, modified, or deleted as part of applying transactions in the specified ledger. |
|
||||
|
||||
The `ledger` field is deprecated and may be removed without further notice.
|
||||
|
||||
{% admonition type="info" name="Note" %}
|
||||
The `ledger` command in Clio does not support the following fields that are supported by [ledger command in rippled](../ledger-methods/ledger.md):
|
||||
|
||||
* `accounts`
|
||||
* `full`
|
||||
* `queue`
|
||||
|
||||
Clio will **always** forward the request to `rippled` when any of the above fields is set to `true`.
|
||||
{% /admonition %}
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
{% code-snippet file="/_api-examples/ledger-clio/wsrpc-response.json" language="json" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
{% code-snippet file="/_api-examples/ledger-clio/jsonrpc-response.json" language="json" prefix="200 OK\n\n" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], 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](../../../protocol/ledger-data/index.md) in this ledger. |
|
||||
| `ledger.close_flags` | Integer | A bit-map of [flags relating to the closing of this ledger](../../../protocol/ledger-data/ledger-header.md#close-flags). |
|
||||
| `ledger.close_time` | Integer | The time this ledger was closed, in [seconds since the Ripple Epoch][]. |
|
||||
| `ledger.close_time_human` | String | The time this ledger was closed, in human-readable format. Always uses the UTC time zone. |
|
||||
| `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. |
|
||||
| `validated` | Boolean | _(May be omitted)_ If `true`, this is a validated ledger version. If omitted or set to `false`, this ledger's data is not final. |
|
||||
| `diff` | Object | _(Omitted unless requested with the `diff` parameter)_ Object containing an array of hashes that were added, modified, or deleted as part of applying transactions for the ledger. |
|
||||
|
||||
If the request specified `"owner_funds": true` and expanded transactions, the response has a field `owner_funds` in the `metaData` object of each [OfferCreate transaction][]. The purpose of this field is to make it easier to track the [funding status of offers](../../../../concepts/tokens/decentralized-exchange/offers.md#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](../subscription-methods/subscribe.md#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](../../../../concepts/tokens/fungible-tokens/freezes.md). |
|
||||
|
||||
If the request specified `"diff": true`, the response has an object `diff`. The fields of this object are as follows:
|
||||
|
||||
| `Field` | Value | Description |
|
||||
|:--------------|:-------|:----------------------------------------------------|
|
||||
| `object_id` | String | The object identifier. |
|
||||
| `Hashes` | Object or Hex String | Depending on whether the request set `binary` to true or false, this field returns the contents of the object that was created, the new value of an object that was modified, or an empty string if the object was deleted. |
|
||||
|
||||
### Response When `diff` is `true`
|
||||
|
||||
|
||||
`{% code-snippet file="/_api-examples/ledger-clio/jsonrpc-diff-response.json" language="json" /%}`
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `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.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,341 @@
|
||||
---
|
||||
html: nft_history.html
|
||||
parent: clio-methods.html
|
||||
seo:
|
||||
description: Retrieve the history of ownership and transfers for the specified NFT using Clio server's `nft_history` API.
|
||||
labels:
|
||||
- Non-fungible Tokens, NFTs
|
||||
---
|
||||
# nft_history
|
||||
|
||||
[[Source]](https://github.com/XRPLF/clio/blob/4a5cb962b6971872d150777881801ce27ae9ed1a/src/rpc/handlers/NFTHistory.cpp "Source")
|
||||
|
||||
The `nft_history` command asks the Clio server for past transaction metadata for the [NFT](../../../../concepts/tokens/nfts/index.md) being queried. {% badge href="https://github.com/XRPLF/clio/releases/tag/1.1.0" %}New in: Clio v1.1.0{% /badge %}
|
||||
|
||||
**Note** `nft_history` returns only _successful_ transactions associated with the NFT.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "nft_history",
|
||||
"nft_id": "00080000B4F4AFC5FBCBD76873F18006173D2193467D3EE70000099B00000000"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "nft_history",
|
||||
"params": [
|
||||
{
|
||||
"nft_id": "00080000B4F4AFC5FBCBD76873F18006173D2193467D3EE70000099B00000000"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
<!-- To DO: Add an example command to the assets/js/apitool-methods-ws.js file. The WebSocket Tool requires access to a publicly available Clio server.
|
||||
[Try it! >](websocket-api-tool.html#nft_history)-->
|
||||
|
||||
The request contains the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------------|:-------------------------------|
|
||||
| `nft_id` | String | A unique identifier for the non-fungible token (NFT). |
|
||||
| `ledger_index_min` | Integer | _(Optional)_ Use to specify the earliest ledger from which to include NFTs. A value of `-1` instructs the server to use the earliest validated ledger version available. |
|
||||
| `ledger_index_max` | Integer | _(Optional)_ Use to specify the most recent ledger to include NFTs from. A value of `-1` instructs the server to use the most recent validated ledger version available. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. Do not specify the `ledger_index` as `closed` or `current`; doing so forwards the request to the P2P `rippled` server and the `nft_history` API is not available on `rippled`. (See [Specifying Ledgers][]) |
|
||||
| `binary` | Boolean | _(Optional)_ Defaults to `false`. If set to `true`, returns transactions as hex strings instead of JSON. |
|
||||
| `forward` | Boolean | _(Optional)_ Defaults to `false`. If set to `true`, returns values indexed with the oldest ledger first. Otherwise, the results are indexed with the newest ledger first. (Each page of results might not be internally ordered, but the pages are ordered overall.) |
|
||||
| `limit` | UInt32 | _(Optional)_ Limit the number of NFTs to retrieve. The server is not required to honor this value. |
|
||||
| `marker` | Marker | Value from a previous paginated response. Resume retrieving data where that response left off. This value is NOT stable if there is a change in the server's range of available ledgers. If you are querying the “validated” ledger, it is possible that new NFTs are created during your paging. |
|
||||
|
||||
**Note** If you do not specify a ledger version, Clio uses the latest validated ledger.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 0,
|
||||
"type": "response",
|
||||
"result": {
|
||||
"ledger_index_min": 21377274,
|
||||
"ledger_index_max": 27876163,
|
||||
"transactions": [
|
||||
{
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "NFTokenPage",
|
||||
"LedgerIndex": "97707A94B298B50334C39FB46E245D4744C0F5B5FFFFFFFFFFFFFFFFFFFFFFFF",
|
||||
"NewFields": {
|
||||
"NFTokens": [
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "0008271097707A94B298B50334C39FB46E245D4744C0F5B50000099B00000000",
|
||||
"URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rNoj836fhDm1eXaHHefPKs7iDb4gwzS7nc",
|
||||
"Balance": "999999988",
|
||||
"Flags": 0,
|
||||
"MintedNFTokens": 1,
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 27876155
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "AC0A2AD29B67B5E6DA1C5DE696440F59BCD8DEA0A4CF7AFD683D1489AAB1ED24",
|
||||
"PreviousFields": {
|
||||
"Balance": "1000000000",
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 27876154
|
||||
},
|
||||
"PreviousTxnID": "B483F0F7100658380E42BCF1B15AD59B71C4082635AD53B78D08A5198BBB6939",
|
||||
"PreviousTxnLgrSeq": 27876154
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"tx": {
|
||||
"Account": "rNoj836fhDm1eXaHHefPKs7iDb4gwzS7nc",
|
||||
"Fee": "12",
|
||||
"Flags": 8,
|
||||
"LastLedgerSequence": 27876176,
|
||||
"NFTokenTaxon": 0,
|
||||
"Sequence": 27876154,
|
||||
"SigningPubKey": "EDDC20C6791F9FB13AFDCE2C717BE8779DD451BB556243F1FDBAA3CD159D68A9F6",
|
||||
"TransactionType": "NFTokenMint",
|
||||
"TransferFee": 10000,
|
||||
"TxnSignature": "EF657AB47E86FDC112BA054D90587DFE64A61604D9EDABAA7B01B61B56433E3C2AC5BF5AD2E8F5D2A9EAC22778F289094AC383A3F172B2304157A533E0C79802",
|
||||
"URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469",
|
||||
"hash": "E0774E1B8628E397C6E88F67D4424E55E4C81324607B19318255310A6FBAA4A2",
|
||||
"ledger_index": 27876158,
|
||||
"date": 735167200
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"nft_id": "0008271097707A94B298B50334C39FB46E245D4744C0F5B50000099B00000000",
|
||||
"validated": true
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"ledger_index_min": 21377274,
|
||||
"ledger_index_max": 27876163,
|
||||
"transactions": [
|
||||
{
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "NFTokenPage",
|
||||
"LedgerIndex": "97707A94B298B50334C39FB46E245D4744C0F5B5FFFFFFFFFFFFFFFFFFFFFFFF",
|
||||
"NewFields": {
|
||||
"NFTokens": [
|
||||
{
|
||||
"NFToken": {
|
||||
"NFTokenID": "0008271097707A94B298B50334C39FB46E245D4744C0F5B50000099B00000000",
|
||||
"URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rNoj836fhDm1eXaHHefPKs7iDb4gwzS7nc",
|
||||
"Balance": "999999988",
|
||||
"Flags": 0,
|
||||
"MintedNFTokens": 1,
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 27876155
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "AC0A2AD29B67B5E6DA1C5DE696440F59BCD8DEA0A4CF7AFD683D1489AAB1ED24",
|
||||
"PreviousFields": {
|
||||
"Balance": "1000000000",
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 27876154
|
||||
},
|
||||
"PreviousTxnID": "B483F0F7100658380E42BCF1B15AD59B71C4082635AD53B78D08A5198BBB6939",
|
||||
"PreviousTxnLgrSeq": 27876154
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"tx": {
|
||||
"Account": "rNoj836fhDm1eXaHHefPKs7iDb4gwzS7nc",
|
||||
"Fee": "12",
|
||||
"Flags": 8,
|
||||
"LastLedgerSequence": 27876176,
|
||||
"NFTokenTaxon": 0,
|
||||
"Sequence": 27876154,
|
||||
"SigningPubKey": "EDDC20C6791F9FB13AFDCE2C717BE8779DD451BB556243F1FDBAA3CD159D68A9F6",
|
||||
"TransactionType": "NFTokenMint",
|
||||
"TransferFee": 10000,
|
||||
"TxnSignature": "EF657AB47E86FDC112BA054D90587DFE64A61604D9EDABAA7B01B61B56433E3C2AC5BF5AD2E8F5D2A9EAC22778F289094AC383A3F172B2304157A533E0C79802",
|
||||
"URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469",
|
||||
"hash": "E0774E1B8628E397C6E88F67D4424E55E4C81324607B19318255310A6FBAA4A2",
|
||||
"ledger_index": 27876158,
|
||||
"date": 735167200
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"nft_id": "0008271097707A94B298B50334C39FB46E245D4744C0F5B50000099B00000000",
|
||||
"validated": true
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
With the `binary` parameter set to _true_, you receive a compact response that uses hex strings. It's not human readable, but much more concise.
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 0,
|
||||
"type": "response",
|
||||
"result": {
|
||||
"ledger_index_min": 21377274,
|
||||
"ledger_index_max": 27876275,
|
||||
"transactions": [
|
||||
{
|
||||
"meta": "201C00000000F8E31100505697707A94B298B50334C39FB46E245D4744C0F5B5FFFFFFFFFFFFFFFFFFFFFFFFE8FAEC5A0008271097707A94B298B50334C39FB46E245D4744C0F5B50000099B000000007542697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469E1F1E1E1E51100612501A95B3A55B483F0F7100658380E42BCF1B15AD59B71C4082635AD53B78D08A5198BBB693956AC0A2AD29B67B5E6DA1C5DE696440F59BCD8DEA0A4CF7AFD683D1489AAB1ED24E62401A95B3A2D0000000062400000003B9ACA00E1E722000000002401A95B3B2D00000001202B0000000162400000003B9AC9F4811497707A94B298B50334C39FB46E245D4744C0F5B5E1E1F1031000",
|
||||
"tx_blob": "12001914271022000000082401A95B3A201B01A95B50202A0000000068400000000000000C7321EDDC20C6791F9FB13AFDCE2C717BE8779DD451BB556243F1FDBAA3CD159D68A9F67440EF657AB47E86FDC112BA054D90587DFE64A61604D9EDABAA7B01B61B56433E3C2AC5BF5AD2E8F5D2A9EAC22778F289094AC383A3F172B2304157A533E0C798027542697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469811497707A94B298B50334C39FB46E245D4744C0F5B5",
|
||||
"ledger_index": 27876158,
|
||||
"date": 735167200,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"nft_id": "0008271097707A94B298B50334C39FB46E245D4744C0F5B50000099B00000000",
|
||||
"validated": true
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"ledger_index_min": 21377274,
|
||||
"ledger_index_max": 27876275,
|
||||
"transactions": [
|
||||
{
|
||||
"meta": "201C00000000F8E31100505697707A94B298B50334C39FB46E245D4744C0F5B5FFFFFFFFFFFFFFFFFFFFFFFFE8FAEC5A0008271097707A94B298B50334C39FB46E245D4744C0F5B50000099B000000007542697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469E1F1E1E1E51100612501A95B3A55B483F0F7100658380E42BCF1B15AD59B71C4082635AD53B78D08A5198BBB693956AC0A2AD29B67B5E6DA1C5DE696440F59BCD8DEA0A4CF7AFD683D1489AAB1ED24E62401A95B3A2D0000000062400000003B9ACA00E1E722000000002401A95B3B2D00000001202B0000000162400000003B9AC9F4811497707A94B298B50334C39FB46E245D4744C0F5B5E1E1F1031000",
|
||||
"tx_blob": "12001914271022000000082401A95B3A201B01A95B50202A0000000068400000000000000C7321EDDC20C6791F9FB13AFDCE2C717BE8779DD451BB556243F1FDBAA3CD159D68A9F67440EF657AB47E86FDC112BA054D90587DFE64A61604D9EDABAA7B01B61B56433E3C2AC5BF5AD2E8F5D2A9EAC22778F289094AC383A3F172B2304157A533E0C798027542697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469811497707A94B298B50334C39FB46E245D4744C0F5B5",
|
||||
"ledger_index": 27876158,
|
||||
"date": 735167200,
|
||||
"validated": true
|
||||
}
|
||||
],
|
||||
"nft_id": "0008271097707A94B298B50334C39FB46E245D4744C0F5B50000099B00000000",
|
||||
"validated": true
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------------|:---------------------------|:---------------------------|
|
||||
| `nft_id` | String | A unique identifier for the non-fungible token (NFT). |
|
||||
| `ledger_index_min` | Integer - [Ledger Index][] | The ledger index of the earliest ledger actually searched for transactions. |
|
||||
| `ledger_index_max` | Integer - [Ledger Index][] | The ledger index of the most recent ledger actually searched for transactions. |
|
||||
| `limit` | Integer | The `limit` value used in the request. (This may differ from the actual limit value enforced by the server.) |
|
||||
| `marker` | [Marker][] | Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. |
|
||||
| `transactions` | Array | Array of transactions matching the request's criteria, as explained below. |
|
||||
| `validated` | Boolean | If included and set to `true`, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change. |
|
||||
|
||||
**Note:** The server may respond with different values of `ledger_index_min` and `ledger_index_max` than you provided in the request, for example if it did not have the versions you specified on hand.
|
||||
|
||||
Each transaction object includes the following fields, depending on whether it was requested in JSON or hex string (`"binary":true`) format.
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------------------|:-------------------------|
|
||||
| `ledger_index` | Integer | The [ledger index][] of the ledger version that included this transaction. |
|
||||
| `meta` | Object (JSON) or String (Binary) | If `binary` is True, then this is a hex string of the transaction metadata. Otherwise, the transaction metadata is included in JSON format. |
|
||||
| `tx` | Object | (JSON mode only) JSON object defining the transaction |
|
||||
| `tx_blob` | String | (Binary mode only) Unique hashed String representing the transaction. |
|
||||
| `validated` | Boolean | Whether or not the transaction is included in a validated ledger. Any transaction not yet in a validated ledger is subject to change. |
|
||||
|
||||
For definitions of the fields returned in the `tx` object, see [Transaction Metadata](../../../protocol/transactions/metadata.md).
|
||||
|
||||
## 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 formatted properly.
|
||||
* `lgrIdxMalformed` - The ledger specified by the `ledger_index_min` or `ledger_index_max` does not exist, or if it does exist but the server does not have it.
|
||||
* `lgrIdxsInvalid` - Either the request specifies a `ledger_index_max` that is before the `ledger_index_min`, or the server does not have a validated ledger range because it is [not synced with the network](../../../../infrastructure/troubleshooting/server-doesnt-sync.md).
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,148 @@
|
||||
---
|
||||
html: nft_info.html
|
||||
parent: clio-methods.html
|
||||
seo:
|
||||
description: Retrieve information about the specified NFT using Clio server's `nft_info` API.
|
||||
labels:
|
||||
- Non-fungible Tokens, NFTs
|
||||
---
|
||||
# nft_info
|
||||
[[Source]](https://github.com/XRPLF/clio/blob/4a5cb962b6971872d150777881801ce27ae9ed1a/src/rpc/handlers/NFTInfo.cpp "Source")
|
||||
|
||||
The `nft_info` command asks the Clio server for information about the [NFT](../../../../concepts/tokens/nfts/index.md) being queried. {% badge href="https://github.com/XRPLF/clio/releases/tag/1.1.0" %}New in: Clio v1.1.0{% /badge %}
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "nft_info",
|
||||
"nft_id": "00080000B4F4AFC5FBCBD76873F18006173D2193467D3EE70000099B00000000"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "nft_info",
|
||||
"params": [
|
||||
{
|
||||
"nft_id": "00080000B4F4AFC5FBCBD76873F18006173D2193467D3EE70000099B00000000"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
<!-- To DO: Add an example command to the assets/js/apitool-methods-ws.js file. The WebSocket Tool requires access to a publicly available Clio server.
|
||||
[Try it! >](websocket-api-tool.html#nft_info)-->
|
||||
|
||||
The request contains the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------------|:-------------------------------|
|
||||
| `nft_id` | String | A unique identifier for the non-fungible token (NFT). |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. Do not specify the `ledger_index` as `closed` or `current`; doing so forwards the request to the P2P `rippled` server and the `nft_info` API is not available on `rippled`. (See [Specifying Ledgers][]) |
|
||||
|
||||
If you do not specify a ledger version, Clio uses the latest validated ledger.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"result": {
|
||||
"nft_id": "00080000B4F4AFC5FBCBD76873F18006173D2193467D3EE70000099B00000000",
|
||||
"ledger_index": 270,
|
||||
"owner": "rG9gdNygQ6npA9JvDFWBoeXbiUcTYJnEnk",
|
||||
"is_burned": true,
|
||||
"flags": 8,
|
||||
"transfer_fee": 0,
|
||||
"issuer": "rHVokeuSnjPjz718qdb47bGXBBHNMP3KDQ",
|
||||
"nft_taxon": 0,
|
||||
"nft_sequence": 0,
|
||||
"validated": true
|
||||
},
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"id": 2002,
|
||||
"message": "This server may be out of date"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"nft_id": "00080000B4F4AFC5FBCBD76873F18006173D2193467D3EE70000099B00000000",
|
||||
"ledger_index": 269,
|
||||
"owner": "rG9gdNygQ6npA9JvDFWBoeXbiUcTYJnEnk",
|
||||
"is_burned": false,
|
||||
"flags": 8,
|
||||
"transfer_fee": 0,
|
||||
"issuer": "rHVokeuSnjPjz718qdb47bGXBBHNMP3KDQ",
|
||||
"nft_taxon": 0,
|
||||
"nft_sequence": 0,
|
||||
"uri": "https://xrpl.org",
|
||||
"validated": true,
|
||||
"status": "success"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"id": 2002,
|
||||
"message": "This server may be out of date"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing an `nft_info` response object with some arrangement of the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:----------------------------------|:----------------|:---------------------|
|
||||
| `nft_id` | String | A unique identifier for the non-fungible token (NFT). |
|
||||
| `ledger_index` | Integer | The [ledger index][] of the most recent ledger version where the state of this NFT was modified, as in the NFT was minted (created), changed ownership (traded), or burned (destroyed). The information returned contains whatever happened most recently compared to the requested ledger. |
|
||||
| `owner` | String | The account ID of this NFT's owner at this ledger index. |
|
||||
| `is_burned` | Boolean | Returns `true` if the NFT is burned at this ledger, or `false` otherwise. |
|
||||
| `flags ` | Integer | The flag set of this NFT. |
|
||||
| `transfer_fee` | Integer | The transfer fee of this NFT. See [NFTokenMint Fields](../../../protocol/transactions/types/nftokenmint.md#nftokenmint-fields) for more information on transfer fees. |
|
||||
| `issuer` | String | The account ID which denotes the issuer of this NFT. |
|
||||
| `nft_taxon` | Integer | The NFT’s taxon. |
|
||||
| `nft_sequence` | Integer | The NFT’s sequence number. |
|
||||
| `uri` | String or `null` | _(Omitted if the NFT is burned at this ledger.)_. This field is `null` if the NFT is not burned at this ledger but does not have a URI. If the NFT is not burned at this ledger and it does have a URI, this field is a string containing the decoded URI of the NFT. NOTE: If you need to retrieve the URI of a burnt token, re-request `nft_info` for this token, specifying the `ledger_index` as the one previous to the index where this token was burned ({_ledger-index-where-token-was-burned_} - 1). |
|
||||
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,627 @@
|
||||
---
|
||||
html: server_info-clio.html
|
||||
parent: clio-methods.html
|
||||
seo:
|
||||
description: Retrieve status of the Clio server in human-readable format.
|
||||
labels:
|
||||
- Core Server
|
||||
---
|
||||
# server_info
|
||||
[[Source]](https://github.com/XRPLF/clio/blob/master/src/rpc/handlers/ServerInfo.cpp "Source")
|
||||
|
||||
The `server_info` command asks the [Clio server](../../../../concepts/networks-and-servers/the-clio-server.md) for a human-readable version of various information about the Clio server being queried. For `rippled` servers, see [`server_info` (`rippled`)](../server-info-methods/server_info.md) instead. {% badge href="https://github.com/XRPLF/clio/releases/tag/1.0.0" %}New in: Clio v1.0.0{% /badge %}
|
||||
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "server_info"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "server_info",
|
||||
"params": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
<!-- [Try it! >](websocket-api-tool.html#server_info) -->
|
||||
|
||||
The request does not take any parameters.
|
||||
|
||||
## Response Format
|
||||
|
||||
When a client connects to the Clio server over `localhost`, the response includes the `counters` and `etl` objects. These objects are omitted from the response when the client is not located on the same server, and hence does not connect over `localhost`.
|
||||
|
||||
An example of a successful response when client connects over `localhost`:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"result": {
|
||||
"info": {
|
||||
"complete_ledgers": "19499132-19977628",
|
||||
"counters": {
|
||||
"rpc": {
|
||||
"account_objects": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "991"
|
||||
},
|
||||
"account_tx": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "91633"
|
||||
},
|
||||
"account_lines": {
|
||||
"started": "5",
|
||||
"finished": "5",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "4915159"
|
||||
},
|
||||
"submit_multisigned": {
|
||||
"started": "2",
|
||||
"finished": "2",
|
||||
"errored": "0",
|
||||
"forwarded": "2",
|
||||
"duration_us": "4823"
|
||||
},
|
||||
"ledger_entry": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "17806"
|
||||
},
|
||||
"server_info": {
|
||||
"started": "5",
|
||||
"finished": "5",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "2375580"
|
||||
},
|
||||
"account_info": {
|
||||
"started": "5",
|
||||
"finished": "5",
|
||||
"errored": "0",
|
||||
"forwarded": "5",
|
||||
"duration_us": "9256"
|
||||
},
|
||||
"account_currencies": {
|
||||
"started": "4",
|
||||
"finished": "4",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "517302"
|
||||
},
|
||||
"noripple_check": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "1",
|
||||
"duration_us": "2218"
|
||||
},
|
||||
"tx": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "562"
|
||||
},
|
||||
"gateway_balances": {
|
||||
"started": "6",
|
||||
"finished": "6",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "1395156"
|
||||
},
|
||||
"channel_authorize": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "1",
|
||||
"duration_us": "2017"
|
||||
},
|
||||
"manifest": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "1",
|
||||
"duration_us": "1707"
|
||||
},
|
||||
"subscribe": {
|
||||
"started": "6",
|
||||
"finished": "6",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "116"
|
||||
},
|
||||
"random": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "111"
|
||||
},
|
||||
"ledger_data": {
|
||||
"started": "14",
|
||||
"finished": "3",
|
||||
"errored": "11",
|
||||
"forwarded": "0",
|
||||
"duration_us": "6179145"
|
||||
},
|
||||
"ripple_path_find": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "1",
|
||||
"duration_us": "1409563"
|
||||
},
|
||||
"account_channels": {
|
||||
"started": "14",
|
||||
"finished": "14",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "1062692"
|
||||
},
|
||||
"submit": {
|
||||
"started": "6",
|
||||
"finished": "6",
|
||||
"errored": "0",
|
||||
"forwarded": "6",
|
||||
"duration_us": "11383"
|
||||
},
|
||||
"transaction_entry": {
|
||||
"started": "8",
|
||||
"finished": "5",
|
||||
"errored": "3",
|
||||
"forwarded": "0",
|
||||
"duration_us": "494131"
|
||||
}
|
||||
},
|
||||
"subscriptions": {
|
||||
"ledger": 0,
|
||||
"transactions": 0,
|
||||
"transactions_proposed": 0,
|
||||
"manifests": 2,
|
||||
"validations": 2,
|
||||
"account": 0,
|
||||
"accounts_proposed": 0,
|
||||
"books": 0
|
||||
}
|
||||
},
|
||||
"load_factor": 1,
|
||||
"clio_version": "0.3.0-b2",
|
||||
"validation_quorum": 8,
|
||||
"rippled_version": "1.9.1-rc1",
|
||||
"validated_ledger": {
|
||||
"age": 4,
|
||||
"hash": "4CD25FB70D45646EE5822E76E58B66D39D5AE6BA0F70491FA803DA0DA218F434",
|
||||
"seq": 19977628,
|
||||
"base_fee_xrp": 1E-5,
|
||||
"reserve_base_xrp": 1E1,
|
||||
"reserve_inc_xrp": 2E0
|
||||
}
|
||||
},
|
||||
"cache": {
|
||||
"size": 8812733,
|
||||
"is_full": true,
|
||||
"latest_ledger_seq": 19977629
|
||||
},
|
||||
"etl": {
|
||||
"etl_sources": [
|
||||
{
|
||||
"validated_range": "19405538-19977629",
|
||||
"is_connected": "1",
|
||||
"ip": "52.36.182.38",
|
||||
"ws_port": "6005",
|
||||
"grpc_port": "50051",
|
||||
"last_msg_age_seconds": "0"
|
||||
}
|
||||
],
|
||||
"is_writer": true,
|
||||
"read_only": false,
|
||||
"last_publish_age_seconds": "2"
|
||||
},
|
||||
"validated": true
|
||||
},
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"id": 2002,
|
||||
"message": "This server may be out of date"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"info": {
|
||||
"complete_ledgers": "19499132-19977628",
|
||||
"counters": {
|
||||
"rpc": {
|
||||
"account_objects": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "991"
|
||||
},
|
||||
"account_tx": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "91633"
|
||||
},
|
||||
"account_lines": {
|
||||
"started": "5",
|
||||
"finished": "5",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "4915159"
|
||||
},
|
||||
"submit_multisigned": {
|
||||
"started": "2",
|
||||
"finished": "2",
|
||||
"errored": "0",
|
||||
"forwarded": "2",
|
||||
"duration_us": "4823"
|
||||
},
|
||||
"ledger_entry": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "17806"
|
||||
},
|
||||
"server_info": {
|
||||
"started": "5",
|
||||
"finished": "5",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "2375580"
|
||||
},
|
||||
"account_info": {
|
||||
"started": "5",
|
||||
"finished": "5",
|
||||
"errored": "0",
|
||||
"forwarded": "5",
|
||||
"duration_us": "9256"
|
||||
},
|
||||
"account_currencies": {
|
||||
"started": "4",
|
||||
"finished": "4",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "517302"
|
||||
},
|
||||
"noripple_check": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "1",
|
||||
"duration_us": "2218"
|
||||
},
|
||||
"tx": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "562"
|
||||
},
|
||||
"gateway_balances": {
|
||||
"started": "6",
|
||||
"finished": "6",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "1395156"
|
||||
},
|
||||
"channel_authorize": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "1",
|
||||
"duration_us": "2017"
|
||||
},
|
||||
"manifest": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "1",
|
||||
"duration_us": "1707"
|
||||
},
|
||||
"subscribe": {
|
||||
"started": "6",
|
||||
"finished": "6",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "116"
|
||||
},
|
||||
"random": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "111"
|
||||
},
|
||||
"ledger_data": {
|
||||
"started": "14",
|
||||
"finished": "3",
|
||||
"errored": "11",
|
||||
"forwarded": "0",
|
||||
"duration_us": "6179145"
|
||||
},
|
||||
"ripple_path_find": {
|
||||
"started": "1",
|
||||
"finished": "1",
|
||||
"errored": "0",
|
||||
"forwarded": "1",
|
||||
"duration_us": "1409563"
|
||||
},
|
||||
"account_channels": {
|
||||
"started": "14",
|
||||
"finished": "14",
|
||||
"errored": "0",
|
||||
"forwarded": "0",
|
||||
"duration_us": "1062692"
|
||||
},
|
||||
"submit": {
|
||||
"started": "6",
|
||||
"finished": "6",
|
||||
"errored": "0",
|
||||
"forwarded": "6",
|
||||
"duration_us": "11383"
|
||||
},
|
||||
"transaction_entry": {
|
||||
"started": "8",
|
||||
"finished": "5",
|
||||
"errored": "3",
|
||||
"forwarded": "0",
|
||||
"duration_us": "494131"
|
||||
}
|
||||
},
|
||||
"subscriptions": {
|
||||
"ledger": 0,
|
||||
"transactions": 0,
|
||||
"transactions_proposed": 0,
|
||||
"manifests": 2,
|
||||
"validations": 2,
|
||||
"account": 0,
|
||||
"accounts_proposed": 0,
|
||||
"books": 0
|
||||
}
|
||||
},
|
||||
"load_factor": 1,
|
||||
"clio_version": "0.3.0-b2",
|
||||
"validation_quorum": 8,
|
||||
"rippled_version": "1.9.1-rc1",
|
||||
"validated_ledger": {
|
||||
"age": 4,
|
||||
"hash": "4CD25FB70D45646EE5822E76E58B66D39D5AE6BA0F70491FA803DA0DA218F434",
|
||||
"seq": 19977628,
|
||||
"base_fee_xrp": 1E-5,
|
||||
"reserve_base_xrp": 1E1,
|
||||
"reserve_inc_xrp": 2E0
|
||||
}
|
||||
},
|
||||
"cache": {
|
||||
"size": 8812733,
|
||||
"is_full": true,
|
||||
"latest_ledger_seq": 19977629
|
||||
},
|
||||
"etl": {
|
||||
"etl_sources": [
|
||||
{
|
||||
"validated_range": "19405538-19977629",
|
||||
"is_connected": "1",
|
||||
"ip": "52.36.182.38",
|
||||
"ws_port": "6005",
|
||||
"grpc_port": "50051",
|
||||
"last_msg_age_seconds": "0"
|
||||
}
|
||||
],
|
||||
"is_writer": true,
|
||||
"read_only": false,
|
||||
"last_publish_age_seconds": "2"
|
||||
},
|
||||
"validated": true,
|
||||
},
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"id": 2002,
|
||||
"message": "This server may be out of date"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
An example of a successful response when client does not connect over `localhost`:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"result": {
|
||||
"info": {
|
||||
"complete_ledgers":"32570-73737719",
|
||||
"load_factor":1,
|
||||
"clio_version":"1.0.2",
|
||||
"validation_quorum":28,
|
||||
"rippled_version":"1.9.1",
|
||||
"validated_ledger": {
|
||||
"age":7,
|
||||
"hash":"4ECDEAF9E6F8B37EFDE297953168AAB42DEED1082A565639EBB2D29E047341B4",
|
||||
"seq":73737719,
|
||||
"base_fee_xrp":1E-5,
|
||||
"reserve_base_xrp":1E1,
|
||||
"reserve_inc_xrp":2E0
|
||||
},
|
||||
"cache": {
|
||||
"size":15258947,
|
||||
"is_full":true,
|
||||
"latest_ledger_seq":73737719
|
||||
}
|
||||
},
|
||||
"validated":true,
|
||||
"status":"success"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"info": {
|
||||
"complete_ledgers":"32570-73737719",
|
||||
"load_factor":1,
|
||||
"clio_version":"1.0.2",
|
||||
"validation_quorum":28,
|
||||
"rippled_version":"1.9.1",
|
||||
"validated_ledger": {
|
||||
"age":7,
|
||||
"hash":"4ECDEAF9E6F8B37EFDE297953168AAB42DEED1082A565639EBB2D29E047341B4",
|
||||
"seq":73737719,
|
||||
"base_fee_xrp":1E-5,
|
||||
"reserve_base_xrp":1E1,
|
||||
"reserve_inc_xrp":2E0
|
||||
},
|
||||
"cache": {
|
||||
"size":15258947,
|
||||
"is_full":true,
|
||||
"latest_ledger_seq":73737719
|
||||
}
|
||||
},
|
||||
"validated":true,
|
||||
"status":"success"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing an `info` object as its only field.
|
||||
|
||||
The `info` object may have some arrangement of the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------------------------|:----------------|:---------------------|
|
||||
| `complete_ledgers` | String | Range expression indicating the sequence numbers of the ledger versions the local `rippled` has in its database. This may be a disjoint sequence such as `24900901-24900984,24901116-24901158`. If the server does not have any complete ledgers (for example, it recently started syncing with the network), this is the string `empty`. |
|
||||
| `counters` | Object | _(May be omitted)_ Stats on API calls handled since server startup. This is present only if the client connects to the Clio server over `localhost`.
|
||||
| `rpc` | Object | _(May be omitted)_ Stats on each API call handled by the Clio server since startup. Since this is nested within the `counters` object, this is also present only if the client connects to the Clio server over `localhost`. |
|
||||
| `rpc.*.started` | Number | Number of API calls of this type that the Clio server has started processing since startup. |
|
||||
| `rpc.*.finished` | Number | Number of API calls of this type that the Clio server has finished processing since startup. |
|
||||
| `rpc.*.errored` | Number | Number of API calls of this type that have resulted in some sort of error since startup. |
|
||||
| `rpc.*.forwarded` | Number | Number of API calls of this type that the Clio server has forwarded to a `rippled` P2P server since startup. |
|
||||
| `rpc.*.duration_us` | Number | The total number of microseconds spent processing API calls of this type since startup. |
|
||||
| `subscriptions` | Object | _(May be omitted)_ Number of current subscribers for each stream type. Since this is nested within the `counters` object, this is also present only if the client connects to the Clio server over `localhost`. |
|
||||
| `subscriptions.ledger` | | |
|
||||
| `subscriptions.transactions` | | |
|
||||
| `subscriptions.transactions_proposed` | | |
|
||||
| `subscriptions.manifests` | | |
|
||||
| `subscriptions.validations` | | |
|
||||
| `subscriptions.account` | | |
|
||||
| `subscriptions.accounts_proposed` | | |
|
||||
| `subscriptions.books` | | |
|
||||
| `time` | String | The current time in UTC, according to the server's clock. {% badge href="https://github.com/XRPLF/clio/releases/tag/2.0.0" %}New in: Clio v2.0{% /badge %} |
|
||||
| `uptime` | Number | Number of consecutive seconds that the server has been operational. {% badge href="https://github.com/XRPLF/clio/releases/tag/2.0.0" %}New in: Clio v2.0{% /badge %} |
|
||||
| `amendment_blocked` | Boolean | _(May be omitted)_ Whether the Clio server is [Amendment Blocked](../../../../concepts/networks-and-servers/amendments.md#amendment-blocked-clio-servers) {% badge href="https://github.com/XRPLF/clio/releases/tag/2.0.0" %}New in: Clio v2.0{% /badge %} |
|
||||
| `load_factor` | Number | The load-scaled open ledger transaction cost the server is currently enforcing, as a multiplier on the base transaction cost. For example, at `1000` load factor and a reference transaction cost of 10 drops of XRP, the load-scaled transaction cost is 10,000 drops (0.01 XRP). The load factor is determined by the highest of the [individual server's load factor](../../../../concepts/transactions/transaction-cost.md#local-load-cost), the cluster's load factor, the [open ledger cost](../../../../concepts/transactions/transaction-cost.md#open-ledger-cost) and the overall network's load factor. |
|
||||
| `clio_version` | String | The version number of the running Clio server. |
|
||||
| `libxrpl_version` | String | The version number of the `libxrpl` library this Clio server was built against. {% badge href="https://github.com/XRPLF/clio/releases/tag/2.0.0" %}New in: Clio v2.0{% /badge %} |
|
||||
| `validation_quorum` | Number | _(May be omitted)_ Minimum number of trusted validations required to validate a ledger version. Some circumstances may cause the server to require more validations. This value is obtained from `rippled`. This field may be omitted from the response if the Clio server is unable to connect to `rippled` for some reason. |
|
||||
| `rippled_version` | String | _(May be omitted)_ The version number of the running `rippled` server that the Clio server is connected to. This field may be omitted from the response if the Clio server is unable to connect to `rippled` for some reason. |
|
||||
| `network_id` | String | _(May be omitted)_ The network ID of the network that the `rippled` this Clio server is connected to is operating on. This field may be omitted from the response if the Clio server is unable to connect to `rippled` for some reason. {% badge href="https://github.com/XRPLF/clio/releases/tag/2.0.0" %}New in: Clio v2.0{% /badge %} |
|
||||
| `validated_ledger` | Object | _(May be omitted)_ Information about the most recent fully-validated ledger. If the most recent validated ledger is not available, the response omits this field and includes `closed_ledger` instead. |
|
||||
| `validated_ledger.age` | Number | The time since the ledger was closed, in seconds. |
|
||||
| `validated_ledger.base_fee_xrp` | Number | Base fee, in XRP. This may be represented in scientific notation such as `1e-05` for 0.00001. |
|
||||
| `validated_ledger.hash` | String | Unique hash for the ledger, as hexadecimal. |
|
||||
| `validated_ledger.reserve_base_xrp` | Number | Minimum amount of XRP (not drops) necessary for every account to keep in reserve. This may be represented in scientific notation such as `1e-05` for 0.00001. |
|
||||
| `validated_ledger.reserve_inc_xrp` | Number | Amount of XRP (not drops) added to the account reserve for each object an account owns in the ledger. This may be represented in scientific notation such as `1e-05` for 0.00001. |
|
||||
| `validated_ledger.seq` | Number | The [ledger index][] of the latest validated ledger. |
|
||||
| `validator_list_expires` | String | _(Admin only)_ Either the human readable time, in UTC, when the current validator list expires, the string `unknown` if the server has yet to load a published validator list or the string `never` if the server uses a static validator list. |
|
||||
| `cache` | Object | Information on Clio's state data cache. |
|
||||
| `cache.size` | Number | Number of state data objects currently in the cache. |
|
||||
| `cache.is_full` | Boolean | True if cache contains all state data for a specific ledger, false otherwise. Some API calls, such as the [book_offers method][], process much faster when the cache is full. |
|
||||
| `cache.latest_ledger_seq` | Number | The [ledger index][] of the latest validated ledger stored in the cache. |
|
||||
| `etl` | Object | The `rippled` sources (ETL sources) that the Clio server is connected to. This is present only if the client connects to the Clio server over `localhost`. |
|
||||
| `etl.etl_sources` | Object Array | List the `rippled` sources (ETL sources) that the Clio server is connected to and extracts data from. |
|
||||
| `etl.etl_sources.validated_range` | String | The validated ledger range retrieved by the P2P `rippled` server. |
|
||||
| `etl.etl_sources.is_connected` | Boolean | True if Clio is connected to this source via websocket, false otherwise. A value of false here could indicate a networking issue, or that `rippled` is not running, amongst other things. |
|
||||
| `etl.etl_sources.ip` | Number | IP of the `rippled` server. |
|
||||
| `etl.etl_sources.ws_port` | Number | Websocket port of the `rippled` server. |
|
||||
| `etl.etl_sources.grpc_port` | Number | The gRPC connection port of the P2P `rippled` server that the Clio server is connected to. |
|
||||
| `etl.etl_sources.last_msg_age_seconds` | Number | Total seconds that have elapsed since Clio last heard anything from `rippled`. This should not be higher than 8. |
|
||||
| `etl.is_writer` | Boolean | True if this Clio server is currently writing data to the database, false otherwise. |
|
||||
| `etl.read_only` | Boolean | True if this Clio server is configured in read-only mode, false otherwise. |
|
||||
| `etl.last_publish_age_seconds` | Number | Time in seconds that have elapsed since this Clio server last published a ledger. This should not be more than 8. |
|
||||
| `validated` | Boolean | When true, this indicates that the response uses a ledger version that has been validated by consensus. In Clio, this is always true as Clio stores and returns validated ledger data. If a request was forwarded to `rippled` and the server returns current data, a missing or false value indicates that this ledger's data is not final. |
|
||||
| `status` | String | Returns the status of the API request: `success` when the request completes successfully. |
|
||||
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
html: clio-methods.html
|
||||
parent: public-api-methods.html
|
||||
metadata:
|
||||
indexPage: true
|
||||
---
|
||||
# Clio Server
|
||||
|
||||
Use these methods to retrieve information using Clio server APIs.
|
||||
|
||||
|
||||
{% child-pages /%}
|
||||
116
docs/references/http-websocket-apis/public-api-methods/index.md
Normal file
116
docs/references/http-websocket-apis/public-api-methods/index.md
Normal file
@@ -0,0 +1,116 @@
|
||||
---
|
||||
html: public-api-methods.html
|
||||
parent: http-websocket-apis.html
|
||||
seo:
|
||||
description: Get data from the XRP Ledger and submit transactions using these public API methods.
|
||||
top_nav_name: API Methods
|
||||
top_nav_grouping: Popular Pages
|
||||
labels:
|
||||
- Core Server
|
||||
---
|
||||
# Public API Methods
|
||||
|
||||
Communicate directly with an [XRP Ledger server](../../../concepts/networks-and-servers/index.md) using the public API methods. Public methods are not necessarily meant for the general public, but they are used by any client attached to the server. Think of public methods as being for members or customers of the organization running the server.
|
||||
|
||||
|
||||
## [Account Methods](account-methods/index.md)
|
||||
|
||||
An account in the XRP Ledger represents a holder of XRP and a sender of transactions. Use these methods to work with account info.
|
||||
|
||||
* **[`account_channels`](account-methods/account_channels.md)** - Get a list of payment channels where the account is the source of the channel.
|
||||
* **[`account_currencies`](account-methods/account_currencies.md)** - Get a list of currencies an account can send or receive.
|
||||
* **[`account_info`](account-methods/account_info.md)** - Get basic data about an account.
|
||||
* **[`account_lines`](account-methods/account_lines.md)** - Get info about an account's trust lines.
|
||||
* **[`account_nfts`](account-methods/account_nfts.md)** - Get a list of non-fungible tokens owned by an account.
|
||||
* **[`account_objects`](account-methods/account_objects.md)** - Get all ledger objects owned by an account.
|
||||
* **[`account_offers`](account-methods/account_offers.md)** - Get info about an account's currency exchange offers.
|
||||
* **[`account_tx`](account-methods/account_tx.md)** - Get info about an account's transactions.
|
||||
* **[`gateway_balances`](account-methods/gateway_balances.md)** - Calculate total amounts issued by an account.
|
||||
* **[`noripple_check`](account-methods/noripple_check.md)** - Get recommended changes to an account's Default Ripple and No Ripple settings.
|
||||
|
||||
|
||||
## [Ledger Methods](ledger-methods/index.md)
|
||||
|
||||
A ledger version contains a header, a transaction tree, and a state tree, which contain account settings, trust lines, balances, transactions, and other data. Use these methods to retrieve ledger info.
|
||||
|
||||
* **[`ledger`](ledger-methods/ledger.md)** - Get info about a ledger version.
|
||||
* **[`ledger_closed`](ledger-methods/ledger_closed.md)** - Get the latest closed ledger version.
|
||||
* **[`ledger_current`](ledger-methods/ledger_current.md)** - Get the current working ledger version.
|
||||
* **[`ledger_data`](ledger-methods/ledger_data.md)** - Get the raw contents of a ledger version.
|
||||
* **[`ledger_entry`](ledger-methods/ledger_entry.md)** - Get one element from a ledger version.
|
||||
|
||||
|
||||
## [Transaction Methods](transaction-methods/index.md)
|
||||
|
||||
Transactions are the only thing that can modify the shared state of the XRP Ledger. All business on the XRP Ledger takes the form of transactions. Use these methods to work with transactions.
|
||||
|
||||
* **[`submit`](transaction-methods/submit.md)** - Send a transaction to the network.
|
||||
* **[`submit_multisigned`](transaction-methods/submit_multisigned.md)** - Send a multi-signed transaction to the network.
|
||||
* **[`transaction_entry`](transaction-methods/transaction_entry.md)** - Retrieve info about a transaction from a particular ledger version.
|
||||
* **[`tx`](transaction-methods/tx.md)** - Retrieve info about a transaction from all the ledgers on hand.
|
||||
* **[`tx_history`](transaction-methods/tx_history.md)** - Retrieve info about all recent transactions.
|
||||
|
||||
By default, the following methods are [admin-only](../admin-api-methods/index.md). They can be used as public methods if the server admin has [enabled public signing](../../../infrastructure/configuration/enable-public-signing.md).
|
||||
|
||||
* **[`sign`](../admin-api-methods/signing-methods/sign.md)** - Cryptographically sign a transaction.
|
||||
* **[`sign_for`](../admin-api-methods/signing-methods/sign_for.md)** - Contribute to a multi-signature.
|
||||
|
||||
|
||||
## [Path and Order Book Methods](path-and-order-book-methods/index.md)
|
||||
|
||||
Paths define a way for payments to flow through intermediary steps on their way from sender to receiver. Paths enable cross-currency payments by connecting sender and receiver through order books. Use these methods to work with paths and other books.
|
||||
|
||||
* **[`amm_info`](path-and-order-book-methods/amm_info.md)** {% not-enabled /%} - Get info about an Automated Market Maker (AMM).
|
||||
* **[`book_offers`](path-and-order-book-methods/book_offers.md)** - Get info about offers to exchange two currencies.
|
||||
* **[`deposit_authorized`](path-and-order-book-methods/deposit_authorized.md)** - Look up whether one account is authorized to send payments directly to another. <!-- STYLE_OVERRIDE: is authorized to -->
|
||||
* **[`nft_buy_offers`](path-and-order-book-methods/nft_buy_offers.md)** - Retrieve a list of buy offers for a specified NFToken object.
|
||||
* **[`nft_sell_offers`](path-and-order-book-methods/nft_sell_offers.md)** - Retrieve a list of sell offers for a specified NFToken object.
|
||||
* **[`path_find`](path-and-order-book-methods/path_find.md)** - Find a path for a payment between two accounts and receive updates.
|
||||
* **[`ripple_path_find`](path-and-order-book-methods/ripple_path_find.md)** - Find a path for payment between two accounts, once.
|
||||
|
||||
|
||||
## [Payment Channel Methods](payment-channel-methods/index.md)
|
||||
|
||||
Payment channels are a tool for facilitating repeated, unidirectional payments, or temporary credit between two parties. Use these methods to work with payment channels.
|
||||
|
||||
* **[`channel_authorize`](payment-channel-methods/channel_authorize.md)** - Sign a claim for money from a payment channel.
|
||||
* **[`channel_verify`](payment-channel-methods/channel_verify.md)** - Check a payment channel claim's signature.
|
||||
|
||||
|
||||
## [Subscription Methods](subscription-methods/index.md)
|
||||
|
||||
Use these methods to enable the server to push updates to your client when various events happen, so that you can know and react right away. _WebSocket API only._
|
||||
|
||||
* **[`subscribe`](subscription-methods/subscribe.md)** - Listen for updates about a particular subject.
|
||||
* **[`unsubscribe`](subscription-methods/unsubscribe.md)** - Stop listening for updates about a particular subject.
|
||||
|
||||
|
||||
## [Server Info Methods](server-info-methods/index.md)
|
||||
|
||||
Use these methods to retrieve information about the current state of the `rippled` server.
|
||||
|
||||
* **[`fee`](server-info-methods/fee.md)** - Get information about transaction cost.
|
||||
* **[`server_info`](server-info-methods/server_info.md)** - Retrieve status of the server in human-readable format.
|
||||
* **[`server_state`](server-info-methods/server_state.md)** - Retrieve status of the server in machine-readable format.
|
||||
- **[`manifest`](server-info-methods/manifest.md)** - Retrieve the latest ephemeral public key information about a known validator.
|
||||
|
||||
## [Clio Methods](clio-server/index.md)
|
||||
|
||||
Use these methods to retrieve information using Clio server APIs.
|
||||
|
||||
* **[`server_info`](clio-methods/server_info-clio.md)** - Retrieve status of the Clio server.
|
||||
* **[`ledger`](clio-methods/ledger-clio.md)** - Get info about a ledger version using Clio server's `ledger` API.
|
||||
* **[`nft_info`](clio-methods/nft_info.md)** - Retrieve information about the specified NFT using Clio server's `nft_info` API.
|
||||
|
||||
## [Utility Methods](utility-methods/index.md)
|
||||
|
||||
Use these methods to perform convenient tasks, such as ping and random number generation.
|
||||
|
||||
* **[`json`](utility-methods/json.md)** - Use as a proxy to running other commands. Accepts the parameters for the command as a JSON value. _Commandline only._
|
||||
* **[`ping`](utility-methods/ping.md)** - Confirm connectivity with the server.
|
||||
* **[`random`](utility-methods/random.md)** - Generate a random number.
|
||||
|
||||
|
||||
## Deprecated Methods
|
||||
|
||||
The `owner_info` command is deprecated. Use [`account_objects`](account-methods/account_objects.md) instead.
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
html: ledger-methods.html
|
||||
parent: public-api-methods.html
|
||||
metadata:
|
||||
indexPage: true
|
||||
---
|
||||
# Ledger Methods
|
||||
|
||||
A ledger version contains a header, a transaction tree, and a state tree, which contain account settings, trustlines, balances, transactions, and other data. Use these methods to retrieve ledger info.
|
||||
|
||||
|
||||
{% child-pages /%}
|
||||
@@ -0,0 +1,150 @@
|
||||
---
|
||||
html: ledger.html # Watch carefully for clashes w/ this filename
|
||||
parent: ledger-methods.html
|
||||
seo:
|
||||
description: Get info about a ledger version.
|
||||
labels:
|
||||
- Blockchain
|
||||
---
|
||||
# ledger
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/LedgerHandler.cpp "Source")
|
||||
|
||||
Retrieve information about the public [ledger](../../../../concepts/ledgers/index.md).
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_ledger_req",
|
||||
"command": "ledger",
|
||||
"ledger_index": "validated",
|
||||
"transactions": false,
|
||||
"expand": false,
|
||||
"owner_funds": false
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger",
|
||||
"params": [
|
||||
{
|
||||
"ledger_index": "validated",
|
||||
"transactions": false,
|
||||
"expand": false,
|
||||
"owner_funds": false
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: ledger ledger_index|ledger_hash [full|tx]
|
||||
# "full" is equivalent to "full": true
|
||||
# "tx" is equivalent to "transactions": true
|
||||
rippled ledger validated
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger)
|
||||
|
||||
The request can contain the following parameters:
|
||||
|
||||
| `Field` | Type | Required? | Description |
|
||||
|:---------------|:-----------------|:----------|-------------|
|
||||
| `ledger_hash` | [Hash][] | No | A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]). |
|
||||
| `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][]) |
|
||||
| `transactions` | Boolean | No | If `true`, return information on transactions in the specified ledger version. The default is `false`. Ignored if you did not specify a ledger version. |
|
||||
| `expand` | Boolean | No | Provide full JSON-formatted information for transaction/account information instead of only hashes. The default is `false`. Ignored unless you request transactions, accounts, or both. |
|
||||
| `owner_funds` | Boolean | No | If `true`, include `owner_funds` field in the metadata of OfferCreate transactions in the response. The default is `false`. Ignored unless transactions are included and `expand` is true. |
|
||||
| `binary` | Boolean | No | If `true`, and `transactions` and `expand` are both also `true`, return transaction information in binary format (hexadecimal string) instead of JSON format. |
|
||||
| `queue` | Boolean | No | If `true`, and the command is requesting the `current` ledger, includes an array of [queued transactions](../../../../concepts/transactions/transaction-cost.md#queued-transactions) in the results. |
|
||||
|
||||
|
||||
The `ledger` field is deprecated and may be removed without further notice. The `full`, `accounts`, and `type` fields (admin-only) are also deprecated; the Clio server does not implement these parameters.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
{% code-snippet file="/_api-examples/ledger/ws-response.json" language="json" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
{% code-snippet file="/_api-examples/ledger/jsonrpc-response.json" language="json" prefix="200 OK\n\n" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
{% code-snippet file="/_api-examples/ledger/jsonrpc-response.json" language="json" prefix="Loading: \"/etc/opt/ripple/rippled.cfg\"\n2023-Nov-01 21:38:14.638871262 UTC HTTPClient:NFO Connecting to 127.0.0.1:5005\n\n" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing information about the ledger, including the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------------------------|:--------|:----------------------------------|
|
||||
| `ledger` | Object | The complete [ledger header data](../../../protocol/ledger-data/ledger-header.md) of this ledger, with some additional fields added for convenience. |
|
||||
| `ledger.account_hash` | String | [Hash](../../../protocol/data-types/basic-data-types.md#hashes) of all account state information in this ledger, as hexadecimal. |
|
||||
| `ledger.close_flags` | Number | A bit-map of [flags relating to the closing of this ledger](../../../protocol/ledger-data/ledger-header.md#close-flags). |
|
||||
| `ledger.close_time` | Number | The time this ledger was closed, in [seconds since the Ripple Epoch][]. |
|
||||
| `ledger.close_time_human` | String | The time this ledger was closed, in human-readable format. Always uses the UTC time zone. |
|
||||
| `ledger.close_time_resolution` | Number | 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` | Number | The time at which the previous ledger was closed. |
|
||||
| `ledger.parent_hash` | String | The unique identifying hash of the ledger that came immediately before this one, as hexadecimal. |
|
||||
| `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](../../../protocol/data-types/basic-data-types.md#hashes) of the transaction information included in this ledger. |
|
||||
| `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 | The unique identifying hash of the entire ledger, as hexadecimal. |
|
||||
| `ledger_index` | Number | The [Ledger Index][] of this ledger. |
|
||||
| `validated` | Boolean | _(May be omitted)_ If `true`, this is a validated ledger version. If omitted or set to `false`, this ledger's data is not final. |
|
||||
| `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. |
|
||||
|
||||
The `ledger.accountState` field (omitted unless requested with `"full": true` or `"accounts": true`) is deprecated.
|
||||
|
||||
The following deprecated fields have been removed: `accepted`, `hash` (use `ledger_hash` instead), `seqNum` (use `ledger_index` instead), `totalCoins` (use `total_coins` instead). {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.12.0" %}Updated in: rippled 1.12.0{% /badge %}
|
||||
|
||||
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](../../../protocol/data-types/basic-data-types.md#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](../../../protocol/transactions/index.md) 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](../../../protocol/transactions/transaction-results/ter-codes.md), 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](../../../../concepts/transactions/index.md#authorizing-transactions). |
|
||||
| `fee` | String | _(May be omitted)_ The [Transaction Cost](../../../../concepts/transactions/transaction-cost.md) of this transaction, in [drops of XRP][]. |
|
||||
| `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][], 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 transaction][]. The purpose of this field is to make it easier to track the [funding status of offers](../../../../concepts/tokens/decentralized-exchange/offers.md#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](../subscription-methods/subscribe.md#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](../../../../concepts/tokens/fungible-tokens/freezes.md). |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `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 localhost).
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,110 @@
|
||||
---
|
||||
html: ledger_closed.html
|
||||
parent: ledger-methods.html
|
||||
seo:
|
||||
description: Get the latest closed ledger version.
|
||||
labels:
|
||||
- Blockchain
|
||||
---
|
||||
# ledger_closed
|
||||
[[Source]](https://github.com/XRPLF/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:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"command": "ledger_closed"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_closed",
|
||||
"params": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: ledger_closed
|
||||
rippled ledger_closed
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_closed)
|
||||
|
||||
This method accepts no parameters.
|
||||
|
||||
## Response Format
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"ledger_hash": "17ACB57A0F73B5160713E81FE72B2AC9F6064541004E272BD09F257D57C30C02",
|
||||
"ledger_index": 6643099
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"ledger_hash": "8B5A0C5F6B198254A6E411AF55C29EE40AA86251D2E78DD0BB17647047FA9C24",
|
||||
"ledger_index": 8696231,
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"ledger_hash" : "6F5D3B97F1CAA8440AFCED3CA10FB9DC6472F64DEBC2EFAE7CAE7FC0123F32DA",
|
||||
"ledger_index" : 56843991,
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:-----------------|:-----------------------------------------|
|
||||
| `ledger_hash` | String | The unique [Hash][] of this ledger version, in hexadecimal. |
|
||||
| `ledger_index` | Unsigned Integer | The [ledger index][] of this ledger version. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,110 @@
|
||||
---
|
||||
html: ledger_current.html
|
||||
parent: ledger-methods.html
|
||||
seo:
|
||||
description: Get the current working ledger version.
|
||||
labels:
|
||||
- Blockchain
|
||||
---
|
||||
# ledger_current
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/LedgerCurrent.cpp "Source")
|
||||
|
||||
The `ledger_current` method returns the unique identifiers of the current in-progress [ledger](../../../../concepts/ledgers/index.md). This command is mostly useful for testing, because the ledger returned is still in flux.
|
||||
|
||||
## Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"command": "ledger_current"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_current",
|
||||
"params": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: ledger_current
|
||||
rippled ledger_current
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_current)
|
||||
|
||||
The request contains no parameters.
|
||||
|
||||
|
||||
## Response Format
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"ledger_current_index": 6643240
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"ledger_current_index": 8696233,
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"ledger_current_index" : 56844050,
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following field:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------------|:------------------------------------|:--------------|
|
||||
| `ledger_current_index` | Unsigned Integer - [Ledger Index][] | The ledger index of this ledger version. |
|
||||
|
||||
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][].
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,272 @@
|
||||
---
|
||||
html: ledger_data.html
|
||||
parent: ledger-methods.html
|
||||
seo:
|
||||
description: Get the raw contents of a ledger version.
|
||||
labels:
|
||||
- Blockchain
|
||||
- Data Retention
|
||||
---
|
||||
# ledger_data
|
||||
[[Source]](https://github.com/XRPLF/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:
|
||||
|
||||
{% raw-partial file="/_snippets/no-cli-syntax.md" /%}
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"ledger_hash": "842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8",
|
||||
"command": "ledger_data",
|
||||
"limit": 5,
|
||||
"binary": true
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_data",
|
||||
"params": [
|
||||
{
|
||||
"binary": true,
|
||||
"ledger_hash": "842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8",
|
||||
"limit": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
|
||||
A request can include the following fields:
|
||||
|
||||
| `Field` | Type | Required? | Description |
|
||||
|:---------------|:-----------------|:----------|----------------|
|
||||
| `ledger_hash` | [Hash][] | No | A 20-byte hex string identifying the ledger version to use. |
|
||||
| `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][]) |
|
||||
| `binary` | Boolean | No | If `true`, return ledger entries as hexadecimal strings instead of JSON. The default is `false`. |
|
||||
| `limit` | Number | No | Limit the number of ledger entries to retrieve. The server may return fewer than this number of entries. Cannot be more than 2048 (when requesting binary) or 256 (when requesting JSON). Positive values outside this range are replaced with the closest valid option. The default is the maximum. |
|
||||
| `marker` | [Marker][] | No | Value from a previous paginated response. Resume retrieving data where that response left off. |
|
||||
| `type` | String | No | Filter results to a specific type of ledger entry. The valid types are: `account`, `amendments`, `amm` {% not-enabled /%}, `check`, `deposit_preauth`, `directory`, `escrow`, `fee`, `hashes`, `nft_offer`, `offer`, `payment_channel`, `signer_list`, `state` (trust line), and `ticket`. |
|
||||
|
||||
The `ledger` field is deprecated and may be removed without further notice.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket (binary:true)" %}
|
||||
```json
|
||||
{
|
||||
"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"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="WebSocket (binary:false)" %}
|
||||
```json
|
||||
{
|
||||
"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"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC (binary:true)" %}
|
||||
```json
|
||||
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"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:------------------------------------|:----------------------|
|
||||
| `ledger_index` | Unsigned Integer - [Ledger Index][] | The ledger index of this ledger version. |
|
||||
| `ledger_hash` | String - [Hash][] | Unique identifying hash of this ledger version. |
|
||||
| `state` | Array | Array of JSON objects containing data from the ledger's state tree, as defined below. |
|
||||
| `marker` | [Marker][] | Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. |
|
||||
|
||||
If a `type` field is mentioned in the request, the `state` array will be empty if the first set of array objects does not match the type requested. In such cases, you can use the `marker` from this response to paginate and retrieve further data.
|
||||
|
||||
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 object types](../../../protocol/ledger-data/ledger-entry-types/index.md) for the full list. |
|
||||
| (Additional fields) | (Various) | _(Only included if `"binary":false`)_ Additional fields describing this object, depending on which [ledger object type](../../../protocol/ledger-data/ledger-entry-types/index.md) it is. |
|
||||
| `index` | String | Unique identifier for this ledger entry, as hex. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][]
|
||||
* `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.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,805 @@
|
||||
---
|
||||
html: ledger_entry.html
|
||||
parent: ledger-methods.html
|
||||
seo:
|
||||
description: Get one element from a ledger version.
|
||||
labels:
|
||||
- Blockchain
|
||||
- Data Retention
|
||||
---
|
||||
# ledger_entry
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/LedgerEntry.cpp "Source")
|
||||
|
||||
The `ledger_entry` method returns a single ledger entry from the XRP Ledger in its raw format. See [ledger format][] for information on the different types of entries you can retrieve.
|
||||
|
||||
## Request Format
|
||||
|
||||
This method can retrieve several different types of data. You can select which type of item to retrieve by passing the appropriate parameters, comprised of the general and type-specific fields listed below, and following the standard [request formatting](../../api-conventions/request-formatting.md). (For example, a WebSocket request always has the `command` field and optionally an `id` field, and a JSON-RPC request uses the `method` and `params` fields.)
|
||||
|
||||
{% raw-partial file="/_snippets/no-cli-syntax.md" /%}
|
||||
|
||||
### General Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
|:------------------------|:---------------------------|:----------------------|
|
||||
| `binary` | Boolean | _(Optional)_ If `true`, return the requested ledger entry's contents as a hex string in the XRP Ledger's [binary format](../../../protocol/binary-format.md). Otherwise, return data in JSON format. The default is `false`. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.2.0" %}Updated in: rippled 1.2.0{% /badge %} |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string (e.g. "validated" or "closed" or "current") to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
|
||||
The `generator` and `ledger` parameters are deprecated and may be removed without further notice.
|
||||
|
||||
In addition to the general fields above, you must specify *exactly 1* of the following fields to indicate what type of entry to retrieve, along with its sub-fields as appropriate. The valid fields are:
|
||||
|
||||
- [`index`](#get-ledger-object-by-id)
|
||||
- [`account_root`](#get-accountroot-object)
|
||||
- [`amm`](#get-amm-object) {% not-enabled /%}
|
||||
- [`directory`](#get-directorynode-object)
|
||||
- [`offer`](#get-offer-object)
|
||||
- [`ripple_state`](#get-ripplestate-object)
|
||||
- [`check`](#get-check-object)
|
||||
- [`escrow`](#get-escrow-object)
|
||||
- [`payment_channel`](#get-paychannel-object)
|
||||
- [`deposit_preauth`](#get-depositpreauth-object)
|
||||
- [`ticket`](#get-ticket-object)
|
||||
- [`nft_page`](#get-nft-page)
|
||||
|
||||
**Caution:** If you specify more than 1 of these type-specific fields in a request, the server retrieves results for only 1 of them. It is not defined which one the server chooses, so you should avoid doing this.
|
||||
|
||||
|
||||
### Get Ledger Object by ID
|
||||
|
||||
Retrieve any type of ledger object by its unique ID.
|
||||
|
||||
| Field | Type | Description |
|
||||
|:--------|:-------|:----------------------------------------------------------|
|
||||
| `index` | String | The [ledger entry ID](../../../protocol/ledger-data/common-fields.md) of a single entry to retrieve from the ledger, as a 64-character (256-bit) hexadecimal string. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"command": "ledger_entry",
|
||||
"index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [
|
||||
{
|
||||
"index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4", "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-by-object-id)
|
||||
|
||||
{% admonition type="success" name="Tip" %}
|
||||
You can use this type of request to get any singleton ledger entry, if it exists in the ledger data, because its ID is always the same. For example:
|
||||
|
||||
- [`Amendments`](../../../protocol/ledger-data/ledger-entry-types/amendments.md) - `7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4`
|
||||
- [`FeeSettings`](../../../protocol/ledger-data/ledger-entry-types/feesettings.md) - `4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A651`
|
||||
- [Recent History `LedgerHashes`](../../../protocol/ledger-data/ledger-entry-types/ledgerhashes.md) - `B4979A36CDC7F3D3D5C31A4EAE2AC7D7209DDA877588B9AFC66799692AB0D66B`
|
||||
- [`NegativeUNL`](../../../protocol/ledger-data/ledger-entry-types/negativeunl.md) - `2E8A59AA9D3B5B186B0B9E0F62E6C02587CA74A4D778938E957B6357D364B244`
|
||||
{% /admonition %}
|
||||
|
||||
|
||||
|
||||
### Get AccountRoot Object
|
||||
|
||||
Retrieve an [AccountRoot entry](../../../protocol/ledger-data/ledger-entry-types/accountroot.md) by its address. This is roughly equivalent to the [account_info method][].
|
||||
|
||||
| Field | Type | Description |
|
||||
|:------------------------|:---------------------------|:----------------------|
|
||||
| `account_root` | String - [Address][] | The classic address of the [AccountRoot entry](../../../protocol/ledger-data/ledger-entry-types/accountroot.md) to retrieve. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_get_accountroot",
|
||||
"command": "ledger_entry",
|
||||
"account_root": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [
|
||||
{
|
||||
"account_root": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "account_root": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-accountroot)
|
||||
|
||||
|
||||
|
||||
### Get AMM Object
|
||||
|
||||
_(Requires the [AMM amendment][] {% not-enabled /%})_
|
||||
|
||||
Retrieve an Automated Market-Maker (AMM) object from the ledger. This is similar to [amm_info method][], but the `ledger_entry` version returns only the ledger entry as stored.
|
||||
|
||||
| Field | Type | Description |
|
||||
|:-------------|:-----------------|:----------------------|
|
||||
| `amm` | Object or String | The [AMM](../../../protocol/ledger-data/ledger-entry-types/amm.md) to retrieve. If you specify a string, it must be the [object ID](../../../protocol/ledger-data/common-fields.md) of the AMM, as hexadecimal. If you specify an object, it must contain `asset` and `asset2` sub-fields. |
|
||||
| `amm.asset` | Object | One of the two assets in this AMM's pool, as a [currency object without an amount](../../../protocol/data-types/currency-formats.md#specifying-without-amounts). |
|
||||
| `amm.asset2` | Object | The other of the two assets in this AMM's pool, as a [currency object without an amount](../../../protocol/data-types/currency-formats.md#specifying-without-amounts). |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 3,
|
||||
"command": "ledger_entry",
|
||||
"amm": {
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
}
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [
|
||||
{
|
||||
"amm": {
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "amm": { "asset": { "currency": "XRP" }, "asset2": { "currency" : "TST", "issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd" } }, "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool?server=wss%3A%2F%2Famm.devnet.rippletest.net%3A51233%2F#ledger_entry-amm)
|
||||
|
||||
|
||||
|
||||
### Get DirectoryNode Object
|
||||
|
||||
Retrieve a [DirectoryNode](../../../protocol/ledger-data/ledger-entry-types/directorynode.md), which contains a list of other ledger objects. Can be provided as string (object ID of the Directory) or as an object.
|
||||
|
||||
| Field | Type | Description |
|
||||
|:------------------------|:---------------------------|:----------------------|
|
||||
| `directory` | Object or String | The [DirectoryNode](../../../protocol/ledger-data/ledger-entry-types/directorynode.md) to retrieve. If a string, must be the [object ID](../../../protocol/ledger-data/common-fields.md) of the directory, as hexadecimal. 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 [DirectoryNode](../../../protocol/ledger-data/ledger-entry-types/directorynode.md). |
|
||||
| `directory.dir_root` | String | _(Optional)_ Unique index identifying the directory to retrieve, as a hex string. |
|
||||
| `directory.owner` | String | _(Optional)_ Unique address of the account associated with this directory. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 3,
|
||||
"command": "ledger_entry",
|
||||
"directory": {
|
||||
"owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"sub_index": 0
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [
|
||||
{
|
||||
"directory": {
|
||||
"owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"sub_index": 0
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "directory": { "owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", "sub_index": 0 }, "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-directorynode)
|
||||
|
||||
|
||||
|
||||
### Get Offer Object
|
||||
|
||||
Retrieve an [Offer entry](../../../protocol/ledger-data/ledger-entry-types/offer.md), which defines an offer to exchange currency. Can be provided as string (unique index of the Offer) or as an object.
|
||||
|
||||
| Field | Type | Description |
|
||||
|:------------------------|:---------------------------|:----------------------|
|
||||
| `offer` | Object or String | If a string, interpret as [ledger entry ID](../../../protocol/ledger-data/common-fields.md) of the Offer to retrieve. If an object, requires the sub-fields `account` and `seq` to uniquely identify the offer. |
|
||||
| `offer.account` | String - [Address][] | _(Required if `offer` is specified as an object)_ The account that placed the offer. |
|
||||
| `offer.seq` | Unsigned Integer | _(Required if `offer` is specified as an object)_ The [Sequence Number][] of the transaction that created the Offer entry. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_get_offer",
|
||||
"command": "ledger_entry",
|
||||
"offer": {
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"seq": 359
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [
|
||||
{
|
||||
"offer": {
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"seq": 359
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "offer": { "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", "seq": 359}, "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-offer)
|
||||
|
||||
|
||||
|
||||
### Get RippleState Object
|
||||
|
||||
Retrieve a [RippleState entry][], which tracks a (non-XRP) currency balance between two accounts.
|
||||
|
||||
| Field | Type | Description |
|
||||
|:------------------------|:---------------------------|:----------------------|
|
||||
| `ripple_state` | Object | 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` is specified)_ 2-length array of account [Address][]es, defining the two accounts linked by this RippleState entry. |
|
||||
| `ripple_state.currency` | String | _(Required if `ripple_state` is specified)_ [Currency Code][] of the RippleState entry to retrieve. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_get_ripplestate",
|
||||
"command": "ledger_entry",
|
||||
"ripple_state": {
|
||||
"accounts": [
|
||||
"rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"
|
||||
],
|
||||
"currency": "USD"
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [{
|
||||
"ripple_state": {
|
||||
"accounts": [
|
||||
"rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"
|
||||
],
|
||||
"currency": "USD"
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "ripple_state": { "accounts": ["rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"], "currency": "USD"}, "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-ripplestate)
|
||||
|
||||
|
||||
|
||||
### Get Check Object
|
||||
|
||||
Retrieve a [Check entry](../../../protocol/ledger-data/ledger-entry-types/check.md), which is a potential payment that can be cashed by its recipient.
|
||||
|
||||
| Field | Type | Description |
|
||||
|:--------|:-------|:----------------------------------------------------------|
|
||||
| `check` | String | The [object ID](../../../protocol/ledger-data/common-fields.md) of a [Check entry](../../../protocol/ledger-data/ledger-entry-types/check.md) to retrieve. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_get_check",
|
||||
"command": "ledger_entry",
|
||||
"check": "C4A46CCD8F096E994C4B0DEAB6CE98E722FC17D7944C28B95127C2659C47CBEB",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [{
|
||||
"check": "C4A46CCD8F096E994C4B0DEAB6CE98E722FC17D7944C28B95127C2659C47CBEB",
|
||||
"ledger_index": "validated"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "check": "C4A46CCD8F096E994C4B0DEAB6CE98E722FC17D7944C28B95127C2659C47CBEB", "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-check)
|
||||
|
||||
|
||||
|
||||
### Get Escrow Object
|
||||
|
||||
Retrieve an [Escrow entry](../../../protocol/ledger-data/ledger-entry-types/escrow.md), which holds XRP until a specific time or condition is met. Can be provided as string (object ID of the Escrow) or as an object.
|
||||
|
||||
| Field | Type | Description |
|
||||
|:------------------------|:---------------------------|:----------------------|
|
||||
| `escrow` | Object or String | The Escrow to retrieve. If a string, must be the [object ID](../../../protocol/ledger-data/common-fields.md) of the Escrow, as hexadecimal. If an object, requires `owner` and `seq` sub-fields. |
|
||||
| `escrow.owner` | String - [Address][] | _(Required if `escrow` is specified as an object)_ The owner (sender) of the Escrow object. |
|
||||
| `escrow.seq` | Unsigned Integer | _(Required if `escrow` is specified as an object)_ The [Sequence Number][] of the transaction that created the Escrow object. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_get_escrow",
|
||||
"command": "ledger_entry",
|
||||
"escrow": {
|
||||
"owner": "rL4fPHi2FWGwRGRQSH7gBcxkuo2b9NTjKK",
|
||||
"seq": 126
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [{
|
||||
"escrow": {
|
||||
"owner": "rL4fPHi2FWGwRGRQSH7gBcxkuo2b9NTjKK",
|
||||
"seq": 126
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "escrow": { "owner": "rL4fPHi2FWGwRGRQSH7gBcxkuo2b9NTjKK", "seq": 126 }, "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-escrow)
|
||||
|
||||
|
||||
|
||||
### Get PayChannel Object
|
||||
|
||||
Retrieve a [PayChannel entry](../../../protocol/ledger-data/ledger-entry-types/paychannel.md), which holds XRP for asynchronous payments.
|
||||
|
||||
| Field | Type | Description |
|
||||
|:------------------|:-------|:------------------------------------------------|
|
||||
| `payment_channel` | String | The [object ID](../../../protocol/ledger-data/common-fields.md) of the PayChannel to retrieve. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_get_paychannel",
|
||||
"command": "ledger_entry",
|
||||
"payment_channel": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [{
|
||||
"payment_channel": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7",
|
||||
"ledger_index": "validated"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "payment_channel": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7", "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-paychannel)
|
||||
|
||||
|
||||
### Get DepositPreauth Object
|
||||
|
||||
Retrieve a [DepositPreauth entry](../../../protocol/ledger-data/ledger-entry-types/depositpreauth.md), which tracks preauthorization for payments to accounts requiring [Deposit Authorization](../../../../concepts/accounts/depositauth.md).
|
||||
|
||||
| Field | Type | Description |
|
||||
|:-----------------------------|:---------------------|:-----------------------|
|
||||
| `deposit_preauth` | Object or String | Specify the DepositPreauth to retrieve. If a string, must be the [ledger entry ID](../../../protocol/ledger-data/common-fields.md) of the DepositPreauth entry, as hexadecimal. If an object, requires `owner` and `authorized` sub-fields. |
|
||||
| `deposit_preauth.owner` | String - [Address][] | _(Required if `deposit_preauth` is specified as an object)_ The account that provided the preauthorization. |
|
||||
| `deposit_preauth.authorized` | String - [Address][] | _(Required if `deposit_preauth` is specified as an object)_ The account that received the preauthorization. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_get_deposit_preauth",
|
||||
"command": "ledger_entry",
|
||||
"deposit_preauth": {
|
||||
"owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"authorized": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX"
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [{
|
||||
"deposit_preauth": {
|
||||
"owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"authorized": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX"
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "deposit_preauth": { "owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", "authorized": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX" }, "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-depositpreauth)
|
||||
|
||||
|
||||
### Get Ticket Object
|
||||
|
||||
Retrieve a [Ticket entry](../../../protocol/ledger-data/ledger-entry-types/ticket.md), which represents a [sequence number][] set aside for future use. _(Added by the [TicketBatch amendment][])_
|
||||
|
||||
| Field | Type | Description |
|
||||
|:--------------------|:---------------------|:----------------------|
|
||||
| `ticket` | Object or String | The Ticket to retrieve. If a string, must be the [ledger entry ID](../../../protocol/ledger-data/common-fields.md) of the Ticket, as hexadecimal. If an object, the `account` and `ticket_seq` sub-fields are required to uniquely specify the Ticket entry. |
|
||||
| `ticket.account` | String - [Address][] | _(Required if `ticket` is specified as an object)_ The owner of the Ticket. |
|
||||
| `ticket.ticket_seq` | Number | _(Required if `ticket` is specified as an object)_ The Ticket Sequence number of the Ticket to retrieve. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_get_ticket",
|
||||
"command": "ledger_entry",
|
||||
"ticket": {
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"ticket_seq": 389
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [{
|
||||
"ticket": {
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"ticket_seq": 389
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "ticket": { "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", "ticket_seq: 389 }, "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-ticket)
|
||||
|
||||
|
||||
### Get NFT Page
|
||||
|
||||
Return an NFT Page in its raw ledger format.
|
||||
|
||||
| Field | Type | Description |
|
||||
|:------------------------|:---------------------------|:----------------------|
|
||||
| `nft_page` | String | The [ledger entry ID](../../../protocol/ledger-data/common-fields.md) of an [NFT Page](../../../protocol/ledger-data/ledger-entry-types/nftokenpage.md) to retrieve. |
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_get_nft_page",
|
||||
"command": "ledger_entry",
|
||||
"nft_page": "255DD86DDF59D778081A06D02701E9B2C9F4F01DFFFFFFFFFFFFFFFFFFFFFFFF",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [{
|
||||
"nft_page": "255DD86DDF59D778081A06D02701E9B2C9F4F01DFFFFFFFFFFFFFFFFFFFFFFFF",
|
||||
"ledger_index": "validated"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
rippled json ledger_entry '{ "nft_page": "255DD86DDF59D778081A06D02701E9B2C9F4F01DFFFFFFFFFFFFFFFFFFFFFFFF", "ledger_index": "validated" }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ledger_entry-nft-page)
|
||||
|
||||
## Response Format
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------------|:-----------------|:-----------------------------------------|
|
||||
| `index` | String | The unique ID of this [ledger entry](../../../protocol/ledger-data/ledger-entry-types/index.md). |
|
||||
| `ledger_index` | Unsigned Integer | The [ledger index][] of the ledger that was used when retrieving this data. |
|
||||
| `node` | Object | _(Omitted if `"binary": true` specified.)_ Object containing the data of this ledger entry, according to the [ledger format][]. |
|
||||
| `node_binary` | String | _(Omitted unless `"binary":true` specified)_ The [binary representation](../../../protocol/binary-format.md) of the ledger object, as hexadecimal. |
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "example_get_accountroot",
|
||||
"result": {
|
||||
"index": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
|
||||
"ledger_hash": "31850E8E48E76D1064651DF39DF4E9542E8C90A9A9B629F4DE339EB3FA74F726",
|
||||
"ledger_index": 61966146,
|
||||
"node": {
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"AccountTxnID": "4E0AA11CBDD1760DE95B68DF2ABBE75C9698CEB548BEA9789053FCB3EBD444FB",
|
||||
"Balance": "424021949",
|
||||
"Domain": "6D64756F31332E636F6D",
|
||||
"EmailHash": "98B4375E1D753E5B91627516F6D70977",
|
||||
"Flags": 9568256,
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"MessageKey": "0000000000000000000000070000000300",
|
||||
"OwnerCount": 12,
|
||||
"PreviousTxnID": "4E0AA11CBDD1760DE95B68DF2ABBE75C9698CEB548BEA9789053FCB3EBD444FB",
|
||||
"PreviousTxnLgrSeq": 61965653,
|
||||
"RegularKey": "rD9iJmieYHn8jTtPjwwkW2Wm9sVDvPXLoJ",
|
||||
"Sequence": 385,
|
||||
"TransferRate": 4294967295,
|
||||
"index": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8"
|
||||
},
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"index": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
|
||||
"ledger_hash": "395946243EA36C5092AE58AF729D2875F659812409810A63096AC006C73E656E",
|
||||
"ledger_index": 61966165,
|
||||
"node": {
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"AccountTxnID": "4E0AA11CBDD1760DE95B68DF2ABBE75C9698CEB548BEA9789053FCB3EBD444FB",
|
||||
"Balance": "424021949",
|
||||
"Domain": "6D64756F31332E636F6D",
|
||||
"EmailHash": "98B4375E1D753E5B91627516F6D70977",
|
||||
"Flags": 9568256,
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"MessageKey": "0000000000000000000000070000000300",
|
||||
"OwnerCount": 12,
|
||||
"PreviousTxnID": "4E0AA11CBDD1760DE95B68DF2ABBE75C9698CEB548BEA9789053FCB3EBD444FB",
|
||||
"PreviousTxnLgrSeq": 61965653,
|
||||
"RegularKey": "rD9iJmieYHn8jTtPjwwkW2Wm9sVDvPXLoJ",
|
||||
"Sequence": 385,
|
||||
"TransferRate": 4294967295,
|
||||
"index": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8"
|
||||
},
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"index": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
|
||||
"ledger_hash": "395946243EA36C5092AE58AF729D2875F659812409810A63096AC006C73E656E",
|
||||
"ledger_index": 61966165,
|
||||
"node": {
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"AccountTxnID": "4E0AA11CBDD1760DE95B68DF2ABBE75C9698CEB548BEA9789053FCB3EBD444FB",
|
||||
"Balance": "424021949",
|
||||
"Domain": "6D64756F31332E636F6D",
|
||||
"EmailHash": "98B4375E1D753E5B91627516F6D70977",
|
||||
"Flags": 9568256,
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"MessageKey": "0000000000000000000000070000000300",
|
||||
"OwnerCount": 12,
|
||||
"PreviousTxnID": "4E0AA11CBDD1760DE95B68DF2ABBE75C9698CEB548BEA9789053FCB3EBD444FB",
|
||||
"PreviousTxnLgrSeq": 61965653,
|
||||
"RegularKey": "rD9iJmieYHn8jTtPjwwkW2Wm9sVDvPXLoJ",
|
||||
"Sequence": 385,
|
||||
"TransferRate": 4294967295,
|
||||
"index": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8"
|
||||
},
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `deprecatedFeature` - The request specified a removed field, such as `generator`.
|
||||
* `entryNotFound` - The requested ledger entry does not exist in the ledger.
|
||||
* `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.
|
||||
* `malformedAddress` - The request improperly specified an [Address][] field.
|
||||
* `malformedCurrency` - The request improperly specified a [Currency Code][] field.
|
||||
* `malformedOwner` - The request improperly specified the `escrow.owner` sub-field.
|
||||
* `malformedRequest` - The request provided an invalid combination of fields, or provided the wrong type for one or more fields.
|
||||
* `unknownOption` - The fields provided in the request did not match any of the expected request formats.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,260 @@
|
||||
---
|
||||
html: amm_info.html
|
||||
parent: path-and-order-book-methods.html
|
||||
seo:
|
||||
description: Get info about an Automated Market Maker (AMM) instance.
|
||||
status: not_enabled
|
||||
labels:
|
||||
- Decentralized Exchange
|
||||
- Cross-Currency
|
||||
- AMM
|
||||
---
|
||||
# amm_info
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/AMMInfo.cpp "Source")
|
||||
|
||||
The {% code-page-name /%} method gets information about an Automated Market Maker (AMM) instance.
|
||||
|
||||
_(Requires the [AMM amendment][] {% not-enabled /%})_
|
||||
|
||||
|
||||
### Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
{% raw-partial file="/_snippets/no-cli-syntax.md" /%}
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"command": "{% $frontmatter.seo.title %}",
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "{% $frontmatter.seo.title %}",
|
||||
"params": [{
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool?server=wss%3A%2F%2Famm.devnet.rippletest.net%3A51233%2F#amm_info)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Required? | Description |
|
||||
|:--------------|:-----------------|:----------|-------------|
|
||||
| `account` | String - [Address][] | No | Show only LP Tokens held by this liquidity provider. |
|
||||
| `amm_account` | String - [Address][] | No | The address of the AMM's special AccountRoot. (This is the `issuer` of the AMM's LP Tokens.) |
|
||||
| `asset` | Object or String | No | One of the assets of the AMM to look up, as an object with `currency` and `issuer` fields (omit `issuer` for XRP), like [currency amounts][Currency Amount]. For XRP, you can specify as the string `XRP` instead of as an object. |
|
||||
| `asset2` | Object or String | No | The other of the assets of the AMM, as an object with `currency` and `issuer` fields (omit `issuer` for XRP), like [currency amounts][Currency Amount]. |
|
||||
|
||||
You must specify _either_ `amm_account` or both `asset` and `asset2`.
|
||||
|
||||
### Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"amm": {
|
||||
"account": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"amount": "296890496",
|
||||
"amount2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value": "25.81656470648473"
|
||||
},
|
||||
"asset2_frozen": false,
|
||||
"auction_slot": {
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"auth_accounts": [
|
||||
{
|
||||
"account": "r3f2WpQMsAd8k4Zoijv2PZ78EYFJ2EdvgV"
|
||||
},
|
||||
{
|
||||
"account": "rnW8FAPgpQgA6VoESnVrUVJHBdq9QAtRZs"
|
||||
}
|
||||
],
|
||||
"discounted_fee": 60,
|
||||
"expiration": "2023-Jan-26 00:28:40.000000000 UTC",
|
||||
"price": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "0"
|
||||
},
|
||||
"time_interval": 0
|
||||
},
|
||||
"lp_token": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "87533.41976112682"
|
||||
},
|
||||
"trading_fee": 600,
|
||||
"vote_slots": [
|
||||
{
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"trading_fee": 600,
|
||||
"vote_weight": 9684
|
||||
}
|
||||
]
|
||||
},
|
||||
"ledger_current_index": 316725,
|
||||
"validated": false
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"amm": {
|
||||
"account": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"amount": "296890496",
|
||||
"amount2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value": "25.81656470648473"
|
||||
},
|
||||
"asset2_frozen": false,
|
||||
"auction_slot": {
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"auth_accounts": [
|
||||
{
|
||||
"account": "r3f2WpQMsAd8k4Zoijv2PZ78EYFJ2EdvgV"
|
||||
},
|
||||
{
|
||||
"account": "rnW8FAPgpQgA6VoESnVrUVJHBdq9QAtRZs"
|
||||
}
|
||||
],
|
||||
"discounted_fee": 0,
|
||||
"expiration": "2023-Jan-26 00:28:40.000000000 UTC",
|
||||
"price": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "0"
|
||||
},
|
||||
"time_interval": 0
|
||||
},
|
||||
"lp_token": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "87533.41976112682"
|
||||
},
|
||||
"trading_fee": 600,
|
||||
"vote_slots": [
|
||||
{
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"trading_fee": 600,
|
||||
"vote_weight": 9684
|
||||
}
|
||||
]
|
||||
},
|
||||
"ledger_current_index": 316745,
|
||||
"status": "success",
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:-----------------------|:-----------------|:----------------------------------------------------------|
|
||||
| `amm` | Object | An [**AMM Description Object**](#amm-description-object) for the requested asset pair. |
|
||||
| `ledger_current_index` | [Ledger Index][] | _(Omitted if `ledger_index` is provided instead)_ The [ledger index][] of the current in-progress ledger, which was used when retrieving this information. |
|
||||
| `ledger_hash` | [Hash][] | _(Omitted if `ledger_current_index` is provided instead)_ The identifying hash of the ledger version that was used when retrieving this data. |
|
||||
| `ledger_index` | [Ledger Index][] | _(Omitted if `ledger_current_index` is provided instead)_ The [ledger index][] of the ledger version used when retrieving this information. |
|
||||
| `validated` | Boolean | If `true`, the ledger used for this request is validated and these results are final; if omitted or set to `false`, the data is pending and may change. |
|
||||
|
||||
|
||||
### AMM Description Object
|
||||
|
||||
The `amm` field is an object describing the current status of an Automated Market Maker (AMM) in the ledger, and contains the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|-----------------|---------------------|-------------|
|
||||
| `account` | String | The [Address][] of the AMM Account. |
|
||||
| `amount` | [Currency Amount][] | The total amount of one asset in the AMM's pool. (Note: This could be `asset` _or_ `asset2` from the request.) |
|
||||
| `amount2` | [Currency Amount][] | The total amount of the other asset in the AMM's pool. (Note: This could be `asset` _or_ `asset2` from the request.) |
|
||||
| `asset_frozen` | Boolean | _(Omitted for XRP)_ If `true`, the `amount` currency is currently [frozen](../../../../concepts/tokens/fungible-tokens/freezes.md). |
|
||||
| `asset2_frozen` | Boolean | _(Omitted for XRP)_ If `true`, the `amount2` currency is currently [frozen](../../../../concepts/tokens/fungible-tokens/freezes.md). |
|
||||
| `auction_slot` | Object | _(May be omitted)_ An [Auction Slot Object](#auction-slot-object) describing the current auction slot holder, if there is one. |
|
||||
| `lp_token` | [Currency Amount][] | The total amount of this AMM's LP Tokens outstanding. If the request specified a liquidity provider in the `account` field, instead, this is the amount of this AMM's LP Tokens held by that liquidity provider. |
|
||||
| `trading_fee` | Number | The AMM's current trading fee, in units of 1/100,000; a value of 1 is equivalent to a 0.001% fee. |
|
||||
| `vote_slots` | Array | _(May be omitted)_ The current votes for the AMM's trading fee, as [Vote Slot Objects](#vote-slot-objects). |
|
||||
|
||||
|
||||
### Auction Slot Object
|
||||
|
||||
The `auction_slot` field of the `amm` object describes the current auction slot holder of the AMM, and contains the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|------------------|---------------------|-------------|
|
||||
| `account` | String | The [Address][] of the account that owns the auction slot. |
|
||||
| `auth_accounts` | Array | A list of additional accounts that the auction slot holder has designated as being eligible of the discounted trading fee. Each member of this array is an object with one field, `account`, containing the address of the designated account. |
|
||||
| `discounted_fee` | Number | The discounted trading fee that applies to the auction slot holder, and any eligible accounts, when trading against this AMM. This is 1/10 of the AMM's normal trading fee. |
|
||||
| `expiration` | String | The ISO 8601 UTC timestamp after which this auction slot expires. After expired, the auction slot does not apply (but the data can remain in the ledger until another transaction replaces it or cleans it up). |
|
||||
| `price` | [Currency Amount][] | The amount, in LP Tokens, that the auction slot holder paid to win the auction slot. This affects the price to outbid the current slot holder. |
|
||||
| `time_interval` | Number | The current 72-minute time interval this auction slot is in, from 0 to 19. The auction slot expires after 24 hours (20 intervals of 72 minutes) and affects the cost to outbid the current holder and how much the current holder is refunded if someone outbids them. |
|
||||
|
||||
|
||||
### Vote Slot Objects
|
||||
|
||||
Each entry in the `vote_slots` array represents one liquidity provider's vote to set the trading fee, and contains the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|---------------|--------|-------------|
|
||||
| `account` | String | The [Address][] of this liquidity provider. |
|
||||
| `trading_fee` | Number | The trading fee this liquidity provider voted for, in units of 1/100,000. |
|
||||
| `vote_weight` | Number | How much this liquidity provider's vote counts towards the final trading fee. This is proportional to how much of the AMM's LP Tokens this liquidity provider holds. The value is equal to 100,000 times the number of this LP Tokens this liquidity provider holds, divided by the total number of LP Tokens outstanding. For example, a value of 1000 means that the liquidity provider holds 1% of this AMM's LP Tokens. |
|
||||
|
||||
|
||||
### Possible Errors
|
||||
|
||||
- Any of the [universal error types][].
|
||||
- `actNotFound` - The AMM for this asset pair does not exist, or an account specified in the request does not exist.
|
||||
- `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
|
||||
|
||||
## See Also
|
||||
|
||||
- [AMM object](../../../protocol/ledger-data/ledger-entry-types/amm.md) - The canonical storage format of the AMM object
|
||||
- [AMMBid][] - More info on the auction slot and bidding mechanism
|
||||
- [AMMVote][] - More info on the trading fee voting mechanism
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,267 @@
|
||||
---
|
||||
html: book_offers.html
|
||||
parent: path-and-order-book-methods.html
|
||||
seo:
|
||||
description: Get info about offers to exchange two currencies.
|
||||
labels:
|
||||
- Decentralized Exchange
|
||||
- Cross-Currency
|
||||
---
|
||||
# book_offers
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/BookOffers.cpp "Source")
|
||||
|
||||
The `book_offers` method retrieves a list of [Offers](../../../../concepts/tokens/decentralized-exchange/offers.md) between two currencies, also known as an _order book_. The response omits [unfunded Offers](../../../../concepts/tokens/decentralized-exchange/offers.md#lifecycle-of-an-offer) and reports how much of each remaining Offer's total is currently funded.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 4,
|
||||
"command": "book_offers",
|
||||
"taker": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"taker_gets": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"taker_pays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
|
||||
},
|
||||
"limit": 10
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "book_offers",
|
||||
"params": [
|
||||
{
|
||||
"taker": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"taker_gets": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"taker_pays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
|
||||
},
|
||||
"limit": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: book_offers taker_pays taker_gets [taker [ledger [limit] ] ]
|
||||
rippled book_offers 'USD/rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B' 'EUR/rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#book_offers)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Required? | Description |
|
||||
|:---------------|:-----------------|:----------|-------------|
|
||||
| `taker_gets` | Object | Yes | The asset the account taking the Offer would receive, as a [currency without an amount](../../../protocol/data-types/currency-formats.md#specifying-without-amounts). |
|
||||
| `taker_pays` | Object | Yes | The asset the account taking the Offer would pay, as a [currency without an amount](../../../protocol/data-types/currency-formats.md#specifying-without-amounts). |
|
||||
| `ledger_hash` | [Hash][] | No | A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `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][]) |
|
||||
| `limit` | Number | No | The maximum number of Offers to return. The response may include fewer results. |
|
||||
| `taker` | String | No | The [Address][] of an account to use as a perspective. The response includes this account's Offers even if they are unfunded. (You can use this to see what Offers are above or below yours in the order book.) |
|
||||
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 11,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"ledger_current_index": 7035305,
|
||||
"offers": [
|
||||
{
|
||||
"Account": "rM3X3QSr8icjTGpaF52dozhbT2BZSXJQYM",
|
||||
"BookDirectory": "7E5F614417C2D0A7CEFEB73C4AA773ED5B078DE2B5771F6D55055E4C405218EB",
|
||||
"BookNode": "0000000000000000",
|
||||
"Flags": 0,
|
||||
"LedgerEntryType": "Offer",
|
||||
"OwnerNode": "0000000000000AE0",
|
||||
"PreviousTxnID": "6956221794397C25A53647182E5C78A439766D600724074C99D78982E37599F1",
|
||||
"PreviousTxnLgrSeq": 7022646,
|
||||
"Sequence": 264542,
|
||||
"TakerGets": {
|
||||
"currency": "EUR",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "17.90363633316433"
|
||||
},
|
||||
"TakerPays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "27.05340557506234"
|
||||
},
|
||||
"index": "96A9104BF3137131FF8310B9174F3B37170E2144C813CA2A1695DF2C5677E811",
|
||||
"quality": "1.511056473200875"
|
||||
},
|
||||
{
|
||||
"Account": "rhsxKNyN99q6vyYCTHNTC1TqWCeHr7PNgp",
|
||||
"BookDirectory": "7E5F614417C2D0A7CEFEB73C4AA773ED5B078DE2B5771F6D5505DCAA8FE12000",
|
||||
"BookNode": "0000000000000000",
|
||||
"Flags": 131072,
|
||||
"LedgerEntryType": "Offer",
|
||||
"OwnerNode": "0000000000000001",
|
||||
"PreviousTxnID": "8AD748CD489F7FF34FCD4FB73F77F1901E27A6EFA52CCBB0CCDAAB934E5E754D",
|
||||
"PreviousTxnLgrSeq": 7007546,
|
||||
"Sequence": 265,
|
||||
"TakerGets": {
|
||||
"currency": "EUR",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "2.542743233917848"
|
||||
},
|
||||
"TakerPays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "4.19552633596446"
|
||||
},
|
||||
"index": "7001797678E886E22D6DE11AF90DF1E08F4ADC21D763FAFB36AF66894D695235",
|
||||
"quality": "1.65"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"ledger_current_index": 8696243,
|
||||
"offers": [],
|
||||
"status": "success",
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"ledger_current_index" : 56867201,
|
||||
"offers" : [
|
||||
{
|
||||
"Account" : "rnixnrMHHvR7ejMpJMRCWkaNrq3qREwMDu",
|
||||
"BookDirectory" : "7E5F614417C2D0A7CEFEB73C4AA773ED5B078DE2B5771F6D56038D7EA4C68000",
|
||||
"BookNode" : "0000000000000000",
|
||||
"Flags" : 131072,
|
||||
"LedgerEntryType" : "Offer",
|
||||
"OwnerNode" : "0000000000000000",
|
||||
"PreviousTxnID" : "E43ADD1BD4AC2049E0D9DE6BC279B7FD95A99C8DE2C4694A4A7623F6D9AAAE29",
|
||||
"PreviousTxnLgrSeq" : 47926685,
|
||||
"Sequence" : 219,
|
||||
"TakerGets" : {
|
||||
"currency" : "EUR",
|
||||
"issuer" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value" : "2.459108753792364"
|
||||
},
|
||||
"TakerPays" : {
|
||||
"currency" : "USD",
|
||||
"issuer" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value" : "24.59108753792364"
|
||||
},
|
||||
"index" : "3087B4828C6B5D8595EA325D69C0F396C57452893647799493A38F2C164990AB",
|
||||
"owner_funds" : "2.872409153061363",
|
||||
"quality" : "10"
|
||||
},
|
||||
{
|
||||
"Account" : "rKwjWCKBaASEvtHCxtvReNd2i9n8DxSihk",
|
||||
"BookDirectory" : "7E5F614417C2D0A7CEFEB73C4AA773ED5B078DE2B5771F6D56038D7EA4C68000",
|
||||
"BookNode" : "0000000000000000",
|
||||
"Flags" : 131072,
|
||||
"LedgerEntryType" : "Offer",
|
||||
"OwnerNode" : "0000000000000000",
|
||||
"PreviousTxnID" : "B63B2ECD124FE6B02BC2998929517266BD221A02FEE51DDE4992C1BCB7E86CD3",
|
||||
"PreviousTxnLgrSeq" : 43166305,
|
||||
"Sequence" : 19,
|
||||
"TakerGets" : {
|
||||
"currency" : "EUR",
|
||||
"issuer" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value" : "3.52"
|
||||
},
|
||||
"TakerPays" : {
|
||||
"currency" : "USD",
|
||||
"issuer" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value" : "35.2"
|
||||
},
|
||||
"index" : "89865F2C70D1140796D9D249AC2ED765AE2D007A52DEC6D6D64CCB1A77A6EB7F",
|
||||
"owner_funds" : "3.523192614770459",
|
||||
"quality" : "10",
|
||||
"taker_gets_funded" : {
|
||||
"currency" : "EUR",
|
||||
"issuer" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value" : "3.516160294182094"
|
||||
},
|
||||
"taker_pays_funded" : {
|
||||
"currency" : "USD",
|
||||
"issuer" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value" : "35.16160294182094"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status" : "success",
|
||||
"validated" : false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------------|:-----------------|:------------------------|
|
||||
| `ledger_current_index` | [Ledger Index][] | _(Omitted if `ledger_current_index` is provided)_ The [ledger index][] of the current in-progress ledger version, which was used to retrieve this information. |
|
||||
| `ledger_index` | [Ledger Index][] | _(Omitted if `ledger_current_index` provided)_ The ledger index of the ledger version that was used when retrieving this data, as requested. |
|
||||
| `ledger_hash` | [Hash][] | _(May be omitted)_ The identifying hash of the ledger version that was used when retrieving this data, as requested. |
|
||||
| `offers` | Array | Array of offer objects, each of which has the fields of an [Offer object](../../../protocol/ledger-data/ledger-entry-types/offer.md) |
|
||||
|
||||
In addition to the standard Offer fields, the following fields may be included in members of the `offers` array:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:--------------------|:--------------------|:--------------------|
|
||||
| `owner_funds` | String | Amount of the `TakerGets` currency the side placing the offer has available to be traded. (XRP is represented as drops; any other currency is represented as a decimal value.) If a trader has multiple offers in the same book, only the highest-ranked offer includes this field. |
|
||||
| `taker_gets_funded` | [Currency Amount][] | _(Only included in partially-funded offers)_ The maximum amount of currency that the taker can get, given the funding status of the offer. |
|
||||
| `taker_pays_funded` | [Currency Amount][] | _(Only included in partially-funded offers)_ The maximum amount of currency that the taker would pay, given the funding status of the offer. |
|
||||
| `quality` | String | The exchange rate, as the ratio `taker_pays` divided by `taker_gets`. For fairness, offers that have the same quality are automatically taken first-in, first-out. (In other words, if multiple people offer to exchange currency at the same rate, the oldest offer is taken first.) |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `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.
|
||||
* `srcCurMalformed` - The `taker_pays` field in the request is not formatted properly.
|
||||
* `dstAmtMalformed` - The `taker_gets` field in the request is not formatted properly.
|
||||
* `srcIsrMalformed` - The `issuer` field of the `taker_pays` field in the request is not valid.
|
||||
* `dstIsrMalformed` - The `issuer` field of the `taker_gets` field in the request is not valid.
|
||||
* `badMarket` - The desired order book does not exist; for example, offers to exchange a currency for itself.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,150 @@
|
||||
---
|
||||
html: deposit_authorized.html
|
||||
parent: path-and-order-book-methods.html
|
||||
seo:
|
||||
description: Check whether an account is authorized to send money directly to another.
|
||||
labels:
|
||||
- Accounts
|
||||
- Security
|
||||
---
|
||||
# deposit_authorized
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/817d2339b8632cb2f97d3edd6f7af33aa7631744/src/ripple/rpc/handlers/DepositAuthorized.cpp "Source")
|
||||
|
||||
The `deposit_authorized` command indicates whether one account is authorized to send payments directly to another. See [Deposit Authorization](../../../../concepts/accounts/depositauth.md) for information on how to require authorization to deliver money to your account. <!-- STYLE_OVERRIDE: is authorized to -->
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "deposit_authorized",
|
||||
"source_account": "rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de",
|
||||
"destination_account": "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "deposit_authorized",
|
||||
"params": [
|
||||
{
|
||||
"source_account": "rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de",
|
||||
"destination_account": "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```bash
|
||||
#Syntax: deposit_authorized <source_account> <destination_account> [<ledger>]
|
||||
rippled deposit_authorized rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8 validated
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:----------------------|:---------------------------|:------------------------|
|
||||
| `source_account` | String - [Address][] | The sender of a possible payment. |
|
||||
| `destination_account` | String - [Address][] | The recipient of a possible payment. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"result": {
|
||||
"deposit_authorized": true,
|
||||
"destination_account": "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8",
|
||||
"ledger_hash": "BD03A10653ED9D77DCA859B7A735BF0580088A8F287FA2C5403E0A19C58EF322",
|
||||
"ledger_index": 8,
|
||||
"source_account": "rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de",
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"deposit_authorized": true,
|
||||
"destination_account": "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8",
|
||||
"ledger_hash": "BD03A10653ED9D77DCA859B7A735BF0580088A8F287FA2C5403E0A19C58EF322",
|
||||
"ledger_index": 8,
|
||||
"source_account": "rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de",
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
Loading: "/etc/rippled.cfg"
|
||||
2018-Jul-30 20:07:38.771658157 HTTPClient:NFO Connecting to 127.0.0.1:5005
|
||||
|
||||
{
|
||||
"result" : {
|
||||
"deposit_authorized" : true,
|
||||
"destination_account" : "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8",
|
||||
"ledger_hash" : "BD03A10653ED9D77DCA859B7A735BF0580088A8F287FA2C5403E0A19C58EF322",
|
||||
"ledger_index" : 8,
|
||||
"source_account" : "rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de",
|
||||
"status" : "success",
|
||||
"validated" : true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------------|:--------------------------|:------------------------|
|
||||
| `deposit_authorized` | Boolean | Whether the specified source account is authorized to send payments directly to the destination account. If `true`, either the destination account does not require [Deposit Authorization](../../../../concepts/accounts/depositauth.md) or the source account is preauthorized. |
|
||||
| `destination_account` | String - [Address][] | The destination account specified in the request. |
|
||||
| `ledger_hash` | String | _(May be omitted)_ The identifying hash of the ledger that was used to generate this response. |
|
||||
| `ledger_index` | Number - [Ledger Index][] | _(May be omitted)_ The ledger index of the ledger version that was used to generate this response. |
|
||||
| `ledger_current_index` | Number - [Ledger Index][] | _(May be omitted)_ The ledger index of the current in-progress ledger version, which was used to generate this response. |
|
||||
| `source_account` | String - [Address][] | The source account specified in the request. |
|
||||
| `validated` | Boolean | _(May be omitted)_ If `true`, the information comes from a validated ledger version. |
|
||||
|
||||
**Note:** A `deposit_authorized` status of `true` does not guarantee that a payment can be sent from the specified source to the specified destination. For example, the destination account may not have a [trust line](../../../../concepts/tokens/fungible-tokens/index.md) for the specified currency, or there may not be enough liquidity to deliver a payment.
|
||||
|
||||
## 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` - An [Address][] specified in the `source_account` or `destination_account` field of the request was not properly formatted. (It may contain a typo or be the wrong length, causing a failed checksum.)
|
||||
* `dstActNotFound` - The `destination_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 it does exist but the server does not have it.
|
||||
* `srcActNotFound` - The `source_account` field of the request does not correspond to an account in the ledger.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
html: path-and-order-book-methods.html
|
||||
parent: public-api-methods.html
|
||||
metadata:
|
||||
indexPage: true
|
||||
---
|
||||
# Path and Order Book Methods
|
||||
|
||||
Paths define a way for payments to flow through intermediary steps on their way from sender to receiver. Paths enable cross-currency payments by connecting sender and receiver through order books. Use these methods to work with paths and other books.
|
||||
|
||||
|
||||
{% child-pages /%}
|
||||
@@ -0,0 +1,133 @@
|
||||
---
|
||||
html: nft_buy_offers.html
|
||||
parent: path-and-order-book-methods.html
|
||||
seo:
|
||||
description: Get a list of all buy offers for a NFToken.
|
||||
labels:
|
||||
- Non-fungible Tokens, NFTs, NFTokens
|
||||
---
|
||||
# nft_buy_offers
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/NFTOffers.cpp "Source")
|
||||
|
||||
The `nft_buy_offers` method returns a list of buy offers for a given [NFToken][] object.
|
||||
|
||||
_(Added by the [NonFungibleTokensV1_1 amendment][].)_
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% raw-partial file="/_snippets/no-cli-syntax.md" /%}
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"command": "nft_buy_offers",
|
||||
"nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "nft_buy_offers",
|
||||
"params": [{
|
||||
"nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
|
||||
"ledger_index": "validated"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#nft_buy_offers)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------------|:-----------------|:-----------------------------------------|
|
||||
| `nft_id` | String | The unique identifier of a [NFToken][] object. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Number | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
| `limit` | Integer | _(Optional)_ Limit the number of NFT buy offers to retrieve. This value cannot be lower than 50 or more than 500. Positive values outside this range are replaced with the closest valid option. The default is 250. |
|
||||
| `marker` | [Marker][] | _(Optional)_ Value from a previous paginated response. Resume retrieving data where that response left off. |
|
||||
|
||||
|
||||
## Response Format
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
|
||||
"offers": [
|
||||
{
|
||||
"amount": "1500",
|
||||
"flags": 0,
|
||||
"nft_offer_index": "3212D26DB00031889D4EF7D9129BB0FA673B5B40B1759564486C0F0946BA203F",
|
||||
"owner": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx"
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
|
||||
"offers": [
|
||||
{
|
||||
"amount": "1500",
|
||||
"flags": 0,
|
||||
"nft_offer_index": "3212D26DB00031889D4EF7D9129BB0FA673B5B40B1759564486C0F0946BA203F",
|
||||
"owner": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx"
|
||||
}
|
||||
],
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------|:-----------|:-----------------------------------------------------|
|
||||
| `nft_id` | String | The NFToken these offers are for, as specified in the request. |
|
||||
| `offers` | Array | A list of buy offers for the token. Each of these is formatted as a **Buy Offer** (see below). |
|
||||
| `limit` | Number | _(May be omitted)_ The `limit`, as specified in the request. |
|
||||
| `marker` | [Marker][] | _(May be omitted)_ Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. Omitted when there are no pages of information after this one. |
|
||||
|
||||
### Buy Offers
|
||||
|
||||
Each member of the `offers` array represents one [NFTokenOffer object][] to buy the NFT in question and has the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------|:-----------------|:--------------------------------------|
|
||||
| `amount` | String or Object | The amount offered to buy the NFT for, as a String representing an amount in drops of XRP, or an object representing an amount of a fungible token. (See [Specifying Currency Amounts][Currency Amount]) |
|
||||
| `flags` | Number | A set of bit-flags for this offer. See [NFTokenOffer flags](../../../protocol/ledger-data/ledger-entry-types/nftokenoffer.md#nftokenoffer-flags) for possible values. |
|
||||
| `nft_offer_index` | String | The [ledger object ID](../../../protocol/ledger-data/common-fields.md) of this offer. |
|
||||
| `owner` | String | The account that placed this offer. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `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 it does exist but the server does not have it.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,134 @@
|
||||
---
|
||||
html: nft_sell_offers.html
|
||||
parent: path-and-order-book-methods.html
|
||||
seo:
|
||||
description: Get a list of all sell offers for a NFToken.
|
||||
labels:
|
||||
- Non-fungible Tokens, NFTs, NFTokens
|
||||
---
|
||||
# nft_sell_offers
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/NFTOffers.cpp "Source")
|
||||
|
||||
The `nft_sell_offers` method returns a list of sell offers for a given [NFToken][] object.
|
||||
|
||||
_(Added by the [NonFungibleTokensV1_1 amendment][].)_
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% raw-partial file="/_snippets/no-cli-syntax.md" /%}
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"command": "nft_sell_offers",
|
||||
"nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "nft_sell_offers",
|
||||
"params": [
|
||||
{
|
||||
"nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#nft_sell_offers)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------------|:-----------------|:-----------------------------------------|
|
||||
| `nft_id` | String | The unique identifier of a [NFToken][] object. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Number | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
| `limit` | Integer | _(Optional)_ Limit the number of NFT sell offers to retrieve. This value cannot be lower than 50 or more than 500. Positive values outside this range are replaced with the closest valid option. The default is 250. |
|
||||
| `marker` | [Marker][] | _(Optional)_ Value from a previous paginated response. Resume retrieving data where that response left off. |
|
||||
|
||||
## Response Format
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
|
||||
"offers": [
|
||||
{
|
||||
"amount": "1000",
|
||||
"flags": 1,
|
||||
"nft_offer_index": "9E28E366573187F8E5B85CE301F229E061A619EE5A589EF740088F8843BF10A1",
|
||||
"owner": "rLpSRZ1E8JHyNDZeHYsQs1R5cwDCB3uuZt"
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
|
||||
"offers": [
|
||||
{
|
||||
"amount": "1000",
|
||||
"flags": 1,
|
||||
"nft_offer_index": "9E28E366573187F8E5B85CE301F229E061A619EE5A589EF740088F8843BF10A1",
|
||||
"owner": "rLpSRZ1E8JHyNDZeHYsQs1R5cwDCB3uuZt"
|
||||
}
|
||||
],
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------|:-----------|:-----------------------------------------------------|
|
||||
| `nft_id` | String | The NFToken these offers are for, as specified in the request. |
|
||||
| `offers` | Array | A list of buy offers for the token. Each of these is formatted as a **Sell Offer** (see below). |
|
||||
| `limit` | Number | _(May be omitted)_ The `limit`, as specified in the request. |
|
||||
| `marker` | [Marker][] | _(May be omitted)_ Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. Omitted when there are no pages of information after this one. |
|
||||
|
||||
### Sell Offers
|
||||
|
||||
Each member of the `offers` array represents one [NFTokenOffer object][] to buy the NFT in question and has the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------|:-----------------|:--------------------------------------|
|
||||
| `amount` | String or Object | The amount offered to sell the NFT for, as a String representing an amount in drops of XRP, or an object representing an amount of a fungible token. (See [Specifying Currency Amounts][Currency Amount]) |
|
||||
| `flags` | Number | A set of bit-flags for this offer. See [NFTokenOffer flags](../../../protocol/ledger-data/ledger-entry-types/nftokenoffer.md#nftokenoffer-flags) for possible values. |
|
||||
| `nft_offer_index` | String | The [ledger object ID](../../../protocol/ledger-data/common-fields.md) of this offer. |
|
||||
| `owner` | String | The account that placed this offer. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `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 it does exist but the server does not have it.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,590 @@
|
||||
---
|
||||
html: path_find.html
|
||||
parent: path-and-order-book-methods.html
|
||||
seo:
|
||||
description: Find a path for a payment between two accounts and receive updates.
|
||||
labels:
|
||||
- Cross-Currency
|
||||
- Tokens
|
||||
---
|
||||
# path_find
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/PathFind.cpp "Source")
|
||||
|
||||
*WebSocket API only!* The `path_find` method searches for a [path](../../../../concepts/tokens/fungible-tokens/paths.md) along which a transaction can possibly be made, and periodically sends updates when the path changes over time. For a simpler version that is supported by JSON-RPC, see the [ripple_path_find method][]. For payments occurring strictly in XRP, it is not necessary to find a path, because XRP can be sent directly to any account.
|
||||
|
||||
There are three different modes, or sub-commands, of the path_find command. Specify which one you want with the `subcommand` parameter:
|
||||
|
||||
* `create` - Start sending pathfinding information
|
||||
* `close` - Stop sending pathfinding information
|
||||
* `status` - Get the information of the currently-open pathfinding request
|
||||
|
||||
Although the `rippled` server tries to find the cheapest path or combination of paths for making a payment, it is not guaranteed that the paths returned by this method are, in fact, the best paths. Due to server load, pathfinding may not find the best results. Additionally, you should be careful with the pathfinding results from untrusted servers. A server could be modified to return less-than-optimal paths to earn money for its operators. If you do not have your own server that you can trust with pathfinding, you should compare the results of pathfinding from multiple servers run by different parties, to minimize the risk of a single server returning poor results. (**Note:** A server returning less-than-optimal results is not necessarily proof of malicious behavior; it could also be a symptom of heavy server load.)
|
||||
|
||||
## path_find create
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/PathFind.cpp#L50-L56 "Source")
|
||||
|
||||
The `create` sub-command of `path_find` creates an ongoing request to find possible paths along which a payment transaction could be made from one specified account such that another account receives a desired amount of some currency. The initial response contains a suggested path between the two addresses that would result in the desired amount being received. After that, the server sends additional messages, with `"type": "path_find"`, with updates to the potential paths. The frequency of updates is left to the discretion of the server, but it usually means once every few seconds when there is a new ledger version.
|
||||
|
||||
A client can only have one pathfinding request open at a time. If another pathfinding request is already open on the same connection, the old request is automatically closed and replaced with the new request.
|
||||
|
||||
### Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 8,
|
||||
"command": "path_find",
|
||||
"subcommand": "create",
|
||||
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"destination_amount": {
|
||||
"value": "0.001",
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#path_find)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:----------------------|:-----------------|:----------------------------------|
|
||||
| `subcommand` | String | Use `"create"` to send the create sub-command |
|
||||
| `source_account` | String | Unique address of the account to find a path from. (In other words, the account that would be sending a payment.) |
|
||||
| `destination_account` | String | Unique address of the account to find a path to. (In other words, the account that would receive a payment.) |
|
||||
| `destination_amount` | String or Object | [Currency Amount][] that the destination account would receive in a transaction. **Special case:** You can specify `"-1"` (for XRP) or provide -1 as the contents of the `value` field (for non-XRP currencies). This requests a path to deliver as much as possible, while spending no more than the amount specified in `send_max` (if provided). |
|
||||
| `send_max` | String or Object | _(Optional)_ [Currency Amount][] that would be spent in the transaction. Not compatible with `source_currencies`. |
|
||||
| `paths` | Array | _(Optional)_ Array of arrays of objects, representing [payment paths](../../../../concepts/tokens/fungible-tokens/paths.md) to check. You can use this to keep updated on changes to particular paths you already know about, or to check the overall cost to make a payment along a certain path. |
|
||||
|
||||
The server also recognizes the following fields, but the results of using them are not guaranteed: `source_currencies`, `bridges`. These fields should be considered reserved for future use.
|
||||
|
||||
### Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"alternatives": [
|
||||
{
|
||||
"paths_computed": [
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount": "251686"
|
||||
},
|
||||
{
|
||||
"paths_computed": [
|
||||
[
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount": {
|
||||
"currency": "BTC",
|
||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"value": "0.000001541291269274307"
|
||||
}
|
||||
},
|
||||
{
|
||||
"paths_computed": [
|
||||
[
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount": {
|
||||
"currency": "CHF",
|
||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"value": "0.0009211546262510451"
|
||||
}
|
||||
},
|
||||
{
|
||||
"paths_computed": [
|
||||
[
|
||||
{
|
||||
"account": "razqQKzJRdB4UxFPWf5NEpEG3WMkmwgcXA",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account": "razqQKzJRdB4UxFPWf5NEpEG3WMkmwgcXA",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount": {
|
||||
"currency": "CNY",
|
||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"value": "0.006293562"
|
||||
}
|
||||
},
|
||||
{
|
||||
"paths_computed": [
|
||||
[
|
||||
{
|
||||
"account": "rGwUWgN5BEg3QGNY3RX2HfYowjUTZdid3E",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account": "rGwUWgN5BEg3QGNY3RX2HfYowjUTZdid3E",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account": "rGwUWgN5BEg3QGNY3RX2HfYowjUTZdid3E",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount": {
|
||||
"currency": "DYM",
|
||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"value": "0.0007157142857142858"
|
||||
}
|
||||
},
|
||||
{
|
||||
"paths_computed": [
|
||||
[
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount": {
|
||||
"currency": "EUR",
|
||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"value": "0.0007409623616236163"
|
||||
}
|
||||
},
|
||||
{
|
||||
"paths_computed": [
|
||||
[
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount": {
|
||||
"currency": "JPY",
|
||||
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"value": "0.103412412"
|
||||
}
|
||||
}
|
||||
],
|
||||
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"destination_amount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "0.001"
|
||||
},
|
||||
"id": 1,
|
||||
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"full_reply": false
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The initial response follows the [standard format](../../api-conventions/response-formatting.md), with a successful result containing the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:----------------------|:-----------------|:----------------------------------|
|
||||
| `alternatives` | Array | Array of objects with suggested [paths](../../../../concepts/tokens/fungible-tokens/paths.md) to take, as described below. If empty, then no paths were found connecting the source and destination accounts. |
|
||||
| `destination_account` | String | Unique address of the account that would receive a transaction. |
|
||||
| `destination_amount` | String or Object | [Currency Amount][] that the destination would receive in a transaction. |
|
||||
| `source_account` | String | Unique address that would send a transaction. |
|
||||
| `full_reply` | Boolean | If `false`, this is the result of an incomplete search. A later reply may have a better path. If `true`, then this is the best path found. (It is still theoretically possible that a better path could exist, but `rippled` won't find it.) Until you close the pathfinding request, `rippled` continues to send updates each time a new ledger closes. |
|
||||
|
||||
Each element in the `alternatives` array is an object that represents a path from one possible source currency (held by the initiating account) to the destination account and currency. This object has the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------------------|:-----------------|:---------------------------------------|
|
||||
| `paths_computed` | Array | Array of arrays of objects defining [payment paths](../../../../concepts/tokens/fungible-tokens/paths.md) |
|
||||
| `source_amount` | String or Object | [Currency Amount][] that the source would have to send along this path for the destination to receive the desired amount. |
|
||||
| `destination_amount` | String or Object | _(May be omitted)_ [Currency Amount][] that the destination would receive along this path. Only included if the `destination_amount` from the request was the "-1" special case. |
|
||||
|
||||
### Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `noEvents` - You are using a protocol that does not support asynchronous callbacks, for example JSON-RPC. (See the [ripple_path_find method][] for a pathfinding method that _is_ compatible with JSON-RPC.)
|
||||
|
||||
### Asynchronous Follow-ups
|
||||
|
||||
In addition to the initial response, the server sends more messages in a similar format to update on the status of [payment paths](../../../../concepts/tokens/fungible-tokens/paths.md) over time. These messages include the `id` of the original WebSocket request so you can tell which request prompted them, and the field `"type": "path_find"` at the top level to indicate that they are additional responses. The other fields are defined in the same way as the initial response.
|
||||
|
||||
If the follow-up includes `"full_reply": true`, then this is the best path that rippled can find as of the current ledger.
|
||||
|
||||
Here is an example of an asynchronous follow-up from a path_find create request:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"type": "path_find",
|
||||
"alternatives": [
|
||||
/* paths omitted from this example; same format as the initial response */
|
||||
],
|
||||
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"destination_amount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "0.001"
|
||||
},
|
||||
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
## path_find close
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/PathFind.cpp#L58-L67 "Source")
|
||||
|
||||
The `close` sub-command of `path_find` instructs the server to stop sending information about the current open pathfinding request.
|
||||
|
||||
### Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 57,
|
||||
"command": "path_find",
|
||||
"subcommand": "close"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:-------------|:-------|:-------------------------------------------|
|
||||
| `subcommand` | String | Use `"close"` to send the close sub-command |
|
||||
|
||||
### Response Format
|
||||
|
||||
If a pathfinding request was successfully closed, the response follows the same format as the initial response to [`path_find create`](#path_find-create), plus the following field:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------|:--------|:--------------------------------------------------------|
|
||||
| `closed` | Boolean | The value `true` indicates this reply is in response to a `path_find close` command. |
|
||||
|
||||
If there was no outstanding pathfinding request, an error is returned instead.
|
||||
|
||||
### Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - If any fields are specified incorrectly, or any required fields are missing.
|
||||
* `noEvents` - If you tried to use this method on a protocol that does not support asynchronous callbacks, for example JSON-RPC. (See the [ripple_path_find method][] for a pathfinding method that _is_ compatible with JSON-RPC.)
|
||||
* `noPathRequest` - You tried to close a pathfinding request when there is not an open one.
|
||||
|
||||
## path_find status
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/PathFind.cpp#L69-L77 "Source")
|
||||
|
||||
The `status` sub-command of `path_find` requests an immediate update about the client's currently-open pathfinding request.
|
||||
|
||||
### Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 58,
|
||||
"command": "path_find",
|
||||
"subcommand": "status"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:-------------|:-------|:---------------------------------------------|
|
||||
| `subcommand` | String | Use `"status"` to send the status sub-command |
|
||||
|
||||
### Response Format
|
||||
|
||||
If a pathfinding request is open, the response follows the same format as the initial response to [`path_find create`](#path_find-create), plus the following field:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------|:--------|:--------------------------------------------------------|
|
||||
| `status` | Boolean | The value `true` indicates this reply is in response to a `path_find status` command. |
|
||||
|
||||
If there was no outstanding pathfinding request, an error is returned instead.
|
||||
|
||||
### Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `noEvents` - You are using a protocol that does not support asynchronous callbacks, for example JSON-RPC. (See the [ripple_path_find method][] for a pathfinding method that _is_ compatible with JSON-RPC.)
|
||||
* `noPathRequest` - You tried to check the status of a pathfinding request when there is not an open one.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,456 @@
|
||||
---
|
||||
html: ripple_path_find.html
|
||||
parent: path-and-order-book-methods.html
|
||||
seo:
|
||||
description: Find a path for payment between two accounts, once.
|
||||
labels:
|
||||
- Cross-Currency
|
||||
- Tokens
|
||||
---
|
||||
# ripple_path_find
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/RipplePathFind.cpp "Source")
|
||||
|
||||
The `ripple_path_find` method is a simplified version of the [path_find method][] that provides a single response with a [payment path](../../../../concepts/tokens/fungible-tokens/paths.md) you can use right away. It is available in both the WebSocket and JSON-RPC APIs. However, the results tend to become outdated as time passes. Instead of making multiple calls to stay updated, you should instead use the [path_find method][] to subscribe to continued updates where possible.
|
||||
|
||||
Although the `rippled` server tries to find the cheapest path or combination of paths for making a payment, it is not guaranteed that the paths returned by this method are, in fact, the best paths.
|
||||
|
||||
**Caution:** Be careful with the pathfinding results from untrusted servers. A server could be modified to return less-than-optimal paths to earn money for its operators. A server may also return poor results when under heavy load. If you do not have your own server that you can trust with pathfinding, you should compare the results of pathfinding from multiple servers run by different parties, to minimize the risk of a single server returning poor results.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 8,
|
||||
"command": "ripple_path_find",
|
||||
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"source_currencies": [
|
||||
{
|
||||
"currency": "XRP"
|
||||
},
|
||||
{
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"destination_amount": {
|
||||
"value": "0.001",
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ripple_path_find",
|
||||
"params": [
|
||||
{
|
||||
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"destination_amount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "0.001"
|
||||
},
|
||||
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"source_currencies": [
|
||||
{
|
||||
"currency": "XRP"
|
||||
},
|
||||
{
|
||||
"currency": "USD"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax ripple_path_find json ledger_index|ledger_hash
|
||||
rippled ripple_path_find '{"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", "source_currencies": [ { "currency": "XRP" }, { "currency": "USD" } ], "destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", "destination_amount": { "value": "0.001", "currency": "USD", "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B" } }'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ripple_path_find)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:----------------------|:---------------------------|:------------------------|
|
||||
| `source_account` | String | Unique address of the account that would send funds in a transaction |
|
||||
| `destination_account` | String | Unique address of the account that would receive funds in a transaction |
|
||||
| `destination_amount` | String or Object | [Currency Amount][] that the destination account would receive in a transaction. **Special case:** You can specify `"-1"` (for XRP) or provide -1 as the contents of the `value` field (for non-XRP currencies). This requests a path to deliver as much as possible, while spending no more than the amount specified in `send_max` (if provided). |
|
||||
| `send_max` | String or Object | _(Optional)_ [Currency Amount][] that would be spent in the transaction. Cannot be used with `source_currencies`. |
|
||||
| `source_currencies` | Array | _(Optional)_ Array of currencies that the source account might want to spend. Each entry in the array should be a JSON object with a mandatory `currency` field and optional `issuer` field, like how [currency amounts][Currency Amount] are specified. Cannot contain more than **18** source currencies. By default, uses all source currencies available up to a maximum of **88** different currency/issuer pairs. |
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 8,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"alternatives": [
|
||||
{
|
||||
"paths_canonical": [],
|
||||
"paths_computed": [
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rLpq4LgabRfm1xEX5dpWfJovYBH6g7z99q",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rPuBoajMjFoDjweJBrtZEBwUMkyruxpwwV",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount": "256987"
|
||||
}
|
||||
],
|
||||
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"destination_currencies": [
|
||||
"015841551A748AD2C1F76FF6ECB0CCCD00000000",
|
||||
"JOE",
|
||||
"DYM",
|
||||
"EUR",
|
||||
"CNY",
|
||||
"MXN",
|
||||
"BTC",
|
||||
"USD",
|
||||
"XRP"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"alternatives": [
|
||||
{
|
||||
"paths_canonical": [],
|
||||
"paths_computed": [
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rpDMez6pm6dBve2TJsmDpv7Yae6V5Pyvy2",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rpDMez6pm6dBve2TJsmDpv7Yae6V5Pyvy2",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rfDeu7TPUmyvUrffexjMjq3mMcSQHZSYyA",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "raspZSGNiTKi5jmvFxUYCuYXPv1V8WhL5g",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"currency": "USD",
|
||||
"issuer": "rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT",
|
||||
"type": 48,
|
||||
"type_hex": "0000000000000030"
|
||||
},
|
||||
{
|
||||
"account": "rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount": "207414"
|
||||
}
|
||||
],
|
||||
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"destination_currencies": [
|
||||
"USD",
|
||||
"JOE",
|
||||
"BTC",
|
||||
"DYM",
|
||||
"CNY",
|
||||
"EUR",
|
||||
"015841551A748AD2C1F76FF6ECB0CCCD00000000",
|
||||
"MXN",
|
||||
"XRP"
|
||||
],
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"alternatives" : [
|
||||
{
|
||||
"paths_canonical" : [],
|
||||
"paths_computed" : [
|
||||
[
|
||||
{
|
||||
"currency" : "USD",
|
||||
"issuer" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"type" : 48,
|
||||
"type_hex" : "0000000000000030"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount" : "5212"
|
||||
},
|
||||
{
|
||||
"paths_canonical" : [],
|
||||
"paths_computed" : [
|
||||
[
|
||||
{
|
||||
"account" : "r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X",
|
||||
"type" : 1,
|
||||
"type_hex" : "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account" : "rnx1RNE5cJbYzMsJbF3XzyQMxZNBPqdCVd",
|
||||
"type" : 1,
|
||||
"type_hex" : "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account" : "r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X",
|
||||
"type" : 1,
|
||||
"type_hex" : "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account" : "ragizZ31TmpachYAuG3n56XCb1R5vc3cTQ",
|
||||
"type" : 1,
|
||||
"type_hex" : "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account" : "r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X",
|
||||
"type" : 1,
|
||||
"type_hex" : "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account" : "r9JS9fLbtLzgBCdFCnS3LpVPUBJAmg7PnM",
|
||||
"type" : 1,
|
||||
"type_hex" : "0000000000000001"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account" : "r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X",
|
||||
"type" : 1,
|
||||
"type_hex" : "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account" : "rDc9zKqfxm43S9LwpNkwV9KgW6PKUPrT5u",
|
||||
"type" : 1,
|
||||
"type_hex" : "0000000000000001"
|
||||
}
|
||||
]
|
||||
],
|
||||
"source_amount" : {
|
||||
"currency" : "USD",
|
||||
"issuer" : "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"value" : "0.001002"
|
||||
}
|
||||
}
|
||||
],
|
||||
"destination_account" : "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"destination_amount" : {
|
||||
"currency" : "USD",
|
||||
"issuer" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value" : "0.001"
|
||||
},
|
||||
"destination_currencies" : [
|
||||
"USD",
|
||||
"015841551A748AD2C1F76FF6ECB0CCCD00000000",
|
||||
"BTC",
|
||||
"DYM",
|
||||
"CNY",
|
||||
"EUR",
|
||||
"JOE",
|
||||
"MXN",
|
||||
"XRP"
|
||||
],
|
||||
"full_reply" : true,
|
||||
"source_account" : "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------------------|:-------|:-----------------------------------------|
|
||||
| `alternatives` | Array | Array of objects with possible paths to take, as described below. If empty, then there are no paths connecting the source and destination accounts. |
|
||||
| `destination_account` | String | Unique address of the account that would receive a payment transaction |
|
||||
| `destination_currencies` | Array | Array of strings representing the currencies that the destination accepts, as 3-letter codes like `"USD"` or as 40-character hex like `"015841551A748AD2C1F76FF6ECB0CCCD00000000"` |
|
||||
|
||||
Each element in the `alternatives` array is an object that represents a path from one possible source currency (held by the initiating account) to the destination account and currency. This object has the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-----------------|:-----------------|:---------------------------------------|
|
||||
| `paths_computed` | Array | Array of arrays of objects defining [payment paths](../../../../concepts/tokens/fungible-tokens/paths.md) |
|
||||
| `source_amount` | String or Object | [Currency Amount][] that the source would have to send along this path for the destination to receive the desired amount |
|
||||
|
||||
The following fields are deprecated, and may be omitted: `paths_canonical`, and `paths_expanded`. If they appear, you should disregard them.
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `tooBusy` - The server is under too much load to calculate paths. Not returned if you are connected as an admin.
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `srcActMissing` - The `source_account` field is omitted from the request.
|
||||
* `srcActMalformed` - The `source_account` field in the request is not formatted properly.
|
||||
* `dstActMissing` - The `destination_account` field is omitted from the request.
|
||||
* `dstActMalformed` - The `destination_account` field in the request is not formatted properly.
|
||||
* `srcCurMalformed` - The `source_currencies` field is not formatted properly.
|
||||
* `srcIsrMalformed` - The `issuer` field of one or more of the currency objects in the request is not valid.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,134 @@
|
||||
---
|
||||
html: channel_authorize.html
|
||||
parent: payment-channel-methods.html
|
||||
seo:
|
||||
description: Sign a claim for money from a payment channel.
|
||||
labels:
|
||||
- Payment Channels
|
||||
---
|
||||
# channel_authorize
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/d4a56f223a3b80f64ff70b4e90ab6792806929ca/src/ripple/rpc/handlers/PayChanClaim.cpp#L41 "Source")
|
||||
|
||||
_(Added by the [PayChan amendment][] to be enabled.)_
|
||||
|
||||
The `channel_authorize` method creates a signature that can be used to redeem a specific amount of XRP from a payment channel.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "channel_authorize_example_id1",
|
||||
"command": "channel_authorize",
|
||||
"channel_id": "5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3",
|
||||
"seed": "s████████████████████████████",
|
||||
"key_type": "secp256k1",
|
||||
"amount": "1000000",
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
POST http://localhost:5005/
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"method": "channel_authorize",
|
||||
"params": [{
|
||||
"channel_id": "5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3",
|
||||
"seed": "s████████████████████████████",
|
||||
"key_type": "secp256k1",
|
||||
"amount": "1000000"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: channel_authorize <private_key> [<key_type>] <channel_id> <drops>
|
||||
rippled channel_authorize s████████████████████████████ secp256k1 5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3 1000000
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `channel_id` | String | The unique ID of the payment channel to use.
|
||||
| `secret` | String | _(Optional)_ The secret key to use to sign the claim. This must be the same key pair as the public key specified in the channel. Cannot be used with `seed`, `seed_hex`, or `passphrase`. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.4.0" %}Updated in: rippled 1.4.0{% /badge %} |
|
||||
| `seed` | String | _(Optional)_ The secret seed to use to sign the claim. This must be the same key pair as the public key specified in the channel. Must be in the XRP Ledger's [base58][] format. If provided, you must also specify the `key_type`. Cannot be used with `secret`, `seed_hex`, or `passphrase`. |
|
||||
| `seed_hex` | String | _(Optional)_ The secret seed to use to sign the claim. This must be the same key pair as the public key specified in the channel. Must be in hexadecimal format. If provided, you must also specify the `key_type`. Cannot be used with `secret`, `seed`, or `passphrase`. |
|
||||
| `passphrase` | String | _(Optional)_ A string passphrase to use to sign the claim. This must be the same key pair as the public key specified in the channel. The [key derived from this passphrase](../../../../concepts/accounts/cryptographic-keys.md#key-derivation) must match the public key specified in the channel. If provided, you must also specify the `key_type`. Cannot be used with `secret`, `seed`, or `seed_hex`. |
|
||||
| `key_type` | String | _(Optional)_ The [signing algorithm](../../../../concepts/accounts/cryptographic-keys.md#signing-algorithms) of the cryptographic key pair provided. Valid types are `secp256k1` or `ed25519`. The default is `secp256k1`. |
|
||||
| `amount` | String | Cumulative amount of XRP, in drops, to authorize. If the destination has already received a lesser amount of XRP from this channel, the signature created by this method can be redeemed for the difference. |
|
||||
|
||||
The request **must** specify exactly one of `secret`, `seed`, `seed_hex`, or `passphrase`.
|
||||
|
||||
**Warning:** Do not send secret keys to untrusted servers or through unsecured network connections. (This includes the `secret`, `seed`, `seed_hex`, or `passphrase` fields of this request.) You should only use this method on a secure, encrypted network connection to a server you run or fully trust with your funds. Otherwise, eavesdroppers could use your secret key to sign claims and take all the money from this payment channel and anything else using the same key pair. See [Set Up Secure Signing](../../../../concepts/transactions/secure-signing.md) for instructions.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "channel_authorize_example_id1",
|
||||
"status": "success"
|
||||
"result": {
|
||||
"signature": "304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800BBC43746F34AF50290064",
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"signature": "304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800BBC43746F34AF50290064",
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"signature": "304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800BBC43746F34AF50290064",
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `signature` | String | The signature for this claim, as a hexadecimal value. To process the claim, the destination account of the payment channel must send a [PaymentChannelClaim transaction][] with this signature, the exact Channel ID, XRP amount, and public key of the channel. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `badKeyType` - The `key_type` parameter in the request is not a valid key type. (Valid types are `secp256k1` or `ed25519`.)
|
||||
* `badSeed` - The `secret` in the request is not a valid secret key.
|
||||
* `channelAmtMalformed` - The `amount` in the request is not a valid [XRP amount][XRP, in drops].
|
||||
* `channelMalformed` - The `channel_id` in the request is not a valid Channel ID. The Channel ID should be a 256-bit (64-character) hexadecimal string.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,127 @@
|
||||
---
|
||||
html: channel_verify.html
|
||||
parent: payment-channel-methods.html
|
||||
seo:
|
||||
description: Check a payment channel claim's signature.
|
||||
labels:
|
||||
- Payment Channels
|
||||
---
|
||||
# channel_verify
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/d4a56f223a3b80f64ff70b4e90ab6792806929ca/src/ripple/rpc/handlers/PayChanClaim.cpp#L89 "Source")
|
||||
|
||||
_(Added by the [PayChan amendment][] to be enabled.)_
|
||||
|
||||
The `channel_verify` method checks the validity of a signature that can be used to redeem a specific amount of XRP from a payment channel.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "channel_verify",
|
||||
"channel_id": "5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3",
|
||||
"signature": "304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800BBC43746F34AF50290064",
|
||||
"public_key": "aB44YfzW24VDEJQ2UuLPV2PvqcPCSoLnL7y5M1EzhdW4LnK5xMS3",
|
||||
"amount": "1000000"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "channel_verify",
|
||||
"params": [{
|
||||
"channel_id": "5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3",
|
||||
"signature": "304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800BBC43746F34AF50290064",
|
||||
"public_key": "aB44YfzW24VDEJQ2UuLPV2PvqcPCSoLnL7y5M1EzhdW4LnK5xMS3",
|
||||
"amount": "1000000"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: channel_verify <public_key> <channel_id> <amount> <signature>
|
||||
rippled channel_verify aB44YfzW24VDEJQ2UuLPV2PvqcPCSoLnL7y5M1EzhdW4LnK5xMS3 5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3 1000000 304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800BBC43746F34AF50290064
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `amount` | String | The amount of [XRP, in drops][], the provided `signature` authorizes. |
|
||||
| `channel_id` | String | The Channel ID of the channel that provides the XRP. This is a 64-character hexadecimal string. |
|
||||
| `public_key` | String | The public key of the channel and the key pair that was used to create the signature, in hexadecimal or the XRP Ledger's [base58][] format. {% badge href="https://github.com/XRPLF/rippled/releases/tag/0.90.0" %}Updated in: rippled 0.90.0{% /badge %} |
|
||||
| `signature` | String | The signature to verify, in hexadecimal. |
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"signature_verified":true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"signature_verified":true,
|
||||
"status":"success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"signature_verified":true,
|
||||
"status":"success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `signature_verified` | Boolean | If `true`, the signature is valid for the stated amount, channel, and public key. |
|
||||
|
||||
**Caution:** This does not indicate check that the channel has enough XRP allocated to it. Before considering a claim valid, you should look up the channel in the latest validated ledger and confirm that the channel is open and its `amount` value is equal or greater than the `amount` of the claim. To do so, use the [account_channels method][].
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `publicMalformed` - The `public_key` field of the request is not a valid public key in the correct format. Public keys are 33 bytes and must be represented in base58 or hexadecimal. The [base58 representation of account public keys starts with the letter `a`](../../../protocol/data-types/base58-encodings.md). The hexadecimal representation is 66 characters long.
|
||||
* `channelMalformed` - The `channel_id` field of the request is not a valid Channel ID. The Channel ID must be a 256-bit (64-character) hexadecimal string.
|
||||
* `channelAmtMalformed` - The value specified in the `amount` field was not a valid [XRP amount][XRP, in drops].
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
html: payment-channel-methods.html
|
||||
parent: public-api-methods.html
|
||||
metadata:
|
||||
indexPage: true
|
||||
---
|
||||
# Payment Channel Methods
|
||||
|
||||
Payment channels are a tool for facilitating repeated, unidirectional payments, or temporary credit between two parties. Use these methods to work with payment channels.
|
||||
|
||||
|
||||
{% child-pages /%}
|
||||
@@ -0,0 +1,170 @@
|
||||
---
|
||||
html: fee.html
|
||||
parent: server-info-methods.html
|
||||
seo:
|
||||
description: Get information about transaction cost.
|
||||
labels:
|
||||
- Fees
|
||||
---
|
||||
# fee
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/release/src/ripple/rpc/handlers/Fee1.cpp "Source")
|
||||
|
||||
The `fee` command reports the current state of the open-ledger requirements for the [transaction cost](../../../../concepts/transactions/transaction-cost.md). This requires the [FeeEscalation amendment][] to be enabled.
|
||||
|
||||
This is a public command available to unprivileged users. {% badge href="https://github.com/XRPLF/rippled/releases/tag/0.32.0" %}Updated in: rippled 0.32.0{% /badge %}
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "fee_websocket_example",
|
||||
"command": "fee"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "fee",
|
||||
"params": [{}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: fee
|
||||
rippled fee
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request does not include any parameters.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "fee_websocket_example",
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"current_ledger_size": "14",
|
||||
"current_queue_size": "0",
|
||||
"drops": {
|
||||
"base_fee": "10",
|
||||
"median_fee": "11000",
|
||||
"minimum_fee": "10",
|
||||
"open_ledger_fee": "10"
|
||||
},
|
||||
"expected_ledger_size": "24",
|
||||
"ledger_current_index": 26575101,
|
||||
"levels": {
|
||||
"median_level": "281600",
|
||||
"minimum_level": "256",
|
||||
"open_ledger_level": "256",
|
||||
"reference_level": "256"
|
||||
},
|
||||
"max_queue_size": "480"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"current_ledger_size": "56",
|
||||
"current_queue_size": "11",
|
||||
"drops": {
|
||||
"base_fee": "10",
|
||||
"median_fee": "10000",
|
||||
"minimum_fee": "10",
|
||||
"open_ledger_fee": "2653937"
|
||||
},
|
||||
"expected_ledger_size": "55",
|
||||
"ledger_current_index": 26575101,
|
||||
"levels": {
|
||||
"median_level": "256000",
|
||||
"minimum_level": "256",
|
||||
"open_ledger_level": "67940792",
|
||||
"reference_level": "256"
|
||||
},
|
||||
"max_queue_size": "1100",
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
Loading: "/etc/rippled.cfg"
|
||||
Connecting to 127.0.0.1:5005
|
||||
|
||||
{
|
||||
"result" : {
|
||||
"current_ledger_size" : "16",
|
||||
"current_queue_size" : "2",
|
||||
"drops" : {
|
||||
"base_fee" : "10",
|
||||
"median_fee" : "11000",
|
||||
"minimum_fee" : "10",
|
||||
"open_ledger_fee" : "3203982"
|
||||
},
|
||||
"expected_ledger_size" : "15",
|
||||
"ledger_current_index": 26575101,
|
||||
"levels" : {
|
||||
"median_level" : "281600",
|
||||
"minimum_level" : "256",
|
||||
"open_ledger_level" : "82021944",
|
||||
"reference_level" : "256"
|
||||
},
|
||||
"max_queue_size" : "300",
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------------------|:-----------------|:-----------------------------|
|
||||
| `current_ledger_size` | String (Integer) | Number of transactions provisionally included in the in-progress ledger. |
|
||||
| `current_queue_size` | String (Integer) | Number of transactions currently queued for the next ledger. |
|
||||
| `drops` | Object | Various information about the transaction cost (the `Fee` field of a transaction), in [drops of XRP][]. |
|
||||
| `drops.base_fee` | String (Integer) | The transaction cost required for a [reference transaction](../../../../concepts/transactions/transaction-cost.md#reference-transaction-cost) to be included in a ledger under minimum load, represented in drops of XRP. |
|
||||
| `drops.median_fee` | String (Integer) | An approximation of the median transaction cost among transactions included in the previous validated ledger, represented in drops of XRP. |
|
||||
| `drops.minimum_fee` | String (Integer) | The minimum transaction cost for a [reference transaction](../../../../concepts/transactions/transaction-cost.md#reference-transaction-cost) to be queued for a later ledger, represented in drops of XRP. If greater than `base_fee`, the transaction queue is full. |
|
||||
| `drops.open_ledger_fee` | String (Integer) | The minimum transaction cost that a [reference transaction](../../../../concepts/transactions/transaction-cost.md#reference-transaction-cost) must pay to be included in the current open ledger, represented in drops of XRP. |
|
||||
| `expected_ledger_size` | String (Integer) | The approximate number of transactions expected to be included in the current ledger. This is based on the number of transactions in the previous ledger. |
|
||||
| `ledger_current_index` | Number | The [Ledger Index][] of the current open ledger these stats describe. |
|
||||
| `levels` | Object | Various information about the transaction cost, in [fee levels][]. The ratio in fee levels applies to any transaction relative to the minimum cost of that particular transaction. |
|
||||
| `levels.median_level` | String (Integer) | The median transaction cost among transactions in the previous validated ledger, represented in [fee levels][]. |
|
||||
| `levels.minimum_level` | String (Integer) | The minimum transaction cost required to be queued for a future ledger, represented in [fee levels][]. |
|
||||
| `levels.open_ledger_level` | String (Integer) | The minimum transaction cost required to be included in the current open ledger, represented in [fee levels][]. |
|
||||
| `levels.reference_level` | String (Integer) | The equivalent of the minimum transaction cost, represented in [fee levels][]. |
|
||||
| `max_queue_size` | String (Integer) | The maximum number of transactions that the [transaction queue](../../../../concepts/transactions/transaction-cost.md#queued-transactions) can currently hold. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
- Any of the [universal error types][].
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
html: server-info-methods.html
|
||||
parent: public-api-methods.html
|
||||
metadata:
|
||||
indexPage: true
|
||||
---
|
||||
# Server Info Methods
|
||||
|
||||
Use these methods to retrieve information about the current state of the rippled server.
|
||||
|
||||
|
||||
{% child-pages /%}
|
||||
@@ -0,0 +1,153 @@
|
||||
---
|
||||
html: manifest.html
|
||||
parent: server-info-methods.html
|
||||
seo:
|
||||
description: Look up the public information about a known validator.
|
||||
labels:
|
||||
- Blockchain
|
||||
---
|
||||
# manifest
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/Manifest.cpp "Source")
|
||||
|
||||
The {% code-page-name /%} method reports the current "manifest" information for a given validator public key. The "manifest" is a block of data that authorizes an ephemeral signing key with a signature from the validator's master key pair. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.7.0" %}Updated in: rippled 1.7.0{% /badge %}
|
||||
|
||||
|
||||
### Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"command": "{% $frontmatter.seo.title %}",
|
||||
"public_key": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "{% $frontmatter.seo.title %}",
|
||||
"params": [{
|
||||
"public_key":"nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p"
|
||||
}]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: {% $frontmatter.seo.title %} public_key
|
||||
rippled {% $frontmatter.seo.title %} nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------|:-------|:-----------------------------------|
|
||||
| `public_key` | String | The [base58][]-encoded public key of the validator to look up. This can be the master public key or ephemeral public key. |
|
||||
|
||||
|
||||
### Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"details": {
|
||||
"domain": "",
|
||||
"ephemeral_key": "n9J67zk4B7GpbQV5jRQntbgdKf7TW6894QuG7qq1rE5gvjCu6snA",
|
||||
"master_key": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p",
|
||||
"seq": 1
|
||||
},
|
||||
"manifest": "JAAAAAFxIe3AkJgOyqs3y+UuiAI27Ff3Mrfbt8e7mjdo06bnGEp5XnMhAhRmvCZmWZXlwShVE9qXs2AVCvhVuA/WGYkTX/vVGBGwdkYwRAIgGnYpIGufURojN2cTXakAM7Vwa0GR7o3osdVlZShroXQCIH9R/Lx1v9rdb4YY2n5nrxdnhSSof3U6V/wIHJmeao5ucBJA9D1iAMo7YFCpb245N3Czc0L1R2Xac0YwQ6XdGT+cZ7yw2n8JbdC3hH8Xu9OUqc867Ee6JmlXtyDHzBdY/hdJCQ==",
|
||||
"requested": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p"
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"details": {
|
||||
"domain": "",
|
||||
"ephemeral_key": "n9J67zk4B7GpbQV5jRQntbgdKf7TW6894QuG7qq1rE5gvjCu6snA",
|
||||
"master_key": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p",
|
||||
"seq": 1
|
||||
},
|
||||
"manifest": "JAAAAAFxIe3AkJgOyqs3y+UuiAI27Ff3Mrfbt8e7mjdo06bnGEp5XnMhAhRmvCZmWZXlwShVE9qXs2AVCvhVuA/WGYkTX/vVGBGwdkYwRAIgGnYpIGufURojN2cTXakAM7Vwa0GR7o3osdVlZShroXQCIH9R/Lx1v9rdb4YY2n5nrxdnhSSof3U6V/wIHJmeao5ucBJA9D1iAMo7YFCpb245N3Czc0L1R2Xac0YwQ6XdGT+cZ7yw2n8JbdC3hH8Xu9OUqc867Ee6JmlXtyDHzBdY/hdJCQ==",
|
||||
"requested": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p",
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
Loading: "/etc/rippled.cfg"
|
||||
Connecting to 127.0.0.1:5005
|
||||
|
||||
{
|
||||
"result": {
|
||||
"details": {
|
||||
"domain": "",
|
||||
"ephemeral_key": "n9J67zk4B7GpbQV5jRQntbgdKf7TW6894QuG7qq1rE5gvjCu6snA",
|
||||
"master_key": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p",
|
||||
"seq": 1
|
||||
},
|
||||
"manifest": "JAAAAAFxIe3AkJgOyqs3y+UuiAI27Ff3Mrfbt8e7mjdo06bnGEp5XnMhAhRmvCZmWZXlwShVE9qXs2AVCvhVuA/WGYkTX/vVGBGwdkYwRAIgGnYpIGufURojN2cTXakAM7Vwa0GR7o3osdVlZShroXQCIH9R/Lx1v9rdb4YY2n5nrxdnhSSof3U6V/wIHJmeao5ucBJA9D1iAMo7YFCpb245N3Czc0L1R2Xac0YwQ6XdGT+cZ7yw2n8JbdC3hH8Xu9OUqc867Ee6JmlXtyDHzBdY/hdJCQ==",
|
||||
"requested": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p",
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
<!-- Note, the CLI response above is mocked up to compensate for https://github.com/XRPLF/rippled/issues/3317 -->
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------|:-------|:------------------------------------------------------|
|
||||
| `details` | Object | _(May be omitted)_ The data contained in this manifest. Omitted if the server does not have a manifest for the `public_key` from the request. See **Details Object** below for a full description of its contents. |
|
||||
| `manifest` | String | _(May be omitted)_ The full manifest data in base64 format. This data is [serialized](../../../protocol/binary-format.md) to binary before being base64-encoded. Omitted if the server does not have a manifest for the `public_key` from the request. |
|
||||
| `requested` | String | The `public_key` from the request. |
|
||||
|
||||
#### Details Object
|
||||
|
||||
If provided, the `details` object contains the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:----------------|:-------|:--------------------------------------------------|
|
||||
| `domain` | String | The domain name this validator claims to be associated with. If the manifest does not contain a domain, this is an empty string. |
|
||||
| `ephemeral_key` | String | The ephemeral public key for this validator, in [base58][]. |
|
||||
| `master_key` | String | The master public key for this validator, in [base58][]. |
|
||||
| `seq` | Number | The sequence number of this manifest. This number increases whenever the validator operator updates the validator's token to rotate ephemeral keys or change settings. |
|
||||
|
||||
|
||||
### Possible Errors
|
||||
|
||||
- Any of the [universal error types][].
|
||||
- `invalidParams` - The `public_key` field was missing or specified incorrectly.
|
||||
- `reportingUnsupported` - ([Reporting Mode][] servers only) This method is not available in Reporting Mode.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
html: server_definitions.html
|
||||
parent: server-info-methods.html
|
||||
seo:
|
||||
description: Retrieve an SDK-compatible `definitions.json`, generated from the `rippled` instance currently running.
|
||||
labels:
|
||||
- Core Server
|
||||
---
|
||||
# server_definitions
|
||||
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/ServerInfo.cpp#L43 "Source")
|
||||
|
||||
The `server_definitions` command returns an SDK-compatible `definitions.json`, generated from the `rippled` instance currently running. You can use this to query a node in a network, quickly receiving the definitions necessary to serialize/deserialize its binary data.
|
||||
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"command": "server_definitions"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#server_definitions)
|
||||
|
||||
The request does not take any parameters.
|
||||
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"result": {
|
||||
"FIELDS": [
|
||||
[
|
||||
"Generic",
|
||||
{
|
||||
"isSerialized": false,
|
||||
"isSigningField": false,
|
||||
"isVLEncoded": false,
|
||||
"nth": 0,
|
||||
"type": "Unknown"
|
||||
}
|
||||
],
|
||||
[
|
||||
"Invalid",
|
||||
{
|
||||
"isSerialized": false,
|
||||
"isSigningField": false,
|
||||
"isVLEncoded": false,
|
||||
"nth": -1,
|
||||
"type": "Unknown"
|
||||
}
|
||||
],
|
||||
[
|
||||
"ObjectEndMarker",
|
||||
{
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"isVLEncoded": false,
|
||||
"nth": 1,
|
||||
"type": "STObject"
|
||||
}
|
||||
],
|
||||
[
|
||||
"ArrayEndMarker",
|
||||
{
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"isVLEncoded": false,
|
||||
"nth": 1,
|
||||
"type": "STArray"
|
||||
}
|
||||
]
|
||||
...
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
To see a full `definitions.json` file and descriptions of the top-level fields, see: [Definitions File](../../../protocol/binary-format.md#definitions-file).
|
||||
|
||||
|
||||
## Possible Errors
|
||||
|
||||
Any of the [universal error types][].
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,133 @@
|
||||
---
|
||||
html: server_info.html
|
||||
parent: server-info-methods.html
|
||||
seo:
|
||||
description: Retrieve status of the server in human-readable format.
|
||||
labels:
|
||||
- Core Server
|
||||
---
|
||||
# server_info (rippled)
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/ServerInfo.cpp "Source")
|
||||
|
||||
The `server_info` command asks the server for a human-readable version of various information about [the `rippled` server](../../../../concepts/networks-and-servers/index.md) being queried. For [Clio servers](../../../../concepts/networks-and-servers/the-clio-server.md), see [`server_info` (Clio)](../clio-methods/server_info-clio.md) instead.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "server_info"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "server_info",
|
||||
"params": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: server_info
|
||||
rippled server_info
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#server_info)
|
||||
|
||||
The request does not take any parameters.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
{% code-snippet file="/_api-examples/server_info/ws-response.json" language="json" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
{% code-snippet file="/_api-examples/server_info/jsonrpc-response.json" language="json" prefix="200 OK\n\n" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
{% code-snippet file="/_api-examples/server_info/jsonrpc-response.json" language="json" prefix="Loading: \"/etc/opt/ripple/rippled.cfg\"\n2023-Sep-13 22:19:39.404596100 UTC HTTPClient:NFO Connecting to 127.0.0.1:5005\n\n" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing an `info` object as its only field.
|
||||
|
||||
The `info` object may have some arrangement of the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------------------------|:----------------|:---------------------|
|
||||
| `amendment_blocked` | Boolean | _(May be omitted)_ If `true`, this server is [amendment blocked](../../../../concepts/networks-and-servers/amendments.md#amendment-blocked-servers). If the server is not amendment blocked, the response omits this field. |
|
||||
| `build_version` | String | The version number of the running `rippled` server. |
|
||||
| `closed_ledger` | Object | _(May be omitted)_ Information on the most recently closed ledger that has not been validated by consensus. If the most recently validated ledger is available, the response omits this field and includes `validated_ledger` instead. The member fields are the same as the `validated_ledger` field. |
|
||||
| `complete_ledgers` | String | Range expression indicating the sequence numbers of the ledger versions the local `rippled` has in its database. This may be a disjoint sequence such as `24900901-24900984,24901116-24901158`. If the server does not have any complete ledgers (for example, it recently started syncing with the network), this is the string `empty`. |
|
||||
| `hostid` | String | On an admin request, returns the hostname of the server running the `rippled` instance; otherwise, returns a single [RFC-1751][] word based on the [node public key](../../../../concepts/networks-and-servers/peer-protocol.md#node-key-pair). |
|
||||
| `io_latency_ms` | Number | Amount of time spent waiting for I/O operations, in milliseconds. If this number is not very, very low, then the `rippled` server is probably having serious load issues. |
|
||||
| `jq_trans_overflow` | String - Number | The number of times (since starting up) that this server has had over 250 transactions waiting to be processed at once. A large number here may mean that your server is unable to handle the transaction load of the XRP Ledger network. For detailed recommendations of future-proof server specifications, see [Capacity Planning](../../../../infrastructure/installation/capacity-planning.md). |
|
||||
| `last_close` | Object | Information about the last time the server closed a ledger, including the amount of time it took to reach a consensus and the number of trusted validators participating. |
|
||||
| `last_close.converge_time_s` | Number | The amount of time it took to reach a consensus on the most recently validated ledger version, in seconds. |
|
||||
| `last_close.proposers` | Number | How many trusted validators the server considered (including itself, if configured as a validator) in the consensus process for the most recently validated ledger version. |
|
||||
| `load` | Object | _(Admin only)_ Detailed information about the current load state of the server. |
|
||||
| `load.job_types` | Array | _(Admin only)_ Information about the rate of different types of jobs the server is doing and how much time it spends on each. |
|
||||
| `load.threads` | Number | _(Admin only)_ The number of threads in the server's main job pool. |
|
||||
| `load_factor` | Number | The multiplier to the [transaction cost][] the server is currently enforcing. For example, at `1000` load factor and a reference transaction cost of 10 drops of XRP, the load-scaled transaction cost is 10,000 drops (0.01 XRP). The load factor is determined by the highest of the individual server's load factor, the cluster's load factor, the open ledger cost, and the overall network's load factor. |
|
||||
| `load_factor_local` | Number | _(May be omitted)_ The current multiplier to the transaction cost based on load to this server. |
|
||||
| `load_factor_net` | Number | _(May be omitted)_ The current multiplier to the transaction cost being used by the rest of the network (estimated from other servers' reported load values). |
|
||||
| `load_factor_cluster` | Number | _(May be omitted)_ The current multiplier to the transaction cost based on load to servers in this [cluster](../../../../concepts/networks-and-servers/clustering.md). |
|
||||
| `load_factor_fee_escalation` | Number | _(May be omitted)_ The current multiplier to the transaction cost that a transaction must pay to get into the open ledger. |
|
||||
| `load_factor_fee_queue` | Number | _(May be omitted)_ The current multiplier to the transaction cost that a transaction must pay to get into the queue, if the queue is full. |
|
||||
| `load_factor_server` | Number | _(May be omitted)_ The current multiplier to the transaction cost based on load to the server, cluster, and network, but not factoring in the open ledger cost. |
|
||||
| `peers` | Number | _(Omitted by [reporting mode][Reporting mode] servers)_ How many other `rippled` servers this one is currently connected to. |
|
||||
| `ports` | Array | A list of ports where the server is listening for API commands. Each entry in the array is a [Port Descriptor object](#port-descriptor-object). {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.12.0" %}New in: rippled 1.12.0{% /badge %} |
|
||||
| `pubkey_node` | String | Public key used to verify this server for peer-to-peer communications. This [_node key pair_](../../../../concepts/networks-and-servers/peer-protocol.md#node-key-pair) is automatically generated by the server the first time it starts up. (If deleted, the server can create a new pair of keys.) You can set a persistent value in the config file using the `[node_seed]` config option, which is useful for [clustering](../../../../concepts/networks-and-servers/clustering.md). |
|
||||
| `pubkey_validator` | String | _(Admin only)_ Public key used by this node to sign ledger validations. This _validation key pair_ is derived from the `[validator_token]` or `[validation_seed]` config field. |
|
||||
| `reporting` | Object | _([Reporting mode](../../../../concepts/networks-and-servers/rippled-server-modes.md) servers only)_ Information about this server's reporting-mode specific configurations. |
|
||||
| `reporting.etl_sources` | Array | _([Reporting mode](../../../../concepts/networks-and-servers/rippled-server-modes.md) servers only)_ A list of P2P-mode servers this reporting mode is retrieving data from. Each entry in this array is an [ETL Source object](#etl-source-object). |
|
||||
| `reporting.is_writer` | Boolean | _([Reporting mode](../../../../concepts/networks-and-servers/rippled-server-modes.md) servers only)_ If `true`, this server is writing to the external database with ledger data. If `false`, it is not currently writing, possibly because another reporting mode server is currently populating a shared database, or because it's configured as read-only. |
|
||||
| `reporting.last_publish_time` | String | _([Reporting mode](../../../../concepts/networks-and-servers/rippled-server-modes.md) servers only)_ An ISO 8601 timestamp indicating when this server last published a validated ledger to its [subscription streams](../subscription-methods/subscribe.md). |
|
||||
| `server_state` | String | A string indicating to what extent the server is participating in the network. See [Possible Server States](../../api-conventions/rippled-server-states.md) for more details. |
|
||||
| `server_state_duration_us` | Number | The number of consecutive microseconds the server has been in the current state. |
|
||||
| `state_accounting` | Object | A map of various [server states](../../api-conventions/rippled-server-states.md) with information about the time the server spends in each. This can be useful for tracking the long-term health of your server's connectivity to the network. |
|
||||
| `state_accounting.*.duration_us` | String | The number of microseconds the server has spent in this state. (This is updated whenever the server transitions into another state.) |
|
||||
| `state_accounting.*.transitions` | String | The number of times the server has changed into this state. |
|
||||
| `time` | String | The current time in UTC, according to the server's clock. |
|
||||
| `uptime` | Number | Number of consecutive seconds that the server has been operational. |
|
||||
| `validated_ledger` | Object | _(May be omitted)_ Information about the most recent fully-validated ledger. If the most recent validated ledger is not available, the response omits this field and includes `closed_ledger` instead. |
|
||||
| `validated_ledger.age` | Number | The time since the ledger was closed, in seconds. |
|
||||
| `validated_ledger.base_fee_xrp` | Number | Base fee, in XRP. This may be represented in scientific notation such as `1e-05` for 0.00001. |
|
||||
| `validated_ledger.hash` | String | Unique hash for the ledger, as hexadecimal. |
|
||||
| `validated_ledger.reserve_base_xrp` | Number | Minimum amount of XRP (not drops) necessary for every account to keep in reserve |
|
||||
| `validated_ledger.reserve_inc_xrp` | Number | Amount of XRP (not drops) added to the account reserve for each object an account owns in the ledger. |
|
||||
| `validated_ledger.seq` | Number | The [ledger index][] of the latest validated ledger. |
|
||||
| `validation_quorum` | Number | Minimum number of trusted validations required to validate a ledger version. Some circumstances may cause the server to require more validations. |
|
||||
| `validator_list_expires` | String | _(Admin only)_ Either the human readable time, in UTC, when the current validator list expires, the string `unknown` if the server has yet to load a published validator list or the string `never` if the server uses a static validator list. |
|
||||
|
||||
**Note:** If the `closed_ledger` field is present and has a small `seq` value (less than 8 digits), that indicates `rippled` does not currently have a copy of the validated ledger from the peer-to-peer network. This could mean your server is still syncing. Typically, it takes about 5 minutes to sync with the network, depending on your connection speed and hardware specs.
|
||||
|
||||
{% partial file="/_snippets/etl-source-object.md" /%}
|
||||
|
||||
{% partial file="/_snippets/port-descriptor-object.md" /%}
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,329 @@
|
||||
---
|
||||
html: server_state.html
|
||||
parent: server-info-methods.html
|
||||
seo:
|
||||
description: Retrieve status of the server in machine-readable format.
|
||||
labels:
|
||||
- Core Server
|
||||
---
|
||||
# server_state
|
||||
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/ServerState.cpp "Source")
|
||||
|
||||
The `server_state` command asks the server for various machine-readable information about the `rippled` server's current state. The response is almost the same as the [server_info method][], but uses units that are easier to process instead of easier to read. (For example, XRP values are given in integer drops instead of scientific notation or decimal values, and time is given in milliseconds instead of seconds.)
|
||||
|
||||
The [Clio server](../../../../concepts/networks-and-servers/the-clio-server.md) does not support `server_state` directly, but you can ask for the `server_state` of the `rippled` server that Clio is connected to. Specify `"ledger_index": "current"` (WebSocket) or `"params": [{"ledger_index": "current"}]` (JSON-RPC).
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"command": "server_state",
|
||||
"ledger_index": "current"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "server_state",
|
||||
"params": [
|
||||
{"ledger_index": "current"}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: server_state
|
||||
rippled server_state
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#server_state)
|
||||
|
||||
The request does not takes any parameters.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"result": {
|
||||
"state": {
|
||||
"build_version": "1.7.2",
|
||||
"complete_ledgers": "64572720-65887201",
|
||||
"io_latency_ms": 1,
|
||||
"jq_trans_overflow": "0",
|
||||
"last_close": {
|
||||
"converge_time": 3005,
|
||||
"proposers": 41
|
||||
},
|
||||
"load_base": 256,
|
||||
"load_factor": 256,
|
||||
"load_factor_fee_escalation": 256,
|
||||
"load_factor_fee_queue": 256,
|
||||
"load_factor_fee_reference": 256,
|
||||
"load_factor_server": 256,
|
||||
"peer_disconnects": "365006",
|
||||
"peer_disconnects_resources": "336",
|
||||
"peers": 216,
|
||||
"pubkey_node": "n9MozjnGB3tpULewtTsVtuudg5JqYFyV3QFdAtVLzJaxHcBaxuXD",
|
||||
"server_state": "full",
|
||||
"server_state_duration_us": "3588969453592",
|
||||
"state_accounting": {
|
||||
"connected": {
|
||||
"duration_us": "301410595",
|
||||
"transitions": "2"
|
||||
},
|
||||
"disconnected": {
|
||||
"duration_us": "1207534",
|
||||
"transitions": "2"
|
||||
},
|
||||
"full": {
|
||||
"duration_us": "3589171798767",
|
||||
"transitions": "2"
|
||||
},
|
||||
"syncing": {
|
||||
"duration_us": "6182323",
|
||||
"transitions": "2"
|
||||
},
|
||||
"tracking": {
|
||||
"duration_us": "43",
|
||||
"transitions": "2"
|
||||
}
|
||||
},
|
||||
"time": "2021-Aug-24 20:44:43.466048 UTC",
|
||||
"uptime": 3589480,
|
||||
"validated_ledger": {
|
||||
"base_fee": 10,
|
||||
"close_time": 683153081,
|
||||
"hash": "B52AC3876412A152FE9C0442801E685D148D05448D0238587DBA256330A98FD3",
|
||||
"reserve_base": 20000000,
|
||||
"reserve_inc": 5000000,
|
||||
"seq": 65887201
|
||||
},
|
||||
"validation_quorum": 33
|
||||
}
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
Headers
|
||||
|
||||
{
|
||||
"result": {
|
||||
"state": {
|
||||
"build_version": "1.7.2",
|
||||
"complete_ledgers": "65844785-65887184",
|
||||
"io_latency_ms": 3,
|
||||
"jq_trans_overflow": "580",
|
||||
"last_close": {
|
||||
"converge_time": 3012,
|
||||
"proposers": 41
|
||||
},
|
||||
"load_base": 256,
|
||||
"load_factor": 134022,
|
||||
"load_factor_fee_escalation": 134022,
|
||||
"load_factor_fee_queue": 256,
|
||||
"load_factor_fee_reference": 256,
|
||||
"load_factor_server": 256,
|
||||
"peer_disconnects": "792367",
|
||||
"peer_disconnects_resources": "7273",
|
||||
"peers": 72,
|
||||
"pubkey_node": "n9LNvsFiYfFf8va6pma2PHGJKVLSyZweN1iBAkJQSeHw4GjM8gvN",
|
||||
"server_state": "full",
|
||||
"server_state_duration_us": "422128665555",
|
||||
"state_accounting": {
|
||||
"connected": {
|
||||
"duration_us": "172799714",
|
||||
"transitions": "1"
|
||||
},
|
||||
"disconnected": {
|
||||
"duration_us": "309059",
|
||||
"transitions": "1"
|
||||
},
|
||||
"full": {
|
||||
"duration_us": "6020429212246",
|
||||
"transitions": "143"
|
||||
},
|
||||
"syncing": {
|
||||
"duration_us": "413813232",
|
||||
"transitions": "152"
|
||||
},
|
||||
"tracking": {
|
||||
"duration_us": "266553605",
|
||||
"transitions": "152"
|
||||
}
|
||||
},
|
||||
"time": "2021-Aug-24 20:43:43.043406 UTC",
|
||||
"uptime": 6021282,
|
||||
"validated_ledger": {
|
||||
"base_fee": 10,
|
||||
"close_time": 683153020,
|
||||
"hash": "ABEF3D24015E8B6B7184B4ABCEDC0E0E3AA4F0677FAB91C40B1E500707C1F3E5",
|
||||
"reserve_base": 20000000,
|
||||
"reserve_inc": 5000000,
|
||||
"seq": 65887184
|
||||
},
|
||||
"validation_quorum": 33
|
||||
},
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
Loading: "/etc/opt/ripple/rippled.cfg"
|
||||
2020-Mar-24 01:30:08.646201720 UTC HTTPClient:NFO Connecting to 127.0.0.1:5005
|
||||
|
||||
Headers
|
||||
|
||||
{
|
||||
"result": {
|
||||
"state": {
|
||||
"build_version": "1.7.2",
|
||||
"complete_ledgers": "65844785-65887184",
|
||||
"io_latency_ms": 3,
|
||||
"jq_trans_overflow": "580",
|
||||
"last_close": {
|
||||
"converge_time": 3012,
|
||||
"proposers": 41
|
||||
},
|
||||
"load_base": 256,
|
||||
"load_factor": 134022,
|
||||
"load_factor_fee_escalation": 134022,
|
||||
"load_factor_fee_queue": 256,
|
||||
"load_factor_fee_reference": 256,
|
||||
"load_factor_server": 256,
|
||||
"peer_disconnects": "792367",
|
||||
"peer_disconnects_resources": "7273",
|
||||
"peers": 72,
|
||||
"pubkey_node": "n9LNvsFiYfFf8va6pma2PHGJKVLSyZweN1iBAkJQSeHw4GjM8gvN",
|
||||
"server_state": "full",
|
||||
"server_state_duration_us": "422128665555",
|
||||
"state_accounting": {
|
||||
"connected": {
|
||||
"duration_us": "172799714",
|
||||
"transitions": "1"
|
||||
},
|
||||
"disconnected": {
|
||||
"duration_us": "309059",
|
||||
"transitions": "1"
|
||||
},
|
||||
"full": {
|
||||
"duration_us": "6020429212246",
|
||||
"transitions": "143"
|
||||
},
|
||||
"syncing": {
|
||||
"duration_us": "413813232",
|
||||
"transitions": "152"
|
||||
},
|
||||
"tracking": {
|
||||
"duration_us": "266553605",
|
||||
"transitions": "152"
|
||||
}
|
||||
},
|
||||
"time": "2021-Aug-24 20:43:43.043406 UTC",
|
||||
"uptime": 6021282,
|
||||
"validated_ledger": {
|
||||
"base_fee": 10,
|
||||
"close_time": 683153020,
|
||||
"hash": "ABEF3D24015E8B6B7184B4ABCEDC0E0E3AA4F0677FAB91C40B1E500707C1F3E5",
|
||||
"reserve_base": 20000000,
|
||||
"reserve_inc": 5000000,
|
||||
"seq": 65887184
|
||||
},
|
||||
"validation_quorum": 33
|
||||
},
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing a `state` object as its only field.
|
||||
|
||||
The `state` object may have some arrangement of the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------------------------|:----------------|:------------------------|
|
||||
| `amendment_blocked` | Boolean | _(May be omitted)_ If `true`, this server is [amendment blocked](../../../../concepts/networks-and-servers/amendments.md#amendment-blocked-servers). If the server is not amendment blocked, the response omits this field. |
|
||||
| `build_version` | String | The version number of the running `rippled` version. |
|
||||
| `complete_ledgers` | String | Range expression indicating the sequence numbers of the ledger versions the local `rippled` has in its database. It is possible to be a disjoint sequence, e.g. "2500-5000,32570-7695432". If the server does not have any complete ledgers (for example, it recently started syncing with the network), this is the string `empty`. |
|
||||
| `closed_ledger` | Object | _(May be omitted)_ Information on the most recently closed ledger that has not been validated by consensus. If the most recently validated ledger is available, the response omits this field and includes `validated_ledger` instead. The member fields are the same as the `validated_ledger` field. |
|
||||
| `io_latency_ms` | Number | Amount of time spent waiting for I/O operations, in milliseconds. If this number is not very, very low, then the `rippled` server is probably having serious load issues. |
|
||||
| `jq_trans_overflow` | String - Number | The number of times this server has had over 250 transactions waiting to be processed at once. A large number here may mean that your server is unable to handle the transaction load of the XRP Ledger network. For detailed recommendations of future-proof server specifications, see [Capacity Planning](../../../../infrastructure/installation/capacity-planning.md). |
|
||||
| `last_close` | Object | Information about the last time the server closed a ledger, including the amount of time it took to reach a consensus and the number of trusted validators participating. |
|
||||
| `last_close.converge_time` | Number | The amount of time it took to reach a consensus on the most recently validated ledger version, in milliseconds. |
|
||||
| `last_close.proposers` | Number | How many trusted validators the server considered (including itself, if configured as a validator) in the consensus process for the most recently validated ledger version. |
|
||||
| `load` | Object | _(Admin only)_ Detailed information about the current load state of the server. |
|
||||
| `load.job_types` | Array | _(Admin only)_ Information about the rate of different types of jobs the server is doing and how much time it spends on each. |
|
||||
| `load.threads` | Number | _(Admin only)_ The number of threads in the server's main job pool. |
|
||||
| `load_base` | Number | The baseline amount of server load used in [transaction cost][] calculations. If the `load_factor` is equal to the `load_base`, then only the base transaction cost is enforced. If the `load_factor` is higher than the `load_base`, then transaction costs are multiplied by the ratio between them. For example, if the `load_factor` is double the `load_base`, then transaction costs are doubled. |
|
||||
| `load_factor` | Number | The load factor the server is currently enforcing. The ratio between this value and the `load_base` determines the multiplier for transaction costs. The load factor is determined by the highest of the individual server's load factor, the cluster's load factor, the open ledger cost, and the overall network's load factor. |
|
||||
| `load_factor_fee_escalation` | Number | _(May be omitted)_ The current multiplier to the transaction cost to get into the open ledger, in [fee levels][]. |
|
||||
| `load_factor_fee_queue` | Number | _(May be omitted)_ The current multiplier to the transaction cost to get into the queue, if the queue is full, in fee levels. |
|
||||
| `load_factor_fee_reference` | Number | _(May be omitted)_ The transaction cost with no load scaling, in fee levels. |
|
||||
| `load_factor_server` | Number | _(May be omitted)_ The load factor the server is enforcing, based on load to the server, cluster, and network, but not factoring in the open ledger cost. |
|
||||
| `peers` | Number | _(Omitted by [reporting mode][Reporting mode] servers)_ How many other `rippled` servers this one is currently connected to. |
|
||||
| `ports` | Array | A list of ports where the server is listening for API commands. Each entry in the array is a [Port Descriptor object](#port-descriptor-object). {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.12.0" %}New in: rippled 1.12.0{% /badge %} |
|
||||
| `pubkey_node` | String | Public key used to verify this server for peer-to-peer communications. This _node key pair_ is automatically generated by the server the first time it starts up. (If deleted, the server can create a new pair of keys.) You can set a persistent value in the config file using the `[node_seed]` config option, which is useful for [clustering](../../../../concepts/networks-and-servers/clustering.md). |
|
||||
| `pubkey_validator` | String | _(Admin only)_ Public key used by this node to sign ledger validations. This _validation key pair_ is derived from the `[validator_token]` or `[validation_seed]` config field. |
|
||||
| `reporting` | Object | _([Reporting mode][] servers only)_ Information about this server's reporting-mode specific configurations. |
|
||||
| `reporting.etl_sources` | Array | _([Reporting mode][] servers only)_ A list of P2P-mode servers this reporting mode is retrieving data from. Each entry in this array is an [ETL Source object](#etl-source-object). |
|
||||
| `reporting.is_writer` | Boolean | _([Reporting mode][] servers only)_ If `true`, this server is writing to the external database with ledger data. If `false`, it is not currently writing, possibly because another reporting mode server is currently populating a shared database, or because it's configured as read-only. |
|
||||
| `reporting.last_publish_time` | String | _([Reporting mode][] servers only)_ An ISO 8601 timestamp indicating when this server last saw a new validated ledger from any of its P2P mode sources. |
|
||||
| `server_state` | String | A string indicating to what extent the server is participating in the network. See [Possible Server States](../../api-conventions/rippled-server-states.md) for more details. |
|
||||
| `server_state_duration_us` | Number | The number of consecutive microseconds the server has been in the current state. |
|
||||
| `state_accounting` | Object | A map of various [server states](../../api-conventions/rippled-server-states.md) with information about the time the server spends in each. This can be useful for tracking the long-term health of your server's connectivity to the network. |
|
||||
| `state_accounting.*.duration_us` | String | The number of microseconds the server has spent in this state. (This is updated whenever the server transitions into another state.) |
|
||||
| `state_accounting.*.transitions` | String | The number of times the server has changed into this state. |
|
||||
| `time` | String | The current time in UTC, according to the server's clock. |
|
||||
| `uptime` | Number | Number of consecutive seconds that the server has been operational. |
|
||||
| `validated_ledger` | Object | _(May be omitted)_ Information about the most recent fully-validated ledger. If the most recent validated ledger is not available, the response omits this field and includes `closed_ledger` instead. |
|
||||
| `validated_ledger.base_fee` | Number | Base fee, in drops of XRP, for propagating a transaction to the network. |
|
||||
| `validated_ledger.close_time` | Number | Time this ledger was closed, in [seconds since the Ripple Epoch][]. |
|
||||
| `validated_ledger.hash` | String | Unique hash of this ledger version, as hexadecimal. |
|
||||
| `validated_ledger.reserve_base` | Number | The minimum [account reserve](../../../../concepts/accounts/reserves.md), as of the most recent validated ledger version. |
|
||||
| `validated_ledger.reserve_inc` | Number | The [owner reserve](../../../../concepts/accounts/reserves.md) for each item an account owns, as of the most recent validated ledger version. |
|
||||
| `validated_ledger.seq` | Number | The [ledger index][] of the most recently validated ledger version. |
|
||||
| `validation_quorum` | Number | Minimum number of trusted validations required to validate a ledger version. Some circumstances may cause the server to require more validations. |
|
||||
| `validator_list_expires` | Number | _(Admin only)_ When the current validator list expires, in [seconds since the Ripple Epoch][], or 0 if the server has yet to load a published validator list. |
|
||||
|
||||
[Reporting mode]: ../../../../concepts/networks-and-servers/rippled-server-modes.md
|
||||
|
||||
{% partial file="/_snippets/etl-source-object.md" /%}
|
||||
|
||||
{% partial file="/_snippets/port-descriptor-object.md" /%}
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
html: subscription-methods.html
|
||||
parent: public-api-methods.html
|
||||
metadata:
|
||||
indexPage: true
|
||||
---
|
||||
# Subscription Methods
|
||||
|
||||
Use these methods to enable the server to push updates to your client when various events happen, so that you can know and react right away. WebSocket API only.
|
||||
|
||||
|
||||
{% child-pages /%}
|
||||
@@ -0,0 +1,575 @@
|
||||
---
|
||||
html: subscribe.html
|
||||
parent: subscription-methods.html
|
||||
seo:
|
||||
description: Listen for updates about a particular subject.
|
||||
labels:
|
||||
- Payments
|
||||
- Blockchain
|
||||
- Accounts
|
||||
- Smart Contracts
|
||||
---
|
||||
# subscribe
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/Subscribe.cpp "Source")
|
||||
|
||||
The `subscribe` method requests periodic notifications from the server when certain events happen.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="Subscribe to accounts" %}
|
||||
```json
|
||||
{
|
||||
"id": "Example watch Bitstamp's hot wallet",
|
||||
"command": "subscribe",
|
||||
"accounts": ["rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1"]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Subscribe to order book" %}
|
||||
```json
|
||||
{
|
||||
"id": "Example subscribe to XRP/GateHub USD order book",
|
||||
"command": "subscribe",
|
||||
"books": [
|
||||
{
|
||||
"taker_pays": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"taker_gets": {
|
||||
"currency": "USD",
|
||||
"issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq"
|
||||
},
|
||||
"snapshot": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Subscribe to ledger stream" %}
|
||||
```json
|
||||
{
|
||||
"id": "Example watch for new validated ledgers",
|
||||
"command": "subscribe",
|
||||
"streams": ["ledger"]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#subscribe)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:--------------------|:-------|:----------------------------------------------|
|
||||
| `streams` | Array | _(Optional)_ Array of string names of generic streams to subscribe to, as explained below |
|
||||
| `accounts` | Array | _(Optional)_ Array with the unique addresses of accounts to monitor for validated transactions. The addresses must be in the XRP Ledger's [base58][] format. The server sends a notification for any transaction that affects at least one of these accounts. |
|
||||
| `accounts_proposed` | Array | _(Optional)_ Like `accounts`, but include transactions that are not yet finalized. |
|
||||
| `books` | Array | _(Optional)_ Array of objects defining [order books](http://www.investopedia.com/terms/o/order-book.asp) to monitor for updates, as detailed below. |
|
||||
| `url` | String | (Optional for Websocket; Required otherwise) URL where the server sends a JSON-RPC callbacks for each event. *Admin-only.* |
|
||||
| `url_username` | String | _(Optional)_ Username to provide for basic authentication at the callback URL. |
|
||||
| `url_password` | String | _(Optional)_ Password to provide for basic authentication at the callback URL. |
|
||||
|
||||
The following parameters are deprecated and may be removed without further notice: `user`, `password`, `rt_accounts`.
|
||||
|
||||
The `streams` parameter provides access to the following default streams of information:
|
||||
|
||||
- `consensus` - Sends a message whenever the server changes phase in the consensus cycle.
|
||||
- `ledger` - Sends a message whenever the consensus process declares a new validated ledger.
|
||||
- `manifests` - Sends a message whenever the server receives an update to a validator's ephemeral signing key.
|
||||
- `peer_status` - **(Admin only)** Information about connected peer `rippled` servers, especially with regards to the consensus process.
|
||||
- `transactions` - Sends a message whenever a transaction is included in a closed ledger.
|
||||
- `transactions_proposed` - Sends a message whenever a transaction is included in a closed ledger, as well as some transactions that have not yet been included in a validated ledger and may never be. Not all proposed transactions appear before validation.
|
||||
**Note:** [Even some transactions that don't succeed are included](../../../protocol/transactions/transaction-results/transaction-results.md) in validated ledgers, because they take the anti-spam transaction fee.
|
||||
- `server` - Sends a message whenever the status of the `rippled` server (for example, network connectivity) changes.
|
||||
- `validations` - Sends a message whenever the server receives a validation message, regardless of if the server trusts the validator. (An individual `rippled` declares a ledger validated when the server receives validation messages from at least a quorum of trusted validators.)
|
||||
|
||||
**Note:** The following streams are not available from Clio and `rippled` servers in [Reporting Mode][]: `server`, `peer_status`, `consensus`. Both will return the `reportingUnsupported` error if you request one of these streams. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.8.1" %}Updated in: rippled 1.8.1{% /badge %} {% badge href="https://github.com/XRPLF/clio/releases/tag/2.0.0" %}New in: Clio v2.0{% /badge %}
|
||||
|
||||
Each member of the `books` array, if provided, is an object with the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------|:--------|:----------------------------------------------------|
|
||||
| `taker_gets` | Object | Specification of which currency the account taking the Offer would receive, as a [currency object with no amount](../../../protocol/data-types/currency-formats.md#specifying-without-amounts). |
|
||||
| `taker_pays` | Object | Specification of which currency the account taking the Offer would pay, as a [currency object with no amount](../../../protocol/data-types/currency-formats.md#specifying-without-amounts). |
|
||||
| `taker` | String | Unique [account address](../../../../concepts/accounts/accounts.md) to use as a perspective for viewing offers, in the XRP Ledger's [base58][] format. (This affects the funding status and fees of [Offers](../../../../concepts/tokens/decentralized-exchange/offers.md).) |
|
||||
| `snapshot` | Boolean | _(Optional)_ If `true`, return the current state of the order book once when you subscribe before sending updates. The default is `false`. |
|
||||
| `both` | Boolean | _(Optional)_ If `true`, return both sides of the order book. The default is `false`. |
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "Example watch Bitstamp's hot wallet",
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][]. The fields contained in the response vary depending on what subscriptions were included in the request.
|
||||
|
||||
* `accounts` and `accounts_proposed` - No fields returned.
|
||||
* *Stream: `server`* - Information about the server status, such as `load_base` (the current load level of the server), `random` (a randomly-generated value), and others, subject to change.
|
||||
* *Stream: `transactions`*, *Stream: `transactions_proposed`*, *Stream: `validations`*, and *Stream: `consensus`* - No fields returned.
|
||||
* *Stream: `ledger`* - Information about the ledgers on hand and current fee schedule. This includes the same fields as a [ledger stream message](#ledger-stream), except that it omits the `type` and `txn_count` fields.
|
||||
* `books` - No fields returned by default. If `"snapshot": true` is set in the request, returns `offers` (an array of offer definition objects defining the order book).
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `noPermission` - The request included the `url` field, but you are not connected as an admin.
|
||||
* `unknownStream` - One or more the members of the `streams` field of the request is not a valid stream name.
|
||||
* `malformedStream` - The `streams` field of the request is not formatted properly.
|
||||
* `malformedAccount` - One of the addresses in the `accounts` or `accounts_proposed` fields of the request is not a properly-formatted XRP Ledger address. (**Note:**: You _can_ subscribe to the stream of an address that does not yet have an entry in the global ledger to get a message when that address becomes funded.)
|
||||
* `srcCurMalformed` - One or more `taker_pays` sub-fields of the `books` field in the request is not formatted properly.
|
||||
* `dstAmtMalformed` - One or more `taker_gets` sub-fields of the `books` field in the request is not formatted properly.
|
||||
* `srcIsrMalformed` - The `issuer` field of one or more `taker_pays` sub-fields of the `books` field in the request is not valid.
|
||||
* `dstIsrMalformed` - The `issuer` field of one or more `taker_gets` sub-fields of the `books` field in the request is not valid.
|
||||
* `badMarket` - One or more desired order books in the `books` field does not exist; for example, offers to exchange a currency for itself.
|
||||
|
||||
When you subscribe to a particular stream, you receive periodic responses on that stream until you unsubscribe or close the WebSocket connection. The content of those responses depends on what you subscribed to. Here are some examples:
|
||||
|
||||
## Ledger Stream
|
||||
|
||||
The `ledger` stream only sends `ledgerClosed` messages when [the consensus process](../../../../concepts/consensus-protocol/index.md) declares a new validated ledger. The message identifies the ledger and provides some information about its contents.
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "ledgerClosed",
|
||||
"fee_base": 10,
|
||||
"fee_ref": 10,
|
||||
"ledger_hash": "687F604EF6B2F67319E8DCC8C66EF49D84D18A1E18F948421FC24D2C7C3DB464",
|
||||
"ledger_index": 7125358,
|
||||
"ledger_time": 455751310,
|
||||
"reserve_base": 20000000,
|
||||
"reserve_inc": 5000000,
|
||||
"txn_count": 7,
|
||||
"validated_ledgers": "32570-7125358"
|
||||
}
|
||||
```
|
||||
|
||||
The fields from a ledger stream message are as follows:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:--------------------|:--------------------------|:---------------------------|
|
||||
| `type` | String | `ledgerClosed` indicates this is from the ledger stream |
|
||||
| `fee_base` | Number | The [reference transaction cost](../../../../concepts/transactions/transaction-cost.md#reference-transaction-cost) as of this ledger version, in [drops of XRP][]. If this ledger version includes a [SetFee pseudo-transaction](../../../protocol/transactions/pseudo-transaction-types/setfee.md) the new transaction cost applies starting with the following ledger version. |
|
||||
| `fee_ref` | Number | _(May be omitted)_ The [reference transaction cost](../../../../concepts/transactions/transaction-cost.md#reference-transaction-cost) in "fee units". If the _[XRPFees amendment][]_ is enabled, this field is permanently omitted as it will no longer be relevant. |
|
||||
| `ledger_hash` | String - [Hash][] | The identifying hash of the ledger version that was closed. |
|
||||
| `ledger_index` | Number - [Ledger Index][] | The ledger index of the ledger that was closed. |
|
||||
| `ledger_time` | Number | The time this ledger was closed, in [seconds since the Ripple Epoch][] |
|
||||
| `reserve_base` | Number | The minimum [reserve](../../../../concepts/accounts/reserves.md), in [drops of XRP][], that is required for an account. If this ledger version includes a [SetFee pseudo-transaction](../../../protocol/transactions/pseudo-transaction-types/setfee.md) the new base reserve applies starting with the following ledger version. |
|
||||
| `reserve_inc` | Number | The [owner reserve](../../../../concepts/accounts/reserves.md#owner-reserves) for each object an account owns in the ledger, in [drops of XRP][]. If the ledger includes a [SetFee pseudo-transaction](../../../protocol/transactions/pseudo-transaction-types/setfee.md) the new owner reserve applies after this ledger. |
|
||||
| `txn_count` | Number | Number of new transactions included in this ledger version. |
|
||||
| `validated_ledgers` | String | _(May be omitted)_ Range of ledgers that the server has available. This may be a disjoint sequence such as `24900901-24900984,24901116-24901158`. This field is not returned if the server is not connected to the network, or if it is connected but has not yet obtained a ledger from the network. |
|
||||
|
||||
|
||||
## Validations Stream
|
||||
|
||||
{% badge href="https://github.com/XRPLF/rippled/releases/tag/0.29.0" %}New in: rippled 0.29.0{% /badge %}
|
||||
|
||||
The validations stream sends messages whenever it receives validation messages, also called validation votes, regardless of whether or not the validation message is from a trusted validator. The message looks like the following:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "validationReceived",
|
||||
"amendments":[
|
||||
"42426C4D4F1009EE67080A9B7965B44656D7714D104A72F9B4369F97ABF044EE",
|
||||
"4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373",
|
||||
"6781F8368C4771B83E8B821D88F580202BCB4228075297B19E4FDC5233F1EFDC",
|
||||
"C1B8D934087225F509BEB5A8EC24447854713EE447D277F69545ABFA0E0FD490",
|
||||
"DA1BD556B42D85EA9C84066D028D355B52416734D3283F85E216EA5DA6DB7E13"
|
||||
],
|
||||
"base_fee":10,
|
||||
"flags":2147483649,
|
||||
"full":true,
|
||||
"ledger_hash":"EC02890710AAA2B71221B0D560CFB22D64317C07B7406B02959AD84BAD33E602",
|
||||
"ledger_index":"6",
|
||||
"load_fee":256000,
|
||||
"master_key": "nHUon2tpyJEHHYGmxqeGu37cvPYHzrMtUNQFVdCgGNvEkjmCpTqK",
|
||||
"reserve_base":20000000,
|
||||
"reserve_inc":5000000,
|
||||
"signature":"3045022100E199B55643F66BC6B37DBC5E185321CF952FD35D13D9E8001EB2564FFB94A07602201746C9A4F7A93647131A2DEB03B76F05E426EC67A5A27D77F4FF2603B9A528E6",
|
||||
"signing_time":515115322,
|
||||
"validation_public_key":"n94Gnc6svmaPPRHUAyyib1gQUov8sYbjLoEwUBYPH39qHZXuo8ZT"
|
||||
}
|
||||
```
|
||||
|
||||
The fields from a validations stream message are as follows:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------------|:-----------------|:--------------------------------|
|
||||
| `type` | String | The value `validationReceived` indicates this is from the validations stream. |
|
||||
| `amendments` | Array of Strings | _(May be omitted)_ The [amendments](../../../../concepts/networks-and-servers/amendments.md) this server wants to be added to the protocol. |
|
||||
| `base_fee` | Integer | _(May be omitted)_ The unscaled transaction cost (`reference_fee` value) this server wants to set by [Fee Voting](../../../../concepts/consensus-protocol/fee-voting.md). |
|
||||
| `cookie` | String - Number | _(May be omitted)_ An arbitrary value chosen by the server at startup. If the same validation key pair signs validations with different cookies concurrently, that usually indicates that multiple servers are incorrectly configured to use the same validation key pair. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.8.1" %}New in: rippled 1.8.1{% /badge %} |
|
||||
| `flags` | Number | Bit-mask of flags added to this validation message. The flag `0x80000000` indicates that the validation signature is fully-canonical. The flag `0x00000001` indicates that this is a full validation; otherwise it's a partial validation. Partial validations are not meant to vote for any particular ledger. A partial validation indicates that the validator is still online but not keeping up with consensus. |
|
||||
| `full` | Boolean | If `true`, this is a full validation. Otherwise, this is a partial validation. Partial validations are not meant to vote for any particular ledger. A partial validation indicates that the validator is still online but not keeping up with consensus. |
|
||||
| `ledger_hash` | String | The identifying hash of the proposed ledger is being validated. |
|
||||
| `ledger_index` | String - Number | The [Ledger Index][] of the proposed ledger. |
|
||||
| `load_fee` | Integer | _(May be omitted)_ The local load-scaled transaction cost this validator is currently enforcing, in fee units. |
|
||||
| `master_key` | String | _(May be omitted)_ The validator's master public key, if the validator is using a validator token, in the XRP Ledger's [base58][] format. (See also: [Enable Validation on your `rippled` Server](../../../../infrastructure/configuration/server-modes/run-rippled-as-a-validator.md#3-enable-validation-on-your-rippled-server).) |
|
||||
| `reserve_base` | Integer | _(May be omitted)_ The minimum reserve requirement (`account_reserve` value) this validator wants to set by [Fee Voting](../../../../concepts/consensus-protocol/fee-voting.md). |
|
||||
| `reserve_inc` | Integer | _(May be omitted)_ The increment in the reserve requirement (`owner_reserve` value) this validator wants to set by [Fee Voting](../../../../concepts/consensus-protocol/fee-voting.md). |
|
||||
| `server_version` | String - Number | _(May be omitted)_ An 64-bit integer that encodes the version number of the validating server. For example, `"1745990410175512576"`. Only provided once every 256 ledgers. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.8.1" %}New in: rippled 1.8.1{% /badge %} |
|
||||
| `signature` | String | The signature that the validator used to sign its vote for this ledger. |
|
||||
| `signing_time` | Number | When this validation vote was signed, in [seconds since the Ripple Epoch][]. |
|
||||
| `validated_hash` | String | The unique hash of the proposed ledger this validation applies to. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.8.1" %}New in: rippled 1.8.1{% /badge %} |
|
||||
| `validation_public_key` | String | The public key from the key-pair that the validator used to sign the message, in the XRP Ledger's [base58][] format. This identifies the validator sending the message and can also be used to verify the `signature`. If the validator is using a token, this is an ephemeral public key. |
|
||||
|
||||
|
||||
## Transaction Streams
|
||||
|
||||
Many subscriptions result in messages about transactions, including the following:
|
||||
|
||||
* The `transactions` stream
|
||||
* The `transactions_proposed` stream
|
||||
* `accounts` subscriptions
|
||||
* `accounts_proposed` subscriptions
|
||||
* `book` (Order Book) subscriptions
|
||||
|
||||
The `transactions_proposed` stream, strictly speaking, is a superset of the `transactions` stream: it includes all validated transactions, as well as some suggested transactions that have not yet been included in a validated ledger and may never be. You can identify these "in-flight" transactions by their fields:
|
||||
|
||||
* The `validated` field is missing or has a value of `false`.
|
||||
* There is no `meta` or `metadata` field.
|
||||
* Instead of `ledger_hash` and `ledger_index` fields specifying in which ledger version the transactions were finalized, there is a `ledger_current_index` field specifying in which ledger version they are currently proposed.
|
||||
|
||||
Otherwise, the messages from the `transactions_proposed` stream are the same as ones from the `transactions` stream.
|
||||
|
||||
Since the only thing that can modify an account or an order book is a transaction, the messages that are sent as a result of subscribing to particular `accounts` or `books` also take the form of transaction messages, the same as the ones in the `transactions` stream. The only difference is that you only receive messages for transactions that affect the accounts or order books you're watching.
|
||||
|
||||
The `accounts_proposed` subscription works the same way, except it also includes unconfirmed transactions, like the `transactions_proposed` stream, for the accounts you're watching.
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "closed",
|
||||
"type": "transaction",
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied.",
|
||||
"ledger_hash": "989AFBFD65D820C6BD85301B740F5D592F060668A90EEF5EC1815EBA27D58FE8",
|
||||
"ledger_index": 7125442,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"IndexPrevious": "0000000000000000",
|
||||
"Owner": "rRh634Y6QtoqkwTTrGzX66UYoCAvgE6jL",
|
||||
"RootIndex": "ABD8CE2D1205D0C062876E9E1F3CBDC902ED8EF4E8D3D071B962C7ED0E113E68"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "0BBDEE7D0BE120F7BF27640B5245EBFE0C5FD5281988BA823C44477A70262A4D"
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rRh634Y6QtoqkwTTrGzX66UYoCAvgE6jL",
|
||||
"BookDirectory": "892E892DC63D8F70DCF5C9ECF29394FF7DD3DC6F47DB8EB34A03920BFC5E99BE",
|
||||
"BookNode": "0000000000000000",
|
||||
"Flags": 0,
|
||||
"OwnerNode": "000000000000006E",
|
||||
"PreviousTxnID": "58A17D95770F8D07E08B81A85896F4032A328B6C2BDCDEC0A00F3EF3914DCF0A",
|
||||
"PreviousTxnLgrSeq": 7125330,
|
||||
"Sequence": 540691,
|
||||
"TakerGets": "4401967683",
|
||||
"TakerPays": {
|
||||
"currency": "BTC",
|
||||
"issuer": "rNPRNzBB92BVpAhhZr4iXDTveCgV5Pofm9",
|
||||
"value": "0.04424"
|
||||
}
|
||||
},
|
||||
"LedgerEntryType": "Offer",
|
||||
"LedgerIndex": "386B7803A9210747941B0D079BB408F31ACB1CB98832184D0287A1CBF4FE6D00"
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode": {
|
||||
"FinalFields": {
|
||||
"ExchangeRate": "4A03920BFC5E99BE",
|
||||
"Flags": 0,
|
||||
"RootIndex": "892E892DC63D8F70DCF5C9ECF29394FF7DD3DC6F47DB8EB34A03920BFC5E99BE",
|
||||
"TakerGetsCurrency": "0000000000000000000000000000000000000000",
|
||||
"TakerGetsIssuer": "0000000000000000000000000000000000000000",
|
||||
"TakerPaysCurrency": "0000000000000000000000004254430000000000",
|
||||
"TakerPaysIssuer": "92D705968936C419CE614BF264B5EEB1CEA47FF4"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "892E892DC63D8F70DCF5C9ECF29394FF7DD3DC6F47DB8EB34A03920BFC5E99BE"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rRh634Y6QtoqkwTTrGzX66UYoCAvgE6jL",
|
||||
"Balance": "11133297300",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 9,
|
||||
"Sequence": 540706
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "A6C2532E1008A513B3F822A92B8E5214BD0D413DC20AD3631C1A39AD6B36CD07",
|
||||
"PreviousFields": {
|
||||
"Balance": "11133297310",
|
||||
"OwnerCount": 10,
|
||||
"Sequence": 540705
|
||||
},
|
||||
"PreviousTxnID": "484D57DFC4E446DA83B4540305F0CE836D4E007361542EC12CC0FFB5F0A1BE3A",
|
||||
"PreviousTxnLgrSeq": 7125358
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 1,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"transaction": {
|
||||
"Account": "rRh634Y6QtoqkwTTrGzX66UYoCAvgE6jL",
|
||||
"Fee": "10",
|
||||
"Flags": 2147483648,
|
||||
"OfferSequence": 540691,
|
||||
"Sequence": 540705,
|
||||
"SigningPubKey": "030BB49C591C9CD65C945D4B78332F27633D7771E6CF4D4B942D26BA40748BB8B4",
|
||||
"TransactionType": "OfferCancel",
|
||||
"TxnSignature": "30450221008223604A383F3AED25D53CE7C874700619893A6EEE4336508312217850A9722302205E0614366E174F2DFF78B879F310DB0B3F6DA1967E52A32F65E25DCEC622CD68",
|
||||
"date": 455751680,
|
||||
"hash": "94CF924C774DFDBE474A2A7E40AEA70E7E15D130C8CBEF8AF1D2BE97A8269F14"
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
```
|
||||
|
||||
Transaction stream messages have the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------------|:--------------------------|:-----------------------|
|
||||
| `type` | String | `transaction` indicates this is the notification of a transaction, which could come from several possible streams. |
|
||||
| `engine_result` | String | String [Transaction result code](../../../protocol/transactions/transaction-results/transaction-results.md) |
|
||||
| `engine_result_code` | Number | Numeric [transaction response code](../../../protocol/transactions/transaction-results/transaction-results.md), if applicable. |
|
||||
| `engine_result_message` | String | Human-readable explanation for the transaction response |
|
||||
| `ledger_current_index` | Number - [Ledger Index][] | _(Unvalidated transactions only)_ The ledger index of the current in-progress [ledger version](../../../../concepts/ledgers/index.md) for which this transaction is currently proposed. |
|
||||
| `ledger_hash` | String - [Hash][] | _(Validated transactions only)_ The identifying hash of the ledger version that includes this transaction |
|
||||
| `ledger_index` | Number - [Ledger Index][] | _(Validated transactions only)_ The ledger index of the ledger version that includes this transaction. |
|
||||
| `meta` | Object | _(Validated transactions only)_ The [transaction metadata](../../../protocol/transactions/metadata.md), which shows the exact outcome of the transaction in detail. |
|
||||
| `transaction` | Object | The [definition of the transaction](../../../protocol/transactions/index.md) in JSON format |
|
||||
| `validated` | Boolean | If `true`, this transaction is included in a validated ledger and its outcome is final. Responses from the `transaction` stream should always be validated. |
|
||||
|
||||
|
||||
## Peer Status Stream
|
||||
|
||||
The admin-only `peer_status` stream reports a large amount of information on the activities of other `rippled` servers to which this server is connected, in particular their status in the consensus process.
|
||||
|
||||
Example of a Peer Status stream message:
|
||||
|
||||
```json
|
||||
{
|
||||
"action": "CLOSING_LEDGER",
|
||||
"date": 508546525,
|
||||
"ledger_hash": "4D4CD9CD543F0C1EF023CC457F5BEFEA59EEF73E4552542D40E7C4FA08D3C320",
|
||||
"ledger_index": 18853106,
|
||||
"ledger_index_max": 18853106,
|
||||
"ledger_index_min": 18852082,
|
||||
"type": "peerStatusChange"
|
||||
}
|
||||
```
|
||||
|
||||
Peer Status stream messages represent some event where the status of the peer `rippled` server changed. These messages are JSON objects with the following fields:
|
||||
|
||||
| `Field` | Value | Description |
|
||||
|:-------------------|:-------|:-----------------------------------------------|
|
||||
| `type` | String | `peerStatusChange` indicates this comes from the Peer Status stream. |
|
||||
| `action` | String | The type of event that prompted this message. See [Peer Status Events](#peer-status-events) for possible values. |
|
||||
| `date` | Number | The time this event occurred, in [seconds since the Ripple Epoch][]. |
|
||||
| `ledger_hash` | String | (May be omitted) The identifying [Hash][] of a ledger version to which this message pertains. |
|
||||
| `ledger_index` | Number | (May be omitted) The [Ledger Index][] of a ledger version to which this message pertains. |
|
||||
| `ledger_index_max` | Number | (May be omitted) The largest [Ledger Index][] the peer has currently available. |
|
||||
| `ledger_index_min` | Number | (May be omitted) The smallest [Ledger Index][] the peer has currently available. |
|
||||
|
||||
### Peer Status Events
|
||||
|
||||
The `action` field of a Peer Status stream message can have the following values:
|
||||
|
||||
| `Value` | Meaning |
|
||||
|:------------------|:---------------------------------------------------------|
|
||||
| `CLOSING_LEDGER` | The peer closed a ledger version with this [Ledger Index][], which usually means it is about to start consensus. |
|
||||
| `ACCEPTED_LEDGER` | The peer built this ledger version as the result of a consensus round. **Note:** This ledger is still not certain to become immutably validated. |
|
||||
| `SWITCHED_LEDGER` | The peer concluded it was not following the rest of the network and switched to a different ledger version. |
|
||||
| `LOST_SYNC` | The peer fell behind the rest of the network in tracking which ledger versions are validated and which are undergoing consensus. |
|
||||
|
||||
|
||||
## Order Book Streams
|
||||
|
||||
When you subscribe to one or more order books with the `books` field, you get back any transactions that affect those order books.
|
||||
|
||||
Example order book stream message:
|
||||
|
||||
```json
|
||||
{
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"ledger_hash": "08547DD866F099CCB3666F113116B7AA2DF520FA2E3011DD1FF9C9C04A6C7C3E",
|
||||
"ledger_index": 18852105,
|
||||
"meta": {
|
||||
"AffectedNodes": [{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw",
|
||||
"AccountTxnID": "D295E2BE50E3B78AED24790D7B9096996DAF43F095BF17DB83EEACC283D14050",
|
||||
"Balance": "3070332374272",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 23,
|
||||
"RegularKey": "r9S56zu6QeJD5d8A7QMfLAeYavgB9dhaX4",
|
||||
"Sequence": 12142921
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "2880A9B4FB90A306B576C2D532BFE390AB3904642647DCF739492AA244EF46D1",
|
||||
"PreviousFields": {
|
||||
"AccountTxnID": "3CA3422B0E42D76A7A677B0BA0BE72DFCD93676E0C80F8D2EB27C04BD8457A0F",
|
||||
"Balance": "3070332385272",
|
||||
"Sequence": 12142920
|
||||
},
|
||||
"PreviousTxnID": "3CA3422B0E42D76A7A677B0BA0BE72DFCD93676E0C80F8D2EB27C04BD8457A0F",
|
||||
"PreviousTxnLgrSeq": 18852102
|
||||
}
|
||||
}, {
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"IndexPrevious": "00000000000022D2",
|
||||
"Owner": "rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw",
|
||||
"RootIndex": "F435FBBEC9654204D7151A01E686BAA8CB325A472D7B61C7916EA58B59355767"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "29A543B6681AD7FC8AFBD1386DAE7385F02F9B8C4756A467DF6834AB54BBC9DB"
|
||||
}
|
||||
}, {
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"ExchangeRate": "4C1BA999A513EF78",
|
||||
"Flags": 0,
|
||||
"RootIndex": "79C54A4EBD69AB2EADCE313042F36092BE432423CC6A4F784C1BA999A513EF78",
|
||||
"TakerGetsCurrency": "0000000000000000000000000000000000000000",
|
||||
"TakerGetsIssuer": "0000000000000000000000000000000000000000",
|
||||
"TakerPaysCurrency": "0000000000000000000000005553440000000000",
|
||||
"TakerPaysIssuer": "2ADB0B3959D60A6E6991F729E1918B7163925230"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "79C54A4EBD69AB2EADCE313042F36092BE432423CC6A4F784C1BA999A513EF78"
|
||||
}
|
||||
}, {
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "Offer",
|
||||
"LedgerIndex": "92E235EE80D2B28A89BEE2C905D4545C2A004FD5D4097679C8A3FB25507FD9EB",
|
||||
"NewFields": {
|
||||
"Account": "rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw",
|
||||
"BookDirectory": "79C54A4EBD69AB2EADCE313042F36092BE432423CC6A4F784C1BA999A513EF78",
|
||||
"Expiration": 508543674,
|
||||
"OwnerNode": "00000000000022F4",
|
||||
"Sequence": 12142920,
|
||||
"TakerGets": "6537121438",
|
||||
"TakerPays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
|
||||
"value": "50.9"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"DeletedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw",
|
||||
"BookDirectory": "79C54A4EBD69AB2EADCE313042F36092BE432423CC6A4F784C1BA999A513EF78",
|
||||
"BookNode": "0000000000000000",
|
||||
"Expiration": 508543133,
|
||||
"Flags": 0,
|
||||
"OwnerNode": "00000000000022F4",
|
||||
"PreviousTxnID": "58B3279C2D56AAC3D9B06106E637C01E3D911E9D31E2FE4EA0D886AC9F4DEE1E",
|
||||
"PreviousTxnLgrSeq": 18851945,
|
||||
"Sequence": 12142889,
|
||||
"TakerGets": "6537121438",
|
||||
"TakerPays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
|
||||
"value": "50.9"
|
||||
}
|
||||
},
|
||||
"LedgerEntryType": "Offer",
|
||||
"LedgerIndex": "D3436CE21925E1CB12C5C444963B47D7EA0CD9A0E387926DC76B23FE5CD1C15F"
|
||||
}
|
||||
}],
|
||||
"TransactionIndex": 26,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"status": "closed",
|
||||
"transaction": {
|
||||
"Account": "rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw",
|
||||
"Expiration": 508543674,
|
||||
"Fee": "11000",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 18852106,
|
||||
"OfferSequence": 12142889,
|
||||
"Sequence": 12142920,
|
||||
"SigningPubKey": "034841BF24BD72C7CC371EBD87CCBF258D8ADB05C18DE207130364A97D8A3EA524",
|
||||
"TakerGets": "6537121438",
|
||||
"TakerPays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
|
||||
"value": "50.9"
|
||||
},
|
||||
"TransactionType": "OfferCreate",
|
||||
"TxnSignature": "3045022100B9AD678A773FB61F8F9B565713C80CBF187A2F9EB8E9CE0DAC7B839CA6F4B04C02200613D173A0636CD9BE13F2E3EBD13A16932B5B7D8A96BB5F6D561CA5CDBC4AD3",
|
||||
"date": 508543090,
|
||||
"hash": "D295E2BE50E3B78AED24790D7B9096996DAF43F095BF17DB83EEACC283D14050",
|
||||
"owner_funds": "3070197374272"
|
||||
},
|
||||
"type": "transaction",
|
||||
"validated": true
|
||||
}
|
||||
```
|
||||
|
||||
The format of an order book stream message is the same as that of [transaction stream messages](#transaction-streams), except that `OfferCreate` transactions also contain the following field:
|
||||
|
||||
| `Field` | Value | Description |
|
||||
|:--------------------------|:-------|:----------------------------------------|
|
||||
| `transaction.owner_funds` | String | Numeric amount of the `TakerGets` currency that the `Account` sending this OfferCreate transaction has after executing this transaction. This does not check whether the currency amount is [frozen](../../../../concepts/tokens/fungible-tokens/freezes.md). |
|
||||
|
||||
|
||||
## Consensus Stream
|
||||
|
||||
{% badge href="https://github.com/XRPLF/rippled/releases/tag/1.4.0" %}New in: rippled 1.4.0{% /badge %}
|
||||
|
||||
The `consensus` stream sends `consensusPhase` messages when [the consensus process](../../../../concepts/consensus-protocol/index.md) changes phase. The message contains the new phase of consensus the server is in.
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "consensusPhase",
|
||||
"consensus": "accepted"
|
||||
}
|
||||
```
|
||||
|
||||
The fields from a consensus stream message are as follows:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:--------------------|:--------------------------|:---------------------------|
|
||||
| `type` | String | `consensusPhase` indicates this is from the consensus stream |
|
||||
| `consensus` | String | The new consensus phase the server is in. Possible values are `open`, `establish`, and `accepted`. |
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
html: unsubscribe.html
|
||||
parent: subscription-methods.html
|
||||
seo:
|
||||
description: Stop listening for updates about a particular subject.
|
||||
labels:
|
||||
- Payments
|
||||
- Blockchain
|
||||
- Accounts
|
||||
- Smart Contracts
|
||||
---
|
||||
# unsubscribe
|
||||
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/Unsubscribe.cpp "Source")
|
||||
|
||||
The `unsubscribe` command tells the server to stop sending messages for a particular subscription or set of subscriptions.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "Unsubscribe a lot of stuff",
|
||||
"command": "unsubscribe",
|
||||
"streams": ["ledger","server","transactions","transactions_proposed"],
|
||||
"accounts": ["rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1"],
|
||||
"accounts_proposed": ["rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1"],
|
||||
"books": [
|
||||
{
|
||||
"taker_pays": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"taker_gets": {
|
||||
"currency": "USD",
|
||||
"issuer": "rUQTpMqAF5jhykj4FExVeXakrZpiKF6cQV"
|
||||
},
|
||||
"both": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#unsubscribe)
|
||||
|
||||
The parameters in the request are specified almost exactly like the parameters to the [subscribe method][], except that they are used to define which subscriptions to end instead. The parameters are:
|
||||
|
||||
| `Field` | Type | Required? | Description |
|
||||
|:--------------------|:------|:----------|:-----------------------------------------------|
|
||||
| `streams` | Array | No | Array of string names of generic streams to unsubscribe from, including `ledger`, `server`, `transactions`, and `transactions_proposed`. |
|
||||
| `accounts` | Array | No | Array of unique account addresses to stop receiving updates for, in the XRP Ledger's [base58][] format. (This only stops those messages if you previously subscribed to those accounts specifically. You cannot use this to filter accounts out of the general transactions stream.) |
|
||||
| `accounts_proposed` | Array | No | Like `accounts`, but for `accounts_proposed` subscriptions that included not-yet-validated transactions. |
|
||||
| `books` | Array | No | Array of objects defining order books to unsubscribe from, as explained below. |
|
||||
|
||||
The `rt_accounts` and `url` parameters, and the `rt_transactions` stream name, are deprecated and may be removed without further notice.
|
||||
|
||||
The objects in the `books` array are defined almost like the ones from subscribe, except that they don't have all the fields. The fields they have are as follows:
|
||||
|
||||
| `Field` | Type | Required? | Description |
|
||||
|:-------------|:--------|:----------|:----------------------------------------------------|
|
||||
| `taker_gets` | Object | No | Specification of which currency the account taking the offer would receive, as an object with `currency` and `issuer` fields. Omit `issuer` for XRP. |
|
||||
| `taker_pays` | Object | No | Specification of which currency the account taking the offer would receive, as an object with `currency` and `issuer` fields. Omit `issuer` for XRP. |
|
||||
| `both` | Boolean | No | If `true`, remove a subscription for both sides of the order book. |
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "Unsubscribe a lot of stuff",
|
||||
"result": {},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing no fields.
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `noPermission` - The request included the `url` field, but you are not connected as an admin.
|
||||
* `malformedStream` - The `streams` field of the request is not formatted properly.
|
||||
* `malformedAccount` - One of the addresses in the `accounts` or `accounts_proposed` fields of the request is not a properly-formatted XRP Ledger address.
|
||||
* **Note:** You _can_ subscribe to the stream of an address that does not yet have an entry in the global ledger to get a message when that address becomes funded.
|
||||
* `srcCurMalformed` - One or more `taker_pays` sub-fields of the `books` field in the request is not formatted properly.
|
||||
* `dstAmtMalformed` - One or more `taker_gets` sub-fields of the `books` field in the request is not formatted properly.
|
||||
* `srcIsrMalformed` - The `issuer` field of one or more `taker_pays` sub-fields of the `books` field in the request is not valid.
|
||||
* `dstIsrMalformed` - The `issuer` field of one or more `taker_gets` sub-fields of the `books` field in the request is not valid.
|
||||
* `badMarket` - One or more desired order books in the `books` field does not exist; for example, offers to exchange a currency for itself.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
html: transaction-methods.html # watch for clashes w/ this filename
|
||||
parent: public-api-methods.html
|
||||
metadata:
|
||||
indexPage: true
|
||||
---
|
||||
# Transaction Methods
|
||||
|
||||
Transactions are the only thing that can modify the shared state of the XRP Ledger. All business on the XRP Ledger takes the form of transactions. Use these methods to work with transactions.
|
||||
|
||||
|
||||
{% child-pages /%}
|
||||
@@ -0,0 +1,334 @@
|
||||
---
|
||||
html: submit.html
|
||||
parent: transaction-methods.html
|
||||
seo:
|
||||
description: Send a transaction to the network.
|
||||
labels:
|
||||
- Transaction Sending
|
||||
- Payments
|
||||
---
|
||||
# submit
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/Submit.cpp "Source")
|
||||
|
||||
The `submit` method applies a [transaction](../../../protocol/transactions/index.md) and sends it to the network to be confirmed and included in future ledgers.
|
||||
|
||||
This command has two modes:
|
||||
|
||||
* Submit-only mode takes a signed, serialized transaction as a binary blob, and submits it to the network as-is. Since signed transaction objects are immutable, no part of the transaction can be modified or automatically filled in after submission.
|
||||
* Sign-and-submit mode takes a JSON-formatted Transaction object, completes and signs the transaction in the same manner as the [sign method][], and then submits the signed transaction. We recommend only using this mode for testing and development.
|
||||
|
||||
To send a transaction as robustly as possible, you should construct and [sign][sign method] it in advance, persist it somewhere that you can access even after a power outage, then `submit` it as a `tx_blob`. After submission, monitor the network with the [tx method][] command to see if the transaction was successfully applied; if a restart or other problem occurs, you can safely re-submit the `tx_blob` transaction: it won't be applied twice since it has the same sequence number as the old transaction.
|
||||
|
||||
## Submit-Only Mode
|
||||
|
||||
A submit-only request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Required? | Description |
|
||||
|:------------|:--------|:----------|:-----------------------------------------------------|
|
||||
| `tx_blob` | String | Yes | Hex representation of the signed transaction to submit. This can be a [multi-signed transaction](../../../../concepts/accounts/multi-signing.md). |
|
||||
| `fail_hard` | Boolean | No | If `true`, and the transaction fails locally, do not retry or relay the transaction to other servers. The default is `false`. |
|
||||
|
||||
### Request Format
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 3,
|
||||
"command": "submit",
|
||||
"tx_blob": "1200002280000000240000001E61D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA968400000000000000B732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB7447304502210095D23D8AF107DF50651F266259CC7139D0CD0C64ABBA3A958156352A0D95A21E02207FCF9B77D7510380E49FF250C21B57169E14E9B4ACFD314CEDC79DDD0A38B8A681144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "submit",
|
||||
"params": [
|
||||
{
|
||||
"tx_blob": "1200002280000000240000000361D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA968400000000000000A732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB74473045022100D184EB4AE5956FF600E7536EE459345C7BBCF097A84CC61A93B9AF7197EDB98702201CEA8009B7BEEBAA2AACC0359B41C427C1C5B550A4CA4B80CF2174AF2D6D5DCE81144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: submit tx_blob
|
||||
submit 1200002280000000240000000361D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA968400000000000000A732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB74473045022100D184EB4AE5956FF600E7536EE459345C7BBCF097A84CC61A93B9AF7197EDB98702201CEA8009B7BEEBAA2AACC0359B41C427C1C5B550A4CA4B80CF2174AF2D6D5DCE81144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#submit)
|
||||
|
||||
|
||||
## Sign-and-Submit Mode
|
||||
|
||||
This mode signs a transaction and immediately submits it. This mode is intended to be used for testing. You cannot use this mode for [multi-signed transactions](../../../../concepts/accounts/multi-signing.md).
|
||||
|
||||
_By default, sign-and-submit mode is [admin-only](../../admin-api-methods/index.md)._ It can be used as a public method if the server has [enabled public signing](../../../../infrastructure/configuration/enable-public-signing.md).
|
||||
|
||||
You can provide the secret key used to sign the transaction in the following ways:
|
||||
|
||||
* Provide a `secret` value and omit the `key_type` field. This value can be formatted as an XRP Ledger [base58][] seed, RFC-1751, hexadecimal, or as a string passphrase. (secp256k1 keys only)
|
||||
* Provide a `key_type` value and exactly one of `seed`, `seed_hex`, or `passphrase`. Omit the `secret` field. (Not supported by the commandline syntax.)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:--------|:--------------------------------------------------|
|
||||
| `tx_json` | Object | [Transaction definition](../../../protocol/transactions/index.md) in JSON format, optionally omitting any auto-fillable fields. |
|
||||
| `secret` | String | _(Optional)_ Secret key of the account supplying the transaction, used to sign it. Do not send your secret to untrusted servers or through unsecured network connections. Cannot be used with `key_type`, `seed`, `seed_hex`, or `passphrase`. |
|
||||
| `seed` | String | _(Optional)_ Secret key of the account supplying the transaction, used to sign it. Must be in the XRP Ledger's [base58][] format. If provided, you must also specify the `key_type`. Cannot be used with `secret`, `seed_hex`, or `passphrase`. |
|
||||
| `seed_hex` | String | _(Optional)_ Secret key of the account supplying the transaction, used to sign it. Must be in hexadecimal format. If provided, you must also specify the `key_type`. Cannot be used with `secret`, `seed`, or `passphrase`. |
|
||||
| `passphrase` | String | _(Optional)_ Secret key of the account supplying the transaction, used to sign it, as a string passphrase. If provided, you must also specify the `key_type`. Cannot be used with `secret`, `seed`, or `seed_hex`. |
|
||||
| `key_type` | String | _(Optional)_ Type of cryptographic key provided in this request. Valid types are `secp256k1` or `ed25519`. Defaults to `secp256k1`. Cannot be used with `secret`. **Caution:** Ed25519 support is experimental. |
|
||||
| `fail_hard` | Boolean | _(Optional)_ If `true`, and the transaction fails locally, do not retry or relay the transaction to other servers. The default is `false`. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.5.0" %}Updated in: rippled 1.5.0{% /badge %} |
|
||||
| `offline` | Boolean | _(Optional)_ If `true`, when constructing the transaction, do not try to automatically fill in or validate values. The default is `false`. |
|
||||
| `build_path` | Boolean | _(Optional)_ If this field is provided, the server [auto-fills](../../../protocol/transactions/common-fields.md#auto-fillable-fields) the `Paths` field of a [Payment transaction][] before signing. You must omit this field if the transaction is a [direct XRP payment](../../../../concepts/payment-types/direct-xrp-payments.md) or if it is not a Payment-type transaction. **Caution:** The server looks for the presence or absence of this field, not its value. This behavior may change. ([Issue #3272](https://github.com/XRPLF/rippled/issues/3272)) |
|
||||
| `fee_mult_max` | Integer | _(Optional)_ Sign-and-submit fails with the error `rpcHIGH_FEE` if the [auto-filled `Fee` value](../../../protocol/transactions/common-fields.md#auto-fillable-fields) would be greater than the [reference transaction cost](../../../../concepts/transactions/transaction-cost.md#special-transaction-costs) × `fee_mult_max` ÷ `fee_div_max`. This field has no effect if you explicitly specify the `Fee` field of the transaction. The default is `10`. |
|
||||
| `fee_div_max` | Integer | _(Optional)_ Sign-and-submit fails with the error `rpcHIGH_FEE` if the [auto-filled `Fee` value](../../../protocol/transactions/common-fields.md#auto-fillable-fields) would be greater than the [reference transaction cost](../../../../concepts/transactions/transaction-cost.md#special-transaction-costs) × `fee_mult_max` ÷ `fee_div_max`. This field has no effect if you explicitly specify the `Fee` field of the transaction. The default is `1`. |
|
||||
|
||||
See the [sign method][] for detailed information on how the server automatically fills in certain fields.
|
||||
|
||||
### Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"command": "submit",
|
||||
"tx_json" : {
|
||||
"TransactionType" : "Payment",
|
||||
"Account" : "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Destination" : "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"Amount" : {
|
||||
"currency" : "USD",
|
||||
"value" : "1",
|
||||
"issuer" : "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
|
||||
}
|
||||
},
|
||||
"secret" : "s████████████████████████████",
|
||||
"offline": false,
|
||||
"fee_mult_max": 1000
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "submit",
|
||||
"params": [
|
||||
{
|
||||
"offline": false,
|
||||
"secret": "s████████████████████████████",
|
||||
"tx_json": {
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Amount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"value": "1"
|
||||
},
|
||||
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"TransactionType": "Payment"
|
||||
},
|
||||
"fee_mult_max": 1000
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: submit secret json [offline]
|
||||
rippled submit s████████████████████████████ '{"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", "Amount": { "currency": "USD", "issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", "value": "1" }, "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX", "TransactionType": "Payment", "Fee": "10000"}'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#submit)
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"accepted" : true,
|
||||
"account_sequence_available" : 362,
|
||||
"account_sequence_next" : 362,
|
||||
"applied" : true,
|
||||
"broadcast" : true,
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"kept" : true,
|
||||
"open_ledger_cost": "10",
|
||||
"queued" : false,
|
||||
"tx_blob": "1200002280000000240000016861D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA9684000000000002710732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB7446304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F858081144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754",
|
||||
"tx_json": {
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Amount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"value": "1"
|
||||
},
|
||||
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"Fee": "10000",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 360,
|
||||
"SigningPubKey": "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F8580",
|
||||
"hash": "4D5D90890F8D49519E4151938601EF3D0B30B16CD6A519D9C99102C9FA77F7E0"
|
||||
},
|
||||
"validated_ledger_index" : 21184416
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"accepted" : true,
|
||||
"account_sequence_available" : 362,
|
||||
"account_sequence_next" : 362,
|
||||
"applied" : true,
|
||||
"broadcast" : true,
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"status": "success",
|
||||
"kept" : true,
|
||||
"open_ledger_cost": "10",
|
||||
"queued" : false,
|
||||
"tx_blob": "1200002280000000240000016961D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA9684000000000002710732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB74473045022100A7CCD11455E47547FF617D5BFC15D120D9053DFD0536B044F10CA3631CD609E502203B61DEE4AC027C5743A1B56AF568D1E2B8E79BB9E9E14744AC87F38375C3C2F181144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754",
|
||||
"tx_json": {
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Amount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"value": "1"
|
||||
},
|
||||
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"Fee": "10000",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 361,
|
||||
"SigningPubKey": "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022100A7CCD11455E47547FF617D5BFC15D120D9053DFD0536B044F10CA3631CD609E502203B61DEE4AC027C5743A1B56AF568D1E2B8E79BB9E9E14744AC87F38375C3C2F1",
|
||||
"hash": "5B31A7518DC304D5327B4887CD1F7DC2C38D5F684170097020C7C9758B973847"
|
||||
}
|
||||
},
|
||||
"validated_ledger_index" : 21184416
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
Loading: "/etc/rippled.cfg"
|
||||
Connecting to 127.0.0.1:5005
|
||||
|
||||
{
|
||||
"result": {
|
||||
"accepted" : true,
|
||||
"account_sequence_available" : 362,
|
||||
"account_sequence_next" : 362,
|
||||
"applied" : true,
|
||||
"broadcast" : true,
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"status": "success",
|
||||
"kept" : true,
|
||||
"open_ledger_cost": "10",
|
||||
"queued" : false,
|
||||
"tx_blob": "1200002280000000240000016961D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA9684000000000002710732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB74473045022100A7CCD11455E47547FF617D5BFC15D120D9053DFD0536B044F10CA3631CD609E502203B61DEE4AC027C5743A1B56AF568D1E2B8E79BB9E9E14744AC87F38375C3C2F181144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754",
|
||||
"tx_json": {
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Amount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"value": "1"
|
||||
},
|
||||
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"Fee": "10000",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 361,
|
||||
"SigningPubKey": "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022100A7CCD11455E47547FF617D5BFC15D120D9053DFD0536B044F10CA3631CD609E502203B61DEE4AC027C5743A1B56AF568D1E2B8E79BB9E9E14744AC87F38375C3C2F1",
|
||||
"hash": "5B31A7518DC304D5327B4887CD1F7DC2C38D5F684170097020C7C9758B973847"
|
||||
}
|
||||
},
|
||||
"validated_ledger_index" : 21184416
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------------|:--------|:-----------------------------------------|
|
||||
| `engine_result` | String | Text [result code](../../../protocol/transactions/transaction-results/transaction-results.md) indicating the preliminary result of the transaction, for example `tesSUCCESS` |
|
||||
| `engine_result_code` | Integer | Numeric version of the [result code](../../../protocol/transactions/transaction-results/transaction-results.md). **Not recommended.** |
|
||||
| `engine_result_message` | String | Human-readable explanation of the transaction's preliminary result |
|
||||
| `tx_blob` | String | The complete transaction in hex string format |
|
||||
| `tx_json` | Object | The complete transaction in JSON format |
|
||||
| `accepted` | Boolean | _(Omitted in sign-and-submit mode)_ The value `true` indicates that the transaction was applied, queued, broadcast, or kept for later. The value `false` indicates that none of those happened, so the transaction cannot possibly succeed as long as you do not submit it again and have not already submitted it another time. |
|
||||
| `account_sequence_available` | Number | _(Omitted in sign-and-submit mode)_ The next [Sequence Number][] available for the sending account after all pending and [queued](../../../../concepts/transactions/transaction-queue.md) transactions. |
|
||||
| `account_sequence_next` | number | _(Omitted in sign-and-submit mode)_ The next [Sequence Number][] for the sending account after all transactions that have been provisionally applied, but not transactions in the [queue](../../../../concepts/transactions/transaction-queue.md). |
|
||||
| `applied` | Boolean | _(Omitted in sign-and-submit mode)_ The value `true` indicates that this transaction was applied to the open ledger. In this case, the transaction is likely, but not guaranteed, to be validated in the next ledger version. |
|
||||
| `broadcast` | Boolean | _(Omitted in sign-and-submit mode)_ The value `true` indicates this transaction was broadcast to peer servers in the peer-to-peer XRP Ledger network. (Note: if the server has no peers, such as in [stand-alone mode][], the server uses the value `true` for cases where it _would_ have broadcast the transaction.) The value `false` indicates the transaction was not broadcast to any other servers. |
|
||||
| `kept` | Boolean | _(Omitted in sign-and-submit mode)_ The value `true` indicates that the transaction was kept to be retried later. |
|
||||
| `queued` | Boolean | _(Omitted in sign-and-submit mode)_ The value `true` indicates the transaction was put in the [Transaction Queue](../../../../concepts/transactions/transaction-queue.md), which means it is likely to be included in a future ledger version. |
|
||||
| `open_ledger_cost` | String | _(Omitted in sign-and-submit mode)_ The current [open ledger cost](../../../../concepts/transactions/transaction-cost.md#open-ledger-cost) before processing this transaction. Transactions with a lower cost are likely to be [queued](../../../../concepts/transactions/transaction-queue.md). |
|
||||
| `validated_ledger_index` | Integer | _(Omitted in sign-and-submit mode)_ The [ledger index][] of the newest validated ledger at the time of submission. This provides a lower bound on the ledger versions that the transaction can appear in as a result of this request. (The transaction could only have been validated in this ledger version or earlier if it had already been submitted before.) |
|
||||
|
||||
**Warning:** Even if the WebSocket response has `"status":"success"`, indicating that the command was successfully received, that does _not_ indicate that the transaction executed successfully. Many situations can prevent a transaction from processing successfully, such as a lack of trust lines connecting the two accounts in a payment, or changes in the state of the ledger since the time the transaction was constructed. Even if nothing is wrong, it may take several seconds to close and validate the ledger version that includes the transaction. See the [full list of transaction responses](../../../protocol/transactions/transaction-results/transaction-results.md) for details, and do not consider the transaction's results final until they appear in a validated ledger version.
|
||||
|
||||
**Caution:** If this command results in an error message, the message can contain the secret key from the request. (This can only happen in sign-and-submit mode.) Make sure that these errors are not visible to others.
|
||||
|
||||
* Do not write an error including your secret key to a log file that can be seen by multiple people.
|
||||
* Do not paste an error including your secret key to a public place for debugging.
|
||||
* Do not display an error message including your secret key on a website, even by accident.
|
||||
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `amendmentBlocked` - The transaction cannot be submitted to the network because the `rippled` server is [amendment blocked](../../../../concepts/networks-and-servers/amendments.md#amendment-blocked-servers).
|
||||
* `highFee` - The `fee_mult_max` parameter was specified, but the server's current fee multiplier exceeds the specified one. (Sign-and-Submit mode only)
|
||||
* `internalJson` - An internal error occurred when serializing the transaction to JSON. This could be caused by many aspects of the transaction, including a bad signature or some fields being malformed.
|
||||
* `internalSubmit` - An internal error occurred when submitting the transaction. This could be caused by many aspects of the transaction, including a bad signature or some fields being malformed.
|
||||
* `internalTransaction` - An internal error occurred when processing the transaction. This could be caused by many aspects of the transaction, including a bad signature or some fields being malformed.
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `invalidTransaction` - The transaction is malformed or otherwise invalid.
|
||||
* `noPath` - The transaction did not include paths, and the server was unable to find a path by which this payment can occur. (Sign-and-Submit mode only)
|
||||
* `tooBusy` - The transaction did not include paths, but the server is too busy to do pathfinding right now. Does not occur if you are connected as an admin. (Sign-and-Submit mode only)
|
||||
* `notSupported` - Signing is not supported by this server (Sign-and-Submit mode only.) If you are the server admin, you can still access signing when connected [as an admin](../../admin-api-methods/index.md), or you could [enable public signing](../../../../infrastructure/configuration/enable-public-signing.md).
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,308 @@
|
||||
---
|
||||
html: submit_multisigned.html
|
||||
parent: transaction-methods.html
|
||||
seo:
|
||||
description: Send a multi-signed transaction to the network.
|
||||
labels:
|
||||
- Transaction Sending
|
||||
---
|
||||
# submit_multisigned
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/release/src/ripple/rpc/handlers/SubmitMultiSigned.cpp "Source")
|
||||
|
||||
The `submit_multisigned` command applies a [multi-signed](../../../../concepts/accounts/multi-signing.md) transaction and sends it to the network to be included in future ledgers. (You can also submit multi-signed transactions in binary form using the [`submit` command in submit-only mode](submit.md#submit-only-mode).)
|
||||
|
||||
This command requires the [MultiSign amendment][] to be enabled.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "submit_multisigned_example",
|
||||
"command": "submit_multisigned",
|
||||
"tx_json": {
|
||||
"Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC",
|
||||
"Fee": "30000",
|
||||
"Flags": 262144,
|
||||
"LimitAmount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"value": "100"
|
||||
},
|
||||
"Sequence": 2,
|
||||
"Signers": [{
|
||||
"Signer": {
|
||||
"Account": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
||||
"SigningPubKey": "02B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF",
|
||||
"TxnSignature": "30450221009C195DBBF7967E223D8626CA19CF02073667F2B22E206727BFE848FF42BEAC8A022048C323B0BED19A988BDBEFA974B6DE8AA9DCAE250AA82BBD1221787032A864E5"
|
||||
}
|
||||
}, {
|
||||
"Signer": {
|
||||
"Account": "rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v",
|
||||
"SigningPubKey": "028FFB276505F9AC3F57E8D5242B386A597EF6C40A7999F37F1948636FD484E25B",
|
||||
"TxnSignature": "30440220680BBD745004E9CFB6B13A137F505FB92298AD309071D16C7B982825188FD1AE022004200B1F7E4A6A84BB0E4FC09E1E3BA2B66EBD32F0E6D121A34BA3B04AD99BC1"
|
||||
}
|
||||
}],
|
||||
"SigningPubKey": "",
|
||||
"TransactionType": "TrustSet",
|
||||
"hash": "BD636194C48FD7A100DE4C972336534C8E710FD008C0F3CF7BC5BF34DAF3C3E6"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "submit_multisigned",
|
||||
"params": [
|
||||
{
|
||||
"tx_json": {
|
||||
"Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC",
|
||||
"Fee": "30000",
|
||||
"Flags": 262144,
|
||||
"LimitAmount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"value": "0"
|
||||
},
|
||||
"Sequence": 4,
|
||||
"Signers": [
|
||||
{
|
||||
"Signer": {
|
||||
"Account": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
||||
"SigningPubKey": "02B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF",
|
||||
"TxnSignature": "3045022100CC9C56DF51251CB04BB047E5F3B5EF01A0F4A8A549D7A20A7402BF54BA744064022061EF8EF1BCCBF144F480B32508B1D10FD4271831D5303F920DE41C64671CB5B7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Signer": {
|
||||
"Account": "raKEEVSGnKSD9Zyvxu4z6Pqpm4ABH8FS6n",
|
||||
"SigningPubKey": "03398A4EDAE8EE009A5879113EAA5BA15C7BB0F612A87F4103E793AC919BD1E3C1",
|
||||
"TxnSignature": "3045022100FEE8D8FA2D06CE49E9124567DCA265A21A9F5465F4A9279F075E4CE27E4430DE022042D5305777DA1A7801446780308897699412E4EDF0E1AEFDF3C8A0532BDE4D08"
|
||||
}
|
||||
}
|
||||
],
|
||||
"SigningPubKey": "",
|
||||
"TransactionType": "TrustSet",
|
||||
"hash": "81A477E2A362D171BB16BE17B4120D9F809A327FA00242ABCA867283BEA2F4F8"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: submit_multisigned <tx_json>
|
||||
rippled submit_multisigned '{
|
||||
"Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC",
|
||||
"Fee": "30000",
|
||||
"Flags": 262144,
|
||||
"LimitAmount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"value": "0"
|
||||
},
|
||||
"Sequence": 4,
|
||||
"Signers": [
|
||||
{
|
||||
"Signer": {
|
||||
"Account": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
||||
"SigningPubKey": "02B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF",
|
||||
"TxnSignature": "3045022100CC9C56DF51251CB04BB047E5F3B5EF01A0F4A8A549D7A20A7402BF54BA744064022061EF8EF1BCCBF144F480B32508B1D10FD4271831D5303F920DE41C64671CB5B7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Signer": {
|
||||
"Account": "raKEEVSGnKSD9Zyvxu4z6Pqpm4ABH8FS6n",
|
||||
"SigningPubKey": "03398A4EDAE8EE009A5879113EAA5BA15C7BB0F612A87F4103E793AC919BD1E3C1",
|
||||
"TxnSignature": "3045022100FEE8D8FA2D06CE49E9124567DCA265A21A9F5465F4A9279F075E4CE27E4430DE022042D5305777DA1A7801446780308897699412E4EDF0E1AEFDF3C8A0532BDE4D08"
|
||||
}
|
||||
}
|
||||
],
|
||||
"SigningPubKey": "",
|
||||
"TransactionType": "TrustSet",
|
||||
"hash": "81A477E2A362D171BB16BE17B4120D9F809A327FA00242ABCA867283BEA2F4F8"
|
||||
}'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Required? | Description |
|
||||
|:------------|:--------|:----------|:-----------------------------------------------------|
|
||||
| `tx_json` | Object | Yes | [Transaction in JSON format](../../../protocol/transactions/index.md) with an array of `Signers`. To be successful, the weights of the signatures must be equal or higher than the quorum of the [SignerList](../../../protocol/ledger-data/ledger-entry-types/signerlist.md). |
|
||||
| `fail_hard` | Boolean | No | If `true`, and the transaction fails locally, do not retry or relay the transaction to other servers. The default is `false`. |
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": "submit_multisigned_example",
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"tx_blob": "1200142200040000240000000263D5038D7EA4C680000000000000000000000000005553440000000000B5F762798A53D543A014CAF8B297CFF8F2F937E868400000000000753073008114A3780F5CB5A44D366520FC44055E8ED44D9A2270F3E010732102B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF744730450221009C195DBBF7967E223D8626CA19CF02073667F2B22E206727BFE848FF42BEAC8A022048C323B0BED19A988BDBEFA974B6DE8AA9DCAE250AA82BBD1221787032A864E58114204288D2E47F8EF6C99BCC457966320D12409711E1E0107321028FFB276505F9AC3F57E8D5242B386A597EF6C40A7999F37F1948636FD484E25B744630440220680BBD745004E9CFB6B13A137F505FB92298AD309071D16C7B982825188FD1AE022004200B1F7E4A6A84BB0E4FC09E1E3BA2B66EBD32F0E6D121A34BA3B04AD99BC181147908A7F0EDD48EA896C3580A399F0EE78611C8E3E1F1",
|
||||
"tx_json": {
|
||||
"Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC",
|
||||
"Fee": "30000",
|
||||
"Flags": 262144,
|
||||
"LimitAmount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"value": "100"
|
||||
},
|
||||
"Sequence": 2,
|
||||
"Signers": [
|
||||
{
|
||||
"Signer": {
|
||||
"Account": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
||||
"SigningPubKey": "02B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF",
|
||||
"TxnSignature": "30450221009C195DBBF7967E223D8626CA19CF02073667F2B22E206727BFE848FF42BEAC8A022048C323B0BED19A988BDBEFA974B6DE8AA9DCAE250AA82BBD1221787032A864E5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Signer": {
|
||||
"Account": "rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v",
|
||||
"SigningPubKey": "028FFB276505F9AC3F57E8D5242B386A597EF6C40A7999F37F1948636FD484E25B",
|
||||
"TxnSignature": "30440220680BBD745004E9CFB6B13A137F505FB92298AD309071D16C7B982825188FD1AE022004200B1F7E4A6A84BB0E4FC09E1E3BA2B66EBD32F0E6D121A34BA3B04AD99BC1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"SigningPubKey": "",
|
||||
"TransactionType": "TrustSet",
|
||||
"hash": "BD636194C48FD7A100DE4C972336534C8E710FD008C0F3CF7BC5BF34DAF3C3E6"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"status": "success",
|
||||
"tx_blob": "120014220004000024000000046380000000000000000000000000000000000000005553440000000000B5F762798A53D543A014CAF8B297CFF8F2F937E868400000000000753073008114A3780F5CB5A44D366520FC44055E8ED44D9A2270F3E010732102B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF74473045022100CC9C56DF51251CB04BB047E5F3B5EF01A0F4A8A549D7A20A7402BF54BA744064022061EF8EF1BCCBF144F480B32508B1D10FD4271831D5303F920DE41C64671CB5B78114204288D2E47F8EF6C99BCC457966320D12409711E1E010732103398A4EDAE8EE009A5879113EAA5BA15C7BB0F612A87F4103E793AC919BD1E3C174473045022100FEE8D8FA2D06CE49E9124567DCA265A21A9F5465F4A9279F075E4CE27E4430DE022042D5305777DA1A7801446780308897699412E4EDF0E1AEFDF3C8A0532BDE4D0881143A4C02EA95AD6AC3BED92FA036E0BBFB712C030CE1F1",
|
||||
"tx_json": {
|
||||
"Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC",
|
||||
"Fee": "30000",
|
||||
"Flags": 262144,
|
||||
"LimitAmount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"value": "0"
|
||||
},
|
||||
"Sequence": 4,
|
||||
"Signers": [
|
||||
{
|
||||
"Signer": {
|
||||
"Account": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
||||
"SigningPubKey": "02B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF",
|
||||
"TxnSignature": "3045022100CC9C56DF51251CB04BB047E5F3B5EF01A0F4A8A549D7A20A7402BF54BA744064022061EF8EF1BCCBF144F480B32508B1D10FD4271831D5303F920DE41C64671CB5B7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Signer": {
|
||||
"Account": "raKEEVSGnKSD9Zyvxu4z6Pqpm4ABH8FS6n",
|
||||
"SigningPubKey": "03398A4EDAE8EE009A5879113EAA5BA15C7BB0F612A87F4103E793AC919BD1E3C1",
|
||||
"TxnSignature": "3045022100FEE8D8FA2D06CE49E9124567DCA265A21A9F5465F4A9279F075E4CE27E4430DE022042D5305777DA1A7801446780308897699412E4EDF0E1AEFDF3C8A0532BDE4D08"
|
||||
}
|
||||
}
|
||||
],
|
||||
"SigningPubKey": "",
|
||||
"TransactionType": "TrustSet",
|
||||
"hash": "81A477E2A362D171BB16BE17B4120D9F809A327FA00242ABCA867283BEA2F4F8"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```
|
||||
Loading: "/etc/rippled.cfg"
|
||||
Connecting to 127.0.0.1:5005
|
||||
|
||||
{
|
||||
"result": {
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"status": "success",
|
||||
"tx_blob": "120014220004000024000000046380000000000000000000000000000000000000005553440000000000B5F762798A53D543A014CAF8B297CFF8F2F937E868400000000000753073008114A3780F5CB5A44D366520FC44055E8ED44D9A2270F3E010732102B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF74473045022100CC9C56DF51251CB04BB047E5F3B5EF01A0F4A8A549D7A20A7402BF54BA744064022061EF8EF1BCCBF144F480B32508B1D10FD4271831D5303F920DE41C64671CB5B78114204288D2E47F8EF6C99BCC457966320D12409711E1E010732103398A4EDAE8EE009A5879113EAA5BA15C7BB0F612A87F4103E793AC919BD1E3C174473045022100FEE8D8FA2D06CE49E9124567DCA265A21A9F5465F4A9279F075E4CE27E4430DE022042D5305777DA1A7801446780308897699412E4EDF0E1AEFDF3C8A0532BDE4D0881143A4C02EA95AD6AC3BED92FA036E0BBFB712C030CE1F1",
|
||||
"tx_json": {
|
||||
"Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC",
|
||||
"Fee": "30000",
|
||||
"Flags": 262144,
|
||||
"LimitAmount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"value": "0"
|
||||
},
|
||||
"Sequence": 4,
|
||||
"Signers": [
|
||||
{
|
||||
"Signer": {
|
||||
"Account": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
||||
"SigningPubKey": "02B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF",
|
||||
"TxnSignature": "3045022100CC9C56DF51251CB04BB047E5F3B5EF01A0F4A8A549D7A20A7402BF54BA744064022061EF8EF1BCCBF144F480B32508B1D10FD4271831D5303F920DE41C64671CB5B7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Signer": {
|
||||
"Account": "raKEEVSGnKSD9Zyvxu4z6Pqpm4ABH8FS6n",
|
||||
"SigningPubKey": "03398A4EDAE8EE009A5879113EAA5BA15C7BB0F612A87F4103E793AC919BD1E3C1",
|
||||
"TxnSignature": "3045022100FEE8D8FA2D06CE49E9124567DCA265A21A9F5465F4A9279F075E4CE27E4430DE022042D5305777DA1A7801446780308897699412E4EDF0E1AEFDF3C8A0532BDE4D08"
|
||||
}
|
||||
}
|
||||
],
|
||||
"SigningPubKey": "",
|
||||
"TransactionType": "TrustSet",
|
||||
"hash": "81A477E2A362D171BB16BE17B4120D9F809A327FA00242ABCA867283BEA2F4F8"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:------------------------|:--------|:-----------------------------------------|
|
||||
| `engine_result` | String | Code indicating the preliminary result of the transaction, for example `tesSUCCESS` |
|
||||
| `engine_result_code` | Integer | Numeric code indicating the preliminary result of the transaction, directly correlated to `engine_result` |
|
||||
| `engine_result_message` | String | Human-readable explanation of the preliminary transaction result |
|
||||
| `tx_blob` | String | The complete [transaction](../../../protocol/transactions/index.md) in hex string format |
|
||||
| `tx_json` | Object | The complete [transaction](../../../protocol/transactions/index.md) in JSON format |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `srcActMalformed` - The `Account` field from the `tx_json` was invalid or missing.
|
||||
* `internal` - An internal error occurred. This includes the case where a signature is not valid for the transaction JSON provided.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,468 @@
|
||||
---
|
||||
html: transaction_entry.html
|
||||
parent: transaction-methods.html
|
||||
seo:
|
||||
description: Retrieve info about a transaction from a particular ledger version.
|
||||
labels:
|
||||
- Transaction Sending
|
||||
---
|
||||
# transaction_entry
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/TransactionEntry.cpp "Source")
|
||||
|
||||
The `transaction_entry` method retrieves information on a single transaction from a specific ledger version. (The [tx method][], by contrast, searches all ledgers for the specified transaction. We recommend using that method instead.)
|
||||
|
||||
## Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 4,
|
||||
"command": "transaction_entry",
|
||||
"tx_hash": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
|
||||
"ledger_index": 56865245
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "transaction_entry",
|
||||
"params": [
|
||||
{
|
||||
"tx_hash": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
|
||||
"ledger_index": 56865245
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: transaction_entry transaction_hash ledger_index|ledger_hash
|
||||
rippled transaction_entry C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9 56865245
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#transaction_entry)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------------|:-------------------------------|
|
||||
| `ledger_hash` | String | _(Optional)_ A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
|
||||
| `ledger_index` | String or Unsigned Integer | _(Optional)_ The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
|
||||
| `tx_hash` | String | Unique hash of the transaction you are looking up |
|
||||
|
||||
**Note:** This method does not support retrieving information from the current in-progress ledger. You must specify a ledger version in either `ledger_index` or `ledger_hash`.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 4,
|
||||
"result": {
|
||||
"ledger_hash": "793E56131D8D4ABFB27FA383BFC44F2978B046E023FF46C588D7E0C874C2472A",
|
||||
"ledger_index": 56865245,
|
||||
"metadata": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"ExchangeRate": "4F04C66806CF7400",
|
||||
"Flags": 0,
|
||||
"RootIndex": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"TakerGetsCurrency": "0000000000000000000000000000000000000000",
|
||||
"TakerGetsIssuer": "0000000000000000000000000000000000000000",
|
||||
"TakerPaysCurrency": "000000000000000000000000434E590000000000",
|
||||
"TakerPaysIssuer": "CED6E99370D5C00EF4EBF72567DA99F5661BFB3A"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"Balance": "10404767991",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 3,
|
||||
"Sequence": 5037711
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "1DECD9844E95FFBA273F1B94BA0BF2564DDF69F2804497A6D7837B52050174A2",
|
||||
"PreviousFields": {
|
||||
"Balance": "10404768003",
|
||||
"Sequence": 5037710
|
||||
},
|
||||
"PreviousTxnID": "4DC47B246B5EB9CCE92ABA8C482479E3BF1F946CABBEF74CA4DE36521D5F9008",
|
||||
"PreviousTxnLgrSeq": 56865244
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"BookDirectory": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"BookNode": "0000000000000000",
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000000",
|
||||
"PreviousTxnID": "8F5FF57B404827F12BDA7561876A13C3E3B3095CBF75334DBFB5F227391A660C",
|
||||
"PreviousTxnLgrSeq": 56865244,
|
||||
"Sequence": 5037708,
|
||||
"TakerGets": "15000000000",
|
||||
"TakerPays": {
|
||||
"currency": "CNY",
|
||||
"issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value": "20160.75"
|
||||
}
|
||||
},
|
||||
"LedgerEntryType": "Offer",
|
||||
"LedgerIndex": "26AAE6CA8D29E28A47C92ADF22D5D96A0216F0551E16936856DDC8CB1AAEE93B"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"IndexNext": "0000000000000000",
|
||||
"IndexPrevious": "0000000000000000",
|
||||
"Owner": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"RootIndex": "47FAF5D102D8CE655574F440CDB97AC67C5A11068BB3759E87C2B9745EE94548"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "47FAF5D102D8CE655574F440CDB97AC67C5A11068BB3759E87C2B9745EE94548"
|
||||
}
|
||||
},
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "Offer",
|
||||
"LedgerIndex": "8BAEE3C7DE04A568E96007420FA11ABD0BC9AE44D35932BB5640E9C3FB46BC9B",
|
||||
"NewFields": {
|
||||
"Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"BookDirectory": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"Sequence": 5037710,
|
||||
"TakerGets": "15000000000",
|
||||
"TakerPays": {
|
||||
"currency": "CNY",
|
||||
"issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value": "20160.75"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"tx_json": {
|
||||
"Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"Fee": "12",
|
||||
"Flags": 0,
|
||||
"LastLedgerSequence": 56865248,
|
||||
"OfferSequence": 5037708,
|
||||
"Sequence": 5037710,
|
||||
"SigningPubKey": "03B51A3EDF70E4098DA7FB053A01C5A6A0A163A30ED1445F14F87C7C3295FCB3BE",
|
||||
"TakerGets": "15000000000",
|
||||
"TakerPays": {
|
||||
"currency": "CNY",
|
||||
"issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value": "20160.75"
|
||||
},
|
||||
"TransactionType": "OfferCreate",
|
||||
"TxnSignature": "3045022100A5023A0E64923616FCDB6D664F569644C7C9D1895772F986CD6B981B515B02A00220530C973E9A8395BC6FE2484948D2751F6B030FC7FB8575D1BFB406368AD554D9",
|
||||
"hash": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9"
|
||||
},
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"ledger_hash": "793E56131D8D4ABFB27FA383BFC44F2978B046E023FF46C588D7E0C874C2472A",
|
||||
"ledger_index": 56865245,
|
||||
"metadata": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"ExchangeRate": "4F04C66806CF7400",
|
||||
"Flags": 0,
|
||||
"RootIndex": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"TakerGetsCurrency": "0000000000000000000000000000000000000000",
|
||||
"TakerGetsIssuer": "0000000000000000000000000000000000000000",
|
||||
"TakerPaysCurrency": "000000000000000000000000434E590000000000",
|
||||
"TakerPaysIssuer": "CED6E99370D5C00EF4EBF72567DA99F5661BFB3A"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"Balance": "10404767991",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 3,
|
||||
"Sequence": 5037711
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "1DECD9844E95FFBA273F1B94BA0BF2564DDF69F2804497A6D7837B52050174A2",
|
||||
"PreviousFields": {
|
||||
"Balance": "10404768003",
|
||||
"Sequence": 5037710
|
||||
},
|
||||
"PreviousTxnID": "4DC47B246B5EB9CCE92ABA8C482479E3BF1F946CABBEF74CA4DE36521D5F9008",
|
||||
"PreviousTxnLgrSeq": 56865244
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"BookDirectory": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"BookNode": "0000000000000000",
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000000",
|
||||
"PreviousTxnID": "8F5FF57B404827F12BDA7561876A13C3E3B3095CBF75334DBFB5F227391A660C",
|
||||
"PreviousTxnLgrSeq": 56865244,
|
||||
"Sequence": 5037708,
|
||||
"TakerGets": "15000000000",
|
||||
"TakerPays": {
|
||||
"currency": "CNY",
|
||||
"issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value": "20160.75"
|
||||
}
|
||||
},
|
||||
"LedgerEntryType": "Offer",
|
||||
"LedgerIndex": "26AAE6CA8D29E28A47C92ADF22D5D96A0216F0551E16936856DDC8CB1AAEE93B"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"IndexNext": "0000000000000000",
|
||||
"IndexPrevious": "0000000000000000",
|
||||
"Owner": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"RootIndex": "47FAF5D102D8CE655574F440CDB97AC67C5A11068BB3759E87C2B9745EE94548"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "47FAF5D102D8CE655574F440CDB97AC67C5A11068BB3759E87C2B9745EE94548"
|
||||
}
|
||||
},
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "Offer",
|
||||
"LedgerIndex": "8BAEE3C7DE04A568E96007420FA11ABD0BC9AE44D35932BB5640E9C3FB46BC9B",
|
||||
"NewFields": {
|
||||
"Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"BookDirectory": "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"Sequence": 5037710,
|
||||
"TakerGets": "15000000000",
|
||||
"TakerPays": {
|
||||
"currency": "CNY",
|
||||
"issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value": "20160.75"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"status": "success",
|
||||
"tx_json": {
|
||||
"Account": "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"Fee": "12",
|
||||
"Flags": 0,
|
||||
"LastLedgerSequence": 56865248,
|
||||
"OfferSequence": 5037708,
|
||||
"Sequence": 5037710,
|
||||
"SigningPubKey": "03B51A3EDF70E4098DA7FB053A01C5A6A0A163A30ED1445F14F87C7C3295FCB3BE",
|
||||
"TakerGets": "15000000000",
|
||||
"TakerPays": {
|
||||
"currency": "CNY",
|
||||
"issuer": "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value": "20160.75"
|
||||
},
|
||||
"TransactionType": "OfferCreate",
|
||||
"TxnSignature": "3045022100A5023A0E64923616FCDB6D664F569644C7C9D1895772F986CD6B981B515B02A00220530C973E9A8395BC6FE2484948D2751F6B030FC7FB8575D1BFB406368AD554D9",
|
||||
"hash": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9"
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"ledger_hash" : "793E56131D8D4ABFB27FA383BFC44F2978B046E023FF46C588D7E0C874C2472A",
|
||||
"ledger_index" : 56865245,
|
||||
"metadata" : {
|
||||
"AffectedNodes" : [
|
||||
{
|
||||
"ModifiedNode" : {
|
||||
"FinalFields" : {
|
||||
"ExchangeRate" : "4F04C66806CF7400",
|
||||
"Flags" : 0,
|
||||
"RootIndex" : "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"TakerGetsCurrency" : "0000000000000000000000000000000000000000",
|
||||
"TakerGetsIssuer" : "0000000000000000000000000000000000000000",
|
||||
"TakerPaysCurrency" : "000000000000000000000000434E590000000000",
|
||||
"TakerPaysIssuer" : "CED6E99370D5C00EF4EBF72567DA99F5661BFB3A"
|
||||
},
|
||||
"LedgerEntryType" : "DirectoryNode",
|
||||
"LedgerIndex" : "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode" : {
|
||||
"FinalFields" : {
|
||||
"Account" : "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"Balance" : "10404767991",
|
||||
"Flags" : 0,
|
||||
"OwnerCount" : 3,
|
||||
"Sequence" : 5037711
|
||||
},
|
||||
"LedgerEntryType" : "AccountRoot",
|
||||
"LedgerIndex" : "1DECD9844E95FFBA273F1B94BA0BF2564DDF69F2804497A6D7837B52050174A2",
|
||||
"PreviousFields" : {
|
||||
"Balance" : "10404768003",
|
||||
"Sequence" : 5037710
|
||||
},
|
||||
"PreviousTxnID" : "4DC47B246B5EB9CCE92ABA8C482479E3BF1F946CABBEF74CA4DE36521D5F9008",
|
||||
"PreviousTxnLgrSeq" : 56865244
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode" : {
|
||||
"FinalFields" : {
|
||||
"Account" : "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"BookDirectory" : "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"BookNode" : "0000000000000000",
|
||||
"Flags" : 0,
|
||||
"OwnerNode" : "0000000000000000",
|
||||
"PreviousTxnID" : "8F5FF57B404827F12BDA7561876A13C3E3B3095CBF75334DBFB5F227391A660C",
|
||||
"PreviousTxnLgrSeq" : 56865244,
|
||||
"Sequence" : 5037708,
|
||||
"TakerGets" : "15000000000",
|
||||
"TakerPays" : {
|
||||
"currency" : "CNY",
|
||||
"issuer" : "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value" : "20160.75"
|
||||
}
|
||||
},
|
||||
"LedgerEntryType" : "Offer",
|
||||
"LedgerIndex" : "26AAE6CA8D29E28A47C92ADF22D5D96A0216F0551E16936856DDC8CB1AAEE93B"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode" : {
|
||||
"FinalFields" : {
|
||||
"Flags" : 0,
|
||||
"IndexNext" : "0000000000000000",
|
||||
"IndexPrevious" : "0000000000000000",
|
||||
"Owner" : "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"RootIndex" : "47FAF5D102D8CE655574F440CDB97AC67C5A11068BB3759E87C2B9745EE94548"
|
||||
},
|
||||
"LedgerEntryType" : "DirectoryNode",
|
||||
"LedgerIndex" : "47FAF5D102D8CE655574F440CDB97AC67C5A11068BB3759E87C2B9745EE94548"
|
||||
}
|
||||
},
|
||||
{
|
||||
"CreatedNode" : {
|
||||
"LedgerEntryType" : "Offer",
|
||||
"LedgerIndex" : "8BAEE3C7DE04A568E96007420FA11ABD0BC9AE44D35932BB5640E9C3FB46BC9B",
|
||||
"NewFields" : {
|
||||
"Account" : "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"BookDirectory" : "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"Sequence" : 5037710,
|
||||
"TakerGets" : "15000000000",
|
||||
"TakerPays" : {
|
||||
"currency" : "CNY",
|
||||
"issuer" : "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value" : "20160.75"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex" : 0,
|
||||
"TransactionResult" : "tesSUCCESS"
|
||||
},
|
||||
"status" : "success",
|
||||
"tx_json" : {
|
||||
"Account" : "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"Fee" : "12",
|
||||
"Flags" : 0,
|
||||
"LastLedgerSequence" : 56865248,
|
||||
"OfferSequence" : 5037708,
|
||||
"Sequence" : 5037710,
|
||||
"SigningPubKey" : "03B51A3EDF70E4098DA7FB053A01C5A6A0A163A30ED1445F14F87C7C3295FCB3BE",
|
||||
"TakerGets" : "15000000000",
|
||||
"TakerPays" : {
|
||||
"currency" : "CNY",
|
||||
"issuer" : "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value" : "20160.75"
|
||||
},
|
||||
"TransactionType" : "OfferCreate",
|
||||
"TxnSignature" : "3045022100A5023A0E64923616FCDB6D664F569644C7C9D1895772F986CD6B981B515B02A00220530C973E9A8395BC6FE2484948D2751F6B030FC7FB8575D1BFB406368AD554D9",
|
||||
"hash" : "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9"
|
||||
},
|
||||
"validated" : true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:--------------------------|:--------------------------------|
|
||||
| `ledger_index` | Number - [Ledger Index][] | The ledger index of the ledger version the transaction was found in; this is the same as the one from the request. |
|
||||
| `ledger_hash` | String - [Hash][] | _(May be omitted)_ The identifying hash of the ledger version the transaction was found in; this is the same as the one from the request. |
|
||||
| `metadata` | Object | The [transaction metadata](../../../protocol/transactions/metadata.md), which shows the exact results of the transaction in detail. |
|
||||
| `tx_json` | Object | JSON representation of the [Transaction object](../../../protocol/transactions/index.md) |
|
||||
|
||||
There are a couple possible reasons the server may fail to find the transaction:
|
||||
|
||||
* The transaction does not exist
|
||||
* The transaction exists, but not in the specified ledger version
|
||||
* The server does not have the specified ledger version available. Another server that has the correct version on hand may have a different response.
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `fieldNotFoundTransaction` - The `tx_hash` field was omitted from the request
|
||||
* `notYetImplemented` - A ledger version was not specified in the request.
|
||||
* `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.
|
||||
* `transactionNotFound` - The transaction specified in the request could not be found in the specified ledger. (It might be in a different ledger version, or it might not be available at all.)
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,331 @@
|
||||
---
|
||||
html: tx.html
|
||||
parent: transaction-methods.html
|
||||
seo:
|
||||
description: Retrieve info about a transaction from all the ledgers on hand.
|
||||
labels:
|
||||
- Transaction Sending
|
||||
- Payments
|
||||
---
|
||||
# tx
|
||||
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/Tx.cpp "Source")
|
||||
|
||||
The `tx` method retrieves information on a single [transaction](../../../protocol/transactions/index.md), by its [identifying hash][] or its [CTID](../../api-conventions/ctid.md).
|
||||
|
||||
## Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket (Hash)" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "tx",
|
||||
"transaction": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
|
||||
"binary": false
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="WebSocket (CTID)" %}
|
||||
```json
|
||||
{
|
||||
"id": "CTID example",
|
||||
"command": "tx",
|
||||
"ctid": "C005523E00000000",
|
||||
"binary": false
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC (Hash)" %}
|
||||
```json
|
||||
{
|
||||
"method": "tx",
|
||||
"params": [
|
||||
{
|
||||
"transaction": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC (CTID)" %}
|
||||
```json
|
||||
{
|
||||
"method": "tx",
|
||||
"params": [
|
||||
{
|
||||
"ctid": "C005523E00000000",
|
||||
"binary": false
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: tx transaction [binary]
|
||||
rippled tx C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9 false
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#tx)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| Field | Type | Required? | Description |
|
||||
|:--------------|:--------|:----------|----------------------------------------|
|
||||
| `ctid` | String | No | The [compact transaction identifier](../../api-conventions/ctid.md) of the transaction to look up. Must use uppercase hexadecimal only. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.12.0" %}New in: rippled 1.12.0{% /badge %} _(Not supported in Clio v2.0 and earlier)_ |
|
||||
| `transaction` | String | No | The 256-bit hash of the transaction to look up, as hexadecimal. |
|
||||
| `binary` | Boolean | No | If `true`, return transaction data and metadata as binary [serialized](../../../protocol/binary-format.md) to hexadecimal strings. If `false`, return transaction data and metadata as JSON. The default is `false`. |
|
||||
| `min_ledger` | Number | No | Use this with `max_ledger` to specify a range of up to 1000 [ledger indexes][ledger index], starting with this ledger (inclusive). If the server [cannot find the transaction](#not-found-response), it confirms whether it was able to search all the ledgers in this range. |
|
||||
| `max_ledger` | Number | No | Use this with `min_ledger` to specify a range of up to 1000 [ledger indexes][ledger index], ending with this ledger (inclusive). If the server [cannot find the transaction](#not-found-response), it confirms whether it was able to search all the ledgers in the requested range. |
|
||||
|
||||
You must provide _either_ `ctid` or `transaction`, but not both.
|
||||
|
||||
**Caution:** This command may successfully find the transaction even if it is included in a ledger _outside_ the range of `min_ledger` to `max_ledger`.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket (Hash)" %}
|
||||
{% code-snippet file="/_api-examples/tx/ws-response-hash.json" language="json" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="WebSocket (CTID)" %}
|
||||
{% code-snippet file="/_api-examples/tx/ws-response-ctid.json" language="json" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC (Hash)" %}
|
||||
{% code-snippet file="/_api-examples/tx/jsonrpc-response-hash.json" language="json" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC (CTID)" %}
|
||||
{% code-snippet file="/_api-examples/tx/jsonrpc-response-ctid.json" language="json" /%}
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"Account" : "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"Fee" : "12",
|
||||
"Flags" : 0,
|
||||
"LastLedgerSequence" : 56865248,
|
||||
"OfferSequence" : 5037708,
|
||||
"Sequence" : 5037710,
|
||||
"SigningPubKey" : "03B51A3EDF70E4098DA7FB053A01C5A6A0A163A30ED1445F14F87C7C3295FCB3BE",
|
||||
"TakerGets" : "15000000000",
|
||||
"TakerPays" : {
|
||||
"currency" : "CNY",
|
||||
"issuer" : "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value" : "20160.75"
|
||||
},
|
||||
"TransactionType" : "OfferCreate",
|
||||
"TxnSignature" : "3045022100A5023A0E64923616FCDB6D664F569644C7C9D1895772F986CD6B981B515B02A00220530C973E9A8395BC6FE2484948D2751F6B030FC7FB8575D1BFB406368AD554D9",
|
||||
"date" : 648248020,
|
||||
"hash" : "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
|
||||
"inLedger" : 56865245,
|
||||
"ledger_index" : 56865245,
|
||||
"meta" : {
|
||||
"AffectedNodes" : [
|
||||
{
|
||||
"ModifiedNode" : {
|
||||
"FinalFields" : {
|
||||
"ExchangeRate" : "4F04C66806CF7400",
|
||||
"Flags" : 0,
|
||||
"RootIndex" : "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"TakerGetsCurrency" : "0000000000000000000000000000000000000000",
|
||||
"TakerGetsIssuer" : "0000000000000000000000000000000000000000",
|
||||
"TakerPaysCurrency" : "000000000000000000000000434E590000000000",
|
||||
"TakerPaysIssuer" : "CED6E99370D5C00EF4EBF72567DA99F5661BFB3A"
|
||||
},
|
||||
"LedgerEntryType" : "DirectoryNode",
|
||||
"LedgerIndex" : "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode" : {
|
||||
"FinalFields" : {
|
||||
"Account" : "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"Balance" : "10404767991",
|
||||
"Flags" : 0,
|
||||
"OwnerCount" : 3,
|
||||
"Sequence" : 5037711
|
||||
},
|
||||
"LedgerEntryType" : "AccountRoot",
|
||||
"LedgerIndex" : "1DECD9844E95FFBA273F1B94BA0BF2564DDF69F2804497A6D7837B52050174A2",
|
||||
"PreviousFields" : {
|
||||
"Balance" : "10404768003",
|
||||
"Sequence" : 5037710
|
||||
},
|
||||
"PreviousTxnID" : "4DC47B246B5EB9CCE92ABA8C482479E3BF1F946CABBEF74CA4DE36521D5F9008",
|
||||
"PreviousTxnLgrSeq" : 56865244
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode" : {
|
||||
"FinalFields" : {
|
||||
"Account" : "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"BookDirectory" : "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"BookNode" : "0000000000000000",
|
||||
"Flags" : 0,
|
||||
"OwnerNode" : "0000000000000000",
|
||||
"PreviousTxnID" : "8F5FF57B404827F12BDA7561876A13C3E3B3095CBF75334DBFB5F227391A660C",
|
||||
"PreviousTxnLgrSeq" : 56865244,
|
||||
"Sequence" : 5037708,
|
||||
"TakerGets" : "15000000000",
|
||||
"TakerPays" : {
|
||||
"currency" : "CNY",
|
||||
"issuer" : "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value" : "20160.75"
|
||||
}
|
||||
},
|
||||
"LedgerEntryType" : "Offer",
|
||||
"LedgerIndex" : "26AAE6CA8D29E28A47C92ADF22D5D96A0216F0551E16936856DDC8CB1AAEE93B"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode" : {
|
||||
"FinalFields" : {
|
||||
"Flags" : 0,
|
||||
"IndexNext" : "0000000000000000",
|
||||
"IndexPrevious" : "0000000000000000",
|
||||
"Owner" : "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"RootIndex" : "47FAF5D102D8CE655574F440CDB97AC67C5A11068BB3759E87C2B9745EE94548"
|
||||
},
|
||||
"LedgerEntryType" : "DirectoryNode",
|
||||
"LedgerIndex" : "47FAF5D102D8CE655574F440CDB97AC67C5A11068BB3759E87C2B9745EE94548"
|
||||
}
|
||||
},
|
||||
{
|
||||
"CreatedNode" : {
|
||||
"LedgerEntryType" : "Offer",
|
||||
"LedgerIndex" : "8BAEE3C7DE04A568E96007420FA11ABD0BC9AE44D35932BB5640E9C3FB46BC9B",
|
||||
"NewFields" : {
|
||||
"Account" : "rhhh49pFH96roGyuC4E5P4CHaNjS1k8gzM",
|
||||
"BookDirectory" : "02BAAC1E67C1CE0E96F0FA2E8061020536CEDD043FEB0FF54F04C66806CF7400",
|
||||
"Sequence" : 5037710,
|
||||
"TakerGets" : "15000000000",
|
||||
"TakerPays" : {
|
||||
"currency" : "CNY",
|
||||
"issuer" : "rKiCet8SdvWxPXnAgYarFUXMh1zCPz432Y",
|
||||
"value" : "20160.75"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex" : 0,
|
||||
"TransactionResult" : "tesSUCCESS"
|
||||
},
|
||||
"status" : "success",
|
||||
"validated" : true
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the fields of the [Transaction object](../../../protocol/transactions/index.md) as well as the following additional fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------------|:---------------------------------|:-------------------------|
|
||||
| `ctid` | String | The transaction's [compact transaction identifier](../../api-conventions/ctid.md). {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.12.0" %}New in: rippled 1.12.0{% /badge %} _(Not supported in Clio v2.0 and earlier.)_ |
|
||||
| `date` | Number | The [close time](../../../../concepts/ledgers/ledger-close-times.md) of the ledger in which the transaction was applied, in [seconds since the Ripple Epoch][]. |
|
||||
| `hash` | String | The unique [identifying hash][] of the transaction |
|
||||
| `inLedger` | Number | _(Deprecated)_ Alias for `ledger_index`. |
|
||||
| `ledger_index` | Number | The [ledger index][] of the ledger that includes this transaction. |
|
||||
| `meta` | Object (JSON) or String (binary) | [Transaction metadata](../../../protocol/transactions/metadata.md), which describes the results of the transaction. |
|
||||
| `validated` | Boolean | If `true`, this data comes from a validated ledger version; if omitted or set to `false`, this data is not final. |
|
||||
| (Various) | (Various) | Other fields from the [Transaction object](../../../protocol/transactions/index.md) |
|
||||
|
||||
|
||||
### Not Found Response
|
||||
|
||||
If the server does not find the transaction, it returns a `txnNotFound` error, which could mean two things:
|
||||
|
||||
- The transaction has not been included in any ledger version, and has not been executed.
|
||||
- The transaction was included in a ledger version that the server does not have available.
|
||||
|
||||
This means that a `txnNotFound` on its own is not enough to know the [final outcome of a transaction](../../../../concepts/transactions/finality-of-results/index.md).
|
||||
|
||||
To further narrow down the possibilities, you can provide a range of ledgers to search using the `min_ledger` and `max_ledger` fields in the request. If you provide **both** of those fields, the `txnNotFound` response includes the following field:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------------|:----------|:-----------------------------------------|
|
||||
| `searched_all` | Boolean | _(Omitted unless the request provided `min_ledger` and `max_ledger`)_ If `true`, the server was able to search all of the specified ledger versions, and the transaction was in none of them. If `false`, the server did not have all of the specified ledger versions available, so it is not sure if one of them might contain the transaction. |
|
||||
|
||||
An example of a `txnNotFound` response that fully searched a requested range of ledgers:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"error": "txnNotFound",
|
||||
"error_code": 29,
|
||||
"error_message": "Transaction not found.",
|
||||
"id": 1,
|
||||
"request": {
|
||||
"binary": false,
|
||||
"command": "tx",
|
||||
"id": 1,
|
||||
"max_ledger": 54368673,
|
||||
"min_ledger": 54368573,
|
||||
"transaction": "E08D6E9754025BA2534A78707605E0601F03ACE063687A0CA1BDDACFCD1698C7"
|
||||
},
|
||||
"searched_all": true,
|
||||
"status": "error",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"error": "txnNotFound",
|
||||
"error_code": 29,
|
||||
"error_message": "Transaction not found.",
|
||||
"request": {
|
||||
"binary": false,
|
||||
"command": "tx",
|
||||
"max_ledger": 54368673,
|
||||
"min_ledger": 54368573,
|
||||
"transaction": "E08D6E9754025BA2534A78707605E0601F03ACE063687A0CA1BDDACFCD1698C7"
|
||||
},
|
||||
"searched_all": true,
|
||||
"status": "error"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
* `txnNotFound` - Either the transaction does not exist, or it was part of an ledger version that `rippled` does not have available.
|
||||
* `excessiveLgrRange` - The `min_ledger` and `max_ledger` fields of the request are more than 1000 apart.
|
||||
* `invalidLgrRange` - The specified `min_ledger` is larger than the `max_ledger`, or one of those parameters is not a valid ledger index.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
---
|
||||
html: utility-methods.html
|
||||
parent: public-api-methods.html
|
||||
metadata:
|
||||
indexPage: true
|
||||
---
|
||||
# Utility Methods
|
||||
|
||||
Use these methods to perform convenient tasks, such as ping and random number generation.
|
||||
|
||||
|
||||
{% child-pages /%}
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
html: json.html
|
||||
parent: utility-methods.html
|
||||
seo:
|
||||
description: Pass JSON through the commandline.
|
||||
labels:
|
||||
- Core Server
|
||||
---
|
||||
# json
|
||||
|
||||
The `json` method is a proxy to running other commands, and accepts the parameters for the command as a JSON value. It is *exclusive to the Commandline client*, and intended for cases where the commandline syntax for specifying parameters is inadequate or undesirable.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
# Syntax: json method json_stanza
|
||||
rippled -q json ledger_closed '{}'
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"ledger_hash" : "8047C3ECF1FA66326C1E57694F6814A1C32867C04D3D68A851367EE2F89BBEF3",
|
||||
"ledger_index" : 390308,
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with whichever fields are appropriate to the type of command made.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,89 @@
|
||||
---
|
||||
html: ping.html
|
||||
parent: utility-methods.html
|
||||
seo:
|
||||
description: Confirm connectivity with the server.
|
||||
labels:
|
||||
- Core Server
|
||||
---
|
||||
# ping
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/Ping.cpp "Source")
|
||||
|
||||
The `ping` command returns an acknowledgement, so that clients can test the connection status and latency.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "ping"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "ping",
|
||||
"params": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: ping
|
||||
rippled ping
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
[Try it! >](/resources/dev-tools/websocket-api-tool#ping)
|
||||
|
||||
The request includes no parameters.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"result": {},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing no fields. The client can measure the round-trip time from request to response as latency.
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
@@ -0,0 +1,107 @@
|
||||
---
|
||||
html: random.html
|
||||
parent: utility-methods.html
|
||||
seo:
|
||||
description: Generate a random number.
|
||||
labels:
|
||||
- Core Server
|
||||
---
|
||||
# random
|
||||
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/ripple/rpc/handlers/Random.cpp "Source")
|
||||
|
||||
The `random` command provides a random number to be used as a source of entropy for random number generation by clients.
|
||||
|
||||
## Request Format
|
||||
An example of the request format:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"command": "random"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
{
|
||||
"method": "random",
|
||||
"params": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```sh
|
||||
#Syntax: random
|
||||
rippled random
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The request includes no parameters.
|
||||
|
||||
## Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="WebSocket" %}
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"result": {
|
||||
"random": "8ED765AEBBD6767603C2C9375B2679AEC76E6A8133EF59F04F9FC1AAA70E41AF"
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="JSON-RPC" %}
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"random": "4E57146AA47BC6E88FDFE8BAA235B900126C916B6CC521550996F590487B837A",
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Commandline" %}
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"random" : "DB7C23C7F224CD410912E68A997BE0FD0FA7175A4C74B829BE5A80ED0DBAA0C5",
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following field:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------|:-------|:--------------------------|
|
||||
| `random` | String | Random 256-bit hex value. |
|
||||
|
||||
## Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `internal` - Some internal error occurred, possibly relating to the random number generator.
|
||||
|
||||
{% raw-partial file="/_snippets/common-links.md" /%}
|
||||
Reference in New Issue
Block a user