trufflesuite / drizzle

Reactive Ethereum dapp UI suite
905 stars 235 forks source link

Add valid networkIDs to drizzleOptions #23

Closed cds-amal closed 4 years ago

cds-amal commented 5 years ago

Define valid networkIDs that drizzle can use when connecting to web3. This would allow drizzle to present navigation/alert when connecting to invalid (web3) network.

Originally posted by @cds-amal in https://github.com/trufflesuite/drizzle/issues/75#issuecomment-463910618

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been closed, but can be re-opened if further comments indicate that the problem persists. Feel free to tag maintainers if there is no reply to further comments.

cds-amal commented 5 years ago

In light of trufflesuite/drizzle-legacy#220 investigation, letting dapp owners whitelist networks where their contracts are deployed would allow for a better Security UX.

tung-eh commented 5 years ago

Hi guys,

I see that you added this feature via the PR https://github.com/trufflesuite/drizzle/pull/235, right?

When you are going to release this? I'm looking at using it in my proj. TIA

0x31 commented 5 years ago

It would be useful if the fallback provider is used if the injected provider is on the wrong network, instead of just setting the networkMismatch flag. (see https://github.com/ren-forks/drizzle/compare/develop..e69a202)

cds-amal commented 4 years ago

@tung-eh we're in the process of moving to a monorepo that among other things will rename and scope drizzle related projects under @drizzle.

Current Name Scoped name
drizzle @drizzle/store
drizzle-react @drizzle/react-plugin
drizzle-react-components @drizzle/react-components

You can try the renamed drizzle scoped package, with networkMismatch by npm i @drizzle/store. Keep in mind, wherever drizzle was imported it should be replaced with @drizzle/store

cds-amal commented 4 years ago

@noiach thanks for bringing this up! Our intention with the networkWhitelist setting and the NetworkMismatch action allows the dapp to present the user with a warning, or instruction to connect to the intended network.

This would mean introducing another setting on how to handle a mismatch to either present an error, or use the provided fallback.

@SeanJCasey what do you think?

SeanJCasey commented 4 years ago

Thanks for the feedback @noiach . That's an interesting idea and I can imagine the utility. For the current issue/PR though, I think the concern is more about providing the developer with the info needed to respond to a network mismatch as they see fit, rather than presuming what those actions might be.

OnlyOneJMJQ commented 4 years ago

Hey all, closing this since PR 235 has been merged. Thanks @SeanJCasey!