gaurav
July 6, 2022, 12:33pm
1
You can get the supply of a token by checking the attributes of the smart contract
Here is an example to get smart contracts
Check Burn tokens / Check Mint tokens
To check burn tokens you need to check token transfers from the token contract to the burn address (there can be more than 1 burn address).
For mint you do the opposite, check the token transfer from the burn address to the token contract address.
good evening, I tried the query and it also works with multiples of smart contracts, but the naming needs to be fixed, because the object containing the total is not always in the same position.
try this example:
query ($network: EthereumNetwork!) {
ethereum(network: $network) {
address(address: {in: ["0x050d94685c6b0477e1fc555888af6e2bb8dfbda5","0x761D38e5ddf6ccf6Cf7c55759d5210750B5D60F3"]}) {
annotation
address
smartContract {
attributes{
value
}
}
}
}
}
Can you please explain a bit further on “not being in the same position” ??
Are you referring to the position of the totalSupply attribute not being in the same position in the response
The response to the above GraphQL query is as follows. Are you talking about totalSupply attribute not being in the same position for 0x761D38e5ddf6ccf6Cf7c55759d5210750B5D60F3 as it was for 0x050d94685c6b0477e1fc555888af6e2bb8dfbda5 ??
{
"ethereum": {
"address": [
{
"annotation": "",
"address": "0x050d94685c6b0477e1fc555888af6e2bb8dfbda5",
"smartContract": {
"attributes": [
{
"name": "name",
"value": "Inu."
},
{
"name": "totalSupply",
"value": "1000000000000000000000000000000000"
},
{
"name": "decimals",
"value": "18"
},
{
"name": "symbol",
"value": "INU"
}
]
}
},
{
"annotation": "",
"address": "0x761d38e5ddf6ccf6cf7c55759d5210750b5d60f3",
"smartContract": {
"attributes": [
{
"name": "decimals",
"value": "18"
},
{
"name": "name",
"value": "Dogelon"
},
{
"name": "symbol",
"value": "ELON"
},
{
"name": "totalSupply",
"value": "1000000000000000000000000000000000"
}
]
}
}
]
}
}
If yes, then in that case you can make use of “named indexing ”, that way you won’t face indexing issues while dealing with GraphQL response.
I meant that, it was a little hard to just copy that element as api. thanks for the reply