ExecutionService Actions
4 actions registered.
| Name | Deprecated |
|---|---|
executeSnap | |
handleRpcRequest | |
terminateAllSnaps | |
terminateSnap |
ExecutionService:executeSnap
Package: @metamask/snaps-controllers
Initializes and executes a Snap, setting up the communication channels to the Snap etc.
Parameters:
| Name | Description |
|---|---|
snapData | Data needed for Snap execution. |
snapData.snapId | The ID of the Snap to execute. |
snapData.sourceCode | The source code of the Snap to execute. |
snapData.endowments | The endowments available to the executing Snap. |
Returns: A string OK if execution succeeded.
Handler signature:
({ snapId, sourceCode, endowments, }: SnapExecutionData) => Promise<string>
ExecutionService:handleRpcRequest
Package: @metamask/snaps-controllers
Handle RPC request.
Parameters:
| Name | Description |
|---|---|
snapId | The ID of the recipient Snap. |
options | Bag of options to pass to the RPC handler. |
Returns: Promise that can handle the request.
Handler signature:
(snapId: string, options: SnapRpcHookArgs) => Promise<unknown>
ExecutionService:terminateAllSnaps
Package: @metamask/snaps-controllers
Handler signature:
() => Promise<void>
ExecutionService:terminateSnap
Package: @metamask/snaps-controllers
Terminates the Snap with the specified ID and deletes all its associated data. Any subsequent messages targeting the Snap will fail with an error. Throws an error if termination fails unexpectedly.
Parameters:
| Name | Description |
|---|---|
snapId | The id of the Snap to be terminated. |
Handler signature:
(snapId: string) => Promise<void>