@metamask-previews/eth-json-rpc-middleware 22.0.1-preview-47cfb4e → 22.0.1-preview-85ecacba

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 (50) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/index.cjs +7 -1
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +5 -1
  5. package/dist/index.d.cts.map +1 -1
  6. package/dist/index.d.mts +5 -1
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +2 -0
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/methods/wallet-get-granted-execution-permissions.cjs +61 -0
  11. package/dist/methods/wallet-get-granted-execution-permissions.cjs.map +1 -0
  12. package/dist/methods/wallet-get-granted-execution-permissions.d.cts +140 -0
  13. package/dist/methods/wallet-get-granted-execution-permissions.d.cts.map +1 -0
  14. package/dist/methods/wallet-get-granted-execution-permissions.d.mts +140 -0
  15. package/dist/methods/wallet-get-granted-execution-permissions.d.mts.map +1 -0
  16. package/dist/methods/wallet-get-granted-execution-permissions.mjs +57 -0
  17. package/dist/methods/wallet-get-granted-execution-permissions.mjs.map +1 -0
  18. package/dist/methods/wallet-get-supported-execution-permissions.cjs +47 -0
  19. package/dist/methods/wallet-get-supported-execution-permissions.cjs.map +1 -0
  20. package/dist/methods/wallet-get-supported-execution-permissions.d.cts +54 -0
  21. package/dist/methods/wallet-get-supported-execution-permissions.d.cts.map +1 -0
  22. package/dist/methods/wallet-get-supported-execution-permissions.d.mts +54 -0
  23. package/dist/methods/wallet-get-supported-execution-permissions.d.mts.map +1 -0
  24. package/dist/methods/wallet-get-supported-execution-permissions.mjs +43 -0
  25. package/dist/methods/wallet-get-supported-execution-permissions.mjs.map +1 -0
  26. package/dist/methods/wallet-request-execution-permissions.cjs +2 -9
  27. package/dist/methods/wallet-request-execution-permissions.cjs.map +1 -1
  28. package/dist/methods/wallet-request-execution-permissions.d.cts +16 -54
  29. package/dist/methods/wallet-request-execution-permissions.d.cts.map +1 -1
  30. package/dist/methods/wallet-request-execution-permissions.d.mts +16 -54
  31. package/dist/methods/wallet-request-execution-permissions.d.mts.map +1 -1
  32. package/dist/methods/wallet-request-execution-permissions.mjs +2 -9
  33. package/dist/methods/wallet-request-execution-permissions.mjs.map +1 -1
  34. package/dist/utils/structs.cjs +21 -0
  35. package/dist/utils/structs.cjs.map +1 -0
  36. package/dist/utils/structs.d.cts +17 -0
  37. package/dist/utils/structs.d.cts.map +1 -0
  38. package/dist/utils/structs.d.mts +17 -0
  39. package/dist/utils/structs.d.mts.map +1 -0
  40. package/dist/utils/structs.mjs +18 -0
  41. package/dist/utils/structs.mjs.map +1 -0
  42. package/dist/wallet.cjs +11 -1
  43. package/dist/wallet.cjs.map +1 -1
  44. package/dist/wallet.d.cts +7 -1
  45. package/dist/wallet.d.cts.map +1 -1
  46. package/dist/wallet.d.mts +7 -1
  47. package/dist/wallet.d.mts.map +1 -1
  48. package/dist/wallet.mjs +11 -1
  49. package/dist/wallet.mjs.map +1 -1
  50. package/package.json +1 -1
