@metamask/snaps-simulation 4.3.0 → 4.3.2

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.
Files changed (162) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/dist/controllers.cjs +3 -4
  3. package/dist/controllers.cjs.map +1 -1
  4. package/dist/controllers.mjs +1 -1
  5. package/dist/controllers.mjs.map +1 -1
  6. package/dist/files.cjs +4 -5
  7. package/dist/files.cjs.map +1 -1
  8. package/dist/helpers.cjs +1 -2
  9. package/dist/helpers.cjs.map +1 -1
  10. package/dist/interface.cjs +18 -19
  11. package/dist/interface.cjs.map +1 -1
  12. package/dist/interface.d.cts +2 -2
  13. package/dist/interface.d.cts.map +1 -1
  14. package/dist/interface.d.mts +2 -2
  15. package/dist/interface.d.mts.map +1 -1
  16. package/dist/interface.mjs +2 -2
  17. package/dist/interface.mjs.map +1 -1
  18. package/dist/logger.d.cts +0 -1
  19. package/dist/logger.d.cts.map +1 -1
  20. package/dist/logger.d.mts +0 -1
  21. package/dist/logger.d.mts.map +1 -1
  22. package/dist/methods/hooks/chain.cjs +1 -2
  23. package/dist/methods/hooks/chain.cjs.map +1 -1
  24. package/dist/methods/hooks/chain.d.cts +12 -1
  25. package/dist/methods/hooks/chain.d.cts.map +1 -1
  26. package/dist/methods/hooks/chain.d.mts +12 -1
  27. package/dist/methods/hooks/chain.d.mts.map +1 -1
  28. package/dist/methods/hooks/end-trace.cjs +1 -2
  29. package/dist/methods/hooks/end-trace.cjs.map +1 -1
  30. package/dist/methods/hooks/end-trace.d.cts +12 -1
  31. package/dist/methods/hooks/end-trace.d.cts.map +1 -1
  32. package/dist/methods/hooks/end-trace.d.mts +12 -1
  33. package/dist/methods/hooks/end-trace.d.mts.map +1 -1
  34. package/dist/methods/hooks/get-mnemonic.cjs +1 -2
  35. package/dist/methods/hooks/get-mnemonic.cjs.map +1 -1
  36. package/dist/methods/hooks/get-mnemonic.d.cts.map +1 -1
  37. package/dist/methods/hooks/get-mnemonic.d.mts.map +1 -1
  38. package/dist/methods/hooks/get-preferences.cjs +1 -2
  39. package/dist/methods/hooks/get-preferences.cjs.map +1 -1
  40. package/dist/methods/hooks/get-snap.cjs +1 -2
  41. package/dist/methods/hooks/get-snap.cjs.map +1 -1
  42. package/dist/methods/hooks/get-snap.d.cts.map +1 -1
  43. package/dist/methods/hooks/get-snap.d.mts.map +1 -1
  44. package/dist/methods/hooks/notifications.cjs +2 -3
  45. package/dist/methods/hooks/notifications.cjs.map +1 -1
  46. package/dist/methods/hooks/notifications.d.cts +26 -2
  47. package/dist/methods/hooks/notifications.d.cts.map +1 -1
  48. package/dist/methods/hooks/notifications.d.mts +26 -2
  49. package/dist/methods/hooks/notifications.d.mts.map +1 -1
  50. package/dist/methods/hooks/permitted/state.cjs +3 -4
  51. package/dist/methods/hooks/permitted/state.cjs.map +1 -1
  52. package/dist/methods/hooks/permitted/state.d.cts +31 -3
  53. package/dist/methods/hooks/permitted/state.d.cts.map +1 -1
  54. package/dist/methods/hooks/permitted/state.d.mts +31 -3
  55. package/dist/methods/hooks/permitted/state.d.mts.map +1 -1
  56. package/dist/methods/hooks/request-user-approval.cjs +1 -2
  57. package/dist/methods/hooks/request-user-approval.cjs.map +1 -1
  58. package/dist/methods/hooks/request-user-approval.d.cts +15 -1
  59. package/dist/methods/hooks/request-user-approval.d.cts.map +1 -1
  60. package/dist/methods/hooks/request-user-approval.d.mts +15 -1
  61. package/dist/methods/hooks/request-user-approval.d.mts.map +1 -1
  62. package/dist/methods/hooks/start-trace.cjs +1 -2
  63. package/dist/methods/hooks/start-trace.cjs.map +1 -1
  64. package/dist/methods/hooks/start-trace.d.cts +12 -1
  65. package/dist/methods/hooks/start-trace.d.cts.map +1 -1
  66. package/dist/methods/hooks/start-trace.d.mts +12 -1
  67. package/dist/methods/hooks/start-trace.d.mts.map +1 -1
  68. package/dist/methods/hooks/state.cjs +3 -4
  69. package/dist/methods/hooks/state.cjs.map +1 -1
  70. package/dist/methods/hooks/state.d.cts +37 -3
  71. package/dist/methods/hooks/state.d.cts.map +1 -1
  72. package/dist/methods/hooks/state.d.mts +37 -3
  73. package/dist/methods/hooks/state.d.mts.map +1 -1
  74. package/dist/methods/hooks/track-error.cjs +1 -2
  75. package/dist/methods/hooks/track-error.cjs.map +1 -1
  76. package/dist/methods/hooks/track-error.d.cts +11 -1
  77. package/dist/methods/hooks/track-error.d.cts.map +1 -1
  78. package/dist/methods/hooks/track-error.d.mts +11 -1
  79. package/dist/methods/hooks/track-error.d.mts.map +1 -1
  80. package/dist/methods/hooks/track-event.cjs +1 -2
  81. package/dist/methods/hooks/track-event.cjs.map +1 -1
  82. package/dist/methods/hooks/track-event.d.cts +12 -5
  83. package/dist/methods/hooks/track-event.d.cts.map +1 -1
  84. package/dist/methods/hooks/track-event.d.mts +12 -5
  85. package/dist/methods/hooks/track-event.d.mts.map +1 -1
  86. package/dist/methods/specifications.cjs +4 -5
  87. package/dist/methods/specifications.cjs.map +1 -1
  88. package/dist/middleware/engine.cjs +1 -2
  89. package/dist/middleware/engine.cjs.map +1 -1
  90. package/dist/middleware/internal-methods/accounts.cjs +1 -2
  91. package/dist/middleware/internal-methods/accounts.cjs.map +1 -1
  92. package/dist/middleware/internal-methods/chain-id.cjs +1 -2
  93. package/dist/middleware/internal-methods/chain-id.cjs.map +1 -1
  94. package/dist/middleware/internal-methods/middleware.cjs +1 -2
  95. package/dist/middleware/internal-methods/middleware.cjs.map +1 -1
  96. package/dist/middleware/internal-methods/net-version.cjs +1 -2
  97. package/dist/middleware/internal-methods/net-version.cjs.map +1 -1
  98. package/dist/middleware/internal-methods/switch-ethereum-chain.cjs +1 -2
  99. package/dist/middleware/internal-methods/switch-ethereum-chain.cjs.map +1 -1
  100. package/dist/middleware/mock.cjs +1 -2
  101. package/dist/middleware/mock.cjs.map +1 -1
  102. package/dist/middleware/multichain/create-session.cjs +1 -2
  103. package/dist/middleware/multichain/create-session.cjs.map +1 -1
  104. package/dist/middleware/multichain/create-session.d.cts +1 -1
  105. package/dist/middleware/multichain/create-session.d.mts +1 -1
  106. package/dist/middleware/multichain/get-session.cjs +1 -2
  107. package/dist/middleware/multichain/get-session.cjs.map +1 -1
  108. package/dist/middleware/multichain/invoke-method.cjs +1 -2
  109. package/dist/middleware/multichain/invoke-method.cjs.map +1 -1
  110. package/dist/middleware/multichain/middleware.cjs +1 -2
  111. package/dist/middleware/multichain/middleware.cjs.map +1 -1
  112. package/dist/middleware/multichain/revoke-session.cjs +1 -2
  113. package/dist/middleware/multichain/revoke-session.cjs.map +1 -1
  114. package/dist/middleware/multichain/utils.cjs +1 -2
  115. package/dist/middleware/multichain/utils.cjs.map +1 -1
  116. package/dist/middleware/provider.cjs +1 -2
  117. package/dist/middleware/provider.cjs.map +1 -1
  118. package/dist/options.cjs +1 -2
  119. package/dist/options.cjs.map +1 -1
  120. package/dist/options.d.cts +4 -4
  121. package/dist/options.d.mts +4 -4
  122. package/dist/request.cjs +3 -4
  123. package/dist/request.cjs.map +1 -1
  124. package/dist/simulation.cjs +9 -10
  125. package/dist/simulation.cjs.map +1 -1
  126. package/dist/simulation.d.cts.map +1 -1
  127. package/dist/simulation.d.mts.map +1 -1
  128. package/dist/simulation.mjs +4 -4
  129. package/dist/simulation.mjs.map +1 -1
  130. package/dist/store/chain.d.cts.map +1 -1
  131. package/dist/store/chain.d.mts.map +1 -1
  132. package/dist/store/mocks.d.cts.map +1 -1
  133. package/dist/store/mocks.d.mts.map +1 -1
  134. package/dist/store/notifications.d.cts.map +1 -1
  135. package/dist/store/notifications.d.mts.map +1 -1
  136. package/dist/store/state.cjs +2 -2
  137. package/dist/store/state.cjs.map +1 -1
  138. package/dist/store/state.d.cts +4 -7
  139. package/dist/store/state.d.cts.map +1 -1
  140. package/dist/store/state.d.mts +4 -7
  141. package/dist/store/state.d.mts.map +1 -1
  142. package/dist/store/store.cjs +1 -2
  143. package/dist/store/store.cjs.map +1 -1
  144. package/dist/store/store.d.cts +1 -1
  145. package/dist/store/store.d.mts +1 -1
  146. package/dist/store/trackables.d.cts +6 -6
  147. package/dist/store/trackables.d.cts.map +1 -1
  148. package/dist/store/trackables.d.mts +6 -6
  149. package/dist/store/trackables.d.mts.map +1 -1
  150. package/dist/store/ui.d.cts.map +1 -1
  151. package/dist/store/ui.d.mts.map +1 -1
  152. package/dist/structs.cjs +3 -3
  153. package/dist/structs.cjs.map +1 -1
  154. package/dist/structs.mjs +1 -1
  155. package/dist/structs.mjs.map +1 -1
  156. package/dist/utils/account.d.cts.map +1 -1
  157. package/dist/utils/account.d.mts.map +1 -1
  158. package/dist/utils/errors.cjs +1 -2
  159. package/dist/utils/errors.cjs.map +1 -1
  160. package/dist/validation.cjs +7 -8
  161. package/dist/validation.cjs.map +1 -1
  162. package/package.json +11 -11
