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 support for dynamic user interfaces #1465

Merged
merged 80 commits into from
Jan 23, 2024
Merged

Add support for dynamic user interfaces #1465

merged 80 commits into from
Jan 23, 2024

Conversation

GuillaumeRx
Copy link
Contributor

@GuillaumeRx GuillaumeRx commented Jun 1, 2023

This PR adds the necessary pieces for custom UI V2 and reactive interfaces.

Fixes: #935

  • Creates the necessary permitted methods
    • snap_createInterface
    • snap_updateInterface
    • snap_getInterfaceState
  • Adds a new onUserInput handler
    • Updates the SnapController logic to allow a handler without endowment
  • Creates a new controller SnapInterfaceController responsible of the snap interfaces.
  • Creates the new components for reactive interfaces
    • A Form component
    • An Input component
    • A Button component
  • Add support for dynamic interfaces to onHomePage
  • Test everything

@GuillaumeRx GuillaumeRx changed the title Snaps UI V2 [WIP] Snaps UI V2 Jun 1, 2023
@GuillaumeRx GuillaumeRx force-pushed the gr/snaps-ui-v2 branch 3 times, most recently from 00499a8 to 7f1a35c Compare June 26, 2023 13:43
@socket-security
Copy link

socket-security bot commented Jun 27, 2023

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

@GuillaumeRx GuillaumeRx force-pushed the gr/snaps-ui-v2 branch 2 times, most recently from e093f71 to a81b389 Compare January 3, 2024 10:02
Copy link

codecov bot commented Jan 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f1903db) 96.67% compared to head (3a41c67) 96.77%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1465      +/-   ##
==========================================
+ Coverage   96.67%   96.77%   +0.10%     
==========================================
  Files         313      324      +11     
  Lines        7062     7265     +203     
  Branches     1108     1126      +18     
==========================================
+ Hits         6827     7031     +204     
+ Misses        235      234       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/snaps-controllers/src/test-utils/controller.ts Outdated Show resolved Hide resolved
packages/snaps-sdk/src/types/interface.test.ts Outdated Show resolved Hide resolved
packages/snaps-sdk/src/types/interface.test.ts Outdated Show resolved Hide resolved
packages/snaps-rpc-methods/src/restricted/readInterface.ts Outdated Show resolved Hide resolved
packages/snaps-controllers/src/interface/utils.ts Outdated Show resolved Hide resolved
packages/snaps-controllers/src/interface/utils.ts Outdated Show resolved Hide resolved
packages/snaps-controllers/src/interface/utils.ts Outdated Show resolved Hide resolved
packages/snaps-controllers/src/interface/utils.ts Outdated Show resolved Hide resolved
packages/snaps-controllers/src/snaps/SnapController.ts Outdated Show resolved Hide resolved
packages/snaps-rpc-methods/src/restricted/index.ts Outdated Show resolved Hide resolved
packages/snaps-controllers/src/test-utils/controller.ts Outdated Show resolved Hide resolved
packages/snaps-controllers/src/interface/utils.ts Outdated Show resolved Hide resolved
@GuillaumeRx GuillaumeRx marked this pull request as ready for review January 11, 2024 13:52
@GuillaumeRx GuillaumeRx requested a review from a team as a code owner January 11, 2024 13:52
@GuillaumeRx GuillaumeRx changed the title [WIP] Snaps UI V2 Snaps UI V2 Jan 11, 2024
@MetaMask MetaMask deleted a comment from github-actions bot Jan 12, 2024
@GuillaumeRx GuillaumeRx changed the title Snaps UI V2 Add support for dynamic user interfaces Jan 23, 2024
Copy link
Member

@FrederikBolding FrederikBolding left a comment

Choose a reason for hiding this comment

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

🎉

Copy link
Member

@Mrtenz Mrtenz left a comment

Choose a reason for hiding this comment

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

JSDoc should use the imperative form. I left a few suggestions but this applies to other files too.

error: {
code: -32602,
message:
'Invalid params: At path: ui -- Expected the value to satisfy a union of `object | object | object | object | object | object | object | object | object | object | object | object`, but received: "foo".',
Copy link
Member

Choose a reason for hiding this comment

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

This error message is awful 😅 Probably out of scope for this PR though.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, the UI validation methods need serious work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's the usual superstruct error :( We might want to create a wrapper for those errors

Mrtenz
Mrtenz previously approved these changes Jan 23, 2024
@GuillaumeRx GuillaumeRx merged commit db28fc3 into main Jan 23, 2024
144 checks passed
@GuillaumeRx GuillaumeRx deleted the gr/snaps-ui-v2 branch January 23, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom UI v2
3 participants