@@ -0,0 +1,54 @@
1
+ import type { JsonRpcMiddleware } from "@metamask/json-rpc-engine/v2";
2
+ import type { Infer } from "@metamask/superstruct";
3
+ import type { Json, JsonRpcRequest } from "@metamask/utils";
4
+ import type { WalletMiddlewareContext } from "../wallet.cjs";
5
+ /**
6
+ * Superstruct schema for the `wallet_getSupportedExecutionPermissions` request params.
7
+ *
8
+ * This method expects no parameters. Different JSON-RPC clients may send "no params"
9
+ * in different ways (omitted, empty array, or empty object), so we accept all three.
10
+ */
11
+ export declare const GetSupportedExecutionPermissionsParamsStruct: import("@metamask/superstruct").Struct<[] | {} | undefined, null>;
12
+ /**
13
+ * Superstruct schema for a supported permission type configuration.
14
+ */
15
+ export declare const SupportedExecutionPermissionConfigStruct: import("@metamask/superstruct").Struct<{
16
+ chainIds: `0x${string}`[];
17
+ ruleTypes: string[];
18
+ }, {
19
+ chainIds: import("@metamask/superstruct").Struct<`0x${string}`[], import("@metamask/superstruct").Struct<`0x${string}`, null>>;
20
+ ruleTypes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
21
+ }>;
22
+ /**
23
+ * Represents the supported configuration for a permission type.
24
+ */
25
+ export type SupportedExecutionPermissionConfig = Infer<typeof SupportedExecutionPermissionConfigStruct>;
26
+ /**
27
+ * Superstruct schema for the `wallet_getSupportedExecutionPermissions` result.
28
+ */
29
+ export declare const GetSupportedExecutionPermissionsResultStruct: import("@metamask/superstruct").Struct<Record<string, {
30
+ chainIds: `0x${string}`[];
31
+ ruleTypes: string[];
32
+ }>, null>;
33
+ /**
34
+ * Result type for the `wallet_getSupportedExecutionPermissions` JSON-RPC method.
35
+ * Returns an object keyed on supported permission types with their configurations.
36
+ */
37
+ export type GetSupportedExecutionPermissionsResult = Json & Infer<typeof GetSupportedExecutionPermissionsResultStruct>;
38
+ /**
39
+ * Hook type for processing the `wallet_getSupportedExecutionPermissions` request.
40
+ */
41
+ export type ProcessGetSupportedExecutionPermissionsHook = (req: JsonRpcRequest, context: WalletMiddlewareContext) => Promise<GetSupportedExecutionPermissionsResult>;
42
+ /**
43
+ * Creates a handler for the `wallet_getSupportedExecutionPermissions` JSON-RPC method.
44
+ *
45
+ * @param options - The options for the handler.
46
+ * @param options.processGetSupportedExecutionPermissions - The function to process the
47
+ * get supported execution permissions request.
48
+ * @returns A JSON-RPC middleware function that handles the
49
+ * `wallet_getSupportedExecutionPermissions` JSON-RPC method.
50
+ */
51
+ export declare function createWalletGetSupportedExecutionPermissionsHandler({ processGetSupportedExecutionPermissions, }: {
52
+ processGetSupportedExecutionPermissions?: ProcessGetSupportedExecutionPermissionsHook;
53
+ }): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext>;
54
+ //# sourceMappingURL=wallet-get-supported-execution-permissions.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-get-supported-execution-permissions.d.cts","sourceRoot":"","sources":["../../src/methods/wallet-get-supported-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAI5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,4CAA4C,mEAAiB,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,wCAAwC;;;;;;EAGnD,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,KAAK,CACpD,OAAO,wCAAwC,CAChD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4CAA4C;;;SAGxD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sCAAsC,GAAG,IAAI,GACvD,KAAK,CAAC,OAAO,4CAA4C,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,2CAA2C,GAAG,CACxD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,sCAAsC,CAAC,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAgB,mDAAmD,CAAC,EAClE,uCAAuC,GACxC,EAAE;IACD,uCAAuC,CAAC,EAAE,2CAA2C,CAAC;CACvF,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAcnE"}
@@ -0,0 +1,54 @@
1
+ import type { JsonRpcMiddleware } from "@metamask/json-rpc-engine/v2";
2
+ import type { Infer } from "@metamask/superstruct";
3
+ import type { Json, JsonRpcRequest } from "@metamask/utils";
4
+ import type { WalletMiddlewareContext } from "../wallet.mjs";
5
+ /**
6
+ * Superstruct schema for the `wallet_getSupportedExecutionPermissions` request params.
7
+ *
8
+ * This method expects no parameters. Different JSON-RPC clients may send "no params"
9
+ * in different ways (omitted, empty array, or empty object), so we accept all three.
10
+ */
11
+ export declare const GetSupportedExecutionPermissionsParamsStruct: import("@metamask/superstruct").Struct<[] | {} | undefined, null>;
12
+ /**
13
+ * Superstruct schema for a supported permission type configuration.
14
+ */
15
+ export declare const SupportedExecutionPermissionConfigStruct: import("@metamask/superstruct").Struct<{
16
+ chainIds: `0x${string}`[];
17
+ ruleTypes: string[];
18
+ }, {
19
+ chainIds: import("@metamask/superstruct").Struct<`0x${string}`[], import("@metamask/superstruct").Struct<`0x${string}`, null>>;
20
+ ruleTypes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
21
+ }>;
22
+ /**
23
+ * Represents the supported configuration for a permission type.
24
+ */
25
+ export type SupportedExecutionPermissionConfig = Infer<typeof SupportedExecutionPermissionConfigStruct>;
26
+ /**
27
+ * Superstruct schema for the `wallet_getSupportedExecutionPermissions` result.
28
+ */
29
+ export declare const GetSupportedExecutionPermissionsResultStruct: import("@metamask/superstruct").Struct<Record<string, {
30
+ chainIds: `0x${string}`[];
31
+ ruleTypes: string[];
32
+ }>, null>;
33
+ /**
34
+ * Result type for the `wallet_getSupportedExecutionPermissions` JSON-RPC method.
35
+ * Returns an object keyed on supported permission types with their configurations.
36
+ */
37
+ export type GetSupportedExecutionPermissionsResult = Json & Infer<typeof GetSupportedExecutionPermissionsResultStruct>;
38
+ /**
39
+ * Hook type for processing the `wallet_getSupportedExecutionPermissions` request.
40
+ */
41
+ export type ProcessGetSupportedExecutionPermissionsHook = (req: JsonRpcRequest, context: WalletMiddlewareContext) => Promise<GetSupportedExecutionPermissionsResult>;
42
+ /**
43
+ * Creates a handler for the `wallet_getSupportedExecutionPermissions` JSON-RPC method.
44
+ *
45
+ * @param options - The options for the handler.
46
+ * @param options.processGetSupportedExecutionPermissions - The function to process the
47
+ * get supported execution permissions request.
48
+ * @returns A JSON-RPC middleware function that handles the
49
+ * `wallet_getSupportedExecutionPermissions` JSON-RPC method.
50
+ */
51
+ export declare function createWalletGetSupportedExecutionPermissionsHandler({ processGetSupportedExecutionPermissions, }: {
52
+ processGetSupportedExecutionPermissions?: ProcessGetSupportedExecutionPermissionsHook;
53
+ }): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext>;
54
+ //# sourceMappingURL=wallet-get-supported-execution-permissions.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-get-supported-execution-permissions.d.mts","sourceRoot":"","sources":["../../src/methods/wallet-get-supported-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAI5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,4CAA4C,mEAAiB,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,wCAAwC;;;;;;EAGnD,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,KAAK,CACpD,OAAO,wCAAwC,CAChD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4CAA4C;;;SAGxD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sCAAsC,GAAG,IAAI,GACvD,KAAK,CAAC,OAAO,4CAA4C,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,2CAA2C,GAAG,CACxD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,sCAAsC,CAAC,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAgB,mDAAmD,CAAC,EAClE,uCAAuC,GACxC,EAAE;IACD,uCAAuC,CAAC,EAAE,2CAA2C,CAAC;CACvF,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAcnE"}
@@ -0,0 +1,43 @@
1
+ import { rpcErrors } from "@metamask/rpc-errors";
2
+ import { array, object, record, string } from "@metamask/superstruct";
3
+ import { StrictHexStruct } from "@metamask/utils";
4
+ import { NoParamsStruct } from "../utils/structs.mjs";
5
+ import { validateParams } from "../utils/validation.mjs";
6
+ /**
7
+ * Superstruct schema for the `wallet_getSupportedExecutionPermissions` request params.
8
+ *
9
+ * This method expects no parameters. Different JSON-RPC clients may send "no params"
10
+ * in different ways (omitted, empty array, or empty object), so we accept all three.
11
+ */
12
+ export const GetSupportedExecutionPermissionsParamsStruct = NoParamsStruct;
13
+ /**
14
+ * Superstruct schema for a supported permission type configuration.
15
+ */
16
+ export const SupportedExecutionPermissionConfigStruct = object({
17
+ chainIds: array(StrictHexStruct),
18
+ ruleTypes: array(string()),
19
+ });
20
+ /**
21
+ * Superstruct schema for the `wallet_getSupportedExecutionPermissions` result.
22
+ */
23
+ export const GetSupportedExecutionPermissionsResultStruct = record(string(), SupportedExecutionPermissionConfigStruct);
24
+ /**
25
+ * Creates a handler for the `wallet_getSupportedExecutionPermissions` JSON-RPC method.
26
+ *
27
+ * @param options - The options for the handler.
28
+ * @param options.processGetSupportedExecutionPermissions - The function to process the
29
+ * get supported execution permissions request.
30
+ * @returns A JSON-RPC middleware function that handles the
31
+ * `wallet_getSupportedExecutionPermissions` JSON-RPC method.
32
+ */
33
+ export function createWalletGetSupportedExecutionPermissionsHandler({ processGetSupportedExecutionPermissions, }) {
34
+ return async ({ request, context }) => {
35
+ if (!processGetSupportedExecutionPermissions) {
36
+ throw rpcErrors.methodNotSupported('wallet_getSupportedExecutionPermissions - no middleware configured');
37
+ }
38
+ const { params } = request;
39
+ validateParams(params, GetSupportedExecutionPermissionsParamsStruct);
40
+ return await processGetSupportedExecutionPermissions(request, context);
41
+ };
42
+ }
43
+ //# sourceMappingURL=wallet-get-supported-execution-permissions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-get-supported-execution-permissions.mjs","sourceRoot":"","sources":["../../src/methods/wallet-get-supported-execution-permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AAEjD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AACtE,OAAO,EAAE,eAAe,EAAE,wBAAwB;AAGlD,OAAO,EAAE,cAAc,EAAE,6BAAyB;AAClD,OAAO,EAAE,cAAc,EAAE,gCAA4B;AAGrD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4CAA4C,GAAG,cAAc,CAAC;AAE3E;;GAEG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAG,MAAM,CAAC;IAC7D,QAAQ,EAAE,KAAK,CAAC,eAAe,CAAC;IAChC,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;CAC3B,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,4CAA4C,GAAG,MAAM,CAChE,MAAM,EAAE,EACR,wCAAwC,CACzC,CAAC;AAiBF;;;;;;;;GAQG;AACH,MAAM,UAAU,mDAAmD,CAAC,EAClE,uCAAuC,GAGxC;IACC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,uCAAuC,EAAE,CAAC;YAC7C,MAAM,SAAS,CAAC,kBAAkB,CAChC,oEAAoE,CACrE,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,cAAc,CAAC,MAAM,EAAE,4CAA4C,CAAC,CAAC;QAErE,OAAO,MAAM,uCAAuC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine/v2';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, object, record, string } from '@metamask/superstruct';\nimport { StrictHexStruct } from '@metamask/utils';\nimport type { Json, JsonRpcRequest } from '@metamask/utils';\n\nimport { NoParamsStruct } from '../utils/structs';\nimport { validateParams } from '../utils/validation';\nimport type { WalletMiddlewareContext } from '../wallet';\n\n/**\n * Superstruct schema for the `wallet_getSupportedExecutionPermissions` request params.\n *\n * This method expects no parameters. Different JSON-RPC clients may send \"no params\"\n * in different ways (omitted, empty array, or empty object), so we accept all three.\n */\nexport const GetSupportedExecutionPermissionsParamsStruct = NoParamsStruct;\n\n/**\n * Superstruct schema for a supported permission type configuration.\n */\nexport const SupportedExecutionPermissionConfigStruct = object({\n chainIds: array(StrictHexStruct),\n ruleTypes: array(string()),\n});\n\n/**\n * Represents the supported configuration for a permission type.\n */\nexport type SupportedExecutionPermissionConfig = Infer<\n typeof SupportedExecutionPermissionConfigStruct\n>;\n\n/**\n * Superstruct schema for the `wallet_getSupportedExecutionPermissions` result.\n */\nexport const GetSupportedExecutionPermissionsResultStruct = record(\n string(),\n SupportedExecutionPermissionConfigStruct,\n);\n\n/**\n * Result type for the `wallet_getSupportedExecutionPermissions` JSON-RPC method.\n * Returns an object keyed on supported permission types with their configurations.\n */\nexport type GetSupportedExecutionPermissionsResult = Json &\n Infer<typeof GetSupportedExecutionPermissionsResultStruct>;\n\n/**\n * Hook type for processing the `wallet_getSupportedExecutionPermissions` request.\n */\nexport type ProcessGetSupportedExecutionPermissionsHook = (\n req: JsonRpcRequest,\n context: WalletMiddlewareContext,\n) => Promise<GetSupportedExecutionPermissionsResult>;\n\n/**\n * Creates a handler for the `wallet_getSupportedExecutionPermissions` JSON-RPC method.\n *\n * @param options - The options for the handler.\n * @param options.processGetSupportedExecutionPermissions - The function to process the\n * get supported execution permissions request.\n * @returns A JSON-RPC middleware function that handles the\n * `wallet_getSupportedExecutionPermissions` JSON-RPC method.\n */\nexport function createWalletGetSupportedExecutionPermissionsHandler({\n processGetSupportedExecutionPermissions,\n}: {\n processGetSupportedExecutionPermissions?: ProcessGetSupportedExecutionPermissionsHook;\n}): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext> {\n return async ({ request, context }) => {\n if (!processGetSupportedExecutionPermissions) {\n throw rpcErrors.methodNotSupported(\n 'wallet_getSupportedExecutionPermissions - no middleware configured',\n );\n }\n\n const { params } = request;\n\n validateParams(params, GetSupportedExecutionPermissionsParamsStruct);\n\n return await processGetSupportedExecutionPermissions(request, context);\n };\n}\n"]}
@@ -12,19 +12,12 @@ const PermissionStruct = (0, superstruct_1.object)({
12
12
  });
