-
Notifications
You must be signed in to change notification settings - Fork 871
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
Implemented Support eth_subscribe with logs param #16633
Implemented Support eth_subscribe with logs param #16633
Conversation
|
1 similar comment
|
a17df89
to
cbc12f7
Compare
|
cbc12f7
to
57d5d5b
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
|
Signed-off-by: Vadym Struts <vstruts@brave.com>
Signed-off-by: Vadym Struts <vstruts@brave.com>
57d5d5b
to
0df37f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This extends support for a
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
In addition to previously implemented
newHeads
(brave/brave-browser#21350), this adds newlogs
parameter support, but for now filtering options is not supported. It requires the follow up implementationResolves brave/brave-browser#27283
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:
Use
eth_subscribe
to listen for new logs. 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.Ex:
window.ethereum.on('message', (x, y, z) => console.log('message event: ', x, y, z)) window.ethereum.send({ id:5, method: 'eth_subscribe', params:["logs"]}, console.log)
Use
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.window.ethereum.on('message', (x, y, z) => console.log('message event: ', x, y, z)) window.ethereum.send({ id:5, method: 'eth_unsubscribe', params:["0x0b4fcbf913cf950c936489965ba189df"]}, console.log)
where
0x0b4fcbf913cf950c936489965ba189df
- subscription identifier returned by subscription method