{"version":3,"file":"SnapController-method-action-types.mjs","sourceRoot":"","sources":["../../src/snaps/SnapController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SnapController } from './SnapController';\n\n/**\n * Initialise the SnapController.\n *\n * Currently this method sets up the controller and calls the `onStart` lifecycle hook for all\n * runnable Snaps.\n *\n * @param waitForPlatform - Whether to wait for the platform to be ready before returning.\n */\nexport type SnapControllerInitAction = {\n  type: `SnapController:init`;\n  handler: SnapController['init'];\n};\n\n/**\n * Trigger an update of the registry.\n *\n * As a side-effect, this will _always_ check if preinstalled Snaps can be updated and whether any Snaps need to be blocked/unblocked.\n */\nexport type SnapControllerUpdateRegistryAction = {\n  type: `SnapController:updateRegistry`;\n  handler: SnapController['updateRegistry'];\n};\n\n/**\n * Enables the given snap. A snap can only be started if it is enabled. A snap\n * can only be enabled if it isn't blocked.\n *\n * @param snapId - The id of the Snap to enable.\n */\nexport type SnapControllerEnableSnapAction = {\n  type: `SnapController:enableSnap`;\n  handler: SnapController['enableSnap'];\n};\n\n/**\n * Disables the given snap. A snap can only be started if it is enabled.\n *\n * @param snapId - The id of the Snap to disable.\n * @returns A promise that resolves once the snap has been disabled.\n */\nexport type SnapControllerDisableSnapAction = {\n  type: `SnapController:disableSnap`;\n  handler: SnapController['disableSnap'];\n};\n\n/**\n * Stops the given snap, removes all hooks, closes all connections, and\n * terminates its worker.\n *\n * @param snapId - The id of the Snap to stop.\n * @param statusEvent - The Snap status event that caused the snap to be\n * stopped.\n */\nexport type SnapControllerStopSnapAction = {\n  type: `SnapController:stopSnap`;\n  handler: SnapController['stopSnap'];\n};\n\n/**\n * Stops all running snaps, removes all hooks, closes all connections, and\n * terminates their workers.\n *\n * @param statusEvent - The Snap status event that caused the snap to be\n * stopped.\n */\nexport type SnapControllerStopAllSnapsAction = {\n  type: `SnapController:stopAllSnaps`;\n  handler: SnapController['stopAllSnaps'];\n};\n\n/**\n * Returns whether the given snap is running.\n * Throws an error if the snap doesn't exist.\n *\n * @param snapId - The id of the Snap to check.\n * @returns `true` if the snap is running, otherwise `false`.\n */\nexport type SnapControllerIsSnapRunningAction = {\n  type: `SnapController:isSnapRunning`;\n  handler: SnapController['isSnapRunning'];\n};\n\n/**\n * Returns whether the given snap has been added to state.\n *\n * @param snapId - The id of the Snap to check for.\n * @returns `true` if the snap exists in the controller state, otherwise `false`.\n */\nexport type SnapControllerHasSnapAction = {\n  type: `SnapController:hasSnap`;\n  handler: SnapController['hasSnap'];\n};\n\n/**\n * Gets the snap with the given id if it exists, including all data.\n * This should not be used if the snap is to be serializable, as e.g.\n * the snap sourceCode may be quite large.\n *\n * @param snapId - The id of the Snap to get.\n * @returns The entire snap object from the controller state.\n */\nexport type SnapControllerGetSnapAction = {\n  type: `SnapController:getSnap`;\n  handler: SnapController['getSnap'];\n};\n\n/**\n * Updates the own state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state should be updated.\n * @param newSnapState - The new state of the snap.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n */\nexport type SnapControllerUpdateSnapStateAction = {\n  type: `SnapController:updateSnapState`;\n  handler: SnapController['updateSnapState'];\n};\n\n/**\n * Clears the state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state should be cleared.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n */\nexport type SnapControllerClearSnapStateAction = {\n  type: `SnapController:clearSnapState`;\n  handler: SnapController['clearSnapState'];\n};\n\n/**\n * Gets the own state of the snap with the given id.\n * This is distinct from the state MetaMask uses to manage snaps.\n *\n * @param snapId - The id of the Snap whose state to get.\n * @param encrypted - A flag to indicate whether to use encrypted storage or not.\n * @returns The requested snap state or null if no state exists.\n */\nexport type SnapControllerGetSnapStateAction = {\n  type: `SnapController:getSnapState`;\n  handler: SnapController['getSnapState'];\n};\n\n/**\n * Gets a static auxiliary snap file in a chosen file encoding.\n *\n * @param snapId - The id of the Snap whose state to get.\n * @param path - The path to the requested file.\n * @param encoding - An optional requested file encoding.\n * @returns The file requested in the chosen file encoding or null if the file is not found.\n */\nexport type SnapControllerGetSnapFileAction = {\n  type: `SnapController:getSnapFile`;\n  handler: SnapController['getSnapFile'];\n};\n\n/**\n * Determine if a given Snap ID supports a given minimum version of the Snaps platform\n * by inspecting the platformVersion in the Snap manifest.\n *\n * @param snapId - The Snap ID.\n * @param version - The version.\n * @returns True if the platform version is equal or greater to the passed version, false otherwise.\n */\nexport type SnapControllerIsMinimumPlatformVersionAction = {\n  type: `SnapController:isMinimumPlatformVersion`;\n  handler: SnapController['isMinimumPlatformVersion'];\n};\n\n/**\n * Completely clear the controller's state: delete all associated data,\n * handlers, event listeners, and permissions; tear down all snap providers.\n * Also re-initializes the controller after clearing the state.\n */\nexport type SnapControllerClearStateAction = {\n  type: `SnapController:clearState`;\n  handler: SnapController['clearState'];\n};\n\n/**\n * Removes the given snap from state, and clears all associated handlers\n * and listeners.\n *\n * @param snapId - The id of the Snap.\n * @returns A promise that resolves once the snap has been removed.\n */\nexport type SnapControllerRemoveSnapAction = {\n  type: `SnapController:removeSnap`;\n  handler: SnapController['removeSnap'];\n};\n\n/**\n * Stops the given snaps, removes them from state, and clears all associated\n * permissions, handlers, and listeners.\n *\n * @param snapIds - The ids of the Snaps.\n */\nexport type SnapControllerRemoveSnapsAction = {\n  type: `SnapController:removeSnaps`;\n  handler: SnapController['removeSnaps'];\n};\n\n/**\n * Disconnect the Snap from the given origin, meaning the origin can no longer\n * interact with the Snap until it is reconnected.\n *\n * @param origin - The origin from which to remove the Snap.\n * @param snapId - The id of the snap to remove.\n */\nexport type SnapControllerDisconnectOriginAction = {\n  type: `SnapController:disconnectOrigin`;\n  handler: SnapController['disconnectOrigin'];\n};\n\n/**\n * Checks if a list of permissions are dynamic and allowed to be revoked, if they are they will all be revoked.\n *\n * @param snapId - The snap ID.\n * @param permissionNames - The names of the permissions.\n * @throws If non-dynamic permissions are passed.\n */\nexport type SnapControllerRevokeDynamicSnapPermissionsAction = {\n  type: `SnapController:revokeDynamicSnapPermissions`;\n  handler: SnapController['revokeDynamicSnapPermissions'];\n};\n\n/**\n * Gets all snaps in their truncated format.\n *\n * @returns All installed snaps in their truncated format.\n */\nexport type SnapControllerGetAllSnapsAction = {\n  type: `SnapController:getAllSnaps`;\n  handler: SnapController['getAllSnaps'];\n};\n\n/**\n * Gets all runnable snaps.\n *\n * @returns All runnable snaps.\n */\nexport type SnapControllerGetRunnableSnapsAction = {\n  type: `SnapController:getRunnableSnaps`;\n  handler: SnapController['getRunnableSnaps'];\n};\n\n/**\n * Gets the serialized permitted snaps of the given origin, if any.\n *\n * @param origin - The origin whose permitted snaps to retrieve.\n * @returns The serialized permitted snaps for the origin.\n */\nexport type SnapControllerGetPermittedSnapsAction = {\n  type: `SnapController:getPermittedSnaps`;\n  handler: SnapController['getPermittedSnaps'];\n};\n\n/**\n * Installs the snaps requested by the given origin, returning the snap\n * object if the origin is permitted to install it, and an authorization error\n * otherwise.\n *\n * @param origin - The origin that requested to install the snaps.\n * @param requestedSnaps - The snaps to install.\n * @returns An object of snap ids and snap objects, or errors if a\n * snap couldn't be installed.\n */\nexport type SnapControllerInstallSnapsAction = {\n  type: `SnapController:installSnaps`;\n  handler: SnapController['installSnaps'];\n};\n\n/**\n * Passes a JSON-RPC request object to the RPC handler function of a snap.\n *\n * @param options - A bag of options.\n * @param options.snapId - The ID of the recipient snap.\n * @param options.origin - The origin of the RPC request.\n * @param options.handler - The handler to trigger on the snap for the request.\n * @param options.request - The JSON-RPC request object.\n * @returns The result of the JSON-RPC request.\n */\nexport type SnapControllerHandleRequestAction = {\n  type: `SnapController:handleRequest`;\n  handler: SnapController['handleRequest'];\n};\n\n/**\n * Set the active state of the client. This will trigger the `onActive` or\n * `onInactive` lifecycle hooks for all Snaps.\n *\n * @param active - A boolean indicating whether the client is active or not.\n */\nexport type SnapControllerSetClientActiveAction = {\n  type: `SnapController:setClientActive`;\n  handler: SnapController['setClientActive'];\n};\n\n/**\n * Union of all SnapController action types.\n */\nexport type SnapControllerMethodActions =\n  | SnapControllerInitAction\n  | SnapControllerUpdateRegistryAction\n  | SnapControllerEnableSnapAction\n  | SnapControllerDisableSnapAction\n  | SnapControllerStopSnapAction\n  | SnapControllerStopAllSnapsAction\n  | SnapControllerIsSnapRunningAction\n  | SnapControllerHasSnapAction\n  | SnapControllerGetSnapAction\n  | SnapControllerUpdateSnapStateAction\n  | SnapControllerClearSnapStateAction\n  | SnapControllerGetSnapStateAction\n  | SnapControllerGetSnapFileAction\n  | SnapControllerIsMinimumPlatformVersionAction\n  | SnapControllerClearStateAction\n  | SnapControllerRemoveSnapAction\n  | SnapControllerRemoveSnapsAction\n  | SnapControllerDisconnectOriginAction\n  | SnapControllerRevokeDynamicSnapPermissionsAction\n  | SnapControllerGetAllSnapsAction\n  | SnapControllerGetRunnableSnapsAction\n  | SnapControllerGetPermittedSnapsAction\n  | SnapControllerInstallSnapsAction\n  | SnapControllerHandleRequestAction\n  | SnapControllerSetClientActiveAction;\n"]}