I encountered the same error. Itβs because somewhere in your code Moralis.enableWeb()
is called more than once, and moreover at (almost) the same time.
It happened to me on a page that loads the same Component multiple times, where each Component was using this to init the contract:
onMounted (async () => {
const ethers = Moralis.web3Library
const web3 = await Moralis.enableWeb3()
try {
contract.value = await new ethers.Contract(props.collection.attributes.token_contract, JSON.parse(props.collection.attributes.token_abi), web3)
getBaseUri()
} catch (err) {
console.log(err)
}
})
The fix for me is not to call Moralis.enableWeb3()
but use Moralis.web3
directly, as it was already initialized somewhere else:
onMounted (async () => {
const ethers = Moralis.web3Library
const web3 = Moralis.web3
try {
contract.value = await new ethers.Contract(props.collection.attributes.token_contract, JSON.parse(props.collection.attributes.token_abi), web3)
getBaseUri()
} catch (err) {
console.log(err)
}
})