@@ -1,13 +1,24 @@
1
1
  import type { NotifyParams } from "@metamask/snaps-sdk";
2
2
  import { NotificationType } from "@metamask/snaps-sdk";
3
+ import type { SagaIterator } from "redux-saga";
3
4
  import type { RunSagaFunction } from "../../store/index.cjs";
5
+ /**
6
+ * Show a native notification to the user.
7
+ *
8
+ * @param _snapId - The ID of the Snap that created the notification.
9
+ * @param options - The notification options.
10
+ * @param options.message - The message to show in the notification.
11
+ * @yields Adds the notification to the store.
12
+ * @returns `null`.
13
+ */
14
+ declare function showNativeNotificationImplementation(_snapId: string, { message }: NotifyParams): SagaIterator;
4
15
  /**
5
16
  * Get a method that can be used to show a native notification.
6
17
  *
7
18
  * @param runSaga - A function to run a saga outside the usual Redux flow.
8
19
  * @returns A method that can be used to show a native notification.
9
20
  */
10
- export declare function getShowNativeNotificationImplementation(runSaga: RunSagaFunction): (_snapId: string, args_1: NotifyParams) => Promise<any>;
21
+ export declare function getShowNativeNotificationImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof showNativeNotificationImplementation>) => Promise<any>;
11
22
  type InAppNotificationParams = {
12
23
  type: NotificationType;
13
24
  message: string;
@@ -18,12 +29,25 @@ type InAppNotificationParams = {
18
29
  href: string;
19
30
  } | undefined;
20
31
  };
32
+ /**
33
+ * Show an in-app notification to the user.
34
+ *
35
+ * @param _snapId - The ID of the Snap that created the notification.
36
+ * @param options - The notification options.
37
+ * @param options.message - The message to show in the notification.
38
+ * @param options.title - The title to show in the notification.
39
+ * @param options.content - The JSX content to show in the notification.
40
+ * @param options.footerLink - The footer to show in the notification.
41
+ * @yields Adds the notification to the store.
42
+ * @returns `null`.
43
+ */
44
+ declare function showInAppNotificationImplementation(_snapId: string, { message, title, content, footerLink }: InAppNotificationParams): SagaIterator<null>;
21
45
  /**
22
46
  * Get a method that can be used to show an in-app notification.
23
47
  *
24
48
  * @param runSaga - A function to run a saga outside the usual Redux flow.
25
49
  * @returns A method that can be used to show an in-app notification.
26
50
  */
27
- export declare function getShowInAppNotificationImplementation(runSaga: RunSagaFunction): (_snapId: string, args_1: InAppNotificationParams) => Promise<any>;
51
+ export declare function getShowInAppNotificationImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof showInAppNotificationImplementation>) => Promise<any>;
28
52
  export {};
29
53
  //# sourceMappingURL=notifications.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA4B;AACxD,OAAO,EAAE,gBAAgB,EAAE,4BAA4B;AAKvD,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAuBnD;;;;;GAKG;AACH,wBAAgB,uCAAuC,CACrD,OAAO,EAAE,eAAe,2DAUzB;AAED,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACzD,CAAC;AAoCF;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,OAAO,EAAE,eAAe,sEAUzB"}
1
+ {"version":3,"file":"notifications.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA4B;AACxD,OAAO,EAAE,gBAAgB,EAAE,4BAA4B;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAGnD;;;;;;;;GAQG;AACH,iBAAU,oCAAoC,CAC5C,OAAO,EAAE,MAAM,EACf,EAAE,OAAO,EAAE,EAAE,YAAY,GACxB,YAAY,CAMd;AAED;;;;;GAKG;AACH,wBAAgB,uCAAuC,CACrD,OAAO,EAAE,eAAe,IAGtB,GAAG,MAAM,UAAU,CAAC,OAAO,oCAAoC,CAAC,kBAOnE;AAED,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACzD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,iBAAU,mCAAmC,CAC3C,OAAO,EAAE,MAAM,EACf,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,uBAAuB,GAC/D,YAAY,CAAC,IAAI,CAAC,CAiBpB;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,OAAO,EAAE,eAAe,IAGtB,GAAG,MAAM,UAAU,CAAC,OAAO,mCAAmC,CAAC,kBAOlE"}
@@ -1,13 +1,24 @@
1
1
  import type { NotifyParams } from "@metamask/snaps-sdk";
2
2
  import { NotificationType } from "@metamask/snaps-sdk";
3
+ import type { SagaIterator } from "redux-saga";
3
4
  import type { RunSagaFunction } from "../../store/index.mjs";
5
+ /**
6
+ * Show a native notification to the user.
7
+ *
8
+ * @param _snapId - The ID of the Snap that created the notification.
9
+ * @param options - The notification options.
10
+ * @param options.message - The message to show in the notification.
11
+ * @yields Adds the notification to the store.
12
+ * @returns `null`.
13
+ */
14
+ declare function showNativeNotificationImplementation(_snapId: string, { message }: NotifyParams): SagaIterator;
4
15
  /**
5
16
  * Get a method that can be used to show a native notification.
6
17
  *
7
18
  * @param runSaga - A function to run a saga outside the usual Redux flow.
8
19
  * @returns A method that can be used to show a native notification.
9
20
  */
10
- export declare function getShowNativeNotificationImplementation(runSaga: RunSagaFunction): (_snapId: string, args_1: NotifyParams) => Promise<any>;
21
+ export declare function getShowNativeNotificationImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof showNativeNotificationImplementation>) => Promise<any>;
11
22
  type InAppNotificationParams = {
12
23
  type: NotificationType;
13
24
  message: string;
@@ -18,12 +29,25 @@ type InAppNotificationParams = {
18
29
  href: string;
19
30
  } | undefined;
20
31
  };
32
+ /**
33
+ * Show an in-app notification to the user.
34
+ *
35
+ * @param _snapId - The ID of the Snap that created the notification.
36
+ * @param options - The notification options.
37
+ * @param options.message - The message to show in the notification.
38
+ * @param options.title - The title to show in the notification.
39
+ * @param options.content - The JSX content to show in the notification.
40
+ * @param options.footerLink - The footer to show in the notification.
41
+ * @yields Adds the notification to the store.
42
+ * @returns `null`.
43
+ */
44
+ declare function showInAppNotificationImplementation(_snapId: string, { message, title, content, footerLink }: InAppNotificationParams): SagaIterator<null>;
21
45
  /**
22
46
  * Get a method that can be used to show an in-app notification.
23
47
  *
24
48
  * @param runSaga - A function to run a saga outside the usual Redux flow.
25
49
  * @returns A method that can be used to show an in-app notification.
26
50
  */
