钱包 API

资产明细#

查询地址持有的多个链或指定链的 token 余额列表。 余额查询支持:

  • 主链币
  • EVM 链的 ERC20 代币
  • Bitcoin 链的 BRC-20、ARC-20、Runes 和 SRC-20 代币
  • Fractal Bitcoin 链的 BRC-20 代币

此外,该接口支持过滤风险空投代币。

请求路径#

GET https://www.okx.com/api/v5/wallet/asset/all-token-balances-by-address

请求参数#

ParameterTypeRequiredDescription
addressStringYes地址
chainsStringYes筛选需要查询资产明细的链,多条链以","分隔。最多支持 50 个
filterStringNo0: 过滤风险空投币
1: 不过滤风险空投币
默认过滤

响应参数#

ParameterTypeDescription
tokenAssetsArray代币余额
>chainIndexString链唯一标识
>tokenAddressString合约地址
>addressString地址
>symbolString代币简称
>balanceString代币数量
>tokenPriceString币种单位价值,以美元计价
>tokenTypeString币种类型:
1:token
2:铭文
>transferAmountStringBRC-20、FBRC-20 等铭文资产可直接转账、交易的余额数量,一般称为可转余额。
>availableAmountStringBRC-20、FBRC-20 等铭文资产需要完成铭刻操作才可以交易、转账的数量,一般称为可用余额或者待铭刻余额。
>isRiskTokenBooleantrue:命中风险空投币
false:未命中风险空投币

请求示例#

shell
curl --location --request GET 'https://www.okx.com/api/v5/wallet/asset/all-token-balances-by-address?address=0x50c476a139aab23fdaf9bca12614cdd54a4244e3&chains=1&filter=1' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z' \

响应示例#

200
{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "tokenAssets": [
                {
                    "chainIndex": "1",
                    "tokenAddress": "0xf4d2888d29d722226fafa5d9b24f9164c092421e",
                    "address":"0x50c476a139aab23fdaf9bca12614cdd54a4244e3",
                    "symbol": "LOOKS",
                    "balance": "0.6908810093750312",
                    "tokenPrice": "0.035834243057603148",
                    "tokenType": "1",
                    "isRiskToken": false
                },
                {
                    "chainIndex": "1",
                    "tokenAddress": "0x6570ffe19da7e2b425329b157d9109b87f18304b",
                    "address":"0x50c476a139aab23fdaf9bca12614cdd54a4244e3",
                    "symbol": "UNM",
                    "balance": "0.00157",
                    "tokenPrice": "5.401009128680169",
                    "tokenType": "1",
                    "isRiskToken": false
                },
                {
                    "chainIndex": "1",
                    "tokenAddress": "0x67542502245eb5df64ef7ea776199ceb79401058",
                    "address":"0x50c476a139aab23fdaf9bca12614cdd54a4244e3",
                    "symbol": "$ UniswapLR.com @ 5.75",
                    "balance": "1000",
                    "tokenPrice": "0",
                    "tokenType": "1",
                    "isRiskToken": true
                }
            ]
        }
    ]
}