-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add EIP-1193 compatible provider to AbstractProvider interface #3499
Conversation
28d6203
to
6e058a3
Compare
@@ -19,7 +19,6 @@ | |||
*/ | |||
|
|||
import * as net from 'net'; | |||
import { EventEmitter } from "events" |
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.
👍
packages/web3-core/types/index.d.ts
Outdated
sendAsync(payload: JsonRpcPayload, callback: (error: Error | null, result?: JsonRpcResponse) => void): void; | ||
send?(payload: JsonRpcPayload, callback: (error: Error | null, result?: JsonRpcResponse) => void): void; | ||
request?(args: RequestArguments): Promise<unknown>; |
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.
Purely out of curiosity, what's the behavior of unknown
here when assigning the result? Like, do you have to cast it or it "just works".
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.
Ah yes thanks I'll change to any
since unknown
will force the user to type cast the result and I don't think we need to enforce that.
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!
Description
This PR builds on #3451 by adding a EIP-1193 compatible provider to
AbstractProvider
with the optional methodrequest(args: RequestArguments): Promise<unknown>
.Type of change
Checklist:
npm run dtslint
with success and extended the tests and types if necessary.npm run test:unit
with success.npm run test:cov
and my test cases cover all the lines and branches of the added code.npm run build-all
and tested the resulting files fromdist
folder in a browser.CHANGELOG.md
file in the root folder.