@metamask/snaps-jest 8.3.0 → 8.3.1
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 -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} +1 -0
- 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} +6 -5
- 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} +6 -5
- 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} +6 -5
- 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} +2 -1
- 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} +6 -5
- 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
package/jest-preset.js
CHANGED
package/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-jest",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.1",
|
|
4
4
|
"description": "A Jest preset for end-to-end testing MetaMask Snaps, including a Jest environment, and a set of Jest matchers.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"import":
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
"import": {
|
|
9
|
+
"types": "./dist/index.d.mts",
|
|
10
|
+
"default": "./dist/index.mjs"
|
|
11
|
+
},
|
|
12
|
+
"require": {
|
|
13
|
+
"types": "./dist/index.d.cts",
|
|
14
|
+
"default": "./dist/index.cjs"
|
|
15
|
+
}
|
|
11
16
|
},
|
|
12
17
|
"./jest-preset": "./jest-preset.js",
|
|
13
18
|
"./package.json": "./package.json"
|
|
14
19
|
},
|
|
15
|
-
"main": "./dist/index.
|
|
20
|
+
"main": "./dist/index.cjs",
|
|
16
21
|
"module": "./dist/index.mjs",
|
|
17
|
-
"types": "./dist/
|
|
22
|
+
"types": "./dist/index.d.cts",
|
|
18
23
|
"files": [
|
|
19
24
|
"dist",
|
|
20
25
|
"jest-preset.js"
|
|
@@ -29,30 +34,28 @@
|
|
|
29
34
|
"lint:ci": "yarn lint",
|
|
30
35
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
31
36
|
"lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-jest",
|
|
32
|
-
"build": "
|
|
33
|
-
"build:types": "tsc --project tsconfig.build.json",
|
|
34
|
-
"clean": "rimraf '*.tsbuildinfo' 'dist'",
|
|
37
|
+
"build": "ts-bridge --project tsconfig.build.json --verbose --no-references",
|
|
35
38
|
"publish:preview": "yarn npm publish --tag preview",
|
|
36
|
-
"lint:dependencies": "depcheck"
|
|
37
|
-
"build:ci": "tsup --clean"
|
|
39
|
+
"lint:dependencies": "depcheck"
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {
|
|
40
42
|
"@jest/environment": "^29.5.0",
|
|
41
43
|
"@jest/expect": "^29.5.0",
|
|
42
44
|
"@jest/globals": "^29.5.0",
|
|
43
45
|
"@metamask/base-controller": "^6.0.2",
|
|
44
|
-
"@metamask/eth-json-rpc-middleware": "^
|
|
46
|
+
"@metamask/eth-json-rpc-middleware": "^14.0.0",
|
|
45
47
|
"@metamask/json-rpc-engine": "^9.0.2",
|
|
46
48
|
"@metamask/json-rpc-middleware-stream": "^8.0.2",
|
|
47
49
|
"@metamask/key-tree": "^9.1.2",
|
|
48
50
|
"@metamask/permission-controller": "^11.0.0",
|
|
49
|
-
"@metamask/
|
|
50
|
-
"@metamask/snaps-
|
|
51
|
-
"@metamask/snaps-
|
|
52
|
-
"@metamask/snaps-
|
|
53
|
-
"@metamask/snaps-
|
|
51
|
+
"@metamask/phishing-controller": "^12.0.2",
|
|
52
|
+
"@metamask/snaps-controllers": "^9.6.0",
|
|
53
|
+
"@metamask/snaps-execution-environments": "^6.7.0",
|
|
54
|
+
"@metamask/snaps-rpc-methods": "^11.1.0",
|
|
55
|
+
"@metamask/snaps-sdk": "^6.4.0",
|
|
56
|
+
"@metamask/snaps-utils": "^8.1.0",
|
|
54
57
|
"@metamask/superstruct": "^3.1.0",
|
|
55
|
-
"@metamask/utils": "^9.1
|
|
58
|
+
"@metamask/utils": "^9.2.1",
|
|
56
59
|
"@reduxjs/toolkit": "^1.9.5",
|
|
57
60
|
"express": "^4.18.2",
|
|
58
61
|
"jest-environment-node": "^29.5.0",
|
|
@@ -72,18 +75,19 @@
|
|
|
72
75
|
"@metamask/eslint-config-typescript": "^12.1.0",
|
|
73
76
|
"@swc/core": "1.3.78",
|
|
74
77
|
"@swc/jest": "^0.2.26",
|
|
78
|
+
"@ts-bridge/cli": "^0.4.4",
|
|
75
79
|
"@types/jest": "^27.5.1",
|
|
76
80
|
"@types/mime": "^3.0.0",
|
|
77
81
|
"@types/semver": "^7.5.0",
|
|
78
82
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
79
|
-
"@typescript-eslint/parser": "^
|
|
83
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
80
84
|
"deepmerge": "^4.2.2",
|
|
81
85
|
"depcheck": "^1.4.7",
|
|
82
86
|
"eslint": "^8.27.0",
|
|
83
87
|
"eslint-config-prettier": "^8.5.0",
|
|
84
88
|
"eslint-plugin-import": "^2.26.0",
|
|
85
89
|
"eslint-plugin-jest": "^27.1.5",
|
|
86
|
-
"eslint-plugin-jsdoc": "^
|
|
90
|
+
"eslint-plugin-jsdoc": "^41.1.2",
|
|
87
91
|
"eslint-plugin-n": "^15.7.0",
|
|
88
92
|
"eslint-plugin-prettier": "^4.2.1",
|
|
89
93
|
"eslint-plugin-promise": "^6.1.1",
|
|
@@ -91,9 +95,7 @@
|
|
|
91
95
|
"jest-it-up": "^2.0.0",
|
|
92
96
|
"prettier": "^2.7.1",
|
|
93
97
|
"prettier-plugin-packagejson": "^2.2.11",
|
|
94
|
-
"
|
|
95
|
-
"tsup": "^8.0.1",
|
|
96
|
-
"typescript": "~5.0.4"
|
|
98
|
+
"typescript": "~5.3.3"
|
|
97
99
|
},
|
|
98
100
|
"engines": {
|
|
99
101
|
"node": "^18.16 || >=20"
|
package/dist/chunk-24CGIQLL.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
closeInterface,
|
|
3
|
-
resolveInterface,
|
|
4
|
-
setInterface
|
|
5
|
-
} from "./chunk-ZJQSGRNK.mjs";
|
|
6
|
-
|
|
7
|
-
// src/internals/simulation/methods/hooks/request-user-approval.ts
|
|
8
|
-
import { put, take } from "redux-saga/effects";
|
|
9
|
-
function* requestUserApprovalImplementation({
|
|
10
|
-
type,
|
|
11
|
-
requestData: { id }
|
|
12
|
-
}) {
|
|
13
|
-
yield put(setInterface({ type, id }));
|
|
14
|
-
const { payload } = yield take(resolveInterface.type);
|
|
15
|
-
yield put(closeInterface());
|
|
16
|
-
return payload;
|
|
17
|
-
}
|
|
18
|
-
function getRequestUserApprovalImplementation(runSaga) {
|
|
19
|
-
return async (...args) => {
|
|
20
|
-
return await runSaga(
|
|
21
|
-
requestUserApprovalImplementation,
|
|
22
|
-
...args
|
|
23
|
-
).toPromise();
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
getRequestUserApprovalImplementation
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=chunk-24CGIQLL.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internals/simulation/methods/hooks/request-user-approval.ts"],"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"],"mappings":";;;;;;;AACA,SAAS,KAAK,YAAY;AAwB1B,UAAU,kCAAkC;AAAA,EAC1C;AAAA,EACA,aAAa,EAAE,GAAG;AACpB,GAAqD;AACnD,QAAM,IAAI,aAAa,EAAE,MAAM,GAAG,CAAC,CAAC;AAIpC,QAAM,EAAE,QAAQ,IAAI,MAAM,KAAK,iBAAiB,IAAI;AACpD,QAAM,IAAI,eAAe,CAAC;AAE1B,SAAO;AACT;AAQO,SAAS,qCAAqC,SAA0B;AAC7E,SAAO,UACF,SACA;AACH,WAAO,MAAM;AAAA,MACX;AAAA,MACA,GAAG;AAAA,IACL,EAAE,UAAU;AAAA,EACd;AACF;","names":[]}
|
package/dist/chunk-2JTGBHPR.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/internals/environment.ts
|
|
2
|
-
var _utils = require('@metamask/utils');
|
|
3
|
-
function getEnvironment() {
|
|
4
|
-
_utils.assert.call(void 0,
|
|
5
|
-
typeof snapsEnvironment !== "undefined",
|
|
6
|
-
"Snaps environment not found. Make sure you have configured the environment correctly."
|
|
7
|
-
);
|
|
8
|
-
return snapsEnvironment;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.getEnvironment = getEnvironment;
|
|
14
|
-
//# sourceMappingURL=chunk-2JTGBHPR.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internals/environment.ts"],"names":[],"mappings":";AAAA,SAAS,cAAc;AAQhB,SAAS,iBAAiB;AAG/B;AAAA,IACE,OAAO,qBAAqB;AAAA,IAC5B;AAAA,EACF;AAEA,SAAO;AACT","sourcesContent":["import { assert } from '@metamask/utils';\n\n/**\n * Get the Snaps environment. This asserts that the environment has been\n * configured.\n *\n * @returns The Snaps environment.\n */\nexport function getEnvironment() {\n // `snapsEnvironment` is a global variable that is set by the Jest\n // environment.\n assert(\n typeof snapsEnvironment !== 'undefined',\n 'Snaps environment not found. Make sure you have configured the environment correctly.',\n );\n\n return snapsEnvironment;\n}\n"]}
|
package/dist/chunk-2RJYSYUB.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/options.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _superstruct = require('@metamask/superstruct');
|
|
11
|
-
var SnapsEnvironmentOptionsStruct = _superstruct.type.call(void 0, {
|
|
12
|
-
server: _superstruct.defaulted.call(void 0,
|
|
13
|
-
_superstruct.object.call(void 0, {
|
|
14
|
-
enabled: _superstruct.defaulted.call(void 0, _superstruct.boolean.call(void 0, ), true),
|
|
15
|
-
port: _superstruct.defaulted.call(void 0, _superstruct.number.call(void 0, ), 0),
|
|
16
|
-
root: _superstruct.defaulted.call(void 0, _superstruct.string.call(void 0, ), process.cwd())
|
|
17
|
-
}),
|
|
18
|
-
{}
|
|
19
|
-
)
|
|
20
|
-
});
|
|
21
|
-
function getOptions(testEnvironmentOptions) {
|
|
22
|
-
return _superstruct.create.call(void 0, testEnvironmentOptions, SnapsEnvironmentOptionsStruct);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
exports.getOptions = getOptions;
|
|
28
|
-
//# sourceMappingURL=chunk-2RJYSYUB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/options.ts"],"names":[],"mappings":";AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,IAAM,gCAAgC,KAAK;AAAA,EACzC,QAAQ;AAAA,IACN,OAAO;AAAA,MACL,SAAS,UAAU,QAAQ,GAAG,IAAI;AAAA,MAClC,MAAM,UAAU,OAAO,GAAG,CAAC;AAAA,MAC3B,MAAM,UAAU,OAAO,GAAG,QAAQ,IAAI,CAAC;AAAA,IACzC,CAAC;AAAA,IACD,CAAC;AAAA,EACH;AACF,CAAC;AAuCM,SAAS,WAAW,wBAAiD;AAC1E,SAAO,OAAO,wBAAwB,6BAA6B;AACrE","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n create,\n defaulted,\n number,\n object,\n string,\n type,\n} from '@metamask/superstruct';\n\nconst SnapsEnvironmentOptionsStruct = type({\n server: defaulted(\n object({\n enabled: defaulted(boolean(), true),\n port: defaulted(number(), 0),\n root: defaulted(string(), process.cwd()),\n }),\n {},\n ),\n});\n\n/**\n * The options for the environment. These can be specified in the Jest\n * configuration under `testEnvironmentOptions`.\n *\n * @example\n * {\n * \"testEnvironment\": \"@metamask/snaps-jest\",\n * \"testEnvironmentOptions\": {\n * \"executionEnvironmentUrl\": \"http://localhost:8080\",\n * \"server\": {\n * \"port\": 8080,\n * /* ... *\\/\n * }\n * }\n * }\n * @property server - The options for the built-in HTTP server.\n * @property server.enabled - Whether to run the built-in HTTP server. Defaults\n * to `true`.\n * @property server.port - The port to use for the built-in HTTP server. If this\n * is not provided, a random available port will be used.\n * @property server.root - The root directory to serve from the built-in HTTP\n * server. Defaults to the current working directory. This is assumed to be the\n * directory containing the snap manifest and `dist` files. If this is a\n * relative path, it will be resolved relative to the current working directory.\n */\nexport type SnapsEnvironmentOptions = Infer<\n typeof SnapsEnvironmentOptionsStruct\n>;\n\n/**\n * Get the environment options. This validates the options, and returns the\n * default options if none are provided.\n *\n * @param testEnvironmentOptions - The test environment options as defined in\n * the Jest configuration.\n * @returns The environment options.\n */\nexport function getOptions(testEnvironmentOptions: Record<string, unknown>) {\n return create(testEnvironmentOptions, SnapsEnvironmentOptionsStruct);\n}\n"]}
|
package/dist/chunk-2YE2P5BZ.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/internals/simulation/store/notifications.ts
|
|
2
|
-
var _toolkit = require('@reduxjs/toolkit');
|
|
3
|
-
var INITIAL_STATE = {
|
|
4
|
-
notifications: []
|
|
5
|
-
};
|
|
6
|
-
var notificationsSlice = _toolkit.createSlice.call(void 0, {
|
|
7
|
-
name: "notifications",
|
|
8
|
-
initialState: INITIAL_STATE,
|
|
9
|
-
reducers: {
|
|
10
|
-
addNotification: (state, action) => {
|
|
11
|
-
state.notifications.push(action.payload);
|
|
12
|
-
},
|
|
13
|
-
removeNotification: (state, action) => {
|
|
14
|
-
state.notifications = state.notifications.filter(
|
|
15
|
-
(notification) => notification.id !== action.payload
|
|
16
|
-
);
|
|
17
|
-
},
|
|
18
|
-
clearNotifications: (state) => {
|
|
19
|
-
state.notifications = [];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
var { addNotification, removeNotification, clearNotifications } = notificationsSlice.actions;
|
|
24
|
-
var getNotifications = _toolkit.createSelector.call(void 0,
|
|
25
|
-
(state) => state.notifications,
|
|
26
|
-
({ notifications }) => notifications
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
exports.notificationsSlice = notificationsSlice; exports.addNotification = addNotification; exports.removeNotification = removeNotification; exports.clearNotifications = clearNotifications; exports.getNotifications = getNotifications;
|
|
36
|
-
//# sourceMappingURL=chunk-2YE2P5BZ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internals/simulation/store/notifications.ts"],"names":[],"mappings":";AAEA,SAAS,gBAAgB,mBAAmB;AA6B5C,IAAM,gBAAoC;AAAA,EACxC,eAAe,CAAC;AAClB;AAEO,IAAM,qBAAqB,YAAY;AAAA,EAC5C,MAAM;AAAA,EACN,cAAc;AAAA,EACd,UAAU;AAAA,IACR,iBAAiB,CAAC,OAAO,WAAwC;AAC/D,YAAM,cAAc,KAAK,OAAO,OAAO;AAAA,IACzC;AAAA,IACA,oBAAoB,CAAC,OAAO,WAAkC;AAC5D,YAAM,gBAAgB,MAAM,cAAc;AAAA,QACxC,CAAC,iBAAiB,aAAa,OAAO,OAAO;AAAA,MAC/C;AAAA,IACF;AAAA,IACA,oBAAoB,CAAC,UAAU;AAC7B,YAAM,gBAAgB,CAAC;AAAA,IACzB;AAAA,EACF;AACF,CAAC;AAEM,IAAM,EAAE,iBAAiB,oBAAoB,mBAAmB,IACrE,mBAAmB;AAQd,IAAM,mBAAmB;AAAA,EAC9B,CAAC,UAA4B,MAAM;AAAA,EACnC,CAAC,EAAE,cAAc,MAAM;AACzB","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"]}
|
package/dist/chunk-3FNLFVV2.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/internals/simulation/middleware/internal-methods/provider-state.ts
|
|
2
|
-
async function getProviderStateHandler(_request, response, _next, end) {
|
|
3
|
-
response.result = {
|
|
4
|
-
isUnlocked: true,
|
|
5
|
-
chainId: "0x01",
|
|
6
|
-
networkVersion: "0x01",
|
|
7
|
-
accounts: []
|
|
8
|
-
};
|
|
9
|
-
return end();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.getProviderStateHandler = getProviderStateHandler;
|
|
15
|
-
//# sourceMappingURL=chunk-3FNLFVV2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internals/simulation/middleware/internal-methods/provider-state.ts"],"names":[],"mappings":";AAqBA,eAAsB,wBACpB,UACA,UACA,OACA,KACA;AAGA,WAAS,SAAS;AAAA,IAChB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,UAAU,CAAC;AAAA,EACb;AAEA,SAAO,IAAI;AACb","sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type {\n Json,\n JsonRpcRequest,\n PendingJsonRpcResponse,\n} from '@metamask/utils';\n\n/**\n * A mock handler for metamask_getProviderState that always returns a specific\n * hardcoded result.\n *\n * @param _request - Incoming JSON-RPC request. Ignored for this specific\n * handler.\n * @param response - The outgoing JSON-RPC response, modified to return the\n * result.\n * @param _next - The `json-rpc-engine` middleware next handler.\n * @param end - The `json-rpc-engine` middleware end handler.\n */\nexport async function getProviderStateHandler(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse<Json>,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n) {\n // For now this will return a mocked result, this should probably match\n // whatever network the simulation is using.\n response.result = {\n isUnlocked: true,\n chainId: '0x01',\n networkVersion: '0x01',\n accounts: [],\n };\n\n return end();\n}\n"]}
|
package/dist/chunk-3J2IBWXV.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createInternalMethodsMiddleware
|
|
3
|
-
} from "./chunk-Q2OQXAUM.mjs";
|
|
4
|
-
import {
|
|
5
|
-
createMockMiddleware
|
|
6
|
-
} from "./chunk-FP4H3ADT.mjs";
|
|
7
|
-
import {
|
|
8
|
-
DEFAULT_JSON_RPC_ENDPOINT
|
|
9
|
-
} from "./chunk-LVNNGMJ2.mjs";
|
|
10
|
-
|
|
11
|
-
// src/internals/simulation/middleware/engine.ts
|
|
12
|
-
import { createFetchMiddleware } from "@metamask/eth-json-rpc-middleware";
|
|
13
|
-
import { JsonRpcEngine } from "@metamask/json-rpc-engine";
|
|
14
|
-
import { createSnapsMethodMiddleware } from "@metamask/snaps-rpc-methods";
|
|
15
|
-
function createJsonRpcEngine({
|
|
16
|
-
store,
|
|
17
|
-
hooks,
|
|
18
|
-
permissionMiddleware,
|
|
19
|
-
endpoint = DEFAULT_JSON_RPC_ENDPOINT
|
|
20
|
-
}) {
|
|
21
|
-
const engine = new JsonRpcEngine();
|
|
22
|
-
engine.push(createMockMiddleware(store));
|
|
23
|
-
engine.push(createInternalMethodsMiddleware(hooks));
|
|
24
|
-
engine.push(createSnapsMethodMiddleware(true, hooks));
|
|
25
|
-
engine.push(permissionMiddleware);
|
|
26
|
-
engine.push(
|
|
27
|
-
createFetchMiddleware({
|
|
28
|
-
btoa: globalThis.btoa,
|
|
29
|
-
fetch: globalThis.fetch,
|
|
30
|
-
rpcUrl: endpoint
|
|
31
|
-
})
|
|
32
|
-
);
|
|
33
|
-
return engine;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
createJsonRpcEngine
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=chunk-3J2IBWXV.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internals/simulation/middleware/engine.ts"],"sourcesContent":["import { createFetchMiddleware } from '@metamask/eth-json-rpc-middleware';\nimport type { JsonRpcMiddleware } from '@metamask/json-rpc-engine';\nimport { JsonRpcEngine } from '@metamask/json-rpc-engine';\nimport type { RestrictedMethodParameters } from '@metamask/permission-controller';\nimport { createSnapsMethodMiddleware } from '@metamask/snaps-rpc-methods';\nimport type { Json } from '@metamask/utils';\n\nimport { DEFAULT_JSON_RPC_ENDPOINT } from '../constants';\nimport type { MiddlewareHooks } from '../simulation';\nimport type { Store } from '../store';\nimport { createInternalMethodsMiddleware } from './internal-methods';\nimport { createMockMiddleware } from './mock';\n\nexport type CreateJsonRpcEngineOptions = {\n store: Store;\n hooks: MiddlewareHooks;\n permissionMiddleware: JsonRpcMiddleware<RestrictedMethodParameters, Json>;\n endpoint?: string;\n};\n\n/**\n * Create a JSON-RPC engine for use in a simulated environment. This engine\n * should be used to handle all JSON-RPC requests. It is set up to handle\n * requests that would normally be handled internally by the MetaMask client, as\n * well as Snap-specific requests.\n *\n * @param options - The options to use when creating the engine.\n * @param options.store - The Redux store to use.\n * @param options.hooks - Any hooks used by the middleware handlers.\n * @param options.permissionMiddleware - The permission middleware to use.\n * @param options.endpoint - The JSON-RPC endpoint to use for Ethereum requests.\n * @returns A JSON-RPC engine.\n */\nexport function createJsonRpcEngine({\n store,\n hooks,\n permissionMiddleware,\n endpoint = DEFAULT_JSON_RPC_ENDPOINT,\n}: CreateJsonRpcEngineOptions) {\n const engine = new JsonRpcEngine();\n engine.push(createMockMiddleware(store));\n engine.push(createInternalMethodsMiddleware(hooks));\n engine.push(createSnapsMethodMiddleware(true, hooks));\n engine.push(permissionMiddleware);\n engine.push(\n createFetchMiddleware({\n btoa: globalThis.btoa,\n fetch: globalThis.fetch,\n rpcUrl: endpoint,\n }),\n );\n\n return engine;\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,6BAA6B;AAEtC,SAAS,qBAAqB;AAE9B,SAAS,mCAAmC;AA6BrC,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAA+B;AAC7B,QAAM,SAAS,IAAI,cAAc;AACjC,SAAO,KAAK,qBAAqB,KAAK,CAAC;AACvC,SAAO,KAAK,gCAAgC,KAAK,CAAC;AAClD,SAAO,KAAK,4BAA4B,MAAM,KAAK,CAAC;AACpD,SAAO,KAAK,oBAAoB;AAChC,SAAO;AAAA,IACL,sBAAsB;AAAA,MACpB,MAAM,WAAW;AAAA,MACjB,OAAO,WAAW;AAAA,MAClB,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
|
package/dist/chunk-3NP6BDGK.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkRJNNNCZJjs = require('./chunk-RJNNNCZJ.js');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkDUVKGPX5js = require('./chunk-DUVKGPX5.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunkSW65QYFVjs = require('./chunk-SW65QYFV.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chunk6V6MFT67js = require('./chunk-6V6MFT67.js');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _chunkWZ57PU2Kjs = require('./chunk-WZ57PU2K.js');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _chunkQYHQ2WWXjs = require('./chunk-QYHQ2WWX.js');
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var _chunkK7MK6LQUjs = require('./chunk-K7MK6LQU.js');
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var _chunkD653LBAYjs = require('./chunk-D653LBAY.js');
|
|
26
|
-
|
|
27
|
-
// src/internals/simulation/simulation.ts
|
|
28
|
-
var _basecontroller = require('@metamask/base-controller');
|
|
29
|
-
var _jsonrpcmiddlewarestream = require('@metamask/json-rpc-middleware-stream');
|
|
30
|
-
var _keytree = require('@metamask/key-tree');
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var _node = require('@metamask/snaps-controllers/node');
|
|
37
|
-
var _snapsrpcmethods = require('@metamask/snaps-rpc-methods');
|
|
38
|
-
var _snapsutils = require('@metamask/snaps-utils');
|
|
39
|
-
var _readablestream = require('readable-stream');
|
|
40
|
-
var _effects = require('redux-saga/effects');
|
|
41
|
-
async function handleInstallSnap(snapId, {
|
|
42
|
-
executionService,
|
|
43
|
-
executionServiceOptions,
|
|
44
|
-
options: rawOptions = {}
|
|
45
|
-
} = {}) {
|
|
46
|
-
const options = _chunk6V6MFT67js.getOptions.call(void 0, rawOptions);
|
|
47
|
-
const location = _node.detectSnapLocation.call(void 0, snapId, {
|
|
48
|
-
allowLocal: true
|
|
49
|
-
});
|
|
50
|
-
const snapFiles = await _node.fetchSnap.call(void 0, snapId, location);
|
|
51
|
-
const { store, runSaga } = _chunkK7MK6LQUjs.createStore.call(void 0, options);
|
|
52
|
-
const controllerMessenger = new (0, _basecontroller.ControllerMessenger)();
|
|
53
|
-
registerActions(controllerMessenger, runSaga);
|
|
54
|
-
const hooks = getHooks(options, snapFiles, snapId, controllerMessenger);
|
|
55
|
-
const { subjectMetadataController, permissionController } = _chunkWZ57PU2Kjs.getControllers.call(void 0, {
|
|
56
|
-
controllerMessenger,
|
|
57
|
-
hooks,
|
|
58
|
-
runSaga,
|
|
59
|
-
options
|
|
60
|
-
});
|
|
61
|
-
const engine = _chunkRJNNNCZJjs.createJsonRpcEngine.call(void 0, {
|
|
62
|
-
store,
|
|
63
|
-
hooks,
|
|
64
|
-
permissionMiddleware: permissionController.createPermissionMiddleware({
|
|
65
|
-
origin: snapId
|
|
66
|
-
})
|
|
67
|
-
});
|
|
68
|
-
const ExecutionService = executionService ?? _node.NodeThreadExecutionService;
|
|
69
|
-
const service = new ExecutionService({
|
|
70
|
-
...executionServiceOptions,
|
|
71
|
-
messenger: controllerMessenger.getRestricted({
|
|
72
|
-
name: "ExecutionService",
|
|
73
|
-
allowedActions: [],
|
|
74
|
-
allowedEvents: []
|
|
75
|
-
}),
|
|
76
|
-
setupSnapProvider: (_snapId, rpcStream) => {
|
|
77
|
-
const mux = _node.setupMultiplex.call(void 0, rpcStream, "snapStream");
|
|
78
|
-
const stream = mux.createStream("metamask-provider");
|
|
79
|
-
const providerStream = _jsonrpcmiddlewarestream.createEngineStream.call(void 0, { engine });
|
|
80
|
-
_readablestream.pipeline.call(void 0, stream, providerStream, stream, (error) => {
|
|
81
|
-
if (error) {
|
|
82
|
-
_snapsutils.logError.call(void 0, `Provider stream failure.`, error);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
await _chunkWZ57PU2Kjs.registerSnap.call(void 0, snapId, snapFiles.manifest.result, {
|
|
88
|
-
permissionController,
|
|
89
|
-
subjectMetadataController
|
|
90
|
-
});
|
|
91
|
-
await service.executeSnap({
|
|
92
|
-
snapId,
|
|
93
|
-
sourceCode: snapFiles.sourceCode.toString("utf8"),
|
|
94
|
-
endowments: await _chunkQYHQ2WWXjs.getEndowments.call(void 0, permissionController, snapId)
|
|
95
|
-
});
|
|
96
|
-
return {
|
|
97
|
-
snapId,
|
|
98
|
-
store,
|
|
99
|
-
executionService: service,
|
|
100
|
-
controllerMessenger,
|
|
101
|
-
runSaga
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function getHooks(options, snapFiles, snapId, controllerMessenger) {
|
|
105
|
-
return {
|
|
106
|
-
getMnemonic: async () => Promise.resolve(_keytree.mnemonicPhraseToBytes.call(void 0, options.secretRecoveryPhrase)),
|
|
107
|
-
getSnapFile: async (path, encoding) => await _chunkSW65QYFVjs.getSnapFile.call(void 0, snapFiles.auxiliaryFiles, path, encoding),
|
|
108
|
-
getIsLocked: () => false,
|
|
109
|
-
createInterface: async (...args) => controllerMessenger.call(
|
|
110
|
-
"SnapInterfaceController:createInterface",
|
|
111
|
-
snapId,
|
|
112
|
-
...args
|
|
113
|
-
),
|
|
114
|
-
updateInterface: async (...args) => controllerMessenger.call(
|
|
115
|
-
"SnapInterfaceController:updateInterface",
|
|
116
|
-
snapId,
|
|
117
|
-
...args
|
|
118
|
-
),
|
|
119
|
-
getInterfaceState: (...args) => controllerMessenger.call(
|
|
120
|
-
"SnapInterfaceController:getInterface",
|
|
121
|
-
snapId,
|
|
122
|
-
...args
|
|
123
|
-
).state,
|
|
124
|
-
resolveInterface: async (...args) => controllerMessenger.call(
|
|
125
|
-
"SnapInterfaceController:resolveInterface",
|
|
126
|
-
snapId,
|
|
127
|
-
...args
|
|
128
|
-
)
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
function registerActions(controllerMessenger, runSaga) {
|
|
132
|
-
controllerMessenger.registerActionHandler(
|
|
133
|
-
"PhishingController:maybeUpdateState",
|
|
134
|
-
async () => Promise.resolve()
|
|
135
|
-
);
|
|
136
|
-
controllerMessenger.registerActionHandler(
|
|
137
|
-
"PhishingController:testOrigin",
|
|
138
|
-
() => ({ result: false, type: "all" })
|
|
139
|
-
);
|
|
140
|
-
controllerMessenger.registerActionHandler(
|
|
141
|
-
"ApprovalController:hasRequest",
|
|
142
|
-
(opts) => {
|
|
143
|
-
function* getCurrentInterfaceSaga() {
|
|
144
|
-
const currentInterface2 = yield _effects.select.call(void 0, _chunkD653LBAYjs.getCurrentInterface);
|
|
145
|
-
return currentInterface2;
|
|
146
|
-
}
|
|
147
|
-
const currentInterface = runSaga(
|
|
148
|
-
getCurrentInterfaceSaga
|
|
149
|
-
).result();
|
|
150
|
-
return currentInterface?.type === _snapsrpcmethods.DIALOG_APPROVAL_TYPES.default && currentInterface?.id === opts?.id;
|
|
151
|
-
}
|
|
152
|
-
);
|
|
153
|
-
controllerMessenger.registerActionHandler(
|
|
154
|
-
"ApprovalController:acceptRequest",
|
|
155
|
-
async (_id, value) => {
|
|
156
|
-
await runSaga(_chunkDUVKGPX5js.resolveWithSaga, value).toPromise();
|
|
157
|
-
return { value };
|
|
158
|
-
}
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
exports.handleInstallSnap = handleInstallSnap; exports.getHooks = getHooks; exports.registerActions = registerActions;
|
|
167
|
-
//# sourceMappingURL=chunk-3NP6BDGK.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internals/simulation/simulation.ts"],"names":["currentInterface"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AAEtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AAQtC,SAAS,gBAAgB;AAGzB,SAAS,gBAAgB;AAEzB,SAAS,cAAc;AA2GvB,eAAsB,kBAKpB,QACA;AAAA,EACE;AAAA,EACA;AAAA,EACA,SAAS,aAAa,CAAC;AACzB,IAA0C,CAAC,GACnB;AACxB,QAAM,UAAU,WAAW,UAAU;AAGrC,QAAM,WAAW,mBAAmB,QAAQ;AAAA,IAC1C,YAAY;AAAA,EACd,CAAC;AAED,QAAM,YAAY,MAAM,UAAU,QAAQ,QAAQ;AAGlD,QAAM,EAAE,OAAO,QAAQ,IAAI,YAAY,OAAO;AAE9C,QAAM,sBAAsB,IAAI,oBAA8B;AAE9D,kBAAgB,qBAAqB,OAAO;AAG5C,QAAM,QAAQ,SAAS,SAAS,WAAW,QAAQ,mBAAmB;AAEtE,QAAM,EAAE,2BAA2B,qBAAqB,IAAI,eAAe;AAAA,IACzE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,SAAS,oBAAoB;AAAA,IACjC;AAAA,IACA;AAAA,IACA,sBAAsB,qBAAqB,2BAA2B;AAAA,MACpE,QAAQ;AAAA,IACV,CAAC;AAAA,EACH,CAAC;AAGD,QAAM,mBAAmB,oBAAoB;AAC7C,QAAM,UAAU,IAAI,iBAAiB;AAAA,IACnC,GAAG;AAAA,IACH,WAAW,oBAAoB,cAAc;AAAA,MAC3C,MAAM;AAAA,MACN,gBAAgB,CAAC;AAAA,MACjB,eAAe,CAAC;AAAA,IAClB,CAAC;AAAA,IACD,mBAAmB,CAAC,SAAiB,cAAsB;AACzD,YAAM,MAAM,eAAe,WAAW,YAAY;AAClD,YAAM,SAAS,IAAI,aAAa,mBAAmB;AACnD,YAAM,iBAAiB,mBAAmB,EAAE,OAAO,CAAC;AAIpD,eAAS,QAAQ,gBAAgB,QAAQ,CAAC,UAAmB;AAC3D,YAAI,OAAO;AACT,mBAAS,4BAA4B,KAAK;AAAA,QAC5C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAID,QAAM,aAAa,QAAQ,UAAU,SAAS,QAAQ;AAAA,IACpD;AAAA,IACA;AAAA,EACF,CAAC;AAGD,QAAM,QAAQ,YAAY;AAAA,IACxB;AAAA,IACA,YAAY,UAAU,WAAW,SAAS,MAAM;AAAA,IAChD,YAAY,MAAM,cAAc,sBAAsB,MAAM;AAAA,EAC9D,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,EACF;AACF;AAWO,SAAS,SACd,SACA,WACA,QACA,qBACiB;AACjB,SAAO;AAAA,IACL,aAAa,YACX,QAAQ,QAAQ,sBAAsB,QAAQ,oBAAoB,CAAC;AAAA,IACrE,aAAa,OAAO,MAAc,aAChC,MAAM,YAAY,UAAU,gBAAgB,MAAM,QAAQ;AAAA,IAC5D,aAAa,MAAM;AAAA,IACnB,iBAAiB,UAAU,SACzB,oBAAoB;AAAA,MAClB;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACF,iBAAiB,UAAU,SACzB,oBAAoB;AAAA,MAClB;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACF,mBAAmB,IAAI,SACrB,oBAAoB;AAAA,MAClB;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,EAAE;AAAA,IACJ,kBAAkB,UAAU,SAC1B,oBAAoB;AAAA,MAClB;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EACJ;AACF;AAQO,SAAS,gBACd,qBACA,SACA;AACA,sBAAoB;AAAA,IAClB;AAAA,IACA,YAAY,QAAQ,QAAQ;AAAA,EAC9B;AAEA,sBAAoB;AAAA,IAClB;AAAA,IACA,OAAO,EAAE,QAAQ,OAAO,MAAM,MAAM;AAAA,EACtC;AAEA,sBAAoB;AAAA,IAClB;AAAA,IACA,CAAC,SAAS;AAOR,gBAAU,0BAAwC;AAChD,cAAMA,oBAA8B,MAAM,OAAO,mBAAmB;AACpE,eAAOA;AAAA,MACT;AAEA,YAAM,mBAA0C;AAAA,QAC9C;AAAA,MACF,EAAE,OAAO;AACT,aACE,kBAAkB,SAAS,sBAAsB,WACjD,kBAAkB,OAAO,MAAM;AAAA,IAEnC;AAAA,EACF;AAEA,sBAAoB;AAAA,IAClB;AAAA,IACA,OAAO,KAAa,UAAmB;AACrC,YAAM,QAAQ,iBAAiB,KAAK,EAAE,UAAU;AAEhD,aAAO,EAAE,MAAM;AAAA,IACjB;AAAA,EACF;AACF","sourcesContent":["import type {\n ActionConstraint,\n EventConstraint,\n} from '@metamask/base-controller';\nimport { ControllerMessenger } from '@metamask/base-controller';\nimport { createEngineStream } from '@metamask/json-rpc-middleware-stream';\nimport { mnemonicPhraseToBytes } from '@metamask/key-tree';\nimport type { AbstractExecutionService } from '@metamask/snaps-controllers';\nimport {\n fetchSnap,\n detectSnapLocation,\n NodeThreadExecutionService,\n setupMultiplex,\n} from '@metamask/snaps-controllers/node';\nimport { DIALOG_APPROVAL_TYPES } from '@metamask/snaps-rpc-methods';\nimport type {\n SnapId,\n AuxiliaryFileEncoding,\n Component,\n InterfaceState,\n} from '@metamask/snaps-sdk';\nimport type { FetchedSnapFiles } from '@metamask/snaps-utils';\nimport { logError } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\nimport type { Duplex } from 'readable-stream';\nimport { pipeline } from 'readable-stream';\nimport type { SagaIterator } from 'redux-saga';\nimport { select } from 'redux-saga/effects';\n\nimport type { RootControllerMessenger } from './controllers';\nimport { getControllers, registerSnap } from './controllers';\nimport { getSnapFile } from './files';\nimport { resolveWithSaga } from './interface';\nimport { getEndowments } from './methods';\nimport { createJsonRpcEngine } from './middleware';\nimport type { SimulationOptions, SimulationUserOptions } from './options';\nimport { getOptions } from './options';\nimport type { Interface, RunSagaFunction, Store } from './store';\nimport { createStore, getCurrentInterface } from './store';\n\n/**\n * Options for the execution service, without the options that are shared\n * between all execution services.\n *\n * @template Service - The type of the execution service, i.e., the class that\n * creates the execution service.\n */\nexport type ExecutionServiceOptions<\n Service extends new (...args: any[]) => any,\n> = Omit<\n ConstructorParameters<Service>[0],\n keyof ConstructorParameters<typeof AbstractExecutionService<unknown>>[0]\n>;\n\n/**\n * The options for running a Snap in a simulated environment.\n *\n * @property executionService - The execution service to use.\n * @property executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @property options - The simulation options.\n * @template Service - The type of the execution service.\n */\nexport type InstallSnapOptions<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService<unknown>\n >,\n> = ExecutionServiceOptions<Service> extends Record<string, never>\n ? {\n executionService: Service;\n executionServiceOptions?: ExecutionServiceOptions<Service>;\n options?: SimulationUserOptions;\n }\n : {\n executionService: Service;\n executionServiceOptions: ExecutionServiceOptions<Service>;\n options?: SimulationUserOptions;\n };\n\nexport type InstalledSnap = {\n snapId: SnapId;\n store: Store;\n executionService: InstanceType<typeof AbstractExecutionService>;\n controllerMessenger: ControllerMessenger<ActionConstraint, EventConstraint>;\n runSaga: RunSagaFunction;\n};\n\nexport type MiddlewareHooks = {\n /**\n * A hook that returns the user's secret recovery phrase.\n *\n * @returns The user's secret recovery phrase.\n */\n getMnemonic: () => Promise<Uint8Array>;\n\n /**\n * A hook that returns the Snap's auxiliary file for the given path.\n *\n * @param path - The path of the auxiliary file to get.\n * @param encoding - The encoding to use when returning the file.\n * @returns The Snap's auxiliary file for the given path.\n */\n getSnapFile: (\n path: string,\n encoding: AuxiliaryFileEncoding,\n ) => Promise<string | null>;\n\n /**\n * A hook that returns whether the client is locked or not.\n *\n * @returns A boolean flag signaling whether the client is locked.\n */\n getIsLocked: () => boolean;\n createInterface: (content: Component) => Promise<string>;\n updateInterface: (id: string, content: Component) => Promise<void>;\n getInterfaceState: (id: string) => InterfaceState;\n resolveInterface: (id: string, value: Json) => Promise<void>;\n};\n\n/**\n * Install a Snap in a simulated environment. This will fetch the Snap files,\n * create a Redux store, set up the controllers and JSON-RPC stack, register the\n * Snap, and run the Snap code in the execution service.\n *\n * @param snapId - The ID of the Snap to install.\n * @param options - The options to use when installing the Snap.\n * @param options.executionService - The execution service to use.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @template Service - The type of the execution service.\n */\nexport async function handleInstallSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n>(\n snapId: SnapId,\n {\n executionService,\n executionServiceOptions,\n options: rawOptions = {},\n }: Partial<InstallSnapOptions<Service>> = {},\n): Promise<InstalledSnap> {\n const options = getOptions(rawOptions);\n\n // Fetch Snap files.\n const location = detectSnapLocation(snapId, {\n allowLocal: true,\n });\n\n const snapFiles = await fetchSnap(snapId, location);\n\n // Create Redux store.\n const { store, runSaga } = createStore(options);\n\n const controllerMessenger = new ControllerMessenger<any, any>();\n\n registerActions(controllerMessenger, runSaga);\n\n // Set up controllers and JSON-RPC stack.\n const hooks = getHooks(options, snapFiles, snapId, controllerMessenger);\n\n const { subjectMetadataController, permissionController } = getControllers({\n controllerMessenger,\n hooks,\n runSaga,\n options,\n });\n\n const engine = createJsonRpcEngine({\n store,\n hooks,\n permissionMiddleware: permissionController.createPermissionMiddleware({\n origin: snapId,\n }),\n });\n\n // Create execution service.\n const ExecutionService = executionService ?? NodeThreadExecutionService;\n const service = new ExecutionService({\n ...executionServiceOptions,\n messenger: controllerMessenger.getRestricted({\n name: 'ExecutionService',\n allowedActions: [],\n allowedEvents: [],\n }),\n setupSnapProvider: (_snapId: string, rpcStream: Duplex) => {\n const mux = setupMultiplex(rpcStream, 'snapStream');\n const stream = mux.createStream('metamask-provider');\n const providerStream = createEngineStream({ engine });\n\n // Error function is difficult to test, so we ignore it.\n /* istanbul ignore next 2 */\n pipeline(stream, providerStream, stream, (error: unknown) => {\n if (error) {\n logError(`Provider stream failure.`, error);\n }\n });\n },\n });\n\n // Register the Snap. This sets up the Snap's permissions and subject\n // metadata.\n await registerSnap(snapId, snapFiles.manifest.result, {\n permissionController,\n subjectMetadataController,\n });\n\n // Run the Snap code in the execution service.\n await service.executeSnap({\n snapId,\n sourceCode: snapFiles.sourceCode.toString('utf8'),\n endowments: await getEndowments(permissionController, snapId),\n });\n\n return {\n snapId,\n store,\n executionService: service,\n controllerMessenger,\n runSaga,\n };\n}\n\n/**\n * Get the hooks for the simulation.\n *\n * @param options - The simulation options.\n * @param snapFiles - The Snap files.\n * @param snapId - The Snap ID.\n * @param controllerMessenger - The controller messenger.\n * @returns The hooks for the simulation.\n */\nexport function getHooks(\n options: SimulationOptions,\n snapFiles: FetchedSnapFiles,\n snapId: SnapId,\n controllerMessenger: RootControllerMessenger,\n): MiddlewareHooks {\n return {\n getMnemonic: async () =>\n Promise.resolve(mnemonicPhraseToBytes(options.secretRecoveryPhrase)),\n getSnapFile: async (path: string, encoding: AuxiliaryFileEncoding) =>\n await getSnapFile(snapFiles.auxiliaryFiles, path, encoding),\n getIsLocked: () => false,\n createInterface: async (...args) =>\n controllerMessenger.call(\n 'SnapInterfaceController:createInterface',\n snapId,\n ...args,\n ),\n updateInterface: async (...args) =>\n controllerMessenger.call(\n 'SnapInterfaceController:updateInterface',\n snapId,\n ...args,\n ),\n getInterfaceState: (...args) =>\n controllerMessenger.call(\n 'SnapInterfaceController:getInterface',\n snapId,\n ...args,\n ).state,\n resolveInterface: async (...args) =>\n controllerMessenger.call(\n 'SnapInterfaceController:resolveInterface',\n snapId,\n ...args,\n ),\n };\n}\n\n/**\n * Register mocked action handlers.\n *\n * @param controllerMessenger - The controller messenger.\n * @param runSaga - The run saga function.\n */\nexport function registerActions(\n controllerMessenger: RootControllerMessenger,\n runSaga: RunSagaFunction,\n) {\n controllerMessenger.registerActionHandler(\n 'PhishingController:maybeUpdateState',\n async () => Promise.resolve(),\n );\n\n controllerMessenger.registerActionHandler(\n 'PhishingController:testOrigin',\n () => ({ result: false, type: 'all' }),\n );\n\n controllerMessenger.registerActionHandler(\n 'ApprovalController:hasRequest',\n (opts) => {\n /**\n * Get the current interface from the store.\n *\n * @yields Selects the current interface from the store.\n * @returns The current interface.\n */\n function* getCurrentInterfaceSaga(): SagaIterator {\n const currentInterface: Interface = yield select(getCurrentInterface);\n return currentInterface;\n }\n\n const currentInterface: Interface | undefined = runSaga(\n getCurrentInterfaceSaga,\n ).result();\n return (\n currentInterface?.type === DIALOG_APPROVAL_TYPES.default &&\n currentInterface?.id === opts?.id\n );\n },\n );\n\n controllerMessenger.registerActionHandler(\n 'ApprovalController:acceptRequest',\n async (_id: string, value: unknown) => {\n await runSaga(resolveWithSaga, value).toPromise();\n\n return { value };\n },\n );\n}\n"]}
|
package/dist/chunk-55J6XMHW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";//# sourceMappingURL=chunk-55J6XMHW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-57SGDM5B.mjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// src/internals/simulation/methods/constants.ts
|
|
2
|
-
var EXCLUDED_SNAP_ENDOWMENTS = [];
|
|
3
|
-
var EXCLUDED_SNAP_PERMISSIONS = [];
|
|
4
|
-
var UNRESTRICTED_METHODS = Object.freeze([
|
|
5
|
-
"eth_blockNumber",
|
|
6
|
-
"eth_call",
|
|
7
|
-
"eth_chainId",
|
|
8
|
-
"eth_coinbase",
|
|
9
|
-
"eth_decrypt",
|
|
10
|
-
"eth_estimateGas",
|
|
11
|
-
"eth_feeHistory",
|
|
12
|
-
"eth_gasPrice",
|
|
13
|
-
"eth_getBalance",
|
|
14
|
-
"eth_getBlockByHash",
|
|
15
|
-
"eth_getBlockByNumber",
|
|
16
|
-
"eth_getBlockTransactionCountByHash",
|
|
17
|
-
"eth_getBlockTransactionCountByNumber",
|
|
18
|
-
"eth_getCode",
|
|
19
|
-
"eth_getEncryptionPublicKey",
|
|
20
|
-
"eth_getFilterChanges",
|
|
21
|
-
"eth_getFilterLogs",
|
|
22
|
-
"eth_getLogs",
|
|
23
|
-
"eth_getProof",
|
|
24
|
-
"eth_getStorageAt",
|
|
25
|
-
"eth_getTransactionByBlockHashAndIndex",
|
|
26
|
-
"eth_getTransactionByBlockNumberAndIndex",
|
|
27
|
-
"eth_getTransactionByHash",
|
|
28
|
-
"eth_getTransactionCount",
|
|
29
|
-
"eth_getTransactionReceipt",
|
|
30
|
-
"eth_getUncleByBlockHashAndIndex",
|
|
31
|
-
"eth_getUncleByBlockNumberAndIndex",
|
|
32
|
-
"eth_getUncleCountByBlockHash",
|
|
33
|
-
"eth_getUncleCountByBlockNumber",
|
|
34
|
-
"eth_getWork",
|
|
35
|
-
"eth_hashrate",
|
|
36
|
-
"eth_mining",
|
|
37
|
-
"eth_newBlockFilter",
|
|
38
|
-
"eth_newFilter",
|
|
39
|
-
"eth_newPendingTransactionFilter",
|
|
40
|
-
"eth_protocolVersion",
|
|
41
|
-
"eth_sendRawTransaction",
|
|
42
|
-
"eth_sendTransaction",
|
|
43
|
-
"eth_sign",
|
|
44
|
-
"eth_signTypedData",
|
|
45
|
-
"eth_signTypedData_v1",
|
|
46
|
-
"eth_signTypedData_v3",
|
|
47
|
-
"eth_signTypedData_v4",
|
|
48
|
-
"eth_submitHashrate",
|
|
49
|
-
"eth_submitWork",
|
|
50
|
-
"eth_syncing",
|
|
51
|
-
"eth_uninstallFilter",
|
|
52
|
-
"metamask_getProviderState",
|
|
53
|
-
"metamask_watchAsset",
|
|
54
|
-
"net_listening",
|
|
55
|
-
"net_peerCount",
|
|
56
|
-
"net_version",
|
|
57
|
-
"personal_ecRecover",
|
|
58
|
-
"personal_sign",
|
|
59
|
-
"wallet_watchAsset",
|
|
60
|
-
"web3_clientVersion",
|
|
61
|
-
"web3_sha3"
|
|
62
|
-
]);
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
EXCLUDED_SNAP_ENDOWMENTS,
|
|
66
|
-
EXCLUDED_SNAP_PERMISSIONS,
|
|
67
|
-
UNRESTRICTED_METHODS
|
|
68
|
-
};
|
|
69
|
-
//# sourceMappingURL=chunk-57SGDM5B.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internals/simulation/methods/constants.ts"],"sourcesContent":["export const EXCLUDED_SNAP_ENDOWMENTS = [];\n\nexport const EXCLUDED_SNAP_PERMISSIONS = [];\n\n/**\n * All unrestricted methods recognized by the `PermissionController`.\n * Unrestricted methods are ignored by the permission system, but every\n * JSON-RPC request seen by the permission system must correspond to a\n * restricted or unrestricted method, or the request will be rejected with a\n * \"method not found\" error.\n */\nexport const UNRESTRICTED_METHODS = Object.freeze([\n 'eth_blockNumber',\n 'eth_call',\n 'eth_chainId',\n 'eth_coinbase',\n 'eth_decrypt',\n 'eth_estimateGas',\n 'eth_feeHistory',\n 'eth_gasPrice',\n 'eth_getBalance',\n 'eth_getBlockByHash',\n 'eth_getBlockByNumber',\n 'eth_getBlockTransactionCountByHash',\n 'eth_getBlockTransactionCountByNumber',\n 'eth_getCode',\n 'eth_getEncryptionPublicKey',\n 'eth_getFilterChanges',\n 'eth_getFilterLogs',\n 'eth_getLogs',\n 'eth_getProof',\n 'eth_getStorageAt',\n 'eth_getTransactionByBlockHashAndIndex',\n 'eth_getTransactionByBlockNumberAndIndex',\n 'eth_getTransactionByHash',\n 'eth_getTransactionCount',\n 'eth_getTransactionReceipt',\n 'eth_getUncleByBlockHashAndIndex',\n 'eth_getUncleByBlockNumberAndIndex',\n 'eth_getUncleCountByBlockHash',\n 'eth_getUncleCountByBlockNumber',\n 'eth_getWork',\n 'eth_hashrate',\n 'eth_mining',\n 'eth_newBlockFilter',\n 'eth_newFilter',\n 'eth_newPendingTransactionFilter',\n 'eth_protocolVersion',\n 'eth_sendRawTransaction',\n 'eth_sendTransaction',\n 'eth_sign',\n 'eth_signTypedData',\n 'eth_signTypedData_v1',\n 'eth_signTypedData_v3',\n 'eth_signTypedData_v4',\n 'eth_submitHashrate',\n 'eth_submitWork',\n 'eth_syncing',\n 'eth_uninstallFilter',\n 'metamask_getProviderState',\n 'metamask_watchAsset',\n 'net_listening',\n 'net_peerCount',\n 'net_version',\n 'personal_ecRecover',\n 'personal_sign',\n 'wallet_watchAsset',\n 'web3_clientVersion',\n 'web3_sha3',\n]);\n"],"mappings":";AAAO,IAAM,2BAA2B,CAAC;AAElC,IAAM,4BAA4B,CAAC;AASnC,IAAM,uBAAuB,OAAO,OAAO;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":[]}
|
package/dist/chunk-5U5WB3SM.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
clearState,
|
|
3
|
-
getState,
|
|
4
|
-
setState
|
|
5
|
-
} from "./chunk-MPZOXW6I.mjs";
|
|
6
|
-
|
|
7
|
-
// src/internals/simulation/methods/hooks/state.ts
|
|
8
|
-
import { parseJson } from "@metamask/snaps-utils";
|
|
9
|
-
import { put, select } from "redux-saga/effects";
|
|
10
|
-
function* getSnapStateImplementation(_snapId, encrypted = true) {
|
|
11
|
-
const state = yield select(getState(encrypted));
|
|
12
|
-
return parseJson(state);
|
|
13
|
-
}
|
|
14
|
-
function getGetSnapStateMethodImplementation(runSaga) {
|
|
15
|
-
return (...args) => {
|
|
16
|
-
return runSaga(getSnapStateImplementation, ...args).result();
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function* updateSnapStateImplementation(_snapId, newState, encrypted = true) {
|
|
20
|
-
yield put(setState({ state: JSON.stringify(newState), encrypted }));
|
|
21
|
-
}
|
|
22
|
-
function getUpdateSnapStateMethodImplementation(runSaga) {
|
|
23
|
-
return (...args) => {
|
|
24
|
-
runSaga(updateSnapStateImplementation, ...args).result();
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function* clearSnapStateImplementation(_snapId, encrypted = true) {
|
|
28
|
-
yield put(clearState({ encrypted }));
|
|
29
|
-
}
|
|
30
|
-
function getClearSnapStateMethodImplementation(runSaga) {
|
|
31
|
-
return async (...args) => {
|
|
32
|
-
runSaga(clearSnapStateImplementation, ...args).result();
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
getGetSnapStateMethodImplementation,
|
|
38
|
-
getUpdateSnapStateMethodImplementation,
|
|
39
|
-
getClearSnapStateMethodImplementation
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=chunk-5U5WB3SM.mjs.map
|