Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use with ColonyNetworkClient #3

Closed
frods opened this issue Jul 10, 2018 · 5 comments
Closed

Use with ColonyNetworkClient #3

frods opened this issue Jul 10, 2018 · 5 comments
Labels
question Further information is requested

Comments

@frods
Copy link
Contributor

frods commented Jul 10, 2018

Hello, I'm trying to use this with ColonyNetworkClient to create a colony on the rinkeby network with my MetaMask.

You can see what I have so far here: https://github.com/Pioneercoinio/PioneerColony/blob/MetaMaskClient/src/metamask_client.js

It seems that the contracts are not being loaded from rinkeby. The error I get is

(node:85249) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
    at _callee$ (/github/pioneercoinio/PioneerColony/src/pioneercolony.js:7:40)

Any idea on what I'm missing?

@chmanie chmanie added the question Further information is requested label Jul 11, 2018
@chmanie
Copy link
Member

chmanie commented Jul 11, 2018

You forgot to init the colonyNetworkClient like described here:
https://docs.colony.io/colonyjs/docs-get-started/

  const networkClient = new ColonyNetworkClient({ adapter });
  await networkClient.init();

Also, you should await the function call of createPioneerColony.

@frods
Copy link
Contributor Author

frods commented Jul 14, 2018

Thanks that was a silly mistake. I'm now getting errors like the following. Do I need to wrap the provider in some other class?

(node:29079) UnhandledPromiseRejectionWarning: TypeError: provider.sendAsync is not a function
    at /github/pioneercoinio/PioneerColony/node_modules/ethers/providers/web3-provider.js:51:18
    at new Promise (<anonymous>)
    at Web3Provider.send (/github/pioneercoinio/PioneerColony/node_modules/ethers/providers/web3-provider.js:44:12)
    at JsonRpcSigner.getAddress (/github/pioneercoinio/PioneerColony/node_modules/ethers/providers/json-rpc-provider.js:94:26)
    at JsonRpcSigner.sendTransaction (/github/pioneercoinio/PioneerColony/node_modules/ethers/providers/json-rpc-provider.js:119:17)
    at /github/pioneercoinio/PioneerColony/node_modules/ethers/contracts/contract.js:163:39
    at EthersContract._callee3$ (/github/pioneercoinio/PioneerColony/node_modules/@colony/colony-js-adapter-ethers/src/EthersContract.js:68:12)
    at tryCatch (/github/pioneercoinio/PioneerColony/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/github/pioneercoinio/PioneerColony/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/github/pioneercoinio/PioneerColony/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:114:21)

Note: I updated the branch linked in the first post with the async await chagnes.

@chmanie
Copy link
Member

chmanie commented Jul 14, 2018

The problem here is that node-metamask is only compatible with the web3 1.0 providers API (those just have a send method) whereas the ethers web3 wrapper requires it to be web3 0.x. So either ethers at some point provides a web3 wrapper which is compatible with the new provider API of web3 or we have to support that in node-metamask (I'd rather not as it's slowly fading out anyways).

@frods
Copy link
Contributor Author

frods commented Jul 17, 2018

If you see node-metamask as fading out, would you suggest another alternative? My main goal is to drive actions in a javascript with a wallet with coins.

@chmanie
Copy link
Member

chmanie commented Jul 18, 2018

No, not node-metamask but web3 0.x is slowly fading out. As of now we just support web3 1.0 on the node side. Currently I don't have time to add support for that but I'd happily take PRs (hint, hint) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants