Skip to content

Instantly share code, notes, and snippets.

@josephros
Last active August 13, 2017 17:41
Show Gist options
  • Save josephros/8878325a376f12971ebc201ae3062fd2 to your computer and use it in GitHub Desktop.
Save josephros/8878325a376f12971ebc201ae3062fd2 to your computer and use it in GitHub Desktop.
Query ERC20 token
// 1. get the total supply
token.totalSupply.call(function (err, totalSupply) {
// 2. get the number of decimal places used to represent this token
token.decimals.call(function (err, decimals) {
// 3. get the name of the token
token.name.call(function (err, name) {
// 3. get the balance of the account holder
var accountAddress = $('#accountAddress').val();
token.balanceOf.call(accountAddress, function (err, balance) {
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment