@metamask/snaps-utils 6.0.0 → 7.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 +23 -1
- package/dist/array.js +8 -0
- package/dist/array.js.map +1 -0
- package/dist/array.mjs +8 -0
- package/dist/array.mjs.map +1 -0
- package/dist/auxiliary-files.js +12 -0
- package/dist/auxiliary-files.js.map +1 -0
- package/dist/auxiliary-files.mjs +12 -0
- package/dist/auxiliary-files.mjs.map +1 -0
- package/dist/base64.js +13 -0
- package/dist/base64.js.map +1 -0
- package/dist/base64.mjs +13 -0
- package/dist/base64.mjs.map +1 -0
- package/dist/bytes.js +10 -0
- package/dist/bytes.js.map +1 -0
- package/dist/bytes.mjs +10 -0
- package/dist/bytes.mjs.map +1 -0
- package/dist/caveats.js +8 -0
- package/dist/caveats.js.map +1 -0
- package/dist/caveats.mjs +8 -0
- package/dist/caveats.mjs.map +1 -0
- package/dist/checksum.js +13 -0
- package/dist/checksum.js.map +1 -0
- package/dist/checksum.mjs +13 -0
- package/dist/checksum.mjs.map +1 -0
- package/dist/chunk-224S5XKL.js +32 -0
- package/dist/chunk-224S5XKL.js.map +1 -0
- package/dist/chunk-2G4HD42C.mjs +22 -0
- package/dist/chunk-2G4HD42C.mjs.map +1 -0
- package/dist/chunk-2IVFF3AA.mjs +211 -0
- package/dist/chunk-2IVFF3AA.mjs.map +1 -0
- package/dist/chunk-2QS3W66J.js +64 -0
- package/dist/chunk-2QS3W66J.js.map +1 -0
- package/dist/chunk-2XF32FCF.js +1 -0
- package/dist/chunk-2XF32FCF.js.map +1 -0
- package/dist/chunk-32B4YQM7.mjs +103 -0
- package/dist/chunk-32B4YQM7.mjs.map +1 -0
- package/dist/chunk-3SARO5TJ.mjs +18 -0
- package/dist/chunk-3SARO5TJ.mjs.map +1 -0
- package/dist/chunk-3TH3NLQL.js +169 -0
- package/dist/chunk-3TH3NLQL.js.map +1 -0
- package/dist/chunk-3ZSMMNQB.mjs +41 -0
- package/dist/chunk-3ZSMMNQB.mjs.map +1 -0
- package/dist/chunk-43EBXDVP.mjs +30 -0
- package/dist/chunk-43EBXDVP.mjs.map +1 -0
- package/dist/chunk-4GBOSMF7.mjs +33 -0
- package/dist/chunk-4GBOSMF7.mjs.map +1 -0
- package/dist/chunk-4IKNNAVC.mjs +30 -0
- package/dist/chunk-4IKNNAVC.mjs.map +1 -0
- package/dist/chunk-4UMDRHDR.js +95 -0
- package/dist/chunk-4UMDRHDR.js.map +1 -0
- package/dist/chunk-6CTV7VW5.mjs +20 -0
- package/dist/chunk-6CTV7VW5.mjs.map +1 -0
- package/dist/chunk-6H32HLTZ.js +10 -0
- package/dist/chunk-6H32HLTZ.js.map +1 -0
- package/dist/chunk-6WBLB5BX.js +9 -0
- package/dist/chunk-6WBLB5BX.js.map +1 -0
- package/dist/chunk-7H5TGXZ5.js +70 -0
- package/dist/chunk-7H5TGXZ5.js.map +1 -0
- package/dist/chunk-7KKLGQNE.js +38 -0
- package/dist/chunk-7KKLGQNE.js.map +1 -0
- package/dist/chunk-7PNGOFLU.js +22 -0
- package/dist/chunk-7PNGOFLU.js.map +1 -0
- package/dist/chunk-7T3N2ZGQ.mjs +107 -0
- package/dist/chunk-7T3N2ZGQ.mjs.map +1 -0
- package/dist/chunk-7XA5VYYV.mjs +9 -0
- package/dist/chunk-7XA5VYYV.mjs.map +1 -0
- package/dist/chunk-B2DMAQNK.mjs +8 -0
- package/dist/chunk-B2DMAQNK.mjs.map +1 -0
- package/dist/chunk-B3YQVRPE.js +107 -0
- package/dist/chunk-B3YQVRPE.js.map +1 -0
- package/dist/chunk-DK3IYVMP.mjs +1 -0
- package/dist/chunk-DK3IYVMP.mjs.map +1 -0
- package/dist/chunk-DKSB4FMW.mjs +74 -0
- package/dist/chunk-DKSB4FMW.mjs.map +1 -0
- package/dist/chunk-F33RMB76.js +69 -0
- package/dist/chunk-F33RMB76.js.map +1 -0
- package/dist/chunk-FJH6DDEL.mjs +193 -0
- package/dist/chunk-FJH6DDEL.mjs.map +1 -0
- package/dist/chunk-FTY3BOF7.js +9 -0
- package/dist/chunk-FTY3BOF7.js.map +1 -0
- package/dist/chunk-GK4IJQVW.js +409 -0
- package/dist/chunk-GK4IJQVW.js.map +1 -0
- package/dist/chunk-GMC2A3D7.js +211 -0
- package/dist/chunk-GMC2A3D7.js.map +1 -0
- package/dist/chunk-GW5NQXN4.mjs +151 -0
- package/dist/chunk-GW5NQXN4.mjs.map +1 -0
- package/dist/chunk-H34N3OWO.mjs +169 -0
- package/dist/chunk-H34N3OWO.mjs.map +1 -0
- package/dist/chunk-H636DAOG.js +193 -0
- package/dist/chunk-H636DAOG.js.map +1 -0
- package/dist/chunk-HOTDTMNP.mjs +21 -0
- package/dist/chunk-HOTDTMNP.mjs.map +1 -0
- package/dist/chunk-HWFLO7W5.mjs +281 -0
- package/dist/chunk-HWFLO7W5.mjs.map +1 -0
- package/dist/chunk-I3BUOULW.js +18 -0
- package/dist/chunk-I3BUOULW.js.map +1 -0
- package/dist/chunk-IIDK6BRC.mjs +1 -0
- package/dist/chunk-IIDK6BRC.mjs.map +1 -0
- package/dist/chunk-IUNNN6HN.mjs +29 -0
- package/dist/chunk-IUNNN6HN.mjs.map +1 -0
- package/dist/chunk-IWENO6LT.js +20 -0
- package/dist/chunk-IWENO6LT.js.map +1 -0
- package/dist/chunk-JGMGNLZW.mjs +38 -0
- package/dist/chunk-JGMGNLZW.mjs.map +1 -0
- package/dist/chunk-JV7OA3FD.js +1 -0
- package/dist/chunk-JV7OA3FD.js.map +1 -0
- package/dist/chunk-KEXZDQAN.js +50 -0
- package/dist/chunk-KEXZDQAN.js.map +1 -0
- package/dist/chunk-KWQKGJSV.js +152 -0
- package/dist/chunk-KWQKGJSV.js.map +1 -0
- package/dist/chunk-LEFOMYX3.mjs +1 -0
- package/dist/chunk-LEFOMYX3.mjs.map +1 -0
- package/dist/chunk-LHIPBIPS.mjs +32 -0
- package/dist/chunk-LHIPBIPS.mjs.map +1 -0
- package/dist/chunk-LOW2T4MV.mjs +50 -0
- package/dist/chunk-LOW2T4MV.mjs.map +1 -0
- package/dist/chunk-MJABESWH.js +20 -0
- package/dist/chunk-MJABESWH.js.map +1 -0
- package/dist/chunk-MSUZTHYT.js +9 -0
- package/dist/chunk-MSUZTHYT.js.map +1 -0
- package/dist/chunk-MYSBDK36.mjs +1 -0
- package/dist/chunk-MYSBDK36.mjs.map +1 -0
- package/dist/chunk-N52KMB25.mjs +109 -0
- package/dist/chunk-N52KMB25.mjs.map +1 -0
- package/dist/chunk-O3XKEEJV.mjs +249 -0
- package/dist/chunk-O3XKEEJV.mjs.map +1 -0
- package/dist/chunk-O4PW77JW.mjs +1 -0
- package/dist/chunk-O4PW77JW.mjs.map +1 -0
- package/dist/chunk-OQSLMZJN.js +281 -0
- package/dist/chunk-OQSLMZJN.js.map +1 -0
- package/dist/chunk-P5V6S2PA.mjs +69 -0
- package/dist/chunk-P5V6S2PA.mjs.map +1 -0
- package/dist/chunk-PHUTP7NB.js +25 -0
- package/dist/chunk-PHUTP7NB.js.map +1 -0
- package/dist/chunk-Q5T57UNN.js +1 -0
- package/dist/chunk-Q5T57UNN.js.map +1 -0
- package/dist/chunk-Q7FGULTV.js +8 -0
- package/dist/chunk-Q7FGULTV.js.map +1 -0
- package/dist/chunk-QF3LHIJ5.mjs +9 -0
- package/dist/chunk-QF3LHIJ5.mjs.map +1 -0
- package/dist/chunk-QJTAFTW7.js +30 -0
- package/dist/chunk-QJTAFTW7.js.map +1 -0
- package/dist/chunk-QWEXXUTO.mjs +10 -0
- package/dist/chunk-QWEXXUTO.mjs.map +1 -0
- package/dist/chunk-QYFDFOWT.js +41 -0
- package/dist/chunk-QYFDFOWT.js.map +1 -0
- package/dist/chunk-R4BBIGBN.js +18 -0
- package/dist/chunk-R4BBIGBN.js.map +1 -0
- package/dist/chunk-R7UAMO2U.js +21 -0
- package/dist/chunk-R7UAMO2U.js.map +1 -0
- package/dist/chunk-RRPU7M4Y.js +29 -0
- package/dist/chunk-RRPU7M4Y.js.map +1 -0
- package/dist/chunk-RS5HE55U.js +109 -0
- package/dist/chunk-RS5HE55U.js.map +1 -0
- package/dist/chunk-TUAHXE75.mjs +21 -0
- package/dist/chunk-TUAHXE75.mjs.map +1 -0
- package/dist/chunk-TURGGK5F.mjs +59 -0
- package/dist/chunk-TURGGK5F.mjs.map +1 -0
- package/dist/chunk-UGQQ5DJ4.mjs +50 -0
- package/dist/chunk-UGQQ5DJ4.mjs.map +1 -0
- package/dist/chunk-VGWELVCX.mjs +18 -0
- package/dist/chunk-VGWELVCX.mjs.map +1 -0
- package/dist/chunk-VMUXXXJC.js +103 -0
- package/dist/chunk-VMUXXXJC.js.map +1 -0
- package/dist/chunk-WDGBH5CP.js +249 -0
- package/dist/chunk-WDGBH5CP.js.map +1 -0
- package/dist/chunk-WJOAEPZ7.js +30 -0
- package/dist/chunk-WJOAEPZ7.js.map +1 -0
- package/dist/chunk-XC5E26VE.mjs +20 -0
- package/dist/chunk-XC5E26VE.mjs.map +1 -0
- package/dist/chunk-XDEHYKW2.js +1 -0
- package/dist/chunk-XDEHYKW2.js.map +1 -0
- package/dist/chunk-XEY3KVEH.js +21 -0
- package/dist/chunk-XEY3KVEH.js.map +1 -0
- package/dist/chunk-XKXHM3PC.mjs +9 -0
- package/dist/chunk-XKXHM3PC.mjs.map +1 -0
- package/dist/chunk-XRGYWWT7.js +151 -0
- package/dist/chunk-XRGYWWT7.js.map +1 -0
- package/dist/chunk-XWFKTDB3.js +50 -0
- package/dist/chunk-XWFKTDB3.js.map +1 -0
- package/dist/chunk-Y3F7VUZB.mjs +409 -0
- package/dist/chunk-Y3F7VUZB.mjs.map +1 -0
- package/dist/chunk-YF4PGFCO.js +1 -0
- package/dist/chunk-YF4PGFCO.js.map +1 -0
- package/dist/chunk-YLT6CNSL.mjs +64 -0
- package/dist/chunk-YLT6CNSL.mjs.map +1 -0
- package/dist/chunk-Z4J4GUGG.mjs +152 -0
- package/dist/chunk-Z4J4GUGG.mjs.map +1 -0
- package/dist/chunk-ZLFA4R5X.js +56 -0
- package/dist/chunk-ZLFA4R5X.js.map +1 -0
- package/dist/chunk-ZRVOIW3H.js +74 -0
- package/dist/chunk-ZRVOIW3H.js.map +1 -0
- package/dist/chunk-ZVXX2CTH.mjs +95 -0
- package/dist/chunk-ZVXX2CTH.mjs.map +1 -0
- package/dist/chunk-ZXCNX3ZB.mjs +70 -0
- package/dist/chunk-ZXCNX3ZB.mjs.map +1 -0
- package/dist/cronjob.js +20 -0
- package/dist/cronjob.js.map +1 -0
- package/dist/cronjob.mjs +20 -0
- package/dist/cronjob.mjs.map +1 -0
- package/dist/deep-clone.js +8 -0
- package/dist/deep-clone.js.map +1 -0
- package/dist/deep-clone.mjs +8 -0
- package/dist/deep-clone.mjs.map +1 -0
- package/dist/default-endowments.js +8 -0
- package/dist/default-endowments.js.map +1 -0
- package/dist/default-endowments.mjs +8 -0
- package/dist/default-endowments.mjs.map +1 -0
- package/dist/derivation-paths.js +13 -0
- package/dist/derivation-paths.js.map +1 -0
- package/dist/derivation-paths.mjs +13 -0
- package/dist/derivation-paths.mjs.map +1 -0
- package/dist/entropy.js +10 -0
- package/dist/entropy.js.map +1 -0
- package/dist/entropy.mjs +10 -0
- package/dist/entropy.mjs.map +1 -0
- package/dist/errors.js +20 -0
- package/dist/errors.js.map +1 -0
- package/dist/errors.mjs +20 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/eval-worker.js +43 -0
- package/dist/eval-worker.js.map +1 -0
- package/dist/eval-worker.mjs +43 -0
- package/dist/eval-worker.mjs.map +1 -0
- package/dist/eval.js +17 -0
- package/dist/eval.js.map +1 -0
- package/dist/eval.mjs +17 -0
- package/dist/eval.mjs.map +1 -0
- package/dist/fs.js +28 -0
- package/dist/fs.js.map +1 -0
- package/dist/fs.mjs +28 -0
- package/dist/fs.mjs.map +1 -0
- package/dist/handler-types.js +10 -0
- package/dist/handler-types.js.map +1 -0
- package/dist/handler-types.mjs +10 -0
- package/dist/handler-types.mjs.map +1 -0
- package/dist/handlers.js +35 -0
- package/dist/handlers.js.map +1 -0
- package/dist/handlers.mjs +35 -0
- package/dist/handlers.mjs.map +1 -0
- package/dist/icon.js +14 -0
- package/dist/icon.js.map +1 -0
- package/dist/icon.mjs +14 -0
- package/dist/icon.mjs.map +1 -0
- package/dist/iframe.js +8 -0
- package/dist/iframe.js.map +1 -0
- package/dist/iframe.mjs +8 -0
- package/dist/iframe.mjs.map +1 -0
- package/dist/index.executionenv.js +134 -0
- package/dist/index.executionenv.js.map +1 -0
- package/dist/index.executionenv.mjs +134 -0
- package/dist/index.executionenv.mjs.map +1 -0
- package/dist/index.js +378 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +378 -0
- package/dist/index.mjs.map +1 -0
- package/dist/json-rpc.js +18 -0
- package/dist/json-rpc.js.map +1 -0
- package/dist/json-rpc.mjs +18 -0
- package/dist/json-rpc.mjs.map +1 -0
- package/dist/json.js +8 -0
- package/dist/json.js.map +1 -0
- package/dist/json.mjs +8 -0
- package/dist/json.mjs.map +1 -0
- package/dist/localization.js +23 -0
- package/dist/localization.js.map +1 -0
- package/dist/localization.mjs +23 -0
- package/dist/localization.mjs.map +1 -0
- package/dist/logging.js +14 -0
- package/dist/logging.js.map +1 -0
- package/dist/logging.mjs +14 -0
- package/dist/logging.mjs.map +1 -0
- package/dist/manifest/index.js +59 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/manifest/index.mjs +59 -0
- package/dist/manifest/index.mjs.map +1 -0
- package/dist/manifest/manifest.js +42 -0
- package/dist/manifest/manifest.js.map +1 -0
- package/dist/manifest/manifest.mjs +42 -0
- package/dist/manifest/manifest.mjs.map +1 -0
- package/dist/manifest/node.js +85 -0
- package/dist/manifest/node.js.map +1 -0
- package/dist/manifest/node.mjs +85 -0
- package/dist/manifest/node.mjs.map +1 -0
- package/dist/manifest/validation.js +58 -0
- package/dist/manifest/validation.js.map +1 -0
- package/dist/manifest/validation.mjs +58 -0
- package/dist/manifest/validation.mjs.map +1 -0
- package/dist/mock.js +13 -0
- package/dist/mock.js.map +1 -0
- package/dist/mock.mjs +13 -0
- package/dist/mock.mjs.map +1 -0
- package/dist/namespace.js +44 -0
- package/dist/namespace.js.map +1 -0
- package/dist/namespace.mjs +44 -0
- package/dist/namespace.mjs.map +1 -0
- package/dist/node.js +448 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +448 -0
- package/dist/node.mjs.map +1 -0
- package/dist/npm.js +32 -0
- package/dist/npm.js.map +1 -0
- package/dist/npm.mjs +32 -0
- package/dist/npm.mjs.map +1 -0
- package/dist/path.js +8 -0
- package/dist/path.js.map +1 -0
- package/dist/path.mjs +8 -0
- package/dist/path.mjs.map +1 -0
- package/dist/post-process.js +10 -0
- package/dist/post-process.js.map +1 -0
- package/dist/post-process.mjs +10 -0
- package/dist/post-process.mjs.map +1 -0
- package/dist/snaps.js +48 -0
- package/dist/snaps.js.map +1 -0
- package/dist/snaps.mjs +48 -0
- package/dist/snaps.mjs.map +1 -0
- package/dist/strings.js +8 -0
- package/dist/strings.js.map +1 -0
- package/dist/strings.mjs +8 -0
- package/dist/strings.mjs.map +1 -0
- package/dist/structs.js +31 -0
- package/dist/structs.js.map +1 -0
- package/dist/structs.mjs +31 -0
- package/dist/structs.mjs.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/bytes.d.ts +1 -1
- package/dist/types/checksum.d.ts +1 -1
- package/dist/types/icon.d.ts +16 -1
- package/dist/types/index.d.ts +1 -6
- package/dist/types/json-rpc.d.ts +1 -1
- package/dist/types/localization.d.ts +1 -1
- package/dist/types/manifest/index.d.ts +0 -1
- package/dist/types/manifest/manifest.d.ts +1 -1
- package/dist/types/manifest/node.d.ts +2 -0
- package/dist/types/manifest/validation.d.ts +5 -5
- package/dist/types/node.d.ts +8 -0
- package/dist/types/post-process.d.ts +1 -1
- package/dist/types/structs.d.ts +0 -20
- package/dist/types/ui.d.ts +7 -0
- package/dist/types/virtual-file/index.d.ts +0 -1
- package/dist/types/virtual-file/node.d.ts +2 -0
- package/dist/types.js +28 -0
- package/dist/types.js.map +1 -0
- package/dist/types.mjs +28 -0
- package/dist/types.mjs.map +1 -0
- package/dist/ui.js +12 -0
- package/dist/ui.js.map +1 -0
- package/dist/ui.mjs +12 -0
- package/dist/ui.mjs.map +1 -0
- package/dist/validation.js +24 -0
- package/dist/validation.js.map +1 -0
- package/dist/validation.mjs +24 -0
- package/dist/validation.mjs.map +1 -0
- package/dist/versions.js +12 -0
- package/dist/versions.js.map +1 -0
- package/dist/versions.mjs +12 -0
- package/dist/versions.mjs.map +1 -0
- package/dist/virtual-file/VirtualFile.js +9 -0
- package/dist/virtual-file/VirtualFile.js.map +1 -0
- package/dist/virtual-file/VirtualFile.mjs +9 -0
- package/dist/virtual-file/VirtualFile.mjs.map +1 -0
- package/dist/virtual-file/index.js +10 -0
- package/dist/virtual-file/index.js.map +1 -0
- package/dist/virtual-file/index.mjs +10 -0
- package/dist/virtual-file/index.mjs.map +1 -0
- package/dist/virtual-file/node.js +17 -0
- package/dist/virtual-file/node.js.map +1 -0
- package/dist/virtual-file/node.mjs +17 -0
- package/dist/virtual-file/node.mjs.map +1 -0
- package/dist/virtual-file/toVirtualFile.js +12 -0
- package/dist/virtual-file/toVirtualFile.js.map +1 -0
- package/dist/virtual-file/toVirtualFile.mjs +12 -0
- package/dist/virtual-file/toVirtualFile.mjs.map +1 -0
- package/package.json +24 -40
- package/dist/cjs/array.js +0 -23
- package/dist/cjs/array.js.map +0 -1
- package/dist/cjs/auxiliary-files.js +0 -27
- package/dist/cjs/auxiliary-files.js.map +0 -1
- package/dist/cjs/base64.js +0 -44
- package/dist/cjs/base64.js.map +0 -1
- package/dist/cjs/bytes.js +0 -23
- package/dist/cjs/bytes.js.map +0 -1
- package/dist/cjs/caveats.js +0 -48
- package/dist/cjs/caveats.js.map +0 -1
- package/dist/cjs/checksum.js +0 -43
- package/dist/cjs/checksum.js.map +0 -1
- package/dist/cjs/cronjob.js +0 -77
- package/dist/cjs/cronjob.js.map +0 -1
- package/dist/cjs/deep-clone.js +0 -22
- package/dist/cjs/deep-clone.js.map +0 -1
- package/dist/cjs/default-endowments.js +0 -49
- package/dist/cjs/default-endowments.js.map +0 -1
- package/dist/cjs/derivation-paths.js +0 -300
- package/dist/cjs/derivation-paths.js.map +0 -1
- package/dist/cjs/entropy.js +0 -23
- package/dist/cjs/entropy.js.map +0 -1
- package/dist/cjs/errors.js +0 -221
- package/dist/cjs/errors.js.map +0 -1
- package/dist/cjs/eval-worker.js +0 -44
- package/dist/cjs/eval-worker.js.map +0 -1
- package/dist/cjs/eval.js +0 -77
- package/dist/cjs/eval.js.map +0 -1
- package/dist/cjs/fs.js +0 -126
- package/dist/cjs/fs.js.map +0 -1
- package/dist/cjs/handler-types.js +0 -34
- package/dist/cjs/handler-types.js.map +0 -1
- package/dist/cjs/handlers.js +0 -173
- package/dist/cjs/handlers.js.map +0 -1
- package/dist/cjs/icon.js +0 -37
- package/dist/cjs/icon.js.map +0 -1
- package/dist/cjs/iframe.js +0 -59
- package/dist/cjs/iframe.js.map +0 -1
- package/dist/cjs/index.browser.js +0 -49
- package/dist/cjs/index.browser.js.map +0 -1
- package/dist/cjs/index.executionenv.js +0 -27
- package/dist/cjs/index.executionenv.js.map +0 -1
- package/dist/cjs/index.js +0 -54
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/json-rpc.js +0 -81
- package/dist/cjs/json-rpc.js.map +0 -1
- package/dist/cjs/json.js +0 -16
- package/dist/cjs/json.js.map +0 -1
- package/dist/cjs/localization.js +0 -113
- package/dist/cjs/localization.js.map +0 -1
- package/dist/cjs/logging.js +0 -40
- package/dist/cjs/logging.js.map +0 -1
- package/dist/cjs/manifest/index.browser.js +0 -20
- package/dist/cjs/manifest/index.browser.js.map +0 -1
- package/dist/cjs/manifest/index.js +0 -21
- package/dist/cjs/manifest/index.js.map +0 -1
- package/dist/cjs/manifest/manifest.js +0 -275
- package/dist/cjs/manifest/manifest.js.map +0 -1
- package/dist/cjs/manifest/validation.js +0 -244
- package/dist/cjs/manifest/validation.js.map +0 -1
- package/dist/cjs/mock.js +0 -128
- package/dist/cjs/mock.js.map +0 -1
- package/dist/cjs/namespace.js +0 -136
- package/dist/cjs/namespace.js.map +0 -1
- package/dist/cjs/npm.js +0 -96
- package/dist/cjs/npm.js.map +0 -1
- package/dist/cjs/path.js +0 -21
- package/dist/cjs/path.js.map +0 -1
- package/dist/cjs/post-process.js +0 -328
- package/dist/cjs/post-process.js.map +0 -1
- package/dist/cjs/snaps.js +0 -232
- package/dist/cjs/snaps.js.map +0 -1
- package/dist/cjs/strings.js +0 -21
- package/dist/cjs/strings.js.map +0 -1
- package/dist/cjs/structs.js +0 -210
- package/dist/cjs/structs.js.map +0 -1
- package/dist/cjs/types.js +0 -104
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/ui.js +0 -53
- package/dist/cjs/ui.js.map +0 -1
- package/dist/cjs/validation.js +0 -24
- package/dist/cjs/validation.js.map +0 -1
- package/dist/cjs/versions.js +0 -47
- package/dist/cjs/versions.js.map +0 -1
- package/dist/cjs/virtual-file/VirtualFile.js +0 -92
- package/dist/cjs/virtual-file/VirtualFile.js.map +0 -1
- package/dist/cjs/virtual-file/index.browser.js +0 -20
- package/dist/cjs/virtual-file/index.browser.js.map +0 -1
- package/dist/cjs/virtual-file/index.js +0 -21
- package/dist/cjs/virtual-file/index.js.map +0 -1
- package/dist/cjs/virtual-file/toVirtualFile.js +0 -33
- package/dist/cjs/virtual-file/toVirtualFile.js.map +0 -1
- package/dist/esm/array.js +0 -13
- package/dist/esm/array.js.map +0 -1
- package/dist/esm/auxiliary-files.js +0 -23
- package/dist/esm/auxiliary-files.js.map +0 -1
- package/dist/esm/base64.js +0 -36
- package/dist/esm/base64.js.map +0 -1
- package/dist/esm/bytes.js +0 -18
- package/dist/esm/bytes.js.map +0 -1
- package/dist/esm/caveats.js +0 -38
- package/dist/esm/caveats.js.map +0 -1
- package/dist/esm/checksum.js +0 -41
- package/dist/esm/checksum.js.map +0 -1
- package/dist/esm/cronjob.js +0 -59
- package/dist/esm/cronjob.js.map +0 -1
- package/dist/esm/deep-clone.js +0 -7
- package/dist/esm/deep-clone.js.map +0 -1
- package/dist/esm/default-endowments.js +0 -39
- package/dist/esm/default-endowments.js.map +0 -1
- package/dist/esm/derivation-paths.js +0 -287
- package/dist/esm/derivation-paths.js.map +0 -1
- package/dist/esm/entropy.js +0 -6
- package/dist/esm/entropy.js.map +0 -1
- package/dist/esm/errors.js +0 -211
- package/dist/esm/errors.js.map +0 -1
- package/dist/esm/eval-worker.js +0 -40
- package/dist/esm/eval-worker.js.map +0 -1
- package/dist/esm/eval.js +0 -65
- package/dist/esm/eval.js.map +0 -1
- package/dist/esm/fs.js +0 -136
- package/dist/esm/fs.js.map +0 -1
- package/dist/esm/handler-types.js +0 -16
- package/dist/esm/handler-types.js.map +0 -1
- package/dist/esm/handlers.js +0 -119
- package/dist/esm/handlers.js.map +0 -1
- package/dist/esm/icon.js +0 -11
- package/dist/esm/icon.js.map +0 -1
- package/dist/esm/iframe.js +0 -49
- package/dist/esm/iframe.js.map +0 -1
- package/dist/esm/index.browser.js +0 -32
- package/dist/esm/index.browser.js.map +0 -1
- package/dist/esm/index.executionenv.js +0 -10
- package/dist/esm/index.executionenv.js.map +0 -1
- package/dist/esm/index.js +0 -37
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/json-rpc.js +0 -79
- package/dist/esm/json-rpc.js.map +0 -1
- package/dist/esm/json.js +0 -17
- package/dist/esm/json.js.map +0 -1
- package/dist/esm/localization.js +0 -115
- package/dist/esm/localization.js.map +0 -1
- package/dist/esm/logging.js +0 -59
- package/dist/esm/logging.js.map +0 -1
- package/dist/esm/manifest/index.browser.js +0 -3
- package/dist/esm/manifest/index.browser.js.map +0 -1
- package/dist/esm/manifest/index.js +0 -4
- package/dist/esm/manifest/index.js.map +0 -1
- package/dist/esm/manifest/manifest.js +0 -299
- package/dist/esm/manifest/manifest.js.map +0 -1
- package/dist/esm/manifest/validation.js +0 -190
- package/dist/esm/manifest/validation.js.map +0 -1
- package/dist/esm/mock.js +0 -111
- package/dist/esm/mock.js.map +0 -1
- package/dist/esm/namespace.js +0 -113
- package/dist/esm/namespace.js.map +0 -1
- package/dist/esm/npm.js +0 -85
- package/dist/esm/npm.js.map +0 -1
- package/dist/esm/path.js +0 -17
- package/dist/esm/path.js.map +0 -1
- package/dist/esm/post-process.js +0 -333
- package/dist/esm/post-process.js.map +0 -1
- package/dist/esm/snaps.js +0 -217
- package/dist/esm/snaps.js.map +0 -1
- package/dist/esm/strings.js +0 -11
- package/dist/esm/strings.js.map +0 -1
- package/dist/esm/structs.js +0 -295
- package/dist/esm/structs.js.map +0 -1
- package/dist/esm/types.js +0 -78
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/ui.js +0 -50
- package/dist/esm/ui.js.map +0 -1
- package/dist/esm/validation.js +0 -19
- package/dist/esm/validation.js.map +0 -1
- package/dist/esm/versions.js +0 -41
- package/dist/esm/versions.js.map +0 -1
- package/dist/esm/virtual-file/VirtualFile.js +0 -82
- package/dist/esm/virtual-file/VirtualFile.js.map +0 -1
- package/dist/esm/virtual-file/index.browser.js +0 -3
- package/dist/esm/virtual-file/index.browser.js.map +0 -1
- package/dist/esm/virtual-file/index.js +0 -4
- package/dist/esm/virtual-file/index.js.map +0 -1
- package/dist/esm/virtual-file/toVirtualFile.js +0 -26
- package/dist/esm/virtual-file/toVirtualFile.js.map +0 -1
- package/dist/types/index.browser.d.ts +0 -30
- package/dist/types/manifest/index.browser.d.ts +0 -1
- package/dist/types/virtual-file/index.browser.d.ts +0 -1
package/dist/cjs/handlers.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
SNAP_EXPORTS: function() {
|
|
13
|
-
return SNAP_EXPORTS;
|
|
14
|
-
},
|
|
15
|
-
OnTransactionSeverityResponseStruct: function() {
|
|
16
|
-
return OnTransactionSeverityResponseStruct;
|
|
17
|
-
},
|
|
18
|
-
OnTransactionResponseWithIdStruct: function() {
|
|
19
|
-
return OnTransactionResponseWithIdStruct;
|
|
20
|
-
},
|
|
21
|
-
OnTransactionResponseWithContentStruct: function() {
|
|
22
|
-
return OnTransactionResponseWithContentStruct;
|
|
23
|
-
},
|
|
24
|
-
OnTransactionResponseStruct: function() {
|
|
25
|
-
return OnTransactionResponseStruct;
|
|
26
|
-
},
|
|
27
|
-
OnSignatureResponseStruct: function() {
|
|
28
|
-
return OnSignatureResponseStruct;
|
|
29
|
-
},
|
|
30
|
-
OnHomePageResponseWithContentStruct: function() {
|
|
31
|
-
return OnHomePageResponseWithContentStruct;
|
|
32
|
-
},
|
|
33
|
-
OnHomePageResponseWithIdStruct: function() {
|
|
34
|
-
return OnHomePageResponseWithIdStruct;
|
|
35
|
-
},
|
|
36
|
-
OnHomePageResponseStruct: function() {
|
|
37
|
-
return OnHomePageResponseStruct;
|
|
38
|
-
},
|
|
39
|
-
AddressResolutionStruct: function() {
|
|
40
|
-
return AddressResolutionStruct;
|
|
41
|
-
},
|
|
42
|
-
DomainResolutionStruct: function() {
|
|
43
|
-
return DomainResolutionStruct;
|
|
44
|
-
},
|
|
45
|
-
AddressResolutionResponseStruct: function() {
|
|
46
|
-
return AddressResolutionResponseStruct;
|
|
47
|
-
},
|
|
48
|
-
DomainResolutionResponseStruct: function() {
|
|
49
|
-
return DomainResolutionResponseStruct;
|
|
50
|
-
},
|
|
51
|
-
OnNameLookupResponseStruct: function() {
|
|
52
|
-
return OnNameLookupResponseStruct;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
const _snapssdk = require("@metamask/snaps-sdk");
|
|
56
|
-
const _superstruct = require("superstruct");
|
|
57
|
-
const _handlertypes = require("./handler-types");
|
|
58
|
-
const SNAP_EXPORTS = {
|
|
59
|
-
[_handlertypes.HandlerType.OnRpcRequest]: {
|
|
60
|
-
type: _handlertypes.HandlerType.OnRpcRequest,
|
|
61
|
-
required: true,
|
|
62
|
-
validator: (snapExport)=>{
|
|
63
|
-
return typeof snapExport === 'function';
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
[_handlertypes.HandlerType.OnTransaction]: {
|
|
67
|
-
type: _handlertypes.HandlerType.OnTransaction,
|
|
68
|
-
required: true,
|
|
69
|
-
validator: (snapExport)=>{
|
|
70
|
-
return typeof snapExport === 'function';
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
[_handlertypes.HandlerType.OnCronjob]: {
|
|
74
|
-
type: _handlertypes.HandlerType.OnCronjob,
|
|
75
|
-
required: true,
|
|
76
|
-
validator: (snapExport)=>{
|
|
77
|
-
return typeof snapExport === 'function';
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
[_handlertypes.HandlerType.OnNameLookup]: {
|
|
81
|
-
type: _handlertypes.HandlerType.OnNameLookup,
|
|
82
|
-
required: true,
|
|
83
|
-
validator: (snapExport)=>{
|
|
84
|
-
return typeof snapExport === 'function';
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
[_handlertypes.HandlerType.OnInstall]: {
|
|
88
|
-
type: _handlertypes.HandlerType.OnInstall,
|
|
89
|
-
required: false,
|
|
90
|
-
validator: (snapExport)=>{
|
|
91
|
-
return typeof snapExport === 'function';
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
[_handlertypes.HandlerType.OnUpdate]: {
|
|
95
|
-
type: _handlertypes.HandlerType.OnUpdate,
|
|
96
|
-
required: false,
|
|
97
|
-
validator: (snapExport)=>{
|
|
98
|
-
return typeof snapExport === 'function';
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
[_handlertypes.HandlerType.OnKeyringRequest]: {
|
|
102
|
-
type: _handlertypes.HandlerType.OnKeyringRequest,
|
|
103
|
-
required: true,
|
|
104
|
-
validator: (snapExport)=>{
|
|
105
|
-
return typeof snapExport === 'function';
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
[_handlertypes.HandlerType.OnHomePage]: {
|
|
109
|
-
type: _handlertypes.HandlerType.OnHomePage,
|
|
110
|
-
required: true,
|
|
111
|
-
validator: (snapExport)=>{
|
|
112
|
-
return typeof snapExport === 'function';
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
[_handlertypes.HandlerType.OnSignature]: {
|
|
116
|
-
type: _handlertypes.HandlerType.OnSignature,
|
|
117
|
-
required: true,
|
|
118
|
-
validator: (snapExport)=>{
|
|
119
|
-
return typeof snapExport === 'function';
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
[_handlertypes.HandlerType.OnUserInput]: {
|
|
123
|
-
type: _handlertypes.HandlerType.OnUserInput,
|
|
124
|
-
required: true,
|
|
125
|
-
validator: (snapExport)=>{
|
|
126
|
-
return typeof snapExport === 'function';
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
const OnTransactionSeverityResponseStruct = (0, _superstruct.object)({
|
|
131
|
-
severity: (0, _superstruct.optional)((0, _superstruct.literal)(_snapssdk.SeverityLevel.Critical))
|
|
132
|
-
});
|
|
133
|
-
const OnTransactionResponseWithIdStruct = (0, _superstruct.assign)(OnTransactionSeverityResponseStruct, (0, _superstruct.object)({
|
|
134
|
-
id: (0, _superstruct.string)()
|
|
135
|
-
}));
|
|
136
|
-
const OnTransactionResponseWithContentStruct = (0, _superstruct.assign)(OnTransactionSeverityResponseStruct, (0, _superstruct.object)({
|
|
137
|
-
content: _snapssdk.ComponentStruct
|
|
138
|
-
}));
|
|
139
|
-
const OnTransactionResponseStruct = (0, _superstruct.nullable)((0, _superstruct.union)([
|
|
140
|
-
OnTransactionResponseWithContentStruct,
|
|
141
|
-
OnTransactionResponseWithIdStruct
|
|
142
|
-
]));
|
|
143
|
-
const OnSignatureResponseStruct = OnTransactionResponseStruct;
|
|
144
|
-
const OnHomePageResponseWithContentStruct = (0, _superstruct.object)({
|
|
145
|
-
content: _snapssdk.ComponentStruct
|
|
146
|
-
});
|
|
147
|
-
const OnHomePageResponseWithIdStruct = (0, _superstruct.object)({
|
|
148
|
-
id: (0, _superstruct.string)()
|
|
149
|
-
});
|
|
150
|
-
const OnHomePageResponseStruct = (0, _superstruct.union)([
|
|
151
|
-
OnHomePageResponseWithContentStruct,
|
|
152
|
-
OnHomePageResponseWithIdStruct
|
|
153
|
-
]);
|
|
154
|
-
const AddressResolutionStruct = (0, _superstruct.object)({
|
|
155
|
-
protocol: (0, _superstruct.string)(),
|
|
156
|
-
resolvedDomain: (0, _superstruct.string)()
|
|
157
|
-
});
|
|
158
|
-
const DomainResolutionStruct = (0, _superstruct.object)({
|
|
159
|
-
protocol: (0, _superstruct.string)(),
|
|
160
|
-
resolvedAddress: (0, _superstruct.string)()
|
|
161
|
-
});
|
|
162
|
-
const AddressResolutionResponseStruct = (0, _superstruct.object)({
|
|
163
|
-
resolvedDomains: (0, _superstruct.size)((0, _superstruct.array)(AddressResolutionStruct), 1, Infinity)
|
|
164
|
-
});
|
|
165
|
-
const DomainResolutionResponseStruct = (0, _superstruct.object)({
|
|
166
|
-
resolvedAddresses: (0, _superstruct.size)((0, _superstruct.array)(DomainResolutionStruct), 1, Infinity)
|
|
167
|
-
});
|
|
168
|
-
const OnNameLookupResponseStruct = (0, _superstruct.nullable)((0, _superstruct.union)([
|
|
169
|
-
AddressResolutionResponseStruct,
|
|
170
|
-
DomainResolutionResponseStruct
|
|
171
|
-
]));
|
|
172
|
-
|
|
173
|
-
//# sourceMappingURL=handlers.js.map
|
package/dist/cjs/handlers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/handlers.ts"],"sourcesContent":["import type {\n OnCronjobHandler,\n OnHomePageHandler,\n OnInstallHandler,\n OnKeyringRequestHandler,\n OnNameLookupHandler,\n OnRpcRequestHandler,\n OnSignatureHandler,\n OnTransactionHandler,\n OnUpdateHandler,\n OnUserInputHandler,\n} from '@metamask/snaps-sdk';\nimport { SeverityLevel, ComponentStruct } from '@metamask/snaps-sdk';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n string,\n array,\n size,\n union,\n} from 'superstruct';\n\nimport type { SnapHandler } from './handler-types';\nimport { HandlerType } from './handler-types';\n\nexport type SnapRpcHookArgs = {\n origin: string;\n handler: HandlerType;\n request: Record<string, unknown>;\n};\n\nexport const SNAP_EXPORTS = {\n [HandlerType.OnRpcRequest]: {\n type: HandlerType.OnRpcRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnRpcRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnTransaction]: {\n type: HandlerType.OnTransaction,\n required: true,\n validator: (snapExport: unknown): snapExport is OnTransactionHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnCronjob]: {\n type: HandlerType.OnCronjob,\n required: true,\n validator: (snapExport: unknown): snapExport is OnCronjobHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnNameLookup]: {\n type: HandlerType.OnNameLookup,\n required: true,\n validator: (snapExport: unknown): snapExport is OnNameLookupHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnInstall]: {\n type: HandlerType.OnInstall,\n required: false,\n validator: (snapExport: unknown): snapExport is OnInstallHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUpdate]: {\n type: HandlerType.OnUpdate,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUpdateHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnKeyringRequest]: {\n type: HandlerType.OnKeyringRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnKeyringRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnHomePage]: {\n type: HandlerType.OnHomePage,\n required: true,\n validator: (snapExport: unknown): snapExport is OnHomePageHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnSignature]: {\n type: HandlerType.OnSignature,\n required: true,\n validator: (snapExport: unknown): snapExport is OnSignatureHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUserInput]: {\n type: HandlerType.OnUserInput,\n required: true,\n validator: (snapExport: unknown): snapExport is OnUserInputHandler => {\n return typeof snapExport === 'function';\n },\n },\n} as const;\n\nexport const OnTransactionSeverityResponseStruct = object({\n severity: optional(literal(SeverityLevel.Critical)),\n});\n\nexport const OnTransactionResponseWithIdStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n id: string(),\n }),\n);\n\nexport const OnTransactionResponseWithContentStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n content: ComponentStruct,\n }),\n);\n\nexport const OnTransactionResponseStruct = nullable(\n union([\n OnTransactionResponseWithContentStruct,\n OnTransactionResponseWithIdStruct,\n ]),\n);\n\nexport const OnSignatureResponseStruct = OnTransactionResponseStruct;\n\nexport const OnHomePageResponseWithContentStruct = object({\n content: ComponentStruct,\n});\n\nexport const OnHomePageResponseWithIdStruct = object({\n id: string(),\n});\n\nexport const OnHomePageResponseStruct = union([\n OnHomePageResponseWithContentStruct,\n OnHomePageResponseWithIdStruct,\n]);\n\nexport const AddressResolutionStruct = object({\n protocol: string(),\n resolvedDomain: string(),\n});\n\nexport const DomainResolutionStruct = object({\n protocol: string(),\n resolvedAddress: string(),\n});\n\nexport const AddressResolutionResponseStruct = object({\n resolvedDomains: size(array(AddressResolutionStruct), 1, Infinity),\n});\n\nexport const DomainResolutionResponseStruct = object({\n resolvedAddresses: size(array(DomainResolutionStruct), 1, Infinity),\n});\n\nexport const OnNameLookupResponseStruct = nullable(\n union([AddressResolutionResponseStruct, DomainResolutionResponseStruct]),\n);\n\n/**\n * Utility type for getting the handler function type from a handler type.\n */\nexport type HandlerFunction<Type extends SnapHandler> =\n Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler\n ? Handler\n : never;\n\n/**\n * All the function-based handlers that a snap can implement.\n */\nexport type SnapFunctionExports = {\n [Key in keyof typeof SNAP_EXPORTS]?: HandlerFunction<\n (typeof SNAP_EXPORTS)[Key]\n >;\n};\n\n/**\n * All handlers that a snap can implement.\n */\nexport type SnapExports = SnapFunctionExports;\n"],"names":["SNAP_EXPORTS","OnTransactionSeverityResponseStruct","OnTransactionResponseWithIdStruct","OnTransactionResponseWithContentStruct","OnTransactionResponseStruct","OnSignatureResponseStruct","OnHomePageResponseWithContentStruct","OnHomePageResponseWithIdStruct","OnHomePageResponseStruct","AddressResolutionStruct","DomainResolutionStruct","AddressResolutionResponseStruct","DomainResolutionResponseStruct","OnNameLookupResponseStruct","HandlerType","OnRpcRequest","type","required","validator","snapExport","OnTransaction","OnCronjob","OnNameLookup","OnInstall","OnUpdate","OnKeyringRequest","OnHomePage","OnSignature","OnUserInput","object","severity","optional","literal","SeverityLevel","Critical","assign","id","string","content","ComponentStruct","nullable","union","protocol","resolvedDomain","resolvedAddress","resolvedDomains","size","array","Infinity","resolvedAddresses"],"mappings":";;;;;;;;;;;IAkCaA,YAAY;eAAZA;;IAyEAC,mCAAmC;eAAnCA;;IAIAC,iCAAiC;eAAjCA;;IAOAC,sCAAsC;eAAtCA;;IAOAC,2BAA2B;eAA3BA;;IAOAC,yBAAyB;eAAzBA;;IAEAC,mCAAmC;eAAnCA;;IAIAC,8BAA8B;eAA9BA;;IAIAC,wBAAwB;eAAxBA;;IAKAC,uBAAuB;eAAvBA;;IAKAC,sBAAsB;eAAtBA;;IAKAC,+BAA+B;eAA/BA;;IAIAC,8BAA8B;eAA9BA;;IAIAC,0BAA0B;eAA1BA;;;0BAzJkC;6BAWxC;8BAGqB;AAQrB,MAAMb,eAAe;IAC1B,CAACc,yBAAW,CAACC,YAAY,CAAC,EAAE;QAC1BC,MAAMF,yBAAW,CAACC,YAAY;QAC9BE,UAAU;QACVC,WAAW,CAACC;YACV,OAAO,OAAOA,eAAe;QAC/B;IACF;IACA,CAACL,yBAAW,CAACM,aAAa,CAAC,EAAE;QAC3BJ,MAAMF,yBAAW,CAACM,aAAa;QAC/BH,UAAU;QACVC,WAAW,CAACC;YACV,OAAO,OAAOA,eAAe;QAC/B;IACF;IACA,CAACL,yBAAW,CAACO,SAAS,CAAC,EAAE;QACvBL,MAAMF,yBAAW,CAACO,SAAS;QAC3BJ,UAAU;QACVC,WAAW,CAACC;YACV,OAAO,OAAOA,eAAe;QAC/B;IACF;IACA,CAACL,yBAAW,CAACQ,YAAY,CAAC,EAAE;QAC1BN,MAAMF,yBAAW,CAACQ,YAAY;QAC9BL,UAAU;QACVC,WAAW,CAACC;YACV,OAAO,OAAOA,eAAe;QAC/B;IACF;IACA,CAACL,yBAAW,CAACS,SAAS,CAAC,EAAE;QACvBP,MAAMF,yBAAW,CAACS,SAAS;QAC3BN,UAAU;QACVC,WAAW,CAACC;YACV,OAAO,OAAOA,eAAe;QAC/B;IACF;IACA,CAACL,yBAAW,CAACU,QAAQ,CAAC,EAAE;QACtBR,MAAMF,yBAAW,CAACU,QAAQ;QAC1BP,UAAU;QACVC,WAAW,CAACC;YACV,OAAO,OAAOA,eAAe;QAC/B;IACF;IACA,CAACL,yBAAW,CAACW,gBAAgB,CAAC,EAAE;QAC9BT,MAAMF,yBAAW,CAACW,gBAAgB;QAClCR,UAAU;QACVC,WAAW,CAACC;YACV,OAAO,OAAOA,eAAe;QAC/B;IACF;IACA,CAACL,yBAAW,CAACY,UAAU,CAAC,EAAE;QACxBV,MAAMF,yBAAW,CAACY,UAAU;QAC5BT,UAAU;QACVC,WAAW,CAACC;YACV,OAAO,OAAOA,eAAe;QAC/B;IACF;IACA,CAACL,yBAAW,CAACa,WAAW,CAAC,EAAE;QACzBX,MAAMF,yBAAW,CAACa,WAAW;QAC7BV,UAAU;QACVC,WAAW,CAACC;YACV,OAAO,OAAOA,eAAe;QAC/B;IACF;IACA,CAACL,yBAAW,CAACc,WAAW,CAAC,EAAE;QACzBZ,MAAMF,yBAAW,CAACc,WAAW;QAC7BX,UAAU;QACVC,WAAW,CAACC;YACV,OAAO,OAAOA,eAAe;QAC/B;IACF;AACF;AAEO,MAAMlB,sCAAsC4B,IAAAA,mBAAM,EAAC;IACxDC,UAAUC,IAAAA,qBAAQ,EAACC,IAAAA,oBAAO,EAACC,uBAAa,CAACC,QAAQ;AACnD;AAEO,MAAMhC,oCAAoCiC,IAAAA,mBAAM,EACrDlC,qCACA4B,IAAAA,mBAAM,EAAC;IACLO,IAAIC,IAAAA,mBAAM;AACZ;AAGK,MAAMlC,yCAAyCgC,IAAAA,mBAAM,EAC1DlC,qCACA4B,IAAAA,mBAAM,EAAC;IACLS,SAASC,yBAAe;AAC1B;AAGK,MAAMnC,8BAA8BoC,IAAAA,qBAAQ,EACjDC,IAAAA,kBAAK,EAAC;IACJtC;IACAD;CACD;AAGI,MAAMG,4BAA4BD;AAElC,MAAME,sCAAsCuB,IAAAA,mBAAM,EAAC;IACxDS,SAASC,yBAAe;AAC1B;AAEO,MAAMhC,iCAAiCsB,IAAAA,mBAAM,EAAC;IACnDO,IAAIC,IAAAA,mBAAM;AACZ;AAEO,MAAM7B,2BAA2BiC,IAAAA,kBAAK,EAAC;IAC5CnC;IACAC;CACD;AAEM,MAAME,0BAA0BoB,IAAAA,mBAAM,EAAC;IAC5Ca,UAAUL,IAAAA,mBAAM;IAChBM,gBAAgBN,IAAAA,mBAAM;AACxB;AAEO,MAAM3B,yBAAyBmB,IAAAA,mBAAM,EAAC;IAC3Ca,UAAUL,IAAAA,mBAAM;IAChBO,iBAAiBP,IAAAA,mBAAM;AACzB;AAEO,MAAM1B,kCAAkCkB,IAAAA,mBAAM,EAAC;IACpDgB,iBAAiBC,IAAAA,iBAAI,EAACC,IAAAA,kBAAK,EAACtC,0BAA0B,GAAGuC;AAC3D;AAEO,MAAMpC,iCAAiCiB,IAAAA,mBAAM,EAAC;IACnDoB,mBAAmBH,IAAAA,iBAAI,EAACC,IAAAA,kBAAK,EAACrC,yBAAyB,GAAGsC;AAC5D;AAEO,MAAMnC,6BAA6B2B,IAAAA,qBAAQ,EAChDC,IAAAA,kBAAK,EAAC;IAAC9B;IAAiCC;CAA+B"}
|
package/dist/cjs/icon.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
SVG_MAX_BYTE_SIZE: function() {
|
|
13
|
-
return SVG_MAX_BYTE_SIZE;
|
|
14
|
-
},
|
|
15
|
-
SVG_MAX_BYTE_SIZE_TEXT: function() {
|
|
16
|
-
return SVG_MAX_BYTE_SIZE_TEXT;
|
|
17
|
-
},
|
|
18
|
-
assertIsSnapIcon: function() {
|
|
19
|
-
return assertIsSnapIcon;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _utils = require("@metamask/utils");
|
|
23
|
-
const _issvg = /*#__PURE__*/ _interop_require_default(require("is-svg"));
|
|
24
|
-
function _interop_require_default(obj) {
|
|
25
|
-
return obj && obj.__esModule ? obj : {
|
|
26
|
-
default: obj
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
const SVG_MAX_BYTE_SIZE = 100000;
|
|
30
|
-
const SVG_MAX_BYTE_SIZE_TEXT = `${Math.floor(SVG_MAX_BYTE_SIZE / 1000)}kb`;
|
|
31
|
-
const assertIsSnapIcon = (icon)=>{
|
|
32
|
-
(0, _utils.assert)(icon.path.endsWith('.svg'), 'Expected snap icon to end in ".svg".');
|
|
33
|
-
(0, _utils.assert)(Buffer.byteLength(icon.value, 'utf8') <= SVG_MAX_BYTE_SIZE, `The specified SVG icon exceeds the maximum size of ${SVG_MAX_BYTE_SIZE_TEXT}.`);
|
|
34
|
-
(0, _utils.assert)((0, _issvg.default)(icon.toString()), 'Snap icon must be a valid SVG.');
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=icon.js.map
|
package/dist/cjs/icon.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/icon.ts"],"sourcesContent":["import { assert } from '@metamask/utils';\nimport isSvg from 'is-svg';\n\nimport type { VirtualFile } from './virtual-file';\n\nexport const SVG_MAX_BYTE_SIZE = 100_000;\nexport const SVG_MAX_BYTE_SIZE_TEXT = `${Math.floor(\n SVG_MAX_BYTE_SIZE / 1000,\n)}kb`;\n\nexport const assertIsSnapIcon = (icon: VirtualFile) => {\n assert(icon.path.endsWith('.svg'), 'Expected snap icon to end in \".svg\".');\n\n assert(\n Buffer.byteLength(icon.value, 'utf8') <= SVG_MAX_BYTE_SIZE,\n `The specified SVG icon exceeds the maximum size of ${SVG_MAX_BYTE_SIZE_TEXT}.`,\n );\n\n assert(isSvg(icon.toString()), 'Snap icon must be a valid SVG.');\n};\n"],"names":["SVG_MAX_BYTE_SIZE","SVG_MAX_BYTE_SIZE_TEXT","assertIsSnapIcon","Math","floor","icon","assert","path","endsWith","Buffer","byteLength","value","isSvg","toString"],"mappings":";;;;;;;;;;;IAKaA,iBAAiB;eAAjBA;;IACAC,sBAAsB;eAAtBA;;IAIAC,gBAAgB;eAAhBA;;;uBAVU;8DACL;;;;;;AAIX,MAAMF,oBAAoB;AAC1B,MAAMC,yBAAyB,CAAC,EAAEE,KAAKC,KAAK,CACjDJ,oBAAoB,MACpB,EAAE,CAAC;AAEE,MAAME,mBAAmB,CAACG;IAC/BC,IAAAA,aAAM,EAACD,KAAKE,IAAI,CAACC,QAAQ,CAAC,SAAS;IAEnCF,IAAAA,aAAM,EACJG,OAAOC,UAAU,CAACL,KAAKM,KAAK,EAAE,WAAWX,mBACzC,CAAC,mDAAmD,EAAEC,uBAAuB,CAAC,CAAC;IAGjFK,IAAAA,aAAM,EAACM,IAAAA,cAAK,EAACP,KAAKQ,QAAQ,KAAK;AACjC"}
|
package/dist/cjs/iframe.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates the iframe to be used as the execution environment. This may run
|
|
3
|
-
* forever if the iframe never loads, but the promise should be wrapped in
|
|
4
|
-
* an initialization timeout in the SnapController.
|
|
5
|
-
*
|
|
6
|
-
* @param uri - The iframe URI.
|
|
7
|
-
* @param id - The ID to assign to the iframe.
|
|
8
|
-
* @param sandbox - Whether to enable the sandbox attribute.
|
|
9
|
-
* @returns A promise that resolves to the contentWindow of the iframe.
|
|
10
|
-
*/ "use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", {
|
|
12
|
-
value: true
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "createWindow", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function() {
|
|
17
|
-
return createWindow;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
async function createWindow(uri, id, sandbox = true) {
|
|
21
|
-
return await new Promise((resolve, reject)=>{
|
|
22
|
-
const iframe = document.createElement('iframe');
|
|
23
|
-
// The order of operations appears to matter for everything except this
|
|
24
|
-
// attribute. We may as well set it here.
|
|
25
|
-
iframe.setAttribute('id', id);
|
|
26
|
-
iframe.setAttribute('data-testid', 'snaps-iframe');
|
|
27
|
-
if (sandbox) {
|
|
28
|
-
// For the sandbox property to have any effect it needs to be set before the iframe is appended.
|
|
29
|
-
// We apply this property as a principle of least authority (POLA)
|
|
30
|
-
// measure.
|
|
31
|
-
// Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox
|
|
32
|
-
iframe.setAttribute('sandbox', 'allow-scripts');
|
|
33
|
-
}
|
|
34
|
-
// In the past, we've had problems that appear to be symptomatic of the
|
|
35
|
-
// iframe firing the `load` event before its scripts are actually loaded,
|
|
36
|
-
// which has prevented snaps from executing properly. Therefore, we set
|
|
37
|
-
// the `src` attribute and append the iframe to the DOM before attaching
|
|
38
|
-
// the `load` listener.
|
|
39
|
-
//
|
|
40
|
-
// `load` should only fire when "all dependent resources" have been
|
|
41
|
-
// loaded, which includes scripts.
|
|
42
|
-
//
|
|
43
|
-
// MDN article for `load` event: https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
|
|
44
|
-
// Re: `load` firing twice: https://stackoverflow.com/questions/10781880/dynamically-created-iframe-triggers-onload-event-twice/15880489#15880489
|
|
45
|
-
iframe.setAttribute('src', uri);
|
|
46
|
-
document.body.appendChild(iframe);
|
|
47
|
-
iframe.addEventListener('load', ()=>{
|
|
48
|
-
if (iframe.contentWindow) {
|
|
49
|
-
resolve(iframe.contentWindow);
|
|
50
|
-
} else {
|
|
51
|
-
// We don't know of a case when this would happen, but better to fail
|
|
52
|
-
// fast if it does.
|
|
53
|
-
reject(new Error(`iframe.contentWindow not present on load for job "${id}".`));
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=iframe.js.map
|
package/dist/cjs/iframe.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/iframe.ts"],"sourcesContent":["/**\n * Creates the iframe to be used as the execution environment. This may run\n * forever if the iframe never loads, but the promise should be wrapped in\n * an initialization timeout in the SnapController.\n *\n * @param uri - The iframe URI.\n * @param id - The ID to assign to the iframe.\n * @param sandbox - Whether to enable the sandbox attribute.\n * @returns A promise that resolves to the contentWindow of the iframe.\n */\nexport async function createWindow(\n uri: string,\n id: string,\n sandbox = true,\n): Promise<Window> {\n return await new Promise((resolve, reject) => {\n const iframe = document.createElement('iframe');\n // The order of operations appears to matter for everything except this\n // attribute. We may as well set it here.\n iframe.setAttribute('id', id);\n iframe.setAttribute('data-testid', 'snaps-iframe');\n\n if (sandbox) {\n // For the sandbox property to have any effect it needs to be set before the iframe is appended.\n // We apply this property as a principle of least authority (POLA)\n // measure.\n // Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox\n iframe.setAttribute('sandbox', 'allow-scripts');\n }\n\n // In the past, we've had problems that appear to be symptomatic of the\n // iframe firing the `load` event before its scripts are actually loaded,\n // which has prevented snaps from executing properly. Therefore, we set\n // the `src` attribute and append the iframe to the DOM before attaching\n // the `load` listener.\n //\n // `load` should only fire when \"all dependent resources\" have been\n // loaded, which includes scripts.\n //\n // MDN article for `load` event: https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event\n // Re: `load` firing twice: https://stackoverflow.com/questions/10781880/dynamically-created-iframe-triggers-onload-event-twice/15880489#15880489\n iframe.setAttribute('src', uri);\n document.body.appendChild(iframe);\n\n iframe.addEventListener('load', () => {\n if (iframe.contentWindow) {\n resolve(iframe.contentWindow);\n } else {\n // We don't know of a case when this would happen, but better to fail\n // fast if it does.\n reject(\n new Error(\n `iframe.contentWindow not present on load for job \"${id}\".`,\n ),\n );\n }\n });\n });\n}\n"],"names":["createWindow","uri","id","sandbox","Promise","resolve","reject","iframe","document","createElement","setAttribute","body","appendChild","addEventListener","contentWindow","Error"],"mappings":"AAAA;;;;;;;;;CASC;;;;+BACqBA;;;eAAAA;;;AAAf,eAAeA,aACpBC,GAAW,EACXC,EAAU,EACVC,UAAU,IAAI;IAEd,OAAO,MAAM,IAAIC,QAAQ,CAACC,SAASC;QACjC,MAAMC,SAASC,SAASC,aAAa,CAAC;QACtC,uEAAuE;QACvE,yCAAyC;QACzCF,OAAOG,YAAY,CAAC,MAAMR;QAC1BK,OAAOG,YAAY,CAAC,eAAe;QAEnC,IAAIP,SAAS;YACX,gGAAgG;YAChG,kEAAkE;YAClE,WAAW;YACX,qFAAqF;YACrFI,OAAOG,YAAY,CAAC,WAAW;QACjC;QAEA,uEAAuE;QACvE,yEAAyE;QACzE,uEAAuE;QACvE,wEAAwE;QACxE,uBAAuB;QACvB,EAAE;QACF,mEAAmE;QACnE,kCAAkC;QAClC,EAAE;QACF,mGAAmG;QACnG,iJAAiJ;QACjJH,OAAOG,YAAY,CAAC,OAAOT;QAC3BO,SAASG,IAAI,CAACC,WAAW,CAACL;QAE1BA,OAAOM,gBAAgB,CAAC,QAAQ;YAC9B,IAAIN,OAAOO,aAAa,EAAE;gBACxBT,QAAQE,OAAOO,aAAa;YAC9B,OAAO;gBACL,qEAAqE;gBACrE,mBAAmB;gBACnBR,OACE,IAAIS,MACF,CAAC,kDAAkD,EAAEb,GAAG,EAAE,CAAC;YAGjE;QACF;IACF;AACF"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./array"), exports);
|
|
6
|
-
_export_star(require("./auxiliary-files"), exports);
|
|
7
|
-
_export_star(require("./base64"), exports);
|
|
8
|
-
_export_star(require("./bytes"), exports);
|
|
9
|
-
_export_star(require("./caveats"), exports);
|
|
10
|
-
_export_star(require("./checksum"), exports);
|
|
11
|
-
_export_star(require("./cronjob"), exports);
|
|
12
|
-
_export_star(require("./deep-clone"), exports);
|
|
13
|
-
_export_star(require("./default-endowments"), exports);
|
|
14
|
-
_export_star(require("./derivation-paths"), exports);
|
|
15
|
-
_export_star(require("./entropy"), exports);
|
|
16
|
-
_export_star(require("./errors"), exports);
|
|
17
|
-
_export_star(require("./handlers"), exports);
|
|
18
|
-
_export_star(require("./handler-types"), exports);
|
|
19
|
-
_export_star(require("./iframe"), exports);
|
|
20
|
-
_export_star(require("./json"), exports);
|
|
21
|
-
_export_star(require("./json-rpc"), exports);
|
|
22
|
-
_export_star(require("./localization"), exports);
|
|
23
|
-
_export_star(require("./logging"), exports);
|
|
24
|
-
_export_star(require("./manifest/index.browser"), exports);
|
|
25
|
-
_export_star(require("./namespace"), exports);
|
|
26
|
-
_export_star(require("./path"), exports);
|
|
27
|
-
_export_star(require("./snaps"), exports);
|
|
28
|
-
_export_star(require("./strings"), exports);
|
|
29
|
-
_export_star(require("./structs"), exports);
|
|
30
|
-
_export_star(require("./types"), exports);
|
|
31
|
-
_export_star(require("./ui"), exports);
|
|
32
|
-
_export_star(require("./validation"), exports);
|
|
33
|
-
_export_star(require("./versions"), exports);
|
|
34
|
-
_export_star(require("./virtual-file/index.browser"), exports);
|
|
35
|
-
function _export_star(from, to) {
|
|
36
|
-
Object.keys(from).forEach(function(k) {
|
|
37
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
38
|
-
Object.defineProperty(to, k, {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function() {
|
|
41
|
-
return from[k];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return from;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
//# sourceMappingURL=index.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.browser.ts"],"sourcesContent":["export * from './array';\nexport * from './auxiliary-files';\nexport * from './base64';\nexport * from './bytes';\nexport * from './caveats';\nexport * from './checksum';\nexport * from './cronjob';\nexport * from './deep-clone';\nexport * from './default-endowments';\nexport * from './derivation-paths';\nexport * from './entropy';\nexport * from './errors';\nexport * from './handlers';\nexport * from './handler-types';\nexport * from './iframe';\nexport * from './json';\nexport * from './json-rpc';\nexport * from './localization';\nexport * from './logging';\nexport * from './manifest/index.browser';\nexport * from './namespace';\nexport * from './path';\nexport * from './snaps';\nexport * from './strings';\nexport * from './structs';\nexport * from './types';\nexport * from './ui';\nexport * from './validation';\nexport * from './versions';\nexport * from './virtual-file/index.browser';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Special entrypoint for execution environments for bundle sizing reasons
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
_export_star(require("./errors"), exports);
|
|
7
|
-
_export_star(require("./handlers"), exports);
|
|
8
|
-
_export_star(require("./handler-types"), exports);
|
|
9
|
-
_export_star(require("./iframe"), exports);
|
|
10
|
-
_export_star(require("./logging"), exports);
|
|
11
|
-
_export_star(require("./namespace"), exports);
|
|
12
|
-
_export_star(require("./types"), exports);
|
|
13
|
-
function _export_star(from, to) {
|
|
14
|
-
Object.keys(from).forEach(function(k) {
|
|
15
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
16
|
-
Object.defineProperty(to, k, {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function() {
|
|
19
|
-
return from[k];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return from;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=index.executionenv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.executionenv.ts"],"sourcesContent":["// Special entrypoint for execution environments for bundle sizing reasons\nexport * from './errors';\nexport * from './handlers';\nexport * from './handler-types';\nexport * from './iframe';\nexport * from './logging';\nexport * from './namespace';\nexport * from './types';\n"],"names":[],"mappings":"AAAA,0EAA0E;;;;;qBAC5D;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./array"), exports);
|
|
6
|
-
_export_star(require("./auxiliary-files"), exports);
|
|
7
|
-
_export_star(require("./base64"), exports);
|
|
8
|
-
_export_star(require("./bytes"), exports);
|
|
9
|
-
_export_star(require("./caveats"), exports);
|
|
10
|
-
_export_star(require("./cronjob"), exports);
|
|
11
|
-
_export_star(require("./checksum"), exports);
|
|
12
|
-
_export_star(require("./deep-clone"), exports);
|
|
13
|
-
_export_star(require("./default-endowments"), exports);
|
|
14
|
-
_export_star(require("./derivation-paths"), exports);
|
|
15
|
-
_export_star(require("./entropy"), exports);
|
|
16
|
-
_export_star(require("./eval"), exports);
|
|
17
|
-
_export_star(require("./errors"), exports);
|
|
18
|
-
_export_star(require("./fs"), exports);
|
|
19
|
-
_export_star(require("./handlers"), exports);
|
|
20
|
-
_export_star(require("./handler-types"), exports);
|
|
21
|
-
_export_star(require("./iframe"), exports);
|
|
22
|
-
_export_star(require("./json"), exports);
|
|
23
|
-
_export_star(require("./json-rpc"), exports);
|
|
24
|
-
_export_star(require("./localization"), exports);
|
|
25
|
-
_export_star(require("./logging"), exports);
|
|
26
|
-
_export_star(require("./manifest"), exports);
|
|
27
|
-
_export_star(require("./mock"), exports);
|
|
28
|
-
_export_star(require("./namespace"), exports);
|
|
29
|
-
_export_star(require("./npm"), exports);
|
|
30
|
-
_export_star(require("./path"), exports);
|
|
31
|
-
_export_star(require("./post-process"), exports);
|
|
32
|
-
_export_star(require("./snaps"), exports);
|
|
33
|
-
_export_star(require("./strings"), exports);
|
|
34
|
-
_export_star(require("./structs"), exports);
|
|
35
|
-
_export_star(require("./types"), exports);
|
|
36
|
-
_export_star(require("./ui"), exports);
|
|
37
|
-
_export_star(require("./validation"), exports);
|
|
38
|
-
_export_star(require("./versions"), exports);
|
|
39
|
-
_export_star(require("./virtual-file"), exports);
|
|
40
|
-
function _export_star(from, to) {
|
|
41
|
-
Object.keys(from).forEach(function(k) {
|
|
42
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
43
|
-
Object.defineProperty(to, k, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function() {
|
|
46
|
-
return from[k];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
return from;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './array';\nexport * from './auxiliary-files';\nexport * from './base64';\nexport * from './bytes';\nexport * from './caveats';\nexport * from './cronjob';\nexport * from './checksum';\nexport * from './deep-clone';\nexport * from './default-endowments';\nexport * from './derivation-paths';\nexport * from './entropy';\nexport * from './eval';\nexport * from './errors';\nexport * from './fs';\nexport * from './handlers';\nexport * from './handler-types';\nexport * from './iframe';\nexport * from './json';\nexport * from './json-rpc';\nexport * from './localization';\nexport * from './logging';\nexport * from './manifest';\nexport * from './mock';\nexport * from './namespace';\nexport * from './npm';\nexport * from './path';\nexport * from './post-process';\nexport * from './snaps';\nexport * from './strings';\nexport * from './structs';\nexport * from './types';\nexport * from './ui';\nexport * from './validation';\nexport * from './versions';\nexport * from './virtual-file';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
package/dist/cjs/json-rpc.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
RpcOriginsStruct: function() {
|
|
13
|
-
return RpcOriginsStruct;
|
|
14
|
-
},
|
|
15
|
-
assertIsRpcOrigins: function() {
|
|
16
|
-
return assertIsRpcOrigins;
|
|
17
|
-
},
|
|
18
|
-
KeyringOriginsStruct: function() {
|
|
19
|
-
return KeyringOriginsStruct;
|
|
20
|
-
},
|
|
21
|
-
assertIsKeyringOrigins: function() {
|
|
22
|
-
return assertIsKeyringOrigins;
|
|
23
|
-
},
|
|
24
|
-
isOriginAllowed: function() {
|
|
25
|
-
return isOriginAllowed;
|
|
26
|
-
},
|
|
27
|
-
assertIsJsonRpcSuccess: function() {
|
|
28
|
-
return assertIsJsonRpcSuccess;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const _permissioncontroller = require("@metamask/permission-controller");
|
|
32
|
-
const _utils = require("@metamask/utils");
|
|
33
|
-
const _superstruct = require("superstruct");
|
|
34
|
-
const RpcOriginsStruct = (0, _superstruct.refine)((0, _superstruct.object)({
|
|
35
|
-
dapps: (0, _superstruct.optional)((0, _superstruct.boolean)()),
|
|
36
|
-
snaps: (0, _superstruct.optional)((0, _superstruct.boolean)()),
|
|
37
|
-
allowedOrigins: (0, _superstruct.optional)((0, _superstruct.array)((0, _superstruct.string)()))
|
|
38
|
-
}), 'RPC origins', (value)=>{
|
|
39
|
-
const hasOrigins = Boolean(value.snaps === true || value.dapps === true || value.allowedOrigins && value.allowedOrigins.length > 0);
|
|
40
|
-
if (hasOrigins) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
return 'Must specify at least one JSON-RPC origin.';
|
|
44
|
-
});
|
|
45
|
-
function assertIsRpcOrigins(value, // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
46
|
-
ErrorWrapper) {
|
|
47
|
-
(0, _utils.assertStruct)(value, RpcOriginsStruct, 'Invalid JSON-RPC origins', ErrorWrapper);
|
|
48
|
-
}
|
|
49
|
-
const KeyringOriginsStruct = (0, _superstruct.object)({
|
|
50
|
-
allowedOrigins: (0, _superstruct.optional)((0, _superstruct.array)((0, _superstruct.string)()))
|
|
51
|
-
});
|
|
52
|
-
function assertIsKeyringOrigins(value, // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
53
|
-
ErrorWrapper) {
|
|
54
|
-
(0, _utils.assertStruct)(value, KeyringOriginsStruct, 'Invalid keyring origins', ErrorWrapper);
|
|
55
|
-
}
|
|
56
|
-
function isOriginAllowed(origins, subjectType, origin) {
|
|
57
|
-
// The MetaMask client is always allowed.
|
|
58
|
-
if (origin === 'metamask') {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
// If the origin is in the `allowedOrigins` list, it is allowed.
|
|
62
|
-
if (origins.allowedOrigins?.includes(origin)) {
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
// If the origin is a website and `dapps` is true, it is allowed.
|
|
66
|
-
if (subjectType === _permissioncontroller.SubjectType.Website && origins.dapps) {
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
// If the origin is a snap and `snaps` is true, it is allowed.
|
|
70
|
-
return Boolean(subjectType === _permissioncontroller.SubjectType.Snap && origins.snaps);
|
|
71
|
-
}
|
|
72
|
-
function assertIsJsonRpcSuccess(value) {
|
|
73
|
-
if (!(0, _utils.isJsonRpcSuccess)(value)) {
|
|
74
|
-
if ((0, _utils.isJsonRpcFailure)(value)) {
|
|
75
|
-
throw new Error(`JSON-RPC request failed: ${value.error.message}`);
|
|
76
|
-
}
|
|
77
|
-
throw new Error('Invalid JSON-RPC response.');
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
//# sourceMappingURL=json-rpc.js.map
|
package/dist/cjs/json-rpc.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/json-rpc.ts"],"sourcesContent":["import { SubjectType } from '@metamask/permission-controller';\nimport type {\n AssertionErrorConstructor,\n Json,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n isJsonRpcFailure,\n isJsonRpcSuccess,\n} from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { array, boolean, object, optional, refine, string } from 'superstruct';\n\nexport const RpcOriginsStruct = refine(\n object({\n dapps: optional(boolean()),\n snaps: optional(boolean()),\n allowedOrigins: optional(array(string())),\n }),\n 'RPC origins',\n (value) => {\n const hasOrigins = Boolean(\n value.snaps === true ||\n value.dapps === true ||\n (value.allowedOrigins && value.allowedOrigins.length > 0),\n );\n\n if (hasOrigins) {\n return true;\n }\n\n return 'Must specify at least one JSON-RPC origin.';\n },\n);\n\nexport type RpcOrigins = Infer<typeof RpcOriginsStruct>;\n\n/**\n * Asserts that the given value is a valid {@link RpcOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link RpcOrigins} object.\n */\nexport function assertIsRpcOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is RpcOrigins {\n assertStruct(\n value,\n RpcOriginsStruct,\n 'Invalid JSON-RPC origins',\n ErrorWrapper,\n );\n}\n\nexport const KeyringOriginsStruct = object({\n allowedOrigins: optional(array(string())),\n});\n\nexport type KeyringOrigins = Infer<typeof KeyringOriginsStruct>;\n\n/**\n * Assert that the given value is a valid {@link KeyringOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link KeyringOrigins} object.\n */\nexport function assertIsKeyringOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is KeyringOrigins {\n assertStruct(\n value,\n KeyringOriginsStruct,\n 'Invalid keyring origins',\n ErrorWrapper,\n );\n}\n\n/**\n * Check if the given origin is allowed by the given JSON-RPC origins object.\n *\n * @param origins - The JSON-RPC origins object.\n * @param subjectType - The type of the origin.\n * @param origin - The origin to check.\n * @returns Whether the origin is allowed.\n */\nexport function isOriginAllowed(\n origins: RpcOrigins,\n subjectType: SubjectType,\n origin: string,\n) {\n // The MetaMask client is always allowed.\n if (origin === 'metamask') {\n return true;\n }\n\n // If the origin is in the `allowedOrigins` list, it is allowed.\n if (origins.allowedOrigins?.includes(origin)) {\n return true;\n }\n\n // If the origin is a website and `dapps` is true, it is allowed.\n if (subjectType === SubjectType.Website && origins.dapps) {\n return true;\n }\n\n // If the origin is a snap and `snaps` is true, it is allowed.\n return Boolean(subjectType === SubjectType.Snap && origins.snaps);\n}\n\n/**\n * Assert that the given value is a successful JSON-RPC response. If the value\n * is not a success response, an error is thrown. If the value is an JSON-RPC\n * error, the error message is included in the thrown error.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSON-RPC success response.\n */\nexport function assertIsJsonRpcSuccess(\n value: unknown,\n): asserts value is JsonRpcSuccess<Json> {\n if (!isJsonRpcSuccess(value)) {\n if (isJsonRpcFailure(value)) {\n throw new Error(`JSON-RPC request failed: ${value.error.message}`);\n }\n\n throw new Error('Invalid JSON-RPC response.');\n }\n}\n"],"names":["RpcOriginsStruct","assertIsRpcOrigins","KeyringOriginsStruct","assertIsKeyringOrigins","isOriginAllowed","assertIsJsonRpcSuccess","refine","object","dapps","optional","boolean","snaps","allowedOrigins","array","string","value","hasOrigins","Boolean","length","ErrorWrapper","assertStruct","origins","subjectType","origin","includes","SubjectType","Website","Snap","isJsonRpcSuccess","isJsonRpcFailure","Error","error","message"],"mappings":";;;;;;;;;;;IAcaA,gBAAgB;eAAhBA;;IAgCGC,kBAAkB;eAAlBA;;IAaHC,oBAAoB;eAApBA;;IAcGC,sBAAsB;eAAtBA;;IAqBAC,eAAe;eAAfA;;IAgCAC,sBAAsB;eAAtBA;;;sCA9HY;uBAUrB;6BAE0D;AAE1D,MAAML,mBAAmBM,IAAAA,mBAAM,EACpCC,IAAAA,mBAAM,EAAC;IACLC,OAAOC,IAAAA,qBAAQ,EAACC,IAAAA,oBAAO;IACvBC,OAAOF,IAAAA,qBAAQ,EAACC,IAAAA,oBAAO;IACvBE,gBAAgBH,IAAAA,qBAAQ,EAACI,IAAAA,kBAAK,EAACC,IAAAA,mBAAM;AACvC,IACA,eACA,CAACC;IACC,MAAMC,aAAaC,QACjBF,MAAMJ,KAAK,KAAK,QACdI,MAAMP,KAAK,KAAK,QACfO,MAAMH,cAAc,IAAIG,MAAMH,cAAc,CAACM,MAAM,GAAG;IAG3D,IAAIF,YAAY;QACd,OAAO;IACT;IAEA,OAAO;AACT;AAaK,SAASf,mBACdc,KAAc,EACd,gEAAgE;AAChEI,YAAwC;IAExCC,IAAAA,mBAAY,EACVL,OACAf,kBACA,4BACAmB;AAEJ;AAEO,MAAMjB,uBAAuBK,IAAAA,mBAAM,EAAC;IACzCK,gBAAgBH,IAAAA,qBAAQ,EAACI,IAAAA,kBAAK,EAACC,IAAAA,mBAAM;AACvC;AAYO,SAASX,uBACdY,KAAc,EACd,gEAAgE;AAChEI,YAAwC;IAExCC,IAAAA,mBAAY,EACVL,OACAb,sBACA,2BACAiB;AAEJ;AAUO,SAASf,gBACdiB,OAAmB,EACnBC,WAAwB,EACxBC,MAAc;IAEd,yCAAyC;IACzC,IAAIA,WAAW,YAAY;QACzB,OAAO;IACT;IAEA,gEAAgE;IAChE,IAAIF,QAAQT,cAAc,EAAEY,SAASD,SAAS;QAC5C,OAAO;IACT;IAEA,iEAAiE;IACjE,IAAID,gBAAgBG,iCAAW,CAACC,OAAO,IAAIL,QAAQb,KAAK,EAAE;QACxD,OAAO;IACT;IAEA,8DAA8D;IAC9D,OAAOS,QAAQK,gBAAgBG,iCAAW,CAACE,IAAI,IAAIN,QAAQV,KAAK;AAClE;AAUO,SAASN,uBACdU,KAAc;IAEd,IAAI,CAACa,IAAAA,uBAAgB,EAACb,QAAQ;QAC5B,IAAIc,IAAAA,uBAAgB,EAACd,QAAQ;YAC3B,MAAM,IAAIe,MAAM,CAAC,yBAAyB,EAAEf,MAAMgB,KAAK,CAACC,OAAO,CAAC,CAAC;QACnE;QAEA,MAAM,IAAIF,MAAM;IAClB;AACF"}
|
package/dist/cjs/json.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "parseJson", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return parseJson;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _utils = require("@metamask/utils");
|
|
12
|
-
function parseJson(json) {
|
|
13
|
-
return (0, _utils.getSafeJson)(JSON.parse(json));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=json.js.map
|
package/dist/cjs/json.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/json.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\nimport { getSafeJson } from '@metamask/utils';\n\n// TODO: Upstream this to @metamask/utils\n\n/**\n * Parse JSON safely.\n *\n * Does multiple kinds of validation and strips unwanted properties like\n * `__proto__` and `constructor`.\n *\n * @param json - A JSON string to be parsed.\n * @returns The parsed JSON object.\n * @template Type - The type of the JSON object. The type is not actually\n * checked, but it is used to infer the return type.\n */\nexport function parseJson<Type extends Json = Json>(json: string) {\n return getSafeJson<Type>(JSON.parse(json));\n}\n"],"names":["parseJson","json","getSafeJson","JSON","parse"],"mappings":";;;;+BAgBgBA;;;eAAAA;;;uBAfY;AAerB,SAASA,UAAoCC,IAAY;IAC9D,OAAOC,IAAAA,kBAAW,EAAOC,KAAKC,KAAK,CAACH;AACtC"}
|