13
13
  const RuleStruct = (0, superstruct_1.object)({
14
14
  type: (0, superstruct_1.string)(),
15
- isAdjustmentAllowed: (0, superstruct_1.boolean)(),
16
15
  data: (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.unknown)()),
17
16
  });
18
- const AccountSignerStruct = (0, superstruct_1.object)({
19
- type: (0, superstruct_1.literal)('account'),
20
- data: (0, superstruct_1.object)({
21
- address: utils_1.HexChecksumAddressStruct,
22
- }),
23
- });
24
17
  const PermissionRequestStruct = (0, superstruct_1.object)({
25
18
  chainId: utils_1.StrictHexStruct,
26
- address: (0, superstruct_1.optional)(utils_1.HexChecksumAddressStruct),
27
- signer: AccountSignerStruct,
19
+ from: (0, superstruct_1.optional)(utils_1.HexChecksumAddressStruct),
20
+ to: utils_1.HexChecksumAddressStruct,
28
21
  permission: PermissionStruct,
29
22
  rules: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.array)(RuleStruct), (0, superstruct_1.literal)(null)])),
30
23
  });
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-request-execution-permissions.cjs","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":";;;AACA,qDAAiD;AAEjD,uDAU+B;AAC/B,2CAA4E;AAG5E,wDAAqD;AAGrD,MAAM,gBAAgB,GAAG,IAAA,oBAAM,EAAC;IAC9B,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,mBAAmB,EAAE,IAAA,qBAAO,GAAE;IAC9B,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,GAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,IAAA,oBAAM,EAAC;IACxB,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,mBAAmB,EAAE,IAAA,qBAAO,GAAE;IAC9B,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,GAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,IAAA,oBAAM,EAAC;IACjC,IAAI,EAAE,IAAA,qBAAO,EAAC,SAAS,CAAC;IACxB,IAAI,EAAE,IAAA,oBAAM,EAAC;QACX,OAAO,EAAE,gCAAwB;KAClC,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IACrC,OAAO,EAAE,uBAAe;IACxB,OAAO,EAAE,IAAA,sBAAQ,EAAC,gCAAwB,CAAC;IAC3C,MAAM,EAAE,mBAAmB;IAC3B,UAAU,EAAE,gBAAgB;IAC5B,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,UAAU,CAAC,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAC3D,CAAC,CAAC;AAEU,QAAA,iCAAiC,GAAG,IAAA,mBAAK,EAAC,uBAAuB,CAAC,CAAC;AAkBhF;;;;;;;;GAQG;AACH,SAAgB,8CAA8C,CAAC,EAC7D,kCAAkC,GAGnC;IACC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,kCAAkC,EAAE,CAAC;YACxC,MAAM,sBAAS,CAAC,kBAAkB,CAChC,+DAA+D,CAChE,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,IAAA,2BAAc,EAAC,MAAM,EAAE,yCAAiC,CAAC,CAAC;QAE1D,OAAO,MAAM,kCAAkC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC;AACJ,CAAC;AAlBD,wGAkBC","sourcesContent":["import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine/v2';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n literal,\n object,\n optional,\n record,\n string,\n union,\n unknown,\n} from '@metamask/superstruct';\nimport { HexChecksumAddressStruct, StrictHexStruct } from '@metamask/utils';\nimport type { Hex, Json, JsonRpcRequest } from '@metamask/utils';\n\nimport { validateParams } from '../utils/validation';\nimport type { WalletMiddlewareContext } from '../wallet';\n\nconst PermissionStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\nconst RuleStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\nconst AccountSignerStruct = object({\n type: literal('account'),\n data: object({\n address: HexChecksumAddressStruct,\n }),\n});\n\nconst PermissionRequestStruct = object({\n chainId: StrictHexStruct,\n address: optional(HexChecksumAddressStruct),\n signer: AccountSignerStruct,\n permission: PermissionStruct,\n rules: optional(union([array(RuleStruct), literal(null)])),\n});\n\nexport const RequestExecutionPermissionsStruct = array(PermissionRequestStruct);\n\n// RequestExecutionPermissions API types\nexport type RequestExecutionPermissionsRequestParams = Infer<\n typeof RequestExecutionPermissionsStruct\n>;\n\nexport type RequestExecutionPermissionsResult = Json &\n (Infer<typeof PermissionRequestStruct> & {\n context: Hex;\n })[];\n\nexport type ProcessRequestExecutionPermissionsHook = (\n request: RequestExecutionPermissionsRequestParams,\n req: JsonRpcRequest,\n context: WalletMiddlewareContext,\n) => Promise<RequestExecutionPermissionsResult>;\n\n/**\n * Creates a handler for the `wallet_requestExecutionPermissions` JSON-RPC method.\n *\n * @param options - The options for the handler.\n * @param options.processRequestExecutionPermissions - The function to process the\n * request execution permissions request.\n * @returns A JSON-RPC middleware function that handles the\n * `wallet_requestExecutionPermissions` JSON-RPC method.\n */\nexport function createWalletRequestExecutionPermissionsHandler({\n processRequestExecutionPermissions,\n}: {\n processRequestExecutionPermissions?: ProcessRequestExecutionPermissionsHook;\n}): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext> {\n return async ({ request, context }) => {\n if (!processRequestExecutionPermissions) {\n throw rpcErrors.methodNotSupported(\n 'wallet_requestExecutionPermissions - no middleware configured',\n );\n }\n\n const { params } = request;\n\n validateParams(params, RequestExecutionPermissionsStruct);\n\n return await processRequestExecutionPermissions(params, request, context);\n };\n}\n"]}
1
+ {"version":3,"file":"wallet-request-execution-permissions.cjs","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":";;;AACA,qDAAiD;AAEjD,uDAU+B;AAC/B,2CAA4E;AAG5E,wDAAqD;AAGrD,MAAM,gBAAgB,GAAG,IAAA,oBAAM,EAAC;IAC9B,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,mBAAmB,EAAE,IAAA,qBAAO,GAAE;IAC9B,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,GAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,IAAA,oBAAM,EAAC;IACxB,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,GAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IACrC,OAAO,EAAE,uBAAe;IACxB,IAAI,EAAE,IAAA,sBAAQ,EAAC,gCAAwB,CAAC;IACxC,EAAE,EAAE,gCAAwB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,UAAU,CAAC,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAC3D,CAAC,CAAC;AAEU,QAAA,iCAAiC,GAAG,IAAA,mBAAK,EAAC,uBAAuB,CAAC,CAAC;AAyBhF;;;;;;;;GAQG;AACH,SAAgB,8CAA8C,CAAC,EAC7D,kCAAkC,GAGnC;IACC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,kCAAkC,EAAE,CAAC;YACxC,MAAM,sBAAS,CAAC,kBAAkB,CAChC,+DAA+D,CAChE,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,IAAA,2BAAc,EAAC,MAAM,EAAE,yCAAiC,CAAC,CAAC;QAE1D,OAAO,MAAM,kCAAkC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC;AACJ,CAAC;AAlBD,wGAkBC","sourcesContent":["import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine/v2';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n literal,\n object,\n optional,\n record,\n string,\n union,\n unknown,\n} from '@metamask/superstruct';\nimport { HexChecksumAddressStruct, StrictHexStruct } from '@metamask/utils';\nimport type { Hex, Json, JsonRpcRequest } from '@metamask/utils';\n\nimport { validateParams } from '../utils/validation';\nimport type { WalletMiddlewareContext } from '../wallet';\n\nconst PermissionStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\nconst RuleStruct = object({\n type: string(),\n data: record(string(), unknown()),\n});\n\nconst PermissionRequestStruct = object({\n chainId: StrictHexStruct,\n from: optional(HexChecksumAddressStruct),\n to: HexChecksumAddressStruct,\n permission: PermissionStruct,\n rules: optional(union([array(RuleStruct), literal(null)])),\n});\n\nexport const RequestExecutionPermissionsStruct = array(PermissionRequestStruct);\n\n// RequestExecutionPermissions API types\nexport type RequestExecutionPermissionsRequestParams = Infer<\n typeof RequestExecutionPermissionsStruct\n>;\n\nexport type PermissionDependency = {\n factory: Hex;\n factoryData: Hex;\n};\n\nexport type RequestExecutionPermissionsResult = Json &\n (Infer<typeof PermissionRequestStruct> & {\n context: Hex;\n dependencies: PermissionDependency[];\n delegationManager: Hex;\n })[];\n\nexport type ProcessRequestExecutionPermissionsHook = (\n request: RequestExecutionPermissionsRequestParams,\n req: JsonRpcRequest,\n context: WalletMiddlewareContext,\n) => Promise<RequestExecutionPermissionsResult>;\n\n/**\n * Creates a handler for the `wallet_requestExecutionPermissions` JSON-RPC method.\n *\n * @param options - The options for the handler.\n * @param options.processRequestExecutionPermissions - The function to process the\n * request execution permissions request.\n * @returns A JSON-RPC middleware function that handles the\n * `wallet_requestExecutionPermissions` JSON-RPC method.\n */\nexport function createWalletRequestExecutionPermissionsHandler({\n processRequestExecutionPermissions,\n}: {\n processRequestExecutionPermissions?: ProcessRequestExecutionPermissionsHook;\n}): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext> {\n return async ({ request, context }) => {\n if (!processRequestExecutionPermissions) {\n throw rpcErrors.methodNotSupported(\n 'wallet_requestExecutionPermissions - no middleware configured',\n );\n }\n\n const { params } = request;\n\n validateParams(params, RequestExecutionPermissionsStruct);\n\n return await processRequestExecutionPermissions(params, request, context);\n };\n}\n"]}
@@ -4,39 +4,21 @@ import type { Hex, Json, JsonRpcRequest } from "@metamask/utils";
4
4
  import type { WalletMiddlewareContext } from "../wallet.cjs";
