@metamask/snaps-rpc-methods 11.11.0 → 11.13.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/dist/endowments/caveats/requestTime.cjs +1 -2
  3. package/dist/endowments/caveats/requestTime.cjs.map +1 -1
  4. package/dist/endowments/caveats/requestTime.mjs +1 -2
  5. package/dist/endowments/caveats/requestTime.mjs.map +1 -1
  6. package/dist/endowments/rpc.cjs.map +1 -1
  7. package/dist/endowments/rpc.d.cts.map +1 -1
  8. package/dist/endowments/rpc.d.mts.map +1 -1
  9. package/dist/endowments/rpc.mjs.map +1 -1
  10. package/dist/permitted/getState.cjs.map +1 -1
  11. package/dist/permitted/getState.d.cts +1 -1
  12. package/dist/permitted/getState.d.cts.map +1 -1
  13. package/dist/permitted/getState.d.mts +1 -1
  14. package/dist/permitted/getState.d.mts.map +1 -1
  15. package/dist/permitted/getState.mjs.map +1 -1
  16. package/dist/permitted/handlers.cjs +2 -0
  17. package/dist/permitted/handlers.cjs.map +1 -1
  18. package/dist/permitted/handlers.d.cts +2 -1
  19. package/dist/permitted/handlers.d.cts.map +1 -1
  20. package/dist/permitted/handlers.d.mts +2 -1
  21. package/dist/permitted/handlers.d.mts.map +1 -1
  22. package/dist/permitted/handlers.mjs +2 -0
  23. package/dist/permitted/handlers.mjs.map +1 -1
  24. package/dist/permitted/index.cjs.map +1 -1
  25. package/dist/permitted/index.d.cts +2 -1
  26. package/dist/permitted/index.d.cts.map +1 -1
  27. package/dist/permitted/index.d.mts +2 -1
  28. package/dist/permitted/index.d.mts.map +1 -1
  29. package/dist/permitted/index.mjs.map +1 -1
  30. package/dist/permitted/invokeKeyring.cjs.map +1 -1
  31. package/dist/permitted/invokeKeyring.d.cts.map +1 -1
  32. package/dist/permitted/invokeKeyring.d.mts.map +1 -1
  33. package/dist/permitted/invokeKeyring.mjs.map +1 -1
  34. package/dist/permitted/listEntropySources.cjs +50 -0
  35. package/dist/permitted/listEntropySources.cjs.map +1 -0
  36. package/dist/permitted/listEntropySources.d.cts +19 -0
  37. package/dist/permitted/listEntropySources.d.cts.map +1 -0
  38. package/dist/permitted/listEntropySources.d.mts +19 -0
  39. package/dist/permitted/listEntropySources.d.mts.map +1 -0
  40. package/dist/permitted/listEntropySources.mjs +47 -0
  41. package/dist/permitted/listEntropySources.mjs.map +1 -0
  42. package/dist/permitted/middleware.cjs +1 -1
  43. package/dist/permitted/middleware.cjs.map +1 -1
  44. package/dist/permitted/middleware.mjs +1 -1
  45. package/dist/permitted/middleware.mjs.map +1 -1
  46. package/dist/permitted/resolveInterface.cjs.map +1 -1
  47. package/dist/permitted/resolveInterface.d.cts +1 -1
  48. package/dist/permitted/resolveInterface.d.cts.map +1 -1
  49. package/dist/permitted/resolveInterface.d.mts +1 -1
  50. package/dist/permitted/resolveInterface.d.mts.map +1 -1
  51. package/dist/permitted/resolveInterface.mjs.map +1 -1
  52. package/dist/permitted/scheduleBackgroundEvent.cjs.map +1 -1
  53. package/dist/permitted/scheduleBackgroundEvent.d.cts +1 -2
  54. package/dist/permitted/scheduleBackgroundEvent.d.cts.map +1 -1
  55. package/dist/permitted/scheduleBackgroundEvent.d.mts +1 -2
  56. package/dist/permitted/scheduleBackgroundEvent.d.mts.map +1 -1
  57. package/dist/permitted/scheduleBackgroundEvent.mjs.map +1 -1
  58. package/dist/permitted/setState.cjs +1 -3
  59. package/dist/permitted/setState.cjs.map +1 -1
  60. package/dist/permitted/setState.d.cts +1 -1
  61. package/dist/permitted/setState.d.cts.map +1 -1
  62. package/dist/permitted/setState.d.mts +1 -1
  63. package/dist/permitted/setState.d.mts.map +1 -1
  64. package/dist/permitted/setState.mjs +1 -3
  65. package/dist/permitted/setState.mjs.map +1 -1
  66. package/dist/restricted/caveats/index.cjs +3 -3
  67. package/dist/restricted/caveats/index.cjs.map +1 -1
  68. package/dist/restricted/caveats/index.mjs +3 -3
  69. package/dist/restricted/caveats/index.mjs.map +1 -1
  70. package/dist/restricted/caveats/permittedCoinTypes.cjs +7 -0
  71. package/dist/restricted/caveats/permittedCoinTypes.cjs.map +1 -1
  72. package/dist/restricted/caveats/permittedCoinTypes.d.cts.map +1 -1
  73. package/dist/restricted/caveats/permittedCoinTypes.d.mts.map +1 -1
  74. package/dist/restricted/caveats/permittedCoinTypes.mjs +7 -0
  75. package/dist/restricted/caveats/permittedCoinTypes.mjs.map +1 -1
  76. package/dist/restricted/getBip32Entropy.cjs +2 -1
  77. package/dist/restricted/getBip32Entropy.cjs.map +1 -1
  78. package/dist/restricted/getBip32Entropy.d.cts +7 -2
  79. package/dist/restricted/getBip32Entropy.d.cts.map +1 -1
  80. package/dist/restricted/getBip32Entropy.d.mts +7 -2
  81. package/dist/restricted/getBip32Entropy.d.mts.map +1 -1
  82. package/dist/restricted/getBip32Entropy.mjs +3 -2
  83. package/dist/restricted/getBip32Entropy.mjs.map +1 -1
  84. package/dist/restricted/getBip32PublicKey.cjs +3 -1
  85. package/dist/restricted/getBip32PublicKey.cjs.map +1 -1
  86. package/dist/restricted/getBip32PublicKey.d.cts +9 -2
  87. package/dist/restricted/getBip32PublicKey.d.cts.map +1 -1
  88. package/dist/restricted/getBip32PublicKey.d.mts +9 -2
  89. package/dist/restricted/getBip32PublicKey.d.mts.map +1 -1
  90. package/dist/restricted/getBip32PublicKey.mjs +5 -3
  91. package/dist/restricted/getBip32PublicKey.mjs.map +1 -1
  92. package/dist/restricted/getBip44Entropy.cjs +3 -1
  93. package/dist/restricted/getBip44Entropy.cjs.map +1 -1
  94. package/dist/restricted/getBip44Entropy.d.cts +7 -2
  95. package/dist/restricted/getBip44Entropy.d.cts.map +1 -1
  96. package/dist/restricted/getBip44Entropy.d.mts +7 -2
  97. package/dist/restricted/getBip44Entropy.d.mts.map +1 -1
  98. package/dist/restricted/getBip44Entropy.mjs +3 -1
  99. package/dist/restricted/getBip44Entropy.mjs.map +1 -1
  100. package/dist/restricted/getEntropy.cjs +2 -1
  101. package/dist/restricted/getEntropy.cjs.map +1 -1
  102. package/dist/restricted/getEntropy.d.cts +9 -2
  103. package/dist/restricted/getEntropy.d.cts.map +1 -1
  104. package/dist/restricted/getEntropy.d.mts +9 -2
  105. package/dist/restricted/getEntropy.d.mts.map +1 -1
  106. package/dist/restricted/getEntropy.mjs +3 -2
  107. package/dist/restricted/getEntropy.mjs.map +1 -1
  108. package/dist/restricted/index.d.cts +2 -2
  109. package/dist/restricted/index.d.mts +2 -2
  110. package/dist/restricted/notify.cjs.map +1 -1
  111. package/dist/restricted/notify.d.cts +4 -14
  112. package/dist/restricted/notify.d.cts.map +1 -1
  113. package/dist/restricted/notify.d.mts +4 -14
  114. package/dist/restricted/notify.d.mts.map +1 -1
  115. package/dist/restricted/notify.mjs.map +1 -1
  116. package/dist/utils.cjs +29 -1
  117. package/dist/utils.cjs.map +1 -1
  118. package/dist/utils.d.cts +9 -0
  119. package/dist/utils.d.cts.map +1 -1
  120. package/dist/utils.d.mts +9 -0
  121. package/dist/utils.d.mts.map +1 -1
  122. package/dist/utils.mjs +27 -0
  123. package/dist/utils.mjs.map +1 -1
  124. package/package.json +10 -24
