查询地址代币余额详情#

获取指定地址代币余额明细,可以获取该地址上的所有代币余额信息。

请求路径#

GET
https://web3.okx.com/api/v5/xlayer/address/token-balance

请求参数#

参数名类型是否必须描述
chainShortNameString公链缩写符号,例如 XLAYER
addressString地址
protocolTypeString合约协议类型 20代币:token_20 721代币:token_721 1155代币:token_1155
tokenContractAddressString代币合约地址
pageString页码
limitString返回条数,默认返回最近的20条,最多50条

响应参数#

参数名类型描述
pageString当前页码
limitString当前页共多少条数据
totalPageString总共多少页
tokenListArray代币列表
> symbolString该地址对应的代币
> tokenContractAddressString该地址对应的代币合约地址
> holdingAmountString代币持仓数量
> priceUsdString代币美元价格
> valueUsdString代币总的美元价值
> tokenIdStringNFT 的ID

请求示例#

shell
curl --location --request GET 'https://web3.okx.com/api/v5/xlayer/address/token-balance?chainShortName=xlayer&address=0x1e4a5963abfd975d8c9021ce480b42188849d41d&protocolType=token_20&limit=1' \
--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'

响应示例#

json
{
    "code": "0",
    "msg": "",
    "data": [
        {
            "limit": "1",
            "page": "1",
            "totalPage": "2",
            "tokenList": [
                {
                    "symbol": "USDT",
                    "tokenContractAddress": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
                    "tokenType": "ERC20",
                    "holdingAmount": "614.05118",
                    "priceUsd": "1.00062",
                    "valueUsd": "614.4318917316",
                    "tokenId": ""
                }
            ]
        }
    ]
}