27
- export declare function getShowInAppNotificationImplementation(runSaga: RunSagaFunction): (_snapId: string, args_1: InAppNotificationParams) => Promise<any>;
51
+ export declare function getShowInAppNotificationImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof showInAppNotificationImplementation>) => Promise<any>;
28
52
  export {};
29
53
  //# sourceMappingURL=notifications.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA4B;AACxD,OAAO,EAAE,gBAAgB,EAAE,4BAA4B;AAKvD,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAuBnD;;;;;GAKG;AACH,wBAAgB,uCAAuC,CACrD,OAAO,EAAE,eAAe,2DAUzB;AAED,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACzD,CAAC;AAoCF;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,OAAO,EAAE,eAAe,sEAUzB"}
1
+ {"version":3,"file":"notifications.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA4B;AACxD,OAAO,EAAE,gBAAgB,EAAE,4BAA4B;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAGnD;;;;;;;;GAQG;AACH,iBAAU,oCAAoC,CAC5C,OAAO,EAAE,MAAM,EACf,EAAE,OAAO,EAAE,EAAE,YAAY,GACxB,YAAY,CAMd;AAED;;;;;GAKG;AACH,wBAAgB,uCAAuC,CACrD,OAAO,EAAE,eAAe,IAGtB,GAAG,MAAM,UAAU,CAAC,OAAO,oCAAoC,CAAC,kBAOnE;AAED,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACzD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,iBAAU,mCAAmC,CAC3C,OAAO,EAAE,MAAM,EACf,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,uBAAuB,GAC/D,YAAY,CAAC,IAAI,CAAC,CAiBpB;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,OAAO,EAAE,eAAe,IAGtB,GAAG,MAAM,UAAU,CAAC,OAAO,mCAAmC,CAAC,kBAOlE"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPermittedClearSnapStateMethodImplementation = exports.getPermittedUpdateSnapStateMethodImplementation = exports.getPermittedGetSnapStateMethodImplementation = void 0;
3
+ exports.getPermittedGetSnapStateMethodImplementation = getPermittedGetSnapStateMethodImplementation;
4
+ exports.getPermittedUpdateSnapStateMethodImplementation = getPermittedUpdateSnapStateMethodImplementation;
5
+ exports.getPermittedClearSnapStateMethodImplementation = getPermittedClearSnapStateMethodImplementation;
4
6
  const snaps_utils_1 = require("@metamask/snaps-utils");
5
7
  const effects_1 = require("redux-saga/effects");
6
8
  const store_1 = require("../../../store/index.cjs");
@@ -28,7 +30,6 @@ function getPermittedGetSnapStateMethodImplementation(runSaga) {
28
30
  return await runSaga(getSnapStateImplementation, ...args).toPromise();
29
31
  };
30
32
  }
31
- exports.getPermittedGetSnapStateMethodImplementation = getPermittedGetSnapStateMethodImplementation;
32
33
  /**
33
34
  * Update the Snap state in the store.
34
35
  *
@@ -52,7 +53,6 @@ function getPermittedUpdateSnapStateMethodImplementation(runSaga) {
52
53
  return await runSaga(updateSnapStateImplementation, ...args).toPromise();
53
54
  };
54
55
  }
55
- exports.getPermittedUpdateSnapStateMethodImplementation = getPermittedUpdateSnapStateMethodImplementation;
56
56
  /**
57
57
  * Clear the Snap state in the store.
58
58
  *
@@ -74,5 +74,4 @@ function getPermittedClearSnapStateMethodImplementation(runSaga) {
74
74
  runSaga(clearSnapStateImplementation, ...args).result();
75
75
  };
76
76
  }
77
- exports.getPermittedClearSnapStateMethodImplementation = getPermittedClearSnapStateMethodImplementation;
78
77
  //# sourceMappingURL=state.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.cjs","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/state.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAGlD,gDAAiD;AAGjD,oDAAgE;AAEhE;;;;;;;GAOG;AACH,QAAQ,CAAC,CAAC,0BAA0B,CAAC,SAAkB;IACrD,MAAM,KAAK,GAAG,MAAM,IAAA,gBAAM,EAAC,IAAA,gBAAQ,EAAC,SAAS,CAAC,CAAC,CAAC;IAChD,6CAA6C;IAC7C,OAAO,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,4CAA4C,CAC1D,OAAwB;IAExB,OAAO,KAAK,EAAE,GAAG,IAAmD,EAAE,EAAE;QACtE,OAAO,MAAM,OAAO,CAAC,0BAA0B,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IACxE,CAAC,CAAC;AACJ,CAAC;AAND,oGAMC;AAED;;;;;;;GAOG;AACH,QAAQ,CAAC,CAAC,6BAA6B,CACrC,QAA8B,EAC9B,SAAkB;IAElB,6CAA6C;IAC7C,MAAM,IAAA,aAAG,EAAC,IAAA,gBAAQ,EAAC,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACtE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,+CAA+C,CAC7D,OAAwB;IAExB,OAAO,KAAK,EAAE,GAAG,IAAsD,EAAE,EAAE;QACzE,OAAO,MAAM,OAAO,CAAC,6BAA6B,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAND,0GAMC;AAED;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,4BAA4B,CAAC,SAAkB;IACvD,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,8CAA8C,CAC5D,OAAwB;IAExB,OAAO,KAAK,EAAE,GAAG,IAAqD,EAAE,EAAE;QACxE,OAAO,CAAC,4BAA4B,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC;AAND,wGAMC","sourcesContent":["import { parseJson } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\nimport type { SagaIterator } from 'redux-saga';\nimport { put, select } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../../store';\nimport { clearState, getState, setState } from '../../../store';\n\n/**\n * Get the Snap state from the store.\n *\n * @param encrypted - Whether to get the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @returns The state of the Snap.\n * @yields Selects the state from the store.\n */\nfunction* getSnapStateImplementation(encrypted: boolean): SagaIterator<string> {\n const state = yield select(getState(encrypted));\n // TODO: Use actual decryption implementation\n return parseJson(state);\n}\n\n/**\n * Get the implementation of the `getSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `getSnapState` hook.\n */\nexport function getPermittedGetSnapStateMethodImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (...args: Parameters<typeof getSnapStateImplementation>) => {\n return await runSaga(getSnapStateImplementation, ...args).toPromise();\n };\n}\n\n/**\n * Update the Snap state in the store.\n *\n * @param newState - The new state.\n * @param encrypted - Whether to update the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @yields Puts the new state in the store.\n */\nfunction* updateSnapStateImplementation(\n newState: Record<string, Json>,\n encrypted: boolean,\n): SagaIterator<void> {\n // TODO: Use actual encryption implementation\n yield put(setState({ state: JSON.stringify(newState), encrypted }));\n}\n\n/**\n * Get the implementation of the `updateSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `updateSnapState` hook.\n */\nexport function getPermittedUpdateSnapStateMethodImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (...args: Parameters<typeof updateSnapStateImplementation>) => {\n return await runSaga(updateSnapStateImplementation, ...args).toPromise();\n };\n}\n\n/**\n * Clear the Snap state in the store.\n *\n * @param encrypted - Whether to clear the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @yields Puts the new state in the store.\n */\nfunction* clearSnapStateImplementation(encrypted: boolean): SagaIterator<void> {\n yield put(clearState({ encrypted }));\n}\n\n/**\n * Get the implementation of the `clearSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `clearSnapState` hook.\n */\nexport function getPermittedClearSnapStateMethodImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (...args: Parameters<typeof clearSnapStateImplementation>) => {\n runSaga(clearSnapStateImplementation, ...args).result();\n };\n}\n"]}
1
+ {"version":3,"file":"state.cjs","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/state.ts"],"names":[],"mappings":";;AA4BA,oGAMC;AAwBD,0GAMC;AAmBD,wGAMC;AAzFD,uDAAkD;AAGlD,gDAAiD;AAGjD,oDAAgE;AAEhE;;;;;;;GAOG;AACH,QAAQ,CAAC,CAAC,0BAA0B,CAAC,SAAkB;IACrD,MAAM,KAAK,GAAG,MAAM,IAAA,gBAAM,EAAC,IAAA,gBAAQ,EAAC,SAAS,CAAC,CAAC,CAAC;IAChD,6CAA6C;IAC7C,OAAO,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,4CAA4C,CAC1D,OAAwB;IAExB,OAAO,KAAK,EAAE,GAAG,IAAmD,EAAE,EAAE;QACtE,OAAO,MAAM,OAAO,CAAC,0BAA0B,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IACxE,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,QAAQ,CAAC,CAAC,6BAA6B,CACrC,QAA8B,EAC9B,SAAkB;IAElB,6CAA6C;IAC7C,MAAM,IAAA,aAAG,EAAC,IAAA,gBAAQ,EAAC,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACtE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,+CAA+C,CAC7D,OAAwB;IAExB,OAAO,KAAK,EAAE,GAAG,IAAsD,EAAE,EAAE;QACzE,OAAO,MAAM,OAAO,CAAC,6BAA6B,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,4BAA4B,CAAC,SAAkB;IACvD,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,8CAA8C,CAC5D,OAAwB;IAExB,OAAO,KAAK,EAAE,GAAG,IAAqD,EAAE,EAAE;QACxE,OAAO,CAAC,4BAA4B,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { parseJson } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\nimport type { SagaIterator } from 'redux-saga';\nimport { put, select } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../../store';\nimport { clearState, getState, setState } from '../../../store';\n\n/**\n * Get the Snap state from the store.\n *\n * @param encrypted - Whether to get the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @returns The state of the Snap.\n * @yields Selects the state from the store.\n */\nfunction* getSnapStateImplementation(encrypted: boolean): SagaIterator<string> {\n const state = yield select(getState(encrypted));\n // TODO: Use actual decryption implementation\n return parseJson(state);\n}\n\n/**\n * Get the implementation of the `getSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `getSnapState` hook.\n */\nexport function getPermittedGetSnapStateMethodImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (...args: Parameters<typeof getSnapStateImplementation>) => {\n return await runSaga(getSnapStateImplementation, ...args).toPromise();\n };\n}\n\n/**\n * Update the Snap state in the store.\n *\n * @param newState - The new state.\n * @param encrypted - Whether to update the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @yields Puts the new state in the store.\n */\nfunction* updateSnapStateImplementation(\n newState: Record<string, Json>,\n encrypted: boolean,\n): SagaIterator<void> {\n // TODO: Use actual encryption implementation\n yield put(setState({ state: JSON.stringify(newState), encrypted }));\n}\n\n/**\n * Get the implementation of the `updateSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `updateSnapState` hook.\n */\nexport function getPermittedUpdateSnapStateMethodImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (...args: Parameters<typeof updateSnapStateImplementation>) => {\n return await runSaga(updateSnapStateImplementation, ...args).toPromise();\n };\n}\n\n/**\n * Clear the Snap state in the store.\n *\n * @param encrypted - Whether to clear the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @yields Puts the new state in the store.\n */\nfunction* clearSnapStateImplementation(encrypted: boolean): SagaIterator<void> {\n yield put(clearState({ encrypted }));\n}\n\n/**\n * Get the implementation of the `clearSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `clearSnapState` hook.\n */\nexport function getPermittedClearSnapStateMethodImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (...args: Parameters<typeof clearSnapStateImplementation>) => {\n runSaga(clearSnapStateImplementation, ...args).result();\n };\n}\n"]}
@@ -1,24 +1,52 @@
1
1
  import type { Json } from "@metamask/utils";
