I am trying to listen to an approval event in an ERC721 token. On approval, I want to call a function.

const approving = new ethers.Contract(gift.address, abi, signer)
await approving.approve(contractAddress, gift.tokenID)
approving.on('Approval', async() => {
      //await some function

This was the syntax that I used and I am fairly certain that it worked for a while. Now, however, I get the error: "no matching event (argument="name", value="Approval", code=INVALID_ARGUMENT, version=abi/5.6.4)".


1 Answer 1


From docs: https://docs.ethers.org/v5/api/providers/provider/#Provider--events

// This filter could also be generated with the Contract or
// Interface API. If address is not specified, any address
// matches and if topics is not specified, any log matches
filter = {
    topics: [
provider.on(filter, (log, event) => {
    // Emitted whenever approval is given

This is cuz Approval event from IERC721 has following arguments:

event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);


Remember that there is also function setApprovalForAll and different event is emitted ApprovalForAll.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.