Token

APIs to obtain token related details

VM Category Type

1. Get token list by token type

Please note that the API response will only contain the token records corresponding to the tokens that have been verified and are listed on the Explorer portal. The list of currently listed OEP-4, OEP-5 and OEP-8 tokens can be accessed by following the respective links.

url:/v2/tokens/{token_type}?page_size=10&page_number=1, 
method:GET, 
successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":{
        "records":[
            {
                "contract_hash": "16edbe366d1337eb...4c94aeef02", 
                "creator": "AUr5QUfeBADq6BMY6Tp5yuMsUNGpsD7nLZ", 
                "description": "30", 
                "logo": "", 
                "create_time":1516946305, 
                "update_time":1516948340, 
                "contact_info":"{\"website\":\"www.test.cn\", \"github\":\"github.com\"}", 
                "total_supply": 1000000000, 
                "name": "name", 
                "symbol": "MYT", 
                "decimals": 8, 
                "address_count": 1, 
                "tx_count": 30, 
                "vm_category":"neovm"
            }
        ], 
        "total":12
    }
}

OEP8 Token

If the param token_type == oep8, then the result is:

successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":{
        "records":[
            {
                "contract_hash": "16edbe366d1337eb...4c94aeef02", 
                "name": "name", 
                "creator": "AUr5QUfeBADq6BMY6Tp5yuMsUNGpsD7nLZ", 
                "description": "test contract", 
                "logo": "", 
                "create_time":1516946305, 
                "update_time":1516948340, 
                "contact_info":"{\"website\":\"www.tst.cn\", \"github\":\"github.com\"}", , 
                "total_supply": {
                	"01":"1002", 
                	"02":"899", 
                	"03":"321"
                }, 
                "symbol": {
                	"01":"TNA", 
                	"02":"TNB", 
                	"03":"TNC"
                }, 
                "token_name":{
                	"01":"TokenNameFrist", 
                	"02":"TokenNameSecond", 
                	"03":"TokenNameThird"
                }, 
                "token_id":{
                	"01":"01", 
                	"02":"02", 
                	"03":"03"
                }
                "address_count": 1, 
                "tx_count": 30, 
                "vm_category":"neovm"
            }
        ], 
        "total":12
    }
}

2. Get token detail by token type and contracthash

url:/v2/tokens/{token_type}/{contract_hash}, 
method:GET, 
successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":{
        "contract_hash": "16edbe366d...99424c94aeef02", 
        "name": "name", 
        "abi":"25a80bbc...5381", 
        "code": "013ec56b6...006a5", 
        "source_code":"", 
        "create_time":1516946305, 
        "update_time":1516948340, 
        "contact_info":"{\"website\":\"www.test.cn\", \"github\":\"github.com\"}", 
        "logo":"", 
        "description": "oep4 token", 
        "creator": "AFmseVrdL9f9oyC....G6UbvhPbdYzM", 
        "ont_sum": "2123.000000000", 
        "ong_sum": "1233123123.000000000", 
        "address_count": 122, 
        "tx_count": 30, 
        "token_sum":{\"Ht\":\"124\"}", 
        "category":"oep", 
        "type":"oep4", 
        "total_supply": 1000000000, 
        "symbol": "MYT", 
        "decimals": 8, 
        "vm_category":""
    }
}

OEP8 Token

If the param token_type == oep8, then the result is:

successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":{
        "contract_hash": "16edbe366d...99424c94aeef02", 
        "name": "name", 
        "abi":"25a80bbc...5381", 
        "code": "013ec56b6...006a5", 
        "source_code":"", 
        "create_time":1516946305, 
        "update_time":1516948340, 
        "contact_info":"{\"website\":\"www.test.cn\", \"github\":\"github.com\"}", 
        "logo":"", 
        "description": "LuckyNumber is a decentralized, tru.....", 
        "creator": "AFmseVrdL9f9oyCzZefL9tG6UbvhPbdYzM", 
        "ont_sum": "2123.000000000", 
        "ong_sum": "1233123123.000000000", 
        "address_count": 122, 
        "tx_count": 30, 
        "token_sum":{\"Ht\":\"124\"}", 
        "category":"oep", 
        "type":"oep8", 
        "total_supply": {
            "01":"1002", 
            "02":"899", 
            "03":"321"
        }, 
        "symbol": {
            "01":"TNA", 
            "02":"TNB", 
            "03":"TNC"
        }, 
        "token_name":{
            "01":"TokenNameFrist", 
            "02":"TokenNameSecond", 
            "03":"TokenNameThird"
        }, 
        "token_id":{
            "01":"01", 
            "02":"02", 
            "03":"03"
        }
    }
}

