Rippled/XRP API手册

account_currencies - 获取账户货币清单

account_currencies命令获取指定账户可以发送或接收的货币清单。注意,返回的清单不一定是 完全确认的,但可以用来填充用户界面。

API请求格式

WebSocket请求示例

{
    "command": "account_currencies",
    "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
    "strict": true,
    "ledger_index": "validated"
}

JSON-RPC请求示例

{
    "method": "account_currencies",
    "params": [
        {
            "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
            "account_index": 0,
            "ledger_index": "validated",
            "strict": true
        }
    ]
}

命令请求参数

  • account:要查询的账户ID,通常使用账户地址,字符串
  • strict:是否仅支持使用地址或公钥作为账户ID,布尔值,默认值:true
  • ledger_hash:要使用的账本哈希,20字节16进制字符串
  • ledger_index:要使用的账本索引或账本快捷选择符,整数或字符串

API响应格式

WebSocket响应示例

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

JSON-RCP响应示例

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

命令响应字段

  • ledger_hash:使用的账本哈希,字符串
  • ledger_index:使用的账本索引号,整数
  • receive_currencies:该账户可以接收的货币,字符串数组
  • send_currencies:该账户可以发送的货币清单,字符串数组
  • validated:数据所使用的账本是否已验证,布尔值