package/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [11.13.0]
11
+
12
+ ### Added
13
+
14
+ - Implement SIP-30 ([#3156](https://github.com/MetaMask/snaps/pull/3156), [#3165](https://github.com/MetaMask/snaps/pull/3165))
15
+ - This adds a `snap_listEntropySources` method, which returns a list of
16
+ entropy sources.
17
+ - The `snap_get*Entropy` methods now accept an optional `source` parameter to
18
+ specify the entropy source to use.
19
+
20
+ ## [11.12.0]
21
+
22
+ ### Added
23
+
24
+ - Add additional properties to `snap_getPreferences` ([#3093](https://github.com/MetaMask/snaps/pull/3093))
25
+
26
+ ### Changed
27
+
28
+ - Bump MetaMask dependencies ([#3091](https://github.com/MetaMask/snaps/pull/3091), [#3082](https://github.com/MetaMask/snaps/pull/3082), [#3050](https://github.com/MetaMask/snaps/pull/3050))
29
+
10
30
  ## [11.11.0]
11
31
 
12
32
  ### Added
@@ -380,7 +400,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
380
400
  - The version of the package no longer needs to match the version of all other
381
401
  MetaMask Snaps packages.
382
402
 
383
- [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@11.11.0...HEAD
403
+ [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@11.13.0...HEAD
404
+ [11.13.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@11.12.0...@metamask/snaps-rpc-methods@11.13.0
405
+ [11.12.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@11.11.0...@metamask/snaps-rpc-methods@11.12.0
384
406
  [11.11.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@11.10.0...@metamask/snaps-rpc-methods@11.11.0
385
407
  [11.10.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@11.9.1...@metamask/snaps-rpc-methods@11.10.0
386
408
  [11.9.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-rpc-methods@11.9.0...@metamask/snaps-rpc-methods@11.9.1
@@ -12,8 +12,7 @@ const utils_1 = require("@metamask/utils");
12
12
  * {@link AssertionError}.
13
13
  * @throws If the value is not a valid `maxRequestTime` value.
14
14
  */
15
- function assertIsMaxRequestTime(value, // eslint-disable-next-line @typescript-eslint/naming-convention
16
- ErrorWrapper) {
15
+ function assertIsMaxRequestTime(value, ErrorWrapper) {
17
16
  (0, utils_1.assertStruct)(value, snaps_utils_1.MaxRequestTimeStruct, 'Invalid maxRequestTime', ErrorWrapper);
18
17
  }
19
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"requestTime.cjs","sourceRoot":"","sources":["../../../src/endowments/caveats/requestTime.ts"],"names":[],"mappings":";;;AAK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IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO,YAAY,CAAC;QACtB,CAAC;QAED,OAAO;YACL,GAAG,YAAY;YACf,OAAO,EAAE;gBACP,GAAG,CAAC,YAAY,CAAC,OAAO,IAAI,EAAE,CAAC;gBAC/B;oBACE,IAAI,EAAE,4BAAc,CAAC,cAAc;oBACnC,KAAK,EAAE,cAAc;iBACtB;aACF;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAxBD,gEAwBC;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,UAAiC;IAEjC,MAAM,WAAW,GAAG,UAAU,EAAE,OAAO,EAAE,IAAI,CAC3C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,4BAAc,CAAC,cAAc,CAC1D,CAAC;IACF,OAAQ,WAAW,EAAE,KAAgB,IAAI,IAAI,CAAC;AAChD,CAAC;AAPD,0DAOC;AAEY,QAAA,kCAAkC,GAG3C;IACF,CAAC,4BAAc,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC;QAC7C,IAAI,EAAE,4BAAc,CAAC,cAAc;QACnC,SAAS,EAAE,CAAC,MAA2B,EAAE,EAAE,CACzC,4BAA4B,CAAC,MAAM,CAAC;KACvC,CAAC;CACH,CAAC","sourcesContent":["import type {\n Caveat,\n CaveatSpecificationConstraint,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport { MaxRequestTimeStruct, SnapCaveatType } from '@metamask/snaps-utils';\nimport type { AssertionErrorConstructor, Json } from '@metamask/utils';\nimport { assertStruct, hasProperty, isObject } from '@metamask/utils';\n\nimport type { CaveatMapperFunction, CaveatMapperReturnValue } from './generic';\n\n/**\n * Asserts that the given value is a valid `maxRequestTime` value.\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 `maxRequestTime` value.\n */\nfunction assertIsMaxRequestTime(\n value: unknown, // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is number {\n assertStruct(\n value,\n MaxRequestTimeStruct,\n 'Invalid maxRequestTime',\n ErrorWrapper,\n );\n}\n\n/**\n * Validate the value of a caveat. This does not validate the type of the\n * caveat itself, only the value of the caveat.\n *\n * @param caveat - The caveat to validate.\n * @throws If the caveat value is invalid.\n */\nfunction validateMaxRequestTimeCaveat(caveat: Caveat<string, any>) {\n if (!hasProperty(caveat, 'value')) {\n throw rpcErrors.invalidParams({\n message: 'Invalid maxRequestTime caveat.',\n });\n }\n\n const { value } = caveat;\n assertIsMaxRequestTime(value, rpcErrors.invalidParams);\n}\n\n/**\n * Map a raw value from the `initialPermissions` to a caveat specification.\n * Note that this function does not do any validation, that's handled by the\n * PermissionsController when the permission is requested.\n *\n * @param value - The raw value from the `initialPermissions`.\n * @returns The caveat specification.\n */\nexport function getMaxRequestTimeCaveatMapper(\n value: Json,\n): CaveatMapperReturnValue {\n if (\n !value ||\n !isObject(value) ||\n (isObject(value) && !hasProperty(value, 'maxRequestTime'))\n ) {\n return { caveats: null };\n }\n return {\n caveats: [\n {\n type: SnapCaveatType.MaxRequestTime,\n value: value.maxRequestTime,\n },\n ],\n };\n}\n\n/**\n * Creates a wrapping caveat mapper that creates the `maxRequestTime` caveat\n * and merges it with any other caveats created by the mapper function.\n *\n * @param mapper - Another caveat mapper function.\n * @returns The caveat specification.\n */\nexport function createMaxRequestTimeMapper(\n mapper: CaveatMapperFunction,\n): CaveatMapperFunction {\n return function (value: Json) {\n // We assume this to be used only with caveats of this type\n const { maxRequestTime, ...rest } = value as Record<string, Json>;\n\n const mapperResult = mapper(rest);\n\n if (!maxRequestTime) {\n return mapperResult;\n }\n\n return {\n ...mapperResult,\n caveats: [\n ...(mapperResult.caveats ?? []),\n {\n type: SnapCaveatType.MaxRequestTime,\n value: maxRequestTime,\n },\n ],\n };\n };\n}\n\n/**\n * Getter function to get the {@link MaxRequestTime} caveat value from a permission if specified.\n *\n * @param permission - The permission to get the caveat value from.\n * @returns The caveat value if present, otherwise null.\n */\nexport function getMaxRequestTimeCaveat(\n permission?: PermissionConstraint,\n): number | null {\n const foundCaveat = permission?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.MaxRequestTime,\n );\n return (foundCaveat?.value as number) ?? null;\n}\n\nexport const maxRequestTimeCaveatSpecifications: Record<\n SnapCaveatType.MaxRequestTime,\n CaveatSpecificationConstraint\n> = {\n [SnapCaveatType.MaxRequestTime]: Object.freeze({\n type: SnapCaveatType.MaxRequestTime,\n validator: (caveat: Caveat<string, any>) =>\n validateMaxRequestTimeCaveat(caveat),\n }),\n};\n"]}
1
+ {"version":3,"file":"requestTime.cjs","sourceRoot":"","sources":["../../../src/endowments/caveats/requestTime.ts"],"names":[],"mappings":";;;AAKA,qDAAiD;AACjD,uDAA6E;AAE7E,2CAAsE;AAItE;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAC7B,KAAc,EACd,YAAwC;IAExC,IAAA,oBAAY,EACV,KAAK,EACL,kCAAoB,EACpB,wBAAwB,EACxB,YAAY,CACb,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,4BAA4B,CAAC,MAA2B;IAC/D,IAAI,CAAC,IAAA,mBAAW,EAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;QAClC,MAAM,sBAAS,CAAC,aAAa,CAAC;YAC5B,OAAO,EAAE,gCAAgC;SAC1C,CAAC,CAAC;IACL,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACzB,sBAAsB,CAAC,KAAK,EAAE,sBAAS,CAAC,aAAa,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,6BAA6B,CAC3C,KAAW;IAEX,IACE,CAAC,KAAK;QACN,CAAC,IAAA,gBAAQ,EAAC,KAAK,CAAC;QAChB,CAAC,IAAA,gBAAQ,EAAC,KAAK,C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nC,SAAS,EAAE,CAAC,MAA2B,EAAE,EAAE,CACzC,4BAA4B,CAAC,MAAM,CAAC;KACvC,CAAC;CACH,CAAC","sourcesContent":["import type {\n Caveat,\n CaveatSpecificationConstraint,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport { MaxRequestTimeStruct, SnapCaveatType } from '@metamask/snaps-utils';\nimport type { AssertionErrorConstructor, Json } from '@metamask/utils';\nimport { assertStruct, hasProperty, isObject } from '@metamask/utils';\n\nimport type { CaveatMapperFunction, CaveatMapperReturnValue } from './generic';\n\n/**\n * Asserts that the given value is a valid `maxRequestTime` value.\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 `maxRequestTime` value.\n */\nfunction assertIsMaxRequestTime(\n value: unknown,\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is number {\n assertStruct(\n value,\n MaxRequestTimeStruct,\n 'Invalid maxRequestTime',\n ErrorWrapper,\n );\n}\n\n/**\n * Validate the value of a caveat. This does not validate the type of the\n * caveat itself, only the value of the caveat.\n *\n * @param caveat - The caveat to validate.\n * @throws If the caveat value is invalid.\n */\nfunction validateMaxRequestTimeCaveat(caveat: Caveat<string, any>) {\n if (!hasProperty(caveat, 'value')) {\n throw rpcErrors.invalidParams({\n message: 'Invalid maxRequestTime caveat.',\n });\n }\n\n const { value } = caveat;\n assertIsMaxRequestTime(value, rpcErrors.invalidParams);\n}\n\n/**\n * Map a raw value from the `initialPermissions` to a caveat specification.\n * Note that this function does not do any validation, that's handled by the\n * PermissionsController when the permission is requested.\n *\n * @param value - The raw value from the `initialPermissions`.\n * @returns The caveat specification.\n */\nexport function getMaxRequestTimeCaveatMapper(\n value: Json,\n): CaveatMapperReturnValue {\n if (\n !value ||\n !isObject(value) ||\n (isObject(value) && !hasProperty(value, 'maxRequestTime'))\n ) {\n return { caveats: null };\n }\n return {\n caveats: [\n {\n type: SnapCaveatType.MaxRequestTime,\n value: value.maxRequestTime,\n },\n ],\n };\n}\n\n/**\n * Creates a wrapping caveat mapper that creates the `maxRequestTime` caveat\n * and merges it with any other caveats created by the mapper function.\n *\n * @param mapper - Another caveat mapper function.\n * @returns The caveat specification.\n */\nexport function createMaxRequestTimeMapper(\n mapper: CaveatMapperFunction,\n): CaveatMapperFunction {\n return function (value: Json) {\n // We assume this to be used only with caveats of this type\n const { maxRequestTime, ...rest } = value as Record<string, Json>;\n\n const mapperResult = mapper(rest);\n\n if (!maxRequestTime) {\n return mapperResult;\n }\n\n return {\n ...mapperResult,\n caveats: [\n ...(mapperResult.caveats ?? []),\n {\n type: SnapCaveatType.MaxRequestTime,\n value: maxRequestTime,\n },\n ],\n };\n };\n}\n\n/**\n * Getter function to get the {@link MaxRequestTime} caveat value from a permission if specified.\n *\n * @param permission - The permission to get the caveat value from.\n * @returns The caveat value if present, otherwise null.\n */\nexport function getMaxRequestTimeCaveat(\n permission?: PermissionConstraint,\n): number | null {\n const foundCaveat = permission?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.MaxRequestTime,\n );\n return (foundCaveat?.value as number) ?? null;\n}\n\nexport const maxRequestTimeCaveatSpecifications: Record<\n SnapCaveatType.MaxRequestTime,\n CaveatSpecificationConstraint\n> = {\n [SnapCaveatType.MaxRequestTime]: Object.freeze({\n type: SnapCaveatType.MaxRequestTime,\n validator: (caveat: Caveat<string, any>) =>\n validateMaxRequestTimeCaveat(caveat),\n }),\n};\n"]}
@@ -9,8 +9,7 @@ import { assertStruct, hasProperty, isObject } from "@metamask/utils";
9
9
  * {@link AssertionError}.
10
10
  * @throws If the value is not a valid `maxRequestTime` value.
11
11
  */
12
- function assertIsMaxRequestTime(value, // eslint-disable-next-line @typescript-eslint/naming-convention
13
- ErrorWrapper) {
12
+ function assertIsMaxRequestTime(value, ErrorWrapper) {
14
13
  assertStruct(value, MaxRequestTimeStruct, 'Invalid maxRequestTime', ErrorWrapper);
15
14
  }
16
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"requestTime.mjs","sourceRoot":"","sources":["../../../src/endowments/caveats/requestTime.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AACjD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,8BAA8B;AAE7E,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,wBAAwB;AAItE;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAC7B,KAAc,EAAE,gEAAgE;AAChF,YAAwC;IAExC,YAAY,CACV,KAAK,EACL,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,CACb,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,4BAA4B,CAAC,MAA2B;IAC/D,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;QAClC,MAAM,SAAS,CAAC,aAAa,CAAC;YAC5B,OAAO,EAAE,gCAAgC;SAC1C,CAAC,CAAC;IACL,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACzB,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,KAAW;IAEX,IACE,CAAC,KAAK;QACN,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChB,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAC1D,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,cAAc,CAAC,cAAc;gBACnC,KAAK,EAAE,KAAK,CAAC,cAAc;aAC5B;SACF;KACF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,MAA4B;IAE5B,OAAO,UAAU,KAAW;QAC1B,2DAA2D;QAC3D,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,KAA6B,CAAC;QAElE,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAElC,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO,YAAY,CAAC;QACtB,CAAC;QAED,OAAO;YACL,GAAG,YAAY;YACf,OAAO,EAAE;gBACP,GAAG,CAAC,YAAY,CAAC,OAAO,IAAI,EAAE,CAAC;gBAC/B;oBACE,IAAI,EAAE,cAAc,CAAC,cAAc;oBACnC,KAAK,EAAE,cAAc;iBACtB;aACF;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAiC;IAEjC,MAAM,WAAW,GAAG,UAAU,EAAE,OAAO,EAAE,IAAI,CAC3C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,CAC1D,CAAC;IACF,OAAQ,WAAW,EAAE,KAAgB,IAAI,IAAI,CAAC;AAChD,CAAC;AAED,MAAM,CAAC,MAAM,kCAAkC,GAG3C;IACF,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC;QAC7C,IAAI,EAAE,cAAc,CAAC,cAAc;QACnC,SAAS,EAAE,CAAC,MAA2B,EAAE,EAAE,CACzC,4BAA4B,CAAC,MAAM,CAAC;KACvC,CAAC;CACH,CAAC","sourcesContent":["import type {\n Caveat,\n CaveatSpecificationConstraint,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport { MaxRequestTimeStruct, SnapCaveatType } from '@metamask/snaps-utils';\nimport type { AssertionErrorConstructor, Json } from '@metamask/utils';\nimport { assertStruct, hasProperty, isObject } from '@metamask/utils';\n\nimport type { CaveatMapperFunction, CaveatMapperReturnValue } from './generic';\n\n/**\n * Asserts that the given value is a valid `maxRequestTime` value.\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 `maxRequestTime` value.\n */\nfunction assertIsMaxRequestTime(\n value: unknown, // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is number {\n assertStruct(\n value,\n MaxRequestTimeStruct,\n 'Invalid maxRequestTime',\n ErrorWrapper,\n );\n}\n\n/**\n * Validate the value of a caveat. This does not validate the type of the\n * caveat itself, only the value of the caveat.\n *\n * @param caveat - The caveat to validate.\n * @throws If the caveat value is invalid.\n */\nfunction validateMaxRequestTimeCaveat(caveat: Caveat<string, any>) {\n if (!hasProperty(caveat, 'value')) {\n throw rpcErrors.invalidParams({\n message: 'Invalid maxRequestTime caveat.',\n });\n }\n\n const { value } = caveat;\n assertIsMaxRequestTime(value, rpcErrors.invalidParams);\n}\n\n/**\n * Map a raw value from the `initialPermissions` to a caveat specification.\n * Note that this function does not do any validation, that's handled by the\n * PermissionsController when the permission is requested.\n *\n * @param value - The raw value from the `initialPermissions`.\n * @returns The caveat specification.\n */\nexport function getMaxRequestTimeCaveatMapper(\n value: Json,\n): CaveatMapperReturnValue {\n if (\n !value ||\n !isObject(value) ||\n (isObject(value) && !hasProperty(value, 'maxRequestTime'))\n ) {\n return { caveats: null };\n }\n return {\n caveats: [\n {\n type: SnapCaveatType.MaxRequestTime,\n value: value.maxRequestTime,\n },\n ],\n };\n}\n\n/**\n * Creates a wrapping caveat mapper that creates the `maxRequestTime` caveat\n * and merges it with any other caveats created by the mapper function.\n *\n * @param mapper - Another caveat mapper function.\n * @returns The caveat specification.\n */\nexport function createMaxRequestTimeMapper(\n mapper: CaveatMapperFunction,\n): CaveatMapperFunction {\n return function (value: Json) {\n // We assume this to be used only with caveats of this type\n const { maxRequestTime, ...rest } = value as Record<string, Json>;\n\n const mapperResult = mapper(rest);\n\n if (!maxRequestTime) {\n return mapperResult;\n }\n\n return {\n ...mapperResult,\n caveats: [\n ...(mapperResult.caveats ?? []),\n {\n type: SnapCaveatType.MaxRequestTime,\n value: maxRequestTime,\n },\n ],\n };\n };\n}\n\n/**\n * Getter function to get the {@link MaxRequestTime} caveat value from a permission if specified.\n *\n * @param permission - The permission to get the caveat value from.\n * @returns The caveat value if present, otherwise null.\n */\nexport function getMaxRequestTimeCaveat(\n permission?: PermissionConstraint,\n): number | null {\n const foundCaveat = permission?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.MaxRequestTime,\n );\n return (foundCaveat?.value as number) ?? null;\n}\n\nexport const maxRequestTimeCaveatSpecifications: Record<\n SnapCaveatType.MaxRequestTime,\n CaveatSpecificationConstraint\n> = {\n [SnapCaveatType.MaxRequestTime]: Object.freeze({\n type: SnapCaveatType.MaxRequestTime,\n validator: (caveat: Caveat<string, any>) =>\n validateMaxRequestTimeCaveat(caveat),\n }),\n};\n"]}
1
+ {"version":3,"file":"requestTime.mjs","sourceRoot":"","sources":["../../../src/endowments/caveats/requestTime.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AACjD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,8BAA8B;AAE7E,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,wBAAwB;AAItE;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAC7B,KAAc,EACd,YAAwC;IAExC,YAAY,CACV,KAAK,EACL,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,CACb,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,4BAA4B,CAAC,MAA2B;IAC/D,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;QAClC,MAAM,SAAS,CAAC,aAAa,CAAC;YAC5B,OAAO,EAAE,gCAAgC;SAC1C,CAAC,CAAC;IACL,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,G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F,OAAQ,WAAW,EAAE,KAAgB,IAAI,IAAI,CAAC;AAChD,CAAC;AAED,MAAM,CAAC,MAAM,kCAAkC,GAG3C;IACF,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC;QAC7C,IAAI,EAAE,cAAc,CAAC,cAAc;QACnC,SAAS,EAAE,CAAC,MAA2B,EAAE,EAAE,CACzC,4BAA4B,CAAC,MAAM,CAAC;KACvC,CAAC;CACH,CAAC","sourcesContent":["import type {\n Caveat,\n CaveatSpecificationConstraint,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport { MaxRequestTimeStruct, SnapCaveatType } from '@metamask/snaps-utils';\nimport type { AssertionErrorConstructor, Json } from '@metamask/utils';\nimport { assertStruct, hasProperty, isObject } from '@metamask/utils';\n\nimport type { CaveatMapperFunction, CaveatMapperReturnValue } from './generic';\n\n/**\n * Asserts that the given value is a valid `maxRequestTime` value.\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 `maxRequestTime` value.\n */\nfunction assertIsMaxRequestTime(\n value: unknown,\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is number {\n assertStruct(\n value,\n MaxRequestTimeStruct,\n 'Invalid maxRequestTime',\n ErrorWrapper,\n );\n}\n\n/**\n * Validate the value of a caveat. This does not validate the type of the\n * caveat itself, only the value of the caveat.\n *\n * @param caveat - The caveat to validate.\n * @throws If the caveat value is invalid.\n */\nfunction validateMaxRequestTimeCaveat(caveat: Caveat<string, any>) {\n if (!hasProperty(caveat, 'value')) {\n throw rpcErrors.invalidParams({\n message: 'Invalid maxRequestTime caveat.',\n });\n }\n\n const { value } = caveat;\n assertIsMaxRequestTime(value, rpcErrors.invalidParams);\n}\n\n/**\n * Map a raw value from the `initialPermissions` to a caveat specification.\n * Note that this function does not do any validation, that's handled by the\n * PermissionsController when the permission is requested.\n *\n * @param value - The raw value from the `initialPermissions`.\n * @returns The caveat specification.\n */\nexport function getMaxRequestTimeCaveatMapper(\n value: Json,\n): CaveatMapperReturnValue {\n if (\n !value ||\n !isObject(value) ||\n (isObject(value) && !hasProperty(value, 'maxRequestTime'))\n ) {\n return { caveats: null };\n }\n return {\n caveats: [\n {\n type: SnapCaveatType.MaxRequestTime,\n value: value.maxRequestTime,\n },\n ],\n };\n}\n\n/**\n * Creates a wrapping caveat mapper that creates the `maxRequestTime` caveat\n * and merges it with any other caveats created by the mapper function.\n *\n * @param mapper - Another caveat mapper function.\n * @returns The caveat specification.\n */\nexport function createMaxRequestTimeMapper(\n mapper: CaveatMapperFunction,\n): CaveatMapperFunction {\n return function (value: Json) {\n // We assume this to be used only with caveats of this type\n const { maxRequestTime, ...rest } = value as Record<string, Json>;\n\n const mapperResult = mapper(rest);\n\n if (!maxRequestTime) {\n return mapperResult;\n }\n\n return {\n ...mapperResult,\n caveats: [\n ...(mapperResult.caveats ?? []),\n {\n type: SnapCaveatType.MaxRequestTime,\n value: maxRequestTime,\n },\n ],\n };\n };\n}\n\n/**\n * Getter function to get the {@link MaxRequestTime} caveat value from a permission if specified.\n *\n * @param permission - The permission to get the caveat value from.\n * @returns The caveat value if present, otherwise null.\n */\nexport function getMaxRequestTimeCaveat(\n permission?: PermissionConstraint,\n): number | null {\n const foundCaveat = permission?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.MaxRequestTime,\n );\n return (foundCaveat?.value as number) ?? null;\n}\n\nexport const maxRequestTimeCaveatSpecifications: Record<\n SnapCaveatType.MaxRequestTime,\n CaveatSpecificationConstraint\n> = {\n [SnapCaveatType.MaxRequestTime]: Object.freeze({\n type: SnapCaveatType.MaxRequestTime,\n validator: (caveat: Caveat<string, any>) =>\n validateMaxRequestTimeCaveat(caveat),\n }),\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.cjs","sourceRoot":"","sources":["../../src/endowments/rpc.ts"],"names":[],"mappings":";;;AASA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gBACE,IAAI,EAAE,4BAAc,CAAC,SAAS;gBAC9B,KAAK;aACN;SACF;KACF,CAAC;AACJ,CAAC;AAXD,gDAWC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,UAAiC;IAEjC,MAAM,OAAO,GAAG,UAAU,EAAE,OAAO,EAAE,MAAM,CACzC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,4BAAc,CAAC,SAAS,CACrD,CAAC;IACF,IAAA,cAAM,EAAC,OAAO,CAAC,CAAC;IAChB,IAAA,cAAM,EAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;IAE7B,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAA+B,CAAC;IACxD,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,CAAC;AAXD,kDAWC;AAEY,QAAA,uBAAuB,GAGhC;IACF,CAAC,4BAAc,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC;QACxC,IAAI,EAAE,4BAAc,CAAC,SAAS;QAC9B,SAAS,EAAE,CAAC,MAA2B,EAAE,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC;KAC1E,CAAC;CACH,CAAC","sourcesContent":["import type {\n Caveat,\n CaveatSpecificationConstraint,\n EndowmentGetterParams,\n PermissionConstraint,\n PermissionSpecificationBuilder,\n PermissionValidatorConstraint,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { RpcOrigins } from '@metamask/snaps-utils';\nimport { assertIsRpcOrigins, SnapCaveatType } from '@metamask/snaps-utils';\nimport type { Json, NonEmptyArray } from '@metamask/utils';\nimport { hasProperty, isPlainObject, assert } from '@metamask/utils';\n\nimport { createGenericPermissionValidator } from './caveats';\nimport { SnapEndowments } from './enum';\n\nconst targetName = SnapEndowments.Rpc;\n\ntype RpcSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.Endowment;\n targetName: typeof targetName;\n endowmentGetter: (_options?: any) => null;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n validator: PermissionValidatorConstraint;\n subjectTypes: readonly SubjectType[];\n}>;\n\ntype RpcSpecificationBuilderOptions = {\n // Empty for now.\n};\n\n/**\n * The specification builder for the JSON-RPC endowment permission.\n *\n * @param _builderOptions - Optional specification builder options.\n * @returns The specification for the JSON-RPC endowment permission.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.Endowment,\n RpcSpecificationBuilderOptions,\n RpcSpecification\n> = (_builderOptions?: any): RpcSpecification => {\n return {\n permissionType: PermissionType.Endowment,\n targetName,\n allowedCaveats: [SnapCaveatType.RpcOrigin, SnapCaveatType.MaxRequestTime],\n endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,\n validator: createGenericPermissionValidator([\n { type: SnapCaveatType.RpcOrigin },\n { type: SnapCaveatType.MaxRequestTime, optional: true },\n ]),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nexport const rpcEndowmentBuilder = Object.freeze({\n targetName,\n specificationBuilder,\n} as const);\n\n/**\n * Validate the value of a caveat. This does not validate the type of the\n * caveat itself, only the value of the caveat.\n *\n * @param caveat - The caveat to validate.\n * @throws If the caveat value is invalid.\n */\nfunction validateCaveatOrigins(caveat: Caveat<string, any>) {\n if (!hasProperty(caveat, 'value') || !isPlainObject(caveat.value)) {\n throw rpcErrors.invalidParams({\n message: 'Invalid JSON-RPC origins: Expected a plain object.',\n });\n }\n\n const { value } = caveat;\n assertIsRpcOrigins(value, rpcErrors.invalidParams);\n}\n\n/**\n * Map a raw value from the `initialPermissions` to a caveat specification.\n * Note that this function does not do any validation, that's handled by the\n * PermissionsController when the permission is requested.\n *\n * @param value - The raw value from the `initialPermissions`.\n * @returns The caveat specification.\n */\nexport function getRpcCaveatMapper(\n value: Json,\n): Pick<PermissionConstraint, 'caveats'> {\n return {\n caveats: [\n {\n type: SnapCaveatType.RpcOrigin,\n value,\n },\n ],\n };\n}\n\n/**\n * Getter function to get the {@link RpcOrigins} caveat value from a permission.\n *\n * @param permission - The permission to get the caveat value from.\n * @returns The caveat value.\n * @throws If the permission does not have a valid {@link RpcOrigins} caveat.\n */\nexport function getRpcCaveatOrigins(\n permission?: PermissionConstraint,\n): RpcOrigins | null {\n const caveats = permission?.caveats?.filter(\n (caveat) => caveat.type === SnapCaveatType.RpcOrigin,\n );\n assert(caveats);\n assert(caveats.length === 1);\n\n const caveat = caveats[0] as Caveat<string, RpcOrigins>;\n return caveat.value;\n}\n\nexport const rpcCaveatSpecifications: Record<\n SnapCaveatType.RpcOrigin,\n CaveatSpecificationConstraint\n> = {\n [SnapCaveatType.RpcOrigin]: Object.freeze({\n type: SnapCaveatType.RpcOrigin,\n validator: (caveat: Caveat<string, any>) => validateCaveatOrigins(caveat),\n }),\n};\n"]}
1
+ {"version":3,"file":"rpc.cjs","sourceRoot":"","sources":["../../src/endowments/rpc.ts"],"names":[],"mappings":";;;AASA,2EAA8E;AAC9E,qDAAiD;AAEjD,uDAA2E;AAE3E,2CAAqE;AAErE,iDAA6D;AAC7D,qCAAwC;AAExC,MAAM,UAAU,GAAG,qBAAc,CAAC,GAAG,CAAC;AAkBtC;;;;;GAKG;AACH,MAAM,oBAAoB,GAItB,CAAC,eAAqB,EAAoB,EAAE;IAC9C,OAAO;QACL,cAAc,EAAE,sCAAc,CAAC,SAAS;QACxC,UAAU;QACV,cAAc,EAAE,CAAC,4BAAc,CAAC,SAAS,EAAE,4BAAc,CAAC,cAAc,CAAC;QACzE,eAAe,EAAE,CAAC,cAAsC,EAAE,EAAE,CAAC,IAAI;QACjE,SAAS,EAAE,IAAA,0CAAgC,EAAC;YAC1C,EAAE,IAAI,EAAE,4BAAc,CAAC,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,4BAAc,CAAC,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE;SACxD,CAAC;QACF,YAAY,EAAE,CAAC,mCAAW,CAAC,IAA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AC;QACxC,IAAI,EAAE,4BAAc,CAAC,SAAS;QAC9B,SAAS,EAAE,CAAC,MAA2B,EAAE,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC;KAC1E,CAAC;CACH,CAAC","sourcesContent":["import type {\n Caveat,\n CaveatSpecificationConstraint,\n EndowmentGetterParams,\n PermissionConstraint,\n PermissionSpecificationBuilder,\n PermissionValidatorConstraint,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { RpcOrigins } from '@metamask/snaps-utils';\nimport { assertIsRpcOrigins, SnapCaveatType } from '@metamask/snaps-utils';\nimport type { Json, NonEmptyArray } from '@metamask/utils';\nimport { hasProperty, isPlainObject, assert } from '@metamask/utils';\n\nimport { createGenericPermissionValidator } from './caveats';\nimport { SnapEndowments } from './enum';\n\nconst targetName = SnapEndowments.Rpc;\n\ntype RpcSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.Endowment;\n targetName: typeof targetName;\n endowmentGetter: (_options?: any) => null;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n validator: PermissionValidatorConstraint;\n subjectTypes: readonly SubjectType[];\n}>;\n\n// TODO: Either fix this lint violation or explain why it's necessary to\n// ignore.\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ntype RpcSpecificationBuilderOptions = {\n // Empty for now.\n};\n\n/**\n * The specification builder for the JSON-RPC endowment permission.\n *\n * @param _builderOptions - Optional specification builder options.\n * @returns The specification for the JSON-RPC endowment permission.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.Endowment,\n RpcSpecificationBuilderOptions,\n RpcSpecification\n> = (_builderOptions?: any): RpcSpecification => {\n return {\n permissionType: PermissionType.Endowment,\n targetName,\n allowedCaveats: [SnapCaveatType.RpcOrigin, SnapCaveatType.MaxRequestTime],\n endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,\n validator: createGenericPermissionValidator([\n { type: SnapCaveatType.RpcOrigin },\n { type: SnapCaveatType.MaxRequestTime, optional: true },\n ]),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nexport const rpcEndowmentBuilder = Object.freeze({\n targetName,\n specificationBuilder,\n} as const);\n\n/**\n * Validate the value of a caveat. This does not validate the type of the\n * caveat itself, only the value of the caveat.\n *\n * @param caveat - The caveat to validate.\n * @throws If the caveat value is invalid.\n */\nfunction validateCaveatOrigins(caveat: Caveat<string, any>) {\n if (!hasProperty(caveat, 'value') || !isPlainObject(caveat.value)) {\n throw rpcErrors.invalidParams({\n message: 'Invalid JSON-RPC origins: Expected a plain object.',\n });\n }\n\n const { value } = caveat;\n assertIsRpcOrigins(value, rpcErrors.invalidParams);\n}\n\n/**\n * Map a raw value from the `initialPermissions` to a caveat specification.\n * Note that this function does not do any validation, that's handled by the\n * PermissionsController when the permission is requested.\n *\n * @param value - The raw value from the `initialPermissions`.\n * @returns The caveat specification.\n */\nexport function getRpcCaveatMapper(\n value: Json,\n): Pick<PermissionConstraint, 'caveats'> {\n return {\n caveats: [\n {\n type: SnapCaveatType.RpcOrigin,\n value,\n },\n ],\n };\n}\n\n/**\n * Getter function to get the {@link RpcOrigins} caveat value from a permission.\n *\n * @param permission - The permission to get the caveat value from.\n * @returns The caveat value.\n * @throws If the permission does not have a valid {@link RpcOrigins} caveat.\n */\nexport function getRpcCaveatOrigins(\n permission?: PermissionConstraint,\n): RpcOrigins | null {\n const caveats = permission?.caveats?.filter(\n (caveat) => caveat.type === SnapCaveatType.RpcOrigin,\n );\n assert(caveats);\n assert(caveats.length === 1);\n\n const caveat = caveats[0] as Caveat<string, RpcOrigins>;\n return caveat.value;\n}\n\nexport const rpcCaveatSpecifications: Record<\n SnapCaveatType.RpcOrigin,\n CaveatSpecificationConstraint\n> = {\n [SnapCaveatType.RpcOrigin]: Object.freeze({\n type: SnapCaveatType.RpcOrigin,\n validator: (caveat: Caveat<string, any>) => validateCaveatOrigins(caveat),\n }),\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.d.cts","sourceRoot":"","sources":["../../src/endowments/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,6BAA6B,EAE7B,oBAAoB,EACpB,8BAA8B,EAC9B,6BAA6B,EAE9B,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,wCAAwC;AAE9E,OAAO,KAAK,EAAE,UAAU,EAAE,8BAA8B;AACxD,OAAO,EAAsB,cAAc,EAAE,8BAA8B;AAC3E,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,wBAAwB;AAI3D,OAAO,EAAE,cAAc,EAAE,mBAAe;AAExC,QAAA,MAAM,UAAU,qBAAqB,CAAC;AAWtC,KAAK,8BAA8B,GAAG,EAErC,CAAC;AA0BF,eAAO,MAAM,mBAAmB;;;wBApCd,eAAe,SAAS;oBAC5B,iBAAiB;qCACA,GAAG,KAAK,IAAI;wBACzB,SAAS,cAAc,MAAM,CAAC,CAAC,GAAG,IAAI;mBAC3C,6BAA6B;sBAC1B,SAAS,WAAW,EAAE;;EAkC3B,CAAC;AAoBZ;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,IAAI,GACV,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,CASvC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,CAAC,EAAE,oBAAoB,GAChC,UAAU,GAAG,IAAI,CASnB;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,cAAc,CAAC,SAAS,EACxB,6BAA6B,CAM9B,CAAC"}
1
+ {"version":3,"file":"rpc.d.cts","sourceRoot":"","sources":["../../src/endowments/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,6BAA6B,EAE7B,oBAAoB,EACpB,8BAA8B,EAC9B,6BAA6B,EAE9B,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,wCAAwC;AAE9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AAqB,CAAC,MAAM,CAAC;KAC1E,CAAC;CACH,CAAC","sourcesContent":["import type {\n Caveat,\n CaveatSpecificationConstraint,\n EndowmentGetterParams,\n PermissionConstraint,\n PermissionSpecificationBuilder,\n PermissionValidatorConstraint,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { RpcOrigins } from '@metamask/snaps-utils';\nimport { assertIsRpcOrigins, SnapCaveatType } from '@metamask/snaps-utils';\nimport type { Json, NonEmptyArray } from '@metamask/utils';\nimport { hasProperty, isPlainObject, assert } from '@metamask/utils';\n\nimport { createGenericPermissionValidator } from './caveats';\nimport { SnapEndowments } from './enum';\n\nconst targetName = SnapEndowments.Rpc;\n\ntype RpcSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.Endowment;\n targetName: typeof targetName;\n endowmentGetter: (_options?: any) => null;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n validator: PermissionValidatorConstraint;\n subjectTypes: readonly SubjectType[];\n}>;\n\ntype RpcSpecificationBuilderOptions = {\n // Empty for now.\n};\n\n/**\n * The specification builder for the JSON-RPC endowment permission.\n *\n * @param _builderOptions - Optional specification builder options.\n * @returns The specification for the JSON-RPC endowment permission.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.Endowment,\n RpcSpecificationBuilderOptions,\n RpcSpecification\n> = (_builderOptions?: any): RpcSpecification => {\n return {\n permissionType: PermissionType.Endowment,\n targetName,\n allowedCaveats: [SnapCaveatType.RpcOrigin, SnapCaveatType.MaxRequestTime],\n endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,\n validator: createGenericPermissionValidator([\n { type: SnapCaveatType.RpcOrigin },\n { type: SnapCaveatType.MaxRequestTime, optional: true },\n ]),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nexport const rpcEndowmentBuilder = Object.freeze({\n targetName,\n specificationBuilder,\n} as const);\n\n/**\n * Validate the value of a caveat. This does not validate the type of the\n * caveat itself, only the value of the caveat.\n *\n * @param caveat - The caveat to validate.\n * @throws If the caveat value is invalid.\n */\nfunction validateCaveatOrigins(caveat: Caveat<string, any>) {\n if (!hasProperty(caveat, 'value') || !isPlainObject(caveat.value)) {\n throw rpcErrors.invalidParams({\n message: 'Invalid JSON-RPC origins: Expected a plain object.',\n });\n }\n\n const { value } = caveat;\n assertIsRpcOrigins(value, rpcErrors.invalidParams);\n}\n\n/**\n * Map a raw value from the `initialPermissions` to a caveat specification.\n * Note that this function does not do any validation, that's handled by the\n * PermissionsController when the permission is requested.\n *\n * @param value - The raw value from the `initialPermissions`.\n * @returns The caveat specification.\n */\nexport function getRpcCaveatMapper(\n value: Json,\n): Pick<PermissionConstraint, 'caveats'> {\n return {\n caveats: [\n {\n type: SnapCaveatType.RpcOrigin,\n value,\n },\n ],\n };\n}\n\n/**\n * Getter function to get the {@link RpcOrigins} caveat value from a permission.\n *\n * @param permission - The permission to get the caveat value from.\n * @returns The caveat value.\n * @throws If the permission does not have a valid {@link RpcOrigins} caveat.\n */\nexport function getRpcCaveatOrigins(\n permission?: PermissionConstraint,\n): RpcOrigins | null {\n const caveats = permission?.caveats?.filter(\n (caveat) => caveat.type === SnapCaveatType.RpcOrigin,\n );\n assert(caveats);\n assert(caveats.length === 1);\n\n const caveat = caveats[0] as Caveat<string, RpcOrigins>;\n return caveat.value;\n}\n\nexport const rpcCaveatSpecifications: Record<\n SnapCaveatType.RpcOrigin,\n CaveatSpecificationConstraint\n> = {\n [SnapCaveatType.RpcOrigin]: Object.freeze({\n type: SnapCaveatType.RpcOrigin,\n validator: (caveat: Caveat<string, any>) => validateCaveatOrigins(caveat),\n }),\n};\n"]}
1
+ {"version":3,"file":"rpc.mjs","sourceRoot":"","sources":["../../src/endowments/rpc.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,wCAAwC;AAC9E,OAAO,EAAE,SAAS,EAAE,6BAA6B;A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C;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAW;IAEX,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,cAAc,CAAC,SAAS;gBAC9B,KAAK;aACN;SACF;KACF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAiC;IAEjC,MAAM,OAAO,GAAG,UAAU,EAAE,OAAO,EAAE,MAAM,CACzC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,SAAS,CACrD,CAAC;IACF,MAAM,CAAC,OAAO,CAAC,CAAC;IAChB,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;IAE7B,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAA+B,CAAC;IACxD,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAGhC;IACF,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC;QACxC,IAAI,EAAE,cAAc,CAAC,SAAS;QAC9B,SAAS,EAAE,CAAC,MAA2B,EAAE,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC;KAC1E,CAAC;CACH,CAAC","sourcesContent":["import type {\n Caveat,\n CaveatSpecificationConstraint,\n EndowmentGetterParams,\n PermissionConstraint,\n PermissionSpecificationBuilder,\n PermissionValidatorConstraint,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { RpcOrigins } from '@metamask/snaps-utils';\nimport { assertIsRpcOrigins, SnapCaveatType } from '@metamask/snaps-utils';\nimport type { Json, NonEmptyArray } from '@metamask/utils';\nimport { hasProperty, isPlainObject, assert } from '@metamask/utils';\n\nimport { createGenericPermissionValidator } from './caveats';\nimport { SnapEndowments } from './enum';\n\nconst targetName = SnapEndowments.Rpc;\n\ntype RpcSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.Endowment;\n targetName: typeof targetName;\n endowmentGetter: (_options?: any) => null;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n validator: PermissionValidatorConstraint;\n subjectTypes: readonly SubjectType[];\n}>;\n\n// TODO: Either fix this lint violation or explain why it's necessary to\n// ignore.\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ntype RpcSpecificationBuilderOptions = {\n // Empty for now.\n};\n\n/**\n * The specification builder for the JSON-RPC endowment permission.\n *\n * @param _builderOptions - Optional specification builder options.\n * @returns The specification for the JSON-RPC endowment permission.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.Endowment,\n RpcSpecificationBuilderOptions,\n RpcSpecification\n> = (_builderOptions?: any): RpcSpecification => {\n return {\n permissionType: PermissionType.Endowment,\n targetName,\n allowedCaveats: [SnapCaveatType.RpcOrigin, SnapCaveatType.MaxRequestTime],\n endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,\n validator: createGenericPermissionValidator([\n { type: SnapCaveatType.RpcOrigin },\n { type: SnapCaveatType.MaxRequestTime, optional: true },\n ]),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nexport const rpcEndowmentBuilder = Object.freeze({\n targetName,\n specificationBuilder,\n} as const);\n\n/**\n * Validate the value of a caveat. This does not validate the type of the\n * caveat itself, only the value of the caveat.\n *\n * @param caveat - The caveat to validate.\n * @throws If the caveat value is invalid.\n */\nfunction validateCaveatOrigins(caveat: Caveat<string, any>) {\n if (!hasProperty(caveat, 'value') || !isPlainObject(caveat.value)) {\n throw rpcErrors.invalidParams({\n message: 'Invalid JSON-RPC origins: Expected a plain object.',\n });\n }\n\n const { value } = caveat;\n assertIsRpcOrigins(value, rpcErrors.invalidParams);\n}\n\n/**\n * Map a raw value from the `initialPermissions` to a caveat specification.\n * Note that this function does not do any validation, that's handled by the\n * PermissionsController when the permission is requested.\n *\n * @param value - The raw value from the `initialPermissions`.\n * @returns The caveat specification.\n */\nexport function getRpcCaveatMapper(\n value: Json,\n): Pick<PermissionConstraint, 'caveats'> {\n return {\n caveats: [\n {\n type: SnapCaveatType.RpcOrigin,\n value,\n },\n ],\n };\n}\n\n/**\n * Getter function to get the {@link RpcOrigins} caveat value from a permission.\n *\n * @param permission - The permission to get the caveat value from.\n * @returns The caveat value.\n * @throws If the permission does not have a valid {@link RpcOrigins} caveat.\n */\nexport function getRpcCaveatOrigins(\n permission?: PermissionConstraint,\n): RpcOrigins | null {\n const caveats = permission?.caveats?.filter(\n (caveat) => caveat.type === SnapCaveatType.RpcOrigin,\n );\n assert(caveats);\n assert(caveats.length === 1);\n\n const caveat = caveats[0] as Caveat<string, RpcOrigins>;\n return caveat.value;\n}\n\nexport const rpcCaveatSpecifications: Record<\n SnapCaveatType.RpcOrigin,\n CaveatSpecificationConstraint\n> = {\n [SnapCaveatType.RpcOrigin]: Object.freeze({\n type: SnapCaveatType.RpcOrigin,\n validator: (caveat: Caveat<string, any>) => validateCaveatOrigins(caveat),\n }),\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getState.cjs","sourceRoot":"","sources":["../../src/permitted/getState.ts"],"names":[],"mappings":";;;AAEA,qDAAiE;AAGjE,uDAM+B;AAE/B,2CAAmE;AAEnE,+DAA+D;AAE/D,wCAA0D;AAE1D,MAAM,SAAS,GAAqC;IAClD,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,IAAI;IAClB,gBAAgB,EAAE,IAAI;CACvB,CAAC;AAEF;;GAEG;AACU,QAAA,eAAe,GAIxB;IACF,WAAW,EAAE,CAAC,eAAe,CAAC;IAC9B,cAAc,EAAE,sBAAsB;IACtC,SAAS;CACV,CAAC;AA0BF,MAAM,wBAAwB,GAAG,IAAA,oBAAM,EAAC;IACtC,GAAG,EAAE,IAAA,sBAAQ,EAAC,sBAAc,CAAC;IAC7B,SAAS,EAAE,IAAA,sBAAQ,EAAC,IAAA,qBAAO,G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1B,MAAM,sBAAS,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,GAAG,CACjB,KAAkC,EAClC,GAAwB;IAExB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,MAAM,GAAS,KAAK,CAAC;IAEzB,uEAAuE;IACvE,4DAA4D;IAC5D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,sBAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACxC,MAAM,sBAAS,CAAC,aAAa,CAC3B,oDAAoD,CACrD,CAAC;QACJ,CAAC;QAED,IAAI,IAAA,gBAAQ,EAAC,MAAM,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,IAAA,mBAAW,EAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5B,SAAS;QACX,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAlCD,kBAkCC","sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { providerErrors, rpcErrors } from '@metamask/rpc-errors';\nimport type { GetStateParams, GetStateResult } from '@metamask/snaps-sdk';\nimport { type InferMatching } from '@metamask/snaps-utils';\nimport {\n boolean,\n create,\n object,\n optional,\n StructError,\n} from '@metamask/superstruct';\nimport type { PendingJsonRpcResponse, JsonRpcRequest } from '@metamask/utils';\nimport { hasProperty, isObject, type Json } from '@metamask/utils';\n\nimport { manageStateBuilder } from '../restricted/manageState';\nimport type { MethodHooksObject } from '../utils';\nimport { FORBIDDEN_KEYS, StateKeyStruct } from '../utils';\n\nconst hookNames: MethodHooksObject<GetStateHooks> = {\n hasPermission: true,\n getSnapState: true,\n getUnlockPromise: true,\n};\n\n/**\n * `snap_getState` gets the state of the Snap.\n */\nexport const getStateHandler: PermittedHandlerExport<\n GetStateHooks,\n GetStateParameters,\n GetStateResult\n> = {\n methodNames: ['snap_getState'],\n implementation: getStateImplementation,\n hookNames,\n};\n\nexport type GetStateHooks = {\n /**\n * Check if the requesting origin has a given permission.\n *\n * @param permissionName - The name of the permission to check.\n * @returns Whether the origin has the permission.\n */\n hasPermission: (permissionName: string) => boolean;\n\n /**\n * Get the state of the requesting Snap.\n *\n * @returns The current state of the Snap.\n */\n getSnapState: (encrypted: boolean) => Promise<Record<string, Json>>;\n\n /**\n * Wait for the extension to be unlocked.\n *\n * @returns A promise that resolves once the extension is unlocked.\n */\n getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;\n};\n\nconst GetStateParametersStruct = object({\n key: optional(StateKeyStruct),\n encrypted: optional(boolean()),\n});\n\nexport type GetStateParameters = InferMatching<\n typeof GetStateParametersStruct,\n GetStateParams\n>;\n\n/**\n * The `snap_getState` method implementation.\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.hasPermission - Check whether a given origin has a given\n * permission.\n * @param hooks.getSnapState - Get the state of the requesting Snap.\n * @param hooks.getUnlockPromise - Wait for the extension to be unlocked.\n * @returns Nothing.\n */\nasync function getStateImplementation(\n request: JsonRpcRequest<GetStateParameters>,\n response: PendingJsonRpcResponse<GetStateResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { hasPermission, getSnapState, getUnlockPromise }: GetStateHooks,\n): Promise<void> {\n const { params } = request;\n\n if (!hasPermission(manageStateBuilder.targetName)) {\n return end(providerErrors.unauthorized());\n }\n\n try {\n const validatedParams = getValidatedParams(params);\n const { key, encrypted = true } = validatedParams;\n\n if (encrypted) {\n await getUnlockPromise(true);\n }\n\n const state = await getSnapState(encrypted);\n response.result = get(state, key);\n } catch (error) {\n return end(error);\n }\n\n return end();\n}\n\n/**\n * Validate the parameters of the `snap_getState` method.\n *\n * @param params - The parameters to validate.\n * @returns The validated parameters.\n */\nfunction getValidatedParams(params?: unknown) {\n try {\n return create(params, GetStateParametersStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw rpcErrors.invalidParams({\n message: `Invalid params: ${error.message}.`,\n });\n }\n\n /* istanbul ignore next */\n throw rpcErrors.internal();\n }\n}\n\n/**\n * Get the value of a key in an object. The key may contain Lodash-style path\n * syntax, e.g., `a.b.c` (with the exception of array syntax). If the key does\n * not exist, `null` is returned.\n *\n * This is a simplified version of Lodash's `get` function, but Lodash doesn't\n * seem to be maintained anymore, so we're using our own implementation.\n *\n * @param value - The object to get the key from.\n * @param key - The key to get.\n * @returns The value of the key in the object, or `null` if the key does not\n * exist.\n */\nexport function get(\n value: Record<string, Json> | null,\n key?: string | undefined,\n): Json {\n if (key === undefined) {\n return value;\n }\n\n const keys = key.split('.');\n let result: Json = value;\n\n // Intentionally using a classic for loop here for performance reasons.\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < keys.length; i++) {\n const currentKey = keys[i];\n if (FORBIDDEN_KEYS.includes(currentKey)) {\n throw rpcErrors.invalidParams(\n 'Invalid params: Key contains forbidden characters.',\n );\n }\n\n if (isObject(result)) {\n if (!hasProperty(result, currentKey)) {\n return null;\n }\n\n result = result[currentKey];\n continue;\n }\n\n return null;\n }\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"getState.cjs","sourceRoot":"","sources":["../../src/permitted/getState.ts"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C,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5B,SAAS;QACX,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAlCD,kBAkCC","sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { providerErrors, rpcErrors } from '@metamask/rpc-errors';\nimport type { GetStateParams, GetStateResult } from '@metamask/snaps-sdk';\nimport { type InferMatching } from '@metamask/snaps-utils';\nimport {\n boolean,\n create,\n object,\n optional,\n StructError,\n} from '@metamask/superstruct';\nimport type {\n PendingJsonRpcResponse,\n Json,\n JsonRpcRequest,\n} from '@metamask/utils';\nimport { hasProperty, isObject } from '@metamask/utils';\n\nimport { manageStateBuilder } from '../restricted/manageState';\nimport type { MethodHooksObject } from '../utils';\nimport { FORBIDDEN_KEYS, StateKeyStruct } from '../utils';\n\nconst hookNames: MethodHooksObject<GetStateHooks> = {\n hasPermission: true,\n getSnapState: true,\n getUnlockPromise: true,\n};\n\n/**\n * `snap_getState` gets the state of the Snap.\n */\nexport const getStateHandler: PermittedHandlerExport<\n GetStateHooks,\n GetStateParameters,\n GetStateResult\n> = {\n methodNames: ['snap_getState'],\n implementation: getStateImplementation,\n hookNames,\n};\n\nexport type GetStateHooks = {\n /**\n * Check if the requesting origin has a given permission.\n *\n * @param permissionName - The name of the permission to check.\n * @returns Whether the origin has the permission.\n */\n hasPermission: (permissionName: string) => boolean;\n\n /**\n * Get the state of the requesting Snap.\n *\n * @returns The current state of the Snap.\n */\n getSnapState: (encrypted: boolean) => Promise<Record<string, Json>>;\n\n /**\n * Wait for the extension to be unlocked.\n *\n * @returns A promise that resolves once the extension is unlocked.\n */\n getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;\n};\n\nconst GetStateParametersStruct = object({\n key: optional(StateKeyStruct),\n encrypted: optional(boolean()),\n});\n\nexport type GetStateParameters = InferMatching<\n typeof GetStateParametersStruct,\n GetStateParams\n>;\n\n/**\n * The `snap_getState` method implementation.\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.hasPermission - Check whether a given origin has a given\n * permission.\n * @param hooks.getSnapState - Get the state of the requesting Snap.\n * @param hooks.getUnlockPromise - Wait for the extension to be unlocked.\n * @returns Nothing.\n */\nasync function getStateImplementation(\n request: JsonRpcRequest<GetStateParameters>,\n response: PendingJsonRpcResponse<GetStateResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { hasPermission, getSnapState, getUnlockPromise }: GetStateHooks,\n): Promise<void> {\n const { params } = request;\n\n if (!hasPermission(manageStateBuilder.targetName)) {\n return end(providerErrors.unauthorized());\n }\n\n try {\n const validatedParams = getValidatedParams(params);\n const { key, encrypted = true } = validatedParams;\n\n if (encrypted) {\n await getUnlockPromise(true);\n }\n\n const state = await getSnapState(encrypted);\n response.result = get(state, key);\n } catch (error) {\n return end(error);\n }\n\n return end();\n}\n\n/**\n * Validate the parameters of the `snap_getState` method.\n *\n * @param params - The parameters to validate.\n * @returns The validated parameters.\n */\nfunction getValidatedParams(params?: unknown) {\n try {\n return create(params, GetStateParametersStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw rpcErrors.invalidParams({\n message: `Invalid params: ${error.message}.`,\n });\n }\n\n /* istanbul ignore next */\n throw rpcErrors.internal();\n }\n}\n\n/**\n * Get the value of a key in an object. The key may contain Lodash-style path\n * syntax, e.g., `a.b.c` (with the exception of array syntax). If the key does\n * not exist, `null` is returned.\n *\n * This is a simplified version of Lodash's `get` function, but Lodash doesn't\n * seem to be maintained anymore, so we're using our own implementation.\n *\n * @param value - The object to get the key from.\n * @param key - The key to get.\n * @returns The value of the key in the object, or `null` if the key does not\n * exist.\n */\nexport function get(\n value: Record<string, Json> | null,\n key?: string | undefined,\n): Json {\n if (key === undefined) {\n return value;\n }\n\n const keys = key.split('.');\n let result: Json = value;\n\n // Intentionally using a classic for loop here for performance reasons.\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < keys.length; i++) {\n const currentKey = keys[i];\n if (FORBIDDEN_KEYS.includes(currentKey)) {\n throw rpcErrors.invalidParams(\n 'Invalid params: Key contains forbidden characters.',\n );\n }\n\n if (isObject(result)) {\n if (!hasProperty(result, currentKey)) {\n return null;\n }\n\n result = result[currentKey];\n continue;\n }\n\n return null;\n }\n\n return result;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { PermittedHandlerExport } from "@metamask/permission-controller";
2
2
  import type { GetStateParams, GetStateResult } from "@metamask/snaps-sdk";
3
3
  import { type InferMatching } from "@metamask/snaps-utils";
4
- import { type Json } from "@metamask/utils";
4
+ import type { Json } from "@metamask/utils";
5
5
  /**
6
6
  * `snap_getState` gets the state of the Snap.
7
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getState.d.cts","sourceRoot":"","sources":["../../src/permitted/getState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAwC;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,4BAA4B;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,8BAA8B;AAS3D,OAAO,EAAyB,KAAK,IAAI,EAAE,wBAAwB;AAYnE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,sBAAsB,CAClD,aAAa,EACb,kBAAkB,EAClB,cAAc,CAKf,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;OAKG;IACH,aAAa,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC;IAEnD;;;;OAIG;IACH,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CA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AAM,MAAM,kBAAkB,GAAG,aAAa,CAC5C,OAAO,wBAAwB,EAC/B,cAAc,CACf,CAAC;AAoEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,GAAG,CACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,EAClC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,GACvB,IAAI,CA+BN"}
@@ -1,7 +1,7 @@
1
1
  import type { PermittedHandlerExport } from "@metamask/permission-controller";
2
2
  import type { GetStateParams, GetStateResult } from "@metamask/snaps-sdk";
3
3
  import { type InferMatching } from "@metamask/snaps-utils";
4
- import { type Json } from "@metamask/utils";
4
+ import type { Json } from "@metamask/utils";
5
5
  /**
6
6
  * `snap_getState` gets the state of the Snap.
7
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getState.d.mts","sourceRoot":"","sources":["../../src/permitted/getState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAwC;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,4BAA4B;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,8BAA8B;AAS3D,OAAO,EAAyB,KAAK,IAAI,EAAE,wBAAwB;AAYnE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,sBAAsB,CAClD,aAAa,EACb,kBAAkB,EAClB,cAAc,CAKf,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;OAKG;IACH,aAAa,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC;IAEnD;;;;OAIG;IACH,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEpE;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,uBAAuB,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE,CAAC;AAEF,QAAA,MAAM,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AAE,EAAE,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACxC,MAAM,SAAS,CAAC,aAAa,CAC3B,oDAAoD,CACrD,CAAC;QACJ,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5B,SAAS;QACX,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { providerErrors, rpcErrors } from '@metamask/rpc-errors';\nimport type { GetStateParams, GetStateResult } from '@metamask/snaps-sdk';\nimport { type InferMatching } from '@metamask/snaps-utils';\nimport {\n boolean,\n create,\n object,\n optional,\n StructError,\n} from '@metamask/superstruct';\nimport type { PendingJsonRpcResponse, JsonRpcRequest } from '@metamask/utils';\nimport { hasProperty, isObject, type Json } from '@metamask/utils';\n\nimport { manageStateBuilder } from '../restricted/manageState';\nimport type { MethodHooksObject } from '../utils';\nimport { FORBIDDEN_KEYS, StateKeyStruct } from '../utils';\n\nconst hookNames: MethodHooksObject<GetStateHooks> = {\n hasPermission: true,\n getSnapState: true,\n getUnlockPromise: true,\n};\n\n/**\n * `snap_getState` gets the state of the Snap.\n */\nexport const getStateHandler: PermittedHandlerExport<\n GetStateHooks,\n GetStateParameters,\n GetStateResult\n> = {\n methodNames: ['snap_getState'],\n implementation: getStateImplementation,\n hookNames,\n};\n\nexport type GetStateHooks = {\n /**\n * Check if the requesting origin has a given permission.\n *\n * @param permissionName - The name of the permission to check.\n * @returns Whether the origin has the permission.\n */\n hasPermission: (permissionName: string) => boolean;\n\n /**\n * Get the state of the requesting Snap.\n *\n * @returns The current state of the Snap.\n */\n getSnapState: (encrypted: boolean) => Promise<Record<string, Json>>;\n\n /**\n * Wait for the extension to be unlocked.\n *\n * @returns A promise that resolves once the extension is unlocked.\n */\n getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;\n};\n\nconst GetStateParametersStruct = object({\n key: optional(StateKeyStruct),\n encrypted: optional(boolean()),\n});\n\nexport type GetStateParameters = InferMatching<\n typeof GetStateParametersStruct,\n GetStateParams\n>;\n\n/**\n * The `snap_getState` method implementation.\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.hasPermission - Check whether a given origin has a given\n * permission.\n * @param hooks.getSnapState - Get the state of the requesting Snap.\n * @param hooks.getUnlockPromise - Wait for the extension to be unlocked.\n * @returns Nothing.\n */\nasync function getStateImplementation(\n request: JsonRpcRequest<GetStateParameters>,\n response: PendingJsonRpcResponse<GetStateResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { hasPermission, getSnapState, getUnlockPromise }: GetStateHooks,\n): Promise<void> {\n const { params } = request;\n\n if (!hasPermission(manageStateBuilder.targetName)) {\n return end(providerErrors.unauthorized());\n }\n\n try {\n const validatedParams = getValidatedParams(params);\n const { key, encrypted = true } = validatedParams;\n\n if (encrypted) {\n await getUnlockPromise(true);\n }\n\n const state = await getSnapState(encrypted);\n response.result = get(state, key);\n } catch (error) {\n return end(error);\n }\n\n return end();\n}\n\n/**\n * Validate the parameters of the `snap_getState` method.\n *\n * @param params - The parameters to validate.\n * @returns The validated parameters.\n */\nfunction getValidatedParams(params?: unknown) {\n try {\n return create(params, GetStateParametersStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw rpcErrors.invalidParams({\n message: `Invalid params: ${error.message}.`,\n });\n }\n\n /* istanbul ignore next */\n throw rpcErrors.internal();\n }\n}\n\n/**\n * Get the value of a key in an object. The key may contain Lodash-style path\n * syntax, e.g., `a.b.c` (with the exception of array syntax). If the key does\n * not exist, `null` is returned.\n *\n * This is a simplified version of Lodash's `get` function, but Lodash doesn't\n * seem to be maintained anymore, so we're using our own implementation.\n *\n * @param value - The object to get the key from.\n * @param key - The key to get.\n * @returns The value of the key in the object, or `null` if the key does not\n * exist.\n */\nexport function get(\n value: Record<string, Json> | null,\n key?: string | undefined,\n): Json {\n if (key === undefined) {\n return value;\n }\n\n const keys = key.split('.');\n let result: Json = value;\n\n // Intentionally using a classic for loop here for performance reasons.\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < keys.length; i++) {\n const currentKey = keys[i];\n if (FORBIDDEN_KEYS.includes(currentKey)) {\n throw rpcErrors.invalidParams(\n 'Invalid params: Key contains forbidden characters.',\n );\n }\n\n if (isObject(result)) {\n if (!hasProperty(result, currentKey)) {\n return null;\n }\n\n result = result[currentKey];\n continue;\n }\n\n return null;\n }\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"getState.mjs","sourceRoot":"","sources":["../../src/permitted/getState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,6BAA6B;AAGjE,OAAO,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACZ,8BAA8B;AAM/B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,wBAAwB;AAExD,OAAO,EAAE,kBAAkB,EAAE,sCAAkC;AAE/D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,qBAAiB;AAE1D,MAAM,SAAS,GAAqC;IAClD,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,IAAI;IAClB,gBAAgB,EAAE,IAAI;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAIxB;IACF,WA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,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;YACjC,MAAM,SAAS,CAAC,aAAa,CAAC;gBAC5B,OAAO,EAAE,mBAAmB,KAAK,CAAC,OAAO,GAAG;aAC7C,CAAC,CAAC;QACL,CAAC;QAED,0BAA0B;QAC1B,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,GAAG,CACjB,KAAkC,EAClC,GAAwB;IAExB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,MAAM,GAAS,KAAK,CAAC;IAEzB,uEAAuE;IACvE,4DAA4D;IAC5D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACxC,MAAM,SAAS,CAAC,aAAa,CAC3B,oDAAoD,CACrD,CAAC;QACJ,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5B,SAAS;QACX,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { JsonRpcEngineEndCallback } from '@metamask/json-rpc-engine';\nimport type { PermittedHandlerExport } from '@metamask/permission-controller';\nimport { providerErrors, rpcErrors } from '@metamask/rpc-errors';\nimport type { GetStateParams, GetStateResult } from '@metamask/snaps-sdk';\nimport { type InferMatching } from '@metamask/snaps-utils';\nimport {\n boolean,\n create,\n object,\n optional,\n StructError,\n} from '@metamask/superstruct';\nimport type {\n PendingJsonRpcResponse,\n Json,\n JsonRpcRequest,\n} from '@metamask/utils';\nimport { hasProperty, isObject } from '@metamask/utils';\n\nimport { manageStateBuilder } from '../restricted/manageState';\nimport type { MethodHooksObject } from '../utils';\nimport { FORBIDDEN_KEYS, StateKeyStruct } from '../utils';\n\nconst hookNames: MethodHooksObject<GetStateHooks> = {\n hasPermission: true,\n getSnapState: true,\n getUnlockPromise: true,\n};\n\n/**\n * `snap_getState` gets the state of the Snap.\n */\nexport const getStateHandler: PermittedHandlerExport<\n GetStateHooks,\n GetStateParameters,\n GetStateResult\n> = {\n methodNames: ['snap_getState'],\n implementation: getStateImplementation,\n hookNames,\n};\n\nexport type GetStateHooks = {\n /**\n * Check if the requesting origin has a given permission.\n *\n * @param permissionName - The name of the permission to check.\n * @returns Whether the origin has the permission.\n */\n hasPermission: (permissionName: string) => boolean;\n\n /**\n * Get the state of the requesting Snap.\n *\n * @returns The current state of the Snap.\n */\n getSnapState: (encrypted: boolean) => Promise<Record<string, Json>>;\n\n /**\n * Wait for the extension to be unlocked.\n *\n * @returns A promise that resolves once the extension is unlocked.\n */\n getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;\n};\n\nconst GetStateParametersStruct = object({\n key: optional(StateKeyStruct),\n encrypted: optional(boolean()),\n});\n\nexport type GetStateParameters = InferMatching<\n typeof GetStateParametersStruct,\n GetStateParams\n>;\n\n/**\n * The `snap_getState` method implementation.\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.hasPermission - Check whether a given origin has a given\n * permission.\n * @param hooks.getSnapState - Get the state of the requesting Snap.\n * @param hooks.getUnlockPromise - Wait for the extension to be unlocked.\n * @returns Nothing.\n */\nasync function getStateImplementation(\n request: JsonRpcRequest<GetStateParameters>,\n response: PendingJsonRpcResponse<GetStateResult>,\n _next: unknown,\n end: JsonRpcEngineEndCallback,\n { hasPermission, getSnapState, getUnlockPromise }: GetStateHooks,\n): Promise<void> {\n const { params } = request;\n\n if (!hasPermission(manageStateBuilder.targetName)) {\n return end(providerErrors.unauthorized());\n }\n\n try {\n const validatedParams = getValidatedParams(params);\n const { key, encrypted = true } = validatedParams;\n\n if (encrypted) {\n await getUnlockPromise(true);\n }\n\n const state = await getSnapState(encrypted);\n response.result = get(state, key);\n } catch (error) {\n return end(error);\n }\n\n return end();\n}\n\n/**\n * Validate the parameters of the `snap_getState` method.\n *\n * @param params - The parameters to validate.\n * @returns The validated parameters.\n */\nfunction getValidatedParams(params?: unknown) {\n try {\n return create(params, GetStateParametersStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw rpcErrors.invalidParams({\n message: `Invalid params: ${error.message}.`,\n });\n }\n\n /* istanbul ignore next */\n throw rpcErrors.internal();\n }\n}\n\n/**\n * Get the value of a key in an object. The key may contain Lodash-style path\n * syntax, e.g., `a.b.c` (with the exception of array syntax). If the key does\n * not exist, `null` is returned.\n *\n * This is a simplified version of Lodash's `get` function, but Lodash doesn't\n * seem to be maintained anymore, so we're using our own implementation.\n *\n * @param value - The object to get the key from.\n * @param key - The key to get.\n * @returns The value of the key in the object, or `null` if the key does not\n * exist.\n */\nexport function get(\n value: Record<string, Json> | null,\n key?: string | undefined,\n): Json {\n if (key === undefined) {\n return value;\n }\n\n const keys = key.split('.');\n let result: Json = value;\n\n // Intentionally using a classic for loop here for performance reasons.\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < keys.length; i++) {\n const currentKey = keys[i];\n if (FORBIDDEN_KEYS.includes(currentKey)) {\n throw rpcErrors.invalidParams(\n 'Invalid params: Key contains forbidden characters.',\n );\n }\n\n if (isObject(result)) {\n if (!hasProperty(result, currentKey)) {\n return null;\n }\n\n result = result[currentKey];\n continue;\n }\n\n return null;\n }\n\n return result;\n}\n"]}
@@ -16,6 +16,7 @@ const getSnaps_1 = require("./getSnaps.cjs");
16
16
  const getState_1 = require("./getState.cjs");
17
17
  const invokeKeyring_1 = require("./invokeKeyring.cjs");
18
18
  const invokeSnapSugar_1 = require("./invokeSnapSugar.cjs");
19
+ const listEntropySources_1 = require("./listEntropySources.cjs");
19
20
  const requestSnaps_1 = require("./requestSnaps.cjs");
20
21
  const resolveInterface_1 = require("./resolveInterface.cjs");
21
22
  const scheduleBackgroundEvent_1 = require("./scheduleBackgroundEvent.cjs");
@@ -36,6 +37,7 @@ exports.methodHandlers = {
36
37
  snap_updateInterface: updateInterface_1.updateInterfaceHandler,
37
38
  snap_getInterfaceState: getInterfaceState_1.getInterfaceStateHandler,
38
39
  snap_getInterfaceContext: getInterfaceContext_1.getInterfaceContextHandler,
40
+ snap_listEntropySources: listEntropySources_1.listEntropySourcesHandler,
39
41
  snap_resolveInterface: resolveInterface_1.resolveInterfaceHandler,
40
42
  snap_getCurrencyRate: getCurrencyRate_1.getCurrencyRateHandler,
41
43
  snap_experimentalProviderRequest: experimentalProviderRequest_1.providerRequestHandler,
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.cjs","sourceRoot":"","sources":["../../src/permitted/handlers.ts"],"names":[],"mappings":";;;AAAA,uEAAuE;AACvE,iDAAiD;AACjD,2DAA2D;AAC3D,mFAAuE;AACvE,mDAAmD;AACnD,mEAAmE;AACnE,2DAA2D;AAC3D,2DAA2D;AAC3D,2CAA2C;AAC3C,mEAAmE;AACnE,+DAA+D;AAC/D,6CAA6C;AAC7C,6CAA6C;AAC7C,uDAAuD;AACvD,2DAA2D;AAC3D,qDAAqD;AACrD,6DAA6D;AAC7D,2EAA2E;AAC3E,6CAA6C;AAC7C,2DAA2D;AAE3D,yDAAyD;AAC5C,QAAA,cAAc,GAAG;IAC5B,kBAAkB,EAAE,gCAAkB;IACtC,eAAe,EAAE,0BAAe;IAChC,mBAAmB,EAAE,kCAAmB;IACxC,iBAAiB,EAAE,wCAAsB;IACzC,oBAAoB,EAAE,oCAAoB;IAC1C,eAAe,EAAE,8BAAiB;IAClC,oBAAoB,EAAE,wCAAsB;IAC5C,YAAY,EAAE,wBAAc;IAC5B,aAAa,EAAE,0BAAe;IAC9B,oBAAoB,EAAE,wCAAsB;IAC5C,oBAAoB,EAAE,wCAAsB;IAC5C,sBAAsB,EAAE,4CAAwB;IAChD,wBAAwB,EAAE,gDAA0B;IACpD,qBAAqB,EAAE,0CAAuB;IAC9C,oBAAoB,EAAE,wCAAsB;IAC5C,gCAAgC,EAAE,oDAAsB;IACxD,4BAA4B,EAAE,wDAA8B;IAC5D,0BAA0B,EAAE,oDAA4B;IACxD,wBAAwB,EAAE,gDAA0B;IACpD,aAAa,EAAE,0BAAe;CAC/B,CAAC;AACF,wDAAwD;AAE3C,QAAA,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,sBAAc,CAAC,CAAC","sourcesContent":["import { cancelBackgroundEventHandler } from './cancelBackgroundEvent';\nimport { clearStateHandler } from './clearState';\nimport { createInterfaceHandler } from './createInterface';\nimport { providerRequestHandler } from './experimentalProviderRequest';\nimport { getAllSnapsHandler } from './getAllSnaps';\nimport { getBackgroundEventsHandler } from './getBackgroundEvents';\nimport { getClientStatusHandler } from './getClientStatus';\nimport { getCurrencyRateHandler } from './getCurrencyRate';\nimport { getFileHandler } from './getFile';\nimport { getInterfaceContextHandler } from './getInterfaceContext';\nimport { getInterfaceStateHandler } from './getInterfaceState';\nimport { getSnapsHandler } from './getSnaps';\nimport { getStateHandler } from './getState';\nimport { invokeKeyringHandler } from './invokeKeyring';\nimport { invokeSnapSugarHandler } from './invokeSnapSugar';\nimport { requestSnapsHandler } from './requestSnaps';\nimport { resolveInterfaceHandler } from './resolveInterface';\nimport { scheduleBackgroundEventHandler } from './scheduleBackgroundEvent';\nimport { setStateHandler } from './setState';\nimport { updateInterfaceHandler } from './updateInterface';\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_clearState: clearStateHandler,\n snap_getClientStatus: getClientStatusHandler,\n snap_getFile: getFileHandler,\n snap_getState: getStateHandler,\n snap_createInterface: createInterfaceHandler,\n snap_updateInterface: updateInterfaceHandler,\n snap_getInterfaceState: getInterfaceStateHandler,\n snap_getInterfaceContext: getInterfaceContextHandler,\n snap_resolveInterface: resolveInterfaceHandler,\n snap_getCurrencyRate: getCurrencyRateHandler,\n snap_experimentalProviderRequest: providerRequestHandler,\n snap_scheduleBackgroundEvent: scheduleBackgroundEventHandler,\n snap_cancelBackgroundEvent: cancelBackgroundEventHandler,\n snap_getBackgroundEvents: getBackgroundEventsHandler,\n snap_setState: setStateHandler,\n};\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport const handlers = Object.values(methodHandlers);\n"]}
1
+ {"version":3,"file":"handlers.cjs","sourceRoot":"","sources":["../../src/permitted/handlers.ts"],"names":[],"mappings":";;;AAAA,uEAAuE;AACvE,iDAAiD;AACjD,2DAA2D;AAC3D,mFAAuE;AACvE,mDAAmD;AACnD,mEAAmE;AACnE,2DAA2D;AAC3D,2DAA2D;AAC3D,2CAA2C;AAC3C,mEAAmE;AACnE,+DAA+D;AAC/D,6CAA6C;AAC7C,6CAA6C;AAC7C,uDAAuD;AACvD,2DAA2D;AAC3D,iEAAiE;AACjE,qDAAqD;AACrD,6DAA6D;AAC7D,2EAA2E;AAC3E,6CAA6C;AAC7C,2DAA2D;AAE3D,yDAAyD;AAC5C,QAAA,cAAc,GAAG;IAC5B,kBAAkB,EAAE,gCAAkB;IACtC,eAAe,EAAE,0BAAe;IAChC,mBAAmB,EAAE,kCAAmB;IACxC,iBAAiB,EAAE,wCAAsB;IACzC,oBAAoB,EAAE,oCAAoB;IAC1C,eAAe,EAAE,8BAAiB;IAClC,oBAAoB,EAAE,wCAAsB;IAC5C,YAAY,EAAE,wBAAc;IAC5B,aAAa,EAAE,0BAAe;IAC9B,oBAAoB,EAAE,wCAAsB;IAC5C,oBAAoB,EAAE,wCAAsB;IAC5C,sBAAsB,EAAE,4CAAwB;IAChD,wBAAwB,EAAE,gDAA0B;IACpD,uBAAuB,EAAE,8CAAyB;IAClD,qBAAqB,EAAE,0CAAuB;IAC9C,oBAAoB,EAAE,wCAAsB;IAC5C,gCAAgC,EAAE,oDAAsB;IACxD,4BAA4B,EAAE,wDAA8B;IAC5D,0BAA0B,EAAE,oDAA4B;IACxD,wBAAwB,EAAE,gDAA0B;IACpD,aAAa,EAAE,0BAAe;CAC/B,CAAC;AACF,wDAAwD;AAE3C,QAAA,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,sBAAc,CAAC,CAAC","sourcesContent":["import { cancelBackgroundEventHandler } from './cancelBackgroundEvent';\nimport { clearStateHandler } from './clearState';\nimport { createInterfaceHandler } from './createInterface';\nimport { providerRequestHandler } from './experimentalProviderRequest';\nimport { getAllSnapsHandler } from './getAllSnaps';\nimport { getBackgroundEventsHandler } from './getBackgroundEvents';\nimport { getClientStatusHandler } from './getClientStatus';\nimport { getCurrencyRateHandler } from './getCurrencyRate';\nimport { getFileHandler } from './getFile';\nimport { getInterfaceContextHandler } from './getInterfaceContext';\nimport { getInterfaceStateHandler } from './getInterfaceState';\nimport { getSnapsHandler } from './getSnaps';\nimport { getStateHandler } from './getState';\nimport { invokeKeyringHandler } from './invokeKeyring';\nimport { invokeSnapSugarHandler } from './invokeSnapSugar';\nimport { listEntropySourcesHandler } from './listEntropySources';\nimport { requestSnapsHandler } from './requestSnaps';\nimport { resolveInterfaceHandler } from './resolveInterface';\nimport { scheduleBackgroundEventHandler } from './scheduleBackgroundEvent';\nimport { setStateHandler } from './setState';\nimport { updateInterfaceHandler } from './updateInterface';\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_clearState: clearStateHandler,\n snap_getClientStatus: getClientStatusHandler,\n snap_getFile: getFileHandler,\n snap_getState: getStateHandler,\n snap_createInterface: createInterfaceHandler,\n snap_updateInterface: updateInterfaceHandler,\n snap_getInterfaceState: getInterfaceStateHandler,\n snap_getInterfaceContext: getInterfaceContextHandler,\n snap_listEntropySources: listEntropySourcesHandler,\n snap_resolveInterface: resolveInterfaceHandler,\n snap_getCurrencyRate: getCurrencyRateHandler,\n snap_experimentalProviderRequest: providerRequestHandler,\n snap_scheduleBackgroundEvent: scheduleBackgroundEventHandler,\n snap_cancelBackgroundEvent: cancelBackgroundEventHandler,\n snap_getBackgroundEvents: getBackgroundEventsHandler,\n snap_setState: setStateHandler,\n};\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport const handlers = Object.values(methodHandlers);\n"]}
@@ -22,6 +22,7 @@ export declare const methodHandlers: {
22
22
  contents: string;
23
23
  } | null> | null>>;
24
24
  snap_getInterfaceContext: import("@metamask/permission-controller").PermittedHandlerExport<import("./getInterfaceContext.cjs").GetInterfaceContextMethodHooks, import("@metamask/snaps-sdk").GetInterfaceContextParams, import("@metamask/snaps-sdk").GetInterfaceContextResult>;
25
+ snap_listEntropySources: import("@metamask/permission-controller").PermittedHandlerExport<import("./listEntropySources.cjs").ListEntropySourcesHooks, never, import("@metamask/snaps-sdk").ListEntropySourcesResult>;
25
26
  snap_resolveInterface: import("@metamask/permission-controller").PermittedHandlerExport<import("./resolveInterface.cjs").ResolveInterfaceMethodHooks, import("@metamask/snaps-sdk").ResolveInterfaceParams, null>;
26
27
  snap_getCurrencyRate: import("@metamask/permission-controller").PermittedHandlerExport<import("./getCurrencyRate.cjs").GetCurrencyRateMethodHooks, import("@metamask/snaps-sdk").GetCurrencyRateParams, import("@metamask/snaps-sdk").GetCurrencyRateResult>;
27
28
  snap_experimentalProviderRequest: import("@metamask/permission-controller").PermittedHandlerExport<import("./experimentalProviderRequest.cjs").ProviderRequestMethodHooks, import("@metamask/snaps-sdk").ProviderRequestParams, import("@metamask/utils").Json>;
@@ -40,5 +41,5 @@ export declare const handlers: (import("@metamask/permission-controller").Permit
40
41
  size: number;
41
42
  contentType: string;
42
43
  contents: string;
43
- } | null> | null>> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getSnaps.cjs").GetSnapsHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getState.cjs").GetStateHooks, import("@metamask/snaps-sdk").GetStateParams, import("@metamask/utils").Json> | import("@metamask/permission-controller").PermittedHandlerExport<import("./requestSnaps.cjs").RequestSnapsHooks, import("@metamask/snaps-sdk").RequestSnapsParams, import("@metamask/snaps-sdk").RequestSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./resolveInterface.cjs").ResolveInterfaceMethodHooks, import("@metamask/snaps-sdk").ResolveInterfaceParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./scheduleBackgroundEvent.cjs").ScheduleBackgroundEventMethodHooks, import("@metamask/snaps-sdk").ScheduleBackgroundEventParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./setState.cjs").SetStateHooks, import("@metamask/snaps-sdk").SetStateParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./updateInterface.cjs").UpdateInterfaceMethodHooks, import("@metamask/snaps-sdk").UpdateInterfaceParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getFile.cjs").GetFileHooks, import("@metamask/snaps-sdk").GetFileParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getInterfaceContext.cjs").GetInterfaceContextMethodHooks, import("@metamask/snaps-sdk").GetInterfaceContextParams, import("@metamask/snaps-sdk").GetInterfaceContextResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeSnapSugar.cjs").InvokeSnapSugarHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json> | import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeKeyring.cjs").InvokeKeyringHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json>)[];
44
+ } | null> | null>> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getSnaps.cjs").GetSnapsHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getState.cjs").GetStateHooks, import("@metamask/snaps-sdk").GetStateParams, import("@metamask/utils").Json> | import("@metamask/permission-controller").PermittedHandlerExport<import("./listEntropySources.cjs").ListEntropySourcesHooks, never, import("@metamask/snaps-sdk").ListEntropySourcesResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./requestSnaps.cjs").RequestSnapsHooks, import("@metamask/snaps-sdk").RequestSnapsParams, import("@metamask/snaps-sdk").RequestSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./resolveInterface.cjs").ResolveInterfaceMethodHooks, import("@metamask/snaps-sdk").ResolveInterfaceParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./scheduleBackgroundEvent.cjs").ScheduleBackgroundEventMethodHooks, import("@metamask/snaps-sdk").ScheduleBackgroundEventParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./setState.cjs").SetStateHooks, import("@metamask/snaps-sdk").SetStateParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./updateInterface.cjs").UpdateInterfaceMethodHooks, import("@metamask/snaps-sdk").UpdateInterfaceParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getFile.cjs").GetFileHooks, import("@metamask/snaps-sdk").GetFileParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getInterfaceContext.cjs").GetInterfaceContextMethodHooks, import("@metamask/snaps-sdk").GetInterfaceContextParams, import("@metamask/snaps-sdk").GetInterfaceContextResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeSnapSugar.cjs").InvokeSnapSugarHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json> | import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeKeyring.cjs").InvokeKeyringHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json>)[];
44
45
  //# sourceMappingURL=handlers.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.cts","sourceRoot":"","sources":["../../src/permitted/handlers.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqB1B,CAAC;AAGF,eAAO,MAAM,QAAQ;;;;;;;;;;0kEAAgC,CAAC"}
1
+ {"version":3,"file":"handlers.d.cts","sourceRoot":"","sources":["../../src/permitted/handlers.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsB1B,CAAC;AAGF,eAAO,MAAM,QAAQ;;;;;;;;;;owEAAgC,CAAC"}
@@ -22,6 +22,7 @@ export declare const methodHandlers: {
22
22
  contents: string;
23
23
  } | null> | null>>;
24
24
  snap_getInterfaceContext: import("@metamask/permission-controller").PermittedHandlerExport<import("./getInterfaceContext.mjs").GetInterfaceContextMethodHooks, import("@metamask/snaps-sdk").GetInterfaceContextParams, import("@metamask/snaps-sdk").GetInterfaceContextResult>;
25
+ snap_listEntropySources: import("@metamask/permission-controller").PermittedHandlerExport<import("./listEntropySources.mjs").ListEntropySourcesHooks, never, import("@metamask/snaps-sdk").ListEntropySourcesResult>;
25
26
  snap_resolveInterface: import("@metamask/permission-controller").PermittedHandlerExport<import("./resolveInterface.mjs").ResolveInterfaceMethodHooks, import("@metamask/snaps-sdk").ResolveInterfaceParams, null>;
26
27
  snap_getCurrencyRate: import("@metamask/permission-controller").PermittedHandlerExport<import("./getCurrencyRate.mjs").GetCurrencyRateMethodHooks, import("@metamask/snaps-sdk").GetCurrencyRateParams, import("@metamask/snaps-sdk").GetCurrencyRateResult>;
27
28
  snap_experimentalProviderRequest: import("@metamask/permission-controller").PermittedHandlerExport<import("./experimentalProviderRequest.mjs").ProviderRequestMethodHooks, import("@metamask/snaps-sdk").ProviderRequestParams, import("@metamask/utils").Json>;
@@ -40,5 +41,5 @@ export declare const handlers: (import("@metamask/permission-controller").Permit
40
41
  size: number;
41
42
  contentType: string;
42
43
  contents: string;
43
- } | null> | null>> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getSnaps.mjs").GetSnapsHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getState.mjs").GetStateHooks, import("@metamask/snaps-sdk").GetStateParams, import("@metamask/utils").Json> | import("@metamask/permission-controller").PermittedHandlerExport<import("./requestSnaps.mjs").RequestSnapsHooks, import("@metamask/snaps-sdk").RequestSnapsParams, import("@metamask/snaps-sdk").RequestSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./resolveInterface.mjs").ResolveInterfaceMethodHooks, import("@metamask/snaps-sdk").ResolveInterfaceParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./scheduleBackgroundEvent.mjs").ScheduleBackgroundEventMethodHooks, import("@metamask/snaps-sdk").ScheduleBackgroundEventParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./setState.mjs").SetStateHooks, import("@metamask/snaps-sdk").SetStateParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./updateInterface.mjs").UpdateInterfaceMethodHooks, import("@metamask/snaps-sdk").UpdateInterfaceParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getFile.mjs").GetFileHooks, import("@metamask/snaps-sdk").GetFileParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getInterfaceContext.mjs").GetInterfaceContextMethodHooks, import("@metamask/snaps-sdk").GetInterfaceContextParams, import("@metamask/snaps-sdk").GetInterfaceContextResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeSnapSugar.mjs").InvokeSnapSugarHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json> | import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeKeyring.mjs").InvokeKeyringHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json>)[];
44
+ } | null> | null>> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getSnaps.mjs").GetSnapsHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getState.mjs").GetStateHooks, import("@metamask/snaps-sdk").GetStateParams, import("@metamask/utils").Json> | import("@metamask/permission-controller").PermittedHandlerExport<import("./listEntropySources.mjs").ListEntropySourcesHooks, never, import("@metamask/snaps-sdk").ListEntropySourcesResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./requestSnaps.mjs").RequestSnapsHooks, import("@metamask/snaps-sdk").RequestSnapsParams, import("@metamask/snaps-sdk").RequestSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./resolveInterface.mjs").ResolveInterfaceMethodHooks, import("@metamask/snaps-sdk").ResolveInterfaceParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./scheduleBackgroundEvent.mjs").ScheduleBackgroundEventMethodHooks, import("@metamask/snaps-sdk").ScheduleBackgroundEventParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./setState.mjs").SetStateHooks, import("@metamask/snaps-sdk").SetStateParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./updateInterface.mjs").UpdateInterfaceMethodHooks, import("@metamask/snaps-sdk").UpdateInterfaceParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getFile.mjs").GetFileHooks, import("@metamask/snaps-sdk").GetFileParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getInterfaceContext.mjs").GetInterfaceContextMethodHooks, import("@metamask/snaps-sdk").GetInterfaceContextParams, import("@metamask/snaps-sdk").GetInterfaceContextResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeSnapSugar.mjs").InvokeSnapSugarHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json> | import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeKeyring.mjs").InvokeKeyringHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json>)[];
44
45
  //# sourceMappingURL=handlers.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.mts","sourceRoot":"","sources":["../../src/permitted/handlers.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqB1B,CAAC;AAGF,eAAO,MAAM,QAAQ;;;;;;;;;;0kEAAgC,CAAC"}
