1Hive/celeste-dashboard

Fix the localhost:8545 error in dashboard.

kamikazebr opened this issue ยท 7 comments

In https://celeste.1hive.org/#/dashboard

It try connect to localhost

image

image

It's looking the errors and the end in ethers, just need some futher investigation to know the cause.

That file its just used to test

I believe it might be related to these lines: https://github.com/1Hive/celeste-dashboard/blob/master/src/lib/web3-utils.js#L27-L32

export function getDefaultProvider(chainId = getPreferredChain()) {
  const type = getNetworkType(chainId)
  const defaultEthNode = getDefaultEthNode(chainId)

  return defaultEthNode
    ? new Providers.StaticJsonRpcProvider(defaultEthNode)
    : ethers.getDefaultProvider(type, getBackendServicesKeys())
}

In particular, every time we are using getDefaultProvider we have to double-check if we are providing the right chainId. Let's review the getPreferredChain, getNetworkType, and getDefaultEthNode are working fine.

Also, @fabriziovigevani might have a better understanding here.

I believe it might be related to these lines: https://github.com/1Hive/celeste-dashboard/blob/master/src/lib/web3-utils.js#L27-L32

export function getDefaultProvider(chainId = getPreferredChain()) {
  const type = getNetworkType(chainId)
  const defaultEthNode = getDefaultEthNode(chainId)

  return defaultEthNode
    ? new Providers.StaticJsonRpcProvider(defaultEthNode)
    : ethers.getDefaultProvider(type, getBackendServicesKeys())
}

In particular, every time we are using getDefaultProvider we have to double-check if we are providing the right chainId. Let's review the getPreferredChain, getNetworkType, and getDefaultEthNode are working fine.

Yes. I got to them. I think good way its write small unit test to ensure it works properly.

image
I made some unit tests.

now i'll investigate why it getting null

@0xGabi

The getDefaultProvider only return the default chain ID when it its called without args, like undefined

image

When passed NULL, so it point to localhost

The getPreferredChain() works correctly
image

Both tests PASS

The PR need be reviewed #155