I learned that migrating to ethers.js
is better since [email protected]
is default to that.
But I have an issue when I mint if I remove web3.js
and use Moralis.enableWeb3()
. This is the shortened code:
const web3 = (await Moralis.enableWeb3())
async function mintToken(_uri){
const encodedFunction = web3.eth.abi.encodeFunctionCall({
name: "mintToken",
type: "function",
inputs: [{
type: 'string',
name: 'tokenURI'
}]
}, [_uri]);
Code above return me an error:
It used to work perfectly fine with web3.js
with the following code:
const web3 = new Web3(window.ethereum);
async function mintToken(_uri){
const encodedFunction = web3.eth.abi.encodeFunctionCall({
name: "mintToken",
type: "function",
inputs: [{
type: 'string',
name: 'tokenURI'
}]
}, [_uri]);
Why am I getting an error with ethers.js
?
Thanks advance.