Merge pull request #14 from sebastinez/sebastinez/reload-network-change

Validate network and reloads on change
This commit is contained in:
Alexis Sellier
2021-06-08 17:57:39 +02:00
committed by GitHub
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -35,6 +35,10 @@ export class Config {
signer: ethers.Signer & TypedDataSigner | null,
) {
let cfg = (<Record<string, any>> config)[network.name];
if (!cfg) {
throw `Network ${network.name} is not supported`;
}
this.network = network;
this.registrar = cfg.registrar;
+2
View File
@@ -164,6 +164,8 @@ export const session = derived(state, s => {
return null;
});
window.ethereum?.on('chainChanged', () => location.reload());
// Updates state when user changes accounts
window.ethereum?.on("accountsChanged", state.setChangedAccount);