A node.js script to print details about the Celo blockchain that is connected at http://localhost:8545
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
// Run this script in a npm project with contractkit installed | |
// https://www.npmjs.com/package/@celo/contractkit | |
const Kit = require('@celo/contractkit') | |
const CeloContract = Kit.CeloContract | |
const kit = Kit.newKit('http://localhost:8545') | |
async function wrapper(){ | |
let accounts = await kit.web3.eth.getAccounts() | |
let balance = await kit.getTotalBalance(accounts[0]) | |
const goldTokenAddress = await kit.registry.addressFor(CeloContract.GoldToken) | |
const stableTokenAddress = await kit.registry.addressFor(CeloContract.StableToken) | |
const registryAddress = await kit.registry.addressFor(CeloContract.Registry) | |
const validatorsAddress = await kit.registry.addressFor(CeloContract.Validators) | |
console.log("Accounts: ", accounts) | |
for (let [key, value] of Object.entries(balance)) { | |
console.log(`${key}: ${value.toString(10)}`); | |
} | |
console.log("Gold Token Address: ", goldTokenAddress) | |
console.log("Stable Token Address: ", stableTokenAddress) | |
console.log("Registry Address: ", registryAddress) | |
console.log("Validators Address: ", validatorsAddress) | |
} | |
wrapper() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment