Skip to content

Commit 4297e21

Browse files
Update AccountDefaultView and AccountView to handle unsupported networks
Co-Authored-By: nacho@reown.com <nacho@reown.com>
1 parent 78499a8 commit 4297e21

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

packages/scaffold/src/views/w3m-account-default-view/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,13 @@ export function AccountDefaultView() {
146146
};
147147

148148
const onNetworkPress = () => {
149-
RouterController.push('Networks');
149+
const isNetworkSupported = NetworkController.isActiveNetworkInRequestedNetworks();
150+
151+
if (AccountController.state.isConnected && !isNetworkSupported) {
152+
RouterController.push('UnsupportedChain');
153+
} else {
154+
RouterController.push('Networks');
155+
}
150156

151157
EventsController.sendEvent({
152158
type: 'track',

packages/scaffold/src/views/w3m-account-view/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ export function AccountView() {
3939
};
4040

4141
const onNetworkPress = () => {
42-
RouterController.push('Networks');
42+
const isNetworkSupported = NetworkController.isActiveNetworkInRequestedNetworks();
43+
44+
if (AccountController.state.isConnected && !isNetworkSupported) {
45+
RouterController.push('UnsupportedChain');
46+
} else {
47+
RouterController.push('Networks');
48+
}
4349
};
4450

4551
const onActivatePress = () => {

0 commit comments

Comments
 (0)