xrp

XRP (XRP)

Method: POST ripple_path_find

dropdown

POST ripple_path_find

Ripple_path_find 方法是 path_find 方法的简化版本,它提供一个单一的响应,您可以立即使用支付路径。

它在 WebSocket 和 JSON-RPC API 中都可用。

然而,随着时间的推移,结果往往会过时。

与其多次调用以保持更新,不如使用 path_find 方法在可能的情况下订阅持续更新。

Parameters

source_account - 细绳

将在交易中发送资金的帐户的唯一地址

destination_account - 细绳

将在交易中接收资金的帐户的唯一地址

destination_amount - 字符串或对象

货币 目标账户将在交易中收到的金额。

这要求尽可能多地传递路径,同时花费不超过 send_max 中指定的数量(如果提供)。

send_max - 字符串或对象

(可选)将在交易中花费的货币金额。不能与 source_currencies 一起使用。

source_currencies - 大批

(可选)源账户可能想要花费的货币数组。

数组中的每个条目都应该是一个带有强制货币字段和可选发行者字段的 JSON 对象,例如货币金额的指定方式。不能包含超过 18 种来源货币。

默认情况下,使用所有可用的源货币,最多 88 种不同的货币/发行人对。

None -

ledger_hash - 细绳

(可选)供分类帐版本使用的 20 字节十六进制字符串。

ledger_index - 字符串或无符号整数

(可选)要使用的分类帐的分类帐索引,或用于自动选择分类帐的快捷字符串。

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