diff --git a/src/logic/contracts/generateBatchRequests.ts b/src/logic/contracts/generateBatchRequests.ts index 1edaaa62..a4db1cfa 100644 --- a/src/logic/contracts/generateBatchRequests.ts +++ b/src/logic/contracts/generateBatchRequests.ts @@ -1,5 +1,5 @@ // -import { web3ReadOnly } from 'src/logic/wallets/getWeb3' +import { web3ReadOnly as web3 } from 'src/logic/wallets/getWeb3' /** * Generates a batch request for grouping RPC calls @@ -12,7 +12,6 @@ import { web3ReadOnly } from 'src/logic/wallets/getWeb3' * @returns {Promise<[*]>} */ const generateBatchRequests = ({ abi, address, batch, context, methods }: any): any => { - const web3 = web3ReadOnly const contractInstance = new web3.eth.Contract(abi, address) const localBatch = batch ? null : new web3.BatchRequest() diff --git a/src/logic/contracts/methodIds.ts b/src/logic/contracts/methodIds.ts index 3808b539..1137e2d7 100644 --- a/src/logic/contracts/methodIds.ts +++ b/src/logic/contracts/methodIds.ts @@ -1,4 +1,4 @@ -import { web3ReadOnly } from 'src/logic/wallets/getWeb3' +import { web3ReadOnly as web3 } from 'src/logic/wallets/getWeb3' // SAFE METHODS TO ITS ID // https://github.com/gnosis/safe-contracts/blob/development/test/safeMethodNaming.js @@ -53,7 +53,6 @@ const METHOD_TO_ID = { } export const decodeParamsFromSafeMethod = (data) => { - const web3 = web3ReadOnly const [methodId, params] = [data.slice(0, 10), data.slice(10)] switch (methodId) { @@ -110,7 +109,6 @@ const isSafeMethod = (methodId: string) => { } export const decodeMethods = (data: string) => { - const web3 = web3ReadOnly const [methodId, params] = [data.slice(0, 10), data.slice(10)] if (isSafeMethod(methodId)) { diff --git a/src/logic/tokens/utils/tokenHelpers.ts b/src/logic/tokens/utils/tokenHelpers.ts index b2417e88..b2c3f215 100644 --- a/src/logic/tokens/utils/tokenHelpers.ts +++ b/src/logic/tokens/utils/tokenHelpers.ts @@ -3,7 +3,7 @@ import generateBatchRequests from 'src/logic/contracts/generateBatchRequests' import { getStandardTokenContract, getTokenInfos } from 'src/logic/tokens/store/actions/fetchTokens' import { makeToken } from 'src/logic/tokens/store/model/token' import { ALTERNATIVE_TOKEN_ABI } from 'src/logic/tokens/utils/alternativeAbi' -import { web3ReadOnly } from 'src/logic/wallets/getWeb3' +import { web3ReadOnly as web3 } from 'src/logic/wallets/getWeb3' import { isEmptyData } from 'src/routes/safe/store/actions/transactions/utils/transactionHelpers' export const ETH_ADDRESS = '0x000' @@ -29,8 +29,6 @@ export const isAddressAToken = async (tokenAddress) => { // } catch { // return 'Not a token address' // } - - const web3 = web3ReadOnly const call = await web3.eth.call({ to: tokenAddress, data: web3.utils.sha3('totalSupply()') }) return call !== '0x'