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

RequestManager depends on deprecated event when used with MetaMask #3651

Closed
rekmarks opened this issue Jul 21, 2020 · 7 comments · Fixed by #3864
Closed

RequestManager depends on deprecated event when used with MetaMask #3651

rekmarks opened this issue Jul 21, 2020 · 7 comments · Fixed by #3864
Assignees
Labels
1.x 1.0 related issues Bug Addressing a bug

Comments

@rekmarks
Copy link

Refs: https://github.com/ethereum/web3.js/blob/1.x/packages/web3-core-requestmanager/src/index.js#L101-L108

web3-core-requestmanager depends on the provider data event, and makes assumptions about its state. I'm not sure if this even was ever intended for consumer usage in the misty past, but by now, it's superfluous.

For MetaMask providers (ethereum.isMetaMask && typeof ethereum.request === 'function'), please use the EIP-1193 message event, described in our docs: https://docs.metamask.io/guide/ethereum-provider.html#message

The message event emits with an object of the form { method: string, data: any }. For method === 'eth_subscription', the result is given as data.result.

@GregTheGreek GregTheGreek added 1.x 1.0 related issues Bug Addressing a bug labels Jul 22, 2020
@GregTheGreek
Copy link
Contributor

Thanks for this catch! We've been looking into ways to add further e2e tests with metamask to help catch these bugs (the new release caused a few issues).

Right now we're thinking about using the mm app example and integrating it to our existing UI test, but it is ultimately a manual process. Any ideas on potentially automating it?

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

@github-actions github-actions bot added the Stale Has not received enough activity label Oct 27, 2020
@GregTheGreek GregTheGreek removed the Stale Has not received enough activity label Oct 27, 2020
@GregTheGreek
Copy link
Contributor

@koraykoska

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

@github-actions github-actions bot added the Stale Has not received enough activity label Jan 11, 2021
@GregTheGreek GregTheGreek removed the Stale Has not received enough activity label Jan 11, 2021
@rekmarks
Copy link
Author

The breaking changes (extension version ^9.0.0) are live on Firefox, and are rolling out to Chrome right now. We are receiving reports of broken subscriptions using web3@^1.3.0.

@rekmarks
Copy link
Author

rekmarks commented Jan 19, 2021

See the following snippet for where we emit the relevant events: https://github.com/MetaMask/inpage-provider/blob/d474406b2d8a99b8303e5e269a86dd5a070c7963/src/MetaMaskInpageProvider.ts/#L269-L276

You should use the message event, per EIP-1193: https://eips.ethereum.org/EIPS/eip-1193#message

@rekmarks
Copy link
Author

rekmarks commented Jan 19, 2021

The following PR should fix it, although I haven't tested it. Feel free to edit/adopt/re-implement as required: #3864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants