File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
scaffold/src/modal/w3m-network-button Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ export const NetworkController = {
122122 if ( ! state . caipNetwork || ! state . requestedCaipNetworks ?. length ) {
123123 return true ; // No active network or no requested networks, so no validation needed
124124 }
125+
125126 return state . requestedCaipNetworks . some ( network => network . id === state . caipNetwork ?. id ) ;
126127 }
127128} ;
Original file line number Diff line number Diff line change @@ -18,11 +18,12 @@ export interface NetworkButtonProps {
1818
1919export function NetworkButton ( { disabled, style } : NetworkButtonProps ) {
2020 const { isConnected } = useSnapshot ( AccountController . state ) ;
21- const { caipNetwork } = useSnapshot ( NetworkController . state ) ;
21+ const { caipNetwork, requestedCaipNetworks } = useSnapshot ( NetworkController . state ) ;
2222 const { loading } = useSnapshot ( ModalController . state ) ;
2323 const { themeMode, themeVariables } = useSnapshot ( ThemeController . state ) ;
2424
25- const isNetworkSupported = NetworkController . isActiveNetworkInRequestedNetworks ( ) ;
25+ const isNetworkSupported = ! caipNetwork || ! requestedCaipNetworks ?. length ||
26+ requestedCaipNetworks . some ( network => network . id === caipNetwork . id ) ;
2627
2728 const onNetworkPress = ( ) => {
2829 if ( isConnected && ! isNetworkSupported ) {
Original file line number Diff line number Diff line change @@ -473,8 +473,8 @@ export class AppKit extends AppKitScaffold {
473473
474474 const internalState = this . wagmiConfig . chains || [ ] ;
475475 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 ) ;
478478 if ( ! isNetworkSupported ) {
479479 console . warn ( `Network ${ caipChainId } is not in the requested networks list` ) ;
480480 }
You can’t perform that action at this time.
0 commit comments