For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

XRP — Methods, submit, transaction, tx, amm, book (2/3)

API reference for XRP. All methods ->

Part 2 of 3: 1 · 2 · 3

transaction_entry

Retrieves info on the transaction from a particular ledger version.

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.)

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON-RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • ledger_hash (string; optional): The unique hash of 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; required): Unique hash of the transaction you are looking up.

Returns (API v2)

  • close_time_iso (string): The ledger close time represented in ISO 8601 time format.
  • hash (string): The unique hash identifier of the transaction.
  • 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; optional): The identifying hash of the ledger version the transaction was found in; this is the same as the one from the request.
  • meta (object): The transaction metadata, which shows the exact results of the transaction in detail.
  • tx_json (object): JSON representation of the Transaction object.

Returns (API v1)

  • 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; optional): 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 which shows the exact results of the transaction in detail.
  • tx_json (object): JSON representation of the Transaction object.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "transaction_entry",
"params": [
{
"tx_hash": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
"ledger_index": 56865245
}
]
}'

tx

Retrieves info on the transaction from all the ledgers at hand.

The tx method retrieves information on a single transaction, by its identifying hash or its CTID.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON-RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • ctid (string; optional): The compact transaction identifier of the transaction to look up. Must use uppercase hexadecimal only. (Not supported in Clio v2.0 and earlier).
    • transaction (string; optional): The 256-bit hash of the transaction to look up, as hexadecimal.
    • binary (boolean; optional): If true, return transaction data and metadata as binary serialized to hexadecimal strings. If false, return transaction data and metadata as JSON. The default is false.
    • min_ledger (number; optional): Use this with max_ledger to specify a range of up to 1000 ledger indexes, starting with this ledger (inclusive). If the server cannot find the transaction, it confirms whether it was able to search all the ledgers in this range.
    • max_ledger (number; optional): Use this with min_ledger to specify a range of up to 1000 ledger indexes, ending with this ledger (inclusive). If the server cannot find the transaction, it confirms whether it was able to search all the ledgers in the requested range.

Returns (API v2)

The response follows the standard format, with a successful result containing the fields of the Transaction object as well as the following additional fields:

  • ctid (string): The transaction's compact transaction identifier. (Not supported in Clio v2.0 and earlier.)
  • date (number): The close time 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 mode): Transaction metadata, which describes the results of the transaction.
  • meta_blob (string — binary mode): Transaction metadata, which describes the results of the transaction, represented as a hex string.
  • tx_blob (string — binary mode): The transaction data represented as a hex string.
  • tx_json (object — JSON mode): The transaction data represented in JSON.
  • validated (boolean): If true, this data comes from a validated ledger version; if omitted or set to false, this data is not final.

Returns (API v1)

The response follows the standard format, with a successful result containing the fields of the Transaction object as well as the following additional fields:

  • ctid (string): The transaction's compact transaction identifier. (Not supported in Clio v2.0 and earlier.)
  • date (number): The close time 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, which describes the results of the transaction.
  • tx (string — binary mode): The transaction data represented as a hex string.
  • 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.

Request example (CTID)

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tx",
"params": [
{
"ctid": "C005523E00000000",
"binary": false,
"api_version": 2
}
]
}'

Request example (Hash)

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tx",
"params": [
{
"transaction": "C53ECF838647FA5A4C780377025FEC7999AB4182590510CA461444B207AB74A9",
"binary": false,
"api_version": 2
}
]
}'

tx_history

Retrieves info on all recent transactions.

The tx_history method retrieves some of the most recent transactions made.

Caution: This method is removed in API v2.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON-RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • start (unsigned integer; required): Number of transactions to skip over.

Returns

  • txs (array): Array of transaction objects.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tx_history",
"params": [
{
"start": 0
}
]
}'

Response example

{
"result": {
"index": 0,
"status": "success",
"txs": [
{
"Account": "rUPWQfH9SoNnbYDMjq6cMoawQ4x2or6nGA",
"Amount": "100000000000000",
"DeliverMax": "100000000000000",
"Destination": "rUPWQfH9SoNnbYDMjq6cMoawQ4x2or6nGA",
"Fee": "10",
"Flags": 131072,
"LastLedgerSequence": 100581760,
"SendMax": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "1000000000000000"
},
"Sequence": 0,
"SigningPubKey": "EDE91272F3124216316CC04C798E7AE3A7395924FAF50533B01BCC0CE5CE71B122",
"TicketSequence": 100371575,
"TransactionType": "Payment",
"TxnSignature": "A338BAEE8DCFA84DC5F6F8ABD81BC1F9D406F24C248A19465A83E7C9564894538A9F83C654DEFD748F7507FF8E134AC0F108A430BD2E21C1CF45F030C9678705",
"hash": "45A8E1470A18F55FF9559700ABA643FE25E7E957CDB2D35F84B6B746A22C96FF",
"inLedger": 100581753,
"ledger_index": 100581753
}
]
}
}

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.

amm_info

Retrieves info on the Automated Market Maker (AMM) instance.

The amm_info method gets information about an Automated Market Maker (AMM) instance.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON-RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • account (string — address; optional): Show only LP Tokens held by this liquidity provider.
    • amm_account (string — address; optional): The address of the AMM's special AccountRoot. (This is the issuer of the AMM's LP Tokens.)
    • asset (object; optional): 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.
    • asset2 (object; optional): The other of the assets of the AMM, as an object with currency and issuer fields (omit issuer for XRP), like currency amounts.

Note: You must specify either amm_account or both asset and asset2.

Returns

The response follows the standard format, with a successful result containing the following fields:

  • amm (object): An AMM Description Object for the requested asset pair.
  • ledger_current_index (ledger index; optional): 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; optional): 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; optional): 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:

  • 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.
  • asset2_frozen (boolean; omitted for XRP): If true, the amount2 currency is currently frozen.
  • auction_slot (object; optional): An 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; optional): The current votes for the AMM's trading fee, as 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:

  • 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:

  • 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.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "amm_info",
"params": [
{
"asset": {
"currency": "XRP"
},
"asset2": {
"currency": "TST",
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
}
}
]
}'

Response example

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