@ -1461,25 +1461,30 @@ export function updateAndSetCustomRpc (newRpc, chainId, ticker = 'ETH', nickname
}
}
export function editRpc ( oldRpc , newRpc , chainId , ticker = 'ETH' , nickname , rpcPrefs ) {
export function editRpc ( oldRpc , newRpc , chainId , ticker = 'ETH' , nickname , rpcPrefs ) {
return ( dispatch ) => {
return async ( dispatch ) => {
log . debug ( ` background.delRpcTarget: ${ oldRpc } ` )
log . debug ( ` background.delRpcTarget: ${ oldRpc } ` )
background . delCustomRpc ( oldRpc , ( err ) => {
try {
if ( err ) {
promisifiedBackground . delCustomRpc ( oldRpc )
log . error ( err )
} catch ( error ) {
return dispatch ( displayWarning ( 'Had a problem removing network!' ) )
log . error ( error )
dispatch ( displayWarning ( 'Had a problem removing network!' ) )
return
}
}
dispatch ( setSelectedToken ( ) )
dispatch ( setSelectedToken ( ) )
background . updateAndSetCustomRpc ( newRpc , chainId , ticker , nickname || newRpc , rpcPrefs , ( err ) => {
if ( err ) {
try {
log . error ( err )
await promisifiedBackground . updateAndSetCustomRpc ( newRpc , chainId , ticker , nickname || newRpc , rpcPrefs )
return dispatch ( displayWarning ( 'Had a problem changing networks!' ) )
} catch ( error ) {
log . error ( error )
dispatch ( displayWarning ( 'Had a problem changing networks!' ) )
return
}
}
dispatch ( {
dispatch ( {
type : actionConstants . SET _RPC _TARGET ,
type : actionConstants . SET _RPC _TARGET ,
value : newRpc ,
value : newRpc ,
} )
} )
} )
} )
}
}
}
}