@metamask/snaps-sdk 9.2.0 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [9.3.0]
11
+
12
+ ### Added
13
+
14
+ - Add support for `onActive` and `onInactive` lifecycle hooks ([#3542](https://github.com/MetaMask/snaps/pull/3542))
15
+ - These hooks are called when the client is activated or deactivated,
16
+ respectively.
17
+
10
18
  ## [9.2.0]
11
19
 
12
20
  ### Added
@@ -638,7 +646,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
638
646
 
639
647
  - Initial release of this package.
640
648
 
641
- [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@9.2.0...HEAD
649
+ [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@9.3.0...HEAD
650
+ [9.3.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@9.2.0...@metamask/snaps-sdk@9.3.0
642
651
  [9.2.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@9.1.0...@metamask/snaps-sdk@9.2.0
643
652
  [9.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@9.0.0...@metamask/snaps-sdk@9.1.0
644
653
  [9.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@8.1.0...@metamask/snaps-sdk@9.0.0
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.cjs","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A lifecycle event handler. This is called whenever a lifecycle event occurs,\n * such as the Snap being installed or updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type LifecycleEventHandler = (args: {\n origin: string;\n}) => Promise<unknown>;\n\n/**\n * The `onInstall` handler. This is called after the Snap is installed.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnInstallHandler = LifecycleEventHandler;\n\n/**\n * The `onUpdate` handler. This is called after the Snap is updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnUpdateHandler = LifecycleEventHandler;\n\n/**\n * The `onStart` handler. This is called when the client is started.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnStartHandler = LifecycleEventHandler;\n"]}
1
+ {"version":3,"file":"lifecycle.cjs","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A lifecycle event handler. This is called whenever a lifecycle event occurs,\n * such as the Snap being installed or updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type LifecycleEventHandler = (args: {\n origin: string;\n}) => Promise<unknown>;\n\n/**\n * The `onInstall` handler. This is called after the Snap is installed.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnInstallHandler = LifecycleEventHandler;\n\n/**\n * The `onUpdate` handler. This is called after the Snap is updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnUpdateHandler = LifecycleEventHandler;\n\n/**\n * The `onStart` handler. This is called when the client is started.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnStartHandler = LifecycleEventHandler;\n\n/**\n * The `onActive` handler. This is called when the client becomes active.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnActiveHandler = LifecycleEventHandler;\n\n/**\n * The `onInactive` handler. This is called when the client becomes inactive.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnInactiveHandler = LifecycleEventHandler;\n"]}
@@ -47,4 +47,28 @@ export type OnUpdateHandler = LifecycleEventHandler;
47
47
  * @param args.origin - The origin that triggered the lifecycle event hook.
48
48
  */
49
49
  export type OnStartHandler = LifecycleEventHandler;
50
+ /**
51
+ * The `onActive` handler. This is called when the client becomes active.
52
+ *
53
+ * Note that using this handler requires the `endowment:lifecycle-hooks`
54
+ * permission.
55
+ *
56
+ * This type is an alias for {@link LifecycleEventHandler}.
57
+ *
58
+ * @param args - The request arguments.
59
+ * @param args.origin - The origin that triggered the lifecycle event hook.
60
+ */
61
+ export type OnActiveHandler = LifecycleEventHandler;
62
+ /**
63
+ * The `onInactive` handler. This is called when the client becomes inactive.
64
+ *
65
+ * Note that using this handler requires the `endowment:lifecycle-hooks`
66
+ * permission.
67
+ *
68
+ * This type is an alias for {@link LifecycleEventHandler}.
69
+ *
70
+ * @param args - The request arguments.
71
+ * @param args.origin - The origin that triggered the lifecycle event hook.
72
+ */
73
+ export type OnInactiveHandler = LifecycleEventHandler;
50
74
  //# sourceMappingURL=lifecycle.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC"}
1
+ {"version":3,"file":"lifecycle.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC"}
@@ -47,4 +47,28 @@ export type OnUpdateHandler = LifecycleEventHandler;
47
47
  * @param args.origin - The origin that triggered the lifecycle event hook.
48
48
  */
49
49
  export type OnStartHandler = LifecycleEventHandler;
50
+ /**
51
+ * The `onActive` handler. This is called when the client becomes active.
52
+ *
53
+ * Note that using this handler requires the `endowment:lifecycle-hooks`
54
+ * permission.
55
+ *
56
+ * This type is an alias for {@link LifecycleEventHandler}.
57
+ *
58
+ * @param args - The request arguments.
59
+ * @param args.origin - The origin that triggered the lifecycle event hook.
60
+ */
61
+ export type OnActiveHandler = LifecycleEventHandler;
62
+ /**
63
+ * The `onInactive` handler. This is called when the client becomes inactive.
64
+ *
65
+ * Note that using this handler requires the `endowment:lifecycle-hooks`
66
+ * permission.
67
+ *
68
+ * This type is an alias for {@link LifecycleEventHandler}.
69
+ *
70
+ * @param args - The request arguments.
71
+ * @param args.origin - The origin that triggered the lifecycle event hook.
72
+ */
73
+ export type OnInactiveHandler = LifecycleEventHandler;
50
74
  //# sourceMappingURL=lifecycle.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC"}
1
+ {"version":3,"file":"lifecycle.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.mjs","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A lifecycle event handler. This is called whenever a lifecycle event occurs,\n * such as the Snap being installed or updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type LifecycleEventHandler = (args: {\n origin: string;\n}) => Promise<unknown>;\n\n/**\n * The `onInstall` handler. This is called after the Snap is installed.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnInstallHandler = LifecycleEventHandler;\n\n/**\n * The `onUpdate` handler. This is called after the Snap is updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnUpdateHandler = LifecycleEventHandler;\n\n/**\n * The `onStart` handler. This is called when the client is started.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnStartHandler = LifecycleEventHandler;\n"]}
1
+ {"version":3,"file":"lifecycle.mjs","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A lifecycle event handler. This is called whenever a lifecycle event occurs,\n * such as the Snap being installed or updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type LifecycleEventHandler = (args: {\n origin: string;\n}) => Promise<unknown>;\n\n/**\n * The `onInstall` handler. This is called after the Snap is installed.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnInstallHandler = LifecycleEventHandler;\n\n/**\n * The `onUpdate` handler. This is called after the Snap is updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnUpdateHandler = LifecycleEventHandler;\n\n/**\n * The `onStart` handler. This is called when the client is started.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnStartHandler = LifecycleEventHandler;\n\n/**\n * The `onActive` handler. This is called when the client becomes active.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnActiveHandler = LifecycleEventHandler;\n\n/**\n * The `onInactive` handler. This is called when the client becomes inactive.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnInactiveHandler = LifecycleEventHandler;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/snaps-sdk",
3
- "version": "9.2.0",
3
+ "version": "9.3.0",
4
4
  "description": "A library containing the core functionality for building MetaMask Snaps",
5
5
  "keywords": [
6
6
  "MetaMask",