This repository was archived by the owner on Mar 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix 3380: Add AbstractProvider #3451
Merged
+20
−1
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
79ab9f3
add AbstractProvider
odanado 20491df
add test for AbstractProvider
odanado 7682f03
Merge branch '1.x' into fix-3380
ryanio 151dc85
Merge branch '1.x' into fix-3380
ryanio d951cb4
Merge branch '1.x' into fix-3380
ryanio d3ef78e
add interface of sendAsync
odanado 28dc745
fix web3-test.ts
odanado File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I would like to consider the following points
extends EventEmitter
.extends EventEmitter
(Leaving only thesend
function in the interface).extends EventEmitter
and directly define theon
,once
, andremoveListener
functions as well as theWebsocketProviderBase
.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.
My
$0.02
is to separate the core functionality from the subscription functionality. Not all custom providers support subscription features by default. Classes can implement multiple interfaces in TypeScript, so it shouldn't be problematic to export two interfaces.I am not an active contributor to this code-base. This is my opinion only.
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.
Hey @odanado thanks for this PR :) It LGTM. For your 3 points, perhaps just on/once/removeListener is sufficient as the "bare minimum".
What are the types of
WebsocketProviderBase
?Also, in light of recent updates to EIP-1193, there is a new
request
method that would be great to add. I don't think havingsendAsync
would hurt either even though it's deprecated it has more long term support.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.
@ryanio Thank you for the comment.
I didn't know the
request
method of EIP-1193.I thought that the interface of the
AbstractProvider
should be an only ofsend
andsendAsync
.The reasons are as follows.
I think it should define a provider that has methods such as on/once/removeListener/request separately from
AbstractProvider
.