Skip to main content
added 448 characters in body
Source Link

I want to get the value from the first indexed parameter of the TokensTransferred event from the transaction logs which can look like this. You can see that the TokensTransferred event has the first indexed parameter as bytes32[]. I want to get values from this array.

I tried out this solution but it gave the error that Interface is not a constructor. Does anyone know what I am doing wrong? How can I get the values from the bytes32[] that are emitted from the event in Ethers.js?

I am trying to get the array like this:

contract.on('TokensTransferred',(messageId)=>{
        console.log("Message Id: ",messageId);
        const iface = new ethers.utils.Interface(fromNetwork?.abi);

        console.log("Decoded Message Ids: ",iface.parseLog([messageId?.hash]));
  }

but still this is giving me this error:

TypeError: Cannot read properties of undefined (reading '0')
    at Interface.parseLog 

I want to get the value from the first indexed parameter of the TokensTransferred event from the transaction logs which can look like this. You can see that the TokensTransferred event has the first indexed parameter as bytes32[]. I want to get values from this array.

I tried out this solution but it gave the error that Interface is not a constructor. Does anyone know what I am doing wrong? How can I get the values from the bytes32[] that are emitted from the event in Ethers.js?

I want to get the value from the first indexed parameter of the TokensTransferred event from the transaction logs which can look like this. You can see that the TokensTransferred event has the first indexed parameter as bytes32[]. I want to get values from this array.

I tried out this solution but it gave the error that Interface is not a constructor. Does anyone know what I am doing wrong? How can I get the values from the bytes32[] that are emitted from the event in Ethers.js?

I am trying to get the array like this:

contract.on('TokensTransferred',(messageId)=>{
        console.log("Message Id: ",messageId);
        const iface = new ethers.utils.Interface(fromNetwork?.abi);

        console.log("Decoded Message Ids: ",iface.parseLog([messageId?.hash]));
  }

but still this is giving me this error:

TypeError: Cannot read properties of undefined (reading '0')
    at Interface.parseLog 
Source Link

Ethers is not decoding the indexed parameters

I want to get the value from the first indexed parameter of the TokensTransferred event from the transaction logs which can look like this. You can see that the TokensTransferred event has the first indexed parameter as bytes32[]. I want to get values from this array.

I tried out this solution but it gave the error that Interface is not a constructor. Does anyone know what I am doing wrong? How can I get the values from the bytes32[] that are emitted from the event in Ethers.js?