-
Notifications
You must be signed in to change notification settings - Fork 894
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
Implement eth_subscribe newHeads #16318
Conversation
Can we also update https://github.com/bbondy/eth-manual-tests and add test plan for QA using it? |
I considered first adding websocket support and then using Infura, but then eth_subscribe wouldn't be supported for user's HTTPS configured RPC endpoints. So I'm starting here with querying for block updates via the block tracker. .
60e51cb
to
c5e5437
Compare
Yep, I'll do that today. |
Added the test plan above and made a pull request for that here: bbondy/eth-manual-tests#5 |
Brave Wallet docs PR: brave/brave-wallet-docs#84 |
|
This adds support for a new
eth_subscribe
method that can be used in Ethereum provider requests.See a description of this here: https://docs.infura.io/infura/networks/ethereum/json-rpc-methods/subscription-methods/eth_subscribe
This implementation only supports
newHeads
for now.There's a follow up issue in brave/brave-browser#27283 for supporting the
"logs"
param.These params are not currently supported by MM at the time of this writing, so they are probably not used in the wild and we can sit on the implementation for now:
"newPendingTransactions"
and"syncing""
.As an alternative to this implementation, I considered first adding websocket support and then using Infura, but then eth_subscribe wouldn't be supported for user's HTTPS configured RPC endpoints. So I'm starting here with querying for block updates via the block tracker.
If approved I will do another pull request for wallet-docs.
Resolves brave/brave-browser#21350
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
eth_subscribe
to listen for new block head. You should see a console message in the developer console matching the same subscription ID every 20 seconds. You can subscribe multiple times, each time will give a new subscription ID.eth_unsubscribe
to stop listening to an event by putting the subscription ID from theeth_subscribe
call. It should stop ending events and return true to the console when you unsubscribe successfully from something.