2
+ import type { SagaIterator } from "redux-saga";
2
3
  import type { RunSagaFunction } from "../../../store/index.cjs";
4
+ /**
5
+ * Get the Snap state from the store.
6
+ *
7
+ * @param encrypted - Whether to get the encrypted or unencrypted state.
8
+ * Defaults to encrypted state.
9
+ * @returns The state of the Snap.
10
+ * @yields Selects the state from the store.
11
+ */
12
+ declare function getSnapStateImplementation(encrypted: boolean): SagaIterator<string>;
3
13
  /**
4
14
  * Get the implementation of the `getSnapState` hook.
5
15
  *
6
16
  * @param runSaga - The function to run a saga outside the usual Redux flow.
7
17
  * @returns The implementation of the `getSnapState` hook.
8
18
  */
9
- export declare function getPermittedGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (encrypted: boolean) => Promise<any>;
19
+ export declare function getPermittedGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof getSnapStateImplementation>) => Promise<any>;
20
+ /**
21
+ * Update the Snap state in the store.
22
+ *
23
+ * @param newState - The new state.
24
+ * @param encrypted - Whether to update the encrypted or unencrypted state.
25
+ * Defaults to encrypted state.
26
+ * @yields Puts the new state in the store.
27
+ */
28
+ declare function updateSnapStateImplementation(newState: Record<string, Json>, encrypted: boolean): SagaIterator<void>;
10
29
  /**
11
30
  * Get the implementation of the `updateSnapState` hook.
12
31
  *
13
32
  * @param runSaga - The function to run a saga outside the usual Redux flow.
14
33
  * @returns The implementation of the `updateSnapState` hook.
15
34
  */
16
- export declare function getPermittedUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (newState: Record<string, Json>, encrypted: boolean) => Promise<any>;
35
+ export declare function getPermittedUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof updateSnapStateImplementation>) => Promise<any>;
36
+ /**
37
+ * Clear the Snap state in the store.
38
+ *
39
+ * @param encrypted - Whether to clear the encrypted or unencrypted state.
40
+ * Defaults to encrypted state.
41
+ * @yields Puts the new state in the store.
42
+ */
43
+ declare function clearSnapStateImplementation(encrypted: boolean): SagaIterator<void>;
17
44
  /**
18
45
  * Get the implementation of the `clearSnapState` hook.
19
46
  *
20
47
  * @param runSaga - The function to run a saga outside the usual Redux flow.
21
48
  * @returns The implementation of the `clearSnapState` hook.
22
49
  */
23
- export declare function getPermittedClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (encrypted: boolean) => Promise<void>;
50
+ export declare function getPermittedClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof clearSnapStateImplementation>) => Promise<void>;
51
+ export {};
24
52
  //# sourceMappingURL=state.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.cts","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAI5C,OAAO,KAAK,EAAE,eAAe,EAAE,iCAAuB;AAiBtD;;;;;GAKG;AACH,wBAAgB,4CAA4C,CAC1D,OAAO,EAAE,eAAe,wCAKzB;AAkBD;;;;;GAKG;AACH,wBAAgB,+CAA+C,CAC7D,OAAO,EAAE,eAAe,wEAKzB;AAaD;;;;;GAKG;AACH,wBAAgB,8CAA8C,CAC5D,OAAO,EAAE,eAAe,yCAKzB"}
1
+ {"version":3,"file":"state.d.cts","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,iCAAuB;AAGtD;;;;;;;GAOG;AACH,iBAAU,0BAA0B,CAAC,SAAS,EAAE,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAI7E;AAED;;;;;GAKG;AACH,wBAAgB,4CAA4C,CAC1D,OAAO,EAAE,eAAe,IAEV,GAAG,MAAM,UAAU,CAAC,OAAO,0BAA0B,CAAC,kBAGrE;AAED;;;;;;;GAOG;AACH,iBAAU,6BAA6B,CACrC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAC9B,SAAS,EAAE,OAAO,GACjB,YAAY,CAAC,IAAI,CAAC,CAGpB;AAED;;;;;GAKG;AACH,wBAAgB,+CAA+C,CAC7D,OAAO,EAAE,eAAe,IAEV,GAAG,MAAM,UAAU,CAAC,OAAO,6BAA6B,CAAC,kBAGxE;AAED;;;;;;GAMG;AACH,iBAAU,4BAA4B,CAAC,SAAS,EAAE,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,8CAA8C,CAC5D,OAAO,EAAE,eAAe,IAEV,GAAG,MAAM,UAAU,CAAC,OAAO,4BAA4B,CAAC,mBAGvE"}
@@ -1,24 +1,52 @@
1
1
  import type { Json } from "@metamask/utils";
2
+ import type { SagaIterator } from "redux-saga";
2
3
  import type { RunSagaFunction } from "../../../store/index.mjs";
4
+ /**
5
+ * Get the Snap state from the store.
6
+ *
7
+ * @param encrypted - Whether to get the encrypted or unencrypted state.
8
+ * Defaults to encrypted state.
9
+ * @returns The state of the Snap.
10
+ * @yields Selects the state from the store.
11
+ */
12
+ declare function getSnapStateImplementation(encrypted: boolean): SagaIterator<string>;
3
13
  /**
4
14
  * Get the implementation of the `getSnapState` hook.
5
15
  *
6
16
  * @param runSaga - The function to run a saga outside the usual Redux flow.
7
17
  * @returns The implementation of the `getSnapState` hook.
8
18
  */
