Last active
March 5, 2019 10:13
-
-
Save laalaguer/6af6cd3cdee7980557b6b7dd555de2f8 to your computer and use it in GitHub Desktop.
Add query balance function
This file contains hidden or 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
| <!-- Continue with the App.vue --> | |
| <script> | |
| const operations = require('./operations.js') | |
| const utils = require('./utils.js') | |
| export default { | |
| data() { | |
| return { | |
| myaddress: '0xa7a609b928c4eac077d0e5640f3fa650746c4fcf', | |
| myamount: 0, | |
| contract: '0x0000000000000000000000000000456e65726779' | |
| } | |
| }, | |
| beforeMount () { | |
| this.refreshTokenBalance() | |
| }, | |
| methods: { | |
| refreshTokenBalance () { | |
| operations.getTokenBalance(this.contract, this.myaddress) | |
| .then(result => { | |
| this.myamount = utils.evmToPrintable(result['decoded']['balance'], this.decimals) | |
| }) | |
| .then(() => { | |
| // eslint-disable-next-line | |
| const ticker = connex.thor.ticker() | |
| ticker.next().then(() => { this.refreshTokenBalance() }) | |
| }) | |
| } | |
| } | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment