xrp

XRP (XRP)

Method: POST ripple_path_find

dropdown

POST ripple_path_find

The ripple_path_find method is a simplified version of the path_find method that provides a single response with a payment path 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.

Parameters

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.

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

None - None

None

ledger_hash - String

(Optional) A 20-byte hex string for the ledger version to use.

ledger_index - String or Unsigned Integer

(Optional) The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically.

Request

curl --location --request POST 'https://xrp.getblock.io/mainnet/' 
--header 'x-api-key: YOUR-API-KEY' 
--header 'Content-Type: application/json' 
--data-raw '{"jsonrpc": "2.0",
"method": "ripple_path_find",
"params": [{"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", "destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", "destination_amount": {"currency": "USD", "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", "value": "0.001"}}],
"id": "getblock.io"}'


Response

{
    "result": {
        "alternatives": [
            {
                "paths_canonical": [],
                "paths_computed": [
                    [
                        {
                            "currency": "USD",
                            "issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
                            "type": 48,
                            "type_hex": "0000000000000030"
                        },
                        {
                            "account": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
                            "type": 1,
                            "type_hex": "0000000000000001"
                        },
                        {
                            "account": "r3ChHwdxjacs7UVVDqg53hEqwJ2oc3Lwr8",
                            "type": 1,
                            "type_hex": "0000000000000001"
                        },
                        {
                            "account": "rNdwi8ain5ibXNB9A7H3zzKtSxgVzAqqAe",
                            "type": 1,
                            "type_hex": "0000000000000001"
                        }
                    ]
                ]
            },
            {
                "paths_canonical": [],
                "paths_computed": [
                    [
                        {
                            "account": "rGwUWgN5BEg3QGNY3RX2HfYowjUTZdid3E",
                            "type": 1,
                            "type_hex": "0000000000000001"
                        }
                    ]
                ],
                "source_amount": {
                    "currency": "DYM",
                    "issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
                    "value": "0.05018012794882048"
                }
            },
            {
                "paths_canonical": [],
                "paths_computed": [
                    [
                        {
                            "account": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
                            "type": 1,
                            "type_hex": "0000000000000001"
                        },
                        {
                            "currency": "EUR",
                            "issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
                            "type": 48,
                            "type_hex": "0000000000000030"
                        }
                    ]
                ]
            },
            {
                "paths_canonical": [],
                "paths_computed": [
                    [
                        {
                            "account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
                            "type": 1,
                            "type_hex": "0000000000000001"
                        },
                        {
                            "currency": "XRP",
                            "type": 16,
                            "type_hex": "0000000000000010"
                        },
                        {
                            "currency": "USD",
                            "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
                            "type": 48,
                            "type_hex": "0000000000000030"
                        }
                    ]
                ],
                "source_amount": {
                    "currency": "MXN",
                    "issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
                    "value": "0.00008727735368956744"
                }
            }
        ],
        "destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
        "destination_amount": {
            "currency": "USD",
            "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
            "value": "0.001"
        },
        "destination_currencies": [
            "015841551A748AD2C1F76FF6ECB0CCCD00000000",
            "JOE",
            "USD",
            "XRP",
            "EUR",
            "CNY",
            "DYM",
            "MXN",
            "BTC"
        ],
        "full_reply": true,
        "source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
        "status": "success"
    }
}