@metamask/snaps-rpc-methods 5.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 +21 -3
- package/dist/chunk-2A5M65V3.js +21 -0
- package/dist/chunk-2A5M65V3.js.map +1 -0
- package/dist/chunk-2IL6T3EX.js +18 -0
- package/dist/chunk-2IL6T3EX.js.map +1 -0
- package/dist/chunk-2N2PZJDJ.mjs +105 -0
- package/dist/chunk-2N2PZJDJ.mjs.map +1 -0
- package/dist/chunk-2QEA2YZM.mjs +23 -0
- package/dist/chunk-2QEA2YZM.mjs.map +1 -0
- package/dist/chunk-2TYDIMR6.js +78 -0
- package/dist/chunk-2TYDIMR6.js.map +1 -0
- package/dist/chunk-2WCLK3LN.mjs +115 -0
- package/dist/chunk-2WCLK3LN.mjs.map +1 -0
- package/dist/chunk-3CSLIOIY.mjs +43 -0
- package/dist/chunk-3CSLIOIY.mjs.map +1 -0
- package/dist/chunk-3DWRS3YG.mjs +49 -0
- package/dist/chunk-3DWRS3YG.mjs.map +1 -0
- package/dist/chunk-3FKD2O7M.js +151 -0
- package/dist/chunk-3FKD2O7M.js.map +1 -0
- package/dist/chunk-4ALFLY5D.js +105 -0
- package/dist/chunk-4ALFLY5D.js.map +1 -0
- package/dist/chunk-4Z4X6EJP.mjs +67 -0
- package/dist/chunk-4Z4X6EJP.mjs.map +1 -0
- package/dist/chunk-5HIIIAIS.mjs +57 -0
- package/dist/chunk-5HIIIAIS.mjs.map +1 -0
- package/dist/chunk-632BZ6JY.js +83 -0
- package/dist/{cjs/utils.js.map → chunk-632BZ6JY.js.map} +1 -1
- package/dist/chunk-6DUTJBD2.mjs +82 -0
- package/dist/chunk-6DUTJBD2.mjs.map +1 -0
- package/dist/chunk-6PXDUIXN.js +67 -0
- package/dist/chunk-6PXDUIXN.js.map +1 -0
- package/dist/chunk-72V4CPGO.mjs +23 -0
- package/dist/chunk-72V4CPGO.mjs.map +1 -0
- package/dist/chunk-7O63CIBT.js +42 -0
- package/dist/chunk-7O63CIBT.js.map +1 -0
- package/dist/chunk-ABFJRV6Q.js +68 -0
- package/dist/chunk-ABFJRV6Q.js.map +1 -0
- package/dist/chunk-BZIPLSKM.mjs +39 -0
- package/dist/chunk-BZIPLSKM.mjs.map +1 -0
- package/dist/chunk-CIIMO4C2.js +45 -0
- package/dist/chunk-CIIMO4C2.js.map +1 -0
- package/dist/chunk-DBYI25UR.js +23 -0
- package/dist/chunk-DBYI25UR.js.map +1 -0
- package/dist/chunk-DDGDVWAW.js +45 -0
- package/dist/chunk-DDGDVWAW.js.map +1 -0
- package/dist/chunk-DR63Z4PV.mjs +83 -0
- package/dist/chunk-DR63Z4PV.mjs.map +1 -0
- package/dist/chunk-E2G25QVG.js +119 -0
- package/dist/chunk-E2G25QVG.js.map +1 -0
- package/dist/chunk-E4HGQWSS.js +43 -0
- package/dist/chunk-E4HGQWSS.js.map +1 -0
- package/dist/chunk-EAL6AH74.js +67 -0
- package/dist/chunk-EAL6AH74.js.map +1 -0
- package/dist/chunk-EB6OXVFN.mjs +52 -0
- package/dist/chunk-EB6OXVFN.mjs.map +1 -0
- package/dist/chunk-EKB7QNFO.mjs +54 -0
- package/dist/chunk-EKB7QNFO.mjs.map +1 -0
- package/dist/chunk-EPNGNDRH.mjs +80 -0
- package/dist/chunk-EPNGNDRH.mjs.map +1 -0
- package/dist/chunk-F5BEVZOB.js +47 -0
- package/dist/chunk-F5BEVZOB.js.map +1 -0
- package/dist/chunk-FMUQOZIO.js +57 -0
- package/dist/chunk-FMUQOZIO.js.map +1 -0
- package/dist/chunk-H45CGE4Z.js +23 -0
- package/dist/chunk-H45CGE4Z.js.map +1 -0
- package/dist/chunk-HIYXSQ6K.mjs +188 -0
- package/dist/chunk-HIYXSQ6K.mjs.map +1 -0
- package/dist/chunk-HLF4WCE4.mjs +20 -0
- package/dist/chunk-HLF4WCE4.mjs.map +1 -0
- package/dist/chunk-HODDBRLQ.js +75 -0
- package/dist/chunk-HODDBRLQ.js.map +1 -0
- package/dist/chunk-HOXOD5RL.mjs +68 -0
- package/dist/chunk-HOXOD5RL.mjs.map +1 -0
- package/dist/chunk-I5H5ZZRC.js +80 -0
- package/dist/chunk-I5H5ZZRC.js.map +1 -0
- package/dist/chunk-IDRDPYAN.js +70 -0
- package/dist/chunk-IDRDPYAN.js.map +1 -0
- package/dist/chunk-JEEKFTAL.mjs +59 -0
- package/dist/chunk-JEEKFTAL.mjs.map +1 -0
- package/dist/chunk-JPUJWFBS.js +115 -0
- package/dist/chunk-JPUJWFBS.js.map +1 -0
- package/dist/chunk-JURJUHQB.mjs +70 -0
- package/dist/chunk-JURJUHQB.mjs.map +1 -0
- package/dist/chunk-JV26U22G.js +52 -0
- package/dist/chunk-JV26U22G.js.map +1 -0
- package/dist/chunk-K73RKHXA.js +20 -0
- package/dist/chunk-K73RKHXA.js.map +1 -0
- package/dist/chunk-KDLWQGV3.js +74 -0
- package/dist/chunk-KDLWQGV3.js.map +1 -0
- package/dist/chunk-KE74K2JM.js +59 -0
- package/dist/chunk-KE74K2JM.js.map +1 -0
- package/dist/chunk-KVHYDTGR.js +1 -0
- package/dist/chunk-KVHYDTGR.js.map +1 -0
- package/dist/chunk-L7MGGL7Q.mjs +43 -0
- package/dist/chunk-L7MGGL7Q.mjs.map +1 -0
- package/dist/chunk-LITIVHN4.js +73 -0
- package/dist/chunk-LITIVHN4.js.map +1 -0
- package/dist/chunk-LU3J2EYE.js +51 -0
- package/dist/chunk-LU3J2EYE.js.map +1 -0
- package/dist/chunk-LX37AMSK.mjs +78 -0
- package/dist/chunk-LX37AMSK.mjs.map +1 -0
- package/dist/chunk-LYOKCYHO.mjs +1 -0
- package/dist/chunk-LYOKCYHO.mjs.map +1 -0
- package/dist/chunk-MDJZ4K3U.mjs +45 -0
- package/dist/chunk-MDJZ4K3U.mjs.map +1 -0
- package/dist/chunk-MVPKNRLA.mjs +21 -0
- package/dist/chunk-MVPKNRLA.mjs.map +1 -0
- package/dist/chunk-MYMH4S2N.mjs +23 -0
- package/dist/chunk-MYMH4S2N.mjs.map +1 -0
- package/dist/chunk-NE2GDZGZ.mjs +67 -0
- package/dist/chunk-NE2GDZGZ.mjs.map +1 -0
- package/dist/chunk-NTDD6M3B.mjs +32 -0
- package/dist/chunk-NTDD6M3B.mjs.map +1 -0
- package/dist/chunk-NUKEBOOL.js +78 -0
- package/dist/chunk-NUKEBOOL.js.map +1 -0
- package/dist/chunk-OMP4SFLK.js +1 -0
- package/dist/chunk-OMP4SFLK.js.map +1 -0
- package/dist/chunk-OU3QPU6E.mjs +45 -0
- package/dist/chunk-OU3QPU6E.mjs.map +1 -0
- package/dist/chunk-OUD66G6O.mjs +74 -0
- package/dist/chunk-OUD66G6O.mjs.map +1 -0
- package/dist/chunk-PEMZWIHQ.js +39 -0
- package/dist/chunk-PEMZWIHQ.js.map +1 -0
- package/dist/chunk-PSAM7MJM.mjs +78 -0
- package/dist/chunk-PSAM7MJM.mjs.map +1 -0
- package/dist/chunk-RC7LBS3H.js +35 -0
- package/dist/chunk-RC7LBS3H.js.map +1 -0
- package/dist/chunk-RHGOSBUT.js +21 -0
- package/dist/chunk-RHGOSBUT.js.map +1 -0
- package/dist/chunk-RKCEAMYH.mjs +18 -0
- package/dist/chunk-RKCEAMYH.mjs.map +1 -0
- package/dist/chunk-RWLBQVYX.mjs +73 -0
- package/dist/chunk-RWLBQVYX.mjs.map +1 -0
- package/dist/chunk-RZDRHJXI.js +23 -0
- package/dist/chunk-RZDRHJXI.js.map +1 -0
- package/dist/chunk-SCXW3FQO.js +49 -0
- package/dist/chunk-SCXW3FQO.js.map +1 -0
- package/dist/chunk-SMWKMPHG.mjs +35 -0
- package/dist/chunk-SMWKMPHG.mjs.map +1 -0
- package/dist/chunk-SXSNJEE7.js +18 -0
- package/dist/chunk-SXSNJEE7.js.map +1 -0
- package/dist/chunk-TNIGT6KN.js +32 -0
- package/dist/chunk-TNIGT6KN.js.map +1 -0
- package/dist/chunk-TRB2LS4N.js +54 -0
- package/dist/chunk-TRB2LS4N.js.map +1 -0
- package/dist/chunk-TZRCALSV.mjs +54 -0
- package/dist/chunk-TZRCALSV.mjs.map +1 -0
- package/dist/chunk-UJZ3HNXS.mjs +23 -0
- package/dist/chunk-UJZ3HNXS.mjs.map +1 -0
- package/dist/chunk-UXVJ7HYO.js +78 -0
- package/dist/{cjs/restricted/getBip32PublicKey.js.map → chunk-UXVJ7HYO.js.map} +1 -1
- package/dist/chunk-UYSXSKML.js +82 -0
- package/dist/chunk-UYSXSKML.js.map +1 -0
- package/dist/chunk-VFI5FR5U.mjs +119 -0
- package/dist/chunk-VFI5FR5U.mjs.map +1 -0
- package/dist/chunk-VRDGSBXX.mjs +78 -0
- package/dist/chunk-VRDGSBXX.mjs.map +1 -0
- package/dist/chunk-VSVVWO3W.mjs +42 -0
- package/dist/chunk-VSVVWO3W.mjs.map +1 -0
- package/dist/chunk-VZBSLVVA.js +23 -0
- package/dist/chunk-VZBSLVVA.js.map +1 -0
- package/dist/chunk-W2VJ5TWL.js +54 -0
- package/dist/chunk-W2VJ5TWL.js.map +1 -0
- package/dist/chunk-WHWFVRFH.js +69 -0
- package/dist/chunk-WHWFVRFH.js.map +1 -0
- package/dist/chunk-WI23VKOX.mjs +21 -0
- package/dist/chunk-WI23VKOX.mjs.map +1 -0
- package/dist/chunk-XAQ2P3BY.js +188 -0
- package/dist/chunk-XAQ2P3BY.js.map +1 -0
- package/dist/chunk-Y5ENHOIY.mjs +47 -0
- package/dist/chunk-Y5ENHOIY.mjs.map +1 -0
- package/dist/chunk-Y6EL5DBH.mjs +75 -0
- package/dist/chunk-Y6EL5DBH.mjs.map +1 -0
- package/dist/chunk-Y7DF3ZHO.mjs +1 -0
- package/dist/chunk-Y7DF3ZHO.mjs.map +1 -0
- package/dist/chunk-YJ3ZFIA7.mjs +51 -0
- package/dist/chunk-YJ3ZFIA7.mjs.map +1 -0
- package/dist/chunk-YK6IFDRN.mjs +151 -0
- package/dist/chunk-YK6IFDRN.mjs.map +1 -0
- package/dist/chunk-YN3OMGA5.mjs +69 -0
- package/dist/chunk-YN3OMGA5.mjs.map +1 -0
- package/dist/chunk-ZLLV3F4G.js +43 -0
- package/dist/chunk-ZLLV3F4G.js.map +1 -0
- package/dist/chunk-ZP3L7LAQ.mjs +18 -0
- package/dist/chunk-ZP3L7LAQ.mjs.map +1 -0
- package/dist/endowments/caveats/generic.js +7 -0
- package/dist/endowments/caveats/generic.js.map +1 -0
- package/dist/endowments/caveats/generic.mjs +7 -0
- package/dist/endowments/caveats/generic.mjs.map +1 -0
- package/dist/endowments/caveats/index.js +18 -0
- package/dist/endowments/caveats/index.js.map +1 -0
- package/dist/endowments/caveats/index.mjs +18 -0
- package/dist/endowments/caveats/index.mjs.map +1 -0
- package/dist/endowments/caveats/requestTime.js +13 -0
- package/dist/endowments/caveats/requestTime.js.map +1 -0
- package/dist/endowments/caveats/requestTime.mjs +13 -0
- package/dist/endowments/caveats/requestTime.mjs.map +1 -0
- package/dist/endowments/cronjob.js +16 -0
- package/dist/endowments/cronjob.js.map +1 -0
- package/dist/endowments/cronjob.mjs +16 -0
- package/dist/endowments/cronjob.mjs.map +1 -0
- package/dist/endowments/enum.js +7 -0
- package/dist/endowments/enum.js.map +1 -0
- package/dist/endowments/enum.mjs +7 -0
- package/dist/endowments/enum.mjs.map +1 -0
- package/dist/endowments/ethereum-provider.js +8 -0
- package/dist/endowments/ethereum-provider.js.map +1 -0
- package/dist/endowments/ethereum-provider.mjs +8 -0
- package/dist/endowments/ethereum-provider.mjs.map +1 -0
- package/dist/endowments/home-page.js +8 -0
- package/dist/endowments/home-page.js.map +1 -0
- package/dist/endowments/home-page.mjs +8 -0
- package/dist/endowments/home-page.mjs.map +1 -0
- package/dist/endowments/index.js +54 -0
- package/dist/endowments/index.js.map +1 -0
- package/dist/endowments/index.mjs +54 -0
- package/dist/endowments/index.mjs.map +1 -0
- package/dist/endowments/keyring.js +17 -0
- package/dist/endowments/keyring.js.map +1 -0
- package/dist/endowments/keyring.mjs +17 -0
- package/dist/endowments/keyring.mjs.map +1 -0
- package/dist/endowments/lifecycle-hooks.js +8 -0
- package/dist/endowments/lifecycle-hooks.js.map +1 -0
- package/dist/endowments/lifecycle-hooks.mjs +8 -0
- package/dist/endowments/lifecycle-hooks.mjs.map +1 -0
- package/dist/endowments/name-lookup.js +19 -0
- package/dist/endowments/name-lookup.js.map +1 -0
- package/dist/endowments/name-lookup.mjs +19 -0
- package/dist/endowments/name-lookup.mjs.map +1 -0
- package/dist/endowments/network-access.js +8 -0
- package/dist/endowments/network-access.js.map +1 -0
- package/dist/endowments/network-access.mjs +8 -0
- package/dist/endowments/network-access.mjs.map +1 -0
- package/dist/endowments/rpc.js +17 -0
- package/dist/endowments/rpc.js.map +1 -0
- package/dist/endowments/rpc.mjs +17 -0
- package/dist/endowments/rpc.mjs.map +1 -0
- package/dist/endowments/signature-insight.js +17 -0
- package/dist/endowments/signature-insight.js.map +1 -0
- package/dist/endowments/signature-insight.mjs +17 -0
- package/dist/endowments/signature-insight.mjs.map +1 -0
- package/dist/endowments/transaction-insight.js +17 -0
- package/dist/endowments/transaction-insight.js.map +1 -0
- package/dist/endowments/transaction-insight.mjs +17 -0
- package/dist/endowments/transaction-insight.mjs.map +1 -0
- package/dist/endowments/web-assembly.js +8 -0
- package/dist/endowments/web-assembly.js.map +1 -0
- package/dist/endowments/web-assembly.mjs +8 -0
- package/dist/endowments/web-assembly.mjs.map +1 -0
- package/dist/index.js +118 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +118 -0
- package/dist/index.mjs.map +1 -0
- package/dist/permissions.js +43 -0
- package/dist/permissions.js.map +1 -0
- package/dist/permissions.mjs +43 -0
- package/dist/permissions.mjs.map +1 -0
- package/dist/permitted/createInterface.js +7 -0
- package/dist/permitted/createInterface.js.map +1 -0
- package/dist/permitted/createInterface.mjs +7 -0
- package/dist/permitted/createInterface.mjs.map +1 -0
- package/dist/permitted/getAllSnaps.js +7 -0
- package/dist/permitted/getAllSnaps.js.map +1 -0
- package/dist/permitted/getAllSnaps.mjs +7 -0
- package/dist/permitted/getAllSnaps.mjs.map +1 -0
- package/dist/permitted/getClientStatus.js +7 -0
- package/dist/permitted/getClientStatus.js.map +1 -0
- package/dist/permitted/getClientStatus.mjs +7 -0
- package/dist/permitted/getClientStatus.mjs.map +1 -0
- package/dist/permitted/getFile.js +9 -0
- package/dist/permitted/getFile.js.map +1 -0
- package/dist/permitted/getFile.mjs +9 -0
- package/dist/permitted/getFile.mjs.map +1 -0
- package/dist/permitted/getInterfaceState.js +7 -0
- package/dist/permitted/getInterfaceState.js.map +1 -0
- package/dist/permitted/getInterfaceState.mjs +7 -0
- package/dist/permitted/getInterfaceState.mjs.map +1 -0
- package/dist/permitted/getSnaps.js +7 -0
- package/dist/permitted/getSnaps.js.map +1 -0
- package/dist/permitted/getSnaps.mjs +7 -0
- package/dist/permitted/getSnaps.mjs.map +1 -0
- package/dist/permitted/handlers.js +20 -0
- package/dist/permitted/handlers.js.map +1 -0
- package/dist/permitted/handlers.mjs +20 -0
- package/dist/permitted/handlers.mjs.map +1 -0
- package/dist/permitted/index.js +26 -0
- package/dist/permitted/index.js.map +1 -0
- package/dist/permitted/index.mjs +26 -0
- package/dist/permitted/index.mjs.map +1 -0
- package/dist/permitted/invokeKeyring.js +8 -0
- package/dist/permitted/invokeKeyring.js.map +1 -0
- package/dist/permitted/invokeKeyring.mjs +8 -0
- package/dist/permitted/invokeKeyring.mjs.map +1 -0
- package/dist/permitted/invokeSnapSugar.js +11 -0
- package/dist/permitted/invokeSnapSugar.js.map +1 -0
- package/dist/permitted/invokeSnapSugar.mjs +11 -0
- package/dist/permitted/invokeSnapSugar.mjs.map +1 -0
- package/dist/permitted/middleware.js +20 -0
- package/dist/permitted/middleware.js.map +1 -0
- package/dist/permitted/middleware.mjs +20 -0
- package/dist/permitted/middleware.mjs.map +1 -0
- package/dist/permitted/requestSnaps.js +12 -0
- package/dist/permitted/requestSnaps.js.map +1 -0
- package/dist/permitted/requestSnaps.mjs +12 -0
- package/dist/permitted/requestSnaps.mjs.map +1 -0
- package/dist/permitted/updateInterface.js +7 -0
- package/dist/permitted/updateInterface.js.map +1 -0
- package/dist/permitted/updateInterface.mjs +7 -0
- package/dist/permitted/updateInterface.mjs.map +1 -0
- package/dist/restricted/caveats/index.js +17 -0
- package/dist/restricted/caveats/index.js.map +1 -0
- package/dist/restricted/caveats/index.mjs +17 -0
- package/dist/restricted/caveats/index.mjs.map +1 -0
- package/dist/restricted/caveats/permittedCoinTypes.js +13 -0
- package/dist/restricted/caveats/permittedCoinTypes.js.map +1 -0
- package/dist/restricted/caveats/permittedCoinTypes.mjs +13 -0
- package/dist/restricted/caveats/permittedCoinTypes.mjs.map +1 -0
- package/dist/restricted/caveats/permittedDerivationPaths.js +13 -0
- package/dist/restricted/caveats/permittedDerivationPaths.js.map +1 -0
- package/dist/restricted/caveats/permittedDerivationPaths.mjs +13 -0
- package/dist/restricted/caveats/permittedDerivationPaths.mjs.map +1 -0
- package/dist/restricted/caveats/snapIds.js +11 -0
- package/dist/restricted/caveats/snapIds.js.map +1 -0
- package/dist/restricted/caveats/snapIds.mjs +11 -0
- package/dist/restricted/caveats/snapIds.mjs.map +1 -0
- package/dist/restricted/dialog.js +9 -0
- package/dist/restricted/dialog.js.map +1 -0
- package/dist/restricted/dialog.mjs +9 -0
- package/dist/restricted/dialog.mjs.map +1 -0
- package/dist/restricted/getBip32Entropy.js +10 -0
- package/dist/restricted/getBip32Entropy.js.map +1 -0
- package/dist/restricted/getBip32Entropy.mjs +10 -0
- package/dist/restricted/getBip32Entropy.mjs.map +1 -0
- package/dist/restricted/getBip32PublicKey.js +12 -0
- package/dist/restricted/getBip32PublicKey.js.map +1 -0
- package/dist/restricted/getBip32PublicKey.mjs +12 -0
- package/dist/restricted/getBip32PublicKey.mjs.map +1 -0
- package/dist/restricted/getBip44Entropy.js +9 -0
- package/dist/restricted/getBip44Entropy.js.map +1 -0
- package/dist/restricted/getBip44Entropy.mjs +9 -0
- package/dist/restricted/getBip44Entropy.mjs.map +1 -0
- package/dist/restricted/getEntropy.js +10 -0
- package/dist/restricted/getEntropy.js.map +1 -0
- package/dist/restricted/getEntropy.mjs +10 -0
- package/dist/restricted/getEntropy.mjs.map +1 -0
- package/dist/restricted/getLocale.js +11 -0
- package/dist/restricted/getLocale.js.map +1 -0
- package/dist/restricted/getLocale.mjs +11 -0
- package/dist/restricted/getLocale.mjs.map +1 -0
- package/dist/restricted/index.js +33 -0
- package/dist/restricted/index.js.map +1 -0
- package/dist/restricted/index.mjs +33 -0
- package/dist/restricted/index.mjs.map +1 -0
- package/dist/restricted/invokeSnap.js +13 -0
- package/dist/restricted/invokeSnap.js.map +1 -0
- package/dist/restricted/invokeSnap.mjs +13 -0
- package/dist/restricted/invokeSnap.mjs.map +1 -0
- package/dist/restricted/manageAccounts.js +13 -0
- package/dist/restricted/manageAccounts.js.map +1 -0
- package/dist/restricted/manageAccounts.mjs +13 -0
- package/dist/restricted/manageAccounts.mjs.map +1 -0
- package/dist/restricted/manageState.js +20 -0
- package/dist/restricted/manageState.js.map +1 -0
- package/dist/restricted/manageState.mjs +20 -0
- package/dist/restricted/manageState.mjs.map +1 -0
- package/dist/restricted/notify.js +13 -0
- package/dist/restricted/notify.js.map +1 -0
- package/dist/restricted/notify.mjs +13 -0
- package/dist/restricted/notify.mjs.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/endowments/caveats/generic.d.ts +19 -0
- package/dist/types/endowments/caveats/index.d.ts +2 -0
- package/dist/types/endowments/caveats/requestTime.d.ts +29 -0
- package/dist/types/endowments/cronjob.d.ts +51 -0
- package/dist/types/endowments/enum.d.ts +13 -0
- package/dist/types/endowments/ethereum-provider.d.ts +14 -0
- package/dist/types/endowments/home-page.d.ts +15 -0
- package/dist/types/endowments/index.d.ts +131 -0
- package/dist/types/endowments/keyring.d.ts +39 -0
- package/dist/types/endowments/lifecycle-hooks.d.ts +15 -0
- package/dist/types/endowments/name-lookup.d.ts +49 -0
- package/dist/types/endowments/network-access.d.ts +14 -0
- package/dist/types/endowments/rpc.d.ts +38 -0
- package/dist/types/endowments/signature-insight.d.ts +39 -0
- package/dist/types/endowments/transaction-insight.d.ts +39 -0
- package/dist/types/endowments/web-assembly.d.ts +14 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/permissions.d.ts +16 -0
- package/dist/types/permitted/createInterface.d.ts +150 -0
- package/dist/types/permitted/getInterfaceState.d.ts +18 -0
- package/dist/types/permitted/handlers.d.ts +4 -1
- package/dist/types/permitted/index.d.ts +4 -1
- package/dist/types/permitted/updateInterface.d.ts +152 -0
- package/dist/types/restricted/dialog.d.ts +776 -14
- package/dist/utils.js +13 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +13 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +22 -19
- package/dist/cjs/index.js +0 -43
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/permitted/getAllSnaps.js +0 -44
- package/dist/cjs/permitted/getAllSnaps.js.map +0 -1
- package/dist/cjs/permitted/getClientStatus.js +0 -40
- package/dist/cjs/permitted/getClientStatus.js.map +0 -1
- package/dist/cjs/permitted/getFile.js +0 -63
- package/dist/cjs/permitted/getFile.js.map +0 -1
- package/dist/cjs/permitted/getSnaps.js +0 -39
- package/dist/cjs/permitted/getSnaps.js.map +0 -1
- package/dist/cjs/permitted/handlers.js +0 -37
- package/dist/cjs/permitted/handlers.js.map +0 -1
- package/dist/cjs/permitted/index.js +0 -21
- package/dist/cjs/permitted/index.js.map +0 -1
- package/dist/cjs/permitted/invokeKeyring.js +0 -87
- package/dist/cjs/permitted/invokeKeyring.js.map +0 -1
- package/dist/cjs/permitted/invokeSnapSugar.js +0 -62
- package/dist/cjs/permitted/invokeSnapSugar.js.map +0 -1
- package/dist/cjs/permitted/middleware.js +0 -38
- package/dist/cjs/permitted/middleware.js.map +0 -1
- package/dist/cjs/permitted/requestSnaps.js +0 -123
- package/dist/cjs/permitted/requestSnaps.js.map +0 -1
- package/dist/cjs/restricted/caveats/index.js +0 -38
- package/dist/cjs/restricted/caveats/index.js.map +0 -1
- package/dist/cjs/restricted/caveats/permittedCoinTypes.js +0 -83
- package/dist/cjs/restricted/caveats/permittedCoinTypes.js.map +0 -1
- package/dist/cjs/restricted/caveats/permittedDerivationPaths.js +0 -67
- package/dist/cjs/restricted/caveats/permittedDerivationPaths.js.map +0 -1
- package/dist/cjs/restricted/caveats/snapIds.js +0 -59
- package/dist/cjs/restricted/caveats/snapIds.js.map +0 -1
- package/dist/cjs/restricted/dialog.js +0 -145
- package/dist/cjs/restricted/dialog.js.map +0 -1
- package/dist/cjs/restricted/getBip32Entropy.js +0 -76
- package/dist/cjs/restricted/getBip32Entropy.js.map +0 -1
- package/dist/cjs/restricted/getBip32PublicKey.js +0 -91
- package/dist/cjs/restricted/getBip44Entropy.js +0 -76
- package/dist/cjs/restricted/getBip44Entropy.js.map +0 -1
- package/dist/cjs/restricted/getEntropy.js +0 -76
- package/dist/cjs/restricted/getEntropy.js.map +0 -1
- package/dist/cjs/restricted/getLocale.js +0 -49
- package/dist/cjs/restricted/getLocale.js.map +0 -1
- package/dist/cjs/restricted/index.js +0 -59
- package/dist/cjs/restricted/index.js.map +0 -1
- package/dist/cjs/restricted/invokeSnap.js +0 -99
- package/dist/cjs/restricted/invokeSnap.js.map +0 -1
- package/dist/cjs/restricted/manageAccounts.js +0 -68
- package/dist/cjs/restricted/manageAccounts.js.map +0 -1
- package/dist/cjs/restricted/manageState.js +0 -208
- package/dist/cjs/restricted/manageState.js.map +0 -1
- package/dist/cjs/restricted/notify.js +0 -92
- package/dist/cjs/restricted/notify.js.map +0 -1
- package/dist/cjs/utils.js +0 -98
- package/dist/esm/index.js +0 -6
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/permitted/getAllSnaps.js +0 -37
- package/dist/esm/permitted/getAllSnaps.js.map +0 -1
- package/dist/esm/permitted/getClientStatus.js +0 -32
- package/dist/esm/permitted/getClientStatus.js.map +0 -1
- package/dist/esm/permitted/getFile.js +0 -45
- package/dist/esm/permitted/getFile.js.map +0 -1
- package/dist/esm/permitted/getSnaps.js +0 -31
- package/dist/esm/permitted/getSnaps.js.map +0 -1
- package/dist/esm/permitted/handlers.js +0 -19
- package/dist/esm/permitted/handlers.js.map +0 -1
- package/dist/esm/permitted/index.js +0 -4
- package/dist/esm/permitted/index.js.map +0 -1
- package/dist/esm/permitted/invokeKeyring.js +0 -79
- package/dist/esm/permitted/invokeKeyring.js.map +0 -1
- package/dist/esm/permitted/invokeSnapSugar.js +0 -60
- package/dist/esm/permitted/invokeSnapSugar.js.map +0 -1
- package/dist/esm/permitted/middleware.js +0 -34
- package/dist/esm/permitted/middleware.js.map +0 -1
- package/dist/esm/permitted/requestSnaps.js +0 -118
- package/dist/esm/permitted/requestSnaps.js.map +0 -1
- package/dist/esm/restricted/caveats/index.js +0 -20
- package/dist/esm/restricted/caveats/index.js.map +0 -1
- package/dist/esm/restricted/caveats/permittedCoinTypes.js +0 -77
- package/dist/esm/restricted/caveats/permittedCoinTypes.js.map +0 -1
- package/dist/esm/restricted/caveats/permittedDerivationPaths.js +0 -64
- package/dist/esm/restricted/caveats/permittedDerivationPaths.js.map +0 -1
- package/dist/esm/restricted/caveats/snapIds.js +0 -50
- package/dist/esm/restricted/caveats/snapIds.js.map +0 -1
- package/dist/esm/restricted/dialog.js +0 -138
- package/dist/esm/restricted/dialog.js.map +0 -1
- package/dist/esm/restricted/getBip32Entropy.js +0 -67
- package/dist/esm/restricted/getBip32Entropy.js.map +0 -1
- package/dist/esm/restricted/getBip32PublicKey.js +0 -79
- package/dist/esm/restricted/getBip32PublicKey.js.map +0 -1
- package/dist/esm/restricted/getBip44Entropy.js +0 -69
- package/dist/esm/restricted/getBip44Entropy.js.map +0 -1
- package/dist/esm/restricted/getEntropy.js +0 -58
- package/dist/esm/restricted/getEntropy.js.map +0 -1
- package/dist/esm/restricted/getLocale.js +0 -42
- package/dist/esm/restricted/getLocale.js.map +0 -1
- package/dist/esm/restricted/index.js +0 -27
- package/dist/esm/restricted/index.js.map +0 -1
- package/dist/esm/restricted/invokeSnap.js +0 -89
- package/dist/esm/restricted/invokeSnap.js.map +0 -1
- package/dist/esm/restricted/manageAccounts.js +0 -60
- package/dist/esm/restricted/manageAccounts.js.map +0 -1
- package/dist/esm/restricted/manageState.js +0 -225
- package/dist/esm/restricted/manageState.js.map +0 -1
- package/dist/esm/restricted/notify.js +0 -92
- package/dist/esm/restricted/notify.js.map +0 -1
- package/dist/esm/utils.js +0 -124
- package/dist/esm/utils.js.map +0 -1
package/dist/utils.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk632BZ6JYjs = require('./chunk-632BZ6JY.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.deriveEntropy = _chunk632BZ6JYjs.deriveEntropy; exports.getNode = _chunk632BZ6JYjs.getNode; exports.getPathPrefix = _chunk632BZ6JYjs.getPathPrefix; exports.selectHooks = _chunk632BZ6JYjs.selectHooks;
|
|
13
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-rpc-methods",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "MetaMask Snaps JSON-RPC method implementations.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/MetaMask/snaps.git"
|
|
8
8
|
},
|
|
9
9
|
"sideEffects": false,
|
|
10
|
-
"
|
|
11
|
-
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.js",
|
|
14
|
+
"types": "./dist/types/index.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"module": "./dist/index.mjs",
|
|
12
20
|
"types": "./dist/types/index.d.ts",
|
|
13
21
|
"files": [
|
|
14
|
-
"dist
|
|
15
|
-
"dist/esm/**",
|
|
16
|
-
"dist/types/**"
|
|
22
|
+
"dist"
|
|
17
23
|
],
|
|
18
24
|
"scripts": {
|
|
19
25
|
"test": "jest && yarn posttest",
|
|
@@ -24,37 +30,33 @@
|
|
|
24
30
|
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies",
|
|
25
31
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
26
32
|
"lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-rpc-methods",
|
|
27
|
-
"build": "
|
|
28
|
-
"build:source": "yarn build:esm && yarn build:cjs",
|
|
33
|
+
"build": "tsup --clean && yarn build:types",
|
|
29
34
|
"build:types": "tsc --project tsconfig.build.json",
|
|
30
|
-
"build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6",
|
|
31
|
-
"build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs",
|
|
32
|
-
"build:clean": "yarn clean && yarn build",
|
|
33
35
|
"clean": "rimraf '*.tsbuildinfo' 'dist'",
|
|
34
36
|
"publish:preview": "yarn npm publish --tag preview",
|
|
35
37
|
"lint:ci": "yarn lint",
|
|
36
|
-
"lint:dependencies": "depcheck"
|
|
38
|
+
"lint:dependencies": "depcheck",
|
|
39
|
+
"build:ci": "tsup --clean"
|
|
37
40
|
},
|
|
38
41
|
"dependencies": {
|
|
39
42
|
"@metamask/key-tree": "^9.0.0",
|
|
40
|
-
"@metamask/permission-controller": "^
|
|
41
|
-
"@metamask/rpc-errors": "^6.1
|
|
42
|
-
"@metamask/snaps-sdk": "^
|
|
43
|
-
"@metamask/snaps-utils": "^
|
|
43
|
+
"@metamask/permission-controller": "^8.0.1",
|
|
44
|
+
"@metamask/rpc-errors": "^6.2.1",
|
|
45
|
+
"@metamask/snaps-sdk": "^3.0.0",
|
|
46
|
+
"@metamask/snaps-utils": "^7.0.0",
|
|
44
47
|
"@metamask/utils": "^8.3.0",
|
|
45
48
|
"@noble/hashes": "^1.3.1",
|
|
46
49
|
"superstruct": "^1.0.3"
|
|
47
50
|
},
|
|
48
51
|
"devDependencies": {
|
|
49
|
-
"@lavamoat/allow-scripts": "^3.0.
|
|
52
|
+
"@lavamoat/allow-scripts": "^3.0.2",
|
|
50
53
|
"@metamask/auto-changelog": "^3.4.4",
|
|
51
54
|
"@metamask/browser-passworder": "^4.3.0",
|
|
52
55
|
"@metamask/eslint-config": "^12.1.0",
|
|
53
56
|
"@metamask/eslint-config-jest": "^12.1.0",
|
|
54
57
|
"@metamask/eslint-config-nodejs": "^12.1.0",
|
|
55
58
|
"@metamask/eslint-config-typescript": "^12.1.0",
|
|
56
|
-
"@metamask/json-rpc-engine": "^7.3.
|
|
57
|
-
"@swc/cli": "^0.1.62",
|
|
59
|
+
"@metamask/json-rpc-engine": "^7.3.2",
|
|
58
60
|
"@swc/core": "1.3.78",
|
|
59
61
|
"@swc/jest": "^0.2.26",
|
|
60
62
|
"@types/node": "18.14.2",
|
|
@@ -75,6 +77,7 @@
|
|
|
75
77
|
"prettier": "^2.7.1",
|
|
76
78
|
"prettier-plugin-packagejson": "^2.2.11",
|
|
77
79
|
"rimraf": "^4.1.2",
|
|
80
|
+
"tsup": "^8.0.1",
|
|
78
81
|
"typescript": "~4.8.4"
|
|
79
82
|
},
|
|
80
83
|
"engines": {
|
package/dist/cjs/index.js
DELETED
|
@@ -1,43 +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
|
-
permittedMethods: function() {
|
|
13
|
-
return _permitted.handlers;
|
|
14
|
-
},
|
|
15
|
-
createSnapsMethodMiddleware: function() {
|
|
16
|
-
return _permitted.createSnapsMethodMiddleware;
|
|
17
|
-
},
|
|
18
|
-
SnapCaveatType: function() {
|
|
19
|
-
return _snapsutils.SnapCaveatType;
|
|
20
|
-
},
|
|
21
|
-
selectHooks: function() {
|
|
22
|
-
return _utils.selectHooks;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
const _permitted = require("./permitted");
|
|
26
|
-
_export_star(require("./restricted"), exports);
|
|
27
|
-
const _snapsutils = require("@metamask/snaps-utils");
|
|
28
|
-
const _utils = require("./utils");
|
|
29
|
-
function _export_star(from, to) {
|
|
30
|
-
Object.keys(from).forEach(function(k) {
|
|
31
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
32
|
-
Object.defineProperty(to, k, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function() {
|
|
35
|
-
return from[k];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
return from;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type { PermittedRpcMethodHooks } from './permitted';\nexport {\n handlers as permittedMethods,\n createSnapsMethodMiddleware,\n} from './permitted';\nexport * from './restricted';\nexport { SnapCaveatType } from '@metamask/snaps-utils';\nexport { selectHooks } from './utils';\n"],"names":["permittedMethods","handlers","createSnapsMethodMiddleware","SnapCaveatType","selectHooks"],"mappings":";;;;;;;;;;;IAEcA,gBAAgB;eAA5BC,mBAAQ;;IACRC,2BAA2B;eAA3BA,sCAA2B;;IAGpBC,cAAc;eAAdA,0BAAc;;IACdC,WAAW;eAAXA,kBAAW;;;2BAHb;qBACO;4BACiB;uBACH"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "getAllSnapsHandler", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return getAllSnapsHandler;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _rpcerrors = require("@metamask/rpc-errors");
|
|
12
|
-
const hookNames = {
|
|
13
|
-
getAllSnaps: true
|
|
14
|
-
};
|
|
15
|
-
const getAllSnapsHandler = {
|
|
16
|
-
methodNames: [
|
|
17
|
-
'wallet_getAllSnaps'
|
|
18
|
-
],
|
|
19
|
-
implementation: getAllSnapsImplementation,
|
|
20
|
-
hookNames
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* The `wallet_getAllSnaps` method implementation.
|
|
24
|
-
* Fetches all installed snaps and adds them to the JSON-RPC response.
|
|
25
|
-
*
|
|
26
|
-
* @param request - The JSON-RPC request object.
|
|
27
|
-
* @param response - The JSON-RPC response object.
|
|
28
|
-
* @param _next - The `json-rpc-engine` "next" callback. Not used by this
|
|
29
|
-
* function.
|
|
30
|
-
* @param end - The `json-rpc-engine` "end" callback.
|
|
31
|
-
* @param hooks - The RPC method hooks.
|
|
32
|
-
* @param hooks.getAllSnaps - A function that returns all installed snaps.
|
|
33
|
-
* @returns Nothing.
|
|
34
|
-
*/ async function getAllSnapsImplementation(request, response, _next, end, { getAllSnaps }) {
|
|
35
|
-
// The origin is added by the MetaMask middleware stack.
|
|
36
|
-
const { origin } = request;
|
|
37
|
-
if (origin !== 'https://snaps.metamask.io') {
|
|
38
|
-
return end(_rpcerrors.rpcErrors.methodNotFound());
|
|
39
|
-
}
|
|
40
|
-
response.result = await getAllSnaps();
|
|
41
|
-
return end();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=getAllSnaps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/permitted/getAllSnaps.ts"],"sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { GetSnapsResult } from '@metamask/snaps-sdk';\nimport type {\n JsonRpcParams,\n JsonRpcRequest,\n PendingJsonRpcResponse,\n} from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\n\nconst hookNames: MethodHooksObject<GetAllSnapsHooks> = {\n getAllSnaps: true,\n};\n\n/**\n * `wallet_getAllSnaps` gets all installed Snaps. Currently, this can only be\n * called from `https://snaps.metamask.io`.\n */\nexport const getAllSnapsHandler: PermittedHandlerExport<\n GetAllSnapsHooks,\n JsonRpcParams,\n GetSnapsResult\n> = {\n methodNames: ['wallet_getAllSnaps'],\n implementation: getAllSnapsImplementation,\n hookNames,\n};\n\nexport type GetAllSnapsHooks = {\n /**\n * @returns All installed Snaps.\n */\n getAllSnaps: () => Promise<GetSnapsResult>;\n};\n\n/**\n * The `wallet_getAllSnaps` method implementation.\n * Fetches all installed snaps and adds them to the JSON-RPC response.\n *\n * @param request - The JSON-RPC request object.\n * @param response - The JSON-RPC response object.\n * @param _next - The `json-rpc-engine` \"next\" callback. Not used by this\n * function.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @param hooks - The RPC method hooks.\n * @param hooks.getAllSnaps - A function that returns all installed snaps.\n * @returns Nothing.\n */\nasync function getAllSnapsImplementation(\n request: JsonRpcRequest,\n response: PendingJsonRpcResponse<GetSnapsResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { getAllSnaps }: GetAllSnapsHooks,\n): Promise<void> {\n // The origin is added by the MetaMask middleware stack.\n const { origin } = request as JsonRpcRequest & { origin: string };\n\n if (origin !== 'https://snaps.metamask.io') {\n return end(rpcErrors.methodNotFound());\n }\n\n response.result = await getAllSnaps();\n return end();\n}\n"],"names":["getAllSnapsHandler","hookNames","getAllSnaps","methodNames","implementation","getAllSnapsImplementation","request","response","_next","end","origin","rpcErrors","methodNotFound","result"],"mappings":";;;;+BAoBaA;;;eAAAA;;;2BAlBa;AAU1B,MAAMC,YAAiD;IACrDC,aAAa;AACf;AAMO,MAAMF,qBAIT;IACFG,aAAa;QAAC;KAAqB;IACnCC,gBAAgBC;IAChBJ;AACF;AASA;;;;;;;;;;;;CAYC,GACD,eAAeI,0BACbC,OAAuB,EACvBC,QAAgD,EAChDC,KAAc,EACdC,GAA6B,EAC7B,EAAEP,WAAW,EAAoB;IAEjC,wDAAwD;IACxD,MAAM,EAAEQ,MAAM,EAAE,GAAGJ;IAEnB,IAAII,WAAW,6BAA6B;QAC1C,OAAOD,IAAIE,oBAAS,CAACC,cAAc;IACrC;IAEAL,SAASM,MAAM,GAAG,MAAMX;IACxB,OAAOO;AACT"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "getClientStatusHandler", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return getClientStatusHandler;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const hookNames = {
|
|
12
|
-
getIsLocked: true
|
|
13
|
-
};
|
|
14
|
-
const getClientStatusHandler = {
|
|
15
|
-
methodNames: [
|
|
16
|
-
'snap_getClientStatus'
|
|
17
|
-
],
|
|
18
|
-
implementation: getClientStatusImplementation,
|
|
19
|
-
hookNames
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* The `snap_getClientStatus` method implementation.
|
|
23
|
-
* Returns useful information about the client running the snap.
|
|
24
|
-
*
|
|
25
|
-
* @param _request - The JSON-RPC request object. Not used by this function.
|
|
26
|
-
* @param response - The JSON-RPC response object.
|
|
27
|
-
* @param _next - The `json-rpc-engine` "next" callback. Not used by this
|
|
28
|
-
* function.
|
|
29
|
-
* @param end - The `json-rpc-engine` "end" callback.
|
|
30
|
-
* @param hooks - The RPC method hooks.
|
|
31
|
-
* @param hooks.getIsLocked - A function that returns whether the client is locked or not.
|
|
32
|
-
* @returns Nothing.
|
|
33
|
-
*/ async function getClientStatusImplementation(_request, response, _next, end, { getIsLocked }) {
|
|
34
|
-
response.result = {
|
|
35
|
-
locked: getIsLocked()
|
|
36
|
-
};
|
|
37
|
-
return end();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=getClientStatus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/permitted/getClientStatus.ts"],"sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport type { GetClientStatusResult } from '@metamask/snaps-sdk';\nimport type {\n JsonRpcParams,\n JsonRpcRequest,\n PendingJsonRpcResponse,\n} from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\n\nconst hookNames: MethodHooksObject<GetClientStatusHooks> = {\n getIsLocked: true,\n};\n\n/**\n * `snap_getClientStatus` returns useful information about the client running the snap.\n */\nexport const getClientStatusHandler: PermittedHandlerExport<\n GetClientStatusHooks,\n JsonRpcParams,\n GetClientStatusResult\n> = {\n methodNames: ['snap_getClientStatus'],\n implementation: getClientStatusImplementation,\n hookNames,\n};\n\nexport type GetClientStatusHooks = {\n /**\n * @returns Whether the client is locked or not.\n */\n getIsLocked: () => boolean;\n};\n\n/**\n * The `snap_getClientStatus` method implementation.\n * Returns useful information about the client running the snap.\n *\n * @param _request - The JSON-RPC request object. Not used by this function.\n * @param response - The JSON-RPC response object.\n * @param _next - The `json-rpc-engine` \"next\" callback. Not used by this\n * function.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @param hooks - The RPC method hooks.\n * @param hooks.getIsLocked - A function that returns whether the client is locked or not.\n * @returns Nothing.\n */\nasync function getClientStatusImplementation(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse<GetClientStatusResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { getIsLocked }: GetClientStatusHooks,\n): Promise<void> {\n response.result = { locked: getIsLocked() };\n return end();\n}\n"],"names":["getClientStatusHandler","hookNames","getIsLocked","methodNames","implementation","getClientStatusImplementation","_request","response","_next","end","result","locked"],"mappings":";;;;+BAkBaA;;;eAAAA;;;AAPb,MAAMC,YAAqD;IACzDC,aAAa;AACf;AAKO,MAAMF,yBAIT;IACFG,aAAa;QAAC;KAAuB;IACrCC,gBAAgBC;IAChBJ;AACF;AASA;;;;;;;;;;;;CAYC,GACD,eAAeI,8BACbC,QAAwB,EACxBC,QAAuD,EACvDC,KAAc,EACdC,GAA6B,EAC7B,EAAEP,WAAW,EAAwB;IAErCK,SAASG,MAAM,GAAG;QAAEC,QAAQT;IAAc;IAC1C,OAAOO;AACT"}
|
|
@@ -1,63 +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
|
-
GetFileArgsStruct: function() {
|
|
13
|
-
return GetFileArgsStruct;
|
|
14
|
-
},
|
|
15
|
-
getFileHandler: function() {
|
|
16
|
-
return getFileHandler;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _rpcerrors = require("@metamask/rpc-errors");
|
|
20
|
-
const _snapssdk = require("@metamask/snaps-sdk");
|
|
21
|
-
const _utils = require("@metamask/utils");
|
|
22
|
-
const _superstruct = require("superstruct");
|
|
23
|
-
const GetFileArgsStruct = (0, _superstruct.object)({
|
|
24
|
-
path: (0, _superstruct.string)(),
|
|
25
|
-
encoding: (0, _superstruct.optional)((0, _superstruct.union)([
|
|
26
|
-
(0, _snapssdk.enumValue)(_snapssdk.AuxiliaryFileEncoding.Base64),
|
|
27
|
-
(0, _snapssdk.enumValue)(_snapssdk.AuxiliaryFileEncoding.Hex),
|
|
28
|
-
(0, _snapssdk.enumValue)(_snapssdk.AuxiliaryFileEncoding.Utf8)
|
|
29
|
-
]))
|
|
30
|
-
});
|
|
31
|
-
const hookNames = {
|
|
32
|
-
getSnapFile: true
|
|
33
|
-
};
|
|
34
|
-
const getFileHandler = {
|
|
35
|
-
methodNames: [
|
|
36
|
-
'snap_getFile'
|
|
37
|
-
],
|
|
38
|
-
implementation,
|
|
39
|
-
hookNames
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* The `snap_getFile` method implementation.
|
|
43
|
-
*
|
|
44
|
-
* @param req - The JSON-RPC request object.
|
|
45
|
-
* @param res - The JSON-RPC response object.
|
|
46
|
-
* @param _next - The `json-rpc-engine` "next" callback. Not used by this
|
|
47
|
-
* function.
|
|
48
|
-
* @param end - The `json-rpc-engine` "end" callback.
|
|
49
|
-
* @param hooks - The RPC method hooks.
|
|
50
|
-
* @param hooks.getSnapFile - The funnction to load a static snap file.
|
|
51
|
-
* @returns Nothing.
|
|
52
|
-
*/ async function implementation(req, res, _next, end, { getSnapFile }) {
|
|
53
|
-
const { params } = req;
|
|
54
|
-
(0, _utils.assertStruct)(params, GetFileArgsStruct, 'Invalid "snap_getFile" parameters', _rpcerrors.rpcErrors.invalidParams);
|
|
55
|
-
try {
|
|
56
|
-
res.result = await getSnapFile(params.path, params.encoding ?? _snapssdk.AuxiliaryFileEncoding.Base64);
|
|
57
|
-
} catch (error) {
|
|
58
|
-
return end(error);
|
|
59
|
-
}
|
|
60
|
-
return end();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=getFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/permitted/getFile.ts"],"sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { GetFileParams, GetFileResult } from '@metamask/snaps-sdk';\nimport { AuxiliaryFileEncoding, enumValue } from '@metamask/snaps-sdk';\nimport type { InferMatching } from '@metamask/snaps-utils';\nimport type { PendingJsonRpcResponse, JsonRpcRequest } from '@metamask/utils';\nimport { assertStruct } from '@metamask/utils';\nimport { object, optional, string, union } from 'superstruct';\n\nimport type { MethodHooksObject } from '../utils';\n\nexport const GetFileArgsStruct = object({\n path: string(),\n encoding: optional(\n union([\n enumValue(AuxiliaryFileEncoding.Base64),\n enumValue(AuxiliaryFileEncoding.Hex),\n enumValue(AuxiliaryFileEncoding.Utf8),\n ]),\n ),\n});\n\nexport type InferredGetFileParams = InferMatching<\n typeof GetFileArgsStruct,\n GetFileParams\n>;\n\nconst hookNames: MethodHooksObject<GetFileHooks> = {\n getSnapFile: true,\n};\n\nexport const getFileHandler: PermittedHandlerExport<\n GetFileHooks,\n InferredGetFileParams,\n string\n> = {\n methodNames: ['snap_getFile'],\n implementation,\n hookNames,\n};\n\nexport type GetFileHooks = {\n getSnapFile: (\n path: InferredGetFileParams['path'],\n encoding: InferredGetFileParams['encoding'],\n ) => Promise<string>;\n};\n\n/**\n * The `snap_getFile` method implementation.\n *\n * @param req - The JSON-RPC request object.\n * @param res - The JSON-RPC response object.\n * @param _next - The `json-rpc-engine` \"next\" callback. Not used by this\n * function.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @param hooks - The RPC method hooks.\n * @param hooks.getSnapFile - The funnction to load a static snap file.\n * @returns Nothing.\n */\nasync function implementation(\n req: JsonRpcRequest<InferredGetFileParams>,\n res: PendingJsonRpcResponse<GetFileResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { getSnapFile }: GetFileHooks,\n): Promise<void> {\n const { params } = req;\n\n assertStruct(\n params,\n GetFileArgsStruct,\n 'Invalid \"snap_getFile\" parameters',\n rpcErrors.invalidParams,\n );\n\n try {\n res.result = await getSnapFile(\n params.path,\n params.encoding ?? AuxiliaryFileEncoding.Base64,\n );\n } catch (error) {\n return end(error);\n }\n\n return end();\n}\n"],"names":["GetFileArgsStruct","getFileHandler","object","path","string","encoding","optional","union","enumValue","AuxiliaryFileEncoding","Base64","Hex","Utf8","hookNames","getSnapFile","methodNames","implementation","req","res","_next","end","params","assertStruct","rpcErrors","invalidParams","result","error"],"mappings":";;;;;;;;;;;IAYaA,iBAAiB;eAAjBA;;IAoBAC,cAAc;eAAdA;;;2BA9Ba;0BAEuB;uBAGpB;6BACmB;AAIzC,MAAMD,oBAAoBE,IAAAA,mBAAM,EAAC;IACtCC,MAAMC,IAAAA,mBAAM;IACZC,UAAUC,IAAAA,qBAAQ,EAChBC,IAAAA,kBAAK,EAAC;QACJC,IAAAA,mBAAS,EAACC,+BAAqB,CAACC,MAAM;QACtCF,IAAAA,mBAAS,EAACC,+BAAqB,CAACE,GAAG;QACnCH,IAAAA,mBAAS,EAACC,+BAAqB,CAACG,IAAI;KACrC;AAEL;AAOA,MAAMC,YAA6C;IACjDC,aAAa;AACf;AAEO,MAAMb,iBAIT;IACFc,aAAa;QAAC;KAAe;IAC7BC;IACAH;AACF;AASA;;;;;;;;;;;CAWC,GACD,eAAeG,eACbC,GAA0C,EAC1CC,GAA0C,EAC1CC,KAAc,EACdC,GAA6B,EAC7B,EAAEN,WAAW,EAAgB;IAE7B,MAAM,EAAEO,MAAM,EAAE,GAAGJ;IAEnBK,IAAAA,mBAAY,EACVD,QACArB,mBACA,qCACAuB,oBAAS,CAACC,aAAa;IAGzB,IAAI;QACFN,IAAIO,MAAM,GAAG,MAAMX,YACjBO,OAAOlB,IAAI,EACXkB,OAAOhB,QAAQ,IAAII,+BAAqB,CAACC,MAAM;IAEnD,EAAE,OAAOgB,OAAO;QACd,OAAON,IAAIM;IACb;IAEA,OAAON;AACT"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "getSnapsHandler", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return getSnapsHandler;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const hookNames = {
|
|
12
|
-
getSnaps: true
|
|
13
|
-
};
|
|
14
|
-
const getSnapsHandler = {
|
|
15
|
-
methodNames: [
|
|
16
|
-
'wallet_getSnaps'
|
|
17
|
-
],
|
|
18
|
-
implementation: getSnapsImplementation,
|
|
19
|
-
hookNames
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* The `wallet_getSnaps` method implementation.
|
|
23
|
-
* Fetches available snaps for the requesting origin and adds them to the JSON-RPC response.
|
|
24
|
-
*
|
|
25
|
-
* @param _req - The JSON-RPC request object. Not used by this function.
|
|
26
|
-
* @param res - The JSON-RPC response object.
|
|
27
|
-
* @param _next - The `json-rpc-engine` "next" callback. Not used by this
|
|
28
|
-
* function.
|
|
29
|
-
* @param end - The `json-rpc-engine` "end" callback.
|
|
30
|
-
* @param hooks - The RPC method hooks.
|
|
31
|
-
* @param hooks.getSnaps - A function that returns the snaps available for the requesting origin.
|
|
32
|
-
* @returns Nothing.
|
|
33
|
-
*/ async function getSnapsImplementation(_req, res, _next, end, { getSnaps }) {
|
|
34
|
-
// getSnaps is already bound to the origin
|
|
35
|
-
res.result = await getSnaps();
|
|
36
|
-
return end();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=getSnaps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/permitted/getSnaps.ts"],"sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport type { GetSnapsResult } from '@metamask/snaps-sdk';\nimport type { JsonRpcParams, PendingJsonRpcResponse } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\n\nconst hookNames: MethodHooksObject<GetSnapsHooks> = {\n getSnaps: true,\n};\n\n/**\n * `wallet_getSnaps` gets the requester's permitted and installed Snaps.\n */\nexport const getSnapsHandler: PermittedHandlerExport<\n GetSnapsHooks,\n JsonRpcParams,\n GetSnapsResult\n> = {\n methodNames: ['wallet_getSnaps'],\n implementation: getSnapsImplementation,\n hookNames,\n};\n\nexport type GetSnapsHooks = {\n /**\n * @returns The permitted and installed snaps for the requesting origin.\n */\n getSnaps: () => Promise<GetSnapsResult>;\n};\n\n/**\n * The `wallet_getSnaps` method implementation.\n * Fetches available snaps for the requesting origin and adds them to the JSON-RPC response.\n *\n * @param _req - The JSON-RPC request object. Not used by this function.\n * @param res - The JSON-RPC response object.\n * @param _next - The `json-rpc-engine` \"next\" callback. Not used by this\n * function.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @param hooks - The RPC method hooks.\n * @param hooks.getSnaps - A function that returns the snaps available for the requesting origin.\n * @returns Nothing.\n */\nasync function getSnapsImplementation(\n _req: unknown,\n res: PendingJsonRpcResponse<GetSnapsResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { getSnaps }: GetSnapsHooks,\n): Promise<void> {\n // getSnaps is already bound to the origin\n res.result = await getSnaps();\n return end();\n}\n"],"names":["getSnapsHandler","hookNames","getSnaps","methodNames","implementation","getSnapsImplementation","_req","res","_next","end","result"],"mappings":";;;;+BAcaA;;;eAAAA;;;AAPb,MAAMC,YAA8C;IAClDC,UAAU;AACZ;AAKO,MAAMF,kBAIT;IACFG,aAAa;QAAC;KAAkB;IAChCC,gBAAgBC;IAChBJ;AACF;AASA;;;;;;;;;;;;CAYC,GACD,eAAeI,uBACbC,IAAa,EACbC,GAA2C,EAC3CC,KAAc,EACdC,GAA6B,EAC7B,EAAEP,QAAQ,EAAiB;IAE3B,0CAA0C;IAC1CK,IAAIG,MAAM,GAAG,MAAMR;IACnB,OAAOO;AACT"}
|
|
@@ -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
|
-
methodHandlers: function() {
|
|
13
|
-
return methodHandlers;
|
|
14
|
-
},
|
|
15
|
-
handlers: function() {
|
|
16
|
-
return handlers;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _getAllSnaps = require("./getAllSnaps");
|
|
20
|
-
const _getClientStatus = require("./getClientStatus");
|
|
21
|
-
const _getFile = require("./getFile");
|
|
22
|
-
const _getSnaps = require("./getSnaps");
|
|
23
|
-
const _invokeKeyring = require("./invokeKeyring");
|
|
24
|
-
const _invokeSnapSugar = require("./invokeSnapSugar");
|
|
25
|
-
const _requestSnaps = require("./requestSnaps");
|
|
26
|
-
const methodHandlers = {
|
|
27
|
-
wallet_getAllSnaps: _getAllSnaps.getAllSnapsHandler,
|
|
28
|
-
wallet_getSnaps: _getSnaps.getSnapsHandler,
|
|
29
|
-
wallet_requestSnaps: _requestSnaps.requestSnapsHandler,
|
|
30
|
-
wallet_invokeSnap: _invokeSnapSugar.invokeSnapSugarHandler,
|
|
31
|
-
wallet_invokeKeyring: _invokeKeyring.invokeKeyringHandler,
|
|
32
|
-
snap_getClientStatus: _getClientStatus.getClientStatusHandler,
|
|
33
|
-
snap_getFile: _getFile.getFileHandler
|
|
34
|
-
};
|
|
35
|
-
const handlers = Object.values(methodHandlers);
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=handlers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/permitted/handlers.ts"],"sourcesContent":["import { getAllSnapsHandler } from './getAllSnaps';\nimport { getClientStatusHandler } from './getClientStatus';\nimport { getFileHandler } from './getFile';\nimport { getSnapsHandler } from './getSnaps';\nimport { invokeKeyringHandler } from './invokeKeyring';\nimport { invokeSnapSugarHandler } from './invokeSnapSugar';\nimport { requestSnapsHandler } from './requestSnaps';\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const methodHandlers = {\n wallet_getAllSnaps: getAllSnapsHandler,\n wallet_getSnaps: getSnapsHandler,\n wallet_requestSnaps: requestSnapsHandler,\n wallet_invokeSnap: invokeSnapSugarHandler,\n wallet_invokeKeyring: invokeKeyringHandler,\n snap_getClientStatus: getClientStatusHandler,\n snap_getFile: getFileHandler,\n};\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport const handlers = Object.values(methodHandlers);\n"],"names":["methodHandlers","handlers","wallet_getAllSnaps","getAllSnapsHandler","wallet_getSnaps","getSnapsHandler","wallet_requestSnaps","requestSnapsHandler","wallet_invokeSnap","invokeSnapSugarHandler","wallet_invokeKeyring","invokeKeyringHandler","snap_getClientStatus","getClientStatusHandler","snap_getFile","getFileHandler","Object","values"],"mappings":";;;;;;;;;;;IASaA,cAAc;eAAdA;;IAWAC,QAAQ;eAARA;;;6BApBsB;iCACI;yBACR;0BACC;+BACK;iCACE;8BACH;AAG7B,MAAMD,iBAAiB;IAC5BE,oBAAoBC,+BAAkB;IACtCC,iBAAiBC,yBAAe;IAChCC,qBAAqBC,iCAAmB;IACxCC,mBAAmBC,uCAAsB;IACzCC,sBAAsBC,mCAAoB;IAC1CC,sBAAsBC,uCAAsB;IAC5CC,cAAcC,uBAAc;AAC9B;AAGO,MAAMd,WAAWe,OAAOC,MAAM,CAACjB"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./handlers"), exports);
|
|
6
|
-
_export_star(require("./middleware"), exports);
|
|
7
|
-
function _export_star(from, to) {
|
|
8
|
-
Object.keys(from).forEach(function(k) {
|
|
9
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
10
|
-
Object.defineProperty(to, k, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function() {
|
|
13
|
-
return from[k];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
return from;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/permitted/index.ts"],"sourcesContent":["import type { GetAllSnapsHooks } from './getAllSnaps';\nimport type { GetClientStatusHooks } from './getClientStatus';\nimport type { GetSnapsHooks } from './getSnaps';\nimport type { RequestSnapsHooks } from './requestSnaps';\n\nexport type PermittedRpcMethodHooks = GetAllSnapsHooks &\n GetClientStatusHooks &\n GetSnapsHooks &\n RequestSnapsHooks;\n\nexport * from './handlers';\nexport * from './middleware';\n"],"names":[],"mappings":";;;;qBAUc;qBACA"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "invokeKeyringHandler", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return invokeKeyringHandler;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _rpcerrors = require("@metamask/rpc-errors");
|
|
12
|
-
const _snapsutils = require("@metamask/snaps-utils");
|
|
13
|
-
const _utils = require("@metamask/utils");
|
|
14
|
-
const _invokeSnapSugar = require("./invokeSnapSugar");
|
|
15
|
-
const hookNames = {
|
|
16
|
-
hasPermission: true,
|
|
17
|
-
handleSnapRpcRequest: true,
|
|
18
|
-
getSnap: true,
|
|
19
|
-
getAllowedKeyringMethods: true
|
|
20
|
-
};
|
|
21
|
-
const invokeKeyringHandler = {
|
|
22
|
-
methodNames: [
|
|
23
|
-
'wallet_invokeKeyring'
|
|
24
|
-
],
|
|
25
|
-
implementation: invokeKeyringImplementation,
|
|
26
|
-
hookNames
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* The `wallet_invokeKeyring` method implementation.
|
|
30
|
-
* Invokes onKeyringRequest if the snap requested is installed and connected to the dapp.
|
|
31
|
-
*
|
|
32
|
-
* @param req - The JSON-RPC request object.
|
|
33
|
-
* @param res - The JSON-RPC response object.
|
|
34
|
-
* @param _next - The `json-rpc-engine` "next" callback. Not used by this
|
|
35
|
-
* function.
|
|
36
|
-
* @param end - The `json-rpc-engine` "end" callback.
|
|
37
|
-
* @param hooks - The RPC method hooks.
|
|
38
|
-
* @param hooks.handleSnapRpcRequest - Invokes a snap with a given RPC request.
|
|
39
|
-
* @param hooks.hasPermission - Checks whether a given origin has a given permission.
|
|
40
|
-
* @param hooks.getSnap - Gets information about a given snap.
|
|
41
|
-
* @param hooks.getAllowedKeyringMethods - Get the list of allowed Keyring
|
|
42
|
-
* methods for a given origin.
|
|
43
|
-
* @returns Nothing.
|
|
44
|
-
*/ async function invokeKeyringImplementation(req, res, _next, end, { handleSnapRpcRequest, hasPermission, getSnap, getAllowedKeyringMethods }) {
|
|
45
|
-
let params;
|
|
46
|
-
try {
|
|
47
|
-
params = (0, _invokeSnapSugar.getValidatedParams)(req.params);
|
|
48
|
-
} catch (error) {
|
|
49
|
-
return end(error);
|
|
50
|
-
}
|
|
51
|
-
// We expect the MM middleware stack to always add the origin to requests
|
|
52
|
-
const { origin } = req;
|
|
53
|
-
const { snapId, request } = params;
|
|
54
|
-
if (!origin || !hasPermission(_snapsutils.WALLET_SNAP_PERMISSION_KEY)) {
|
|
55
|
-
return end(_rpcerrors.rpcErrors.invalidRequest({
|
|
56
|
-
message: `The snap "${snapId}" is not connected to "${origin}". Please connect before invoking the snap.`
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
if (!getSnap(snapId)) {
|
|
60
|
-
return end(_rpcerrors.rpcErrors.invalidRequest({
|
|
61
|
-
message: `The snap "${snapId}" is not installed. Please install it first, before invoking the snap.`
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
if (!(0, _utils.hasProperty)(request, 'method') || typeof request.method !== 'string') {
|
|
65
|
-
return end(_rpcerrors.rpcErrors.invalidRequest({
|
|
66
|
-
message: 'The request must have a method.'
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
const allowedMethods = getAllowedKeyringMethods();
|
|
70
|
-
if (!allowedMethods.includes(request.method)) {
|
|
71
|
-
return end(_rpcerrors.rpcErrors.invalidRequest({
|
|
72
|
-
message: `The origin "${origin}" is not allowed to invoke the method "${request.method}".`
|
|
73
|
-
}));
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
res.result = await handleSnapRpcRequest({
|
|
77
|
-
snapId,
|
|
78
|
-
request,
|
|
79
|
-
handler: _snapsutils.HandlerType.OnKeyringRequest
|
|
80
|
-
});
|
|
81
|
-
} catch (error) {
|
|
82
|
-
return end(error);
|
|
83
|
-
}
|
|
84
|
-
return end();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
//# sourceMappingURL=invokeKeyring.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/permitted/invokeKeyring.ts"],"sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type {\n InvokeKeyringParams,\n InvokeKeyringResult,\n InvokeSnapParams,\n} from '@metamask/snaps-sdk';\nimport type { Snap, SnapRpcHookArgs } from '@metamask/snaps-utils';\nimport { HandlerType, WALLET_SNAP_PERMISSION_KEY } from '@metamask/snaps-utils';\nimport type { PendingJsonRpcResponse, JsonRpcRequest } from '@metamask/utils';\nimport { hasProperty, type Json } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\nimport { getValidatedParams } from './invokeSnapSugar';\n\nconst hookNames: MethodHooksObject<InvokeKeyringHooks> = {\n hasPermission: true,\n handleSnapRpcRequest: true,\n getSnap: true,\n getAllowedKeyringMethods: true,\n};\n\n/**\n * `wallet_invokeKeyring` gets the requester's permitted and installed Snaps.\n */\nexport const invokeKeyringHandler: PermittedHandlerExport<\n InvokeKeyringHooks,\n InvokeSnapParams,\n InvokeKeyringResult\n> = {\n methodNames: ['wallet_invokeKeyring'],\n implementation: invokeKeyringImplementation,\n hookNames,\n};\n\nexport type InvokeKeyringHooks = {\n hasPermission: (permissionName: string) => boolean;\n\n handleSnapRpcRequest: ({\n snapId,\n handler,\n request,\n }: Omit<SnapRpcHookArgs, 'origin'> & { snapId: string }) => Promise<unknown>;\n\n getSnap: (snapId: string) => Snap | undefined;\n\n getAllowedKeyringMethods: () => string[];\n};\n\n/**\n * The `wallet_invokeKeyring` method implementation.\n * Invokes onKeyringRequest if the snap requested is installed and connected to the dapp.\n *\n * @param req - The JSON-RPC request object.\n * @param res - The JSON-RPC response object.\n * @param _next - The `json-rpc-engine` \"next\" callback. Not used by this\n * function.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @param hooks - The RPC method hooks.\n * @param hooks.handleSnapRpcRequest - Invokes a snap with a given RPC request.\n * @param hooks.hasPermission - Checks whether a given origin has a given permission.\n * @param hooks.getSnap - Gets information about a given snap.\n * @param hooks.getAllowedKeyringMethods - Get the list of allowed Keyring\n * methods for a given origin.\n * @returns Nothing.\n */\nasync function invokeKeyringImplementation(\n req: JsonRpcRequest<InvokeKeyringParams>,\n res: PendingJsonRpcResponse<InvokeKeyringResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n {\n handleSnapRpcRequest,\n hasPermission,\n getSnap,\n getAllowedKeyringMethods,\n }: InvokeKeyringHooks,\n): Promise<void> {\n let params: InvokeSnapParams;\n try {\n params = getValidatedParams(req.params);\n } catch (error) {\n return end(error);\n }\n\n // We expect the MM middleware stack to always add the origin to requests\n const { origin } = req as JsonRpcRequest & { origin: string };\n const { snapId, request } = params;\n\n if (!origin || !hasPermission(WALLET_SNAP_PERMISSION_KEY)) {\n return end(\n rpcErrors.invalidRequest({\n message: `The snap \"${snapId}\" is not connected to \"${origin}\". Please connect before invoking the snap.`,\n }),\n );\n }\n\n if (!getSnap(snapId)) {\n return end(\n rpcErrors.invalidRequest({\n message: `The snap \"${snapId}\" is not installed. Please install it first, before invoking the snap.`,\n }),\n );\n }\n\n if (!hasProperty(request, 'method') || typeof request.method !== 'string') {\n return end(\n rpcErrors.invalidRequest({\n message: 'The request must have a method.',\n }),\n );\n }\n\n const allowedMethods = getAllowedKeyringMethods();\n if (!allowedMethods.includes(request.method)) {\n return end(\n rpcErrors.invalidRequest({\n message: `The origin \"${origin}\" is not allowed to invoke the method \"${request.method}\".`,\n }),\n );\n }\n\n try {\n res.result = (await handleSnapRpcRequest({\n snapId,\n request,\n handler: HandlerType.OnKeyringRequest,\n })) as Json;\n } catch (error) {\n return end(error);\n }\n\n return end();\n}\n"],"names":["invokeKeyringHandler","hookNames","hasPermission","handleSnapRpcRequest","getSnap","getAllowedKeyringMethods","methodNames","implementation","invokeKeyringImplementation","req","res","_next","end","params","getValidatedParams","error","origin","snapId","request","WALLET_SNAP_PERMISSION_KEY","rpcErrors","invalidRequest","message","hasProperty","method","allowedMethods","includes","result","handler","HandlerType","OnKeyringRequest"],"mappings":";;;;+BA0BaA;;;eAAAA;;;2BAxBa;4BAO8B;uBAEjB;iCAGJ;AAEnC,MAAMC,YAAmD;IACvDC,eAAe;IACfC,sBAAsB;IACtBC,SAAS;IACTC,0BAA0B;AAC5B;AAKO,MAAML,uBAIT;IACFM,aAAa;QAAC;KAAuB;IACrCC,gBAAgBC;IAChBP;AACF;AAgBA;;;;;;;;;;;;;;;;CAgBC,GACD,eAAeO,4BACbC,GAAwC,EACxCC,GAAgD,EAChDC,KAAc,EACdC,GAA6B,EAC7B,EACET,oBAAoB,EACpBD,aAAa,EACbE,OAAO,EACPC,wBAAwB,EACL;IAErB,IAAIQ;IACJ,IAAI;QACFA,SAASC,IAAAA,mCAAkB,EAACL,IAAII,MAAM;IACxC,EAAE,OAAOE,OAAO;QACd,OAAOH,IAAIG;IACb;IAEA,yEAAyE;IACzE,MAAM,EAAEC,MAAM,EAAE,GAAGP;IACnB,MAAM,EAAEQ,MAAM,EAAEC,OAAO,EAAE,GAAGL;IAE5B,IAAI,CAACG,UAAU,CAACd,cAAciB,sCAA0B,GAAG;QACzD,OAAOP,IACLQ,oBAAS,CAACC,cAAc,CAAC;YACvBC,SAAS,CAAC,UAAU,EAAEL,OAAO,uBAAuB,EAAED,OAAO,2CAA2C,CAAC;QAC3G;IAEJ;IAEA,IAAI,CAACZ,QAAQa,SAAS;QACpB,OAAOL,IACLQ,oBAAS,CAACC,cAAc,CAAC;YACvBC,SAAS,CAAC,UAAU,EAAEL,OAAO,sEAAsE,CAAC;QACtG;IAEJ;IAEA,IAAI,CAACM,IAAAA,kBAAW,EAACL,SAAS,aAAa,OAAOA,QAAQM,MAAM,KAAK,UAAU;QACzE,OAAOZ,IACLQ,oBAAS,CAACC,cAAc,CAAC;YACvBC,SAAS;QACX;IAEJ;IAEA,MAAMG,iBAAiBpB;IACvB,IAAI,CAACoB,eAAeC,QAAQ,CAACR,QAAQM,MAAM,GAAG;QAC5C,OAAOZ,IACLQ,oBAAS,CAACC,cAAc,CAAC;YACvBC,SAAS,CAAC,YAAY,EAAEN,OAAO,uCAAuC,EAAEE,QAAQM,MAAM,CAAC,EAAE,CAAC;QAC5F;IAEJ;IAEA,IAAI;QACFd,IAAIiB,MAAM,GAAI,MAAMxB,qBAAqB;YACvCc;YACAC;YACAU,SAASC,uBAAW,CAACC,gBAAgB;QACvC;IACF,EAAE,OAAOf,OAAO;QACd,OAAOH,IAAIG;IACb;IAEA,OAAOH;AACT"}
|
|
@@ -1,62 +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
|
-
invokeSnapSugarHandler: function() {
|
|
13
|
-
return invokeSnapSugarHandler;
|
|
14
|
-
},
|
|
15
|
-
invokeSnapSugar: function() {
|
|
16
|
-
return invokeSnapSugar;
|
|
17
|
-
},
|
|
18
|
-
getValidatedParams: function() {
|
|
19
|
-
return getValidatedParams;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _rpcerrors = require("@metamask/rpc-errors");
|
|
23
|
-
const _utils = require("@metamask/utils");
|
|
24
|
-
const invokeSnapSugarHandler = {
|
|
25
|
-
methodNames: [
|
|
26
|
-
'wallet_invokeSnap'
|
|
27
|
-
],
|
|
28
|
-
implementation: invokeSnapSugar,
|
|
29
|
-
hookNames: undefined
|
|
30
|
-
};
|
|
31
|
-
function invokeSnapSugar(req, _res, next, end) {
|
|
32
|
-
let params;
|
|
33
|
-
try {
|
|
34
|
-
params = getValidatedParams(req.params);
|
|
35
|
-
} catch (error) {
|
|
36
|
-
return end(error);
|
|
37
|
-
}
|
|
38
|
-
req.method = 'wallet_snap';
|
|
39
|
-
req.params = params;
|
|
40
|
-
return next();
|
|
41
|
-
}
|
|
42
|
-
function getValidatedParams(params) {
|
|
43
|
-
if (!(0, _utils.isObject)(params)) {
|
|
44
|
-
throw _rpcerrors.rpcErrors.invalidParams({
|
|
45
|
-
message: 'Expected params to be a single object.'
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
const { snapId, request } = params;
|
|
49
|
-
if (!snapId || typeof snapId !== 'string' || snapId === '') {
|
|
50
|
-
throw _rpcerrors.rpcErrors.invalidParams({
|
|
51
|
-
message: 'Must specify a valid snap ID.'
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
if (!(0, _utils.isObject)(request)) {
|
|
55
|
-
throw _rpcerrors.rpcErrors.invalidParams({
|
|
56
|
-
message: 'Expected request to be a single object.'
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return params;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
//# sourceMappingURL=invokeSnapSugar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/permitted/invokeSnapSugar.ts"],"sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { InvokeSnapParams, InvokeSnapResult } from '@metamask/snaps-sdk';\nimport type { JsonRpcRequest } from '@metamask/utils';\nimport { isObject } from '@metamask/utils';\n\n/**\n * `wallet_invokeSnap` attempts to invoke an RPC method of the specified Snap.\n */\nexport const invokeSnapSugarHandler: PermittedHandlerExport<\n void,\n InvokeSnapParams,\n InvokeSnapResult\n> = {\n methodNames: ['wallet_invokeSnap'],\n implementation: invokeSnapSugar,\n hookNames: undefined,\n};\n\n/**\n * The `wallet_invokeSnap` method implementation.\n * Reroutes incoming JSON-RPC requests that are targeting snaps, by modifying the method and params.\n *\n * @param req - The JSON-RPC request object.\n * @param _res - The JSON-RPC response object. Not used by this\n * function.\n * @param next - The `json-rpc-engine` \"next\" callback.\n * @param end - The `json-rpc-engine` \"end\" callback.\n * @returns Nothing.\n * @throws If the params are invalid.\n */\nexport function invokeSnapSugar(\n req: JsonRpcRequest<InvokeSnapParams>,\n _res: unknown,\n next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n): void {\n let params: InvokeSnapParams;\n try {\n params = getValidatedParams(req.params);\n } catch (error) {\n return end(error);\n }\n\n req.method = 'wallet_snap';\n req.params = params;\n return next();\n}\n\n/**\n * Validates the wallet_invokeSnap method `params` and returns them cast to the correct\n * type. Throws if validation fails.\n *\n * @param params - The unvalidated params object from the method request.\n * @returns The validated method parameter object.\n */\nexport function getValidatedParams(params: unknown): InvokeSnapParams {\n if (!isObject(params)) {\n throw rpcErrors.invalidParams({\n message: 'Expected params to be a single object.',\n });\n }\n\n const { snapId, request } = params;\n\n if (!snapId || typeof snapId !== 'string' || snapId === '') {\n throw rpcErrors.invalidParams({\n message: 'Must specify a valid snap ID.',\n });\n }\n\n if (!isObject(request)) {\n throw rpcErrors.invalidParams({\n message: 'Expected request to be a single object.',\n });\n }\n\n return params as InvokeSnapParams;\n}\n"],"names":["invokeSnapSugarHandler","invokeSnapSugar","getValidatedParams","methodNames","implementation","hookNames","undefined","req","_res","next","end","params","error","method","isObject","rpcErrors","invalidParams","message","snapId","request"],"mappings":";;;;;;;;;;;IAaaA,sBAAsB;eAAtBA;;IAsBGC,eAAe;eAAfA;;IAyBAC,kBAAkB;eAAlBA;;;2BAvDU;uBAGD;AAKlB,MAAMF,yBAIT;IACFG,aAAa;QAAC;KAAoB;IAClCC,gBAAgBH;IAChBI,WAAWC;AACb;AAcO,SAASL,gBACdM,GAAqC,EACrCC,IAAa,EACbC,IAA+B,EAC/BC,GAA6B;IAE7B,IAAIC;IACJ,IAAI;QACFA,SAAST,mBAAmBK,IAAII,MAAM;IACxC,EAAE,OAAOC,OAAO;QACd,OAAOF,IAAIE;IACb;IAEAL,IAAIM,MAAM,GAAG;IACbN,IAAII,MAAM,GAAGA;IACb,OAAOF;AACT;AASO,SAASP,mBAAmBS,MAAe;IAChD,IAAI,CAACG,IAAAA,eAAQ,EAACH,SAAS;QACrB,MAAMI,oBAAS,CAACC,aAAa,CAAC;YAC5BC,SAAS;QACX;IACF;IAEA,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGR;IAE5B,IAAI,CAACO,UAAU,OAAOA,WAAW,YAAYA,WAAW,IAAI;QAC1D,MAAMH,oBAAS,CAACC,aAAa,CAAC;YAC5BC,SAAS;QACX;IACF;IAEA,IAAI,CAACH,IAAAA,eAAQ,EAACK,UAAU;QACtB,MAAMJ,oBAAS,CAACC,aAAa,CAAC;YAC5BC,SAAS;QACX;IACF;IAEA,OAAON;AACT"}
|