0

I am using Web3 1.3.0. Connecting using Node. Also if I try to enter the name of my Event I get an error saying that event does not exist. This is what I get, shouldn't event have a value ?

I am using Infura.

var web3 = new Web3("wss://rinkeby.infura.io/ws/v3/xxxxxxxxxxx

myContract.getPastEvents('allEvents',{fromBlock:1},function(err,results){
  console.log("err:",err);
  console.log("res:",results);
});

{
    address: '0x822eE9b5D26a45a37885dd2B5A56C45b710C9548',
    blockHash: '0x2c242dab7c5668e998b7f01f8328092caeaaa792ad482b678389ed86dc6bb33d',
    blockNumber: 7319168,
    logIndex: 0,
    removed: false,
    transactionHash: '0x54915f09e41fed2f4b4ec8a96edfd2979621dc3dac1c66dcc1b2d427b6d040e1',
    transactionIndex: 0,
    id: 'log_e45f6e21',
    returnValues: Result {},
    event: undefined,
    signature: null,
    raw: {
      data: '0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000054561676c65000000000000000000000000000000000000000000000000000000',
      topics: [Array]
    }

{
    "address": "0x822eE9b5D26a45a37885dd2B5A56C45b710C9548",
    "blockHash": "0x2c242dab7c5668e998b7f01f8328092caeaaa792ad482b678389ed86dc6bb33d",
    "blockNumber": 7319168,
    "logIndex": 0,
    "removed": false,
    "transactionHash": "0x54915f09e41fed2f4b4ec8a96edfd2979621dc3dac1c66dcc1b2d427b6d040e1",
    "transactionIndex": 0,
    "id": "log_e45f6e21",
    "returnValues": {},
    "signature": null,
    "raw": {
        "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000054561676c65000000000000000000000000000000000000000000000000000000",
        "topics": [
            "0x566651c26d6867f4a0341c33295b297504f1f8445ef05b6a80d7faa24280cd2e",
            "0x0000000000000000000000000000000000000000000000000000000000000060"
        ]
    }
},
3
  • Can you please console.log(JSON.stringify(results, null, 4));? Oct 8 '20 at 4:22
  • Artifacts were compiled with truffle: Truffle v5.1.1 (core: 5.1.1) Solidity v0.5.12 (solc-js) Node v12.13.1 Web3.js v1.2.2 Infura support says wscat returns correctly, and the issue is likely decoding the ABI. Could there be some version conflicts ?
    – Ryan Price
    Oct 15 '20 at 23:02
  • There are 368 events (between 06. and 16. Oct 2020). Without the ABI it is not possible to check the root cause of your problem. So, please provide the ABI of this contract (you find it in the result files of the compiler). If you don't have the ABI anymore, send the source code of your contract or just recompile. Mar 5 at 14:57
0

Well, I could not figure this out. So scrapped it and switched to https://docs.ethers.io/v5/ and life is much better, ethers returns the logs and exposed the events I can extract the data I need. I really would have liked to figure out the solution to continue to use Web3js v.1.x but I could not find answers or support.

0

I believe this is a common problem. It happens when the ABI you're using doesn't match the event being taken, thus resulting in missing information. I run into that issue and that was my solution.

Hope it helps some folk out there :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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