tron token信息获取以及字段解析
TRC20主网
- URL示例:https://apilist.tronscan.org/api/token_trc20?contract=TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8&showAll=1
- logo_url:trc20_tokens[0].icon_url
- token_precision:trc20_tokens[0].decimals
- short_name:trc20_tokens[0].symbol
- token不存在返回:{"total":0,"contractMap":{},"rangeTotal":0,"trc20_tokens":[]}
- 判断不存在:0==total
TRC20测试网shasta
- URL示例:https://shastapi.tronscan.org/api/token_trc20?contract=TB5NSkyzxkzi3eHW87NwFE6TmtTmnZw61y&showAll=1
- logo_url:trc20_tokens[0].icon_url
- token_precision:trc20_tokens[0].decimals
- short_name:trc20_tokens[0].symbol
- token不存在返回:{"total":0,"contractMap":{},"rangeTotal":0,"trc20_tokens":[]}
- 判断不存在:0==total
TRC20测试网nile
- URL示例:https://nileapi.tronscan.org/api/token_trc20?contract=TF17BgPaZYbz8oxbjhriubPDsA7ArKoLX3&showAll=1
- logo_url:trc20_tokens[0].icon_url
- token_precision:trc20_tokens[0].decimals
- short_name:trc20_tokens[0].symbol
- token不存在返回:{"total":0,"contractMap":{},"rangeTotal":0,"trc20_tokens":[]}
- 判断不存在:0==total
TRC10主网
- URL示例:https://apilist.tronscan.org/api/token?id=1002000&showAll=1
- logo_url:data[0].imgUrl
- token_precision:data[0].precision
- short_name:data[0].abbr
- token不存在返回:{"total":0,"data":[],"contractMap":{},"totalAll":0}
- 判断不存在:0==total
TRC10测试网shasta
- URL示例:https://shastapi.tronscan.org/api/token?id=1000252&showAll=1
- logo_url:data[0].imgUrl,如果没有LOGO则为空字符串
- token_precision:data[0].precision
- short_name:data[0].abbr
- token不存在返回:{"total":0,"data":[],"contractMap":{},"totalAll":0}
- 判断不存在:0==total
TRC10测试网nile
- URL示例:https://nileapi.tronscan.org/api/token?id=1000016&showAll=1
- logo_url:data[0].imgUrl
- token_precision:data[0].precision
- short_name:data[0].abbr
- token不存在返回:{"total":0,"data":[],"contractMap":{},"totalAll":0}
- 判断不存在:0==total
总结
- 判断token是否存在都用0==total
- TRC20主网和测试网获取方式一样
- TRC10主网和测试网获取方式一样