Switching the network in Settings (the settings-network change handler in src/popup/views/settings.js, which calls onChainSwitch()) saves the new network but sends no chainChanged to open tabs. Only the background's broadcastChainChanged() sends that event, and only a site's approved wallet_switchEthereumChain request reaches it.
A connected page therefore keeps the old chain id in window.ethereum.chainId until it asks eth_chainId again, and can build a transaction for the old chain, which the wallet then refuses when it prepares it.
Definition of done
Switching the network in Settings sends chainChanged with the new chain id to every open tab, as an approved site request does.
A test shows it.
Model: opus-5-5
Switching the network in Settings (the `settings-network` change handler in `src/popup/views/settings.js`, which calls `onChainSwitch()`) saves the new network but sends no `chainChanged` to open tabs. Only the background's `broadcastChainChanged()` sends that event, and only a site's approved `wallet_switchEthereumChain` request reaches it.
A connected page therefore keeps the old chain id in `window.ethereum.chainId` until it asks `eth_chainId` again, and can build a transaction for the old chain, which the wallet then refuses when it prepares it.
**Definition of done**
- Switching the network in Settings sends `chainChanged` with the new chain id to every open tab, as an approved site request does.
- A test shows it.
Model: opus-5-5
Plan: the Settings switch sends chainChanged through the same background function an approved site request uses, so both paths tell open pages; a switch to the active network sends nothing. A jest test fails first on next.
Model: opus-5-5
Plan: the Settings switch sends `chainChanged` through the same background function an approved site request uses, so both paths tell open pages; a switch to the active network sends nothing. A jest test fails first on `next`.
Model: opus-5-5
Built in #503: once Settings has saved a switch, the background sends chainChanged with the new chain id to every open tab through the same function an approved site request uses. Choosing the network already active sends nothing.
Model: opus-5-5
Built in https://git.eeqj.de/sneak/AutistMask/pulls/503: once Settings has saved a switch, the background sends `chainChanged` with the new chain id to every open tab through the same function an approved site request uses. Choosing the network already active sends nothing.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Switching the network in Settings (the
settings-networkchange handler insrc/popup/views/settings.js, which callsonChainSwitch()) saves the new network but sends nochainChangedto open tabs. Only the background'sbroadcastChainChanged()sends that event, and only a site's approvedwallet_switchEthereumChainrequest reaches it.A connected page therefore keeps the old chain id in
window.ethereum.chainIduntil it askseth_chainIdagain, and can build a transaction for the old chain, which the wallet then refuses when it prepares it.Definition of done
chainChangedwith the new chain id to every open tab, as an approved site request does.Model: opus-5-5
Plan: the Settings switch sends
chainChangedthrough the same background function an approved site request uses, so both paths tell open pages; a switch to the active network sends nothing. A jest test fails first onnext.Model: opus-5-5
Built in #503: once Settings has saved a switch, the background sends
chainChangedwith the new chain id to every open tab through the same function an approved site request uses. Choosing the network already active sends nothing.Model: opus-5-5