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

Add EIP-1193 compatible provider to AbstractProvider interface #3499

Merged
merged 2 commits into from
May 7, 2020

Conversation

ryanio
Copy link
Collaborator

@ryanio ryanio commented May 5, 2020

Description

This PR builds on #3451 by adding a EIP-1193 compatible provider to AbstractProvider with the optional method request(args: RequestArguments): Promise<unknown>.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build-all and tested the resulting files from dist folder in a browser.
  • I have updated the CHANGELOG.md file in the root folder.
  • I have tested my code on the live network.

@ryanio ryanio added 1.x 1.0 related issues EIP 1193 labels May 5, 2020
@ryanio ryanio force-pushed the addEIP1193 branch 3 times, most recently from 28d6203 to 6e058a3 Compare May 6, 2020 18:18
@cgewecke cgewecke added this to In progress in v1.2.8 May 6, 2020
@ryanio ryanio added the Review Needed Maintainer(s) need to review label May 6, 2020
@@ -19,7 +19,6 @@
*/

import * as net from 'net';
import { EventEmitter } from "events"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ryanio ryanio moved this from In progress to Review in v1.2.8 May 7, 2020
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>;
Copy link
Collaborator

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".

Copy link
Collaborator Author

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.

cgewecke
cgewecke previously approved these changes May 7, 2020
Copy link
Collaborator

@cgewecke cgewecke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ryanio ryanio merged commit e8b7a3f into 1.x May 7, 2020
@holgerd77 holgerd77 deleted the addEIP1193 branch May 8, 2020 06:44
@cgewecke cgewecke moved this from Review to Done in v1.2.8 May 8, 2020
@ryanio ryanio mentioned this pull request May 8, 2020
13 tasks
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 Review Needed Maintainer(s) need to review
Projects
No open projects
v1.2.8
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants