File tree 3 files changed +6
-4
lines changed
scaffold/src/modal/w3m-network-button
3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ export const NetworkController = {
122
122
if ( ! state . caipNetwork || ! state . requestedCaipNetworks ?. length ) {
123
123
return true ; // No active network or no requested networks, so no validation needed
124
124
}
125
+
125
126
return state . requestedCaipNetworks . some ( network => network . id === state . caipNetwork ?. id ) ;
126
127
}
127
128
} ;
Original file line number Diff line number Diff line change @@ -18,11 +18,12 @@ export interface NetworkButtonProps {
18
18
19
19
export function NetworkButton ( { disabled, style } : NetworkButtonProps ) {
20
20
const { isConnected } = useSnapshot ( AccountController . state ) ;
21
- const { caipNetwork } = useSnapshot ( NetworkController . state ) ;
21
+ const { caipNetwork, requestedCaipNetworks } = useSnapshot ( NetworkController . state ) ;
22
22
const { loading } = useSnapshot ( ModalController . state ) ;
23
23
const { themeMode, themeVariables } = useSnapshot ( ThemeController . state ) ;
24
24
25
- const isNetworkSupported = NetworkController . isActiveNetworkInRequestedNetworks ( ) ;
25
+ const isNetworkSupported = ! caipNetwork || ! requestedCaipNetworks ?. length ||
26
+ requestedCaipNetworks . some ( network => network . id === caipNetwork . id ) ;
26
27
27
28
const onNetworkPress = ( ) => {
28
29
if ( isConnected && ! isNetworkSupported ) {
Original file line number Diff line number Diff line change @@ -473,8 +473,8 @@ export class AppKit extends AppKitScaffold {
473
473
474
474
const internalState = this . wagmiConfig . chains || [ ] ;
475
475
const isNetworkSupported = internalState . length === 0 ||
476
- internalState . some ( ( chain : Chain ) =>
477
- `${ ConstantsUtil . EIP155 } :${ chain . id } ` === caipChainId ) ;
476
+ internalState . some ( ( chainItem : Chain ) =>
477
+ `${ ConstantsUtil . EIP155 } :${ chainItem . id } ` === caipChainId ) ;
478
478
if ( ! isNetworkSupported ) {
479
479
console . warn ( `Network ${ caipChainId } is not in the requested networks list` ) ;
480
480
}
You can’t perform that action at this time.
0 commit comments