5
5
  declare const PermissionRequestStruct: import("@metamask/superstruct").Struct<{
6
6
  chainId: `0x${string}`;
7
- signer: {
8
- data: {
9
- address: `0x${string}`;
10
- };
11
- type: "account";
12
- };
7
+ to: `0x${string}`;
13
8
  permission: {
14
9
  data: Record<string, unknown>;
15
10
  type: string;
16
11
  isAdjustmentAllowed: boolean;
17
12
  };
18
- address?: `0x${string}` | undefined;
13
+ from?: `0x${string}` | undefined;
19
14
  rules?: {
20
15
  data: Record<string, unknown>;
21
16
  type: string;
22
- isAdjustmentAllowed: boolean;
23
17
  }[] | null | undefined;
24
18
  }, {
25
19
  chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
26
- address: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
27
- signer: import("@metamask/superstruct").Struct<{
28
- data: {
29
- address: `0x${string}`;
30
- };
31
- type: "account";
32
- }, {
33
- type: import("@metamask/superstruct").Struct<"account", "account">;
34
- data: import("@metamask/superstruct").Struct<{
35
- address: `0x${string}`;
36
- }, {
37
- address: import("@metamask/superstruct").Struct<`0x${string}`, null>;
38
- }>;
39
- }>;
20
+ from: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
21
+ to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
40
22
  permission: import("@metamask/superstruct").Struct<{
41
23
  data: Record<string, unknown>;
42
24
  type: string;
@@ -49,63 +31,38 @@ declare const PermissionRequestStruct: import("@metamask/superstruct").Struct<{
49
31
  rules: import("@metamask/superstruct").Struct<{
50
32
  data: Record<string, unknown>;
51
33
  type: string;
52
- isAdjustmentAllowed: boolean;
53
34
  }[] | null | undefined, null>;
54
35
  }>;
55
36
  export declare const RequestExecutionPermissionsStruct: import("@metamask/superstruct").Struct<{
56
37
  chainId: `0x${string}`;
57
- signer: {
58
- data: {
59
- address: `0x${string}`;
60
- };
61
- type: "account";
62
- };
38
+ to: `0x${string}`;
63
39
  permission: {
64
40
  data: Record<string, unknown>;
65
41
  type: string;
66
42
  isAdjustmentAllowed: boolean;
67
43
  };
68
- address?: `0x${string}` | undefined;
44
+ from?: `0x${string}` | undefined;
69
45
  rules?: {
70
46
  data: Record<string, unknown>;
71
47
  type: string;
72
- isAdjustmentAllowed: boolean;
73
48
  }[] | null | undefined;
74
49
  }[], import("@metamask/superstruct").Struct<{
75
50
  chainId: `0x${string}`;
76
- signer: {
77
- data: {
78
- address: `0x${string}`;
79
- };
80
- type: "account";
81
- };
51
+ to: `0x${string}`;
82
52
  permission: {
83
53
  data: Record<string, unknown>;
84
54
  type: string;
85
55
  isAdjustmentAllowed: boolean;
86
56
  };
87
- address?: `0x${string}` | undefined;
57
+ from?: `0x${string}` | undefined;
88
58
  rules?: {
89
59
  data: Record<string, unknown>;
90
60
  type: string;
91
- isAdjustmentAllowed: boolean;
92
61
  }[] | null | undefined;
93
62
  }, {
94
63
  chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
95
- address: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
96
- signer: import("@metamask/superstruct").Struct<{
97
- data: {
98
- address: `0x${string}`;
99
- };
100
- type: "account";
101
- }, {
102
- type: import("@metamask/superstruct").Struct<"account", "account">;
103
- data: import("@metamask/superstruct").Struct<{
104
- address: `0x${string}`;
105
- }, {
106
- address: import("@metamask/superstruct").Struct<`0x${string}`, null>;
107
- }>;
108
- }>;
64
+ from: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
65
+ to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
109
66
  permission: import("@metamask/superstruct").Struct<{
110
67
  data: Record<string, unknown>;
111
68
  type: string;
@@ -118,12 +75,17 @@ export declare const RequestExecutionPermissionsStruct: import("@metamask/supers
118
75
  rules: import("@metamask/superstruct").Struct<{
119
76
  data: Record<string, unknown>;
120
77
  type: string;
121
- isAdjustmentAllowed: boolean;
122
78
  }[] | null | undefined, null>;
123
79
  }>>;
124
80
  export type RequestExecutionPermissionsRequestParams = Infer<typeof RequestExecutionPermissionsStruct>;
81
+ export type PermissionDependency = {
82
+ factory: Hex;
83
+ factoryData: Hex;
84
+ };
125
85
  export type RequestExecutionPermissionsResult = Json & (Infer<typeof PermissionRequestStruct> & {
126
86
  context: Hex;
87
+ dependencies: PermissionDependency[];
88
+ delegationManager: Hex;
127
89
  })[];
128
90
  export type ProcessRequestExecutionPermissionsHook = (request: RequestExecutionPermissionsRequestParams, req: JsonRpcRequest, context: WalletMiddlewareContext) => Promise<RequestExecutionPermissionsResult>;
129
91
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-request-execution-permissions.d.cts","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAGjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;AAqBzD,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiC,CAAC;AAGhF,MAAM,MAAM,wCAAwC,GAAG,KAAK,CAC1D,OAAO,iCAAiC,CACzC,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,IAAI,GAClD,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;IACvC,OAAO,EAAE,GAAG,CAAC;CACd,CAAC,EAAE,CAAC;AAEP,MAAM,MAAM,sCAAsC,GAAG,CACnD,OAAO,EAAE,wCAAwC,EACjD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,iCAAiC,CAAC,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,8CAA8C,CAAC,EAC7D,kCAAkC,GACnC,EAAE;IACD,kCAAkC,CAAC,EAAE,sCAAsC,CAAC;CAC7E,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAcnE"}
1
+ {"version":3,"file":"wallet-request-execution-permissions.d.cts","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAGjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;AAazD,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiC,CAAC;AAGhF,MAAM,MAAM,wCAAwC,GAAG,KAAK,CAC1D,OAAO,iCAAiC,CACzC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,GAAG,CAAC;IACb,WAAW,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,IAAI,GAClD,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;IACvC,OAAO,EAAE,GAAG,CAAC;IACb,YAAY,EAAE,oBAAoB,EAAE,CAAC;IACrC,iBAAiB,EAAE,GAAG,CAAC;CACxB,CAAC,EAAE,CAAC;AAEP,MAAM,MAAM,sCAAsC,GAAG,CACnD,OAAO,EAAE,wCAAwC,EACjD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,iCAAiC,CAAC,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,8CAA8C,CAAC,EAC7D,kCAAkC,GACnC,EAAE;IACD,kCAAkC,CAAC,EAAE,sCAAsC,CAAC;CAC7E,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAcnE"}
@@ -4,39 +4,21 @@ import type { Hex, Json, JsonRpcRequest } from "@metamask/utils";
4
4
  import type { WalletMiddlewareContext } from "../wallet.mjs";
5
5
  declare const PermissionRequestStruct: import("@metamask/superstruct").Struct<{
6
6
  chainId: `0x${string}`;
7
- signer: {
8
- data: {
9
- address: `0x${string}`;
10
- };
11
- type: "account";
12
- };
7
+ to: `0x${string}`;
13
8
  permission: {
14
9
  data: Record<string, unknown>;
15
10
  type: string;
16
11
  isAdjustmentAllowed: boolean;
17
12
  };
18
- address?: `0x${string}` | undefined;
13
+ from?: `0x${string}` | undefined;
19
14
  rules?: {
20
15
  data: Record<string, unknown>;
21
16
  type: string;
22
- isAdjustmentAllowed: boolean;
23
17
  }[] | null | undefined;
24
18
  }, {
25
19
  chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
26
- address: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
27
- signer: import("@metamask/superstruct").Struct<{
28
- data: {
29
- address: `0x${string}`;
30
- };
31
- type: "account";
32
- }, {
33
- type: import("@metamask/superstruct").Struct<"account", "account">;
34
- data: import("@metamask/superstruct").Struct<{
35
- address: `0x${string}`;
36
- }, {
37
- address: import("@metamask/superstruct").Struct<`0x${string}`, null>;
38
- }>;
39
- }>;
20
+ from: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
21
+ to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
40
22
  permission: import("@metamask/superstruct").Struct<{
41
23
  data: Record<string, unknown>;
42
24
  type: string;
@@ -49,63 +31,38 @@ declare const PermissionRequestStruct: import("@metamask/superstruct").Struct<{
49
31
  rules: import("@metamask/superstruct").Struct<{
50
32
  data: Record<string, unknown>;
51
33
  type: string;
52
- isAdjustmentAllowed: boolean;
53
34
  }[] | null | undefined, null>;
54
35
  }>;
55
36
  export declare const RequestExecutionPermissionsStruct: import("@metamask/superstruct").Struct<{
56
37
  chainId: `0x${string}`;
57
- signer: {
58
- data: {
59
- address: `0x${string}`;
60
- };
61
- type: "account";
62
- };
38
+ to: `0x${string}`;
63
39
  permission: {
64
40
  data: Record<string, unknown>;
65
41
  type: string;
66
42
  isAdjustmentAllowed: boolean;
67
43
  };
68
- address?: `0x${string}` | undefined;
44
+ from?: `0x${string}` | undefined;
69
45
  rules?: {
70
46
  data: Record<string, unknown>;
71
47
  type: string;
72
- isAdjustmentAllowed: boolean;
73
48
  }[] | null | undefined;
74
49
  }[], import("@metamask/superstruct").Struct<{
75
50
  chainId: `0x${string}`;
76
- signer: {
77
- data: {
78
- address: `0x${string}`;
79
- };
80
- type: "account";
81
- };
51
+ to: `0x${string}`;
82
52
  permission: {
83
53
  data: Record<string, unknown>;
84
54
  type: string;
85
55
  isAdjustmentAllowed: boolean;
86
56
  };
87
- address?: `0x${string}` | undefined;
57
+ from?: `0x${string}` | undefined;
88
58
  rules?: {
89
59
  data: Record<string, unknown>;
90
60
  type: string;
91
- isAdjustmentAllowed: boolean;
92
61
  }[] | null | undefined;
93
62
  }, {
94
63
  chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
95
- address: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
96
- signer: import("@metamask/superstruct").Struct<{
97
- data: {
98
- address: `0x${string}`;
99
- };
100
- type: "account";
101
- }, {
102
- type: import("@metamask/superstruct").Struct<"account", "account">;
103
- data: import("@metamask/superstruct").Struct<{
104
- address: `0x${string}`;
105
- }, {
106
- address: import("@metamask/superstruct").Struct<`0x${string}`, null>;
107
- }>;
108
- }>;
64
+ from: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
65
+ to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
109
66
  permission: import("@metamask/superstruct").Struct<{
110
67
  data: Record<string, unknown>;
111
68
  type: string;
@@ -118,12 +75,17 @@ export declare const RequestExecutionPermissionsStruct: import("@metamask/supers
118
75
  rules: import("@metamask/superstruct").Struct<{
119
76
  data: Record<string, unknown>;
120
77
  type: string;
121
- isAdjustmentAllowed: boolean;
122
78
  }[] | null | undefined, null>;
123
79
  }>>;
124
80
  export type RequestExecutionPermissionsRequestParams = Infer<typeof RequestExecutionPermissionsStruct>;
81
+ export type PermissionDependency = {
82
+ factory: Hex;
83
+ factoryData: Hex;
84
+ };
125
85
  export type RequestExecutionPermissionsResult = Json & (Infer<typeof PermissionRequestStruct> & {
126
86
  context: Hex;
87
+ dependencies: PermissionDependency[];
88
+ delegationManager: Hex;
127
89
  })[];
128
90
  export type ProcessRequestExecutionPermissionsHook = (request: RequestExecutionPermissionsRequestParams, req: JsonRpcRequest, context: WalletMiddlewareContext) => Promise<RequestExecutionPermissionsResult>;
129
91
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-request-execution-permissions.d.mts","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAGjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;AAqBzD,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiC,CAAC;AAGhF,MAAM,MAAM,wCAAwC,GAAG,KAAK,CAC1D,OAAO,iCAAiC,CACzC,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,IAAI,GAClD,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;IACvC,OAAO,EAAE,GAAG,CAAC;CACd,CAAC,EAAE,CAAC;AAEP,MAAM,MAAM,sCAAsC,GAAG,CACnD,OAAO,EAAE,wCAAwC,EACjD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,iCAAiC,CAAC,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,8CAA8C,CAAC,EAC7D,kCAAkC,GACnC,EAAE;IACD,kCAAkC,CAAC,EAAE,sCAAsC,CAAC;CAC7E,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAcnE"}
1
+ {"version":3,"file":"wallet-request-execution-permissions.d.mts","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAGjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;AAazD,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiC,CAAC;AAGhF,MAAM,MAAM,wCAAwC,GAAG,KAAK,CAC1D,OAAO,iCAAiC,CACzC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,GAAG,CAAC;IACb,WAAW,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,IAAI,GAClD,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;IACvC,OAAO,EAAE,GAAG,CAAC;IACb,YAAY,EAAE,oBAAoB,EAAE,CAAC;IACrC,iBAAiB,EAAE,GAAG,CAAC;CACxB,CAAC,EAAE,CAAC;AAEP,MAAM,MAAM,sCAAsC,GAAG,CACnD,OAAO,EAAE,wCAAwC,EACjD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,iCAAiC,CAAC,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,8CAA8C,CAAC,EAC7D,kCAAkC,GACnC,EAAE;IACD,kCAAkC,CAAC,EAAE,sCAAsC,CAAC;CAC7E,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAcnE"}
@@ -9,19 +9,12 @@ const PermissionStruct = object({
9
9
  });
10
10
  const RuleStruct = object({
11
11
  type: string(),
12
- isAdjustmentAllowed: boolean(),
13
12
  data: record(string(), unknown()),
14
13
  });
15
- const AccountSignerStruct = object({
16
- type: literal('account'),
17
- data: object({
18
- address: HexChecksumAddressStruct,
19
- }),
20
- });
21
14
  const PermissionRequestStruct = object({
22
15
  chainId: StrictHexStruct,
23
- address: optional(HexChecksumAddressStruct),
24
- signer: AccountSignerStruct,
16
+ from: optional(HexChecksumAddressStruct),
17
+ to: HexChecksumAddressStruct,
25
18
  permission: PermissionStruct,
26
19
  rules: optional(union([array(RuleStruct), literal(null)])),
27
20
  });
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-request-execution-permissions.mjs","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AAEjD,OAAO,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACR,8BAA8B;AAC/B,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,wBAAwB;AAG5E,OAAO,EAAE,cAAc,EAAE,gCAA4B;AAGrD,MAAM,gBAAgB,GAAG,MAAM,CAAC;IAC9B,IAAI,EAAE,MAAM,EAAE;IACd,mBAAmB,EAAE,OAAO,EAAE;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,EAAE;IACd,mBAAmB,EAAE,OAAO,EAAE;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,MAAM,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,wBAAwB;KAClC,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,MAAM,CAAC;IACrC,OAAO,EAAE,eAAe;IACxB,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC;IAC3C,MAAM,EAAE,mBAAmB;IAC3B,UAAU,EAAE,gBAAgB;IAC5B,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAkBhF;;;;;;;;GAQG;AACH,MAAM,UAAU,8CAA8C,CAAC,EAC7D,kCAAkC,GAGnC;IACC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,kCAAkC,EAAE,CAAC;YACxC,MAAM,SAAS,CAAC,kBAAkB,CAChC,+DAA+D,CAChE,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,cAAc,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAAC;QAE1D,OAAO,MAAM,kCAAkC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine/v2';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n literal,\n object,\n optional,\n record,\n string,\n union,\n unknown,\n} from '@metamask/superstruct';\nimport { HexChecksumAddressStruct, StrictHexStruct } from '@metamask/utils';\nimport type { Hex, Json, JsonRpcRequest } from '@metamask/utils';\n\nimport { validateParams } from '../utils/validation';\nimport type { WalletMiddlewareContext } from '../wallet';\n\nconst PermissionStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\nconst RuleStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\nconst AccountSignerStruct = object({\n type: literal('account'),\n data: object({\n address: HexChecksumAddressStruct,\n }),\n});\n\nconst PermissionRequestStruct = object({\n chainId: StrictHexStruct,\n address: optional(HexChecksumAddressStruct),\n signer: AccountSignerStruct,\n permission: PermissionStruct,\n rules: optional(union([array(RuleStruct), literal(null)])),\n});\n\nexport const RequestExecutionPermissionsStruct = array(PermissionRequestStruct);\n\n// RequestExecutionPermissions API types\nexport type RequestExecutionPermissionsRequestParams = Infer<\n typeof RequestExecutionPermissionsStruct\n>;\n\nexport type RequestExecutionPermissionsResult = Json &\n (Infer<typeof PermissionRequestStruct> & {\n context: Hex;\n })[];\n\nexport type ProcessRequestExecutionPermissionsHook = (\n request: RequestExecutionPermissionsRequestParams,\n req: JsonRpcRequest,\n context: WalletMiddlewareContext,\n) => Promise<RequestExecutionPermissionsResult>;\n\n/**\n * Creates a handler for the `wallet_requestExecutionPermissions` JSON-RPC method.\n *\n * @param options - The options for the handler.\n * @param options.processRequestExecutionPermissions - The function to process the\n * request execution permissions request.\n * @returns A JSON-RPC middleware function that handles the\n * `wallet_requestExecutionPermissions` JSON-RPC method.\n */\nexport function createWalletRequestExecutionPermissionsHandler({\n processRequestExecutionPermissions,\n}: {\n processRequestExecutionPermissions?: ProcessRequestExecutionPermissionsHook;\n}): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext> {\n return async ({ request, context }) => {\n if (!processRequestExecutionPermissions) {\n throw rpcErrors.methodNotSupported(\n 'wallet_requestExecutionPermissions - no middleware configured',\n );\n }\n\n const { params } = request;\n\n validateParams(params, RequestExecutionPermissionsStruct);\n\n return await processRequestExecutionPermissions(params, request, context);\n };\n}\n"]}
1
+ {"version":3,"file":"wallet-request-execution-permissions.mjs","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AAEjD,OAAO,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACR,8BAA8B;AAC/B,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,wBAAwB;AAG5E,OAAO,EAAE,cAAc,EAAE,gCAA4B;AAGrD,MAAM,gBAAgB,GAAG,MAAM,CAAC;IAC9B,IAAI,EAAE,MAAM,EAAE;IACd,mBAAmB,EAAE,OAAO,EAAE;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,EAAE;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,MAAM,CAAC;IACrC,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,QAAQ,CAAC,wBAAwB,CAAC;IACxC,EAAE,EAAE,wBAAwB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAyBhF;;;;;;;;GAQG;AACH,MAAM,UAAU,8CAA8C,CAAC,EAC7D,kCAAkC,GAGnC;IACC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,kCAAkC,EAAE,CAAC;YACxC,MAAM,SAAS,CAAC,kBAAkB,CAChC,+DAA+D,CAChE,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,cAAc,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAAC;QAE1D,OAAO,MAAM,kCAAkC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine/v2';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n literal,\n object,\n optional,\n record,\n string,\n union,\n unknown,\n} from '@metamask/superstruct';\nimport { HexChecksumAddressStruct, StrictHexStruct } from '@metamask/utils';\nimport type { Hex, Json, JsonRpcRequest } from '@metamask/utils';\n\nimport { validateParams } from '../utils/validation';\nimport type { WalletMiddlewareContext } from '../wallet';\n\nconst PermissionStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\nconst RuleStruct = object({\n type: string(),\n data: record(string(), unknown()),\n});\n\nconst PermissionRequestStruct = object({\n chainId: StrictHexStruct,\n from: optional(HexChecksumAddressStruct),\n to: HexChecksumAddressStruct,\n permission: PermissionStruct,\n rules: optional(union([array(RuleStruct), literal(null)])),\n});\n\nexport const RequestExecutionPermissionsStruct = array(PermissionRequestStruct);\n\n// RequestExecutionPermissions API types\nexport type RequestExecutionPermissionsRequestParams = Infer<\n typeof RequestExecutionPermissionsStruct\n>;\n\nexport type PermissionDependency = {\n factory: Hex;\n factoryData: Hex;\n};\n\nexport type RequestExecutionPermissionsResult = Json &\n (Infer<typeof PermissionRequestStruct> & {\n context: Hex;\n dependencies: PermissionDependency[];\n delegationManager: Hex;\n })[];\n\nexport type ProcessRequestExecutionPermissionsHook = (\n request: RequestExecutionPermissionsRequestParams,\n req: JsonRpcRequest,\n context: WalletMiddlewareContext,\n) => Promise<RequestExecutionPermissionsResult>;\n\n/**\n * Creates a handler for the `wallet_requestExecutionPermissions` JSON-RPC method.\n *\n * @param options - The options for the handler.\n * @param options.processRequestExecutionPermissions - The function to process the\n * request execution permissions request.\n * @returns A JSON-RPC middleware function that handles the\n * `wallet_requestExecutionPermissions` JSON-RPC method.\n */\nexport function createWalletRequestExecutionPermissionsHandler({\n processRequestExecutionPermissions,\n}: {\n processRequestExecutionPermissions?: ProcessRequestExecutionPermissionsHook;\n}): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext> {\n return async ({ request, context }) => {\n if (!processRequestExecutionPermissions) {\n throw rpcErrors.methodNotSupported(\n 'wallet_requestExecutionPermissions - no middleware configured',\n );\n }\n\n const { params } = request;\n\n validateParams(params, RequestExecutionPermissionsStruct);\n\n return await processRequestExecutionPermissions(params, request, context);\n };\n}\n"]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoParamsStruct = exports.EmptyArrayStruct = void 0;
4
+ const superstruct_1 = require("@metamask/superstruct");
5
+ /**
6
+ * Superstruct schema for an empty array [].
7
+ * Validates that the value is an array with zero elements.
8
+ */
9
+ exports.EmptyArrayStruct = (0, superstruct_1.define)('EmptyArray', (value) => Array.isArray(value) && value.length === 0 ? true : 'Expected an empty array');
10
+ /**
11
+ * Superstruct schema for JSON-RPC methods that expect no parameters.
12
+ *
13
+ * Different JSON-RPC clients may send "no params" in different ways:
14
+ * - Omitted entirely (undefined)
15
+ * - Empty array []
16
+ * - Empty object {}
17
+ *
18
+ * This struct accepts all three forms for maximum compatibility.
19
+ */
20
+ exports.NoParamsStruct = (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.object)({}), exports.EmptyArrayStruct]));
21
+ //# sourceMappingURL=structs.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.cjs","sourceRoot":"","sources":["../../src/utils/structs.ts"],"names":[],"mappings":";;;AAAA,uDAAwE;AAExE;;;GAGG;AACU,QAAA,gBAAgB,GAAG,IAAA,oBAAM,EAAK,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CACjE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAyB,CAC9E,CAAC;AAEF;;;;;;;;;GASG;AACU,QAAA,cAAc,GAAG,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,EAAC,EAAE,CAAC,EAAE,wBAAgB,CAAC,CAAC,CAAC,CAAC","sourcesContent":["import { define, object, optional, union } from '@metamask/superstruct';\n\n/**\n * Superstruct schema for an empty array [].\n * Validates that the value is an array with zero elements.\n */\nexport const EmptyArrayStruct = define<[]>('EmptyArray', (value) =>\n Array.isArray(value) && value.length === 0 ? true : 'Expected an empty array',\n);\n\n/**\n * Superstruct schema for JSON-RPC methods that expect no parameters.\n *\n * Different JSON-RPC clients may send \"no params\" in different ways:\n * - Omitted entirely (undefined)\n * - Empty array []\n * - Empty object {}\n *\n * This struct accepts all three forms for maximum compatibility.\n */\nexport const NoParamsStruct = optional(union([object({}), EmptyArrayStruct]));\n"]}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Superstruct schema for an empty array [].
3
+ * Validates that the value is an array with zero elements.
4
+ */
5
+ export declare const EmptyArrayStruct: import("@metamask/superstruct").Struct<[], null>;
6
+ /**
7
+ * Superstruct schema for JSON-RPC methods that expect no parameters.
8
+ *
9
+ * Different JSON-RPC clients may send "no params" in different ways:
10
+ * - Omitted entirely (undefined)
11
+ * - Empty array []
12
+ * - Empty object {}
13
+ *
14
+ * This struct accepts all three forms for maximum compatibility.
15
+ */
16
+ export declare const NoParamsStruct: import("@metamask/superstruct").Struct<[] | {} | undefined, null>;
17
+ //# sourceMappingURL=structs.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.d.cts","sourceRoot":"","sources":["../../src/utils/structs.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,kDAE5B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,mEAAkD,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Superstruct schema for an empty array [].
3
+ * Validates that the value is an array with zero elements.
4
+ */
5
+ export declare const EmptyArrayStruct: import("@metamask/superstruct").Struct<[], null>;
6
+ /**
7
+ * Superstruct schema for JSON-RPC methods that expect no parameters.
8
+ *
9
+ * Different JSON-RPC clients may send "no params" in different ways:
10
+ * - Omitted entirely (undefined)
11
+ * - Empty array []
12
+ * - Empty object {}
13
+ *
14
+ * This struct accepts all three forms for maximum compatibility.
15
+ */
16
+ export declare const NoParamsStruct: import("@metamask/superstruct").Struct<[] | {} | undefined, null>;
17
+ //# sourceMappingURL=structs.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.d.mts","sourceRoot":"","sources":["../../src/utils/structs.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,kDAE5B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,mEAAkD,CAAC"}