9
- export declare function getPermittedGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (encrypted: boolean) => Promise<any>;
19
+ export declare function getPermittedGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof getSnapStateImplementation>) => Promise<any>;
20
+ /**
21
+ * Update the Snap state in the store.
22
+ *
23
+ * @param newState - The new state.
24
+ * @param encrypted - Whether to update the encrypted or unencrypted state.
25
+ * Defaults to encrypted state.
26
+ * @yields Puts the new state in the store.
27
+ */
28
+ declare function updateSnapStateImplementation(newState: Record<string, Json>, encrypted: boolean): SagaIterator<void>;
10
29
  /**
11
30
  * Get the implementation of the `updateSnapState` hook.
12
31
  *
13
32
  * @param runSaga - The function to run a saga outside the usual Redux flow.
14
33
  * @returns The implementation of the `updateSnapState` hook.
15
34
  */
16
- export declare function getPermittedUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (newState: Record<string, Json>, encrypted: boolean) => Promise<any>;
35
+ export declare function getPermittedUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof updateSnapStateImplementation>) => Promise<any>;
36
+ /**
37
+ * Clear the Snap state in the store.
38
+ *
39
+ * @param encrypted - Whether to clear the encrypted or unencrypted state.
40
+ * Defaults to encrypted state.
41
+ * @yields Puts the new state in the store.
42
+ */
43
+ declare function clearSnapStateImplementation(encrypted: boolean): SagaIterator<void>;
17
44
  /**
18
45
  * Get the implementation of the `clearSnapState` hook.
19
46
  *
20
47
  * @param runSaga - The function to run a saga outside the usual Redux flow.
21
48
  * @returns The implementation of the `clearSnapState` hook.
22
49
  */
23
- export declare function getPermittedClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (encrypted: boolean) => Promise<void>;
50
+ export declare function getPermittedClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof clearSnapStateImplementation>) => Promise<void>;
51
+ export {};
24
52
  //# sourceMappingURL=state.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.mts","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAI5C,OAAO,KAAK,EAAE,eAAe,EAAE,iCAAuB;AAiBtD;;;;;GAKG;AACH,wBAAgB,4CAA4C,CAC1D,OAAO,EAAE,eAAe,wCAKzB;AAkBD;;;;;GAKG;AACH,wBAAgB,+CAA+C,CAC7D,OAAO,EAAE,eAAe,wEAKzB;AAaD;;;;;GAKG;AACH,wBAAgB,8CAA8C,CAC5D,OAAO,EAAE,eAAe,yCAKzB"}
1
+ {"version":3,"file":"state.d.mts","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,iCAAuB;AAGtD;;;;;;;GAOG;AACH,iBAAU,0BAA0B,CAAC,SAAS,EAAE,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAI7E;AAED;;;;;GAKG;AACH,wBAAgB,4CAA4C,CAC1D,OAAO,EAAE,eAAe,IAEV,GAAG,MAAM,UAAU,CAAC,OAAO,0BAA0B,CAAC,kBAGrE;AAED;;;;;;;GAOG;AACH,iBAAU,6BAA6B,CACrC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAC9B,SAAS,EAAE,OAAO,GACjB,YAAY,CAAC,IAAI,CAAC,CAGpB;AAED;;;;;GAKG;AACH,wBAAgB,+CAA+C,CAC7D,OAAO,EAAE,eAAe,IAEV,GAAG,MAAM,UAAU,CAAC,OAAO,6BAA6B,CAAC,kBAGxE;AAED;;;;;;GAMG;AACH,iBAAU,4BAA4B,CAAC,SAAS,EAAE,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,8CAA8C,CAC5D,OAAO,EAAE,eAAe,IAEV,GAAG,MAAM,UAAU,CAAC,OAAO,4BAA4B,CAAC,mBAGvE"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRequestUserApprovalImplementation = void 0;
3
+ exports.getRequestUserApprovalImplementation = getRequestUserApprovalImplementation;
4
4
  const effects_1 = require("redux-saga/effects");
5
5
  const store_1 = require("../../store/index.cjs");
6
6
  /**
@@ -34,5 +34,4 @@ function getRequestUserApprovalImplementation(runSaga) {
34
34
  return await runSaga(requestUserApprovalImplementation, ...args).toPromise();
35
35
  };
36
36
  }
37
- exports.getRequestUserApprovalImplementation = getRequestUserApprovalImplementation;
38
37
  //# sourceMappingURL=request-user-approval.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-user-approval.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/request-user-approval.ts"],"names":[],"mappings":";;;AACA,gDAA+C;AAG/C,iDAA6E;AAS7E;;;;;;;;;;;GAWG;AACH,QAAQ,CAAC,CAAC,iCAAiC,CAAC,EAC1C,IAAI,EACJ,WAAW,EAAE,EAAE,EAAE,EAAE,GACO;IAC1B,MAAM,IAAA,aAAG,EAAC,IAAA,oBAAY,EAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAEtC,2EAA2E;IAC3E,mDAAmD;IACnD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,cAAI,EAAC,wBAAgB,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,IAAA,aAAG,EAAC,IAAA,sBAAc,GAAE,CAAC,CAAC;IAE5B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,oCAAoC,CAAC,OAAwB;IAC3E,OAAO,KAAK,EACV,GAAG,IAA0D,EAC7D,EAAE;QACF,OAAO,MAAM,OAAO,CAClB,iCAAiC,EACjC,GAAG,IAAI,CACR,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AATD,oFASC","sourcesContent":["import type { SagaIterator } from 'redux-saga';\nimport { put, take } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { resolveInterface, setInterface, closeInterface } from '../../store';\n\ntype RequestUserApprovalParams = {\n type: string;\n requestData: {\n id: string;\n };\n};\n\n/**\n * Show a dialog to the user. This will wait for `resolveUserInterface` to be\n * dispatched before returning.\n *\n * @param opts - The options for the request.\n * @param opts.type - The type of dialog to show.\n * @param opts.requestData - The data to display in the dialog.\n * @param opts.requestData.id - The ID of the interface.\n * @yields Sets the dialog in the store, waits for the user to resolve the\n * dialog, and closes the dialog.\n * @returns The result of the dialog.\n */\nfunction* requestUserApprovalImplementation({\n type,\n requestData: { id },\n}: RequestUserApprovalParams): SagaIterator<unknown> {\n yield put(setInterface({ type, id }));\n\n // We use `take` to wait for `resolveUserInterface` to be dispatched, which\n // indicates that the user has resolved the dialog.\n const { payload } = yield take(resolveInterface.type);\n yield put(closeInterface());\n\n return payload;\n}\n\n/**\n * Get the implementation of the `requestUserApproval` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `requestUserApproval` hook.\n */\nexport function getRequestUserApprovalImplementation(runSaga: RunSagaFunction) {\n return async (\n ...args: Parameters<typeof requestUserApprovalImplementation>\n ) => {\n return await runSaga(\n requestUserApprovalImplementation,\n ...args,\n ).toPromise();\n };\n}\n"]}
1
+ {"version":3,"file":"request-user-approval.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/request-user-approval.ts"],"names":[],"mappings":";;AA6CA,oFASC;AArDD,gDAA+C;AAG/C,iDAA6E;AAS7E;;;;;;;;;;;GAWG;AACH,QAAQ,CAAC,CAAC,iCAAiC,CAAC,EAC1C,IAAI,EACJ,WAAW,EAAE,EAAE,EAAE,EAAE,GACO;IAC1B,MAAM,IAAA,aAAG,EAAC,IAAA,oBAAY,EAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAEtC,2EAA2E;IAC3E,mDAAmD;IACnD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,cAAI,EAAC,wBAAgB,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,IAAA,aAAG,EAAC,IAAA,sBAAc,GAAE,CAAC,CAAC;IAE5B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,oCAAoC,CAAC,OAAwB;IAC3E,OAAO,KAAK,EACV,GAAG,IAA0D,EAC7D,EAAE;QACF,OAAO,MAAM,OAAO,CAClB,iCAAiC,EACjC,GAAG,IAAI,CACR,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { SagaIterator } from 'redux-saga';\nimport { put, take } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { resolveInterface, setInterface, closeInterface } from '../../store';\n\ntype RequestUserApprovalParams = {\n type: string;\n requestData: {\n id: string;\n };\n};\n\n/**\n * Show a dialog to the user. This will wait for `resolveUserInterface` to be\n * dispatched before returning.\n *\n * @param opts - The options for the request.\n * @param opts.type - The type of dialog to show.\n * @param opts.requestData - The data to display in the dialog.\n * @param opts.requestData.id - The ID of the interface.\n * @yields Sets the dialog in the store, waits for the user to resolve the\n * dialog, and closes the dialog.\n * @returns The result of the dialog.\n */\nfunction* requestUserApprovalImplementation({\n type,\n requestData: { id },\n}: RequestUserApprovalParams): SagaIterator<unknown> {\n yield put(setInterface({ type, id }));\n\n // We use `take` to wait for `resolveUserInterface` to be dispatched, which\n // indicates that the user has resolved the dialog.\n const { payload } = yield take(resolveInterface.type);\n yield put(closeInterface());\n\n return payload;\n}\n\n/**\n * Get the implementation of the `requestUserApproval` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `requestUserApproval` hook.\n */\nexport function getRequestUserApprovalImplementation(runSaga: RunSagaFunction) {\n return async (\n ...args: Parameters<typeof requestUserApprovalImplementation>\n ) => {\n return await runSaga(\n requestUserApprovalImplementation,\n ...args,\n ).toPromise();\n };\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { SagaIterator } from "redux-saga";
1
2
  import type { RunSagaFunction } from "../../store/index.cjs";
2
3
  type RequestUserApprovalParams = {
3
4
  type: string;
@@ -5,12 +6,25 @@ type RequestUserApprovalParams = {
5
6
  id: string;
6
7
  };
7
8
  };
9
+ /**
10
+ * Show a dialog to the user. This will wait for `resolveUserInterface` to be
11
+ * dispatched before returning.
12
+ *
13
+ * @param opts - The options for the request.
14
+ * @param opts.type - The type of dialog to show.
15
+ * @param opts.requestData - The data to display in the dialog.
16
+ * @param opts.requestData.id - The ID of the interface.
17
+ * @yields Sets the dialog in the store, waits for the user to resolve the
18
+ * dialog, and closes the dialog.
19
+ * @returns The result of the dialog.
20
+ */
21
+ declare function requestUserApprovalImplementation({ type, requestData: { id }, }: RequestUserApprovalParams): SagaIterator<unknown>;
8
22
  /**
9
23
  * Get the implementation of the `requestUserApproval` hook.
10
24
  *
11
25
  * @param runSaga - The function to run a saga outside the usual Redux flow.
12
26
  * @returns The implementation of the `requestUserApproval` hook.
13
27
  */
14
- export declare function getRequestUserApprovalImplementation(runSaga: RunSagaFunction): (args_0: RequestUserApprovalParams) => Promise<any>;
28
+ export declare function getRequestUserApprovalImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof requestUserApprovalImplementation>) => Promise<any>;
15
29
  export {};
16
30
  //# sourceMappingURL=request-user-approval.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-user-approval.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/request-user-approval.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAGnD,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE;QACX,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AA4BF;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,eAAe,uDAS5E"}
1
+ {"version":3,"file":"request-user-approval.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/request-user-approval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAGnD,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE;QACX,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,iBAAU,iCAAiC,CAAC,EAC1C,IAAI,EACJ,WAAW,EAAE,EAAE,EAAE,EAAE,GACpB,EAAE,yBAAyB,GAAG,YAAY,CAAC,OAAO,CAAC,CASnD;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,eAAe,IAEzE,GAAG,MAAM,UAAU,CAAC,OAAO,iCAAiC,CAAC,kBAOhE"}
@@ -1,3 +1,4 @@
1
+ import type { SagaIterator } from "redux-saga";
1
2
  import type { RunSagaFunction } from "../../store/index.mjs";
2
3
  type RequestUserApprovalParams = {
3
4
  type: string;
@@ -5,12 +6,25 @@ type RequestUserApprovalParams = {
5
6
  id: string;
6
7
  };
7
8
  };
9
+ /**
10
+ * Show a dialog to the user. This will wait for `resolveUserInterface` to be
11
+ * dispatched before returning.
12
+ *
13
+ * @param opts - The options for the request.
14
+ * @param opts.type - The type of dialog to show.
15
+ * @param opts.requestData - The data to display in the dialog.
16
+ * @param opts.requestData.id - The ID of the interface.
17
+ * @yields Sets the dialog in the store, waits for the user to resolve the
18
+ * dialog, and closes the dialog.
19
+ * @returns The result of the dialog.
20
+ */
21
+ declare function requestUserApprovalImplementation({ type, requestData: { id }, }: RequestUserApprovalParams): SagaIterator<unknown>;
8
22
  /**
9
23
  * Get the implementation of the `requestUserApproval` hook.
10
24
  *
11
25
  * @param runSaga - The function to run a saga outside the usual Redux flow.
12
26
  * @returns The implementation of the `requestUserApproval` hook.
13
27
  */
14
- export declare function getRequestUserApprovalImplementation(runSaga: RunSagaFunction): (args_0: RequestUserApprovalParams) => Promise<any>;
28
+ export declare function getRequestUserApprovalImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof requestUserApprovalImplementation>) => Promise<any>;
15
29
  export {};