1
+ {"version":3,"file":"handlers.d.mts","sourceRoot":"","sources":["../../src/permitted/handlers.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsB1B,CAAC;AAGF,eAAO,MAAM,QAAQ;;;;;;;;;;owEAAgC,CAAC"}
@@ -13,6 +13,7 @@ import { getSnapsHandler } from "./getSnaps.mjs";
13
13
  import { getStateHandler } from "./getState.mjs";
14
14
  import { invokeKeyringHandler } from "./invokeKeyring.mjs";
15
15
  import { invokeSnapSugarHandler } from "./invokeSnapSugar.mjs";
16
+ import { listEntropySourcesHandler } from "./listEntropySources.mjs";
16
17
  import { requestSnapsHandler } from "./requestSnaps.mjs";
17
18
  import { resolveInterfaceHandler } from "./resolveInterface.mjs";
18
19
  import { scheduleBackgroundEventHandler } from "./scheduleBackgroundEvent.mjs";
@@ -33,6 +34,7 @@ export const methodHandlers = {
33
34
  snap_updateInterface: updateInterfaceHandler,
34
35
  snap_getInterfaceState: getInterfaceStateHandler,
35
36
  snap_getInterfaceContext: getInterfaceContextHandler,
37
+ snap_listEntropySources: listEntropySourcesHandler,
36
38
  snap_resolveInterface: resolveInterfaceHandler,
37
39
  snap_getCurrencyRate: getCurrencyRateHandler,
38
40
  snap_experimentalProviderRequest: providerRequestHandler,
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.mjs","sourceRoot":"","sources":["../../src/permitted/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,oCAAgC;AACvE,OAAO,EAAE,iBAAiB,EAAE,yBAAqB;AACjD,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,sBAAsB,EAAE,0CAAsC;AACvE,OAAO,EAAE,kBAAkB,EAAE,0BAAsB;AACnD,OAAO,EAAE,0BAA0B,EAAE,kCAA8B;AACnE,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,cAAc,EAAE,sBAAkB;AAC3C,OAAO,EAAE,0BAA0B,EAAE,kCAA8B;AACnE,OAAO,EAAE,wBAAwB,EAAE,gCAA4B;AAC/D,OAAO,EAAE,eAAe,EAAE,uBAAmB;AAC7C,OAAO,EAAE,eAAe,EAAE,uBAAmB;AAC7C,OAAO,EAAE,oBAAoB,EAAE,4BAAwB;AACvD,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,mBAAmB,EAAE,2BAAuB;AACrD,OAAO,EAAE,uBAAuB,EAAE,+BAA2B;AAC7D,OAAO,EAAE,8BAA8B,EAAE,sCAAkC;AAC3E,OAAO,EAAE,eAAe,EAAE,uBAAmB;AAC7C,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAE3D,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,kBAAkB,EAAE,kBAAkB;IACtC,eAAe,EAAE,eAAe;IAChC,mBAAmB,EAAE,mBAAmB;IACxC,iBAAiB,EAAE,sBAAsB;IACzC,oBAAoB,EAAE,oBAAoB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,oBAAoB,EAAE,sBAAsB;IAC5C,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,oBAAoB,EAAE,sBAAsB;IAC5C,oBAAoB,EAAE,sBAAsB;IAC5C,sBAAsB,EAAE,wBAAwB;IAChD,wBAAwB,EAAE,0BAA0B;IACpD,qBAAqB,EAAE,uBAAuB;IAC9C,oBAAoB,EAAE,sBAAsB;IAC5C,gCAAgC,EAAE,sBAAsB;IACxD,4BAA4B,EAAE,8BAA8B;IAC5D,0BAA0B,EAAE,4BAA4B;IACxD,wBAAwB,EAAE,0BAA0B;IACpD,aAAa,EAAE,eAAe;CAC/B,CAAC;AACF,wDAAwD;AAExD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import { cancelBackgroundEventHandler } from './cancelBackgroundEvent';\nimport { clearStateHandler } from './clearState';\nimport { createInterfaceHandler } from './createInterface';\nimport { providerRequestHandler } from './experimentalProviderRequest';\nimport { getAllSnapsHandler } from './getAllSnaps';\nimport { getBackgroundEventsHandler } from './getBackgroundEvents';\nimport { getClientStatusHandler } from './getClientStatus';\nimport { getCurrencyRateHandler } from './getCurrencyRate';\nimport { getFileHandler } from './getFile';\nimport { getInterfaceContextHandler } from './getInterfaceContext';\nimport { getInterfaceStateHandler } from './getInterfaceState';\nimport { getSnapsHandler } from './getSnaps';\nimport { getStateHandler } from './getState';\nimport { invokeKeyringHandler } from './invokeKeyring';\nimport { invokeSnapSugarHandler } from './invokeSnapSugar';\nimport { requestSnapsHandler } from './requestSnaps';\nimport { resolveInterfaceHandler } from './resolveInterface';\nimport { scheduleBackgroundEventHandler } from './scheduleBackgroundEvent';\nimport { setStateHandler } from './setState';\nimport { updateInterfaceHandler } from './updateInterface';\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_clearState: clearStateHandler,\n snap_getClientStatus: getClientStatusHandler,\n snap_getFile: getFileHandler,\n snap_getState: getStateHandler,\n snap_createInterface: createInterfaceHandler,\n snap_updateInterface: updateInterfaceHandler,\n snap_getInterfaceState: getInterfaceStateHandler,\n snap_getInterfaceContext: getInterfaceContextHandler,\n snap_resolveInterface: resolveInterfaceHandler,\n snap_getCurrencyRate: getCurrencyRateHandler,\n snap_experimentalProviderRequest: providerRequestHandler,\n snap_scheduleBackgroundEvent: scheduleBackgroundEventHandler,\n snap_cancelBackgroundEvent: cancelBackgroundEventHandler,\n snap_getBackgroundEvents: getBackgroundEventsHandler,\n snap_setState: setStateHandler,\n};\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport const handlers = Object.values(methodHandlers);\n"]}
1
+ {"version":3,"file":"handlers.mjs","sourceRoot":"","sources":["../../src/permitted/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,oCAAgC;AACvE,OAAO,EAAE,iBAAiB,EAAE,yBAAqB;AACjD,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,sBAAsB,EAAE,0CAAsC;AACvE,OAAO,EAAE,kBAAkB,EAAE,0BAAsB;AACnD,OAAO,EAAE,0BAA0B,EAAE,kCAA8B;AACnE,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,cAAc,EAAE,sBAAkB;AAC3C,OAAO,EAAE,0BAA0B,EAAE,kCAA8B;AACnE,OAAO,EAAE,wBAAwB,EAAE,gCAA4B;AAC/D,OAAO,EAAE,eAAe,EAAE,uBAAmB;AAC7C,OAAO,EAAE,eAAe,EAAE,uBAAmB;AAC7C,OAAO,EAAE,oBAAoB,EAAE,4BAAwB;AACvD,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,yBAAyB,EAAE,iCAA6B;AACjE,OAAO,EAAE,mBAAmB,EAAE,2BAAuB;AACrD,OAAO,EAAE,uBAAuB,EAAE,+BAA2B;AAC7D,OAAO,EAAE,8BAA8B,EAAE,sCAAkC;AAC3E,OAAO,EAAE,eAAe,EAAE,uBAAmB;AAC7C,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAE3D,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,kBAAkB,EAAE,kBAAkB;IACtC,eAAe,EAAE,eAAe;IAChC,mBAAmB,EAAE,mBAAmB;IACxC,iBAAiB,EAAE,sBAAsB;IACzC,oBAAoB,EAAE,oBAAoB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,oBAAoB,EAAE,sBAAsB;IAC5C,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,oBAAoB,EAAE,sBAAsB;IAC5C,oBAAoB,EAAE,sBAAsB;IAC5C,sBAAsB,EAAE,wBAAwB;IAChD,wBAAwB,EAAE,0BAA0B;IACpD,uBAAuB,EAAE,yBAAyB;IAClD,qBAAqB,EAAE,uBAAuB;IAC9C,oBAAoB,EAAE,sBAAsB;IAC5C,gCAAgC,EAAE,sBAAsB;IACxD,4BAA4B,EAAE,8BAA8B;IAC5D,0BAA0B,EAAE,4BAA4B;IACxD,wBAAwB,EAAE,0BAA0B;IACpD,aAAa,EAAE,eAAe;CAC/B,CAAC;AACF,wDAAwD;AAExD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import { cancelBackgroundEventHandler } from './cancelBackgroundEvent';\nimport { clearStateHandler } from './clearState';\nimport { createInterfaceHandler } from './createInterface';\nimport { providerRequestHandler } from './experimentalProviderRequest';\nimport { getAllSnapsHandler } from './getAllSnaps';\nimport { getBackgroundEventsHandler } from './getBackgroundEvents';\nimport { getClientStatusHandler } from './getClientStatus';\nimport { getCurrencyRateHandler } from './getCurrencyRate';\nimport { getFileHandler } from './getFile';\nimport { getInterfaceContextHandler } from './getInterfaceContext';\nimport { getInterfaceStateHandler } from './getInterfaceState';\nimport { getSnapsHandler } from './getSnaps';\nimport { getStateHandler } from './getState';\nimport { invokeKeyringHandler } from './invokeKeyring';\nimport { invokeSnapSugarHandler } from './invokeSnapSugar';\nimport { listEntropySourcesHandler } from './listEntropySources';\nimport { requestSnapsHandler } from './requestSnaps';\nimport { resolveInterfaceHandler } from './resolveInterface';\nimport { scheduleBackgroundEventHandler } from './scheduleBackgroundEvent';\nimport { setStateHandler } from './setState';\nimport { updateInterfaceHandler } from './updateInterface';\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_clearState: clearStateHandler,\n snap_getClientStatus: getClientStatusHandler,\n snap_getFile: getFileHandler,\n snap_getState: getStateHandler,\n snap_createInterface: createInterfaceHandler,\n snap_updateInterface: updateInterfaceHandler,\n snap_getInterfaceState: getInterfaceStateHandler,\n snap_getInterfaceContext: getInterfaceContextHandler,\n snap_listEntropySources: listEntropySourcesHandler,\n snap_resolveInterface: resolveInterfaceHandler,\n snap_getCurrencyRate: getCurrencyRateHandler,\n snap_experimentalProviderRequest: providerRequestHandler,\n snap_scheduleBackgroundEvent: scheduleBackgroundEventHandler,\n snap_cancelBackgroundEvent: cancelBackgroundEventHandler,\n snap_getBackgroundEvents: getBackgroundEventsHandler,\n snap_setState: setStateHandler,\n};\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport const handlers = Object.values(methodHandlers);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkCA,iDAA2B;AAC3B,mDAA6B","sourcesContent":["import type { CancelBackgroundEventMethodHooks } from './cancelBackgroundEvent';\nimport type { ClearStateHooks } from './clearState';\nimport type { CreateInterfaceMethodHooks } from './createInterface';\nimport type { ProviderRequestMethodHooks } from './experimentalProviderRequest';\nimport type { GetAllSnapsHooks } from './getAllSnaps';\nimport type { GetBackgroundEventsMethodHooks } from './getBackgroundEvents';\nimport type { GetClientStatusHooks } from './getClientStatus';\nimport type { GetCurrencyRateMethodHooks } from './getCurrencyRate';\nimport type { GetInterfaceStateMethodHooks } from './getInterfaceState';\nimport type { GetSnapsHooks } from './getSnaps';\nimport type { GetStateHooks } from './getState';\nimport type { RequestSnapsHooks } from './requestSnaps';\nimport type { ResolveInterfaceMethodHooks } from './resolveInterface';\nimport type { ScheduleBackgroundEventMethodHooks } from './scheduleBackgroundEvent';\nimport type { SetStateHooks } from './setState';\nimport type { UpdateInterfaceMethodHooks } from './updateInterface';\n\nexport type PermittedRpcMethodHooks = ClearStateHooks &\n GetAllSnapsHooks &\n GetClientStatusHooks &\n GetSnapsHooks &\n GetStateHooks &\n RequestSnapsHooks &\n CreateInterfaceMethodHooks &\n UpdateInterfaceMethodHooks &\n GetInterfaceStateMethodHooks &\n ResolveInterfaceMethodHooks &\n GetCurrencyRateMethodHooks &\n ProviderRequestMethodHooks &\n ScheduleBackgroundEventMethodHooks &\n CancelBackgroundEventMethodHooks &\n GetBackgroundEventsMethodHooks &\n SetStateHooks;\n\nexport * from './handlers';\nexport * from './middleware';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoCA,iDAA2B;AAC3B,mDAA6B","sourcesContent":["import type { CancelBackgroundEventMethodHooks } from './cancelBackgroundEvent';\nimport type { ClearStateHooks } from './clearState';\nimport type { CreateInterfaceMethodHooks } from './createInterface';\nimport type { ProviderRequestMethodHooks } from './experimentalProviderRequest';\nimport type { GetAllSnapsHooks } from './getAllSnaps';\nimport type { GetBackgroundEventsMethodHooks } from './getBackgroundEvents';\nimport type { GetClientStatusHooks } from './getClientStatus';\nimport type { GetCurrencyRateMethodHooks } from './getCurrencyRate';\nimport type { GetInterfaceStateMethodHooks } from './getInterfaceState';\nimport type { GetSnapsHooks } from './getSnaps';\nimport type { GetStateHooks } from './getState';\nimport type { ListEntropySourcesHooks } from './listEntropySources';\nimport type { RequestSnapsHooks } from './requestSnaps';\nimport type { ResolveInterfaceMethodHooks } from './resolveInterface';\nimport type { ScheduleBackgroundEventMethodHooks } from './scheduleBackgroundEvent';\nimport type { SetStateHooks } from './setState';\nimport type { UpdateInterfaceMethodHooks } from './updateInterface';\n\nexport type PermittedRpcMethodHooks = ClearStateHooks &\n GetAllSnapsHooks &\n GetClientStatusHooks &\n GetSnapsHooks &\n GetStateHooks &\n ListEntropySourcesHooks &\n RequestSnapsHooks &\n CreateInterfaceMethodHooks &\n UpdateInterfaceMethodHooks &\n GetInterfaceStateMethodHooks &\n ResolveInterfaceMethodHooks &\n GetCurrencyRateMethodHooks &\n ProviderRequestMethodHooks &\n ScheduleBackgroundEventMethodHooks &\n CancelBackgroundEventMethodHooks &\n GetBackgroundEventsMethodHooks &\n SetStateHooks;\n\nexport * from './handlers';\nexport * from './middleware';\n"]}
@@ -9,12 +9,13 @@ import type { GetCurrencyRateMethodHooks } from "./getCurrencyRate.cjs";
9
9
  import type { GetInterfaceStateMethodHooks } from "./getInterfaceState.cjs";
10
10
  import type { GetSnapsHooks } from "./getSnaps.cjs";
11
11
  import type { GetStateHooks } from "./getState.cjs";
12
+ import type { ListEntropySourcesHooks } from "./listEntropySources.cjs";
12
13
  import type { RequestSnapsHooks } from "./requestSnaps.cjs";
13
14
  import type { ResolveInterfaceMethodHooks } from "./resolveInterface.cjs";
14
15
  import type { ScheduleBackgroundEventMethodHooks } from "./scheduleBackgroundEvent.cjs";
15
16
  import type { SetStateHooks } from "./setState.cjs";
16
17
  import type { UpdateInterfaceMethodHooks } from "./updateInterface.cjs";
17
- export type PermittedRpcMethodHooks = ClearStateHooks & GetAllSnapsHooks & GetClientStatusHooks & GetSnapsHooks & GetStateHooks & RequestSnapsHooks & CreateInterfaceMethodHooks & UpdateInterfaceMethodHooks & GetInterfaceStateMethodHooks & ResolveInterfaceMethodHooks & GetCurrencyRateMethodHooks & ProviderRequestMethodHooks & ScheduleBackgroundEventMethodHooks & CancelBackgroundEventMethodHooks & GetBackgroundEventsMethodHooks & SetStateHooks;
18
+ export type PermittedRpcMethodHooks = ClearStateHooks & GetAllSnapsHooks & GetClientStatusHooks & GetSnapsHooks & GetStateHooks & ListEntropySourcesHooks & RequestSnapsHooks & CreateInterfaceMethodHooks & UpdateInterfaceMethodHooks & GetInterfaceStateMethodHooks & ResolveInterfaceMethodHooks & GetCurrencyRateMethodHooks & ProviderRequestMethodHooks & ScheduleBackgroundEventMethodHooks & CancelBackgroundEventMethodHooks & GetBackgroundEventsMethodHooks & SetStateHooks;
18
19
  export * from "./handlers.cjs";
19
20
  export * from "./middleware.cjs";
20
21
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,oCAAgC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AACpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AACpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,0CAAsC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAAsB;AACtD,OAAO,KAAK,EAAE,8BAA8B,EAAE,kCAA8B;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,8BAA0B;AAC9D,OAAO,KAAK,EAA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OAAO,KAAK,EAAE,aAAa,EAAE,uBAAmB;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,iCAA6B;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,2BAAuB;AACxD,OAAO,KAAK,EAAE,2BAA2B,EAAE,+BAA2B;AACtE,OAAO,KAAK,EAAE,kCAAkC,EAAE,sCAAkC;AACpF,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAmB;AAChD,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AAEpE,MAAM,MAAM,uBAAuB,GAAG,eAAe,GACnD,gBAAgB,GAChB,oBAAoB,GACpB,aAAa,GACb,aAAa,GACb,uBAAuB,GACvB,iBAAiB,GACjB,0BAA0B,GAC1B,0BAA0B,GAC1B,4BAA4B,GAC5B,2BAA2B,GAC3B,0BAA0B,GAC1B,0BAA0B,GAC1B,kCAAkC,GAClC,gCAAgC,GAChC,8BAA8B,GAC9B,aAAa,CAAC;AAEhB,+BAA2B;AAC3B,iCAA6B"}
@@ -9,12 +9,13 @@ import type { GetCurrencyRateMethodHooks } from "./getCurrencyRate.mjs";
9
9
  import type { GetInterfaceStateMethodHooks } from "./getInterfaceState.mjs";
10
10
  import type { GetSnapsHooks } from "./getSnaps.mjs";
11
11
  import type { GetStateHooks } from "./getState.mjs";
12
+ import type { ListEntropySourcesHooks } from "./listEntropySources.mjs";
12
13
  import type { RequestSnapsHooks } from "./requestSnaps.mjs";
13
14
  import type { ResolveInterfaceMethodHooks } from "./resolveInterface.mjs";
14
15
  import type { ScheduleBackgroundEventMethodHooks } from "./scheduleBackgroundEvent.mjs";
15
16
  import type { SetStateHooks } from "./setState.mjs";
16
17
  import type { UpdateInterfaceMethodHooks } from "./updateInterface.mjs";
17
- export type PermittedRpcMethodHooks = ClearStateHooks & GetAllSnapsHooks & GetClientStatusHooks & GetSnapsHooks & GetStateHooks & RequestSnapsHooks & CreateInterfaceMethodHooks & UpdateInterfaceMethodHooks & GetInterfaceStateMethodHooks & ResolveInterfaceMethodHooks & GetCurrencyRateMethodHooks & ProviderRequestMethodHooks & ScheduleBackgroundEventMethodHooks & CancelBackgroundEventMethodHooks & GetBackgroundEventsMethodHooks & SetStateHooks;
18
+ export type PermittedRpcMethodHooks = ClearStateHooks & GetAllSnapsHooks & GetClientStatusHooks & GetSnapsHooks & GetStateHooks & ListEntropySourcesHooks & RequestSnapsHooks & CreateInterfaceMethodHooks & UpdateInterfaceMethodHooks & GetInterfaceStateMethodHooks & ResolveInterfaceMethodHooks & GetCurrencyRateMethodHooks & ProviderRequestMethodHooks & ScheduleBackgroundEventMethodHooks & CancelBackgroundEventMethodHooks & GetBackgroundEventsMethodHooks & SetStateHooks;
18
19
  export * from "./handlers.mjs";
19
20
  export * from "./middleware.mjs";
20
21
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,oCAAgC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AACpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AACpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,0CAAsC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAAsB;AACtD,OAAO,KAAK,EAAE,8BAA8B,EAAE,kCAA8B;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,8BAA0B;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AACpE,OAAO,KAAK,EAAE,4BAA4B,EAAE,gCAA4B;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAmB;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAmB;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,2BAAuB;AACxD,OAAO,KAAK,EAAE,2BAA2B,EAAE,+BAA2B;AACtE,OAAO,KAAK,EAAE,kCAAkC,EAAE,sCA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AA0B,EAAE,8BAA0B;AAEpE,MAAM,MAAM,uBAAuB,GAAG,eAAe,GACnD,gBAAgB,GAChB,oBAAoB,GACpB,aAAa,GACb,aAAa,GACb,uBAAuB,GACvB,iBAAiB,GACjB,0BAA0B,GAC1B,0BAA0B,GAC1B,4BAA4B,GAC5B,2BAA2B,GAC3B,0BAA0B,GAC1B,0BAA0B,GAC1B,kCAAkC,GAClC,gCAAgC,GAChC,8BAA8B,GAC9B,aAAa,CAAC;AAEhB,+BAA2B;AAC3B,iCAA6B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":"AAkCA,+BAA2B;AAC3B,iCAA6B","sourcesContent":["import type { CancelBackgroundEventMethodHooks } from './cancelBackgroundEvent';\nimport type { ClearStateHooks } from './clearState';\nimport type { CreateInterfaceMethodHooks } from './createInterface';\nimport type { ProviderRequestMethodHooks } from './experimentalProviderRequest';\nimport type { GetAllSnapsHooks } from './getAllSnaps';\nimport type { GetBackgroundEventsMethodHooks } from './getBackgroundEvents';\nimport type { GetClientStatusHooks } from './getClientStatus';\nimport type { GetCurrencyRateMethodHooks } from './getCurrencyRate';\nimport type { GetInterfaceStateMethodHooks } from './getInterfaceState';\nimport type { GetSnapsHooks } from './getSnaps';\nimport type { GetStateHooks } from './getState';\nimport type { RequestSnapsHooks } from './requestSnaps';\nimport type { ResolveInterfaceMethodHooks } from './resolveInterface';\nimport type { ScheduleBackgroundEventMethodHooks } from './scheduleBackgroundEvent';\nimport type { SetStateHooks } from './setState';\nimport type { UpdateInterfaceMethodHooks } from './updateInterface';\n\nexport type PermittedRpcMethodHooks = ClearStateHooks &\n GetAllSnapsHooks &\n GetClientStatusHooks &\n GetSnapsHooks &\n GetStateHooks &\n RequestSnapsHooks &\n CreateInterfaceMethodHooks &\n UpdateInterfaceMethodHooks &\n GetInterfaceStateMethodHooks &\n ResolveInterfaceMethodHooks &\n GetCurrencyRateMethodHooks &\n ProviderRequestMethodHooks &\n ScheduleBackgroundEventMethodHooks &\n CancelBackgroundEventMethodHooks &\n GetBackgroundEventsMethodHooks &\n SetStateHooks;\n\nexport * from './handlers';\nexport * from './middleware';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":"AAoCA,+BAA2B;AAC3B,iCAA6B","sourcesContent":["import type { CancelBackgroundEventMethodHooks } from './cancelBackgroundEvent';\nimport type { ClearStateHooks } from './clearState';\nimport type { CreateInterfaceMethodHooks } from './createInterface';\nimport type { ProviderRequestMethodHooks } from './experimentalProviderRequest';\nimport type { GetAllSnapsHooks } from './getAllSnaps';\nimport type { GetBackgroundEventsMethodHooks } from './getBackgroundEvents';\nimport type { GetClientStatusHooks } from './getClientStatus';\nimport type { GetCurrencyRateMethodHooks } from './getCurrencyRate';\nimport type { GetInterfaceStateMethodHooks } from './getInterfaceState';\nimport type { GetSnapsHooks } from './getSnaps';\nimport type { GetStateHooks } from './getState';\nimport type { ListEntropySourcesHooks } from './listEntropySources';\nimport type { RequestSnapsHooks } from './requestSnaps';\nimport type { ResolveInterfaceMethodHooks } from './resolveInterface';\nimport type { ScheduleBackgroundEventMethodHooks } from './scheduleBackgroundEvent';\nimport type { SetStateHooks } from './setState';\nimport type { UpdateInterfaceMethodHooks } from './updateInterface';\n\nexport type PermittedRpcMethodHooks = ClearStateHooks &\n GetAllSnapsHooks &\n GetClientStatusHooks &\n GetSnapsHooks &\n GetStateHooks &\n ListEntropySourcesHooks &\n RequestSnapsHooks &\n CreateInterfaceMethodHooks &\n UpdateInterfaceMethodHooks &\n GetInterfaceStateMethodHooks &\n ResolveInterfaceMethodHooks &\n GetCurrencyRateMethodHooks &\n ProviderRequestMethodHooks &\n ScheduleBackgroundEventMethodHooks &\n CancelBackgroundEventMethodHooks &\n GetBackgroundEventsMethodHooks &\n SetStateHooks;\n\nexport * from './handlers';\nexport * from './middleware';\n"]}