67P / kredits-web

Kredits Web UI
https://kredits.kosmos.org
6 stars 2 forks source link

If user brings blockchain, make sure it's the right one #82

Closed raucao closed 5 years ago

raucao commented 5 years ago

Currently, with e.g. Metamask installed, and e.g. mainnet selected, the app will throw an exception about not being able to find the contract, but not tell the user anything about it. In that case, the loading indicator will just be visible indefinitely.

The app should catch that error and notify the user to make sure they have the right chain selected.

bumi commented 5 years ago

We have the available_networks method in kredits-contracts (Kredits.available_networks()) that can be used. After the window.ethereum.enable() call we should be able to check for window.ethereum.networkVersion which returns a string of the network ID (should be confirmed if that is metamask specific or a general provider standard). https://github.com/67P/kredits-web/blob/master/app/services/kredits.js#L121

maybe @haythem96 you want to have a look at this?

haythemsellami commented 5 years ago

@bumi sure will look at that...