Created
March 5, 2019 09:25
-
-
Save laalaguer/f347c14925584d1ad7ea4a284a7e5097 to your computer and use it in GitHub Desktop.
Operations to query balance of VTHO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get token amount of holder from a contract. | |
* @param {String} addressContract 0x started address. | |
* @param {String} addressHolder 0x started address. | |
*/ | |
async function getTokenBalance (addressContract, addressHolder) { | |
const balanceOfABI = { | |
'constant': true, | |
'inputs': [ | |
{ | |
'name': '_owner', | |
'type': 'address' | |
} | |
], | |
'name': 'balanceOf', | |
'outputs': [ | |
{ | |
'name': 'balance', | |
'type': 'uint256' | |
} | |
], | |
'payable': false, | |
'stateMutability': 'view', | |
'type': 'function' | |
} | |
// eslint-disable-next-line | |
const balanceOfMethod = connex.thor.account(addressContract).method(balanceOfABI) | |
const balanceInfo = await balanceOfMethod.call(addressHolder) | |
return balanceInfo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment