Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth.filter.watch is returning null instead of data provided by Geth #167

Closed
ethers opened this issue Apr 17, 2015 · 2 comments
Closed

eth.filter.watch is returning null instead of data provided by Geth #167

ethers opened this issue Apr 17, 2015 · 2 comments

Comments

@ethers
Copy link
Contributor

ethers commented Apr 17, 2015

Geth develop 4020258 and web3.js develop 271b00f

eth.filter.watch is returning null instead of data provided by Geth

Here's the data returned by Geth, which is correct:

I0417 14:44:02.366721    2668 api.go:42] eth_getFilterChanges ["0xa"]
I0417 14:44:02.366922    2668 http.go:114] Generated response: *rpc.RpcSuccessResponse &{%!s(float64=48) 2.0 [{0x50e4d8b5a5568bb8039f14ef990b3878c0984907 [0x000000000000000000000000cd2a3d9f938e13cd947ec05abc7fe734df8dd826] 0x0000000000000000000000000000000000000000000000000000000000000001 0x1ced9 0x0 0x59f55ebbd1a1cfddcee7221667c4fffce761105adc6fe8311e0064ef0473e420 0xd07e7d44b2741afa2ed29ff18d25a145b4c00a8a79179bc0bd3fdf038757a5b9 0x0}]}
I0417 14:44:02.367159    2668 http.go:125] Sending payload: [
    {
        "id": 48,
        "jsonrpc": "2.0",
        "result": [
            {
                "address": "0x50e4d8b5a5568bb8039f14ef990b3878c0984907",
                "topics": [
                    "0x000000000000000000000000cd2a3d9f938e13cd947ec05abc7fe734df8dd826"
                ],
                "data": "0x0000000000000000000000000000000000000000000000000000000000000001",
                "blockNumber": "0x1ced9",
                "logIndex": "0x0",
                "blockHash": "0x59f55ebbd1a1cfddcee7221667c4fffce761105adc6fe8311e0064ef0473e420",
                "transactionHash": "0xd07e7d44b2741afa2ed29ff18d25a145b4c00a8a79179bc0bd3fdf038757a5b9",
                "transactionIndex": "0x0"
            }
        ]
    }
]

Here's the JS:
gExchangeContractAddr is 0x50e4d8b5a5568bb8039f14ef990b3878c0984907

web3.eth.filter({'address': gExchangeContractAddr}).watch(function(res) {
  console.log(res)
});

In Chrome console, "null" is logged, instead of the data returned by Geth. Appears to be a regression as it worked several weeks ago.

@frozeman
Copy link
Contributor

Thanks for the hint. Actually you need to provide an error first callback. Try:

web3.eth.filter({'address': gExchangeContractAddr}).watch(function(err, res) {
  console.log(res)
});

The docs are outdated, i will update those. Thanks for the hint.

@ethers
Copy link
Contributor Author

ethers commented Apr 21, 2015

thx 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants