@metamask/snaps-jest 4.0.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -1
- package/README.md +66 -179
- package/dist/chunk-2KLZ7GOW.js +15 -0
- package/dist/chunk-2KLZ7GOW.js.map +1 -0
- package/dist/chunk-2M7WQ26F.js +28 -0
- package/dist/chunk-2M7WQ26F.js.map +1 -0
- package/dist/chunk-34GS3AHA.js +33 -0
- package/dist/chunk-34GS3AHA.js.map +1 -0
- package/dist/chunk-3CC2NI7R.js +80 -0
- package/dist/chunk-3CC2NI7R.js.map +1 -0
- package/dist/chunk-3IUQA6YL.mjs +1 -0
- package/dist/chunk-3IUQA6YL.mjs.map +1 -0
- package/dist/chunk-3KCEPGJA.js +39 -0
- package/dist/chunk-3KCEPGJA.js.map +1 -0
- package/dist/chunk-3KQYPQZY.js +20 -0
- package/dist/chunk-3KQYPQZY.js.map +1 -0
- package/dist/chunk-3O5OISLU.js +16 -0
- package/dist/chunk-3O5OISLU.js.map +1 -0
- package/dist/chunk-3ZW2EE3B.js +1 -0
- package/dist/chunk-3ZW2EE3B.js.map +1 -0
- package/dist/chunk-4FCRZDOX.js +134 -0
- package/dist/chunk-4FCRZDOX.js.map +1 -0
- package/dist/chunk-4HY4SM3A.js +1 -0
- package/dist/chunk-4HY4SM3A.js.map +1 -0
- package/dist/chunk-4JUUFDTC.js +104 -0
- package/dist/chunk-4JUUFDTC.js.map +1 -0
- package/dist/chunk-4VCE3DRR.mjs +34 -0
- package/dist/chunk-4VCE3DRR.mjs.map +1 -0
- package/dist/chunk-4WCFXE73.js +48 -0
- package/dist/chunk-4WCFXE73.js.map +1 -0
- package/dist/chunk-5IUHGC5S.js +153 -0
- package/dist/chunk-5IUHGC5S.js.map +1 -0
- package/dist/chunk-5O6VBW42.js +42 -0
- package/dist/chunk-5O6VBW42.js.map +1 -0
- package/dist/chunk-6IMEYERE.js +137 -0
- package/dist/chunk-6IMEYERE.js.map +1 -0
- package/dist/chunk-6KNT4UMX.mjs +35 -0
- package/dist/chunk-6KNT4UMX.mjs.map +1 -0
- package/dist/chunk-6RDNSELT.mjs +39 -0
- package/dist/chunk-6RDNSELT.mjs.map +1 -0
- package/dist/chunk-72YN2D26.mjs +60 -0
- package/dist/chunk-72YN2D26.mjs.map +1 -0
- package/dist/chunk-7JLVQJK7.js +14 -0
- package/dist/chunk-7JLVQJK7.js.map +1 -0
- package/dist/chunk-AH7YNG6N.js +22 -0
- package/dist/chunk-AH7YNG6N.js.map +1 -0
- package/dist/chunk-AIZADBRK.mjs +36 -0
- package/dist/chunk-AIZADBRK.mjs.map +1 -0
- package/dist/chunk-AKFRQ5EJ.mjs +42 -0
- package/dist/chunk-AKFRQ5EJ.mjs.map +1 -0
- package/dist/chunk-AUB7XPDH.mjs +28 -0
- package/dist/chunk-AUB7XPDH.mjs.map +1 -0
- package/dist/chunk-BJMTD7H2.mjs +20 -0
- package/dist/chunk-BJMTD7H2.mjs.map +1 -0
- package/dist/chunk-BN5VBVT3.mjs +233 -0
- package/dist/chunk-BN5VBVT3.mjs.map +1 -0
- package/dist/chunk-CKOGTHM4.mjs +22 -0
- package/dist/chunk-CKOGTHM4.mjs.map +1 -0
- package/dist/chunk-CZQKOZLR.js +11 -0
- package/dist/chunk-CZQKOZLR.js.map +1 -0
- package/dist/chunk-D36QBJ35.js +24 -0
- package/dist/chunk-D36QBJ35.js.map +1 -0
- package/dist/chunk-DEFFA5IJ.mjs +24 -0
- package/dist/chunk-DEFFA5IJ.mjs.map +1 -0
- package/dist/chunk-EFB6AQPB.js +36 -0
- package/dist/chunk-EFB6AQPB.js.map +1 -0
- package/dist/chunk-EOCDSPT7.mjs +97 -0
- package/dist/chunk-EOCDSPT7.mjs.map +1 -0
- package/dist/chunk-FPFX5AKR.mjs +36 -0
- package/dist/chunk-FPFX5AKR.mjs.map +1 -0
- package/dist/chunk-HBT34TJ2.mjs +1 -0
- package/dist/chunk-HBT34TJ2.mjs.map +1 -0
- package/dist/chunk-HBVDXIVN.mjs +80 -0
- package/dist/chunk-HBVDXIVN.mjs.map +1 -0
- package/dist/chunk-HMF2CKYT.mjs +39 -0
- package/dist/chunk-HMF2CKYT.mjs.map +1 -0
- package/dist/chunk-HP56MLQ3.js +1 -0
- package/dist/chunk-HP56MLQ3.js.map +1 -0
- package/dist/chunk-I5LVU57H.mjs +69 -0
- package/dist/chunk-I5LVU57H.mjs.map +1 -0
- package/dist/chunk-I7FLOZU7.mjs +1 -0
- package/dist/chunk-I7FLOZU7.mjs.map +1 -0
- package/dist/chunk-J2ID3DS7.mjs +33 -0
- package/dist/chunk-J2ID3DS7.mjs.map +1 -0
- package/dist/chunk-JA7RJLI7.js +34 -0
- package/dist/chunk-JA7RJLI7.js.map +1 -0
- package/dist/chunk-JB2H2XEL.mjs +1 -0
- package/dist/chunk-JB2H2XEL.mjs.map +1 -0
- package/dist/chunk-JDN3VGMO.js +21 -0
- package/dist/chunk-JDN3VGMO.js.map +1 -0
- package/dist/chunk-JGQJFYU4.js +57 -0
- package/dist/chunk-JGQJFYU4.js.map +1 -0
- package/dist/chunk-JJCX335U.mjs +91 -0
- package/dist/chunk-JJCX335U.mjs.map +1 -0
- package/dist/chunk-JMDSN227.mjs +25 -0
- package/dist/chunk-JMDSN227.mjs.map +1 -0
- package/dist/chunk-JXOKRTEH.mjs +11 -0
- package/dist/chunk-JXOKRTEH.mjs.map +1 -0
- package/dist/chunk-JZJWUVD7.mjs +1 -0
- package/dist/chunk-JZJWUVD7.mjs.map +1 -0
- package/dist/chunk-K2KTKFLP.js +76 -0
- package/dist/chunk-K2KTKFLP.js.map +1 -0
- package/dist/chunk-KGIWSGTT.js +91 -0
- package/dist/chunk-KGIWSGTT.js.map +1 -0
- package/dist/chunk-KPXLJ6RH.js +60 -0
- package/dist/chunk-KPXLJ6RH.js.map +1 -0
- package/dist/chunk-LD5PSHHT.mjs +57 -0
- package/dist/chunk-LD5PSHHT.mjs.map +1 -0
- package/dist/chunk-LNNKGOHQ.mjs +16 -0
- package/dist/chunk-LNNKGOHQ.mjs.map +1 -0
- package/dist/chunk-MNDF32ZV.js +8 -0
- package/dist/chunk-MNDF32ZV.js.map +1 -0
- package/dist/chunk-MSQ7Q2VJ.mjs +13 -0
- package/dist/chunk-MSQ7Q2VJ.mjs.map +1 -0
- package/dist/chunk-O3VJYBFN.mjs +15 -0
- package/dist/chunk-O3VJYBFN.mjs.map +1 -0
- package/dist/chunk-O4MJRHZD.js +69 -0
- package/dist/chunk-O4MJRHZD.js.map +1 -0
- package/dist/chunk-OC64PNDU.mjs +21 -0
- package/dist/chunk-OC64PNDU.mjs.map +1 -0
- package/dist/chunk-ON6M4WG5.js +36 -0
- package/dist/chunk-ON6M4WG5.js.map +1 -0
- package/dist/chunk-P7JA42ZC.mjs +153 -0
- package/dist/chunk-P7JA42ZC.mjs.map +1 -0
- package/dist/chunk-PHUTP7NB.js +25 -0
- package/dist/chunk-PHUTP7NB.js.map +1 -0
- package/dist/chunk-QFPRGU5L.mjs +104 -0
- package/dist/chunk-QFPRGU5L.mjs.map +1 -0
- package/dist/chunk-QMHWGASM.js +1 -0
- package/dist/chunk-QMHWGASM.js.map +1 -0
- package/dist/chunk-QNDLJ2W7.js +1 -0
- package/dist/chunk-QNDLJ2W7.js.map +1 -0
- package/dist/chunk-QUUILTDY.mjs +137 -0
- package/dist/chunk-QUUILTDY.mjs.map +1 -0
- package/dist/chunk-R7ORBTUD.js +1 -0
- package/dist/chunk-R7ORBTUD.js.map +1 -0
- package/dist/chunk-RQBZLDXL.js +233 -0
- package/dist/chunk-RQBZLDXL.js.map +1 -0
- package/dist/chunk-S3DHQTXB.js +1 -0
- package/dist/chunk-S3DHQTXB.js.map +1 -0
- package/dist/chunk-SWSSV3LK.js +35 -0
- package/dist/chunk-SWSSV3LK.js.map +1 -0
- package/dist/chunk-T4TRX3ZR.js +22 -0
- package/dist/chunk-T4TRX3ZR.js.map +1 -0
- package/dist/chunk-UXHKMILA.mjs +1 -0
- package/dist/chunk-UXHKMILA.mjs.map +1 -0
- package/dist/chunk-VCXM6FKU.mjs +1 -0
- package/dist/chunk-VCXM6FKU.mjs.map +1 -0
- package/dist/chunk-VHTVUQWR.mjs +14 -0
- package/dist/chunk-VHTVUQWR.mjs.map +1 -0
- package/dist/chunk-VNQIROKZ.js +97 -0
- package/dist/chunk-VNQIROKZ.js.map +1 -0
- package/dist/chunk-VXQOXWRO.mjs +48 -0
- package/dist/chunk-VXQOXWRO.mjs.map +1 -0
- package/dist/chunk-VYKYQSUI.mjs +22 -0
- package/dist/chunk-VYKYQSUI.mjs.map +1 -0
- package/dist/chunk-WEI35OIM.mjs +8 -0
- package/dist/chunk-WEI35OIM.mjs.map +1 -0
- package/dist/chunk-WL2GRM5E.mjs +76 -0
- package/dist/chunk-WL2GRM5E.mjs.map +1 -0
- package/dist/chunk-XDZPH5WD.js +39 -0
- package/dist/chunk-XDZPH5WD.js.map +1 -0
- package/dist/chunk-Y5NWZU43.js +13 -0
- package/dist/chunk-Y5NWZU43.js.map +1 -0
- package/dist/chunk-YZFWCFMG.js +1 -0
- package/dist/chunk-YZFWCFMG.js.map +1 -0
- package/dist/chunk-ZCE26WZM.mjs +1 -0
- package/dist/chunk-ZCE26WZM.mjs.map +1 -0
- package/dist/chunk-ZZPKZRJQ.mjs +134 -0
- package/dist/chunk-ZZPKZRJQ.mjs.map +1 -0
- package/dist/environment.js +47 -0
- package/dist/environment.js.map +1 -0
- package/dist/environment.mjs +47 -0
- package/dist/environment.mjs.map +1 -0
- package/dist/helpers.js +44 -0
- package/dist/helpers.js.map +1 -0
- package/dist/helpers.mjs +44 -0
- package/dist/helpers.mjs.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +54 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internals/environment.js +8 -0
- package/dist/internals/environment.js.map +1 -0
- package/dist/internals/environment.mjs +8 -0
- package/dist/internals/environment.mjs.map +1 -0
- package/dist/internals/index.js +123 -0
- package/dist/internals/index.js.map +1 -0
- package/dist/internals/index.mjs +123 -0
- package/dist/internals/index.mjs.map +1 -0
- package/dist/internals/logger.js +8 -0
- package/dist/internals/logger.js.map +1 -0
- package/dist/internals/logger.mjs +8 -0
- package/dist/internals/logger.mjs.map +1 -0
- package/dist/internals/request.js +40 -0
- package/dist/internals/request.js.map +1 -0
- package/dist/internals/request.mjs +40 -0
- package/dist/internals/request.mjs.map +1 -0
- package/dist/internals/server.js +9 -0
- package/dist/internals/server.js.map +1 -0
- package/dist/internals/server.mjs +9 -0
- package/dist/internals/server.mjs.map +1 -0
- package/dist/internals/simulation/constants.js +12 -0
- package/dist/internals/simulation/constants.js.map +1 -0
- package/dist/internals/simulation/constants.mjs +12 -0
- package/dist/internals/simulation/constants.mjs.map +1 -0
- package/dist/internals/simulation/controllers.js +26 -0
- package/dist/internals/simulation/controllers.js.map +1 -0
- package/dist/internals/simulation/controllers.mjs +26 -0
- package/dist/internals/simulation/controllers.mjs.map +1 -0
- package/dist/internals/simulation/files.js +8 -0
- package/dist/internals/simulation/files.js.map +1 -0
- package/dist/internals/simulation/files.mjs +8 -0
- package/dist/internals/simulation/files.mjs.map +1 -0
- package/dist/internals/simulation/index.js +90 -0
- package/dist/internals/simulation/index.js.map +1 -0
- package/dist/internals/simulation/index.mjs +90 -0
- package/dist/internals/simulation/index.mjs.map +1 -0
- package/dist/internals/simulation/interface.js +16 -0
- package/dist/internals/simulation/interface.js.map +1 -0
- package/dist/internals/simulation/interface.mjs +16 -0
- package/dist/internals/simulation/interface.mjs.map +1 -0
- package/dist/internals/simulation/methods/constants.js +12 -0
- package/dist/internals/simulation/methods/constants.js.map +1 -0
- package/dist/internals/simulation/methods/constants.mjs +12 -0
- package/dist/internals/simulation/methods/constants.mjs.map +1 -0
- package/dist/internals/simulation/methods/hooks/encryption.js +10 -0
- package/dist/internals/simulation/methods/hooks/encryption.js.map +1 -0
- package/dist/internals/simulation/methods/hooks/encryption.mjs +10 -0
- package/dist/internals/simulation/methods/hooks/encryption.mjs.map +1 -0
- package/dist/internals/simulation/methods/hooks/get-locale.js +8 -0
- package/dist/internals/simulation/methods/hooks/get-locale.js.map +1 -0
- package/dist/internals/simulation/methods/hooks/get-locale.mjs +8 -0
- package/dist/internals/simulation/methods/hooks/get-locale.mjs.map +1 -0
- package/dist/internals/simulation/methods/hooks/index.js +45 -0
- package/dist/internals/simulation/methods/hooks/index.js.map +1 -0
- package/dist/internals/simulation/methods/hooks/index.mjs +45 -0
- package/dist/internals/simulation/methods/hooks/index.mjs.map +1 -0
- package/dist/internals/simulation/methods/hooks/interface.js +10 -0
- package/dist/internals/simulation/methods/hooks/interface.js.map +1 -0
- package/dist/internals/simulation/methods/hooks/interface.mjs +10 -0
- package/dist/internals/simulation/methods/hooks/interface.mjs.map +1 -0
- package/dist/internals/simulation/methods/hooks/notifications.js +16 -0
- package/dist/internals/simulation/methods/hooks/notifications.js.map +1 -0
- package/dist/internals/simulation/methods/hooks/notifications.mjs +16 -0
- package/dist/internals/simulation/methods/hooks/notifications.mjs.map +1 -0
- package/dist/internals/simulation/methods/hooks/show-dialog.js +14 -0
- package/dist/internals/simulation/methods/hooks/show-dialog.js.map +1 -0
- package/dist/internals/simulation/methods/hooks/show-dialog.mjs +14 -0
- package/dist/internals/simulation/methods/hooks/show-dialog.mjs.map +1 -0
- package/dist/internals/simulation/methods/hooks/state.js +18 -0
- package/dist/internals/simulation/methods/hooks/state.js.map +1 -0
- package/dist/internals/simulation/methods/hooks/state.mjs +18 -0
- package/dist/internals/simulation/methods/hooks/state.mjs.map +1 -0
- package/dist/internals/simulation/methods/index.js +29 -0
- package/dist/internals/simulation/methods/index.js.map +1 -0
- package/dist/internals/simulation/methods/index.mjs +29 -0
- package/dist/internals/simulation/methods/index.mjs.map +1 -0
- package/dist/internals/simulation/methods/specifications.js +28 -0
- package/dist/internals/simulation/methods/specifications.js.map +1 -0
- package/dist/internals/simulation/methods/specifications.mjs +28 -0
- package/dist/internals/simulation/methods/specifications.mjs.map +1 -0
- package/dist/internals/simulation/middleware/engine.js +15 -0
- package/dist/internals/simulation/middleware/engine.js.map +1 -0
- package/dist/internals/simulation/middleware/engine.mjs +15 -0
- package/dist/internals/simulation/middleware/engine.mjs.map +1 -0
- package/dist/internals/simulation/middleware/index.js +16 -0
- package/dist/internals/simulation/middleware/index.js.map +1 -0
- package/dist/internals/simulation/middleware/index.mjs +16 -0
- package/dist/internals/simulation/middleware/index.mjs.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.js +8 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.js.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.mjs +8 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.mjs.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/index.js +11 -0
- package/dist/internals/simulation/middleware/internal-methods/index.js.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/index.mjs +11 -0
- package/dist/internals/simulation/middleware/internal-methods/index.mjs.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.js +10 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.js.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.mjs +10 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.mjs.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.js +8 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.js.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs +8 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs.map +1 -0
- package/dist/internals/simulation/middleware/mock.js +9 -0
- package/dist/internals/simulation/middleware/mock.js.map +1 -0
- package/dist/internals/simulation/middleware/mock.mjs +9 -0
- package/dist/internals/simulation/middleware/mock.mjs.map +1 -0
- package/dist/internals/simulation/options.js +9 -0
- package/dist/internals/simulation/options.js.map +1 -0
- package/dist/internals/simulation/options.mjs +9 -0
- package/dist/internals/simulation/options.mjs.map +1 -0
- package/dist/internals/simulation/simulation.js +39 -0
- package/dist/internals/simulation/simulation.js.map +1 -0
- package/dist/internals/simulation/simulation.mjs +39 -0
- package/dist/internals/simulation/simulation.mjs.map +1 -0
- package/dist/internals/simulation/store/index.js +44 -0
- package/dist/internals/simulation/store/index.js.map +1 -0
- package/dist/internals/simulation/store/index.mjs +44 -0
- package/dist/internals/simulation/store/index.mjs.map +1 -0
- package/dist/internals/simulation/store/mocks.js +16 -0
- package/dist/internals/simulation/store/mocks.js.map +1 -0
- package/dist/internals/simulation/store/mocks.mjs +16 -0
- package/dist/internals/simulation/store/mocks.mjs.map +1 -0
- package/dist/internals/simulation/store/notifications.js +16 -0
- package/dist/internals/simulation/store/notifications.js.map +1 -0
- package/dist/internals/simulation/store/notifications.mjs +16 -0
- package/dist/internals/simulation/store/notifications.mjs.map +1 -0
- package/dist/internals/simulation/store/state.js +14 -0
- package/dist/internals/simulation/store/state.js.map +1 -0
- package/dist/internals/simulation/store/state.mjs +14 -0
- package/dist/internals/simulation/store/state.mjs.map +1 -0
- package/dist/internals/simulation/store/store.js +12 -0
- package/dist/internals/simulation/store/store.js.map +1 -0
- package/dist/internals/simulation/store/store.mjs +12 -0
- package/dist/internals/simulation/store/store.mjs.map +1 -0
- package/dist/internals/simulation/store/ui.js +16 -0
- package/dist/internals/simulation/store/ui.js.map +1 -0
- package/dist/internals/simulation/store/ui.mjs +16 -0
- package/dist/internals/simulation/store/ui.mjs.map +1 -0
- package/dist/internals/structs.js +18 -0
- package/dist/internals/structs.js.map +1 -0
- package/dist/internals/structs.mjs +18 -0
- package/dist/internals/structs.mjs.map +1 -0
- package/dist/matchers.js +50 -0
- package/dist/matchers.js.map +1 -0
- package/dist/matchers.mjs +50 -0
- package/dist/matchers.mjs.map +1 -0
- package/dist/options.js +8 -0
- package/dist/options.js.map +1 -0
- package/dist/options.mjs +8 -0
- package/dist/options.mjs.map +1 -0
- package/dist/setup.js +39 -0
- package/dist/setup.js.map +1 -0
- package/dist/setup.mjs +39 -0
- package/dist/setup.mjs.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/environment.d.ts +14 -15
- package/dist/types/helpers.d.ts +64 -3
- package/dist/types/internals/index.d.ts +1 -4
- package/dist/types/internals/request.d.ts +38 -74
- package/dist/types/internals/simulation/constants.d.ts +13 -0
- package/dist/types/internals/simulation/controllers.d.ts +40 -0
- package/dist/types/internals/simulation/files.d.ts +11 -0
- package/dist/types/internals/simulation/index.d.ts +5 -0
- package/dist/types/internals/simulation/interface.d.ts +25 -0
- package/dist/types/internals/simulation/methods/constants.d.ts +10 -0
- package/dist/types/internals/simulation/methods/hooks/encryption.d.ts +29 -0
- package/dist/types/internals/simulation/methods/hooks/get-locale.d.ts +9 -0
- package/dist/types/internals/simulation/methods/hooks/index.d.ts +6 -0
- package/dist/types/internals/simulation/methods/hooks/interface.d.ts +16 -0
- package/dist/types/internals/simulation/methods/hooks/notifications.d.ts +16 -0
- package/dist/types/internals/simulation/methods/hooks/show-dialog.d.ts +9 -0
- package/dist/types/internals/simulation/methods/hooks/state.d.ts +22 -0
- package/dist/types/internals/simulation/methods/index.d.ts +1 -0
- package/dist/types/internals/simulation/methods/specifications.d.ts +56 -0
- package/dist/types/internals/simulation/middleware/engine.d.ts +26 -0
- package/dist/types/internals/simulation/middleware/index.d.ts +1 -0
- package/dist/types/internals/simulation/middleware/internal-methods/accounts.d.ts +18 -0
- package/dist/types/internals/simulation/middleware/internal-methods/index.d.ts +1 -0
- package/dist/types/internals/simulation/middleware/internal-methods/middleware.d.ts +22 -0
- package/dist/types/internals/simulation/middleware/internal-methods/provider-state.d.ts +14 -0
- package/dist/types/internals/simulation/middleware/mock.d.ts +10 -0
- package/dist/types/internals/simulation/options.d.ts +37 -0
- package/dist/types/internals/simulation/simulation.d.ts +98 -0
- package/dist/types/internals/simulation/store/index.d.ts +4 -0
- package/dist/types/internals/simulation/store/mocks.d.ts +35 -0
- package/dist/types/internals/simulation/store/notifications.d.ts +44 -0
- package/dist/types/internals/simulation/store/state.d.ts +55 -0
- package/dist/types/internals/simulation/store/store.d.ts +22 -0
- package/dist/types/internals/simulation/store/ui.d.ts +25 -0
- package/dist/types/internals/structs.d.ts +153 -0
- package/dist/types/options.d.ts +3 -35
- package/dist/types/types.d.ts +88 -41
- package/dist/types/vendor/readable-stream.d.js +1 -0
- package/dist/types/vendor/readable-stream.d.js.map +1 -0
- package/dist/types/vendor/readable-stream.d.mjs +1 -0
- package/dist/types/vendor/readable-stream.d.mjs.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/jest-preset.js +1 -1
- package/package.json +37 -24
- package/dist/cjs/environment.js +0 -205
- package/dist/cjs/environment.js.map +0 -1
- package/dist/cjs/helpers.js +0 -67
- package/dist/cjs/helpers.js.map +0 -1
- package/dist/cjs/index.js +0 -42
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/internals/environment.js +0 -19
- package/dist/cjs/internals/environment.js.map +0 -1
- package/dist/cjs/internals/index.js +0 -28
- package/dist/cjs/internals/index.js.map +0 -1
- package/dist/cjs/internals/interface.js +0 -103
- package/dist/cjs/internals/interface.js.map +0 -1
- package/dist/cjs/internals/logger.js +0 -14
- package/dist/cjs/internals/logger.js.map +0 -1
- package/dist/cjs/internals/network.js +0 -148
- package/dist/cjs/internals/network.js.map +0 -1
- package/dist/cjs/internals/request.js +0 -121
- package/dist/cjs/internals/request.js.map +0 -1
- package/dist/cjs/internals/server.js +0 -75
- package/dist/cjs/internals/server.js.map +0 -1
- package/dist/cjs/internals/structs.js +0 -122
- package/dist/cjs/internals/structs.js.map +0 -1
- package/dist/cjs/internals/types.js +0 -6
- package/dist/cjs/internals/types.js.map +0 -1
- package/dist/cjs/internals/wait-for.js +0 -63
- package/dist/cjs/internals/wait-for.js.map +0 -1
- package/dist/cjs/matchers.js +0 -117
- package/dist/cjs/matchers.js.map +0 -1
- package/dist/cjs/options.js +0 -29
- package/dist/cjs/options.js.map +0 -1
- package/dist/cjs/setup.js +0 -10
- package/dist/cjs/setup.js.map +0 -1
- package/dist/cjs/types.js +0 -6
- package/dist/cjs/types.js.map +0 -1
- package/dist/esm/environment.js +0 -182
- package/dist/esm/environment.js.map +0 -1
- package/dist/esm/helpers.js +0 -82
- package/dist/esm/helpers.js.map +0 -1
- package/dist/esm/index.js +0 -6
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/internals/environment.js +0 -14
- package/dist/esm/internals/environment.js.map +0 -1
- package/dist/esm/internals/index.js +0 -12
- package/dist/esm/internals/index.js.map +0 -1
- package/dist/esm/internals/interface.js +0 -100
- package/dist/esm/internals/interface.js.map +0 -1
- package/dist/esm/internals/logger.js +0 -4
- package/dist/esm/internals/logger.js.map +0 -1
- package/dist/esm/internals/network.js +0 -143
- package/dist/esm/internals/network.js.map +0 -1
- package/dist/esm/internals/request.js +0 -120
- package/dist/esm/internals/request.js.map +0 -1
- package/dist/esm/internals/server.js +0 -68
- package/dist/esm/internals/server.js.map +0 -1
- package/dist/esm/internals/structs.js +0 -98
- package/dist/esm/internals/structs.js.map +0 -1
- package/dist/esm/internals/types.js +0 -3
- package/dist/esm/internals/types.js.map +0 -1
- package/dist/esm/internals/wait-for.js +0 -63
- package/dist/esm/internals/wait-for.js.map +0 -1
- package/dist/esm/matchers.js +0 -108
- package/dist/esm/matchers.js.map +0 -1
- package/dist/esm/options.js +0 -26
- package/dist/esm/options.js.map +0 -1
- package/dist/esm/setup.js +0 -6
- package/dist/esm/setup.js.map +0 -1
- package/dist/esm/types.js +0 -3
- package/dist/esm/types.js.map +0 -1
- package/dist/types/internals/interface.d.ts +0 -25
- package/dist/types/internals/network.d.ts +0 -87
- package/dist/types/internals/types.d.ts +0 -18
- package/dist/types/internals/wait-for.d.ts +0 -38
|
@@ -1,81 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { AbstractExecutionService } from '@metamask/snaps-controllers';
|
|
2
|
+
import type { SnapId, Component } from '@metamask/snaps-sdk';
|
|
3
|
+
import type { HandlerType } from '@metamask/snaps-utils';
|
|
4
|
+
import type { RequestOptions, SnapRequest } from '../types';
|
|
5
|
+
import type { RunSagaFunction, Store } from './simulation';
|
|
6
|
+
import type { RootControllerMessenger } from './simulation/controllers';
|
|
7
|
+
export declare type HandleRequestOptions = {
|
|
8
|
+
snapId: SnapId;
|
|
9
|
+
store: Store;
|
|
10
|
+
executionService: AbstractExecutionService<unknown>;
|
|
11
|
+
handler: HandlerType;
|
|
12
|
+
controllerMessenger: RootControllerMessenger;
|
|
13
|
+
runSaga: RunSagaFunction;
|
|
14
|
+
request: RequestOptions;
|
|
15
|
+
};
|
|
4
16
|
/**
|
|
5
|
-
* Send a request to the
|
|
17
|
+
* Send a JSON-RPC request to the Snap, and wrap the response in a
|
|
18
|
+
* {@link SnapResponse} object.
|
|
6
19
|
*
|
|
7
|
-
* @param page - The page to send the request from.
|
|
8
20
|
* @param options - The request options.
|
|
9
|
-
* @param options.
|
|
10
|
-
* @param
|
|
11
|
-
* @
|
|
21
|
+
* @param options.snapId - The ID of the Snap to send the request to.
|
|
22
|
+
* @param options.store - The Redux store.
|
|
23
|
+
* @param options.executionService - The execution service to use to send the
|
|
24
|
+
* request.
|
|
25
|
+
* @param options.handler - The handler to use to send the request.
|
|
26
|
+
* @param options.controllerMessenger - The controller messenger used to call actions.
|
|
27
|
+
* @param options.runSaga - A function to run a saga outside the usual Redux
|
|
28
|
+
* flow.
|
|
29
|
+
* @param options.request - The request to send.
|
|
30
|
+
* @param options.request.id - The ID of the request. If not provided, a random
|
|
31
|
+
* ID will be generated.
|
|
32
|
+
* @param options.request.origin - The origin of the request. Defaults to
|
|
33
|
+
* `https://metamask.io`.
|
|
34
|
+
* @returns The response, wrapped in a {@link SnapResponse} object.
|
|
12
35
|
*/
|
|
13
|
-
export declare function
|
|
36
|
+
export declare function handleRequest({ snapId, store, executionService, handler, controllerMessenger, runSaga, request: { id, origin, ...options }, }: HandleRequestOptions): SnapRequest;
|
|
14
37
|
/**
|
|
15
|
-
*
|
|
38
|
+
* Get the response content either from the SnapInterfaceController or the response object if there is one.
|
|
16
39
|
*
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @
|
|
40
|
+
* @param result - The handler result object.
|
|
41
|
+
* @param snapId - The Snap ID.
|
|
42
|
+
* @param controllerMessenger - The controller messenger.
|
|
43
|
+
* @returns The content components if any.
|
|
20
44
|
*/
|
|
21
|
-
export declare function
|
|
22
|
-
id: string;
|
|
23
|
-
response: ({
|
|
24
|
-
result: import("@metamask/snaps-sdk").Json;
|
|
25
|
-
} | {
|
|
26
|
-
error: import("@metamask/snaps-sdk").Json;
|
|
27
|
-
}) & Record<"error", unknown>;
|
|
28
|
-
notifications: never[];
|
|
29
|
-
content?: undefined;
|
|
30
|
-
} | {
|
|
31
|
-
id: string;
|
|
32
|
-
response: {
|
|
33
|
-
result: import("@metamask/snaps-sdk").Json;
|
|
34
|
-
};
|
|
35
|
-
notifications: never[];
|
|
36
|
-
content: import("@metamask/snaps-sdk").Panel | {
|
|
37
|
-
value: string;
|
|
38
|
-
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
39
|
-
sensitive?: boolean | undefined;
|
|
40
|
-
} | {
|
|
41
|
-
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
42
|
-
} | {
|
|
43
|
-
value: string;
|
|
44
|
-
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
45
|
-
} | {
|
|
46
|
-
value: string;
|
|
47
|
-
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
48
|
-
} | {
|
|
49
|
-
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
50
|
-
} | {
|
|
51
|
-
value: string;
|
|
52
|
-
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
53
|
-
markdown?: boolean | undefined;
|
|
54
|
-
} | {
|
|
55
|
-
value: string;
|
|
56
|
-
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
57
|
-
} | {
|
|
58
|
-
value: {
|
|
59
|
-
value: string;
|
|
60
|
-
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
61
|
-
} | {
|
|
62
|
-
value: string;
|
|
63
|
-
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
64
|
-
markdown?: boolean | undefined;
|
|
65
|
-
} | {
|
|
66
|
-
value: string;
|
|
67
|
-
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
68
|
-
};
|
|
69
|
-
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
70
|
-
label: string;
|
|
71
|
-
variant?: "default" | "warning" | "critical" | undefined;
|
|
72
|
-
};
|
|
73
|
-
}>;
|
|
74
|
-
/**
|
|
75
|
-
* Run a cronjob.
|
|
76
|
-
*
|
|
77
|
-
* @param page - The page to run the cronjob from.
|
|
78
|
-
* @param options - The request options.
|
|
79
|
-
* @returns The response.
|
|
80
|
-
*/
|
|
81
|
-
export declare function runCronjob(page: Page, options: CronjobOptions): SnapRequest;
|
|
45
|
+
export declare function getContentFromResult(result: unknown, snapId: SnapId, controllerMessenger: RootControllerMessenger): Component | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A secret recovery phrase that is used for testing purposes. Do not use this
|
|
3
|
+
* to store any real funds!
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_SRP = "test test test test test test test test test test test ball";
|
|
6
|
+
/**
|
|
7
|
+
* The default locale.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_LOCALE = "en";
|
|
10
|
+
/**
|
|
11
|
+
* The default JSON-RPC endpoint for Ethereum requests.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_JSON_RPC_ENDPOINT = "https://cloudflare-eth.com/";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ControllerMessenger } from '@metamask/base-controller';
|
|
2
|
+
import type { CaveatSpecificationConstraint, PermissionSpecificationConstraint, PermissionControllerActions, SubjectMetadataControllerActions } from '@metamask/permission-controller';
|
|
3
|
+
import { PermissionController, SubjectMetadataController } from '@metamask/permission-controller';
|
|
4
|
+
import { SnapInterfaceController } from '@metamask/snaps-controllers';
|
|
5
|
+
import type { ExecutionServiceActions, SnapInterfaceControllerActions, SnapInterfaceControllerAllowedActions } from '@metamask/snaps-controllers';
|
|
6
|
+
import type { SnapId } from '@metamask/snaps-sdk';
|
|
7
|
+
import type { SnapManifest } from '@metamask/snaps-utils';
|
|
8
|
+
import type { SimulationOptions } from './options';
|
|
9
|
+
import type { MiddlewareHooks } from './simulation';
|
|
10
|
+
import type { RunSagaFunction } from './store';
|
|
11
|
+
export declare type RootControllerAllowedActions = SnapInterfaceControllerActions | SnapInterfaceControllerAllowedActions | PermissionControllerActions | ExecutionServiceActions | SubjectMetadataControllerActions;
|
|
12
|
+
export declare type RootControllerMessenger = ControllerMessenger<RootControllerAllowedActions, any>;
|
|
13
|
+
export declare type GetControllersOptions = {
|
|
14
|
+
controllerMessenger: ControllerMessenger<any, any>;
|
|
15
|
+
hooks: MiddlewareHooks;
|
|
16
|
+
runSaga: RunSagaFunction;
|
|
17
|
+
options: SimulationOptions;
|
|
18
|
+
};
|
|
19
|
+
export declare type Controllers = {
|
|
20
|
+
permissionController: PermissionController<PermissionSpecificationConstraint, CaveatSpecificationConstraint>;
|
|
21
|
+
subjectMetadataController: SubjectMetadataController;
|
|
22
|
+
interfaceController: SnapInterfaceController;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Get the controllers for the Snap.
|
|
26
|
+
*
|
|
27
|
+
* @param options - The options.
|
|
28
|
+
* @returns The controllers for the Snap.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getControllers(options: GetControllersOptions): Controllers;
|
|
31
|
+
/**
|
|
32
|
+
* Register the Snap. This sets up the Snap's permissions and subject metadata.
|
|
33
|
+
*
|
|
34
|
+
* @param snapId - The ID of the Snap to install.
|
|
35
|
+
* @param manifest - The parsed manifest.
|
|
36
|
+
* @param controllers - The controllers for the Snap.
|
|
37
|
+
* @param controllers.permissionController - The permission controller.
|
|
38
|
+
* @param controllers.subjectMetadataController - The subject metadata controller.
|
|
39
|
+
*/
|
|
40
|
+
export declare function registerSnap(snapId: SnapId, manifest: SnapManifest, { permissionController, subjectMetadataController, }: Omit<Controllers, 'interfaceController'>): Promise<void>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AuxiliaryFileEncoding } from '@metamask/snaps-sdk';
|
|
2
|
+
import type { VirtualFile } from '@metamask/snaps-utils';
|
|
3
|
+
/**
|
|
4
|
+
* Get a statically defined Snap file from an array of files.
|
|
5
|
+
*
|
|
6
|
+
* @param files - The Snap files.
|
|
7
|
+
* @param path - The file path.
|
|
8
|
+
* @param encoding - The requested file encoding.
|
|
9
|
+
* @returns The file in the requested encoding if found, otherwise null.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getSnapFile(files: VirtualFile[], path: string, encoding?: AuxiliaryFileEncoding): Promise<string | null>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Component, SnapId } from '@metamask/snaps-sdk';
|
|
2
|
+
import { DialogType } from '@metamask/snaps-sdk';
|
|
3
|
+
import type { SagaIterator } from 'redux-saga';
|
|
4
|
+
import type { SnapInterface } from '../../types';
|
|
5
|
+
import type { RootControllerMessenger } from './controllers';
|
|
6
|
+
import type { RunSagaFunction } from './store';
|
|
7
|
+
/**
|
|
8
|
+
* Get a user interface object from a type and content object.
|
|
9
|
+
*
|
|
10
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
11
|
+
* @param type - The type of the interface.
|
|
12
|
+
* @param content - The content to show in the interface.
|
|
13
|
+
* @returns The user interface object.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getInterfaceResponse(runSaga: RunSagaFunction, type: DialogType, content: Component): SnapInterface;
|
|
16
|
+
/**
|
|
17
|
+
* Get a user interface object from a Snap.
|
|
18
|
+
*
|
|
19
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
20
|
+
* @param snapId - The Snap ID.
|
|
21
|
+
* @param controllerMessenger - The controller messenger used to call actions.
|
|
22
|
+
* @yields Takes the set interface action.
|
|
23
|
+
* @returns The user interface object.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getInterface(runSaga: RunSagaFunction, snapId: SnapId, controllerMessenger: RootControllerMessenger): SagaIterator<SnapInterface>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const EXCLUDED_SNAP_ENDOWMENTS: never[];
|
|
2
|
+
export declare const EXCLUDED_SNAP_PERMISSIONS: never[];
|
|
3
|
+
/**
|
|
4
|
+
* All unrestricted methods recognized by the `PermissionController`.
|
|
5
|
+
* Unrestricted methods are ignored by the permission system, but every
|
|
6
|
+
* JSON-RPC request seen by the permission system must correspond to a
|
|
7
|
+
* restricted or unrestricted method, or the request will be rejected with a
|
|
8
|
+
* "method not found" error.
|
|
9
|
+
*/
|
|
10
|
+
export declare const UNRESTRICTED_METHODS: readonly string[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Json } from '@metamask/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Mocks encrypting a value using a password. This is not a real encryption
|
|
4
|
+
* method, but rather is used to simulate encryption in the tests.
|
|
5
|
+
*
|
|
6
|
+
* Ideally we would use a real encryption method, such as
|
|
7
|
+
* `@metamask/browser-passworder`, but it doesn't seem to work with Node.js 18
|
|
8
|
+
* without some mocking. We can switch to a real encryption method once we
|
|
9
|
+
* drop support for Node.js 18.
|
|
10
|
+
*
|
|
11
|
+
* @param password - The password to use.
|
|
12
|
+
* @param value - The value to encrypt.
|
|
13
|
+
* @returns The "encrypted" value.
|
|
14
|
+
*/
|
|
15
|
+
export declare function encryptImplementation(password: string, value: Json): string;
|
|
16
|
+
/**
|
|
17
|
+
* Mocks decrypting a value using a password. This is not a real encryption
|
|
18
|
+
* method, but rather is used to simulate encryption in the tests.
|
|
19
|
+
*
|
|
20
|
+
* Ideally we would use a real decryption method, such as
|
|
21
|
+
* `@metamask/browser-passworder`, but it doesn't seem to work with Node.js 18
|
|
22
|
+
* without some mocking. We can switch to a real encryption method once we
|
|
23
|
+
* drop support for Node.js 18.
|
|
24
|
+
*
|
|
25
|
+
* @param password - The password to use.
|
|
26
|
+
* @param value - The value to decrypt.
|
|
27
|
+
* @returns The "decrypted" value.
|
|
28
|
+
*/
|
|
29
|
+
export declare function decryptImplementation(password: string, value: string): any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SimulationOptions } from '../../options';
|
|
2
|
+
/**
|
|
3
|
+
* Get the implementation of the `getLocale` hook.
|
|
4
|
+
*
|
|
5
|
+
* @param options - The simulation options.
|
|
6
|
+
* @param options.locale - The locale to use.
|
|
7
|
+
* @returns The implementation of the `getLocale` hook.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getGetLocaleMethodImplementation({ locale, }: SimulationOptions): () => Promise<string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Component, SnapId } from '@metamask/snaps-sdk';
|
|
2
|
+
import type { RootControllerMessenger } from '../../controllers';
|
|
3
|
+
/**
|
|
4
|
+
* Get the implementation of the `createInterface` hook.
|
|
5
|
+
*
|
|
6
|
+
* @param controllerMessenger - The controller messenger used to call actions.
|
|
7
|
+
* @returns The implementation of the `createInterface` hook.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getCreateInterfaceImplementation(controllerMessenger: RootControllerMessenger): (snapId: SnapId, content: Component) => Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Get the implementation of the `getInterface` hook.
|
|
12
|
+
*
|
|
13
|
+
* @param controllerMessenger - The controller messenger used to call actions.
|
|
14
|
+
* @returns The implementation of the `getInterface` hook.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getGetInterfaceImplementation(controllerMessenger: RootControllerMessenger): (snapId: SnapId, id: string) => import("@metamask/snaps-controllers").StoredInterface;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NotifyParams } from '@metamask/snaps-sdk';
|
|
2
|
+
import type { RunSagaFunction } from '../../store';
|
|
3
|
+
/**
|
|
4
|
+
* Get a method that can be used to show a native notification.
|
|
5
|
+
*
|
|
6
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
7
|
+
* @returns A method that can be used to show a native notification.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getShowNativeNotificationImplementation(runSaga: RunSagaFunction): (args_0: string, args_1: NotifyParams) => Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* Get a method that can be used to show an in-app notification.
|
|
12
|
+
*
|
|
13
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
14
|
+
* @returns A method that can be used to show an in-app notification.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getShowInAppNotificationImplementation(runSaga: RunSagaFunction): (args_0: string, args_1: NotifyParams) => Promise<any>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DialogType } from '@metamask/snaps-sdk';
|
|
2
|
+
import type { RunSagaFunction } from '../../store';
|
|
3
|
+
/**
|
|
4
|
+
* Get the implementation of the `showDialog` hook.
|
|
5
|
+
*
|
|
6
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
7
|
+
* @returns The implementation of the `showDialog` hook.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getShowDialogImplementation(runSaga: RunSagaFunction): (_snapId: string, type: DialogType, id: string, _placeholder?: string | undefined) => Promise<any>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RunSagaFunction } from '../../store';
|
|
2
|
+
/**
|
|
3
|
+
* Get the implementation of the `getSnapState` hook.
|
|
4
|
+
*
|
|
5
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
6
|
+
* @returns The implementation of the `getSnapState` hook.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getGetSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, encrypted?: boolean | undefined) => any;
|
|
9
|
+
/**
|
|
10
|
+
* Get the implementation of the `updateSnapState` hook.
|
|
11
|
+
*
|
|
12
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
13
|
+
* @returns The implementation of the `updateSnapState` hook.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getUpdateSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, newState: string, encrypted?: boolean | undefined) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Get the implementation of the `clearSnapState` hook.
|
|
18
|
+
*
|
|
19
|
+
* @param runSaga - The function to run a saga outside the usual Redux flow.
|
|
20
|
+
* @returns The implementation of the `clearSnapState` hook.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getClearSnapStateMethodImplementation(runSaga: RunSagaFunction): (_snapId: string, encrypted?: boolean | undefined) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './specifications';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { GenericPermissionController } from '@metamask/permission-controller';
|
|
2
|
+
import type { SnapId } from '@metamask/snaps-sdk';
|
|
3
|
+
import type { RootControllerMessenger } from '../controllers';
|
|
4
|
+
import type { SimulationOptions } from '../options';
|
|
5
|
+
import type { RunSagaFunction } from '../store';
|
|
6
|
+
export declare type PermissionSpecificationsHooks = {
|
|
7
|
+
/**
|
|
8
|
+
* A hook that returns the user's secret recovery phrase.
|
|
9
|
+
*
|
|
10
|
+
* @returns The user's secret recovery phrase.
|
|
11
|
+
*/
|
|
12
|
+
getMnemonic: () => Promise<Uint8Array>;
|
|
13
|
+
};
|
|
14
|
+
export declare type GetPermissionSpecificationsOptions = {
|
|
15
|
+
controllerMessenger: RootControllerMessenger;
|
|
16
|
+
hooks: PermissionSpecificationsHooks;
|
|
17
|
+
runSaga: RunSagaFunction;
|
|
18
|
+
options: SimulationOptions;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Get a function which resolves with the specified result.
|
|
22
|
+
*
|
|
23
|
+
* @param result - The result to return.
|
|
24
|
+
* @returns The function implementation.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolve(result: unknown): () => unknown;
|
|
27
|
+
/**
|
|
28
|
+
* Get a function which resolves with the specified result.
|
|
29
|
+
*
|
|
30
|
+
* @param result - The result to return. If not specified, the function will
|
|
31
|
+
* resolve with `undefined`.
|
|
32
|
+
* @returns The function implementation.
|
|
33
|
+
*/
|
|
34
|
+
export declare function asyncResolve(result?: unknown): () => Promise<unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* Get the permission specifications for the Snap.
|
|
37
|
+
*
|
|
38
|
+
* @param options - The options.
|
|
39
|
+
* @param options.controllerMessenger - The controller messenger.
|
|
40
|
+
* @param options.hooks - The hooks.
|
|
41
|
+
* @param options.runSaga - The function to run a saga outside the usual Redux
|
|
42
|
+
* flow.
|
|
43
|
+
* @param options.options - The simulation options.
|
|
44
|
+
* @returns The permission specifications for the Snap.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getPermissionSpecifications({ controllerMessenger, hooks, runSaga, options, }: GetPermissionSpecificationsOptions): {
|
|
47
|
+
[x: string]: import("@metamask/permission-controller").PermissionSpecificationConstraint;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Get the endowments for the Snap.
|
|
51
|
+
*
|
|
52
|
+
* @param permissionController - The permission controller.
|
|
53
|
+
* @param snapId - The ID of the Snap.
|
|
54
|
+
* @returns The endowments for the Snap.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getEndowments(permissionController: GenericPermissionController, snapId: SnapId): Promise<string[]>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine';
|
|
2
|
+
import { JsonRpcEngine } from '@metamask/json-rpc-engine';
|
|
3
|
+
import type { RestrictedMethodParameters } from '@metamask/permission-controller';
|
|
4
|
+
import type { Json } from '@metamask/utils';
|
|
5
|
+
import type { MiddlewareHooks } from '../simulation';
|
|
6
|
+
import type { Store } from '../store';
|
|
7
|
+
export declare type CreateJsonRpcEngineOptions = {
|
|
8
|
+
store: Store;
|
|
9
|
+
hooks: MiddlewareHooks;
|
|
10
|
+
permissionMiddleware: JsonRpcMiddleware<RestrictedMethodParameters, Json>;
|
|
11
|
+
endpoint?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Create a JSON-RPC engine for use in a simulated environment. This engine
|
|
15
|
+
* should be used to handle all JSON-RPC requests. It is set up to handle
|
|
16
|
+
* requests that would normally be handled internally by the MetaMask client, as
|
|
17
|
+
* well as Snap-specific requests.
|
|
18
|
+
*
|
|
19
|
+
* @param options - The options to use when creating the engine.
|
|
20
|
+
* @param options.store - The Redux store to use.
|
|
21
|
+
* @param options.hooks - Any hooks used by the middleware handlers.
|
|
22
|
+
* @param options.permissionMiddleware - The permission middleware to use.
|
|
23
|
+
* @param options.endpoint - The JSON-RPC endpoint to use for Ethereum requests.
|
|
24
|
+
* @returns A JSON-RPC engine.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createJsonRpcEngine({ store, hooks, permissionMiddleware, endpoint, }: CreateJsonRpcEngineOptions): JsonRpcEngine;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './engine';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { JsonRpcEngineEndCallback, JsonRpcEngineNextCallback } from '@metamask/json-rpc-engine';
|
|
2
|
+
import type { Json, JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';
|
|
3
|
+
export declare type GetAccountsHandlerHooks = {
|
|
4
|
+
getMnemonic: () => Promise<Uint8Array>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A mock handler for account related methods that always returns the first
|
|
8
|
+
* address for the selected secret recovery phrase.
|
|
9
|
+
*
|
|
10
|
+
* @param _request - Incoming JSON-RPC request. This is ignored for this
|
|
11
|
+
* specific handler.
|
|
12
|
+
* @param response - The outgoing JSON-RPC response, modified to return the
|
|
13
|
+
* result.
|
|
14
|
+
* @param _next - The `json-rpc-engine` middleware next handler.
|
|
15
|
+
* @param end - The `json-rpc-engine` middleware end handler.
|
|
16
|
+
* @param hooks - Any hooks required by this handler.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getAccountsHandler(_request: JsonRpcRequest, response: PendingJsonRpcResponse<Json>, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback, hooks: GetAccountsHandlerHooks): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './middleware';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine';
|
|
2
|
+
import type { Json, JsonRpcParams } from '@metamask/utils';
|
|
3
|
+
export declare type InternalMethodsMiddlewareHooks = {
|
|
4
|
+
/**
|
|
5
|
+
* A hook that returns the user's secret recovery phrase.
|
|
6
|
+
*
|
|
7
|
+
* @returns The user's secret recovery phrase.
|
|
8
|
+
*/
|
|
9
|
+
getMnemonic: () => Promise<Uint8Array>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Create a middleware for handling JSON-RPC methods normally handled internally
|
|
13
|
+
* by the MetaMask client.
|
|
14
|
+
*
|
|
15
|
+
* NOTE: This middleware provides all `hooks` to all handlers and should
|
|
16
|
+
* therefore NOT be used outside of the simulation environment. It is intended
|
|
17
|
+
* for testing purposes only.
|
|
18
|
+
*
|
|
19
|
+
* @param hooks - Any hooks used by the middleware handlers.
|
|
20
|
+
* @returns A middleware function.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createInternalMethodsMiddleware(hooks: InternalMethodsMiddlewareHooks): JsonRpcMiddleware<JsonRpcParams, Json>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JsonRpcEngineEndCallback, JsonRpcEngineNextCallback } from '@metamask/json-rpc-engine';
|
|
2
|
+
import type { Json, JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';
|
|
3
|
+
/**
|
|
4
|
+
* A mock handler for metamask_getProviderState that always returns a specific
|
|
5
|
+
* hardcoded result.
|
|
6
|
+
*
|
|
7
|
+
* @param _request - Incoming JSON-RPC request. Ignored for this specific
|
|
8
|
+
* handler.
|
|
9
|
+
* @param response - The outgoing JSON-RPC response, modified to return the
|
|
10
|
+
* result.
|
|
11
|
+
* @param _next - The `json-rpc-engine` middleware next handler.
|
|
12
|
+
* @param end - The `json-rpc-engine` middleware end handler.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getProviderStateHandler(_request: JsonRpcRequest, response: PendingJsonRpcResponse<Json>, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine';
|
|
2
|
+
import type { Json, JsonRpcParams } from '@metamask/utils';
|
|
3
|
+
import type { Store } from '../store';
|
|
4
|
+
/**
|
|
5
|
+
* Create a middleware for handling JSON-RPC methods that have been mocked.
|
|
6
|
+
*
|
|
7
|
+
* @param store - The Redux store to use.
|
|
8
|
+
* @returns A middleware function.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createMockMiddleware(store: Store): JsonRpcMiddleware<JsonRpcParams, Json>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Infer } from 'superstruct';
|
|
2
|
+
declare const SimulationOptionsStruct: import("superstruct").Struct<{
|
|
3
|
+
state?: Record<string, import("@metamask/utils").Json> | null | undefined;
|
|
4
|
+
locale?: string | undefined;
|
|
5
|
+
secretRecoveryPhrase?: string | undefined;
|
|
6
|
+
unencryptedState?: Record<string, import("@metamask/utils").Json> | null | undefined;
|
|
7
|
+
}, {
|
|
8
|
+
secretRecoveryPhrase: import("superstruct").Struct<string | undefined, null>;
|
|
9
|
+
locale: import("superstruct").Struct<string | undefined, null>;
|
|
10
|
+
state: import("superstruct").Struct<Record<string, import("@metamask/utils").Json> | null | undefined, null>;
|
|
11
|
+
unencryptedState: import("superstruct").Struct<Record<string, import("@metamask/utils").Json> | null | undefined, null>;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Options for the simulation.
|
|
15
|
+
*
|
|
16
|
+
* @property secretRecoveryPhrase - The secret recovery phrase to use. This is
|
|
17
|
+
* used to derive addresses and private keys. Defaults to a test recovery
|
|
18
|
+
* phrase.
|
|
19
|
+
* @property locale - The locale to use. Defaults to `en`.
|
|
20
|
+
* @property state - The initial state of the Snap, if any. Defaults to `null`.
|
|
21
|
+
*/
|
|
22
|
+
export declare type SimulationUserOptions = Infer<typeof SimulationOptionsStruct>;
|
|
23
|
+
/**
|
|
24
|
+
* Options for the simulation, with defaults filled in.
|
|
25
|
+
*
|
|
26
|
+
* See {@link SimulationUserOptions} for documentation.
|
|
27
|
+
*/
|
|
28
|
+
export declare type SimulationOptions = Required<SimulationUserOptions>;
|
|
29
|
+
/**
|
|
30
|
+
* Get the options for the simulation.
|
|
31
|
+
*
|
|
32
|
+
* @param options - The user options. Any options not specified will be filled
|
|
33
|
+
* in with default values.
|
|
34
|
+
* @returns The simulation options.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getOptions(options: SimulationUserOptions): SimulationOptions;
|
|
37
|
+
export {};
|