16
30
  //# sourceMappingURL=request-user-approval.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-user-approval.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/request-user-approval.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAGnD,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE;QACX,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AA4BF;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,eAAe,uDAS5E"}
1
+ {"version":3,"file":"request-user-approval.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/request-user-approval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAGnD,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE;QACX,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,iBAAU,iCAAiC,CAAC,EAC1C,IAAI,EACJ,WAAW,EAAE,EAAE,EAAE,EAAE,GACpB,EAAE,yBAAyB,GAAG,YAAY,CAAC,OAAO,CAAC,CASnD;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,eAAe,IAEzE,GAAG,MAAM,UAAU,CAAC,OAAO,iCAAiC,CAAC,kBAOhE"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStartTraceImplementation = void 0;
3
+ exports.getStartTraceImplementation = getStartTraceImplementation;
4
4
  const effects_1 = require("redux-saga/effects");
5
5
  const store_1 = require("../../store/index.cjs");
6
6
  /**
@@ -30,5 +30,4 @@ function getStartTraceImplementation(runSaga) {
30
30
  return runSaga(startTraceImplementation, ...args).result();
31
31
  };
32
32
  }
33
- exports.getStartTraceImplementation = getStartTraceImplementation;
34
33
  //# sourceMappingURL=start-trace.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-trace.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":";;;AAEA,gDAAyC;AAGzC,iDAAyC;AAEzC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,wBAAwB,CAAC,KAAuB;IACxD,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,OAAO;QACL,yDAAyD;QACzD,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,cAAc;QACvB,wDAAwD;KACzD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,OAAwB;IAClE,OAAO,CAAC,GAAG,IAAiD,EAAE,EAAE;QAC9D,OAAO,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAJD,kEAIC","sourcesContent":["import type { StartTraceParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { startTrace } from '../../store';\n\n/**\n * Start a performance trace.\n *\n * @param event - The performance trace to start.\n * @returns `null`.\n * @yields Adds the pending trace to the store.\n */\nfunction* startTraceImplementation(event: StartTraceParams): SagaIterator {\n yield put(startTrace(event));\n return {\n /* eslint-disable @typescript-eslint/naming-convention */\n _traceId: 'test-trace-id',\n _spanId: 'test-span-id',\n /* eslint-enable @typescript-eslint/naming-convention */\n };\n}\n\n/**\n * Get a method that can be used to start a performance trace.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to start a performance trace.\n */\nexport function getStartTraceImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof startTraceImplementation>) => {\n return runSaga(startTraceImplementation, ...args).result();\n };\n}\n"]}
1
+ {"version":3,"file":"start-trace.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":";;AA8BA,kEAIC;AAhCD,gDAAyC;AAGzC,iDAAyC;AAEzC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,wBAAwB,CAAC,KAAuB;IACxD,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,OAAO;QACL,yDAAyD;QACzD,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,cAAc;QACvB,wDAAwD;KACzD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,OAAwB;IAClE,OAAO,CAAC,GAAG,IAAiD,EAAE,EAAE;QAC9D,OAAO,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { StartTraceParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { startTrace } from '../../store';\n\n/**\n * Start a performance trace.\n *\n * @param event - The performance trace to start.\n * @returns `null`.\n * @yields Adds the pending trace to the store.\n */\nfunction* startTraceImplementation(event: StartTraceParams): SagaIterator {\n yield put(startTrace(event));\n return {\n /* eslint-disable @typescript-eslint/naming-convention */\n _traceId: 'test-trace-id',\n _spanId: 'test-span-id',\n /* eslint-enable @typescript-eslint/naming-convention */\n };\n}\n\n/**\n * Get a method that can be used to start a performance trace.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to start a performance trace.\n */\nexport function getStartTraceImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof startTraceImplementation>) => {\n return runSaga(startTraceImplementation, ...args).result();\n };\n}\n"]}
@@ -1,9 +1,20 @@
1
+ import type { StartTraceParams } from "@metamask/snaps-sdk";
2
+ import type { SagaIterator } from "redux-saga";
1
3
  import type { RunSagaFunction } from "../../store/index.cjs";
