Created
October 25, 2019 18:04
-
-
Save tyrion70/3eb669cfdd029d0c9ff7d1cc48028f98 to your computer and use it in GitHub Desktop.
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
| const iWanClient = require('iwan-sdk'); | |
| // MAINNET | |
| let apiClientMain = new iWanClient('YOUR-API-KEY, YOUR-SECRET-KEY'); | |
| let totalstake = 0; | |
| apiClientMain.getCurrentStakerInfo("WAN",(err, validators) => { | |
| if (err) { | |
| console.log(err); | |
| } else { | |
| for (b in validators) { | |
| totalstake += parseInt(validators[b].amount) / 1000000000000000000 | |
| for (i = 0; i < validators[b].partners.length; i++) { | |
| totalstake += parseInt(validators[b].partners[i].amount) / 1000000000000000000 | |
| } | |
| for (i = 0; i < validators[b].clients.length; i++) { | |
| totalstake += parseInt(validators[b].clients[i].amount) / 1000000000000000000 | |
| } | |
| } | |
| console.log(totalstake) | |
| } | |
| apiClientMain.close(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment