diff --git a/src/logic/wallets/store/actions/removeProvider.js b/src/logic/wallets/store/actions/removeProvider.js index f827e033..696a2189 100644 --- a/src/logic/wallets/store/actions/removeProvider.js +++ b/src/logic/wallets/store/actions/removeProvider.js @@ -2,6 +2,7 @@ import { createAction } from 'redux-actions' import type { Dispatch as ReduxDispatch } from 'redux' import { NOTIFICATIONS, showSnackbar } from '~/logic/notifications' +import { getWeb3 } from '~/logic/wallets/getWeb3' export const REMOVE_PROVIDER = 'REMOVE_PROVIDER' @@ -10,9 +11,11 @@ const removeProvider = createAction(REMOVE_PROVIDER) export default (enqueueSnackbar: Function, closeSnackbar: Function) => (dispatch: ReduxDispatch<*>) => { showSnackbar(NOTIFICATIONS.WALLET_DISCONNECTED_MSG, enqueueSnackbar, closeSnackbar) - // remove info about current wallet connect session on disconnect so it's not used later - // TODO: use a method for killing the session from web3connect when they provide one - localStorage.removeItem('walletconnect') + const web3 = getWeb3() + + if (web3.currentProvider && web3.currentProvider.close) { + web3.currentProvider.close() + } dispatch(removeProvider()) }