Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict'
- var Web3 = require("web3")
- var util = require("util")
- const mainnet = 'http://127.0.0.1:7545'
- // const Balance = use('App/Models/etherium/Balance')
- let web3 = new Web3(new Web3.providers.HttpProvider(mainnet));
- class BalanceController {
- newBalances() {
- web3.eth.getBalance(address)
- .then(data => callback(data))
- // Attaches a callback for only the rejection of the Promise
- .catch(err => {
- console.log("Error: " + err)
- })
- }
- async balanceStore({ request, response, auth }) {
- const gb = await web3.eth.getBalance(request.input('address'))
- console.log(util.inspect(gb))
- }
- }
- module.exports = BalanceController
Advertisement
Add Comment
Please, Sign In to add comment