diff --git a/src/config.ts b/src/config.ts index 24055a36a..aa7748c1d 100644 --- a/src/config.ts +++ b/src/config.ts @@ -35,6 +35,10 @@ export class Config { signer: ethers.Signer & TypedDataSigner | null, ) { let cfg = (> config)[network.name]; + + if (!cfg) { + throw `Network ${network.name} is not supported`; + } this.network = network; this.registrar = cfg.registrar; diff --git a/src/session.ts b/src/session.ts index aa203722e..ac01bfa6c 100644 --- a/src/session.ts +++ b/src/session.ts @@ -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);