@metamask/snaps-jest 8.3.0 → 8.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -2
- package/dist/environment.cjs +96 -0
- package/dist/environment.cjs.map +1 -0
- package/dist/{types/environment.d.ts → environment.d.cts} +5 -4
- package/dist/environment.d.cts.map +1 -0
- package/dist/environment.d.mts +53 -0
- package/dist/environment.d.mts.map +1 -0
- package/dist/environment.mjs +94 -44
- package/dist/environment.mjs.map +1 -1
- package/dist/global.cjs +4 -0
- package/dist/global.cjs.map +1 -0
- package/dist/{types/global.d.ts → global.d.cts} +2 -1
- package/dist/global.d.cts.map +1 -0
- package/dist/global.d.mts +70 -0
- package/dist/global.d.mts.map +1 -0
- package/dist/global.mjs +2 -1
- package/dist/global.mjs.map +1 -1
- package/dist/helpers.cjs +240 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/{types/helpers.d.ts → helpers.d.cts} +5 -4
- package/dist/helpers.d.cts.map +1 -0
- package/dist/helpers.d.mts +132 -0
- package/dist/helpers.d.mts.map +1 -0
- package/dist/helpers.mjs +228 -56
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.cjs +29 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6 -67
- package/dist/index.mjs.map +1 -1
- package/dist/internals/environment.cjs +18 -0
- package/dist/internals/environment.cjs.map +1 -0
- package/dist/{types/internals/environment.d.ts → internals/environment.d.cts} +2 -1
- package/dist/internals/environment.d.cts.map +1 -0
- package/dist/internals/environment.d.mts +8 -0
- package/dist/internals/environment.d.mts.map +1 -0
- package/dist/internals/environment.mjs +13 -7
- package/dist/internals/environment.mjs.map +1 -1
- package/dist/internals/index.cjs +23 -0
- package/dist/internals/index.cjs.map +1 -0
- package/dist/internals/index.d.cts +7 -0
- package/dist/internals/index.d.cts.map +1 -0
- package/dist/internals/index.d.mts +7 -0
- package/dist/internals/index.d.mts.map +1 -0
- package/dist/internals/index.mjs +6 -149
- package/dist/internals/index.mjs.map +1 -1
- package/dist/internals/logger.cjs +6 -0
- package/dist/internals/logger.cjs.map +1 -0
- package/dist/{types/internals/logger.d.ts → internals/logger.d.cts} +1 -0
- package/dist/internals/logger.d.cts.map +1 -0
- package/dist/internals/logger.d.mts +3 -0
- package/dist/internals/logger.d.mts.map +1 -0
- package/dist/internals/logger.mjs +2 -7
- package/dist/internals/logger.mjs.map +1 -1
- package/dist/internals/request.cjs +143 -0
- package/dist/internals/request.cjs.map +1 -0
- package/dist/{types/internals/request.d.ts → internals/request.d.cts} +7 -6
- package/dist/internals/request.d.cts.map +1 -0
- package/dist/internals/request.d.mts +56 -0
- package/dist/internals/request.d.mts.map +1 -0
- package/dist/internals/request.mjs +137 -41
- package/dist/internals/request.mjs.map +1 -1
- package/dist/internals/server.cjs +74 -0
- package/dist/internals/server.cjs.map +1 -0
- package/dist/{types/internals/server.d.ts → internals/server.d.cts} +3 -2
- package/dist/internals/server.d.cts.map +1 -0
- package/dist/internals/server.d.mts +15 -0
- package/dist/internals/server.d.mts.map +1 -0
- package/dist/internals/server.mjs +73 -8
- package/dist/internals/server.mjs.map +1 -1
- package/dist/internals/simulation/constants.cjs +21 -0
- package/dist/internals/simulation/constants.cjs.map +1 -0
- package/dist/{types/internals/simulation/constants.d.ts → internals/simulation/constants.d.cts} +1 -0
- package/dist/internals/simulation/constants.d.cts.map +1 -0
- package/dist/internals/simulation/constants.d.mts +18 -0
- package/dist/internals/simulation/constants.d.mts.map +1 -0
- package/dist/internals/simulation/constants.mjs +17 -13
- package/dist/internals/simulation/constants.mjs.map +1 -1
- package/dist/internals/simulation/controllers.cjs +101 -0
- package/dist/internals/simulation/controllers.cjs.map +1 -0
- package/dist/{types/internals/simulation/controllers.d.ts → internals/simulation/controllers.d.cts} +11 -10
- package/dist/internals/simulation/controllers.d.cts.map +1 -0
- package/dist/internals/simulation/controllers.d.mts +41 -0
- package/dist/internals/simulation/controllers.d.mts.map +1 -0
- package/dist/internals/simulation/controllers.mjs +95 -24
- package/dist/internals/simulation/controllers.mjs.map +1 -1
- package/dist/internals/simulation/files.cjs +94 -0
- package/dist/internals/simulation/files.cjs.map +1 -0
- package/dist/{types/internals/simulation/files.d.ts → internals/simulation/files.d.cts} +6 -4
- package/dist/internals/simulation/files.d.cts.map +1 -0
- package/dist/internals/simulation/files.d.mts +49 -0
- package/dist/internals/simulation/files.d.mts.map +1 -0
- package/dist/internals/simulation/files.mjs +90 -13
- package/dist/internals/simulation/files.mjs.map +1 -1
- package/dist/internals/simulation/index.cjs +22 -0
- package/dist/internals/simulation/index.cjs.map +1 -0
- package/dist/internals/simulation/index.d.cts +6 -0
- package/dist/internals/simulation/index.d.cts.map +1 -0
- package/dist/internals/simulation/index.d.mts +6 -0
- package/dist/internals/simulation/index.d.mts.map +1 -0
- package/dist/internals/simulation/index.mjs +5 -110
- package/dist/internals/simulation/index.mjs.map +1 -1
- package/dist/internals/simulation/interface.cjs +527 -0
- package/dist/internals/simulation/interface.cjs.map +1 -0
- package/dist/{types/internals/simulation/interface.d.ts → internals/simulation/interface.d.cts} +9 -8
- package/dist/internals/simulation/interface.d.cts.map +1 -0
- package/dist/internals/simulation/interface.d.mts +152 -0
- package/dist/internals/simulation/interface.d.mts.map +1 -0
- package/dist/internals/simulation/interface.mjs +512 -36
- package/dist/internals/simulation/interface.mjs.map +1 -1
- package/dist/internals/simulation/methods/constants.cjs +72 -0
- package/dist/internals/simulation/methods/constants.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/constants.d.ts → internals/simulation/methods/constants.d.cts} +1 -0
- package/dist/internals/simulation/methods/constants.d.cts.map +1 -0
- package/dist/internals/simulation/methods/constants.d.mts +11 -0
- package/dist/internals/simulation/methods/constants.d.mts.map +1 -0
- package/dist/internals/simulation/methods/constants.mjs +68 -11
- package/dist/internals/simulation/methods/constants.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/get-preferences.cjs +18 -0
- package/dist/internals/simulation/methods/hooks/get-preferences.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/hooks/get-preferences.d.ts → internals/simulation/methods/hooks/get-preferences.d.cts} +2 -1
- package/dist/internals/simulation/methods/hooks/get-preferences.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/get-preferences.d.mts +14 -0
- package/dist/internals/simulation/methods/hooks/get-preferences.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/get-preferences.mjs +13 -7
- package/dist/internals/simulation/methods/hooks/get-preferences.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/index.cjs +22 -0
- package/dist/internals/simulation/methods/hooks/index.cjs.map +1 -0
- package/dist/internals/simulation/methods/hooks/index.d.cts +6 -0
- package/dist/internals/simulation/methods/hooks/index.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/index.d.mts +6 -0
- package/dist/internals/simulation/methods/hooks/index.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/index.mjs +5 -38
- package/dist/internals/simulation/methods/hooks/index.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/interface.cjs +24 -0
- package/dist/internals/simulation/methods/hooks/interface.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/hooks/interface.d.ts → internals/simulation/methods/hooks/interface.d.cts} +3 -2
- package/dist/internals/simulation/methods/hooks/interface.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/interface.d.mts +17 -0
- package/dist/internals/simulation/methods/hooks/interface.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/interface.mjs +18 -9
- package/dist/internals/simulation/methods/hooks/interface.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/notifications.cjs +58 -0
- package/dist/internals/simulation/methods/hooks/notifications.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/hooks/notifications.d.ts → internals/simulation/methods/hooks/notifications.d.cts} +5 -4
- package/dist/internals/simulation/methods/hooks/notifications.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/notifications.d.mts +17 -0
- package/dist/internals/simulation/methods/hooks/notifications.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/notifications.mjs +54 -15
- package/dist/internals/simulation/methods/hooks/notifications.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/request-user-approval.cjs +38 -0
- package/dist/internals/simulation/methods/hooks/request-user-approval.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/hooks/request-user-approval.d.ts → internals/simulation/methods/hooks/request-user-approval.d.cts} +2 -1
- package/dist/internals/simulation/methods/hooks/request-user-approval.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts +16 -0
- package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/request-user-approval.mjs +34 -13
- package/dist/internals/simulation/methods/hooks/request-user-approval.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/state.cjs +84 -0
- package/dist/internals/simulation/methods/hooks/state.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/hooks/state.d.ts → internals/simulation/methods/hooks/state.d.cts} +3 -2
- package/dist/internals/simulation/methods/hooks/state.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/state.d.mts +24 -0
- package/dist/internals/simulation/methods/hooks/state.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/state.mjs +78 -17
- package/dist/internals/simulation/methods/hooks/state.mjs.map +1 -1
- package/dist/internals/simulation/methods/index.cjs +18 -0
- package/dist/internals/simulation/methods/index.cjs.map +1 -0
- package/dist/internals/simulation/methods/index.d.cts +2 -0
- package/dist/internals/simulation/methods/index.d.cts.map +1 -0
- package/dist/internals/simulation/methods/index.d.mts +2 -0
- package/dist/internals/simulation/methods/index.d.mts.map +1 -0
- package/dist/internals/simulation/methods/index.mjs +1 -27
- package/dist/internals/simulation/methods/index.mjs.map +1 -1
- package/dist/internals/simulation/methods/specifications.cjs +85 -0
- package/dist/internals/simulation/methods/specifications.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/specifications.d.ts → internals/simulation/methods/specifications.d.cts} +6 -5
- package/dist/internals/simulation/methods/specifications.d.cts.map +1 -0
- package/dist/internals/simulation/methods/specifications.d.mts +57 -0
- package/dist/internals/simulation/methods/specifications.d.mts.map +1 -0
- package/dist/internals/simulation/methods/specifications.mjs +77 -26
- package/dist/internals/simulation/methods/specifications.mjs.map +1 -1
- package/dist/internals/simulation/middleware/engine.cjs +37 -0
- package/dist/internals/simulation/middleware/engine.cjs.map +1 -0
- package/dist/{types/internals/simulation/middleware/engine.d.ts → internals/simulation/middleware/engine.d.cts} +7 -6
- package/dist/internals/simulation/middleware/engine.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/engine.d.mts +27 -0
- package/dist/internals/simulation/middleware/engine.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/engine.mjs +33 -14
- package/dist/internals/simulation/middleware/engine.mjs.map +1 -1
- package/dist/internals/simulation/middleware/index.cjs +18 -0
- package/dist/internals/simulation/middleware/index.cjs.map +1 -0
- package/dist/internals/simulation/middleware/index.d.cts +2 -0
- package/dist/internals/simulation/middleware/index.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/index.d.mts +2 -0
- package/dist/internals/simulation/middleware/index.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/index.mjs +1 -15
- package/dist/internals/simulation/middleware/index.mjs.map +1 -1
- package/dist/internals/simulation/middleware/internal-methods/accounts.cjs +34 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.cjs.map +1 -0
- package/dist/{types/internals/simulation/middleware/internal-methods/accounts.d.ts → internals/simulation/middleware/internal-methods/accounts.d.cts} +4 -2
- package/dist/internals/simulation/middleware/internal-methods/accounts.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts +20 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.mjs +29 -7
- package/dist/internals/simulation/middleware/internal-methods/accounts.mjs.map +1 -1
- package/dist/internals/simulation/middleware/internal-methods/index.cjs +18 -0
- package/dist/internals/simulation/middleware/internal-methods/index.cjs.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/index.d.cts +2 -0
- package/dist/internals/simulation/middleware/internal-methods/index.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/index.d.mts +2 -0
- package/dist/internals/simulation/middleware/internal-methods/index.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/index.mjs +1 -10
- package/dist/internals/simulation/middleware/internal-methods/index.mjs.map +1 -1
- package/dist/internals/simulation/middleware/internal-methods/middleware.cjs +44 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.cjs.map +1 -0
- package/dist/{types/internals/simulation/middleware/internal-methods/middleware.d.ts → internals/simulation/middleware/internal-methods/middleware.d.cts} +3 -2
- package/dist/internals/simulation/middleware/internal-methods/middleware.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts +23 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.mjs +38 -8
- package/dist/internals/simulation/middleware/internal-methods/middleware.mjs.map +1 -1
- package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs +28 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs.map +1 -0
- package/dist/{types/internals/simulation/middleware/internal-methods/provider-state.d.ts → internals/simulation/middleware/internal-methods/provider-state.d.cts} +4 -2
- package/dist/internals/simulation/middleware/internal-methods/provider-state.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts +16 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs +23 -7
- package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs.map +1 -1
- package/dist/internals/simulation/middleware/mock.cjs +22 -0
- package/dist/internals/simulation/middleware/mock.cjs.map +1 -0
- package/dist/{types/internals/simulation/middleware/mock.d.ts → internals/simulation/middleware/mock.d.cts} +4 -3
- package/dist/internals/simulation/middleware/mock.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/mock.d.mts +11 -0
- package/dist/internals/simulation/middleware/mock.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/mock.mjs +17 -8
- package/dist/internals/simulation/middleware/mock.mjs.map +1 -1
- package/dist/internals/simulation/options.cjs +25 -0
- package/dist/internals/simulation/options.cjs.map +1 -0
- package/dist/{types/internals/simulation/options.d.ts → internals/simulation/options.d.cts} +3 -2
- package/dist/internals/simulation/options.d.cts.map +1 -0
- package/dist/internals/simulation/options.d.mts +40 -0
- package/dist/internals/simulation/options.d.mts.map +1 -0
- package/dist/internals/simulation/options.mjs +20 -8
- package/dist/internals/simulation/options.mjs.map +1 -1
- package/dist/internals/simulation/simulation.cjs +155 -0
- package/dist/internals/simulation/simulation.cjs.map +1 -0
- package/dist/{types/internals/simulation/simulation.d.ts → internals/simulation/simulation.d.cts} +11 -9
- package/dist/internals/simulation/simulation.d.cts.map +1 -0
- package/dist/internals/simulation/simulation.d.mts +103 -0
- package/dist/internals/simulation/simulation.d.mts.map +1 -0
- package/dist/internals/simulation/simulation.mjs +149 -38
- package/dist/internals/simulation/simulation.mjs.map +1 -1
- package/dist/internals/simulation/store/index.cjs +21 -0
- package/dist/internals/simulation/store/index.cjs.map +1 -0
- package/dist/internals/simulation/store/index.d.cts +5 -0
- package/dist/internals/simulation/store/index.d.cts.map +1 -0
- package/dist/internals/simulation/store/index.d.mts +5 -0
- package/dist/internals/simulation/store/index.d.mts.map +1 -0
- package/dist/internals/simulation/store/index.mjs +4 -43
- package/dist/internals/simulation/store/index.mjs.map +1 -1
- package/dist/internals/simulation/store/mocks.cjs +39 -0
- package/dist/internals/simulation/store/mocks.cjs.map +1 -0
- package/dist/{types/internals/simulation/store/mocks.d.ts → internals/simulation/store/mocks.d.cts} +9 -8
- package/dist/internals/simulation/store/mocks.d.cts.map +1 -0
- package/dist/internals/simulation/store/mocks.d.mts +36 -0
- package/dist/internals/simulation/store/mocks.d.mts.map +1 -0
- package/dist/internals/simulation/store/mocks.mjs +33 -14
- package/dist/internals/simulation/store/mocks.mjs.map +1 -1
- package/dist/internals/simulation/store/notifications.cjs +35 -0
- package/dist/internals/simulation/store/notifications.cjs.map +1 -0
- package/dist/{types/internals/simulation/store/notifications.d.ts → internals/simulation/store/notifications.d.cts} +9 -8
- package/dist/internals/simulation/store/notifications.d.cts.map +1 -0
- package/dist/internals/simulation/store/notifications.d.mts +45 -0
- package/dist/internals/simulation/store/notifications.d.mts.map +1 -0
- package/dist/internals/simulation/store/notifications.mjs +30 -14
- package/dist/internals/simulation/store/notifications.mjs.map +1 -1
- package/dist/internals/simulation/store/state.cjs +54 -0
- package/dist/internals/simulation/store/state.cjs.map +1 -0
- package/dist/{types/internals/simulation/store/state.d.ts → internals/simulation/store/state.d.cts} +12 -11
- package/dist/internals/simulation/store/state.d.cts.map +1 -0
- package/dist/internals/simulation/store/state.d.mts +56 -0
- package/dist/internals/simulation/store/state.d.mts.map +1 -0
- package/dist/internals/simulation/store/state.mjs +48 -12
- package/dist/internals/simulation/store/state.mjs.map +1 -1
- package/dist/internals/simulation/store/store.cjs +51 -0
- package/dist/internals/simulation/store/store.cjs.map +1 -0
- package/dist/{types/internals/simulation/store/store.d.ts → internals/simulation/store/store.d.cts} +6 -5
- package/dist/internals/simulation/store/store.d.cts.map +1 -0
- package/dist/internals/simulation/store/store.d.mts +22 -0
- package/dist/internals/simulation/store/store.d.mts.map +1 -0
- package/dist/internals/simulation/store/store.mjs +44 -11
- package/dist/internals/simulation/store/store.mjs.map +1 -1
- package/dist/internals/simulation/store/ui.cjs +24 -0
- package/dist/internals/simulation/store/ui.cjs.map +1 -0
- package/dist/{types/internals/simulation/store/ui.d.ts → internals/simulation/store/ui.d.cts} +9 -8
- package/dist/internals/simulation/store/ui.d.cts.map +1 -0
- package/dist/internals/simulation/store/ui.d.mts +27 -0
- package/dist/internals/simulation/store/ui.d.mts.map +1 -0
- package/dist/internals/simulation/store/ui.mjs +19 -14
- package/dist/internals/simulation/store/ui.mjs.map +1 -1
- package/dist/internals/structs.cjs +157 -0
- package/dist/internals/structs.cjs.map +1 -0
- package/dist/{types/internals/structs.d.ts → internals/structs.d.cts} +28 -27
- package/dist/internals/structs.d.cts.map +1 -0
- package/dist/internals/structs.d.mts +205 -0
- package/dist/internals/structs.d.mts.map +1 -0
- package/dist/internals/structs.mjs +153 -21
- package/dist/internals/structs.mjs.map +1 -1
- package/dist/matchers.cjs +160 -0
- package/dist/matchers.cjs.map +1 -0
- package/dist/{types/matchers.d.ts → matchers.d.cts} +4 -3
- package/dist/matchers.d.cts.map +1 -0
- package/dist/matchers.d.mts +28 -0
- package/dist/matchers.d.mts.map +1 -0
- package/dist/matchers.mjs +152 -47
- package/dist/matchers.mjs.map +1 -1
- package/dist/options.cjs +24 -0
- package/dist/options.cjs.map +1 -0
- package/dist/{types/options.d.ts → options.d.cts} +2 -1
- package/dist/options.d.cts.map +1 -0
- package/dist/options.d.mts +61 -0
- package/dist/options.d.mts.map +1 -0
- package/dist/options.mjs +19 -7
- package/dist/options.mjs.map +1 -1
- package/dist/setup.cjs +7 -0
- package/dist/setup.cjs.map +1 -0
- package/dist/setup.d.cts +2 -0
- package/dist/setup.d.cts.map +1 -0
- package/dist/setup.d.mts +2 -0
- package/dist/setup.d.mts.map +1 -0
- package/dist/setup.mjs +4 -37
- package/dist/setup.mjs.map +1 -1
- package/dist/types/index.cjs +18 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/types.cjs +3 -0
- package/dist/types/types.cjs.map +1 -0
- package/dist/types/{types.d.ts → types.d.cts} +7 -6
- package/dist/types/types.d.cts.map +1 -0
- package/dist/types/types.d.mts +386 -0
- package/dist/types/types.d.mts.map +1 -0
- package/dist/types/types.mjs +2 -0
- package/dist/types/types.mjs.map +1 -0
- package/jest-preset.js +1 -1
- package/package.json +25 -23
- package/dist/chunk-24CGIQLL.mjs +0 -30
- package/dist/chunk-24CGIQLL.mjs.map +0 -1
- package/dist/chunk-2JTGBHPR.js +0 -14
- package/dist/chunk-2JTGBHPR.js.map +0 -1
- package/dist/chunk-2RJYSYUB.js +0 -28
- package/dist/chunk-2RJYSYUB.js.map +0 -1
- package/dist/chunk-2YE2P5BZ.js +0 -36
- package/dist/chunk-2YE2P5BZ.js.map +0 -1
- package/dist/chunk-3FNLFVV2.js +0 -15
- package/dist/chunk-3FNLFVV2.js.map +0 -1
- package/dist/chunk-3J2IBWXV.mjs +0 -39
- package/dist/chunk-3J2IBWXV.mjs.map +0 -1
- package/dist/chunk-3NP6BDGK.js +0 -167
- package/dist/chunk-3NP6BDGK.js.map +0 -1
- package/dist/chunk-55J6XMHW.js +0 -1
- package/dist/chunk-55J6XMHW.js.map +0 -1
- package/dist/chunk-57SGDM5B.mjs +0 -69
- package/dist/chunk-57SGDM5B.mjs.map +0 -1
- package/dist/chunk-5U5WB3SM.mjs +0 -41
- package/dist/chunk-5U5WB3SM.mjs.map +0 -1
- package/dist/chunk-5ZFHFICZ.mjs +0 -1
- package/dist/chunk-5ZFHFICZ.mjs.map +0 -1
- package/dist/chunk-6HHV6YFQ.mjs +0 -1
- package/dist/chunk-6HHV6YFQ.mjs.map +0 -1
- package/dist/chunk-6JPBXAHM.mjs +0 -509
- package/dist/chunk-6JPBXAHM.mjs.map +0 -1
- package/dist/chunk-6V6MFT67.js +0 -38
- package/dist/chunk-6V6MFT67.js.map +0 -1
- package/dist/chunk-7PCHIR6O.mjs +0 -181
- package/dist/chunk-7PCHIR6O.mjs.map +0 -1
- package/dist/chunk-ALRZENWP.mjs +0 -42
- package/dist/chunk-ALRZENWP.mjs.map +0 -1
- package/dist/chunk-AMAL4SJH.js +0 -153
- package/dist/chunk-AMAL4SJH.js.map +0 -1
- package/dist/chunk-C26TYXXD.mjs +0 -240
- package/dist/chunk-C26TYXXD.mjs.map +0 -1
- package/dist/chunk-CACRY3TX.mjs +0 -104
- package/dist/chunk-CACRY3TX.mjs.map +0 -1
- package/dist/chunk-CKRORVDW.js +0 -1
- package/dist/chunk-CKRORVDW.js.map +0 -1
- package/dist/chunk-D653LBAY.js +0 -34
- package/dist/chunk-D653LBAY.js.map +0 -1
- package/dist/chunk-DR6Y7IVX.js +0 -1
- package/dist/chunk-DR6Y7IVX.js.map +0 -1
- package/dist/chunk-DUVKGPX5.js +0 -509
- package/dist/chunk-DUVKGPX5.js.map +0 -1
- package/dist/chunk-EMTW3H54.js +0 -20
- package/dist/chunk-EMTW3H54.js.map +0 -1
- package/dist/chunk-FP4H3ADT.mjs +0 -20
- package/dist/chunk-FP4H3ADT.mjs.map +0 -1
- package/dist/chunk-FQWOVTBB.mjs +0 -22
- package/dist/chunk-FQWOVTBB.mjs.map +0 -1
- package/dist/chunk-G333FBBL.mjs +0 -38
- package/dist/chunk-G333FBBL.mjs.map +0 -1
- package/dist/chunk-GECE47HW.js +0 -1
- package/dist/chunk-GECE47HW.js.map +0 -1
- package/dist/chunk-GLPGOEVE.js +0 -240
- package/dist/chunk-GLPGOEVE.js.map +0 -1
- package/dist/chunk-GMTKFAWO.js +0 -42
- package/dist/chunk-GMTKFAWO.js.map +0 -1
- package/dist/chunk-H2464AXT.mjs +0 -33
- package/dist/chunk-H2464AXT.mjs.map +0 -1
- package/dist/chunk-HROOL3VI.js +0 -1
- package/dist/chunk-HROOL3VI.js.map +0 -1
- package/dist/chunk-IWJ4HKDR.mjs +0 -50
- package/dist/chunk-IWJ4HKDR.mjs.map +0 -1
- package/dist/chunk-IXKO6X55.mjs +0 -15
- package/dist/chunk-IXKO6X55.mjs.map +0 -1
- package/dist/chunk-J3I5KZIF.js +0 -22
- package/dist/chunk-J3I5KZIF.js.map +0 -1
- package/dist/chunk-J4ZPUCLX.mjs +0 -8
- package/dist/chunk-J4ZPUCLX.mjs.map +0 -1
- package/dist/chunk-JMDSN227.mjs +0 -25
- package/dist/chunk-JMDSN227.mjs.map +0 -1
- package/dist/chunk-K7MK6LQU.js +0 -54
- package/dist/chunk-K7MK6LQU.js.map +0 -1
- package/dist/chunk-KIQOUUEZ.mjs +0 -1
- package/dist/chunk-KIQOUUEZ.mjs.map +0 -1
- package/dist/chunk-KOPPL55J.mjs +0 -28
- package/dist/chunk-KOPPL55J.mjs.map +0 -1
- package/dist/chunk-KPRLFCKD.js +0 -13
- package/dist/chunk-KPRLFCKD.js.map +0 -1
- package/dist/chunk-LACTK6EO.js +0 -33
- package/dist/chunk-LACTK6EO.js.map +0 -1
- package/dist/chunk-LB4R3BUA.mjs +0 -36
- package/dist/chunk-LB4R3BUA.mjs.map +0 -1
- package/dist/chunk-LBC2OGSN.js +0 -48
- package/dist/chunk-LBC2OGSN.js.map +0 -1
- package/dist/chunk-LPMHPAZK.js +0 -203
- package/dist/chunk-LPMHPAZK.js.map +0 -1
- package/dist/chunk-LSKT2AUS.mjs +0 -97
- package/dist/chunk-LSKT2AUS.mjs.map +0 -1
- package/dist/chunk-LVNNGMJ2.mjs +0 -13
- package/dist/chunk-LVNNGMJ2.mjs.map +0 -1
- package/dist/chunk-MF43OG3Z.mjs +0 -1
- package/dist/chunk-MF43OG3Z.mjs.map +0 -1
- package/dist/chunk-MPZOXW6I.mjs +0 -48
- package/dist/chunk-MPZOXW6I.mjs.map +0 -1
- package/dist/chunk-N6MAO223.js +0 -60
- package/dist/chunk-N6MAO223.js.map +0 -1
- package/dist/chunk-NTOY6Y4Q.mjs +0 -1
- package/dist/chunk-NTOY6Y4Q.mjs.map +0 -1
- package/dist/chunk-OHRFO2BL.mjs +0 -89
- package/dist/chunk-OHRFO2BL.mjs.map +0 -1
- package/dist/chunk-OO6IVUCV.js +0 -104
- package/dist/chunk-OO6IVUCV.js.map +0 -1
- package/dist/chunk-ORR7AE5X.mjs +0 -54
- package/dist/chunk-ORR7AE5X.mjs.map +0 -1
- package/dist/chunk-PDOVVC74.mjs +0 -153
- package/dist/chunk-PDOVVC74.mjs.map +0 -1
- package/dist/chunk-PHUTP7NB.js +0 -25
- package/dist/chunk-PHUTP7NB.js.map +0 -1
- package/dist/chunk-Q2OQXAUM.mjs +0 -35
- package/dist/chunk-Q2OQXAUM.mjs.map +0 -1
- package/dist/chunk-Q3I6P2ZF.mjs +0 -167
- package/dist/chunk-Q3I6P2ZF.mjs.map +0 -1
- package/dist/chunk-QRVFWATH.mjs +0 -14
- package/dist/chunk-QRVFWATH.mjs.map +0 -1
- package/dist/chunk-QYHQ2WWX.js +0 -89
- package/dist/chunk-QYHQ2WWX.js.map +0 -1
- package/dist/chunk-RJNNNCZJ.js +0 -39
- package/dist/chunk-RJNNNCZJ.js.map +0 -1
- package/dist/chunk-ROCGQYSK.mjs +0 -203
- package/dist/chunk-ROCGQYSK.mjs.map +0 -1
- package/dist/chunk-RQKT6BQ2.mjs +0 -1
- package/dist/chunk-RQKT6BQ2.mjs.map +0 -1
- package/dist/chunk-S2HLITUN.js +0 -1
- package/dist/chunk-S2HLITUN.js.map +0 -1
- package/dist/chunk-SB5EPHE3.js +0 -41
- package/dist/chunk-SB5EPHE3.js.map +0 -1
- package/dist/chunk-SLU4FNKX.mjs +0 -60
- package/dist/chunk-SLU4FNKX.mjs.map +0 -1
- package/dist/chunk-SNXRXX2O.js +0 -30
- package/dist/chunk-SNXRXX2O.js.map +0 -1
- package/dist/chunk-SW65QYFV.js +0 -50
- package/dist/chunk-SW65QYFV.js.map +0 -1
- package/dist/chunk-TGZ7WOTJ.mjs +0 -1
- package/dist/chunk-TGZ7WOTJ.mjs.map +0 -1
- package/dist/chunk-TZB4LBT7.js +0 -8
- package/dist/chunk-TZB4LBT7.js.map +0 -1
- package/dist/chunk-UDOXICJK.mjs +0 -1
- package/dist/chunk-UDOXICJK.mjs.map +0 -1
- package/dist/chunk-VHJZERIC.js +0 -1
- package/dist/chunk-VHJZERIC.js.map +0 -1
- package/dist/chunk-VOYBI6T4.mjs +0 -22
- package/dist/chunk-VOYBI6T4.mjs.map +0 -1
- package/dist/chunk-WDYPMEZB.js +0 -22
- package/dist/chunk-WDYPMEZB.js.map +0 -1
- package/dist/chunk-WHGYMK5B.js +0 -1
- package/dist/chunk-WHGYMK5B.js.map +0 -1
- package/dist/chunk-WZ57PU2K.js +0 -97
- package/dist/chunk-WZ57PU2K.js.map +0 -1
- package/dist/chunk-XAOCS6ZD.js +0 -69
- package/dist/chunk-XAOCS6ZD.js.map +0 -1
- package/dist/chunk-XK5HPZZC.mjs +0 -14
- package/dist/chunk-XK5HPZZC.mjs.map +0 -1
- package/dist/chunk-XP4YGQJA.js +0 -14
- package/dist/chunk-XP4YGQJA.js.map +0 -1
- package/dist/chunk-Y2U3ZPCK.js +0 -181
- package/dist/chunk-Y2U3ZPCK.js.map +0 -1
- package/dist/chunk-Y3JC4WGW.js +0 -35
- package/dist/chunk-Y3JC4WGW.js.map +0 -1
- package/dist/chunk-ZG33OGC3.mjs +0 -1
- package/dist/chunk-ZG33OGC3.mjs.map +0 -1
- package/dist/chunk-ZJQSGRNK.mjs +0 -34
- package/dist/chunk-ZJQSGRNK.mjs.map +0 -1
- package/dist/chunk-ZTX624YO.js +0 -1
- package/dist/chunk-ZTX624YO.js.map +0 -1
- package/dist/environment.js +0 -46
- package/dist/environment.js.map +0 -1
- package/dist/global.js +0 -2
- package/dist/global.js.map +0 -1
- package/dist/helpers.js +0 -57
- package/dist/helpers.js.map +0 -1
- package/dist/index.js +0 -68
- package/dist/index.js.map +0 -1
- package/dist/internals/environment.js +0 -8
- package/dist/internals/environment.js.map +0 -1
- package/dist/internals/index.js +0 -150
- package/dist/internals/index.js.map +0 -1
- package/dist/internals/logger.js +0 -8
- package/dist/internals/logger.js.map +0 -1
- package/dist/internals/request.js +0 -42
- package/dist/internals/request.js.map +0 -1
- package/dist/internals/server.js +0 -9
- package/dist/internals/server.js.map +0 -1
- package/dist/internals/simulation/constants.js +0 -14
- package/dist/internals/simulation/constants.js.map +0 -1
- package/dist/internals/simulation/controllers.js +0 -25
- package/dist/internals/simulation/controllers.js.map +0 -1
- package/dist/internals/simulation/files.js +0 -14
- package/dist/internals/simulation/files.js.map +0 -1
- package/dist/internals/simulation/index.js +0 -111
- package/dist/internals/simulation/index.js.map +0 -1
- package/dist/internals/simulation/interface.js +0 -37
- package/dist/internals/simulation/interface.js.map +0 -1
- package/dist/internals/simulation/methods/constants.js +0 -12
- package/dist/internals/simulation/methods/constants.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/get-preferences.js +0 -8
- package/dist/internals/simulation/methods/hooks/get-preferences.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/index.js +0 -39
- package/dist/internals/simulation/methods/hooks/index.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/interface.js +0 -10
- package/dist/internals/simulation/methods/hooks/interface.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/notifications.js +0 -16
- package/dist/internals/simulation/methods/hooks/notifications.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/request-user-approval.js +0 -14
- package/dist/internals/simulation/methods/hooks/request-user-approval.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/state.js +0 -18
- package/dist/internals/simulation/methods/hooks/state.js.map +0 -1
- package/dist/internals/simulation/methods/index.js +0 -28
- package/dist/internals/simulation/methods/index.js.map +0 -1
- package/dist/internals/simulation/methods/specifications.js +0 -27
- package/dist/internals/simulation/methods/specifications.js.map +0 -1
- package/dist/internals/simulation/middleware/engine.js +0 -15
- package/dist/internals/simulation/middleware/engine.js.map +0 -1
- package/dist/internals/simulation/middleware/index.js +0 -16
- package/dist/internals/simulation/middleware/index.js.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/accounts.js +0 -8
- package/dist/internals/simulation/middleware/internal-methods/accounts.js.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/index.js +0 -11
- package/dist/internals/simulation/middleware/internal-methods/index.js.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/middleware.js +0 -10
- package/dist/internals/simulation/middleware/internal-methods/middleware.js.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/provider-state.js +0 -8
- package/dist/internals/simulation/middleware/internal-methods/provider-state.js.map +0 -1
- package/dist/internals/simulation/middleware/mock.js +0 -9
- package/dist/internals/simulation/middleware/mock.js.map +0 -1
- package/dist/internals/simulation/options.js +0 -9
- package/dist/internals/simulation/options.js.map +0 -1
- package/dist/internals/simulation/simulation.js +0 -39
- package/dist/internals/simulation/simulation.js.map +0 -1
- package/dist/internals/simulation/store/index.js +0 -44
- package/dist/internals/simulation/store/index.js.map +0 -1
- package/dist/internals/simulation/store/mocks.js +0 -16
- package/dist/internals/simulation/store/mocks.js.map +0 -1
- package/dist/internals/simulation/store/notifications.js +0 -16
- package/dist/internals/simulation/store/notifications.js.map +0 -1
- package/dist/internals/simulation/store/state.js +0 -14
- package/dist/internals/simulation/store/state.js.map +0 -1
- package/dist/internals/simulation/store/store.js +0 -12
- package/dist/internals/simulation/store/store.js.map +0 -1
- package/dist/internals/simulation/store/ui.js +0 -16
- package/dist/internals/simulation/store/ui.js.map +0 -1
- package/dist/internals/structs.js +0 -22
- package/dist/internals/structs.js.map +0 -1
- package/dist/matchers.js +0 -49
- package/dist/matchers.js.map +0 -1
- package/dist/options.js +0 -8
- package/dist/options.js.map +0 -1
- package/dist/setup.js +0 -38
- package/dist/setup.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/index.d.ts +0 -5
- package/dist/types/internals/index.d.ts +0 -6
- package/dist/types/internals/simulation/index.d.ts +0 -5
- package/dist/types/internals/simulation/methods/hooks/index.d.ts +0 -5
- package/dist/types/internals/simulation/methods/index.d.ts +0 -1
- package/dist/types/internals/simulation/middleware/index.d.ts +0 -1
- package/dist/types/internals/simulation/middleware/internal-methods/index.d.ts +0 -1
- package/dist/types/internals/simulation/store/index.d.ts +0 -4
- package/dist/types/setup.d.ts +0 -1
- package/dist/types/vendor/readable-stream.d.js +0 -1
- package/dist/types/vendor/readable-stream.d.js.map +0 -1
- package/dist/types/vendor/readable-stream.d.mjs +0 -1
- package/dist/types/vendor/readable-stream.d.mjs.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/types.mjs +0 -2
- package/dist/types.mjs.map +0 -1
|
@@ -1,16 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import "
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { NotificationType } from "@metamask/snaps-sdk";
|
|
2
|
+
import $reduxjstoolkit from "@reduxjs/toolkit";
|
|
3
|
+
const { nanoid } = $reduxjstoolkit;
|
|
4
|
+
import $reduxsagaeffects from "redux-saga/effects";
|
|
5
|
+
const { put } = $reduxsagaeffects;
|
|
6
|
+
import { addNotification } from "../../store/index.mjs";
|
|
7
|
+
/**
|
|
8
|
+
* Show a native notification to the user.
|
|
9
|
+
*
|
|
10
|
+
* @param _snapId - The ID of the Snap that created the notification.
|
|
11
|
+
* @param options - The notification options.
|
|
12
|
+
* @param options.message - The message to show in the notification.
|
|
13
|
+
* @yields Adds the notification to the store.
|
|
14
|
+
* @returns `null`.
|
|
15
|
+
*/
|
|
16
|
+
function* showNativeNotificationImplementation(_snapId, { message }) {
|
|
17
|
+
yield put(addNotification({ id: nanoid(), type: NotificationType.Native, message }));
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a method that can be used to show a native notification.
|
|
22
|
+
*
|
|
23
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
24
|
+
* @returns A method that can be used to show a native notification.
|
|
25
|
+
*/
|
|
26
|
+
export function getShowNativeNotificationImplementation(runSaga) {
|
|
27
|
+
return async (...args) => {
|
|
28
|
+
return await runSaga(showNativeNotificationImplementation, ...args).toPromise();
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Show an in-app notification to the user.
|
|
33
|
+
*
|
|
34
|
+
* @param _snapId - The ID of the Snap that created the notification.
|
|
35
|
+
* @param options - The notification options.
|
|
36
|
+
* @param options.message - The message to show in the notification.
|
|
37
|
+
* @yields Adds the notification to the store.
|
|
38
|
+
* @returns `null`.
|
|
39
|
+
*/
|
|
40
|
+
function* showInAppNotificationImplementation(_snapId, { message }) {
|
|
41
|
+
yield put(addNotification({ id: nanoid(), type: NotificationType.InApp, message }));
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get a method that can be used to show an in-app notification.
|
|
46
|
+
*
|
|
47
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
48
|
+
* @returns A method that can be used to show an in-app notification.
|
|
49
|
+
*/
|
|
50
|
+
export function getShowInAppNotificationImplementation(runSaga) {
|
|
51
|
+
return async (...args) => {
|
|
52
|
+
return await runSaga(showInAppNotificationImplementation, ...args).toPromise();
|
|
53
|
+
};
|
|
54
|
+
}
|
|
16
55
|
//# sourceMappingURL=notifications.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"notifications.mjs","sourceRoot":"","sources":["../../../../../src/internals/simulation/methods/hooks/notifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,4BAA4B;;;;;AAMvD,OAAO,EAAE,eAAe,EAAE,8BAAoB;AAE9C;;;;;;;;GAQG;AACH,QAAQ,CAAC,CAAC,oCAAoC,CAC5C,OAAe,EACf,EAAE,OAAO,EAAgB;IAEzB,MAAM,GAAG,CACP,eAAe,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAC1E,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uCAAuC,CACrD,OAAwB;IAExB,OAAO,KAAK,EACV,GAAG,IAA6D,EAChE,EAAE;QACF,OAAO,MAAM,OAAO,CAClB,oCAAoC,EACpC,GAAG,IAAI,CACR,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,QAAQ,CAAC,CAAC,mCAAmC,CAC3C,OAAe,EACf,EAAE,OAAO,EAAgB;IAEzB,MAAM,GAAG,CACP,eAAe,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CACzE,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sCAAsC,CACpD,OAAwB;IAExB,OAAO,KAAK,EACV,GAAG,IAA4D,EAC/D,EAAE;QACF,OAAO,MAAM,OAAO,CAClB,mCAAmC,EACnC,GAAG,IAAI,CACR,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { NotifyParams } from '@metamask/snaps-sdk';\nimport { NotificationType } from '@metamask/snaps-sdk';\nimport { nanoid } from '@reduxjs/toolkit';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { addNotification } from '../../store';\n\n/**\n * Show a native notification to the user.\n *\n * @param _snapId - The ID of the Snap that created the notification.\n * @param options - The notification options.\n * @param options.message - The message to show in the notification.\n * @yields Adds the notification to the store.\n * @returns `null`.\n */\nfunction* showNativeNotificationImplementation(\n _snapId: string,\n { message }: NotifyParams,\n): SagaIterator {\n yield put(\n addNotification({ id: nanoid(), type: NotificationType.Native, message }),\n );\n\n return null;\n}\n\n/**\n * Get a method that can be used to show a native notification.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to show a native notification.\n */\nexport function getShowNativeNotificationImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (\n ...args: Parameters<typeof showNativeNotificationImplementation>\n ) => {\n return await runSaga(\n showNativeNotificationImplementation,\n ...args,\n ).toPromise();\n };\n}\n\n/**\n * Show an in-app notification to the user.\n *\n * @param _snapId - The ID of the Snap that created the notification.\n * @param options - The notification options.\n * @param options.message - The message to show in the notification.\n * @yields Adds the notification to the store.\n * @returns `null`.\n */\nfunction* showInAppNotificationImplementation(\n _snapId: string,\n { message }: NotifyParams,\n): SagaIterator<null> {\n yield put(\n addNotification({ id: nanoid(), type: NotificationType.InApp, message }),\n );\n\n return null;\n}\n\n/**\n * Get a method that can be used to show an in-app notification.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to show an in-app notification.\n */\nexport function getShowInAppNotificationImplementation(\n runSaga: RunSagaFunction,\n) {\n return async (\n ...args: Parameters<typeof showInAppNotificationImplementation>\n ) => {\n return await runSaga(\n showInAppNotificationImplementation,\n ...args,\n ).toPromise();\n };\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRequestUserApprovalImplementation = void 0;
|
|
4
|
+
const effects_1 = require("redux-saga/effects");
|
|
5
|
+
const store_1 = require("../../store/index.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Show a dialog to the user. This will wait for `resolveUserInterface` to be
|
|
8
|
+
* dispatched before returning.
|
|
9
|
+
*
|
|
10
|
+
* @param opts - The options for the request.
|
|
11
|
+
* @param opts.type - The type of dialog to show.
|
|
12
|
+
* @param opts.requestData - The data to display in the dialog.
|
|
13
|
+
* @param opts.requestData.id - The ID of the interface.
|
|
14
|
+
* @yields Sets the dialog in the store, waits for the user to resolve the
|
|
15
|
+
* dialog, and closes the dialog.
|
|
16
|
+
* @returns The result of the dialog.
|
|
17
|
+
*/
|
|
18
|
+
function* requestUserApprovalImplementation({ type, requestData: { id }, }) {
|
|
19
|
+
yield (0, effects_1.put)((0, store_1.setInterface)({ type, id }));
|
|
20
|
+
// We use `take` to wait for `resolveUserInterface` to be dispatched, which
|
|
21
|
+
// indicates that the user has resolved the dialog.
|
|
22
|
+
const { payload } = yield (0, effects_1.take)(store_1.resolveInterface.type);
|
|
23
|
+
yield (0, effects_1.put)((0, store_1.closeInterface)());
|
|
24
|
+
return payload;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the implementation of the `requestUserApproval` hook.
|
|
28
|
+
*
|
|
29
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
30
|
+
* @returns The implementation of the `requestUserApproval` hook.
|
|
31
|
+
*/
|
|
32
|
+
function getRequestUserApprovalImplementation(runSaga) {
|
|
33
|
+
return async (...args) => {
|
|
34
|
+
return await runSaga(requestUserApprovalImplementation, ...args).toPromise();
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
exports.getRequestUserApprovalImplementation = getRequestUserApprovalImplementation;
|
|
38
|
+
//# sourceMappingURL=request-user-approval.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-user-approval.cjs","sourceRoot":"","sources":["../../../../../src/internals/simulation/methods/hooks/request-user-approval.ts"],"names":[],"mappings":";;;AACA,gDAA+C;AAG/C,iDAA6E;AAS7E;;;;;;;;;;;GAWG;AACH,QAAQ,CAAC,CAAC,iCAAiC,CAAC,EAC1C,IAAI,EACJ,WAAW,EAAE,EAAE,EAAE,EAAE,GACO;IAC1B,MAAM,IAAA,aAAG,EAAC,IAAA,oBAAY,EAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAEtC,2EAA2E;IAC3E,mDAAmD;IACnD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,cAAI,EAAC,wBAAgB,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,IAAA,aAAG,EAAC,IAAA,sBAAc,GAAE,CAAC,CAAC;IAE5B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,oCAAoC,CAAC,OAAwB;IAC3E,OAAO,KAAK,EACV,GAAG,IAA0D,EAC7D,EAAE;QACF,OAAO,MAAM,OAAO,CAClB,iCAAiC,EACjC,GAAG,IAAI,CACR,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AATD,oFASC","sourcesContent":["import type { SagaIterator } from 'redux-saga';\nimport { put, take } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { resolveInterface, setInterface, closeInterface } from '../../store';\n\ntype RequestUserApprovalParams = {\n type: string;\n requestData: {\n id: string;\n };\n};\n\n/**\n * Show a dialog to the user. This will wait for `resolveUserInterface` to be\n * dispatched before returning.\n *\n * @param opts - The options for the request.\n * @param opts.type - The type of dialog to show.\n * @param opts.requestData - The data to display in the dialog.\n * @param opts.requestData.id - The ID of the interface.\n * @yields Sets the dialog in the store, waits for the user to resolve the\n * dialog, and closes the dialog.\n * @returns The result of the dialog.\n */\nfunction* requestUserApprovalImplementation({\n type,\n requestData: { id },\n}: RequestUserApprovalParams): SagaIterator<unknown> {\n yield put(setInterface({ type, id }));\n\n // We use `take` to wait for `resolveUserInterface` to be dispatched, which\n // indicates that the user has resolved the dialog.\n const { payload } = yield take(resolveInterface.type);\n yield put(closeInterface());\n\n return payload;\n}\n\n/**\n * Get the implementation of the `requestUserApproval` hook.\n *\n * @param runSaga - The function to run a saga outside the usual Redux flow.\n * @returns The implementation of the `requestUserApproval` hook.\n */\nexport function getRequestUserApprovalImplementation(runSaga: RunSagaFunction) {\n return async (\n ...args: Parameters<typeof requestUserApprovalImplementation>\n ) => {\n return await runSaga(\n requestUserApprovalImplementation,\n ...args,\n ).toPromise();\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RunSagaFunction } from
|
|
1
|
+
import type { RunSagaFunction } from "../../store/index.cjs";
|
|
2
2
|
type RequestUserApprovalParams = {
|
|
3
3
|
type: string;
|
|
4
4
|
requestData: {
|
|
@@ -13,3 +13,4 @@ type RequestUserApprovalParams = {
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function getRequestUserApprovalImplementation(runSaga: RunSagaFunction): (args_0: RequestUserApprovalParams) => Promise<any>;
|
|
15
15
|
export {};
|
|
16
|
+
//# sourceMappingURL=request-user-approval.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,14 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
}
|
|
14
35
|
//# sourceMappingURL=request-user-approval.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
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"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import type { Json } from
|
|
2
|
-
import type { RunSagaFunction } from
|
|
1
|
+
import type { Json } from "@metamask/utils";
|
|
2
|
+
import type { RunSagaFunction } from "../../store/index.cjs";
|
|
3
3
|
/**
|
|
4
4
|
* Get the implementation of the `getSnapState` hook.
|
|
5
5
|
*
|
|
@@ -21,3 +21,4 @@ export declare function getUpdateSnapStateMethodImplementation(runSaga: RunSagaF
|
|
|
21
21
|
* @returns The implementation of the `clearSnapState` hook.
|
|
22
22
|
*/
|
|
23
23
|
export declare function getClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, encrypted?: boolean | undefined) => Promise<void>;
|
|
24
|
+
//# sourceMappingURL=state.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Json } from "@metamask/utils";
|
|
2
|
+
import type { RunSagaFunction } from "../../store/index.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Get the implementation of the `getSnapState` hook.
|
|
5
|
+
*
|
|
6
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
7
|
+
* @returns The implementation of the `getSnapState` hook.
|
|
8
|
+
*/
|
|
9
|
+
export declare function 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
|
|
@@ -0,0 +1 @@
|
|
|
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,18 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
}
|
|
18
79
|
//# sourceMappingURL=state.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
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"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./specifications.cjs"), exports);
|
|
18
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/internals/simulation/methods/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAiC","sourcesContent":["export * from './specifications';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/internals/simulation/methods/index.ts"],"names":[],"mappings":"AAAA,qCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/internals/simulation/methods/index.ts"],"names":[],"mappings":"AAAA,qCAAiC"}
|
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
asyncResolve,
|
|
4
|
-
getEndowments,
|
|
5
|
-
getPermissionSpecifications,
|
|
6
|
-
resolve
|
|
7
|
-
} from "../../../chunk-OHRFO2BL.mjs";
|
|
8
|
-
import "../../../chunk-UDOXICJK.mjs";
|
|
9
|
-
import "../../../chunk-QRVFWATH.mjs";
|
|
10
|
-
import "../../../chunk-FQWOVTBB.mjs";
|
|
11
|
-
import "../../../chunk-ALRZENWP.mjs";
|
|
12
|
-
import "../../../chunk-24CGIQLL.mjs";
|
|
13
|
-
import "../../../chunk-5U5WB3SM.mjs";
|
|
14
|
-
import "../../../chunk-RQKT6BQ2.mjs";
|
|
15
|
-
import "../../../chunk-ORR7AE5X.mjs";
|
|
16
|
-
import "../../../chunk-ZJQSGRNK.mjs";
|
|
17
|
-
import "../../../chunk-H2464AXT.mjs";
|
|
18
|
-
import "../../../chunk-LB4R3BUA.mjs";
|
|
19
|
-
import "../../../chunk-MPZOXW6I.mjs";
|
|
20
|
-
import "../../../chunk-57SGDM5B.mjs";
|
|
21
|
-
import "../../../chunk-JMDSN227.mjs";
|
|
22
|
-
export {
|
|
23
|
-
asyncResolve,
|
|
24
|
-
getEndowments,
|
|
25
|
-
getPermissionSpecifications,
|
|
26
|
-
resolve
|
|
27
|
-
};
|
|
1
|
+
export * from "./specifications.mjs";
|
|
28
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/internals/simulation/methods/index.ts"],"names":[],"mappings":"AAAA,qCAAiC","sourcesContent":["export * from './specifications';\n"]}
|