1

I'm simply trying to setup an event listener with web3 and metamask.

  incrementEvent = existingContract.events.Incremented(function(error, event){
                  if (error) console.log(error);
                  console.log("event is: ", event);
                })

Result:

Error: The current provider doesn't support subscriptions: MetamaskInpageProvider
    at Subscription.subscribe (bundle.js:45443)
    at Contract._on (bundle.js:48777)
    at (index):48
    at tryCatcher (bundle.js:44235)
    at Promise._settlePromiseFromHandler (bundle.js:42267)
    at Promise._settlePromise (bundle.js:42325)
    at Promise._settlePromise0 (bundle.js:42370)
    at Promise._settlePromises (bundle.js:42453)
    at bundle.js:39334
    at MutationObserver.<anonymous> (bundle.js:43502)
(index):50 event is: null

How do you listen to contract events with metamask?

1 Answer 1

3

There are some issues with the way metamask handles events currently.

Until those issues are solved you can try use another provider just for handling events. You would need to instantiate another web3 instance with another provider. The provider could be our own node or infura for example.

1
  • 1
    Half year passed, anything new?
    – Richard Fu
    Commented Jul 4, 2018 at 2:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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