@metamask/snaps-simulation 1.5.0 → 2.0.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 +16 -1
- package/dist/controllers.cjs.map +1 -1
- package/dist/controllers.d.cts +2 -2
- package/dist/controllers.d.cts.map +1 -1
- package/dist/controllers.d.mts +2 -2
- package/dist/controllers.d.mts.map +1 -1
- package/dist/controllers.mjs.map +1 -1
- package/dist/helpers.cjs +1 -0
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +9 -0
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +9 -0
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +1 -0
- package/dist/helpers.mjs.map +1 -1
- package/dist/interface.cjs +6 -0
- package/dist/interface.cjs.map +1 -1
- package/dist/interface.d.cts +1 -1
- package/dist/interface.d.cts.map +1 -1
- package/dist/interface.d.mts +1 -1
- package/dist/interface.d.mts.map +1 -1
- package/dist/interface.mjs +6 -0
- package/dist/interface.mjs.map +1 -1
- package/dist/methods/hooks/get-preferences.cjs +3 -2
- package/dist/methods/hooks/get-preferences.cjs.map +1 -1
- package/dist/methods/hooks/get-preferences.d.cts +3 -1
- package/dist/methods/hooks/get-preferences.d.cts.map +1 -1
- package/dist/methods/hooks/get-preferences.d.mts +3 -1
- package/dist/methods/hooks/get-preferences.d.mts.map +1 -1
- package/dist/methods/hooks/get-preferences.mjs +3 -2
- package/dist/methods/hooks/get-preferences.mjs.map +1 -1
- package/dist/methods/hooks/index.cjs +2 -1
- package/dist/methods/hooks/index.cjs.map +1 -1
- package/dist/methods/hooks/index.d.cts +2 -1
- package/dist/methods/hooks/index.d.cts.map +1 -1
- package/dist/methods/hooks/index.d.mts +2 -1
- package/dist/methods/hooks/index.d.mts.map +1 -1
- package/dist/methods/hooks/index.mjs +2 -1
- package/dist/methods/hooks/index.mjs.map +1 -1
- package/dist/methods/hooks/notifications.cjs +15 -2
- package/dist/methods/hooks/notifications.cjs.map +1 -1
- package/dist/methods/hooks/notifications.d.cts +13 -1
- package/dist/methods/hooks/notifications.d.cts.map +1 -1
- package/dist/methods/hooks/notifications.d.mts +13 -1
- package/dist/methods/hooks/notifications.d.mts.map +1 -1
- package/dist/methods/hooks/notifications.mjs +16 -3
- package/dist/methods/hooks/notifications.mjs.map +1 -1
- package/dist/methods/hooks/permitted/index.cjs +18 -0
- package/dist/methods/hooks/permitted/index.cjs.map +1 -0
- package/dist/methods/hooks/permitted/index.d.cts +2 -0
- package/dist/methods/hooks/permitted/index.d.cts.map +1 -0
- package/dist/methods/hooks/permitted/index.d.mts +2 -0
- package/dist/methods/hooks/permitted/index.d.mts.map +1 -0
- package/dist/methods/hooks/permitted/index.mjs +2 -0
- package/dist/methods/hooks/permitted/index.mjs.map +1 -0
- package/dist/methods/hooks/permitted/state.cjs +78 -0
- package/dist/methods/hooks/permitted/state.cjs.map +1 -0
- package/dist/methods/hooks/permitted/state.d.cts +24 -0
- package/dist/methods/hooks/permitted/state.d.cts.map +1 -0
- package/dist/methods/hooks/permitted/state.d.mts +24 -0
- package/dist/methods/hooks/permitted/state.d.mts.map +1 -0
- package/dist/methods/hooks/permitted/state.mjs +72 -0
- package/dist/methods/hooks/permitted/state.mjs.map +1 -0
- package/dist/methods/specifications.cjs.map +1 -1
- package/dist/methods/specifications.d.cts +1 -1
- package/dist/methods/specifications.d.cts.map +1 -1
- package/dist/methods/specifications.d.mts +1 -1
- package/dist/methods/specifications.d.mts.map +1 -1
- package/dist/methods/specifications.mjs.map +1 -1
- package/dist/middleware/engine.cjs +7 -4
- package/dist/middleware/engine.cjs.map +1 -1
- package/dist/middleware/engine.d.cts +6 -4
- package/dist/middleware/engine.d.cts.map +1 -1
- package/dist/middleware/engine.d.mts +6 -4
- package/dist/middleware/engine.d.mts.map +1 -1
- package/dist/middleware/engine.mjs +7 -4
- package/dist/middleware/engine.mjs.map +1 -1
- package/dist/options.cjs +1 -0
- package/dist/options.cjs.map +1 -1
- package/dist/options.d.cts +2 -0
- package/dist/options.d.cts.map +1 -1
- package/dist/options.d.mts +2 -0
- package/dist/options.d.mts.map +1 -1
- package/dist/options.mjs +2 -1
- package/dist/options.mjs.map +1 -1
- package/dist/request.cjs +8 -5
- package/dist/request.cjs.map +1 -1
- package/dist/request.d.cts +2 -1
- package/dist/request.d.cts.map +1 -1
- package/dist/request.d.mts +2 -1
- package/dist/request.d.mts.map +1 -1
- package/dist/request.mjs +8 -5
- package/dist/request.mjs.map +1 -1
- package/dist/simulation.cjs +30 -10
- package/dist/simulation.cjs.map +1 -1
- package/dist/simulation.d.cts +101 -13
- package/dist/simulation.d.cts.map +1 -1
- package/dist/simulation.d.mts +101 -13
- package/dist/simulation.d.mts.map +1 -1
- package/dist/simulation.mjs +28 -9
- package/dist/simulation.mjs.map +1 -1
- package/dist/store/notifications.cjs.map +1 -1
- package/dist/store/notifications.d.cts +9 -0
- package/dist/store/notifications.d.cts.map +1 -1
- package/dist/store/notifications.d.mts +9 -0
- package/dist/store/notifications.d.mts.map +1 -1
- package/dist/store/notifications.mjs.map +1 -1
- package/dist/store/ui.cjs.map +1 -1
- package/dist/store/ui.d.cts +1 -1
- package/dist/store/ui.d.cts.map +1 -1
- package/dist/store/ui.d.mts +1 -1
- package/dist/store/ui.d.mts.map +1 -1
- package/dist/store/ui.mjs.map +1 -1
- package/dist/structs.cjs +6 -0
- package/dist/structs.cjs.map +1 -1
- package/dist/structs.d.cts +66 -0
- package/dist/structs.d.cts.map +1 -1
- package/dist/structs.d.mts +66 -0
- package/dist/structs.d.mts.map +1 -1
- package/dist/structs.mjs +6 -0
- package/dist/structs.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +15 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +15 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +14 -14
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./get-preferences.cjs";
|
|
2
|
+
export * from "./interface.cjs";
|
|
2
3
|
export * from "./notifications.cjs";
|
|
4
|
+
export * from "./permitted/index.cjs";
|
|
3
5
|
export * from "./request-user-approval.cjs";
|
|
4
6
|
export * from "./state.cjs";
|
|
5
|
-
export * from "./interface.cjs";
|
|
6
7
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,oCAAgC;AAChC,4CAAwC;AACxC,4BAAwB
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,4BAAwB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./get-preferences.mjs";
|
|
2
|
+
export * from "./interface.mjs";
|
|
2
3
|
export * from "./notifications.mjs";
|
|
4
|
+
export * from "./permitted/index.mjs";
|
|
3
5
|
export * from "./request-user-approval.mjs";
|
|
4
6
|
export * from "./state.mjs";
|
|
5
|
-
export * from "./interface.mjs";
|
|
6
7
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,oCAAgC;AAChC,4CAAwC;AACxC,4BAAwB
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,4BAAwB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./get-preferences.mjs";
|
|
2
|
+
export * from "./interface.mjs";
|
|
2
3
|
export * from "./notifications.mjs";
|
|
4
|
+
export * from "./permitted/index.mjs";
|
|
3
5
|
export * from "./request-user-approval.mjs";
|
|
4
6
|
export * from "./state.mjs";
|
|
5
|
-
export * from "./interface.mjs";
|
|
6
7
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,oCAAgC;AAChC,4CAAwC;AACxC,4BAAwB
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,4BAAwB","sourcesContent":["export * from './get-preferences';\nexport * from './interface';\nexport * from './notifications';\nexport * from './permitted';\nexport * from './request-user-approval';\nexport * from './state';\n"]}
|
|
@@ -36,11 +36,24 @@ exports.getShowNativeNotificationImplementation = getShowNativeNotificationImple
|
|
|
36
36
|
* @param _snapId - The ID of the Snap that created the notification.
|
|
37
37
|
* @param options - The notification options.
|
|
38
38
|
* @param options.message - The message to show in the notification.
|
|
39
|
+
* @param options.title - The title to show in the notification.
|
|
40
|
+
* @param options.content - The JSX content to show in the notification.
|
|
41
|
+
* @param options.footerLink - The footer to show in the notification.
|
|
39
42
|
* @yields Adds the notification to the store.
|
|
40
43
|
* @returns `null`.
|
|
41
44
|
*/
|
|
42
|
-
function* showInAppNotificationImplementation(_snapId, { message }) {
|
|
43
|
-
|
|
45
|
+
function* showInAppNotificationImplementation(_snapId, { message, title, content, footerLink }) {
|
|
46
|
+
if (content) {
|
|
47
|
+
yield (0, effects_1.put)((0, store_1.setInterface)({ type: 'Notification', id: content }));
|
|
48
|
+
}
|
|
49
|
+
yield (0, effects_1.put)((0, store_1.addNotification)({
|
|
50
|
+
id: (0, toolkit_1.nanoid)(),
|
|
51
|
+
type: snaps_sdk_1.NotificationType.InApp,
|
|
52
|
+
message,
|
|
53
|
+
title,
|
|
54
|
+
content,
|
|
55
|
+
footerLink,
|
|
56
|
+
}));
|
|
44
57
|
return null;
|
|
45
58
|
}
|
|
46
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/notifications.ts"],"names":[],"mappings":";;;AACA,mDAAuD;AACvD,8CAA0C;AAE1C,gDAAyC;AAGzC,
|
|
1
|
+
{"version":3,"file":"notifications.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/notifications.ts"],"names":[],"mappings":";;;AACA,mDAAuD;AACvD,8CAA0C;AAE1C,gDAAyC;AAGzC,iDAA4D;AAE5D;;;;;;;;GAQG;AACH,QAAQ,CAAC,CAAC,oCAAoC,CAC5C,OAAe,EACf,EAAE,OAAO,EAAgB;IAEzB,MAAM,IAAA,aAAG,EACP,IAAA,uBAAe,EAAC,EAAE,EAAE,EAAE,IAAA,gBAAM,GAAE,EAAE,IAAI,EAAE,4BAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAC1E,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,uCAAuC,CACrD,OAAwB;IAExB,OAAO,KAAK,EACV,GAAG,IAA6D,EAChE,EAAE;QACF,OAAO,MAAM,OAAO,CAClB,oCAAoC,EACpC,GAAG,IAAI,CACR,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAXD,0FAWC;AAUD;;;;;;;;;;;GAWG;AACH,QAAQ,CAAC,CAAC,mCAAmC,CAC3C,OAAe,EACf,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAA2B;IAEhE,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,IAAA,aAAG,EAAC,IAAA,oBAAY,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,IAAA,aAAG,EACP,IAAA,uBAAe,EAAC;QACd,EAAE,EAAE,IAAA,gBAAM,GAAE;QACZ,IAAI,EAAE,4BAAgB,CAAC,KAAK;QAC5B,OAAO;QACP,KAAK;QACL,OAAO;QACP,UAAU;KACX,CAAC,CACH,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,sCAAsC,CACpD,OAAwB;IAExB,OAAO,KAAK,EACV,GAAG,IAA4D,EAC/D,EAAE;QACF,OAAO,MAAM,OAAO,CAClB,mCAAmC,EACnC,GAAG,IAAI,CACR,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAXD,wFAWC","sourcesContent":["import type { NotifyParams } from '@metamask/snaps-sdk';\nimport { NotificationType } from '@metamask/snaps-sdk';\nimport { nanoid } from '@reduxjs/toolkit';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { addNotification, setInterface } from '../../store';\n\n/**\n * Show a native notification to the user.\n *\n * @param _snapId - The ID of the Snap that created the notification.\n * @param options - The notification options.\n * @param options.message - The message to show in the notification.\n * @yields Adds the notification to the store.\n * @returns `null`.\n */\nfunction* showNativeNotificationImplementation(\n _snapId: string,\n { message }: NotifyParams,\n): SagaIterator {\n yield put(\n addNotification({ id: nanoid(), type: NotificationType.Native, message }),\n );\n\n return null;\n}\n\n/**\n * Get a method that can be used to show a native notification.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to show a native notification.\n */\nexport function getShowNativeNotificationImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (\n ...args: Parameters<typeof showNativeNotificationImplementation>\n ) => {\n return await runSaga(\n showNativeNotificationImplementation,\n ...args,\n ).toPromise();\n };\n}\n\ntype InAppNotificationParams = {\n type: NotificationType;\n message: string;\n title?: string | undefined;\n content?: string | undefined;\n footerLink?: { text: string; href: string } | undefined;\n};\n\n/**\n * Show an in-app notification to the user.\n *\n * @param _snapId - The ID of the Snap that created the notification.\n * @param options - The notification options.\n * @param options.message - The message to show in the notification.\n * @param options.title - The title to show in the notification.\n * @param options.content - The JSX content to show in the notification.\n * @param options.footerLink - The footer to show in the notification.\n * @yields Adds the notification to the store.\n * @returns `null`.\n */\nfunction* showInAppNotificationImplementation(\n _snapId: string,\n { message, title, content, footerLink }: InAppNotificationParams,\n): SagaIterator<null> {\n if (content) {\n yield put(setInterface({ type: 'Notification', id: content }));\n }\n\n yield put(\n addNotification({\n id: nanoid(),\n type: NotificationType.InApp,\n message,\n title,\n content,\n footerLink,\n }),\n );\n\n return null;\n}\n\n/**\n * Get a method that can be used to show an in-app notification.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to show an in-app notification.\n */\nexport function getShowInAppNotificationImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (\n ...args: Parameters<typeof showInAppNotificationImplementation>\n ) => {\n return await runSaga(\n showInAppNotificationImplementation,\n ...args,\n ).toPromise();\n };\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NotifyParams } from "@metamask/snaps-sdk";
|
|
2
|
+
import { NotificationType } from "@metamask/snaps-sdk";
|
|
2
3
|
import type { RunSagaFunction } from "../../store/index.cjs";
|
|
3
4
|
/**
|
|
4
5
|
* Get a method that can be used to show a native notification.
|
|
@@ -7,11 +8,22 @@ import type { RunSagaFunction } from "../../store/index.cjs";
|
|
|
7
8
|
* @returns A method that can be used to show a native notification.
|
|
8
9
|
*/
|
|
9
10
|
export declare function getShowNativeNotificationImplementation(runSaga: RunSagaFunction): (_snapId: string, args_1: NotifyParams) => Promise<any>;
|
|
11
|
+
type InAppNotificationParams = {
|
|
12
|
+
type: NotificationType;
|
|
13
|
+
message: string;
|
|
14
|
+
title?: string | undefined;
|
|
15
|
+
content?: string | undefined;
|
|
16
|
+
footerLink?: {
|
|
17
|
+
text: string;
|
|
18
|
+
href: string;
|
|
19
|
+
} | undefined;
|
|
20
|
+
};
|
|
10
21
|
/**
|
|
11
22
|
* Get a method that can be used to show an in-app notification.
|
|
12
23
|
*
|
|
13
24
|
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
14
25
|
* @returns A method that can be used to show an in-app notification.
|
|
15
26
|
*/
|
|
16
|
-
export declare function getShowInAppNotificationImplementation(runSaga: RunSagaFunction): (_snapId: string, args_1:
|
|
27
|
+
export declare function getShowInAppNotificationImplementation(runSaga: RunSagaFunction): (_snapId: string, args_1: InAppNotificationParams) => Promise<any>;
|
|
28
|
+
export {};
|
|
17
29
|
//# 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;
|
|
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,4 +1,5 @@
|
|
|
1
1
|
import type { NotifyParams } from "@metamask/snaps-sdk";
|
|
2
|
+
import { NotificationType } from "@metamask/snaps-sdk";
|
|
2
3
|
import type { RunSagaFunction } from "../../store/index.mjs";
|
|
3
4
|
/**
|
|
4
5
|
* Get a method that can be used to show a native notification.
|
|
@@ -7,11 +8,22 @@ import type { RunSagaFunction } from "../../store/index.mjs";
|
|
|
7
8
|
* @returns A method that can be used to show a native notification.
|
|
8
9
|
*/
|
|
9
10
|
export declare function getShowNativeNotificationImplementation(runSaga: RunSagaFunction): (_snapId: string, args_1: NotifyParams) => Promise<any>;
|
|
11
|
+
type InAppNotificationParams = {
|
|
12
|
+
type: NotificationType;
|
|
13
|
+
message: string;
|
|
14
|
+
title?: string | undefined;
|
|
15
|
+
content?: string | undefined;
|
|
16
|
+
footerLink?: {
|
|
17
|
+
text: string;
|
|
18
|
+
href: string;
|
|
19
|
+
} | undefined;
|
|
20
|
+
};
|
|
10
21
|
/**
|
|
11
22
|
* Get a method that can be used to show an in-app notification.
|
|
12
23
|
*
|
|
13
24
|
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
14
25
|
* @returns A method that can be used to show an in-app notification.
|
|
15
26
|
*/
|
|
16
|
-
export declare function getShowInAppNotificationImplementation(runSaga: RunSagaFunction): (_snapId: string, args_1:
|
|
27
|
+
export declare function getShowInAppNotificationImplementation(runSaga: RunSagaFunction): (_snapId: string, args_1: InAppNotificationParams) => Promise<any>;
|
|
28
|
+
export {};
|
|
17
29
|
//# 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;
|
|
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"}
|
|
@@ -2,7 +2,7 @@ import { NotificationType } from "@metamask/snaps-sdk";
|
|
|
2
2
|
import $reduxjstoolkit from "@reduxjs/toolkit";
|
|
3
3
|
const { nanoid } = $reduxjstoolkit;
|
|
4
4
|
import { put } from "redux-saga/effects";
|
|
5
|
-
import { addNotification } from "../../store/index.mjs";
|
|
5
|
+
import { addNotification, setInterface } from "../../store/index.mjs";
|
|
6
6
|
/**
|
|
7
7
|
* Show a native notification to the user.
|
|
8
8
|
*
|
|
@@ -33,11 +33,24 @@ export function getShowNativeNotificationImplementation(runSaga) {
|
|
|
33
33
|
* @param _snapId - The ID of the Snap that created the notification.
|
|
34
34
|
* @param options - The notification options.
|
|
35
35
|
* @param options.message - The message to show in the notification.
|
|
36
|
+
* @param options.title - The title to show in the notification.
|
|
37
|
+
* @param options.content - The JSX content to show in the notification.
|
|
38
|
+
* @param options.footerLink - The footer to show in the notification.
|
|
36
39
|
* @yields Adds the notification to the store.
|
|
37
40
|
* @returns `null`.
|
|
38
41
|
*/
|
|
39
|
-
function* showInAppNotificationImplementation(_snapId, { message }) {
|
|
40
|
-
|
|
42
|
+
function* showInAppNotificationImplementation(_snapId, { message, title, content, footerLink }) {
|
|
43
|
+
if (content) {
|
|
44
|
+
yield put(setInterface({ type: 'Notification', id: content }));
|
|
45
|
+
}
|
|
46
|
+
yield put(addNotification({
|
|
47
|
+
id: nanoid(),
|
|
48
|
+
type: NotificationType.InApp,
|
|
49
|
+
message,
|
|
50
|
+
title,
|
|
51
|
+
content,
|
|
52
|
+
footerLink,
|
|
53
|
+
}));
|
|
41
54
|
return null;
|
|
42
55
|
}
|
|
43
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/notifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,4BAA4B;;;AAGvD,OAAO,EAAE,GAAG,EAAE,2BAA2B;AAGzC,OAAO,EAAE,eAAe,EAAE,8BAAoB;
|
|
1
|
+
{"version":3,"file":"notifications.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/notifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,4BAA4B;;;AAGvD,OAAO,EAAE,GAAG,EAAE,2BAA2B;AAGzC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,8BAAoB;AAE5D;;;;;;;;GAQG;AACH,QAAQ,CAAC,CAAC,oCAAoC,CAC5C,OAAe,EACf,EAAE,OAAO,EAAgB;IAEzB,MAAM,GAAG,CACP,eAAe,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAC1E,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uCAAuC,CACrD,OAAwB;IAExB,OAAO,KAAK,EACV,GAAG,IAA6D,EAChE,EAAE;QACF,OAAO,MAAM,OAAO,CAClB,oCAAoC,EACpC,GAAG,IAAI,CACR,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAUD;;;;;;;;;;;GAWG;AACH,QAAQ,CAAC,CAAC,mCAAmC,CAC3C,OAAe,EACf,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAA2B;IAEhE,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,GAAG,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,GAAG,CACP,eAAe,CAAC;QACd,EAAE,EAAE,MAAM,EAAE;QACZ,IAAI,EAAE,gBAAgB,CAAC,KAAK;QAC5B,OAAO;QACP,KAAK;QACL,OAAO;QACP,UAAU;KACX,CAAC,CACH,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sCAAsC,CACpD,OAAwB;IAExB,OAAO,KAAK,EACV,GAAG,IAA4D,EAC/D,EAAE;QACF,OAAO,MAAM,OAAO,CAClB,mCAAmC,EACnC,GAAG,IAAI,CACR,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { NotifyParams } from '@metamask/snaps-sdk';\nimport { NotificationType } from '@metamask/snaps-sdk';\nimport { nanoid } from '@reduxjs/toolkit';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { addNotification, setInterface } from '../../store';\n\n/**\n * Show a native notification to the user.\n *\n * @param _snapId - The ID of the Snap that created the notification.\n * @param options - The notification options.\n * @param options.message - The message to show in the notification.\n * @yields Adds the notification to the store.\n * @returns `null`.\n */\nfunction* showNativeNotificationImplementation(\n _snapId: string,\n { message }: NotifyParams,\n): SagaIterator {\n yield put(\n addNotification({ id: nanoid(), type: NotificationType.Native, message }),\n );\n\n return null;\n}\n\n/**\n * Get a method that can be used to show a native notification.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to show a native notification.\n */\nexport function getShowNativeNotificationImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (\n ...args: Parameters<typeof showNativeNotificationImplementation>\n ) => {\n return await runSaga(\n showNativeNotificationImplementation,\n ...args,\n ).toPromise();\n };\n}\n\ntype InAppNotificationParams = {\n type: NotificationType;\n message: string;\n title?: string | undefined;\n content?: string | undefined;\n footerLink?: { text: string; href: string } | undefined;\n};\n\n/**\n * Show an in-app notification to the user.\n *\n * @param _snapId - The ID of the Snap that created the notification.\n * @param options - The notification options.\n * @param options.message - The message to show in the notification.\n * @param options.title - The title to show in the notification.\n * @param options.content - The JSX content to show in the notification.\n * @param options.footerLink - The footer to show in the notification.\n * @yields Adds the notification to the store.\n * @returns `null`.\n */\nfunction* showInAppNotificationImplementation(\n _snapId: string,\n { message, title, content, footerLink }: InAppNotificationParams,\n): SagaIterator<null> {\n if (content) {\n yield put(setInterface({ type: 'Notification', id: content }));\n }\n\n yield put(\n addNotification({\n id: nanoid(),\n type: NotificationType.InApp,\n message,\n title,\n content,\n footerLink,\n }),\n );\n\n return null;\n}\n\n/**\n * Get a method that can be used to show an in-app notification.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to show an in-app notification.\n */\nexport function getShowInAppNotificationImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (\n ...args: Parameters<typeof showInAppNotificationImplementation>\n ) => {\n return await runSaga(\n showInAppNotificationImplementation,\n ...args,\n ).toPromise();\n };\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./state.cjs"), exports);
|
|
18
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAAwB","sourcesContent":["export * from './state';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/index.ts"],"names":[],"mappings":"AAAA,4BAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/index.ts"],"names":[],"mappings":"AAAA,4BAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/index.ts"],"names":[],"mappings":"AAAA,4BAAwB","sourcesContent":["export * from './state';\n"]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPermittedClearSnapStateMethodImplementation = exports.getPermittedUpdateSnapStateMethodImplementation = exports.getPermittedGetSnapStateMethodImplementation = void 0;
|
|
4
|
+
const snaps_utils_1 = require("@metamask/snaps-utils");
|
|
5
|
+
const effects_1 = require("redux-saga/effects");
|
|
6
|
+
const store_1 = require("../../../store/index.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Get the Snap state from the store.
|
|
9
|
+
*
|
|
10
|
+
* @param encrypted - Whether to get the encrypted or unencrypted state.
|
|
11
|
+
* Defaults to encrypted state.
|
|
12
|
+
* @returns The state of the Snap.
|
|
13
|
+
* @yields Selects the state from the store.
|
|
14
|
+
*/
|
|
15
|
+
function* getSnapStateImplementation(encrypted) {
|
|
16
|
+
const state = yield (0, effects_1.select)((0, store_1.getState)(encrypted));
|
|
17
|
+
// TODO: Use actual decryption implementation
|
|
18
|
+
return (0, snaps_utils_1.parseJson)(state);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the implementation of the `getSnapState` hook.
|
|
22
|
+
*
|
|
23
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
24
|
+
* @returns The implementation of the `getSnapState` hook.
|
|
25
|
+
*/
|
|
26
|
+
function getPermittedGetSnapStateMethodImplementation(runSaga) {
|
|
27
|
+
return async (...args) => {
|
|
28
|
+
return await runSaga(getSnapStateImplementation, ...args).toPromise();
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.getPermittedGetSnapStateMethodImplementation = getPermittedGetSnapStateMethodImplementation;
|
|
32
|
+
/**
|
|
33
|
+
* Update the Snap state in the store.
|
|
34
|
+
*
|
|
35
|
+
* @param newState - The new state.
|
|
36
|
+
* @param encrypted - Whether to update the encrypted or unencrypted state.
|
|
37
|
+
* Defaults to encrypted state.
|
|
38
|
+
* @yields Puts the new state in the store.
|
|
39
|
+
*/
|
|
40
|
+
function* updateSnapStateImplementation(newState, encrypted) {
|
|
41
|
+
// TODO: Use actual encryption implementation
|
|
42
|
+
yield (0, effects_1.put)((0, store_1.setState)({ state: JSON.stringify(newState), encrypted }));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get the implementation of the `updateSnapState` hook.
|
|
46
|
+
*
|
|
47
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
48
|
+
* @returns The implementation of the `updateSnapState` hook.
|
|
49
|
+
*/
|
|
50
|
+
function getPermittedUpdateSnapStateMethodImplementation(runSaga) {
|
|
51
|
+
return async (...args) => {
|
|
52
|
+
return await runSaga(updateSnapStateImplementation, ...args).toPromise();
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
exports.getPermittedUpdateSnapStateMethodImplementation = getPermittedUpdateSnapStateMethodImplementation;
|
|
56
|
+
/**
|
|
57
|
+
* Clear the Snap state in the store.
|
|
58
|
+
*
|
|
59
|
+
* @param encrypted - Whether to clear the encrypted or unencrypted state.
|
|
60
|
+
* Defaults to encrypted state.
|
|
61
|
+
* @yields Puts the new state in the store.
|
|
62
|
+
*/
|
|
63
|
+
function* clearSnapStateImplementation(encrypted) {
|
|
64
|
+
yield (0, effects_1.put)((0, store_1.clearState)({ encrypted }));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the implementation of the `clearSnapState` hook.
|
|
68
|
+
*
|
|
69
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
70
|
+
* @returns The implementation of the `clearSnapState` hook.
|
|
71
|
+
*/
|
|
72
|
+
function getPermittedClearSnapStateMethodImplementation(runSaga) {
|
|
73
|
+
return async (...args) => {
|
|
74
|
+
runSaga(clearSnapStateImplementation, ...args).result();
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
exports.getPermittedClearSnapStateMethodImplementation = getPermittedClearSnapStateMethodImplementation;
|
|
78
|
+
//# sourceMappingURL=state.cjs.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Json } from "@metamask/utils";
|
|
2
|
+
import type { RunSagaFunction } from "../../../store/index.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Get the implementation of the `getSnapState` hook.
|
|
5
|
+
*
|
|
6
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
7
|
+
* @returns The implementation of the `getSnapState` hook.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getPermittedGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (encrypted: boolean) => Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* Get the implementation of the `updateSnapState` hook.
|
|
12
|
+
*
|
|
13
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
14
|
+
* @returns The implementation of the `updateSnapState` hook.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getPermittedUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (newState: Record<string, Json>, encrypted: boolean) => Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Get the implementation of the `clearSnapState` hook.
|
|
19
|
+
*
|
|
20
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
21
|
+
* @returns The implementation of the `clearSnapState` hook.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getPermittedClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (encrypted: boolean) => Promise<void>;
|
|
24
|
+
//# sourceMappingURL=state.d.cts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Json } from "@metamask/utils";
|
|
2
|
+
import type { RunSagaFunction } from "../../../store/index.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Get the implementation of the `getSnapState` hook.
|
|
5
|
+
*
|
|
6
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
7
|
+
* @returns The implementation of the `getSnapState` hook.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getPermittedGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (encrypted: boolean) => Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* Get the implementation of the `updateSnapState` hook.
|
|
12
|
+
*
|
|
13
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
14
|
+
* @returns The implementation of the `updateSnapState` hook.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getPermittedUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (newState: Record<string, Json>, encrypted: boolean) => Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Get the implementation of the `clearSnapState` hook.
|
|
19
|
+
*
|
|
20
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
21
|
+
* @returns The implementation of the `clearSnapState` hook.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getPermittedClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (encrypted: boolean) => Promise<void>;
|
|
24
|
+
//# sourceMappingURL=state.d.mts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { parseJson } from "@metamask/snaps-utils";
|
|
2
|
+
import { put, select } from "redux-saga/effects";
|
|
3
|
+
import { clearState, getState, setState } 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
|
+
function* getSnapStateImplementation(encrypted) {
|
|
13
|
+
const state = yield select(getState(encrypted));
|
|
14
|
+
// TODO: Use actual decryption implementation
|
|
15
|
+
return parseJson(state);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get the implementation of the `getSnapState` hook.
|
|
19
|
+
*
|
|
20
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
21
|
+
* @returns The implementation of the `getSnapState` hook.
|
|
22
|
+
*/
|
|
23
|
+
export function getPermittedGetSnapStateMethodImplementation(runSaga) {
|
|
24
|
+
return async (...args) => {
|
|
25
|
+
return await runSaga(getSnapStateImplementation, ...args).toPromise();
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Update the Snap state in the store.
|
|
30
|
+
*
|
|
31
|
+
* @param newState - The new state.
|
|
32
|
+
* @param encrypted - Whether to update the encrypted or unencrypted state.
|
|
33
|
+
* Defaults to encrypted state.
|
|
34
|
+
* @yields Puts the new state in the store.
|
|
35
|
+
*/
|
|
36
|
+
function* updateSnapStateImplementation(newState, encrypted) {
|
|
37
|
+
// TODO: Use actual encryption implementation
|
|
38
|
+
yield put(setState({ state: JSON.stringify(newState), encrypted }));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the implementation of the `updateSnapState` hook.
|
|
42
|
+
*
|
|
43
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
44
|
+
* @returns The implementation of the `updateSnapState` hook.
|
|
45
|
+
*/
|
|
46
|
+
export function getPermittedUpdateSnapStateMethodImplementation(runSaga) {
|
|
47
|
+
return async (...args) => {
|
|
48
|
+
return await runSaga(updateSnapStateImplementation, ...args).toPromise();
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Clear the Snap state in the store.
|
|
53
|
+
*
|
|
54
|
+
* @param encrypted - Whether to clear the encrypted or unencrypted state.
|
|
55
|
+
* Defaults to encrypted state.
|
|
56
|
+
* @yields Puts the new state in the store.
|
|
57
|
+
*/
|
|
58
|
+
function* clearSnapStateImplementation(encrypted) {
|
|
59
|
+
yield put(clearState({ encrypted }));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get the implementation of the `clearSnapState` hook.
|
|
63
|
+
*
|
|
64
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
65
|
+
* @returns The implementation of the `clearSnapState` hook.
|
|
66
|
+
*/
|
|
67
|
+
export function getPermittedClearSnapStateMethodImplementation(runSaga) {
|
|
68
|
+
return async (...args) => {
|
|
69
|
+
runSaga(clearSnapStateImplementation, ...args).result();
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=state.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.mjs","sourceRoot":"","sources":["../../../../src/methods/hooks/permitted/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,8BAA8B;AAGlD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,2BAA2B;AAGjD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,iCAAuB;AAEhE;;;;;;;GAOG;AACH,QAAQ,CAAC,CAAC,0BAA0B,CAAC,SAAkB;IACrD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IAChD,6CAA6C;IAC7C,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,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,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACtE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,+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,GAAG,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specifications.cjs","sourceRoot":"","sources":["../../src/methods/specifications.ts"],"names":[],"mappings":";;;AACA,mEAIqC;AAErC,uDAA2D;AAK3D,+CAGqB;AACrB,6CAUiB;AAkBjB;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,MAAe;IACrC,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC;AACtB,CAAC;AAFD,0BAEC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY,
|
|
1
|
+
{"version":3,"file":"specifications.cjs","sourceRoot":"","sources":["../../src/methods/specifications.ts"],"names":[],"mappings":";;;AACA,mEAIqC;AAErC,uDAA2D;AAK3D,+CAGqB;AACrB,6CAUiB;AAkBjB;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,MAAe;IACrC,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC;AACtB,CAAC;AAFD,0BAEC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY,CAAO,MAAa;IAC9C,OAAO,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC;AAC5B,CAAC;AAFD,oCAEC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,2BAA2B,CAAC,EAC1C,mBAAmB,EACnB,KAAK,EACL,OAAO,EACP,OAAO,GAC4B;IACnC,OAAO;QACL,GAAG,IAAA,oDAAgC,EAAC,oCAAwB,CAAC;QAC7D,GAAG,IAAA,2DAAuC,EAAC,qCAAyB,EAAE;YACpE,gBAAgB;YAChB,GAAG,KAAK;YAER,wBAAwB;YACxB,cAAc,EAAE,IAAA,6CAAqC,EAAC,OAAO,CAAC;YAC9D,cAAc,EAAE,IAAA,6CAAqC,EAAC,OAAO,CAAC;YAC9D,YAAY,EAAE,IAAA,2CAAmC,EAAC,OAAO,CAAC;YAC1D,gBAAgB,EAAE,YAAY,CAAC,IAAI,CAAC;YAEpC,+DAA+D;YAC/D,gBAAgB,EAAE,OAAO,CAAC,KAAK,CAAC;YAEhC,uBAAuB,EAAE,YAAY,EAAE;YACvC,mBAAmB,EAAE,IAAA,4CAAoC,EAAC,OAAO,CAAC;YAClE,qBAAqB,EAAE,IAAA,8CAAsC,EAAC,OAAO,CAAC;YACtE,sBAAsB,EAAE,IAAA,+CAAuC,EAAC,OAAO,CAAC;YACxE,eAAe,EAAE,IAAA,8CAAsC,EAAC,OAAO,CAAC;YAChE,eAAe,EAAE,IAAA,wCAAgC,EAAC,mBAAmB,CAAC;YACtE,YAAY,EAAE,IAAA,qCAA6B,EAAC,mBAAmB,CAAC;SACjE,CAAC;KACH,CAAC;AACJ,CAAC;AA9BD,kEA8BC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,aAAa,CACjC,oBAAiD,EACjD,MAAc;IAEd,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,+CAA2B,CAAC,CAAC,MAAM,CAEzE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE;QAClC,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC;QAClC,IAAI,oBAAoB,CAAC,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC;YAC/D,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAAC,aAAa,CACzD,MAAM,EACN,cAAc,CACf,CAAC;YAEF,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,WAAW,CAAC,MAAM,CAAC,UAAsB,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAExB,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,gCAAkB,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC;AAvBD,sCAuBC","sourcesContent":["import type { GenericPermissionController } from '@metamask/permission-controller';\nimport {\n endowmentPermissionBuilders,\n buildSnapEndowmentSpecifications,\n buildSnapRestrictedMethodSpecifications,\n} from '@metamask/snaps-rpc-methods';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport { DEFAULT_ENDOWMENTS } from '@metamask/snaps-utils';\n\nimport type { RootControllerMessenger } from '../controllers';\nimport type { SimulationOptions } from '../options';\nimport type { RunSagaFunction } from '../store';\nimport {\n EXCLUDED_SNAP_ENDOWMENTS,\n EXCLUDED_SNAP_PERMISSIONS,\n} from './constants';\nimport {\n getGetPreferencesMethodImplementation,\n getClearSnapStateMethodImplementation,\n getGetSnapStateMethodImplementation,\n getUpdateSnapStateMethodImplementation,\n getShowInAppNotificationImplementation,\n getShowNativeNotificationImplementation,\n getCreateInterfaceImplementation,\n getGetInterfaceImplementation,\n getRequestUserApprovalImplementation,\n} from './hooks';\n\nexport type PermissionSpecificationsHooks = {\n /**\n * A hook that returns the user's secret recovery phrase.\n *\n * @returns The user's secret recovery phrase.\n */\n getMnemonic: () => Promise<Uint8Array>;\n};\n\nexport type GetPermissionSpecificationsOptions = {\n controllerMessenger: RootControllerMessenger;\n hooks: PermissionSpecificationsHooks;\n runSaga: RunSagaFunction;\n options: SimulationOptions;\n};\n\n/**\n * Get a function which resolves with the specified result.\n *\n * @param result - The result to return.\n * @returns The function implementation.\n */\nexport function resolve(result: unknown) {\n return () => result;\n}\n\n/**\n * Get a function which resolves with the specified result.\n *\n * @param result - The result to return. If not specified, the function will\n * resolve with `undefined`.\n * @returns The function implementation.\n */\nexport function asyncResolve<Type>(result?: Type) {\n return async () => result;\n}\n\n/**\n * Get the permission specifications for the Snap.\n *\n * @param options - The options.\n * @param options.controllerMessenger - The controller messenger.\n * @param options.hooks - The hooks.\n * @param options.runSaga - The function to run a saga outside the usual Redux\n * flow.\n * @param options.options - The simulation options.\n * @returns The permission specifications for the Snap.\n */\nexport function getPermissionSpecifications({\n controllerMessenger,\n hooks,\n runSaga,\n options,\n}: GetPermissionSpecificationsOptions) {\n return {\n ...buildSnapEndowmentSpecifications(EXCLUDED_SNAP_ENDOWMENTS),\n ...buildSnapRestrictedMethodSpecifications(EXCLUDED_SNAP_PERMISSIONS, {\n // Shared hooks.\n ...hooks,\n\n // Snaps-specific hooks.\n clearSnapState: getClearSnapStateMethodImplementation(runSaga),\n getPreferences: getGetPreferencesMethodImplementation(options),\n getSnapState: getGetSnapStateMethodImplementation(runSaga),\n getUnlockPromise: asyncResolve(true),\n\n // TODO: Allow the user to specify the result of this function.\n isOnPhishingList: resolve(false),\n\n maybeUpdatePhishingList: asyncResolve(),\n requestUserApproval: getRequestUserApprovalImplementation(runSaga),\n showInAppNotification: getShowInAppNotificationImplementation(runSaga),\n showNativeNotification: getShowNativeNotificationImplementation(runSaga),\n updateSnapState: getUpdateSnapStateMethodImplementation(runSaga),\n createInterface: getCreateInterfaceImplementation(controllerMessenger),\n getInterface: getGetInterfaceImplementation(controllerMessenger),\n }),\n };\n}\n\n/**\n * Get the endowments for the Snap.\n *\n * @param permissionController - The permission controller.\n * @param snapId - The ID of the Snap.\n * @returns The endowments for the Snap.\n */\nexport async function getEndowments(\n permissionController: GenericPermissionController,\n snapId: SnapId,\n) {\n const allEndowments = await Object.keys(endowmentPermissionBuilders).reduce<\n Promise<string[]>\n >(async (promise, permissionName) => {\n const accumulator = await promise;\n if (permissionController.hasPermission(snapId, permissionName)) {\n const endowments = await permissionController.getEndowments(\n snapId,\n permissionName,\n );\n\n if (endowments) {\n return accumulator.concat(endowments as string[]);\n }\n }\n\n return accumulator;\n }, Promise.resolve([]));\n\n return [...new Set([...DEFAULT_ENDOWMENTS, ...allEndowments])];\n}\n"]}
|
|
@@ -31,7 +31,7 @@ export declare function resolve(result: unknown): () => unknown;
|
|
|
31
31
|
* resolve with `undefined`.
|
|
32
32
|
* @returns The function implementation.
|
|
33
33
|
*/
|
|
34
|
-
export declare function asyncResolve(result?:
|
|
34
|
+
export declare function asyncResolve<Type>(result?: Type): () => Promise<Type | undefined>;
|
|
35
35
|
/**
|
|
36
36
|
* Get the permission specifications for the Snap.
|
|
37
37
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specifications.d.cts","sourceRoot":"","sources":["../../src/methods/specifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,wCAAwC;AAMnF,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAGlD,OAAO,KAAK,EAAE,uBAAuB,EAAE,2BAAuB;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAmB;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,2BAAiB;AAiBhD,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;;OAIG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,KAAK,EAAE,6BAA6B,CAAC;IACrC,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,iBAEtC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"specifications.d.cts","sourceRoot":"","sources":["../../src/methods/specifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,wCAAwC;AAMnF,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAGlD,OAAO,KAAK,EAAE,uBAAuB,EAAE,2BAAuB;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAmB;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,2BAAiB;AAiBhD,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;;OAIG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,KAAK,EAAE,6BAA6B,CAAC;IACrC,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,iBAEtC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,mCAE/C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,mBAAmB,EACnB,KAAK,EACL,OAAO,EACP,OAAO,GACR,EAAE,kCAAkC;;EAyBpC;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,oBAAoB,EAAE,2BAA2B,EACjD,MAAM,EAAE,MAAM,qBAqBf"}
|
|
@@ -31,7 +31,7 @@ export declare function resolve(result: unknown): () => unknown;
|
|
|
31
31
|
* resolve with `undefined`.
|
|
32
32
|
* @returns The function implementation.
|
|
33
33
|
*/
|
|
34
|
-
export declare function asyncResolve(result?:
|
|
34
|
+
export declare function asyncResolve<Type>(result?: Type): () => Promise<Type | undefined>;
|
|
35
35
|
/**
|
|
36
36
|
* Get the permission specifications for the Snap.
|
|
37
37
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specifications.d.mts","sourceRoot":"","sources":["../../src/methods/specifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,wCAAwC;AAMnF,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAGlD,OAAO,KAAK,EAAE,uBAAuB,EAAE,2BAAuB;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAmB;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,2BAAiB;AAiBhD,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;;OAIG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,KAAK,EAAE,6BAA6B,CAAC;IACrC,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,iBAEtC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"specifications.d.mts","sourceRoot":"","sources":["../../src/methods/specifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,wCAAwC;AAMnF,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAGlD,OAAO,KAAK,EAAE,uBAAuB,EAAE,2BAAuB;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAmB;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,2BAAiB;AAiBhD,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;;OAIG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,KAAK,EAAE,6BAA6B,CAAC;IACrC,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,iBAEtC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,mCAE/C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,mBAAmB,EACnB,KAAK,EACL,OAAO,EACP,OAAO,GACR,EAAE,kCAAkC;;EAyBpC;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,oBAAoB,EAAE,2BAA2B,EACjD,MAAM,EAAE,MAAM,qBAqBf"}
|