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.
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 totrue
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.