Open jamsubzero opened 5 years ago
I'm encountering the same issue, but I skipped that part and only test my contract using the test framework.
You can however achieve what you're looking for by using promises in js to return a single account. Not sure how to do it in truffle, I think it's important to know this in order for us to easily debug our contract.
Hope someone can point this out clearly.
EDIT: Check this out. Excerpt from the answer in the link:
async function getAccount(id) {
let accounts = await web3.eth.getAccounts();
return accounts[id];
}
You'll need to execute await getAccount(0)
from an async function of course (or use a Promise
).
I get that same issue. Also when i do "npm run dev" it will show the picture below. Even when i connect with the metamask.
In the beginning i though it was my code, but i clone your repository and run it. its still the same issue.
I get that same issue. Also when i do "npm run dev" it will show the picture below. Even when i connect with the metamask.
In the beginning i though it was my code, but i clone your repository and run it. its still the same issue.
for me also
I have the same issue. How can we fix this?
can somebody help I have the same issue..the contract is not loading. I have also used ethereum.enable() as suggested by some users.
can somebody help I have the same issue..the contract is not loading. I have also used ethereum.enable() as suggested by some users.
hey @suraj1611, @theMoe and @vignesh1010! i have the same issue, did anybody manage ti fix it?
I get that same issue. Also when i do "npm run dev" it will show the picture below. Even when i connect with the metamask.
In the beginning i though it was my code, but i clone your repository and run it. its still the same issue.
Same issue bro
This problem has been solved in another thread
can somebody help I have the same issue..the contract is not loading. I have also used ethereum.enable() as suggested by some users.
hey @suraj1611, @theMoe and @Vignesh1010! i have the same issue, did anybody manage ti fix it?
do u get any solution ??
You can try using this instead
web3.eth.getAccounts().then(function(e){return e[0]})
Here it returns address of 0 index.
If you want to use it with the vote function you can try this
web3.eth.getAccounts().then(function(e){accountid1= e[0]})
app.vote(1, { from: accountid1})
web3.eth.accounts is not working in the console and even in the js test. after long googling, I realize that I can now use eth.web3.getAccounts().. But the problem since this is a method, I can't pass index to getAccounts to get the first account(account 0).
So basically my problem is how can I get a single account from getAccounts function.. anyone have an idea?