3. Get oep8 token transaction list by token name

url:/v2/tokens/oep8/{contract_hash}/{token_name}/transactions?page_size=10&page_number=1, 
method:GET, 
successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":{
    	"records":[
    		{
                "tx_hash":"9762458cd30612509f7c...a010ccc7b347057eb5", 
                "tx_type":209, 
                "tx_time":1522210288, 
                "block_height":1212, 
                "confirm_flag":1, 
                "block_index":1, 
                "fee":"0.01", 
    		}
    	], 
    	"total":20
    }
}

4. Get circulating supply of ONT and ONG

url:/v2/summary/native/circulating-supply/{token}
method:GET

Example Response

696743794   // number of tokens in circulation

5. Get list of token holder addresses

Return addresses with balance greater than 0. The addresses retuned from the balckend has been processed, they are ready for display in the frontend directly without furuter processing. But the balance value requires the frontend to process based on the token's precision.

Native tokens (ONT&ONG):
url:/ontholder/getAssetHolder?qid=1&contract={contract_hash}}&from=0&count=10

oep4 tokens:
url:/ontholder/oep4/getAssetHolder?qid=1&contract={contract_hash}&from=0&count=10

orc20 tokens:
url:/ontholder/orc20/getAssetHolder?qid=1&contract={contract_hash}&from=0&count=10

method:GET

Example Response

{
    "qid": "1",
    "method": "getAssetHolder",
    "error_code": 0,
    "error_info": "",
    "result": [
        {
            "address": "ALVbBHBEquMgtAMrFywT8yBYRmdGBLbGiV",
            "contract": "2f34b28eb98a1dd901d303f5294c87546fb37fe7",
            "balance": "20010000000000000",
            "percent": 0.9955223880597015
        },
        {
            "address": "AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP",
            "contract": "2f34b28eb98a1dd901d303f5294c87546fb37fe7",
            "balance": "69990000000000",
            "percent": 0.003482089552238805
        },
        {
            "address": "AG4pZwKa9cr8ca7PED7FqzUfcwnrQ2N26w",
            "contract": "2f34b28eb98a1dd901d303f5294c87546fb37fe7",
            "balance": "10000000000000",
            "percent": 4.97512437810945E-4
        },
        {
            "address": "AcNsGxJdopi1hz6MXziFraWcgEKxdNDwSx",
            "contract": "2f34b28eb98a1dd901d303f5294c87546fb37fe7",
            "balance": "9895145371331",
            "percent": 4.92295789618457E-4
        },
        {
            "address": "AeWeheZi7a7XoHw2AoivCFDa68xfa436eg",
            "contract": "2f34b28eb98a1dd901d303f5294c87546fb37fe7",
            "balance": "104569135801",
            "percent": 5.202444567213E-6
        },
        {
            "address": "AT9sH4s84NGJYVqNHQWN6vkgb7jQ12eR7p",
            "contract": "2f34b28eb98a1dd901d303f5294c87546fb37fe7",
            "balance": "8900000000",
            "percent": 4.42786069651E-7
        },
        {
            "address": "AFqw9nGHiskTsrfqyMQr3Y3hZ759VpH5j1",
            "contract": "2f34b28eb98a1dd901d303f5294c87546fb37fe7",
            "balance": "1100000000",
            "percent": 5.4726368159E-8
        },
        {
            "address": "AZ8duTd8sPgRS2NQAArkbP3puRYtuGaCF7",
            "contract": "2f34b28eb98a1dd901d303f5294c87546fb37fe7",
            "balance": "285492868",
            "percent": 1.4203625273E-8
        }
    ]
}

6. Get the number of token holders

Native tokens (ONT&ONG):
url:/ontholder/getAssetHolderCount?qid=1&contract={contract_hash}

oep4 tokens:
url:/ontholder/oep4/getAssetHolderCount?qid=1&contract={contract_hash}

orc20 tokens:
url:/ontholder/orc20/getAssetHolderCount?qid=1&contract={contract_hash}

method:GET

Example response

{
    "qid": "1",
    "method": "getAssetHolderCount",
    "error_code": 0,
    "error_info": "",
    "result": 8
}

Last updated