@metamask/snaps-jest 8.3.2 → 8.5.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 +80 -1
- package/LICENSE +15 -0
- package/dist/environment.cjs +2 -1
- package/dist/environment.cjs.map +1 -1
- package/dist/environment.d.cts +2 -2
- package/dist/environment.d.cts.map +1 -1
- package/dist/environment.d.mts +2 -2
- package/dist/environment.d.mts.map +1 -1
- package/dist/environment.mjs +3 -2
- package/dist/environment.mjs.map +1 -1
- package/dist/helpers.cjs +9 -176
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +1 -44
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +1 -44
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +11 -171
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internals/index.cjs +0 -3
- package/dist/internals/index.cjs.map +1 -1
- package/dist/internals/index.d.cts +0 -3
- package/dist/internals/index.d.cts.map +1 -1
- package/dist/internals/index.d.mts +0 -3
- package/dist/internals/index.d.mts.map +1 -1
- package/dist/internals/index.mjs +0 -3
- package/dist/internals/index.mjs.map +1 -1
- package/dist/matchers.cjs +3 -3
- package/dist/matchers.cjs.map +1 -1
- package/dist/matchers.d.cts.map +1 -1
- package/dist/matchers.d.mts.map +1 -1
- package/dist/matchers.mjs +1 -1
- package/dist/matchers.mjs.map +1 -1
- package/package.json +38 -33
- package/dist/internals/request.cjs +0 -143
- package/dist/internals/request.cjs.map +0 -1
- package/dist/internals/request.d.cts +0 -56
- package/dist/internals/request.d.cts.map +0 -1
- package/dist/internals/request.d.mts +0 -56
- package/dist/internals/request.d.mts.map +0 -1
- package/dist/internals/request.mjs +0 -138
- package/dist/internals/request.mjs.map +0 -1
- package/dist/internals/simulation/constants.cjs +0 -21
- package/dist/internals/simulation/constants.cjs.map +0 -1
- package/dist/internals/simulation/constants.d.cts +0 -18
- package/dist/internals/simulation/constants.d.cts.map +0 -1
- package/dist/internals/simulation/constants.d.mts +0 -18
- package/dist/internals/simulation/constants.d.mts.map +0 -1
- package/dist/internals/simulation/constants.mjs +0 -18
- package/dist/internals/simulation/constants.mjs.map +0 -1
- package/dist/internals/simulation/controllers.cjs +0 -101
- package/dist/internals/simulation/controllers.cjs.map +0 -1
- package/dist/internals/simulation/controllers.d.cts +0 -41
- package/dist/internals/simulation/controllers.d.cts.map +0 -1
- package/dist/internals/simulation/controllers.d.mts +0 -41
- package/dist/internals/simulation/controllers.d.mts.map +0 -1
- package/dist/internals/simulation/controllers.mjs +0 -96
- package/dist/internals/simulation/controllers.mjs.map +0 -1
- package/dist/internals/simulation/files.cjs +0 -94
- package/dist/internals/simulation/files.cjs.map +0 -1
- package/dist/internals/simulation/files.d.cts +0 -49
- package/dist/internals/simulation/files.d.cts.map +0 -1
- package/dist/internals/simulation/files.d.mts +0 -49
- package/dist/internals/simulation/files.d.mts.map +0 -1
- package/dist/internals/simulation/files.mjs +0 -91
- package/dist/internals/simulation/files.mjs.map +0 -1
- package/dist/internals/simulation/index.cjs +0 -22
- package/dist/internals/simulation/index.cjs.map +0 -1
- package/dist/internals/simulation/index.d.cts +0 -6
- package/dist/internals/simulation/index.d.cts.map +0 -1
- package/dist/internals/simulation/index.d.mts +0 -6
- package/dist/internals/simulation/index.d.mts.map +0 -1
- package/dist/internals/simulation/index.mjs +0 -6
- package/dist/internals/simulation/index.mjs.map +0 -1
- package/dist/internals/simulation/interface.cjs +0 -527
- package/dist/internals/simulation/interface.cjs.map +0 -1
- package/dist/internals/simulation/interface.d.cts +0 -152
- package/dist/internals/simulation/interface.d.cts.map +0 -1
- package/dist/internals/simulation/interface.d.mts +0 -152
- package/dist/internals/simulation/interface.d.mts.map +0 -1
- package/dist/internals/simulation/interface.mjs +0 -513
- package/dist/internals/simulation/interface.mjs.map +0 -1
- package/dist/internals/simulation/methods/constants.cjs +0 -72
- package/dist/internals/simulation/methods/constants.cjs.map +0 -1
- package/dist/internals/simulation/methods/constants.d.cts +0 -11
- package/dist/internals/simulation/methods/constants.d.cts.map +0 -1
- package/dist/internals/simulation/methods/constants.d.mts +0 -11
- package/dist/internals/simulation/methods/constants.d.mts.map +0 -1
- package/dist/internals/simulation/methods/constants.mjs +0 -69
- package/dist/internals/simulation/methods/constants.mjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/get-preferences.cjs +0 -18
- package/dist/internals/simulation/methods/hooks/get-preferences.cjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/get-preferences.d.cts +0 -14
- package/dist/internals/simulation/methods/hooks/get-preferences.d.cts.map +0 -1
- package/dist/internals/simulation/methods/hooks/get-preferences.d.mts +0 -14
- package/dist/internals/simulation/methods/hooks/get-preferences.d.mts.map +0 -1
- package/dist/internals/simulation/methods/hooks/get-preferences.mjs +0 -14
- package/dist/internals/simulation/methods/hooks/get-preferences.mjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/index.cjs +0 -22
- package/dist/internals/simulation/methods/hooks/index.cjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/index.d.cts +0 -6
- package/dist/internals/simulation/methods/hooks/index.d.cts.map +0 -1
- package/dist/internals/simulation/methods/hooks/index.d.mts +0 -6
- package/dist/internals/simulation/methods/hooks/index.d.mts.map +0 -1
- package/dist/internals/simulation/methods/hooks/index.mjs +0 -6
- package/dist/internals/simulation/methods/hooks/index.mjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/interface.cjs +0 -24
- package/dist/internals/simulation/methods/hooks/interface.cjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/interface.d.cts +0 -17
- package/dist/internals/simulation/methods/hooks/interface.d.cts.map +0 -1
- package/dist/internals/simulation/methods/hooks/interface.d.mts +0 -17
- package/dist/internals/simulation/methods/hooks/interface.d.mts.map +0 -1
- package/dist/internals/simulation/methods/hooks/interface.mjs +0 -19
- package/dist/internals/simulation/methods/hooks/interface.mjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/notifications.cjs +0 -58
- package/dist/internals/simulation/methods/hooks/notifications.cjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/notifications.d.cts +0 -17
- package/dist/internals/simulation/methods/hooks/notifications.d.cts.map +0 -1
- package/dist/internals/simulation/methods/hooks/notifications.d.mts +0 -17
- package/dist/internals/simulation/methods/hooks/notifications.d.mts.map +0 -1
- package/dist/internals/simulation/methods/hooks/notifications.mjs +0 -55
- package/dist/internals/simulation/methods/hooks/notifications.mjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/request-user-approval.cjs +0 -38
- package/dist/internals/simulation/methods/hooks/request-user-approval.cjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/request-user-approval.d.cts +0 -16
- package/dist/internals/simulation/methods/hooks/request-user-approval.d.cts.map +0 -1
- package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts +0 -16
- package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts.map +0 -1
- package/dist/internals/simulation/methods/hooks/request-user-approval.mjs +0 -35
- package/dist/internals/simulation/methods/hooks/request-user-approval.mjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/state.cjs +0 -84
- package/dist/internals/simulation/methods/hooks/state.cjs.map +0 -1
- package/dist/internals/simulation/methods/hooks/state.d.cts +0 -24
- package/dist/internals/simulation/methods/hooks/state.d.cts.map +0 -1
- package/dist/internals/simulation/methods/hooks/state.d.mts +0 -24
- package/dist/internals/simulation/methods/hooks/state.d.mts.map +0 -1
- package/dist/internals/simulation/methods/hooks/state.mjs +0 -79
- package/dist/internals/simulation/methods/hooks/state.mjs.map +0 -1
- package/dist/internals/simulation/methods/index.cjs +0 -18
- package/dist/internals/simulation/methods/index.cjs.map +0 -1
- package/dist/internals/simulation/methods/index.d.cts +0 -2
- package/dist/internals/simulation/methods/index.d.cts.map +0 -1
- package/dist/internals/simulation/methods/index.d.mts +0 -2
- package/dist/internals/simulation/methods/index.d.mts.map +0 -1
- package/dist/internals/simulation/methods/index.mjs +0 -2
- package/dist/internals/simulation/methods/index.mjs.map +0 -1
- package/dist/internals/simulation/methods/specifications.cjs +0 -85
- package/dist/internals/simulation/methods/specifications.cjs.map +0 -1
- package/dist/internals/simulation/methods/specifications.d.cts +0 -57
- package/dist/internals/simulation/methods/specifications.d.cts.map +0 -1
- package/dist/internals/simulation/methods/specifications.d.mts +0 -57
- package/dist/internals/simulation/methods/specifications.d.mts.map +0 -1
- package/dist/internals/simulation/methods/specifications.mjs +0 -78
- package/dist/internals/simulation/methods/specifications.mjs.map +0 -1
- package/dist/internals/simulation/middleware/engine.cjs +0 -37
- package/dist/internals/simulation/middleware/engine.cjs.map +0 -1
- package/dist/internals/simulation/middleware/engine.d.cts +0 -27
- package/dist/internals/simulation/middleware/engine.d.cts.map +0 -1
- package/dist/internals/simulation/middleware/engine.d.mts +0 -27
- package/dist/internals/simulation/middleware/engine.d.mts.map +0 -1
- package/dist/internals/simulation/middleware/engine.mjs +0 -34
- package/dist/internals/simulation/middleware/engine.mjs.map +0 -1
- package/dist/internals/simulation/middleware/index.cjs +0 -18
- package/dist/internals/simulation/middleware/index.cjs.map +0 -1
- package/dist/internals/simulation/middleware/index.d.cts +0 -2
- package/dist/internals/simulation/middleware/index.d.cts.map +0 -1
- package/dist/internals/simulation/middleware/index.d.mts +0 -2
- package/dist/internals/simulation/middleware/index.d.mts.map +0 -1
- package/dist/internals/simulation/middleware/index.mjs +0 -2
- package/dist/internals/simulation/middleware/index.mjs.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/accounts.cjs +0 -34
- package/dist/internals/simulation/middleware/internal-methods/accounts.cjs.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/accounts.d.cts +0 -20
- package/dist/internals/simulation/middleware/internal-methods/accounts.d.cts.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts +0 -20
- package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/accounts.mjs +0 -30
- package/dist/internals/simulation/middleware/internal-methods/accounts.mjs.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/index.cjs +0 -18
- package/dist/internals/simulation/middleware/internal-methods/index.cjs.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/index.d.cts +0 -2
- package/dist/internals/simulation/middleware/internal-methods/index.d.cts.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/index.d.mts +0 -2
- package/dist/internals/simulation/middleware/internal-methods/index.d.mts.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/index.mjs +0 -2
- package/dist/internals/simulation/middleware/internal-methods/index.mjs.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/middleware.cjs +0 -44
- package/dist/internals/simulation/middleware/internal-methods/middleware.cjs.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/middleware.d.cts +0 -23
- package/dist/internals/simulation/middleware/internal-methods/middleware.d.cts.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts +0 -23
- package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/middleware.mjs +0 -40
- package/dist/internals/simulation/middleware/internal-methods/middleware.mjs.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs +0 -28
- package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/provider-state.d.cts +0 -16
- package/dist/internals/simulation/middleware/internal-methods/provider-state.d.cts.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts +0 -16
- package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs +0 -24
- package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs.map +0 -1
- package/dist/internals/simulation/middleware/mock.cjs +0 -22
- package/dist/internals/simulation/middleware/mock.cjs.map +0 -1
- package/dist/internals/simulation/middleware/mock.d.cts +0 -11
- package/dist/internals/simulation/middleware/mock.d.cts.map +0 -1
- package/dist/internals/simulation/middleware/mock.d.mts +0 -11
- package/dist/internals/simulation/middleware/mock.d.mts.map +0 -1
- package/dist/internals/simulation/middleware/mock.mjs +0 -18
- package/dist/internals/simulation/middleware/mock.mjs.map +0 -1
- package/dist/internals/simulation/options.cjs +0 -25
- package/dist/internals/simulation/options.cjs.map +0 -1
- package/dist/internals/simulation/options.d.cts +0 -40
- package/dist/internals/simulation/options.d.cts.map +0 -1
- package/dist/internals/simulation/options.d.mts +0 -40
- package/dist/internals/simulation/options.d.mts.map +0 -1
- package/dist/internals/simulation/options.mjs +0 -21
- package/dist/internals/simulation/options.mjs.map +0 -1
- package/dist/internals/simulation/simulation.cjs +0 -155
- package/dist/internals/simulation/simulation.cjs.map +0 -1
- package/dist/internals/simulation/simulation.d.cts +0 -103
- package/dist/internals/simulation/simulation.d.cts.map +0 -1
- package/dist/internals/simulation/simulation.d.mts +0 -103
- package/dist/internals/simulation/simulation.d.mts.map +0 -1
- package/dist/internals/simulation/simulation.mjs +0 -150
- package/dist/internals/simulation/simulation.mjs.map +0 -1
- package/dist/internals/simulation/store/index.cjs +0 -21
- package/dist/internals/simulation/store/index.cjs.map +0 -1
- package/dist/internals/simulation/store/index.d.cts +0 -5
- package/dist/internals/simulation/store/index.d.cts.map +0 -1
- package/dist/internals/simulation/store/index.d.mts +0 -5
- package/dist/internals/simulation/store/index.d.mts.map +0 -1
- package/dist/internals/simulation/store/index.mjs +0 -5
- package/dist/internals/simulation/store/index.mjs.map +0 -1
- package/dist/internals/simulation/store/mocks.cjs +0 -39
- package/dist/internals/simulation/store/mocks.cjs.map +0 -1
- package/dist/internals/simulation/store/mocks.d.cts +0 -36
- package/dist/internals/simulation/store/mocks.d.cts.map +0 -1
- package/dist/internals/simulation/store/mocks.d.mts +0 -36
- package/dist/internals/simulation/store/mocks.d.mts.map +0 -1
- package/dist/internals/simulation/store/mocks.mjs +0 -35
- package/dist/internals/simulation/store/mocks.mjs.map +0 -1
- package/dist/internals/simulation/store/notifications.cjs +0 -35
- package/dist/internals/simulation/store/notifications.cjs.map +0 -1
- package/dist/internals/simulation/store/notifications.d.cts +0 -45
- package/dist/internals/simulation/store/notifications.d.cts.map +0 -1
- package/dist/internals/simulation/store/notifications.d.mts +0 -45
- package/dist/internals/simulation/store/notifications.d.mts.map +0 -1
- package/dist/internals/simulation/store/notifications.mjs +0 -32
- package/dist/internals/simulation/store/notifications.mjs.map +0 -1
- package/dist/internals/simulation/store/state.cjs +0 -54
- package/dist/internals/simulation/store/state.cjs.map +0 -1
- package/dist/internals/simulation/store/state.d.cts +0 -56
- package/dist/internals/simulation/store/state.d.cts.map +0 -1
- package/dist/internals/simulation/store/state.d.mts +0 -56
- package/dist/internals/simulation/store/state.d.mts.map +0 -1
- package/dist/internals/simulation/store/state.mjs +0 -50
- package/dist/internals/simulation/store/state.mjs.map +0 -1
- package/dist/internals/simulation/store/store.cjs +0 -51
- package/dist/internals/simulation/store/store.cjs.map +0 -1
- package/dist/internals/simulation/store/store.d.cts +0 -22
- package/dist/internals/simulation/store/store.d.cts.map +0 -1
- package/dist/internals/simulation/store/store.d.mts +0 -22
- package/dist/internals/simulation/store/store.d.mts.map +0 -1
- package/dist/internals/simulation/store/store.mjs +0 -45
- package/dist/internals/simulation/store/store.mjs.map +0 -1
- package/dist/internals/simulation/store/ui.cjs +0 -24
- package/dist/internals/simulation/store/ui.cjs.map +0 -1
- package/dist/internals/simulation/store/ui.d.cts +0 -27
- package/dist/internals/simulation/store/ui.d.cts.map +0 -1
- package/dist/internals/simulation/store/ui.d.mts +0 -27
- package/dist/internals/simulation/store/ui.d.mts.map +0 -1
- package/dist/internals/simulation/store/ui.mjs +0 -21
- package/dist/internals/simulation/store/ui.mjs.map +0 -1
- package/dist/internals/structs.cjs +0 -157
- package/dist/internals/structs.cjs.map +0 -1
- package/dist/internals/structs.d.cts +0 -205
- package/dist/internals/structs.d.cts.map +0 -1
- package/dist/internals/structs.d.mts +0 -205
- package/dist/internals/structs.d.mts.map +0 -1
- package/dist/internals/structs.mjs +0 -154
- package/dist/internals/structs.mjs.map +0 -1
- package/dist/types/index.cjs +0 -18
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.d.cts +0 -2
- package/dist/types/index.d.cts.map +0 -1
- package/dist/types/index.d.mts +0 -2
- package/dist/types/index.d.mts.map +0 -1
- package/dist/types/index.mjs +0 -2
- package/dist/types/index.mjs.map +0 -1
- package/dist/types/types.cjs +0 -3
- package/dist/types/types.cjs.map +0 -1
- package/dist/types/types.d.cts +0 -386
- package/dist/types/types.d.cts.map +0 -1
- package/dist/types/types.d.mts +0 -386
- package/dist/types/types.d.mts.map +0 -1
- package/dist/types/types.mjs +0 -2
- package/dist/types/types.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-user-approval.d.cts","sourceRoot":"","sources":["../../../../../src/internals/simulation/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,16 +0,0 @@
|
|
|
1
|
-
import type { RunSagaFunction } from "../../store/index.mjs";
|
|
2
|
-
type RequestUserApprovalParams = {
|
|
3
|
-
type: string;
|
|
4
|
-
requestData: {
|
|
5
|
-
id: string;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Get the implementation of the `requestUserApproval` hook.
|
|
10
|
-
*
|
|
11
|
-
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
12
|
-
* @returns The implementation of the `requestUserApproval` hook.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getRequestUserApprovalImplementation(runSaga: RunSagaFunction): (args_0: RequestUserApprovalParams) => Promise<any>;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=request-user-approval.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-user-approval.d.mts","sourceRoot":"","sources":["../../../../../src/internals/simulation/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,35 +0,0 @@
|
|
|
1
|
-
import $reduxsagaeffects from "redux-saga/effects";
|
|
2
|
-
const { put, take } = $reduxsagaeffects;
|
|
3
|
-
import { resolveInterface, setInterface, closeInterface } from "../../store/index.mjs";
|
|
4
|
-
/**
|
|
5
|
-
* Show a dialog to the user. This will wait for `resolveUserInterface` to be
|
|
6
|
-
* dispatched before returning.
|
|
7
|
-
*
|
|
8
|
-
* @param opts - The options for the request.
|
|
9
|
-
* @param opts.type - The type of dialog to show.
|
|
10
|
-
* @param opts.requestData - The data to display in the dialog.
|
|
11
|
-
* @param opts.requestData.id - The ID of the interface.
|
|
12
|
-
* @yields Sets the dialog in the store, waits for the user to resolve the
|
|
13
|
-
* dialog, and closes the dialog.
|
|
14
|
-
* @returns The result of the dialog.
|
|
15
|
-
*/
|
|
16
|
-
function* requestUserApprovalImplementation({ type, requestData: { id }, }) {
|
|
17
|
-
yield put(setInterface({ type, id }));
|
|
18
|
-
// We use `take` to wait for `resolveUserInterface` to be dispatched, which
|
|
19
|
-
// indicates that the user has resolved the dialog.
|
|
20
|
-
const { payload } = yield take(resolveInterface.type);
|
|
21
|
-
yield put(closeInterface());
|
|
22
|
-
return payload;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Get the implementation of the `requestUserApproval` hook.
|
|
26
|
-
*
|
|
27
|
-
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
28
|
-
* @returns The implementation of the `requestUserApproval` hook.
|
|
29
|
-
*/
|
|
30
|
-
export function getRequestUserApprovalImplementation(runSaga) {
|
|
31
|
-
return async (...args) => {
|
|
32
|
-
return await runSaga(requestUserApprovalImplementation, ...args).toPromise();
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=request-user-approval.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-user-approval.mjs","sourceRoot":"","sources":["../../../../../src/internals/simulation/methods/hooks/request-user-approval.ts"],"names":[],"mappings":";;AAIA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE,8BAAoB;AAS7E;;;;;;;;;;;GAWG;AACH,QAAQ,CAAC,CAAC,iCAAiC,CAAC,EAC1C,IAAI,EACJ,WAAW,EAAE,EAAE,EAAE,EAAE,GACO;IAC1B,MAAM,GAAG,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAEtC,2EAA2E;IAC3E,mDAAmD;IACnD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;IAE5B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,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,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getClearSnapStateMethodImplementation = exports.getUpdateSnapStateMethodImplementation = exports.getGetSnapStateMethodImplementation = 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 _snapId - The ID of the Snap to get the state for. This is ignored
|
|
11
|
-
* because the simulator only supports one Snap.
|
|
12
|
-
* @param encrypted - Whether to get the encrypted or unencrypted state.
|
|
13
|
-
* Defaults to encrypted state.
|
|
14
|
-
* @returns The state of the Snap.
|
|
15
|
-
* @yields Selects the state from the store.
|
|
16
|
-
*/
|
|
17
|
-
function* getSnapStateImplementation(_snapId, encrypted = true) {
|
|
18
|
-
const state = yield (0, effects_1.select)((0, store_1.getState)(encrypted));
|
|
19
|
-
// TODO: Use actual decryption implementation
|
|
20
|
-
return (0, snaps_utils_1.parseJson)(state);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Get the implementation of the `getSnapState` hook.
|
|
24
|
-
*
|
|
25
|
-
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
26
|
-
* @returns The implementation of the `getSnapState` hook.
|
|
27
|
-
*/
|
|
28
|
-
function getGetSnapStateMethodImplementation(runSaga) {
|
|
29
|
-
return (...args) => {
|
|
30
|
-
return runSaga(getSnapStateImplementation, ...args).result();
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
exports.getGetSnapStateMethodImplementation = getGetSnapStateMethodImplementation;
|
|
34
|
-
/**
|
|
35
|
-
* Update the Snap state in the store.
|
|
36
|
-
*
|
|
37
|
-
* @param _snapId - The ID of the Snap to update the state for. This is ignored
|
|
38
|
-
* because the simulator only supports one Snap.
|
|
39
|
-
* @param newState - The new state.
|
|
40
|
-
* @param encrypted - Whether to update the encrypted or unencrypted state.
|
|
41
|
-
* Defaults to encrypted state.
|
|
42
|
-
* @yields Puts the new state in the store.
|
|
43
|
-
*/
|
|
44
|
-
function* updateSnapStateImplementation(_snapId, newState, encrypted = true) {
|
|
45
|
-
// TODO: Use actual encryption implementation
|
|
46
|
-
yield (0, effects_1.put)((0, store_1.setState)({ state: JSON.stringify(newState), encrypted }));
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Get the implementation of the `updateSnapState` hook.
|
|
50
|
-
*
|
|
51
|
-
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
52
|
-
* @returns The implementation of the `updateSnapState` hook.
|
|
53
|
-
*/
|
|
54
|
-
function getUpdateSnapStateMethodImplementation(runSaga) {
|
|
55
|
-
return (...args) => {
|
|
56
|
-
runSaga(updateSnapStateImplementation, ...args).result();
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
exports.getUpdateSnapStateMethodImplementation = getUpdateSnapStateMethodImplementation;
|
|
60
|
-
/**
|
|
61
|
-
* Clear the Snap state in the store.
|
|
62
|
-
*
|
|
63
|
-
* @param _snapId - The ID of the Snap to clear the state for. This is ignored
|
|
64
|
-
* because the simulator only supports one Snap.
|
|
65
|
-
* @param encrypted - Whether to clear the encrypted or unencrypted state.
|
|
66
|
-
* Defaults to encrypted state.
|
|
67
|
-
* @yields Puts the new state in the store.
|
|
68
|
-
*/
|
|
69
|
-
function* clearSnapStateImplementation(_snapId, encrypted = true) {
|
|
70
|
-
yield (0, effects_1.put)((0, store_1.clearState)({ encrypted }));
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get the implementation of the `clearSnapState` hook.
|
|
74
|
-
*
|
|
75
|
-
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
76
|
-
* @returns The implementation of the `clearSnapState` hook.
|
|
77
|
-
*/
|
|
78
|
-
function getClearSnapStateMethodImplementation(runSaga) {
|
|
79
|
-
return async (...args) => {
|
|
80
|
-
runSaga(clearSnapStateImplementation, ...args).result();
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
exports.getClearSnapStateMethodImplementation = getClearSnapStateMethodImplementation;
|
|
84
|
-
//# sourceMappingURL=state.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.cjs","sourceRoot":"","sources":["../../../../../src/internals/simulation/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,CAAC,GAAG,IAAsD,EAAE,EAAE;QACnE,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 (...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 +0,0 @@
|
|
|
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 getGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, encrypted?: boolean | undefined) => 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 getUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, newState: Record<string, Json>, encrypted?: boolean | undefined) => void;
|
|
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 getClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, encrypted?: boolean | undefined) => Promise<void>;
|
|
24
|
-
//# sourceMappingURL=state.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.cts","sourceRoot":"","sources":["../../../../../src/internals/simulation/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,8FAKzB;AAkBD;;;;;GAKG;AACH,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,eAAe,uEAKzB"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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 getGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, encrypted?: boolean | undefined) => 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 getUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, newState: Record<string, Json>, encrypted?: boolean | undefined) => void;
|
|
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 getClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, encrypted?: boolean | undefined) => Promise<void>;
|
|
24
|
-
//# sourceMappingURL=state.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.mts","sourceRoot":"","sources":["../../../../../src/internals/simulation/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,8FAKzB;AAkBD;;;;;GAKG;AACH,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,eAAe,uEAKzB"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { parseJson } from "@metamask/snaps-utils";
|
|
2
|
-
import $reduxsagaeffects from "redux-saga/effects";
|
|
3
|
-
const { put, select } = $reduxsagaeffects;
|
|
4
|
-
import { clearState, getState, setState } from "../../store/index.mjs";
|
|
5
|
-
/**
|
|
6
|
-
* Get the Snap state from the store.
|
|
7
|
-
*
|
|
8
|
-
* @param _snapId - The ID of the Snap to get the state for. This is ignored
|
|
9
|
-
* because the simulator only supports one Snap.
|
|
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(_snapId, encrypted = true) {
|
|
16
|
-
const state = yield select(getState(encrypted));
|
|
17
|
-
// TODO: Use actual decryption implementation
|
|
18
|
-
return 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
|
-
export function getGetSnapStateMethodImplementation(runSaga) {
|
|
27
|
-
return (...args) => {
|
|
28
|
-
return runSaga(getSnapStateImplementation, ...args).result();
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Update the Snap state in the store.
|
|
33
|
-
*
|
|
34
|
-
* @param _snapId - The ID of the Snap to update the state for. This is ignored
|
|
35
|
-
* because the simulator only supports one Snap.
|
|
36
|
-
* @param newState - The new state.
|
|
37
|
-
* @param encrypted - Whether to update the encrypted or unencrypted state.
|
|
38
|
-
* Defaults to encrypted state.
|
|
39
|
-
* @yields Puts the new state in the store.
|
|
40
|
-
*/
|
|
41
|
-
function* updateSnapStateImplementation(_snapId, newState, encrypted = true) {
|
|
42
|
-
// TODO: Use actual encryption implementation
|
|
43
|
-
yield put(setState({ state: JSON.stringify(newState), encrypted }));
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Get the implementation of the `updateSnapState` hook.
|
|
47
|
-
*
|
|
48
|
-
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
49
|
-
* @returns The implementation of the `updateSnapState` hook.
|
|
50
|
-
*/
|
|
51
|
-
export function getUpdateSnapStateMethodImplementation(runSaga) {
|
|
52
|
-
return (...args) => {
|
|
53
|
-
runSaga(updateSnapStateImplementation, ...args).result();
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Clear the Snap state in the store.
|
|
58
|
-
*
|
|
59
|
-
* @param _snapId - The ID of the Snap to clear the state for. This is ignored
|
|
60
|
-
* because the simulator only supports one Snap.
|
|
61
|
-
* @param encrypted - Whether to clear the encrypted or unencrypted state.
|
|
62
|
-
* Defaults to encrypted state.
|
|
63
|
-
* @yields Puts the new state in the store.
|
|
64
|
-
*/
|
|
65
|
-
function* clearSnapStateImplementation(_snapId, encrypted = true) {
|
|
66
|
-
yield put(clearState({ encrypted }));
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Get the implementation of the `clearSnapState` hook.
|
|
70
|
-
*
|
|
71
|
-
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
72
|
-
* @returns The implementation of the `clearSnapState` hook.
|
|
73
|
-
*/
|
|
74
|
-
export function getClearSnapStateMethodImplementation(runSaga) {
|
|
75
|
-
return async (...args) => {
|
|
76
|
-
runSaga(clearSnapStateImplementation, ...args).result();
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=state.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.mjs","sourceRoot":"","sources":["../../../../../src/internals/simulation/methods/hooks/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,8BAA8B;;;AAMlD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,8BAAoB;AAE7D;;;;;;;;;GASG;AACH,QAAQ,CAAC,CAAC,0BAA0B,CAClC,OAAe,EACf,SAAS,GAAG,IAAI;IAEhB,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,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,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,sCAAsC,CACpD,OAAwB;IAExB,OAAO,CAAC,GAAG,IAAsD,EAAE,EAAE;QACnE,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,GAAG,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,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 (...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,18 +0,0 @@
|
|
|
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("./specifications.cjs"), exports);
|
|
18
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/internals/simulation/methods/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAiC","sourcesContent":["export * from './specifications';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/internals/simulation/methods/index.ts"],"names":[],"mappings":"AAAA,qCAAiC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/internals/simulation/methods/index.ts"],"names":[],"mappings":"AAAA,qCAAiC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/internals/simulation/methods/index.ts"],"names":[],"mappings":"AAAA,qCAAiC","sourcesContent":["export * from './specifications';\n"]}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEndowments = exports.getPermissionSpecifications = exports.asyncResolve = exports.resolve = void 0;
|
|
4
|
-
const snaps_rpc_methods_1 = require("@metamask/snaps-rpc-methods");
|
|
5
|
-
const snaps_utils_1 = require("@metamask/snaps-utils");
|
|
6
|
-
const constants_1 = require("./constants.cjs");
|
|
7
|
-
const hooks_1 = require("./hooks/index.cjs");
|
|
8
|
-
/**
|
|
9
|
-
* Get a function which resolves with the specified result.
|
|
10
|
-
*
|
|
11
|
-
* @param result - The result to return.
|
|
12
|
-
* @returns The function implementation.
|
|
13
|
-
*/
|
|
14
|
-
function resolve(result) {
|
|
15
|
-
return () => result;
|
|
16
|
-
}
|
|
17
|
-
exports.resolve = resolve;
|
|
18
|
-
/**
|
|
19
|
-
* Get a function which resolves with the specified result.
|
|
20
|
-
*
|
|
21
|
-
* @param result - The result to return. If not specified, the function will
|
|
22
|
-
* resolve with `undefined`.
|
|
23
|
-
* @returns The function implementation.
|
|
24
|
-
*/
|
|
25
|
-
function asyncResolve(result) {
|
|
26
|
-
return async () => result;
|
|
27
|
-
}
|
|
28
|
-
exports.asyncResolve = asyncResolve;
|
|
29
|
-
/**
|
|
30
|
-
* Get the permission specifications for the Snap.
|
|
31
|
-
*
|
|
32
|
-
* @param options - The options.
|
|
33
|
-
* @param options.controllerMessenger - The controller messenger.
|
|
34
|
-
* @param options.hooks - The hooks.
|
|
35
|
-
* @param options.runSaga - The function to run a saga outside the usual Redux
|
|
36
|
-
* flow.
|
|
37
|
-
* @param options.options - The simulation options.
|
|
38
|
-
* @returns The permission specifications for the Snap.
|
|
39
|
-
*/
|
|
40
|
-
function getPermissionSpecifications({ controllerMessenger, hooks, runSaga, options, }) {
|
|
41
|
-
return {
|
|
42
|
-
...(0, snaps_rpc_methods_1.buildSnapEndowmentSpecifications)(constants_1.EXCLUDED_SNAP_ENDOWMENTS),
|
|
43
|
-
...(0, snaps_rpc_methods_1.buildSnapRestrictedMethodSpecifications)(constants_1.EXCLUDED_SNAP_PERMISSIONS, {
|
|
44
|
-
// Shared hooks.
|
|
45
|
-
...hooks,
|
|
46
|
-
// Snaps-specific hooks.
|
|
47
|
-
clearSnapState: (0, hooks_1.getClearSnapStateMethodImplementation)(runSaga),
|
|
48
|
-
getPreferences: (0, hooks_1.getGetPreferencesMethodImplementation)(options),
|
|
49
|
-
getSnapState: (0, hooks_1.getGetSnapStateMethodImplementation)(runSaga),
|
|
50
|
-
getUnlockPromise: asyncResolve(true),
|
|
51
|
-
// TODO: Allow the user to specify the result of this function.
|
|
52
|
-
isOnPhishingList: resolve(false),
|
|
53
|
-
maybeUpdatePhishingList: asyncResolve(),
|
|
54
|
-
requestUserApproval: (0, hooks_1.getRequestUserApprovalImplementation)(runSaga),
|
|
55
|
-
showInAppNotification: (0, hooks_1.getShowInAppNotificationImplementation)(runSaga),
|
|
56
|
-
showNativeNotification: (0, hooks_1.getShowNativeNotificationImplementation)(runSaga),
|
|
57
|
-
updateSnapState: (0, hooks_1.getUpdateSnapStateMethodImplementation)(runSaga),
|
|
58
|
-
createInterface: (0, hooks_1.getCreateInterfaceImplementation)(controllerMessenger),
|
|
59
|
-
getInterface: (0, hooks_1.getGetInterfaceImplementation)(controllerMessenger),
|
|
60
|
-
}),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
exports.getPermissionSpecifications = getPermissionSpecifications;
|
|
64
|
-
/**
|
|
65
|
-
* Get the endowments for the Snap.
|
|
66
|
-
*
|
|
67
|
-
* @param permissionController - The permission controller.
|
|
68
|
-
* @param snapId - The ID of the Snap.
|
|
69
|
-
* @returns The endowments for the Snap.
|
|
70
|
-
*/
|
|
71
|
-
async function getEndowments(permissionController, snapId) {
|
|
72
|
-
const allEndowments = await Object.keys(snaps_rpc_methods_1.endowmentPermissionBuilders).reduce(async (promise, permissionName) => {
|
|
73
|
-
const accumulator = await promise;
|
|
74
|
-
if (permissionController.hasPermission(snapId, permissionName)) {
|
|
75
|
-
const endowments = await permissionController.getEndowments(snapId, permissionName);
|
|
76
|
-
if (endowments) {
|
|
77
|
-
return accumulator.concat(endowments);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return accumulator;
|
|
81
|
-
}, Promise.resolve([]));
|
|
82
|
-
return [...new Set([...snaps_utils_1.DEFAULT_ENDOWMENTS, ...allEndowments])];
|
|
83
|
-
}
|
|
84
|
-
exports.getEndowments = getEndowments;
|
|
85
|
-
//# sourceMappingURL=specifications.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"specifications.cjs","sourceRoot":"","sources":["../../../../src/internals/simulation/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,CAAC,MAAgB;IAC3C,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(result?: unknown) {\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"]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { GenericPermissionController } from "@metamask/permission-controller";
|
|
2
|
-
import type { SnapId } from "@metamask/snaps-sdk";
|
|
3
|
-
import type { RootControllerMessenger } from "../controllers.cjs";
|
|
4
|
-
import type { SimulationOptions } from "../options.cjs";
|
|
5
|
-
import type { RunSagaFunction } from "../store/index.cjs";
|
|
6
|
-
export type PermissionSpecificationsHooks = {
|
|
7
|
-
/**
|
|
8
|
-
* A hook that returns the user's secret recovery phrase.
|
|
9
|
-
*
|
|
10
|
-
* @returns The user's secret recovery phrase.
|
|
11
|
-
*/
|
|
12
|
-
getMnemonic: () => Promise<Uint8Array>;
|
|
13
|
-
};
|
|
14
|
-
export type GetPermissionSpecificationsOptions = {
|
|
15
|
-
controllerMessenger: RootControllerMessenger;
|
|
16
|
-
hooks: PermissionSpecificationsHooks;
|
|
17
|
-
runSaga: RunSagaFunction;
|
|
18
|
-
options: SimulationOptions;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Get a function which resolves with the specified result.
|
|
22
|
-
*
|
|
23
|
-
* @param result - The result to return.
|
|
24
|
-
* @returns The function implementation.
|
|
25
|
-
*/
|
|
26
|
-
export declare function resolve(result: unknown): () => unknown;
|
|
27
|
-
/**
|
|
28
|
-
* Get a function which resolves with the specified result.
|
|
29
|
-
*
|
|
30
|
-
* @param result - The result to return. If not specified, the function will
|
|
31
|
-
* resolve with `undefined`.
|
|
32
|
-
* @returns The function implementation.
|
|
33
|
-
*/
|
|
34
|
-
export declare function asyncResolve(result?: unknown): () => Promise<unknown>;
|
|
35
|
-
/**
|
|
36
|
-
* Get the permission specifications for the Snap.
|
|
37
|
-
*
|
|
38
|
-
* @param options - The options.
|
|
39
|
-
* @param options.controllerMessenger - The controller messenger.
|
|
40
|
-
* @param options.hooks - The hooks.
|
|
41
|
-
* @param options.runSaga - The function to run a saga outside the usual Redux
|
|
42
|
-
* flow.
|
|
43
|
-
* @param options.options - The simulation options.
|
|
44
|
-
* @returns The permission specifications for the Snap.
|
|
45
|
-
*/
|
|
46
|
-
export declare function getPermissionSpecifications({ controllerMessenger, hooks, runSaga, options, }: GetPermissionSpecificationsOptions): {
|
|
47
|
-
[x: string]: import("@metamask/permission-controller").PermissionSpecificationConstraint;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Get the endowments for the Snap.
|
|
51
|
-
*
|
|
52
|
-
* @param permissionController - The permission controller.
|
|
53
|
-
* @param snapId - The ID of the Snap.
|
|
54
|
-
* @returns The endowments for the Snap.
|
|
55
|
-
*/
|
|
56
|
-
export declare function getEndowments(permissionController: GenericPermissionController, snapId: SnapId): Promise<string[]>;
|
|
57
|
-
//# sourceMappingURL=specifications.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"specifications.d.cts","sourceRoot":"","sources":["../../../../src/internals/simulation/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,OAAO,0BAE5C;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"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { GenericPermissionController } from "@metamask/permission-controller";
|
|
2
|
-
import type { SnapId } from "@metamask/snaps-sdk";
|
|
3
|
-
import type { RootControllerMessenger } from "../controllers.mjs";
|
|
4
|
-
import type { SimulationOptions } from "../options.mjs";
|
|
5
|
-
import type { RunSagaFunction } from "../store/index.mjs";
|
|
6
|
-
export type PermissionSpecificationsHooks = {
|
|
7
|
-
/**
|
|
8
|
-
* A hook that returns the user's secret recovery phrase.
|
|
9
|
-
*
|
|
10
|
-
* @returns The user's secret recovery phrase.
|
|
11
|
-
*/
|
|
12
|
-
getMnemonic: () => Promise<Uint8Array>;
|
|
13
|
-
};
|
|
14
|
-
export type GetPermissionSpecificationsOptions = {
|
|
15
|
-
controllerMessenger: RootControllerMessenger;
|
|
16
|
-
hooks: PermissionSpecificationsHooks;
|
|
17
|
-
runSaga: RunSagaFunction;
|
|
18
|
-
options: SimulationOptions;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Get a function which resolves with the specified result.
|
|
22
|
-
*
|
|
23
|
-
* @param result - The result to return.
|
|
24
|
-
* @returns The function implementation.
|
|
25
|
-
*/
|
|
26
|
-
export declare function resolve(result: unknown): () => unknown;
|
|
27
|
-
/**
|
|
28
|
-
* Get a function which resolves with the specified result.
|
|
29
|
-
*
|
|
30
|
-
* @param result - The result to return. If not specified, the function will
|
|
31
|
-
* resolve with `undefined`.
|
|
32
|
-
* @returns The function implementation.
|
|
33
|
-
*/
|
|
34
|
-
export declare function asyncResolve(result?: unknown): () => Promise<unknown>;
|
|
35
|
-
/**
|
|
36
|
-
* Get the permission specifications for the Snap.
|
|
37
|
-
*
|
|
38
|
-
* @param options - The options.
|
|
39
|
-
* @param options.controllerMessenger - The controller messenger.
|
|
40
|
-
* @param options.hooks - The hooks.
|
|
41
|
-
* @param options.runSaga - The function to run a saga outside the usual Redux
|
|
42
|
-
* flow.
|
|
43
|
-
* @param options.options - The simulation options.
|
|
44
|
-
* @returns The permission specifications for the Snap.
|
|
45
|
-
*/
|
|
46
|
-
export declare function getPermissionSpecifications({ controllerMessenger, hooks, runSaga, options, }: GetPermissionSpecificationsOptions): {
|
|
47
|
-
[x: string]: import("@metamask/permission-controller").PermissionSpecificationConstraint;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Get the endowments for the Snap.
|
|
51
|
-
*
|
|
52
|
-
* @param permissionController - The permission controller.
|
|
53
|
-
* @param snapId - The ID of the Snap.
|
|
54
|
-
* @returns The endowments for the Snap.
|
|
55
|
-
*/
|
|
56
|
-
export declare function getEndowments(permissionController: GenericPermissionController, snapId: SnapId): Promise<string[]>;
|
|
57
|
-
//# sourceMappingURL=specifications.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"specifications.d.mts","sourceRoot":"","sources":["../../../../src/internals/simulation/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,OAAO,0BAE5C;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"}
|