mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-03 18:50:30 +08:00
Merge pull request #14 from sebastinez/sebastinez/reload-network-change
Validate network and reloads on change
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user