makerdao/dai.js

Unhandled Rejection (Error): Cannot resolve network ID. Are you connected?

Closed this issue · 3 comments

I'm trying to get the Eth price with:

const price = maker.service('price');
const ethPrice = await price.getEthPrice();

image

Any idea?

@varon-bardus Can you paste your config and/or Maker.create(...) here? It looks like it's trying to connect to a network with ID 5777 here, which isn't a valid network ID.

I'm using "test" network, with Ganache running on http://127.0.0.1:2000 as documentation stays. Ganache's default network id is 5777, should I use another one? I thought that was fine as docs doesn't specifies it.
Thank you.

Oh, I see. We should add that to the docs. Are you running our script to deploy all the Maker contracts on Ganache? If not, you can do that by cloning the repo and running ./testchain/scripts/with-deployed-system from the root directory. This will set you up with a Ganache environment that has all our contracts deployed, price feeds configured, etc.

If you're already doing that and still hitting this error, try changing the network ID to 999.