4
+ /**
5
+ * Start a performance trace.
6
+ *
7
+ * @param event - The performance trace to start.
8
+ * @returns `null`.
9
+ * @yields Adds the pending trace to the store.
10
+ */
11
+ declare function startTraceImplementation(event: StartTraceParams): SagaIterator;
2
12
  /**
3
13
  * Get a method that can be used to start a performance trace.
4
14
  *
5
15
  * @param runSaga - A function to run a saga outside the usual Redux flow.
6
16
  * @returns A method that can be used to start a performance trace.
7
17
  */
8
- export declare function getStartTraceImplementation(runSaga: RunSagaFunction): (event: import("@metamask/snaps-sdk").TraceRequest) => any;
18
+ export declare function getStartTraceImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof startTraceImplementation>) => any;
19
+ export {};
9
20
  //# sourceMappingURL=start-trace.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-trace.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAoBnD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,8DAInE"}
1
+ {"version":3,"file":"start-trace.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAGnD;;;;;;GAMG;AACH,iBAAU,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAQxE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,IAC1D,GAAG,MAAM,UAAU,CAAC,OAAO,wBAAwB,CAAC,SAG7D"}
@@ -1,9 +1,20 @@
1
+ import type { StartTraceParams } from "@metamask/snaps-sdk";
2
+ import type { SagaIterator } from "redux-saga";
1
3
  import type { RunSagaFunction } from "../../store/index.mjs";
4
+ /**
5
+ * Start a performance trace.
6
+ *
7
+ * @param event - The performance trace to start.
8
+ * @returns `null`.
9
+ * @yields Adds the pending trace to the store.
10
+ */
11
+ declare function startTraceImplementation(event: StartTraceParams): SagaIterator;
2
12
  /**
3
13
  * Get a method that can be used to start a performance trace.
4
14
  *
5
15
  * @param runSaga - A function to run a saga outside the usual Redux flow.
6
16
  * @returns A method that can be used to start a performance trace.
7
17
  */
8
- export declare function getStartTraceImplementation(runSaga: RunSagaFunction): (event: import("@metamask/snaps-sdk").TraceRequest) => any;
18
+ export declare function getStartTraceImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof startTraceImplementation>) => any;
19
+ export {};
9
20
  //# sourceMappingURL=start-trace.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-trace.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAoBnD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,8DAInE"}
1
+ {"version":3,"file":"start-trace.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAGnD;;;;;;GAMG;AACH,iBAAU,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAQxE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,IAC1D,GAAG,MAAM,UAAU,CAAC,OAAO,wBAAwB,CAAC,SAG7D"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getClearSnapStateMethodImplementation = exports.getUpdateSnapStateMethodImplementation = exports.getGetSnapStateMethodImplementation = void 0;
3
+ exports.getGetSnapStateMethodImplementation = getGetSnapStateMethodImplementation;
4
+ exports.getUpdateSnapStateMethodImplementation = getUpdateSnapStateMethodImplementation;
5
+ exports.getClearSnapStateMethodImplementation = getClearSnapStateMethodImplementation;
4
6
  const snaps_utils_1 = require("@metamask/snaps-utils");
5
7
  const effects_1 = require("redux-saga/effects");
6
8
  const store_1 = require("../../store/index.cjs");
@@ -30,7 +32,6 @@ function getGetSnapStateMethodImplementation(runSaga) {
30
32
  return runSaga(getSnapStateImplementation, ...args).result();
31
33
  };
32
34
  }
33
- exports.getGetSnapStateMethodImplementation = getGetSnapStateMethodImplementation;
34
35
  /**
35
36
  * Update the Snap state in the store.
36
37
  *
@@ -56,7 +57,6 @@ function getUpdateSnapStateMethodImplementation(runSaga) {
56
57
  runSaga(updateSnapStateImplementation, ...args).result();
57
58
  };
58
59
  }
59
- exports.getUpdateSnapStateMethodImplementation = getUpdateSnapStateMethodImplementation;
60
60
  /**
61
61
  * Clear the Snap state in the store.
62
62
  *
@@ -80,5 +80,4 @@ function getClearSnapStateMethodImplementation(runSaga) {
80
80
  runSaga(clearSnapStateImplementation, ...args).result();
81
81
  };
82
82
  }
83
- exports.getClearSnapStateMethodImplementation = getClearSnapStateMethodImplementation;
84
83
  //# sourceMappingURL=state.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/state.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAGlD,gDAAiD;AAGjD,iDAA6D;AAE7D;;;;;;;;;GASG;AACH,QAAQ,CAAC,CAAC,0BAA0B,CAClC,OAAe,EACf,SAAS,GAAG,IAAI;IAEhB,MAAM,KAAK,GAAG,MAAM,IAAA,gBAAM,EAAC,IAAA,gBAAQ,EAAC,SAAS,CAAC,CAAC,CAAC;IAChD,6CAA6C;IAC7C,OAAO,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mCAAmC,CAAC,OAAwB;IAC1E,OAAO,CAAC,GAAG,IAAmD,EAAE,EAAE;QAChE,OAAO,OAAO,CAAC,0BAA0B,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC;AAJD,kFAIC;AAED;;;;;;;;;GASG;AACH,QAAQ,CAAC,CAAC,6BAA6B,CACrC,OAAe,EACf,QAA8B,EAC9B,SAAS,GAAG,IAAI;IAEhB,6CAA6C;IAC7C,MAAM,IAAA,aAAG,EAAC,IAAA,gBAAQ,EAAC,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACtE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,sCAAsC,CACpD,OAAwB;IAExB,OAAO,KAAK,EAAE,GAAG,IAAsD,EAAE,EAAE;QACzE,OAAO,CAAC,6BAA6B,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC;AAND,wFAMC;AAED;;;;;;;;GAQG;AACH,QAAQ,CAAC,CAAC,4BAA4B,CACpC,OAAe,EACf,SAAS,GAAG,IAAI;IAEhB,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,qCAAqC,CACnD,OAAwB;IAExB,OAAO,KAAK,EAAE,GAAG,IAAqD,EAAE,EAAE;QACxE,OAAO,CAAC,4BAA4B,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC;AAND,sFAMC","sourcesContent":["import { parseJson } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\nimport type { SagaIterator } from 'redux-saga';\nimport { put, select } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { clearState, getState, setState } from '../../store';\n\n/**\n * Get the Snap state from the store.\n *\n * @param _snapId - The ID of the Snap to get the state for. This is ignored\n * because the simulator only supports one Snap.\n * @param encrypted - Whether to get the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @returns The state of the Snap.\n * @yields Selects the state from the store.\n */\nfunction* getSnapStateImplementation(\n _snapId: string,\n encrypted = true,\n): SagaIterator<string> {\n const state = yield select(getState(encrypted));\n // TODO: Use actual decryption implementation\n return parseJson(state);\n}\n\n/**\n * Get the implementation of the `getSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `getSnapState` hook.\n */\nexport function getGetSnapStateMethodImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof getSnapStateImplementation>) => {\n return runSaga(getSnapStateImplementation, ...args).result();\n };\n}\n\n/**\n * Update the Snap state in the store.\n *\n * @param _snapId - The ID of the Snap to update the state for. This is ignored\n * because the simulator only supports one Snap.\n * @param newState - The new state.\n * @param encrypted - Whether to update the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @yields Puts the new state in the store.\n */\nfunction* updateSnapStateImplementation(\n _snapId: string,\n newState: Record<string, Json>,\n encrypted = true,\n): SagaIterator<void> {\n // TODO: Use actual encryption implementation\n yield put(setState({ state: JSON.stringify(newState), encrypted }));\n}\n\n/**\n * Get the implementation of the `updateSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `updateSnapState` hook.\n */\nexport function getUpdateSnapStateMethodImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (...args: Parameters<typeof updateSnapStateImplementation>) => {\n runSaga(updateSnapStateImplementation, ...args).result();\n };\n}\n\n/**\n * Clear the Snap state in the store.\n *\n * @param _snapId - The ID of the Snap to clear the state for. This is ignored\n * because the simulator only supports one Snap.\n * @param encrypted - Whether to clear the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @yields Puts the new state in the store.\n */\nfunction* clearSnapStateImplementation(\n _snapId: string,\n encrypted = true,\n): SagaIterator<void> {\n yield put(clearState({ encrypted }));\n}\n\n/**\n * Get the implementation of the `clearSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `clearSnapState` hook.\n */\nexport function getClearSnapStateMethodImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (...args: Parameters<typeof clearSnapStateImplementation>) => {\n runSaga(clearSnapStateImplementation, ...args).result();\n };\n}\n"]}
1
+ {"version":3,"file":"state.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/state.ts"],"names":[],"mappings":";;AAiCA,kFAIC;AA2BD,wFAMC;AAwBD,sFAMC;AApGD,uDAAkD;AAGlD,gDAAiD;AAGjD,iDAA6D;AAE7D;;;;;;;;;GASG;AACH,QAAQ,CAAC,CAAC,0BAA0B,CAClC,OAAe,EACf,SAAS,GAAG,IAAI;IAEhB,MAAM,KAAK,GAAG,MAAM,IAAA,gBAAM,EAAC,IAAA,gBAAQ,EAAC,SAAS,CAAC,CAAC,CAAC;IAChD,6CAA6C;IAC7C,OAAO,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mCAAmC,CAAC,OAAwB;IAC1E,OAAO,CAAC,GAAG,IAAmD,EAAE,EAAE;QAChE,OAAO,OAAO,CAAC,0BAA0B,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,QAAQ,CAAC,CAAC,6BAA6B,CACrC,OAAe,EACf,QAA8B,EAC9B,SAAS,GAAG,IAAI;IAEhB,6CAA6C;IAC7C,MAAM,IAAA,aAAG,EAAC,IAAA,gBAAQ,EAAC,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACtE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,sCAAsC,CACpD,OAAwB;IAExB,OAAO,KAAK,EAAE,GAAG,IAAsD,EAAE,EAAE;QACzE,OAAO,CAAC,6BAA6B,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,QAAQ,CAAC,CAAC,4BAA4B,CACpC,OAAe,EACf,SAAS,GAAG,IAAI;IAEhB,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,qCAAqC,CACnD,OAAwB;IAExB,OAAO,KAAK,EAAE,GAAG,IAAqD,EAAE,EAAE;QACxE,OAAO,CAAC,4BAA4B,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { parseJson } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\nimport type { SagaIterator } from 'redux-saga';\nimport { put, select } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { clearState, getState, setState } from '../../store';\n\n/**\n * Get the Snap state from the store.\n *\n * @param _snapId - The ID of the Snap to get the state for. This is ignored\n * because the simulator only supports one Snap.\n * @param encrypted - Whether to get the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @returns The state of the Snap.\n * @yields Selects the state from the store.\n */\nfunction* getSnapStateImplementation(\n _snapId: string,\n encrypted = true,\n): SagaIterator<string> {\n const state = yield select(getState(encrypted));\n // TODO: Use actual decryption implementation\n return parseJson(state);\n}\n\n/**\n * Get the implementation of the `getSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `getSnapState` hook.\n */\nexport function getGetSnapStateMethodImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof getSnapStateImplementation>) => {\n return runSaga(getSnapStateImplementation, ...args).result();\n };\n}\n\n/**\n * Update the Snap state in the store.\n *\n * @param _snapId - The ID of the Snap to update the state for. This is ignored\n * because the simulator only supports one Snap.\n * @param newState - The new state.\n * @param encrypted - Whether to update the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @yields Puts the new state in the store.\n */\nfunction* updateSnapStateImplementation(\n _snapId: string,\n newState: Record<string, Json>,\n encrypted = true,\n): SagaIterator<void> {\n // TODO: Use actual encryption implementation\n yield put(setState({ state: JSON.stringify(newState), encrypted }));\n}\n\n/**\n * Get the implementation of the `updateSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `updateSnapState` hook.\n */\nexport function getUpdateSnapStateMethodImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (...args: Parameters<typeof updateSnapStateImplementation>) => {\n runSaga(updateSnapStateImplementation, ...args).result();\n };\n}\n\n/**\n * Clear the Snap state in the store.\n *\n * @param _snapId - The ID of the Snap to clear the state for. This is ignored\n * because the simulator only supports one Snap.\n * @param encrypted - Whether to clear the encrypted or unencrypted state.\n * Defaults to encrypted state.\n * @yields Puts the new state in the store.\n */\nfunction* clearSnapStateImplementation(\n _snapId: string,\n encrypted = true,\n): SagaIterator<void> {\n yield put(clearState({ encrypted }));\n}\n\n/**\n * Get the implementation of the `clearSnapState` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `clearSnapState` hook.\n */\nexport function getClearSnapStateMethodImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (...args: Parameters<typeof clearSnapStateImplementation>) => {\n runSaga(clearSnapStateImplementation, ...args).result();\n };\n}\n"]}
@@ -1,24 +1,58 @@
1
1
  import type { Json } from "@metamask/utils";
