trufflesuite / drizzle-legacy

Reactive Ethereum datastore for dapp UIs.
http://truffleframework.com/docs/drizzle/getting-started
MIT License
503 stars 128 forks source link

Feature/network whitelist #235

Closed SeanJCasey closed 5 years ago

SeanJCasey commented 5 years ago

This pull request addresses the use case of a user selecting a network in their provider that a dApp does not support.

It adds a networkWhitelist to drizzle options, a list of network ids that the dApp can be accessed on.

If this option is left as default, nothing happens.

If this option is set and the current network is not in the whitelist, then a NETWORK_MISMATCH action is dispatched which sets a networkMismatch boolean to true in state.

I added an options.test.js that includes jest tests for the different scenareos.

I added a default options section to api.test.js for different drizzle options to make sure their default values work as expected.