From 2b6c0a8ba492dbf75321a80a6c7c228b443c2215 Mon Sep 17 00:00:00 2001 From: Roman Storm Date: Fri, 18 Dec 2020 00:01:44 -0800 Subject: [PATCH] fix bug for non-metamask view --- store/deploy.js | 4 ++-- store/provider/getters.js | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/store/deploy.js b/store/deploy.js index 9138ca8..7e8dbe3 100644 --- a/store/deploy.js +++ b/store/deploy.js @@ -9,7 +9,7 @@ const state = () => { const getters = { deployerContract: (state, getters, rootState, rootGetters) => (isProxy) => { - const web3 = rootGetters['provider/getWeb3'] + const web3 = rootGetters['provider/currentRpc'] return new web3.eth.Contract( deployerABI, isProxy @@ -30,7 +30,7 @@ const actions = { dispatch('loading/enable', {}, { root: true }) const isProxy = action.domain === 'deployer.contract.tornadocash.eth' const ethAccount = rootGetters['provider/getAccount'] - const web3 = rootGetters['provider/getWeb3'] + const web3 = rootGetters['provider/currentRpc'] const code = await web3.eth.getCode(action.expectedAddress) console.log('code', code) diff --git a/store/provider/getters.js b/store/provider/getters.js index 7583aa3..351e500 100644 --- a/store/provider/getters.js +++ b/store/provider/getters.js @@ -26,6 +26,11 @@ export default { return Object.freeze(new Web3(provider)) }, + currentRpc: (state, getters) => { + const network = getters.getNetwork + const rpcUrl = network.rpcUrls.Infura.url + return Object.freeze(new Web3(rpcUrl)) + }, getBalance: (state) => { return state.balance },