1

I developed contract with couple of events. It was tested using local geth node and working as expected. Now I want to deploy it and decided to use infura.io as public node provider.

Here I faced show stopping issue: infura provides only limited set or RPC calls and newFilter isn't included in this list. I see that while subscribing to events on my contract first web3 sends eth_newFilter call that failed.

I suspect that I can safely remove filter statement from my contract definition:

this.contract.logWinner({fromBlock:'latest'}).watch(this.onWinner.bind(this));

and replace it with

this.contract.logWinner({}).watch(this.onWinner.bind(this));

but newFilter function still calling and crashed app.

My question: could I avoid somehow calling for eth.newfilter?

-1

Instead of infura.io API which does not support eth_newFilter you can use etherscan.io API.

For example here is how to get EOS Transfer events:

const api = "https://api.etherscan.io/api?module=logs&action=getLogs";
const range = "&fromBlock=379224&toBlock=latest";
const addr = "&address=0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0";
const topic = "&topic0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef";
fetch(api + range + addr + topic).then(r => r.json).then(console.log);
  • I do not need to call 3rd party API at all. My question was about absolutely different case. – Alex G.P. Sep 4 '17 at 16:04
  • Why you are mentioning "show stopping issue: infura provides only limited set or RPC calls" then? – max taldykin Sep 4 '17 at 17:56

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.