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

Feature: Make safe-app-provider follow eip1193 standard #140

Merged
merged 9 commits into from
Apr 26, 2021

Conversation

mmv08
Copy link
Member

@mmv08 mmv08 commented Apr 23, 2021

It turned out that our provider is not https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md compatible. In particular, it was missing events system, and connect/disconnect functionality. This PR fixes it

@github-actions
Copy link
Contributor

CLA Assistant Lite All Contributors have signed the CLA.

@mmv08 mmv08 requested review from rmeissner and germartinez April 23, 2021 15:19
@github-actions
Copy link
Contributor

github-actions bot commented Apr 23, 2021

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 13 0
Ignored 0 N/A
  • Result: ✅ success

  • Annotations: 13 total


[warning] @typescript-eslint/explicit-module-boundary-types

Require explicit return and argument types on exported functions' and classes' public class methods


[warning] @typescript-eslint/no-explicit-any

Disallow usage of the any type


Report generated by eslint-plus-action


constructor(safe: SafeInfo, sdk: SafeAppsSDK) {
this.safe = safe;
this.sdk = sdk;
}

public get chainId(): number {
return NETWORK_CHAIN_ID[this.safe.network];
async connect(): Promise<void> {
Copy link
Member

Choose a reason for hiding this comment

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

If the implementation of this method returns null, is it following the specification regarding Connectivity?
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#connectivity

Copy link
Member Author

@mmv08 mmv08 Apr 26, 2021

Choose a reason for hiding this comment

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

It doesn't really specify what should be returned. Also, it doesn't return null, it returns nothing (that defaults to undefined). I can see the only possible things are the connect/disconnect events, but I don't think they make much sense for the safe provider because of its somewhat unique usage.

Copy link
Member

@rmeissner rmeissner Apr 26, 2021

Choose a reason for hiding this comment

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

Also shouldn't we emit the ProviderConnectInfo at least once? (see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#connect)

// eslint-disable-next-line @typescript-eslint/no-explicit-any
sendAsync(request: any, callback: (error: any, response: any) => void): void {
this.send(request, callback);
async disconnect(): Promise<void> {
Copy link
Member

Choose a reason for hiding this comment

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

If the implementation of this method returns null, is it following the specification regarding Connectivity?
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#connectivity

Copy link
Member

Choose a reason for hiding this comment

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

As this provider cannot disconnect, doing nothing is expected here. (Maybe we should comment this)

@mmv08 mmv08 merged commit 1a60b5f into development Apr 26, 2021
@mmv08 mmv08 deleted the bug/safe-app-provider-on-listener branch April 26, 2021 14:03
@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants