I am trying to run an example blockchain explorer using testrpc, truffle, webpack and am running into errors.

I am unable to get asynchronous functions to work with Metamask plugin, for example, I am unable to run web3.eth.getBlockNumber.

I tried using filter.watch as explained in some forums but no luck. Can someone help?? I am using code from this example - https://www.codeooze.com/blockchain/ethereum-block-explorer-react-02/

I used filter.watch like this,

filter.watch((error,result) =>{
const block = web3.eth.getBlock(result, true)
this.setState({curr_block: block.number})
})

I used this solution from How to map a web3 to a react.js state

I was able to add a callback but it doesn't help me capture the return value in a variable. How can I capture the return value using filter.watch?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.