question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to access web3.eth.accounts in config/contracts.js

See original GitHub issue

What I’m trying to do:

I originally wrote all my tests in the Truffle testing environment. However, after finding Ganache and Truffle were often crashing, I have turned to trying to write tests in Embark.

In order to deploy one of my contracts, I have to send two addresses into the constructor. I have started a local testrpc using embark simulator, which started ganache-cli with a mnemonic and 10 test accounts. I want to send the first and third argument into the constructor similar to the below:

initializeContract(web3.eth.accounts[0], web3.eth.accounts[2]);

What is actually happening:

Embark doesn’t seem to recognize web3. The error code is:

Error: Attempted to deploy contract without specifying parameters

I tried to check the status of the web3 instantiation after starting embark run, and it seems uninitialized? Should accounts and addresses be initialized?

image

Is there something I’m doing wrong to use and/or initialize web3?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:26

github_iconTop GitHub Comments

4reactions
jrainvillecommented, Jul 12, 2018

Contract names might not be exactly the same. Just change them in the config and in the require.

1reaction
0xicingdeathcommented, Jul 12, 2018

Yes, it works!! Thank you so much @jrainville @iurimatias for your help to get this working! (edited: oops)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Undefined results for "web3.eth.accounts" in truffle console
I can use it but I am not able to choose any of the accounts specifically which I was able to do with...
Read more >
web3.eth.accounts — web3.js 1.0.0 documentation
The web3.eth.accounts contains functions to generate Ethereum accounts ... chainId - String : (optional) The chain id to use when signing this transaction....
Read more >
web3.js crypto` from `node_modules/web3-eth-accounts/src ...
error: bundling failed: UnableToResolveError: Unable to resolve module crypto from node_modules/web3-eth-accounts/src/index.js: Module does ...
Read more >
web3.eth.accounts[0] returns undefined - Stack Overflow
Methods in web3 such as getAccounts are asynchronous. Note web3 version 1.x.x return promises. So you use promises and you can also ...
Read more >
Configuring EmbarkJS - Embark Framework
This tells EmbarkJS to either automatically connect to Metamask (or Mist) ... configuration file (typically located in config/contracts.js ) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found