@ -1461,24 +1461,29 @@ 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!' ) )
dispatch ( setSelectedToken ( ) )
return
background . updateAndSetCustomRpc ( newRpc , chainId , ticker , nickname || newRpc , rpcPrefs , ( err ) => {
}
if ( err ) {
log . error ( err )
dispatch ( setSelectedToken ( ) )
return dispatch ( displayWarning ( 'Had a problem changing networks!' ) )
}
try {
dispatch ( {
await promisifiedBackground . updateAndSetCustomRpc ( newRpc , chainId , ticker , nickname || newRpc , rpcPrefs )
type : actionConstants . SET _RPC _TARGET ,
} catch ( error ) {
value : newRpc ,
log . error ( error )
} )
dispatch ( displayWarning ( 'Had a problem changing networks!' ) )
} )
return
}
dispatch ( {
type : actionConstants . SET _RPC _TARGET ,
value : newRpc ,
} )
} )
}
}
}
}