1

When I start my app I listen for posts from the latest block. After a post has been made I'm supposed to return author (address), title (string) and an id (uint).

But what I get in the author and id field is always wrong:

returnValues:
Result {
'0': '0xc56d6494E13A21c9fe6959DC3c0F2e95317ec52d',
'1': 'something',
'2': '1404800390165147213522565871758984e835369099666681',
author: '0xc56d6494E13A21c9fe6959DC3c0F2e95317ec52d',
title: 'something',
id: '1404800390165147213522565871758984835369099666681' }

The event listener:

postListener = () => {
    web3s.eth.getBlock('latest').then((latestBlock) => {
        contract.events.Posted({
            filter: {
                author: addressList,
            },
            fromBlock: latestBlock.number,
        }).on('data', function (event) {
            console.log({ event });
        }).on('error', console.error);
    });
}

ABI:

{
    "anonymous": false,
    "inputs": [
        {
            "indexed": true,
            "name": "author",
            "type": "address"
        },
        {
            "indexed": false,
            "name": "title",
            "type": "string"
        },
        {
            "indexed": true,
            "name": "id",
            "type": "uint256"
        }
    ],
    "name": "Posted",
    "type": "event"
}

What I expect is something like:

author: '0xF6116D9AAE20eb8ca881D2D69a0456519Ae524f9',
title: 'something',
id: '10578'

The source of the contract can be found here: https://github.com/WhaleCoinOrg/WhaleNet/blob/followers/contracts/WhaleNetworkV4.sol

0

My "solution" was to delete my node_modules folder and reinstall them all.

  • This didn't working for me – 0TTT0 Feb 27 at 20:08

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.