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

Separate snap_manageState into separate functions snap_getState, snap_setState, and snap_clearState #1287

Closed
Mrtenz opened this issue Mar 20, 2023 · 3 comments
Assignees
Labels
area-capabilities Related to the kinds of things that snaps are able to do. type-enhancement New feature or request type-research A research task.

Comments

@Mrtenz
Copy link
Member

Mrtenz commented Mar 20, 2023

The snap_manageState API is a bit strange currently, because you have to specify an operation for each request. It's better if the method was separated into three separate methods:

  • snap_getState, similar to the get operation.
    await snap.request({ method: 'snap_getState', params: { key: 'foo' } });
  • snap_setState, similar to the update operation, whereparams is the new state.
    await snap.request({ method: 'snap_setState', params: { key: 'foo', value: 1 } });
  • snap_clearState, similar to the clear operation.
    await snap.request({ method: 'snap_clearState' });

snap_manageState can be deprecated, and mapped internally to one of the methods above, depending on the operation.

Right now we only have one-to-one mappings for permissions to their respective JSON-RPC methods. In order to accomplish the above, while using a single permission, we need to have a way to map one-to-many, from a single storage permission to all the methods above.

@Mrtenz Mrtenz added type-enhancement New feature or request type-research A research task. area-capabilities Related to the kinds of things that snaps are able to do. labels Mar 20, 2023
@hmalik88 hmalik88 self-assigned this Apr 5, 2023
@kenhkan
Copy link

kenhkan commented May 24, 2023

From refinement:

  • PermissionController work needed.
  • Hassan to continue work next sprint.
  • Make ourselves the CODEOWNERS for PermissionController, RateLimiterController, NotificationController

@kenhkan
Copy link

kenhkan commented May 25, 2023

@hmalik88 hmalik88 self-assigned this Jun 22, 2023
@Mrtenz Mrtenz assigned Mrtenz and unassigned hmalik88 Dec 9, 2024
@Mrtenz
Copy link
Member Author

Mrtenz commented Dec 19, 2024

Done in #2916.

@Mrtenz Mrtenz closed this as completed Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-capabilities Related to the kinds of things that snaps are able to do. type-enhancement New feature or request type-research A research task.
Projects
None yet
Development

No branches or pull requests

3 participants