@@ -153,7 +153,7 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = React.m
153153 const [ totalBalancePreferredUnit , setTotalBalancePreferredUnit ] = useState < BitcoinUnit > ( BitcoinUnit . BTC ) ;
154154 const [ selectedBlockExplorer , setSelectedBlockExplorer ] = useState < BlockExplorer > ( BLOCK_EXPLORERS . default ) ;
155155 const [ isElectrumDisabled , setIsElectrumDisabled ] = useState < boolean > ( true ) ;
156- const [ networkType , setNetworkType ] = useState < NetworkType > ( 'mainnet' ) ;
156+ const [ networkType , setNetworkType ] = useState < NetworkType > ( defaultSettingsContext . networkType ) ;
157157 const [ settingsLoaded , setSettingsLoaded ] = useState < boolean > ( false ) ;
158158
159159 const { walletsInitialized } = useStorage ( ) ;
@@ -170,11 +170,12 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = React.m
170170 BlueElectrum . isDisabled ( ) . then ( disabled => {
171171 setIsElectrumDisabled ( disabled ) ;
172172 } ) ,
173- DefaultPreference . get ( NETWORK_TYPE_KEY ) . then ( network => {
174- if ( network === 'testnet' || network === 'signet' ) {
175- setNetworkType ( network ) ;
176- setGlobalNetworkType ( network ) ;
177- }
173+ DefaultPreference . get ( NETWORK_TYPE_KEY ) . then ( maybeNetwork => {
174+ // Can be null if nothing is set
175+ const network = ( maybeNetwork as NetworkType ) || defaultSettingsContext . networkType ;
176+ console . log ( `[BlueWallet] Starting with network: ${ network } ` ) ;
177+ setNetworkType ( network ) ;
178+ setGlobalNetworkType ( network ) ;
178179 } ) ,
179180 getIsHandOffUseEnabled ( ) . then ( handOff => {
180181 setIsHandOffUseEnabledState ( handOff ) ;
0 commit comments