-
Notifications
You must be signed in to change notification settings - Fork 618
Closed
Labels
area-capabilitiesRelated to the kinds of things that snaps are able to do.Related to the kinds of things that snaps are able to do.type-enhancementNew feature or requestNew feature or requesttype-researchA research task.A research task.
Description
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 theget
operation.await snap.request({ method: 'snap_getState', params: { key: 'foo' } });
snap_setState
, similar to theupdate
operation, whereparams
is the new state.await snap.request({ method: 'snap_setState', params: { key: 'foo', value: 1 } });
snap_clearState
, similar to theclear
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.
Metadata
Metadata
Assignees
Labels
area-capabilitiesRelated to the kinds of things that snaps are able to do.Related to the kinds of things that snaps are able to do.type-enhancementNew feature or requestNew feature or requesttype-researchA research task.A research task.