@gateway.fm/gtw-dvf-client-js
Version:
DVF client js lib with gateway.fm rpc endpoints
19 lines (13 loc) • 502 B
JavaScript
const Web3 = require('web3')
const getBalanceInEth = async (web3, account) => web3.utils.fromWei(
await web3.eth.getBalance(account.address),
'ether'
)
const envVars = require('./helpers/loadFromEnvOrConfig')(
process.env.CONFIG_FILE_NAME
)
const web3 = new Web3(new Web3.providers.HttpProvider(envVars.RPC_URL))
const ethPrivKey = envVars.ETH_PRIVATE_KEY
const account = web3.eth.accounts.privateKeyToAccount(ethPrivKey)
getBalanceInEth(web3, account).then(console.log)