@metamask/snaps-jest 8.3.2 → 8.4.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 +11 -1
- package/dist/environment.cjs +2 -1
- package/dist/environment.cjs.map +1 -1
- package/dist/environment.d.cts +1 -1
- package/dist/environment.d.cts.map +1 -1
- package/dist/environment.d.mts +1 -1
- 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 +13 -80
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +2 -44
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +2 -44
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +4 -64
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.cjs +8 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -0
- 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/dist/types/types.cjs.map +1 -1
- package/dist/types/types.d.cts +8 -1
- package/dist/types/types.d.cts.map +1 -1
- package/dist/types/types.d.mts +8 -1
- package/dist/types/types.d.mts.map +1 -1
- package/dist/types/types.mjs.map +1 -1
- package/package.json +4 -17
- 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
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getNotifications = exports.clearNotifications = exports.removeNotification = exports.addNotification = exports.notificationsSlice = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
/**
|
|
7
|
-
* The initial notifications state.
|
|
8
|
-
*/
|
|
9
|
-
const INITIAL_STATE = {
|
|
10
|
-
notifications: [],
|
|
11
|
-
};
|
|
12
|
-
exports.notificationsSlice = (0, toolkit_1.createSlice)({
|
|
13
|
-
name: 'notifications',
|
|
14
|
-
initialState: INITIAL_STATE,
|
|
15
|
-
reducers: {
|
|
16
|
-
addNotification: (state, action) => {
|
|
17
|
-
state.notifications.push(action.payload);
|
|
18
|
-
},
|
|
19
|
-
removeNotification: (state, action) => {
|
|
20
|
-
state.notifications = state.notifications.filter((notification) => notification.id !== action.payload);
|
|
21
|
-
},
|
|
22
|
-
clearNotifications: (state) => {
|
|
23
|
-
state.notifications = [];
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
_a = exports.notificationsSlice.actions, exports.addNotification = _a.addNotification, exports.removeNotification = _a.removeNotification, exports.clearNotifications = _a.clearNotifications;
|
|
28
|
-
/**
|
|
29
|
-
* Get the notifications from the state.
|
|
30
|
-
*
|
|
31
|
-
* @param state - The application state.
|
|
32
|
-
* @returns An array of notifications.
|
|
33
|
-
*/
|
|
34
|
-
exports.getNotifications = (0, toolkit_1.createSelector)((state) => state.notifications, ({ notifications }) => notifications);
|
|
35
|
-
//# sourceMappingURL=notifications.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.cjs","sourceRoot":"","sources":["../../../../src/internals/simulation/store/notifications.ts"],"names":[],"mappings":";;;;AAEA,8CAA+D;AA0B/D;;GAEG;AACH,MAAM,aAAa,GAAuB;IACxC,aAAa,EAAE,EAAE;CAClB,CAAC;AAEW,QAAA,kBAAkB,GAAG,IAAA,qBAAW,EAAC;IAC5C,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,aAAa;IAC3B,QAAQ,EAAE;QACR,eAAe,EAAE,CAAC,KAAK,EAAE,MAAmC,EAAE,EAAE;YAC9D,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAA6B,EAAE,EAAE;YAC3D,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAC9C,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CACrD,CAAC;QACJ,CAAC;QACD,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5B,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC;QAC3B,CAAC;KACF;CACF,CAAC,CAAC;AAEU,KACX,0BAAkB,CAAC,OAAO,EADb,uBAAe,uBAAE,0BAAkB,0BAAE,0BAAkB,yBACzC;AAE7B;;;;;GAKG;AACU,QAAA,gBAAgB,GAAG,IAAA,wBAAc,EAC5C,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,EAChD,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,aAAa,CACrC,CAAC","sourcesContent":["import type { NotificationType } from '@metamask/snaps-sdk';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSelector, createSlice } from '@reduxjs/toolkit';\n\nimport type { ApplicationState } from './store';\n\n/**\n * A notification object.\n *\n * @property id - A unique ID for the notification.\n * @property message - The notification message.\n * @property type - The notification type.\n */\nexport type Notification = {\n id: string;\n message: string;\n type: NotificationType;\n};\n\n/**\n * The notifications state.\n *\n * @property notifications - An array of notifications.\n */\nexport type NotificationsState = {\n notifications: Notification[];\n};\n\n/**\n * The initial notifications state.\n */\nconst INITIAL_STATE: NotificationsState = {\n notifications: [],\n};\n\nexport const notificationsSlice = createSlice({\n name: 'notifications',\n initialState: INITIAL_STATE,\n reducers: {\n addNotification: (state, action: PayloadAction<Notification>) => {\n state.notifications.push(action.payload);\n },\n removeNotification: (state, action: PayloadAction<string>) => {\n state.notifications = state.notifications.filter(\n (notification) => notification.id !== action.payload,\n );\n },\n clearNotifications: (state) => {\n state.notifications = [];\n },\n },\n});\n\nexport const { addNotification, removeNotification, clearNotifications } =\n notificationsSlice.actions;\n\n/**\n * Get the notifications from the state.\n *\n * @param state - The application state.\n * @returns An array of notifications.\n */\nexport const getNotifications = createSelector(\n (state: ApplicationState) => state.notifications,\n ({ notifications }) => notifications,\n);\n"]}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { NotificationType } from "@metamask/snaps-sdk";
|
|
2
|
-
import type { PayloadAction } from "@reduxjs/toolkit";
|
|
3
|
-
/**
|
|
4
|
-
* A notification object.
|
|
5
|
-
*
|
|
6
|
-
* @property id - A unique ID for the notification.
|
|
7
|
-
* @property message - The notification message.
|
|
8
|
-
* @property type - The notification type.
|
|
9
|
-
*/
|
|
10
|
-
export type Notification = {
|
|
11
|
-
id: string;
|
|
12
|
-
message: string;
|
|
13
|
-
type: NotificationType;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* The notifications state.
|
|
17
|
-
*
|
|
18
|
-
* @property notifications - An array of notifications.
|
|
19
|
-
*/
|
|
20
|
-
export type NotificationsState = {
|
|
21
|
-
notifications: Notification[];
|
|
22
|
-
};
|
|
23
|
-
export declare const notificationsSlice: import("@reduxjs/toolkit").Slice<NotificationsState, {
|
|
24
|
-
addNotification: (state: import("immer/dist/internal.js").WritableDraft<NotificationsState>, action: PayloadAction<Notification>) => void;
|
|
25
|
-
removeNotification: (state: import("immer/dist/internal.js").WritableDraft<NotificationsState>, action: PayloadAction<string>) => void;
|
|
26
|
-
clearNotifications: (state: import("immer/dist/internal.js").WritableDraft<NotificationsState>) => void;
|
|
27
|
-
}, "notifications">;
|
|
28
|
-
export declare const addNotification: import("@reduxjs/toolkit").ActionCreatorWithPayload<Notification, "notifications/addNotification">, removeNotification: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "notifications/removeNotification">, clearNotifications: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"notifications/clearNotifications">;
|
|
29
|
-
/**
|
|
30
|
-
* Get the notifications from the state.
|
|
31
|
-
*
|
|
32
|
-
* @param state - The application state.
|
|
33
|
-
* @returns An array of notifications.
|
|
34
|
-
*/
|
|
35
|
-
export declare const getNotifications: ((state: {
|
|
36
|
-
mocks: import("./mocks.cjs").MocksState;
|
|
37
|
-
notifications: NotificationsState;
|
|
38
|
-
state: import("./state.cjs").State;
|
|
39
|
-
ui: import("./ui.cjs").UiState;
|
|
40
|
-
}) => Notification[]) & import("reselect").OutputSelectorFields<(args_0: NotificationsState) => Notification[], {
|
|
41
|
-
clearCache: () => void;
|
|
42
|
-
}> & {
|
|
43
|
-
clearCache: () => void;
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=notifications.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.cts","sourceRoot":"","sources":["../../../../src/internals/simulation/store/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAKtD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B,CAAC;AASF,eAAO,MAAM,kBAAkB;yGAIM,cAAc,YAAY,CAAC;4GAGxB,cAAc,MAAM,CAAC;;mBAS3D,CAAC;AAEH,eAAO,MAAQ,eAAe,sGAAE,kBAAkB,mGAAE,kBAAkB,4FAC1C,CAAC;AAE7B;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;CAG5B,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { NotificationType } from "@metamask/snaps-sdk";
|
|
2
|
-
import type { PayloadAction } from "@reduxjs/toolkit";
|
|
3
|
-
/**
|
|
4
|
-
* A notification object.
|
|
5
|
-
*
|
|
6
|
-
* @property id - A unique ID for the notification.
|
|
7
|
-
* @property message - The notification message.
|
|
8
|
-
* @property type - The notification type.
|
|
9
|
-
*/
|
|
10
|
-
export type Notification = {
|
|
11
|
-
id: string;
|
|
12
|
-
message: string;
|
|
13
|
-
type: NotificationType;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* The notifications state.
|
|
17
|
-
*
|
|
18
|
-
* @property notifications - An array of notifications.
|
|
19
|
-
*/
|
|
20
|
-
export type NotificationsState = {
|
|
21
|
-
notifications: Notification[];
|
|
22
|
-
};
|
|
23
|
-
export declare const notificationsSlice: import("@reduxjs/toolkit").Slice<NotificationsState, {
|
|
24
|
-
addNotification: (state: import("immer/dist/internal.js").WritableDraft<NotificationsState>, action: PayloadAction<Notification>) => void;
|
|
25
|
-
removeNotification: (state: import("immer/dist/internal.js").WritableDraft<NotificationsState>, action: PayloadAction<string>) => void;
|
|
26
|
-
clearNotifications: (state: import("immer/dist/internal.js").WritableDraft<NotificationsState>) => void;
|
|
27
|
-
}, "notifications">;
|
|
28
|
-
export declare const addNotification: import("@reduxjs/toolkit").ActionCreatorWithPayload<Notification, "notifications/addNotification">, removeNotification: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "notifications/removeNotification">, clearNotifications: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"notifications/clearNotifications">;
|
|
29
|
-
/**
|
|
30
|
-
* Get the notifications from the state.
|
|
31
|
-
*
|
|
32
|
-
* @param state - The application state.
|
|
33
|
-
* @returns An array of notifications.
|
|
34
|
-
*/
|
|
35
|
-
export declare const getNotifications: ((state: {
|
|
36
|
-
mocks: import("./mocks.mjs").MocksState;
|
|
37
|
-
notifications: NotificationsState;
|
|
38
|
-
state: import("./state.mjs").State;
|
|
39
|
-
ui: import("./ui.mjs").UiState;
|
|
40
|
-
}) => Notification[]) & import("reselect").OutputSelectorFields<(args_0: NotificationsState) => Notification[], {
|
|
41
|
-
clearCache: () => void;
|
|
42
|
-
}> & {
|
|
43
|
-
clearCache: () => void;
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=notifications.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.mts","sourceRoot":"","sources":["../../../../src/internals/simulation/store/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAKtD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B,CAAC;AASF,eAAO,MAAM,kBAAkB;yGAIM,cAAc,YAAY,CAAC;4GAGxB,cAAc,MAAM,CAAC;;mBAS3D,CAAC;AAEH,eAAO,MAAQ,eAAe,sGAAE,kBAAkB,mGAAE,kBAAkB,4FAC1C,CAAC;AAE7B;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;CAG5B,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import $reduxjstoolkit from "@reduxjs/toolkit";
|
|
2
|
-
const { createSelector, createSlice } = $reduxjstoolkit;
|
|
3
|
-
/**
|
|
4
|
-
* The initial notifications state.
|
|
5
|
-
*/
|
|
6
|
-
const INITIAL_STATE = {
|
|
7
|
-
notifications: [],
|
|
8
|
-
};
|
|
9
|
-
export const notificationsSlice = createSlice({
|
|
10
|
-
name: 'notifications',
|
|
11
|
-
initialState: INITIAL_STATE,
|
|
12
|
-
reducers: {
|
|
13
|
-
addNotification: (state, action) => {
|
|
14
|
-
state.notifications.push(action.payload);
|
|
15
|
-
},
|
|
16
|
-
removeNotification: (state, action) => {
|
|
17
|
-
state.notifications = state.notifications.filter((notification) => notification.id !== action.payload);
|
|
18
|
-
},
|
|
19
|
-
clearNotifications: (state) => {
|
|
20
|
-
state.notifications = [];
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
export const { addNotification, removeNotification, clearNotifications } = notificationsSlice.actions;
|
|
25
|
-
/**
|
|
26
|
-
* Get the notifications from the state.
|
|
27
|
-
*
|
|
28
|
-
* @param state - The application state.
|
|
29
|
-
* @returns An array of notifications.
|
|
30
|
-
*/
|
|
31
|
-
export const getNotifications = createSelector((state) => state.notifications, ({ notifications }) => notifications);
|
|
32
|
-
//# sourceMappingURL=notifications.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.mjs","sourceRoot":"","sources":["../../../../src/internals/simulation/store/notifications.ts"],"names":[],"mappings":";;AA4BA;;GAEG;AACH,MAAM,aAAa,GAAuB;IACxC,aAAa,EAAE,EAAE;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC;IAC5C,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,aAAa;IAC3B,QAAQ,EAAE;QACR,eAAe,EAAE,CAAC,KAAK,EAAE,MAAmC,EAAE,EAAE;YAC9D,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAA6B,EAAE,EAAE;YAC3D,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAC9C,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CACrD,CAAC;QACJ,CAAC;QACD,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5B,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC;QAC3B,CAAC;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,GACtE,kBAAkB,CAAC,OAAO,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAC5C,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,EAChD,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,aAAa,CACrC,CAAC","sourcesContent":["import type { NotificationType } from '@metamask/snaps-sdk';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSelector, createSlice } from '@reduxjs/toolkit';\n\nimport type { ApplicationState } from './store';\n\n/**\n * A notification object.\n *\n * @property id - A unique ID for the notification.\n * @property message - The notification message.\n * @property type - The notification type.\n */\nexport type Notification = {\n id: string;\n message: string;\n type: NotificationType;\n};\n\n/**\n * The notifications state.\n *\n * @property notifications - An array of notifications.\n */\nexport type NotificationsState = {\n notifications: Notification[];\n};\n\n/**\n * The initial notifications state.\n */\nconst INITIAL_STATE: NotificationsState = {\n notifications: [],\n};\n\nexport const notificationsSlice = createSlice({\n name: 'notifications',\n initialState: INITIAL_STATE,\n reducers: {\n addNotification: (state, action: PayloadAction<Notification>) => {\n state.notifications.push(action.payload);\n },\n removeNotification: (state, action: PayloadAction<string>) => {\n state.notifications = state.notifications.filter(\n (notification) => notification.id !== action.payload,\n );\n },\n clearNotifications: (state) => {\n state.notifications = [];\n },\n },\n});\n\nexport const { addNotification, removeNotification, clearNotifications } =\n notificationsSlice.actions;\n\n/**\n * Get the notifications from the state.\n *\n * @param state - The application state.\n * @returns An array of notifications.\n */\nexport const getNotifications = createSelector(\n (state: ApplicationState) => state.notifications,\n ({ notifications }) => notifications,\n);\n"]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getState = exports.clearState = exports.setState = exports.stateSlice = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
/**
|
|
7
|
-
* The initial state.
|
|
8
|
-
*/
|
|
9
|
-
const INITIAL_STATE = {
|
|
10
|
-
encrypted: null,
|
|
11
|
-
unencrypted: null,
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* The state slice, which stores the state of the Snap.
|
|
15
|
-
*/
|
|
16
|
-
exports.stateSlice = (0, toolkit_1.createSlice)({
|
|
17
|
-
name: 'state',
|
|
18
|
-
initialState: INITIAL_STATE,
|
|
19
|
-
reducers: {
|
|
20
|
-
setState: (state, action) => {
|
|
21
|
-
if (action.payload.encrypted) {
|
|
22
|
-
state.encrypted = action.payload.state;
|
|
23
|
-
return state;
|
|
24
|
-
}
|
|
25
|
-
state.unencrypted = action.payload.state;
|
|
26
|
-
return state;
|
|
27
|
-
},
|
|
28
|
-
clearState: (state, action) => {
|
|
29
|
-
if (action.payload.encrypted) {
|
|
30
|
-
state.encrypted = null;
|
|
31
|
-
return state;
|
|
32
|
-
}
|
|
33
|
-
state.unencrypted = null;
|
|
34
|
-
return state;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
_a = exports.stateSlice.actions, exports.setState = _a.setState, exports.clearState = _a.clearState;
|
|
39
|
-
/**
|
|
40
|
-
* Get the state from the store.
|
|
41
|
-
*
|
|
42
|
-
* @param encrypted - Whether to get the encrypted or unencrypted state.
|
|
43
|
-
* @returns A selector that returns the state.
|
|
44
|
-
*/
|
|
45
|
-
function getState(encrypted) {
|
|
46
|
-
return (0, toolkit_1.createSelector)((state) => state, ({ state }) => {
|
|
47
|
-
if (encrypted) {
|
|
48
|
-
return state.encrypted;
|
|
49
|
-
}
|
|
50
|
-
return state.unencrypted;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
exports.getState = getState;
|
|
54
|
-
//# sourceMappingURL=state.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.cjs","sourceRoot":"","sources":["../../../../src/internals/simulation/store/state.ts"],"names":[],"mappings":";;;;AACA,8CAA+D;AAiB/D;;GAEG;AACH,MAAM,aAAa,GAAU;IAC3B,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF;;GAEG;AACU,QAAA,UAAU,GAAG,IAAA,qBAAW,EAAC;IACpC,IAAI,EAAE,OAAO;IACb,YAAY,EAAE,aAAa;IAC3B,QAAQ,EAAE;QACR,QAAQ,EAAE,CACR,KAAK,EACL,MAAmE,EACnE,EAAE;YACF,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;gBAC7B,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;gBACvC,OAAO,KAAK,CAAC;YACf,CAAC;YAED,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;YACzC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,UAAU,EAAE,CAAC,KAAK,EAAE,MAA6C,EAAE,EAAE;YACnE,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;gBAC7B,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;gBACvB,OAAO,KAAK,CAAC;YACf,CAAC;YAED,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;KACF;CACF,CAAC,CAAC;AAEU,KAA2B,kBAAU,CAAC,OAAO,EAA3C,gBAAQ,gBAAE,kBAAU,iBAAwB;AAE3D;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,SAAkB;IACzC,OAAO,IAAA,wBAAc,EACnB,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,EAClC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACZ,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,KAAK,CAAC,SAAS,CAAC;QACzB,CAAC;QAED,OAAO,KAAK,CAAC,WAAW,CAAC;IAC3B,CAAC,CACF,CAAC;AACJ,CAAC;AAXD,4BAWC","sourcesContent":["import type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSelector, createSlice } from '@reduxjs/toolkit';\n\nimport type { ApplicationState } from './store';\n\n/**\n * The Snap state object.\n *\n * @property encrypted - The encrypted state. Can be null if the Snap does not\n * have an encrypted state.\n * @property unencrypted - The unencrypted state. Can be null if the Snap does\n * not have an unencrypted state.\n */\nexport type State = {\n encrypted: string | null;\n unencrypted: string | null;\n};\n\n/**\n * The initial state.\n */\nconst INITIAL_STATE: State = {\n encrypted: null,\n unencrypted: null,\n};\n\n/**\n * The state slice, which stores the state of the Snap.\n */\nexport const stateSlice = createSlice({\n name: 'state',\n initialState: INITIAL_STATE,\n reducers: {\n setState: (\n state,\n action: PayloadAction<{ state: string | null; encrypted: boolean }>,\n ) => {\n if (action.payload.encrypted) {\n state.encrypted = action.payload.state;\n return state;\n }\n\n state.unencrypted = action.payload.state;\n return state;\n },\n clearState: (state, action: PayloadAction<{ encrypted: boolean }>) => {\n if (action.payload.encrypted) {\n state.encrypted = null;\n return state;\n }\n\n state.unencrypted = null;\n return state;\n },\n },\n});\n\nexport const { setState, clearState } = stateSlice.actions;\n\n/**\n * Get the state from the store.\n *\n * @param encrypted - Whether to get the encrypted or unencrypted state.\n * @returns A selector that returns the state.\n */\nexport function getState(encrypted: boolean) {\n return createSelector(\n (state: ApplicationState) => state,\n ({ state }) => {\n if (encrypted) {\n return state.encrypted;\n }\n\n return state.unencrypted;\n },\n );\n}\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
-
/**
|
|
3
|
-
* The Snap state object.
|
|
4
|
-
*
|
|
5
|
-
* @property encrypted - The encrypted state. Can be null if the Snap does not
|
|
6
|
-
* have an encrypted state.
|
|
7
|
-
* @property unencrypted - The unencrypted state. Can be null if the Snap does
|
|
8
|
-
* not have an unencrypted state.
|
|
9
|
-
*/
|
|
10
|
-
export type State = {
|
|
11
|
-
encrypted: string | null;
|
|
12
|
-
unencrypted: string | null;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* The state slice, which stores the state of the Snap.
|
|
16
|
-
*/
|
|
17
|
-
export declare const stateSlice: import("@reduxjs/toolkit").Slice<State, {
|
|
18
|
-
setState: (state: import("immer/dist/internal.js").WritableDraft<State>, action: {
|
|
19
|
-
payload: {
|
|
20
|
-
state: string | null;
|
|
21
|
-
encrypted: boolean;
|
|
22
|
-
};
|
|
23
|
-
type: string;
|
|
24
|
-
}) => import("immer/dist/internal.js").WritableDraft<State>;
|
|
25
|
-
clearState: (state: import("immer/dist/internal.js").WritableDraft<State>, action: PayloadAction<{
|
|
26
|
-
encrypted: boolean;
|
|
27
|
-
}>) => import("immer/dist/internal.js").WritableDraft<State>;
|
|
28
|
-
}, "state">;
|
|
29
|
-
export declare const setState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
|
-
state: string | null;
|
|
31
|
-
encrypted: boolean;
|
|
32
|
-
}, "state/setState">, clearState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
33
|
-
encrypted: boolean;
|
|
34
|
-
}, "state/clearState">;
|
|
35
|
-
/**
|
|
36
|
-
* Get the state from the store.
|
|
37
|
-
*
|
|
38
|
-
* @param encrypted - Whether to get the encrypted or unencrypted state.
|
|
39
|
-
* @returns A selector that returns the state.
|
|
40
|
-
*/
|
|
41
|
-
export declare function getState(encrypted: boolean): ((state: {
|
|
42
|
-
mocks: import("./mocks.cjs").MocksState;
|
|
43
|
-
notifications: import("./notifications.cjs").NotificationsState;
|
|
44
|
-
state: State;
|
|
45
|
-
ui: import("./ui.cjs").UiState;
|
|
46
|
-
}) => string | null) & import("reselect").OutputSelectorFields<(args_0: {
|
|
47
|
-
mocks: import("./mocks.cjs").MocksState;
|
|
48
|
-
notifications: import("./notifications.cjs").NotificationsState;
|
|
49
|
-
state: State;
|
|
50
|
-
ui: import("./ui.cjs").UiState;
|
|
51
|
-
}) => string | null, {
|
|
52
|
-
clearCache: () => void;
|
|
53
|
-
}> & {
|
|
54
|
-
clearCache: () => void;
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=state.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.cts","sourceRoot":"","sources":["../../../../src/internals/simulation/store/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAKtD;;;;;;;GAOG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAUF;;GAEG;AACH,eAAO,MAAM,UAAU;;;mBAMc,MAAM,GAAG,IAAI;uBAAa,OAAO;;;;uFAUtC,cAAc;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;WAUnE,CAAC;AAEH,eAAO,MAAQ,QAAQ;WAtBc,MAAM,GAAG,IAAI;eAAa,OAAO;sBAsB7C,UAAU;eAZwB,OAAO;sBAYR,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,OAAO;;;;;;;;;;;;;;EAW1C"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
-
/**
|
|
3
|
-
* The Snap state object.
|
|
4
|
-
*
|
|
5
|
-
* @property encrypted - The encrypted state. Can be null if the Snap does not
|
|
6
|
-
* have an encrypted state.
|
|
7
|
-
* @property unencrypted - The unencrypted state. Can be null if the Snap does
|
|
8
|
-
* not have an unencrypted state.
|
|
9
|
-
*/
|
|
10
|
-
export type State = {
|
|
11
|
-
encrypted: string | null;
|
|
12
|
-
unencrypted: string | null;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* The state slice, which stores the state of the Snap.
|
|
16
|
-
*/
|
|
17
|
-
export declare const stateSlice: import("@reduxjs/toolkit").Slice<State, {
|
|
18
|
-
setState: (state: import("immer/dist/internal.js").WritableDraft<State>, action: {
|
|
19
|
-
payload: {
|
|
20
|
-
state: string | null;
|
|
21
|
-
encrypted: boolean;
|
|
22
|
-
};
|
|
23
|
-
type: string;
|
|
24
|
-
}) => import("immer/dist/internal.js").WritableDraft<State>;
|
|
25
|
-
clearState: (state: import("immer/dist/internal.js").WritableDraft<State>, action: PayloadAction<{
|
|
26
|
-
encrypted: boolean;
|
|
27
|
-
}>) => import("immer/dist/internal.js").WritableDraft<State>;
|
|
28
|
-
}, "state">;
|
|
29
|
-
export declare const setState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
|
-
state: string | null;
|
|
31
|
-
encrypted: boolean;
|
|
32
|
-
}, "state/setState">, clearState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
33
|
-
encrypted: boolean;
|
|
34
|
-
}, "state/clearState">;
|
|
35
|
-
/**
|
|
36
|
-
* Get the state from the store.
|
|
37
|
-
*
|
|
38
|
-
* @param encrypted - Whether to get the encrypted or unencrypted state.
|
|
39
|
-
* @returns A selector that returns the state.
|
|
40
|
-
*/
|
|
41
|
-
export declare function getState(encrypted: boolean): ((state: {
|
|
42
|
-
mocks: import("./mocks.mjs").MocksState;
|
|
43
|
-
notifications: import("./notifications.mjs").NotificationsState;
|
|
44
|
-
state: State;
|
|
45
|
-
ui: import("./ui.mjs").UiState;
|
|
46
|
-
}) => string | null) & import("reselect").OutputSelectorFields<(args_0: {
|
|
47
|
-
mocks: import("./mocks.mjs").MocksState;
|
|
48
|
-
notifications: import("./notifications.mjs").NotificationsState;
|
|
49
|
-
state: State;
|
|
50
|
-
ui: import("./ui.mjs").UiState;
|
|
51
|
-
}) => string | null, {
|
|
52
|
-
clearCache: () => void;
|
|
53
|
-
}> & {
|
|
54
|
-
clearCache: () => void;
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=state.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.mts","sourceRoot":"","sources":["../../../../src/internals/simulation/store/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAKtD;;;;;;;GAOG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAUF;;GAEG;AACH,eAAO,MAAM,UAAU;;;mBAMc,MAAM,GAAG,IAAI;uBAAa,OAAO;;;;uFAUtC,cAAc;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;WAUnE,CAAC;AAEH,eAAO,MAAQ,QAAQ;WAtBc,MAAM,GAAG,IAAI;eAAa,OAAO;sBAsB7C,UAAU;eAZwB,OAAO;sBAYR,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,OAAO;;;;;;;;;;;;;;EAW1C"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import $reduxjstoolkit from "@reduxjs/toolkit";
|
|
2
|
-
const { createSelector, createSlice } = $reduxjstoolkit;
|
|
3
|
-
/**
|
|
4
|
-
* The initial state.
|
|
5
|
-
*/
|
|
6
|
-
const INITIAL_STATE = {
|
|
7
|
-
encrypted: null,
|
|
8
|
-
unencrypted: null,
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* The state slice, which stores the state of the Snap.
|
|
12
|
-
*/
|
|
13
|
-
export const stateSlice = createSlice({
|
|
14
|
-
name: 'state',
|
|
15
|
-
initialState: INITIAL_STATE,
|
|
16
|
-
reducers: {
|
|
17
|
-
setState: (state, action) => {
|
|
18
|
-
if (action.payload.encrypted) {
|
|
19
|
-
state.encrypted = action.payload.state;
|
|
20
|
-
return state;
|
|
21
|
-
}
|
|
22
|
-
state.unencrypted = action.payload.state;
|
|
23
|
-
return state;
|
|
24
|
-
},
|
|
25
|
-
clearState: (state, action) => {
|
|
26
|
-
if (action.payload.encrypted) {
|
|
27
|
-
state.encrypted = null;
|
|
28
|
-
return state;
|
|
29
|
-
}
|
|
30
|
-
state.unencrypted = null;
|
|
31
|
-
return state;
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
export const { setState, clearState } = stateSlice.actions;
|
|
36
|
-
/**
|
|
37
|
-
* Get the state from the store.
|
|
38
|
-
*
|
|
39
|
-
* @param encrypted - Whether to get the encrypted or unencrypted state.
|
|
40
|
-
* @returns A selector that returns the state.
|
|
41
|
-
*/
|
|
42
|
-
export function getState(encrypted) {
|
|
43
|
-
return createSelector((state) => state, ({ state }) => {
|
|
44
|
-
if (encrypted) {
|
|
45
|
-
return state.encrypted;
|
|
46
|
-
}
|
|
47
|
-
return state.unencrypted;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=state.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.mjs","sourceRoot":"","sources":["../../../../src/internals/simulation/store/state.ts"],"names":[],"mappings":";;AAkBA;;GAEG;AACH,MAAM,aAAa,GAAU;IAC3B,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;IACpC,IAAI,EAAE,OAAO;IACb,YAAY,EAAE,aAAa;IAC3B,QAAQ,EAAE;QACR,QAAQ,EAAE,CACR,KAAK,EACL,MAAmE,EACnE,EAAE;YACF,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;gBAC7B,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;gBACvC,OAAO,KAAK,CAAC;YACf,CAAC;YAED,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;YACzC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,UAAU,EAAE,CAAC,KAAK,EAAE,MAA6C,EAAE,EAAE;YACnE,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;gBAC7B,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;gBACvB,OAAO,KAAK,CAAC;YACf,CAAC;YAED,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAkB;IACzC,OAAO,cAAc,CACnB,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,EAClC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACZ,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,KAAK,CAAC,SAAS,CAAC;QACzB,CAAC;QAED,OAAO,KAAK,CAAC,WAAW,CAAC;IAC3B,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSelector, createSlice } from '@reduxjs/toolkit';\n\nimport type { ApplicationState } from './store';\n\n/**\n * The Snap state object.\n *\n * @property encrypted - The encrypted state. Can be null if the Snap does not\n * have an encrypted state.\n * @property unencrypted - The unencrypted state. Can be null if the Snap does\n * not have an unencrypted state.\n */\nexport type State = {\n encrypted: string | null;\n unencrypted: string | null;\n};\n\n/**\n * The initial state.\n */\nconst INITIAL_STATE: State = {\n encrypted: null,\n unencrypted: null,\n};\n\n/**\n * The state slice, which stores the state of the Snap.\n */\nexport const stateSlice = createSlice({\n name: 'state',\n initialState: INITIAL_STATE,\n reducers: {\n setState: (\n state,\n action: PayloadAction<{ state: string | null; encrypted: boolean }>,\n ) => {\n if (action.payload.encrypted) {\n state.encrypted = action.payload.state;\n return state;\n }\n\n state.unencrypted = action.payload.state;\n return state;\n },\n clearState: (state, action: PayloadAction<{ encrypted: boolean }>) => {\n if (action.payload.encrypted) {\n state.encrypted = null;\n return state;\n }\n\n state.unencrypted = null;\n return state;\n },\n },\n});\n\nexport const { setState, clearState } = stateSlice.actions;\n\n/**\n * Get the state from the store.\n *\n * @param encrypted - Whether to get the encrypted or unencrypted state.\n * @returns A selector that returns the state.\n */\nexport function getState(encrypted: boolean) {\n return createSelector(\n (state: ApplicationState) => state,\n ({ state }) => {\n if (encrypted) {\n return state.encrypted;\n }\n\n return state.unencrypted;\n },\n );\n}\n"]}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createStore = void 0;
|
|
7
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
8
|
-
const redux_saga_1 = __importDefault(require("redux-saga"));
|
|
9
|
-
const mocks_1 = require("./mocks.cjs");
|
|
10
|
-
const notifications_1 = require("./notifications.cjs");
|
|
11
|
-
const state_1 = require("./state.cjs");
|
|
12
|
-
const ui_1 = require("./ui.cjs");
|
|
13
|
-
/**
|
|
14
|
-
* Create a Redux store.
|
|
15
|
-
*
|
|
16
|
-
* @param options - The simulation options.
|
|
17
|
-
* @param options.state - The initial state for the Snap.
|
|
18
|
-
* @param options.unencryptedState - The initial unencrypted state for the Snap.
|
|
19
|
-
* @returns A Redux store with the default state.
|
|
20
|
-
*/
|
|
21
|
-
function createStore({ state, unencryptedState }) {
|
|
22
|
-
const sagaMiddleware = (0, redux_saga_1.default)();
|
|
23
|
-
const store = (0, toolkit_1.configureStore)({
|
|
24
|
-
reducer: {
|
|
25
|
-
mocks: mocks_1.mocksSlice.reducer,
|
|
26
|
-
notifications: notifications_1.notificationsSlice.reducer,
|
|
27
|
-
state: state_1.stateSlice.reducer,
|
|
28
|
-
ui: ui_1.uiSlice.reducer,
|
|
29
|
-
},
|
|
30
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware({ thunk: false }).concat(sagaMiddleware),
|
|
31
|
-
});
|
|
32
|
-
// Set initial state for the Snap.
|
|
33
|
-
if (state) {
|
|
34
|
-
store.dispatch((0, state_1.setState)({
|
|
35
|
-
state: JSON.stringify(state),
|
|
36
|
-
encrypted: true,
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
if (unencryptedState) {
|
|
40
|
-
store.dispatch((0, state_1.setState)({
|
|
41
|
-
state: JSON.stringify(unencryptedState),
|
|
42
|
-
encrypted: false,
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
store,
|
|
47
|
-
runSaga: sagaMiddleware.run.bind(sagaMiddleware),
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
exports.createStore = createStore;
|
|
51
|
-
//# sourceMappingURL=store.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.cjs","sourceRoot":"","sources":["../../../../src/internals/simulation/store/store.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAkD;AAClD,4DAA8C;AAG9C,uCAAqC;AACrC,uDAAqD;AACrD,uCAA+C;AAC/C,iCAA+B;AAE/B;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAqB;IACxE,MAAM,cAAc,GAAG,IAAA,oBAAoB,GAAE,CAAC;IAC9C,MAAM,KAAK,GAAG,IAAA,wBAAc,EAAC;QAC3B,OAAO,EAAE;YACP,KAAK,EAAE,kBAAU,CAAC,OAAO;YACzB,aAAa,EAAE,kCAAkB,CAAC,OAAO;YACzC,KAAK,EAAE,kBAAU,CAAC,OAAO;YACzB,EAAE,EAAE,YAAO,CAAC,OAAO;SACpB;QACD,UAAU,EAAE,CAAC,oBAAoB,EAAE,EAAE,CACnC,oBAAoB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;KAChE,CAAC,CAAC;IAEH,kCAAkC;IAClC,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,CAAC,QAAQ,CACZ,IAAA,gBAAQ,EAAC;YACP,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;YAC5B,SAAS,EAAE,IAAI;SAChB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,CAAC,QAAQ,CACZ,IAAA,gBAAQ,EAAC;YACP,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;YACvC,SAAS,EAAE,KAAK;SACjB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK;QACL,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC;KACjD,CAAC;AACJ,CAAC;AApCD,kCAoCC","sourcesContent":["import { configureStore } from '@reduxjs/toolkit';\nimport createSagaMiddleware from 'redux-saga';\n\nimport type { SimulationOptions } from '../options';\nimport { mocksSlice } from './mocks';\nimport { notificationsSlice } from './notifications';\nimport { setState, stateSlice } from './state';\nimport { uiSlice } from './ui';\n\n/**\n * Create a Redux store.\n *\n * @param options - The simulation options.\n * @param options.state - The initial state for the Snap.\n * @param options.unencryptedState - The initial unencrypted state for the Snap.\n * @returns A Redux store with the default state.\n */\nexport function createStore({ state, unencryptedState }: SimulationOptions) {\n const sagaMiddleware = createSagaMiddleware();\n const store = configureStore({\n reducer: {\n mocks: mocksSlice.reducer,\n notifications: notificationsSlice.reducer,\n state: stateSlice.reducer,\n ui: uiSlice.reducer,\n },\n middleware: (getDefaultMiddleware) =>\n getDefaultMiddleware({ thunk: false }).concat(sagaMiddleware),\n });\n\n // Set initial state for the Snap.\n if (state) {\n store.dispatch(\n setState({\n state: JSON.stringify(state),\n encrypted: true,\n }),\n );\n }\n\n if (unencryptedState) {\n store.dispatch(\n setState({\n state: JSON.stringify(unencryptedState),\n encrypted: false,\n }),\n );\n }\n\n return {\n store,\n runSaga: sagaMiddleware.run.bind(sagaMiddleware),\n };\n}\n\nexport type Store = ReturnType<typeof createStore>['store'];\nexport type ApplicationState = ReturnType<Store['getState']>;\nexport type RunSagaFunction = ReturnType<typeof createStore>['runSaga'];\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { SimulationOptions } from "../options.cjs";
|
|
2
|
-
/**
|
|
3
|
-
* Create a Redux store.
|
|
4
|
-
*
|
|
5
|
-
* @param options - The simulation options.
|
|
6
|
-
* @param options.state - The initial state for the Snap.
|
|
7
|
-
* @param options.unencryptedState - The initial unencrypted state for the Snap.
|
|
8
|
-
* @returns A Redux store with the default state.
|
|
9
|
-
*/
|
|
10
|
-
export declare function createStore({ state, unencryptedState }: SimulationOptions): {
|
|
11
|
-
store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<{
|
|
12
|
-
mocks: import("./mocks.cjs").MocksState;
|
|
13
|
-
notifications: import("./notifications.cjs").NotificationsState;
|
|
14
|
-
state: import("./state.cjs").State;
|
|
15
|
-
ui: import("./ui.cjs").UiState;
|
|
16
|
-
}, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-saga").SagaMiddleware<object>]>>;
|
|
17
|
-
runSaga: <S extends import("redux-saga").Saga>(saga: S, ...args: Parameters<S>) => import("redux-saga").Task<any>;
|
|
18
|
-
};
|
|
19
|
-
export type Store = ReturnType<typeof createStore>['store'];
|
|
20
|
-
export type ApplicationState = ReturnType<Store['getState']>;
|
|
21
|
-
export type RunSagaFunction = ReturnType<typeof createStore>['runSaga'];
|
|
22
|
-
//# sourceMappingURL=store.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.cts","sourceRoot":"","sources":["../../../../src/internals/simulation/store/store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAmB;AAMpD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,iBAAiB;;;;;;;;EAoCzE;AAED,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;AAC5D,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AAC7D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { SimulationOptions } from "../options.mjs";
|
|
2
|
-
/**
|
|
3
|
-
* Create a Redux store.
|
|
4
|
-
*
|
|
5
|
-
* @param options - The simulation options.
|
|
6
|
-
* @param options.state - The initial state for the Snap.
|
|
7
|
-
* @param options.unencryptedState - The initial unencrypted state for the Snap.
|
|
8
|
-
* @returns A Redux store with the default state.
|
|
9
|
-
*/
|
|
10
|
-
export declare function createStore({ state, unencryptedState }: SimulationOptions): {
|
|
11
|
-
store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<{
|
|
12
|
-
mocks: import("./mocks.mjs").MocksState;
|
|
13
|
-
notifications: import("./notifications.mjs").NotificationsState;
|
|
14
|
-
state: import("./state.mjs").State;
|
|
15
|
-
ui: import("./ui.mjs").UiState;
|
|
16
|
-
}, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-saga").SagaMiddleware<object>]>>;
|
|
17
|
-
runSaga: <S extends import("redux-saga").Saga>(saga: S, ...args: Parameters<S>) => import("redux-saga").Task<any>;
|
|
18
|
-
};
|
|
19
|
-
export type Store = ReturnType<typeof createStore>['store'];
|
|
20
|
-
export type ApplicationState = ReturnType<Store['getState']>;
|
|
21
|
-
export type RunSagaFunction = ReturnType<typeof createStore>['runSaga'];
|
|
22
|
-
//# sourceMappingURL=store.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.mts","sourceRoot":"","sources":["../../../../src/internals/simulation/store/store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAmB;AAMpD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,iBAAiB;;;;;;;;EAoCzE;AAED,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;AAC5D,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AAC7D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import $reduxjstoolkit from "@reduxjs/toolkit";
|
|
2
|
-
const { configureStore } = $reduxjstoolkit;
|
|
3
|
-
import createSagaMiddleware from "redux-saga";
|
|
4
|
-
import { mocksSlice } from "./mocks.mjs";
|
|
5
|
-
import { notificationsSlice } from "./notifications.mjs";
|
|
6
|
-
import { setState, stateSlice } from "./state.mjs";
|
|
7
|
-
import { uiSlice } from "./ui.mjs";
|
|
8
|
-
/**
|
|
9
|
-
* Create a Redux store.
|
|
10
|
-
*
|
|
11
|
-
* @param options - The simulation options.
|
|
12
|
-
* @param options.state - The initial state for the Snap.
|
|
13
|
-
* @param options.unencryptedState - The initial unencrypted state for the Snap.
|
|
14
|
-
* @returns A Redux store with the default state.
|
|
15
|
-
*/
|
|
16
|
-
export function createStore({ state, unencryptedState }) {
|
|
17
|
-
const sagaMiddleware = createSagaMiddleware();
|
|
18
|
-
const store = configureStore({
|
|
19
|
-
reducer: {
|
|
20
|
-
mocks: mocksSlice.reducer,
|
|
21
|
-
notifications: notificationsSlice.reducer,
|
|
22
|
-
state: stateSlice.reducer,
|
|
23
|
-
ui: uiSlice.reducer,
|
|
24
|
-
},
|
|
25
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware({ thunk: false }).concat(sagaMiddleware),
|
|
26
|
-
});
|
|
27
|
-
// Set initial state for the Snap.
|
|
28
|
-
if (state) {
|
|
29
|
-
store.dispatch(setState({
|
|
30
|
-
state: JSON.stringify(state),
|
|
31
|
-
encrypted: true,
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
if (unencryptedState) {
|
|
35
|
-
store.dispatch(setState({
|
|
36
|
-
state: JSON.stringify(unencryptedState),
|
|
37
|
-
encrypted: false,
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
store,
|
|
42
|
-
runSaga: sagaMiddleware.run.bind(sagaMiddleware),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=store.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.mjs","sourceRoot":"","sources":["../../../../src/internals/simulation/store/store.ts"],"names":[],"mappings":";;AACA,OAAO,oBAAoB,mBAAmB;AAG9C,OAAO,EAAE,UAAU,EAAE,oBAAgB;AACrC,OAAO,EAAE,kBAAkB,EAAE,4BAAwB;AACrD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,oBAAgB;AAC/C,OAAO,EAAE,OAAO,EAAE,iBAAa;AAE/B;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAqB;IACxE,MAAM,cAAc,GAAG,oBAAoB,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAG,cAAc,CAAC;QAC3B,OAAO,EAAE;YACP,KAAK,EAAE,UAAU,CAAC,OAAO;YACzB,aAAa,EAAE,kBAAkB,CAAC,OAAO;YACzC,KAAK,EAAE,UAAU,CAAC,OAAO;YACzB,EAAE,EAAE,OAAO,CAAC,OAAO;SACpB;QACD,UAAU,EAAE,CAAC,oBAAoB,EAAE,EAAE,CACnC,oBAAoB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;KAChE,CAAC,CAAC;IAEH,kCAAkC;IAClC,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,CAAC,QAAQ,CACZ,QAAQ,CAAC;YACP,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;YAC5B,SAAS,EAAE,IAAI;SAChB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,CAAC,QAAQ,CACZ,QAAQ,CAAC;YACP,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;YACvC,SAAS,EAAE,KAAK;SACjB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK;QACL,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC;KACjD,CAAC;AACJ,CAAC","sourcesContent":["import { configureStore } from '@reduxjs/toolkit';\nimport createSagaMiddleware from 'redux-saga';\n\nimport type { SimulationOptions } from '../options';\nimport { mocksSlice } from './mocks';\nimport { notificationsSlice } from './notifications';\nimport { setState, stateSlice } from './state';\nimport { uiSlice } from './ui';\n\n/**\n * Create a Redux store.\n *\n * @param options - The simulation options.\n * @param options.state - The initial state for the Snap.\n * @param options.unencryptedState - The initial unencrypted state for the Snap.\n * @returns A Redux store with the default state.\n */\nexport function createStore({ state, unencryptedState }: SimulationOptions) {\n const sagaMiddleware = createSagaMiddleware();\n const store = configureStore({\n reducer: {\n mocks: mocksSlice.reducer,\n notifications: notificationsSlice.reducer,\n state: stateSlice.reducer,\n ui: uiSlice.reducer,\n },\n middleware: (getDefaultMiddleware) =>\n getDefaultMiddleware({ thunk: false }).concat(sagaMiddleware),\n });\n\n // Set initial state for the Snap.\n if (state) {\n store.dispatch(\n setState({\n state: JSON.stringify(state),\n encrypted: true,\n }),\n );\n }\n\n if (unencryptedState) {\n store.dispatch(\n setState({\n state: JSON.stringify(unencryptedState),\n encrypted: false,\n }),\n );\n }\n\n return {\n store,\n runSaga: sagaMiddleware.run.bind(sagaMiddleware),\n };\n}\n\nexport type Store = ReturnType<typeof createStore>['store'];\nexport type ApplicationState = ReturnType<Store['getState']>;\nexport type RunSagaFunction = ReturnType<typeof createStore>['runSaga'];\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getCurrentInterface = exports.closeInterface = exports.setInterface = exports.resolveInterface = exports.uiSlice = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const INITIAL_STATE = {
|
|
7
|
-
current: null,
|
|
8
|
-
};
|
|
9
|
-
exports.uiSlice = (0, toolkit_1.createSlice)({
|
|
10
|
-
name: 'ui',
|
|
11
|
-
initialState: INITIAL_STATE,
|
|
12
|
-
reducers: {
|
|
13
|
-
setInterface(state, action) {
|
|
14
|
-
state.current = action.payload;
|
|
15
|
-
},
|
|
16
|
-
closeInterface(state) {
|
|
17
|
-
state.current = null;
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
exports.resolveInterface = (0, toolkit_1.createAction)(`${exports.uiSlice.name}/resolveInterface`);
|
|
22
|
-
_a = exports.uiSlice.actions, exports.setInterface = _a.setInterface, exports.closeInterface = _a.closeInterface;
|
|
23
|
-
exports.getCurrentInterface = (0, toolkit_1.createSelector)((state) => state.ui, (ui) => ui.current);
|
|
24
|
-
//# sourceMappingURL=ui.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ui.cjs","sourceRoot":"","sources":["../../../../src/internals/simulation/store/ui.ts"],"names":[],"mappings":";;;;AAGA,8CAA6E;AAa7E,MAAM,aAAa,GAAY;IAC7B,OAAO,EAAE,IAAI;CACd,CAAC;AAEW,QAAA,OAAO,GAAG,IAAA,qBAAW,EAAC;IACjC,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,aAAa;IAC3B,QAAQ,EAAE;QACR,YAAY,CAAC,KAAK,EAAE,MAAgC;YAClD,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QACjC,CAAC;QACD,cAAc,CAAC,KAAK;YAClB,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACvB,CAAC;KACF;CACF,CAAC,CAAC;AAEU,QAAA,gBAAgB,GAAG,IAAA,sBAAY,EAC1C,GAAG,eAAO,CAAC,IAAI,mBAAmB,CACnC,CAAC;AAEW,KAAmC,eAAO,CAAC,OAAO,EAAhD,oBAAY,oBAAE,sBAAc,qBAAqB;AAEnD,QAAA,mBAAmB,GAAG,IAAA,wBAAc,EAC/C,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,EACrC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CACnB,CAAC","sourcesContent":["import type { DialogApprovalTypes } from '@metamask/snaps-rpc-methods';\nimport type { DialogType } from '@metamask/snaps-sdk';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createAction, createSelector, createSlice } from '@reduxjs/toolkit';\n\nimport type { ApplicationState } from './store';\n\nexport type Interface = {\n type: DialogApprovalTypes[DialogType | 'default'];\n id: string;\n};\n\nexport type UiState = {\n current?: Interface | null;\n};\n\nconst INITIAL_STATE: UiState = {\n current: null,\n};\n\nexport const uiSlice = createSlice({\n name: 'ui',\n initialState: INITIAL_STATE,\n reducers: {\n setInterface(state, action: PayloadAction<Interface>) {\n state.current = action.payload;\n },\n closeInterface(state) {\n state.current = null;\n },\n },\n});\n\nexport const resolveInterface = createAction<unknown>(\n `${uiSlice.name}/resolveInterface`,\n);\n\nexport const { setInterface, closeInterface } = uiSlice.actions;\n\nexport const getCurrentInterface = createSelector(\n (state: ApplicationState) => state.ui,\n (ui) => ui.current,\n);\n"]}
|