2
+ import type { SagaIterator } from "redux-saga";
2
3
  import type { RunSagaFunction } from "../../store/index.cjs";
4
+ /**
5
+ * Get the Snap state from the store.
6
+ *
7
+ * @param _snapId - The ID of the Snap to get the state for. This is ignored
8
+ * because the simulator only supports one Snap.
9
+ * @param encrypted - Whether to get the encrypted or unencrypted state.
10
+ * Defaults to encrypted state.
11
+ * @returns The state of the Snap.
12
+ * @yields Selects the state from the store.
13
+ */
14
+ declare function getSnapStateImplementation(_snapId: string, encrypted?: boolean): SagaIterator<string>;
3
15
  /**
4
16
  * Get the implementation of the `getSnapState` hook.
5
17
  *
6
18
  * @param runSaga - The function to run a saga outside the usual Redux flow.
7
19
  * @returns The implementation of the `getSnapState` hook.
8
20
  */
9
- export declare function getGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, encrypted?: boolean | undefined) => any;
21
+ export declare function getGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof getSnapStateImplementation>) => any;
22
+ /**
23
+ * Update the Snap state in the store.
24
+ *
25
+ * @param _snapId - The ID of the Snap to update the state for. This is ignored
26
+ * because the simulator only supports one Snap.
27
+ * @param newState - The new state.
28
+ * @param encrypted - Whether to update the encrypted or unencrypted state.
29
+ * Defaults to encrypted state.
30
+ * @yields Puts the new state in the store.
31
+ */
32
+ declare function updateSnapStateImplementation(_snapId: string, newState: Record<string, Json>, encrypted?: boolean): SagaIterator<void>;
10
33
  /**
11
34
  * Get the implementation of the `updateSnapState` hook.
12
35
  *
13
36
  * @param runSaga - The function to run a saga outside the usual Redux flow.
14
37
  * @returns The implementation of the `updateSnapState` hook.
15
38
  */
16
- export declare function getUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, newState: Record<string, Json>, encrypted?: boolean | undefined) => Promise<void>;
39
+ export declare function getUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof updateSnapStateImplementation>) => Promise<void>;
40
+ /**
41
+ * Clear the Snap state in the store.
42
+ *
43
+ * @param _snapId - The ID of the Snap to clear the state for. This is ignored
44
+ * because the simulator only supports one Snap.
45
+ * @param encrypted - Whether to clear the encrypted or unencrypted state.
46
+ * Defaults to encrypted state.
47
+ * @yields Puts the new state in the store.
48
+ */
49
+ declare function clearSnapStateImplementation(_snapId: string, encrypted?: boolean): SagaIterator<void>;
17
50
  /**
18
51
  * Get the implementation of the `clearSnapState` hook.
19
52
  *
20
53
  * @param runSaga - The function to run a saga outside the usual Redux flow.
21
54
  * @returns The implementation of the `clearSnapState` hook.
22
55
  */
23
- export declare function getClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, encrypted?: boolean | undefined) => Promise<void>;
56
+ export declare function getClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (...args: Parameters<typeof clearSnapStateImplementation>) => Promise<void>;
57
+ export {};
24
58
  //# sourceMappingURL=state.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAI5C,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAsBnD;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,eAAe,6DAI3E;AAqBD;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,OAAO,EAAE,eAAe,uGAKzB;AAkBD;;;;;GAKG;AACH,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,eAAe,uEAKzB"}
1
+ {"version":3,"file":"state.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAGnD;;;;;;;;;GASG;AACH,iBAAU,0BAA0B,CAClC,OAAO,EAAE,MAAM,EACf,SAAS,UAAO,GACf,YAAY,CAAC,MAAM,CAAC,CAItB;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,eAAe,IAClE,GAAG,MAAM,UAAU,CAAC,OAAO,0BAA0B,CAAC,SAG/D;AAED;;;;;;;;;GASG;AACH,iBAAU,6BAA6B,CACrC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAC9B,SAAS,UAAO,GACf,YAAY,CAAC,IAAI,CAAC,CAGpB;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,OAAO,EAAE,eAAe,IAEV,GAAG,MAAM,UAAU,CAAC,OAAO,6BAA6B,CAAC,mBAGxE;AAED;;;;;;;;GAQG;AACH,iBAAU,4BAA4B,CACpC,OAAO,EAAE,MAAM,EACf,SAAS,UAAO,GACf,YAAY,CAAC,IAAI,CAAC,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,eAAe,IAEV,GAAG,MAAM,UAAU,CAAC,OAAO,4BAA4B,CAAC,mBAGvE"}