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

Closed
opened 2018-10-28 11:02:08 +00:00 by raucao · 2 comments
raucao commented 2018-10-28 11:02:08 +00:00 (Migrated from github.com)

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.

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 2019-07-22 08:18:42 +00:00 (Migrated from github.com)

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?

We have the [`available_networks`]( https://github.com/67P/kredits-contracts/blob/master/lib/kredits.js#L86) 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 2019-07-22 13:05:19 +00:00 (Migrated from github.com)

@bumi sure will look at that...

@bumi sure will look at that...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kredits/kredits-web#82