查询地址代币余额详情#
获取指定地址代币余额明细,可以获取该地址上的所有代币余额信息。
请求路径#
GET
https://web3.okx.com/api/v5/xlayer/address/token-balance请求参数#
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 地址 |
| protocolType | String | 是 | 合约协议类型 20代币:token_20 721代币:token_721 1155代币:token_1155 |
| tokenContractAddress | String | 否 | 代币合约地址 |
| page | String | 否 | 页码 |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多50条 |
响应参数#
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| tokenList | Array | 代币列表 |
| > symbol | String | 该地址对应的代币 |
| > tokenContractAddress | String | 该地址对应的代币合约地址 |
| > holdingAmount | String | 代币持仓数量 |
| > priceUsd | String | 代币美元价格 |
| > valueUsd | String | 代币总的美元价值 |
| > tokenId | String | NFT 的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": ""
}
]
}
]
}
