Hi! I want to get the token id from default Transfer event in an standard erc721 after minting with Moralis.execute()
I’m using new the Moralis beta which as we know now uses ether.js instead of web3.
With web3 I used the transfer event to get the ID of the token, I used to do this:
window.web3 = await Moralis.enableWeb3();
window.tokenContract = new web3.eth.Contract( ABI, TOKEN_CONTRACT_ADDRESS );
const receipt = await tokenContract.methods
.createItem(uriInfo)
.send({ from: ethereum.selectedAddress })
.then(function(result) {
console.log("RECEIPT RECEIVED!: ", result.events.Transfer.returnValues.tokenId);
return result;
})
Now with the new moralis beta I use the Moralis.execute like this:
const options = {
contractAddress: "0xE52,,,D39f1",
functionName: "createItem",
abi: ABI,
params: {uri: uriInfo,},
};
const transaction = await Moralis.executeFunction(options);
const receipt = await transaction.wait(3);
console.log(receipt);
BUT … i cannot figure out how to get the transfer event to then get the token ID, or the content of any other custom event aswell.
The only thing I get is the name of the event (or any other custom event) but not the content…
Any ideas? thanks in advance!