I'm trying to fetch the first account using web3.eth.accounts[0]
using Truffle, but couldn't seem to make it work.
I'm using version 0.5.0. I read that the command is deprecated and have to use web3.eth.getAccounts()
for asynchronous execution. The latter only displays an array of accounts connected to the local network.
How do I get a single account in this case? I wanted to pass { from: web3.eth.accounts[0] }
metadata to a public function in my contract.
solidity
toweb3.js
. – goodvibration Jan 10 '19 at 15:39