@metamask-previews/eth-json-rpc-middleware 22.0.1-preview-957f4826 → 22.0.1-preview-1137ade3

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 +0 -4
  2. package/dist/index.cjs +1 -7
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +1 -5
  5. package/dist/index.d.cts.map +1 -1
  6. package/dist/index.d.mts +1 -5
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +0 -2
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/methods/wallet-request-execution-permissions.cjs +9 -2
  11. package/dist/methods/wallet-request-execution-permissions.cjs.map +1 -1
  12. package/dist/methods/wallet-request-execution-permissions.d.cts +54 -16
  13. package/dist/methods/wallet-request-execution-permissions.d.cts.map +1 -1
  14. package/dist/methods/wallet-request-execution-permissions.d.mts +54 -16
  15. package/dist/methods/wallet-request-execution-permissions.d.mts.map +1 -1
  16. package/dist/methods/wallet-request-execution-permissions.mjs +9 -2
  17. package/dist/methods/wallet-request-execution-permissions.mjs.map +1 -1
  18. package/dist/wallet.cjs +1 -11
  19. package/dist/wallet.cjs.map +1 -1
  20. package/dist/wallet.d.cts +1 -7
  21. package/dist/wallet.d.cts.map +1 -1
  22. package/dist/wallet.d.mts +1 -7
  23. package/dist/wallet.d.mts.map +1 -1
  24. package/dist/wallet.mjs +1 -11
  25. package/dist/wallet.mjs.map +1 -1
  26. package/package.json +2 -2
  27. package/dist/methods/wallet-get-granted-execution-permissions.cjs +0 -61
  28. package/dist/methods/wallet-get-granted-execution-permissions.cjs.map +0 -1
  29. package/dist/methods/wallet-get-granted-execution-permissions.d.cts +0 -140
  30. package/dist/methods/wallet-get-granted-execution-permissions.d.cts.map +0 -1
  31. package/dist/methods/wallet-get-granted-execution-permissions.d.mts +0 -140
  32. package/dist/methods/wallet-get-granted-execution-permissions.d.mts.map +0 -1
  33. package/dist/methods/wallet-get-granted-execution-permissions.mjs +0 -57
  34. package/dist/methods/wallet-get-granted-execution-permissions.mjs.map +0 -1
  35. package/dist/methods/wallet-get-supported-execution-permissions.cjs +0 -47
  36. package/dist/methods/wallet-get-supported-execution-permissions.cjs.map +0 -1
  37. package/dist/methods/wallet-get-supported-execution-permissions.d.cts +0 -54
  38. package/dist/methods/wallet-get-supported-execution-permissions.d.cts.map +0 -1
  39. package/dist/methods/wallet-get-supported-execution-permissions.d.mts +0 -54
  40. package/dist/methods/wallet-get-supported-execution-permissions.d.mts.map +0 -1
  41. package/dist/methods/wallet-get-supported-execution-permissions.mjs +0 -43
  42. package/dist/methods/wallet-get-supported-execution-permissions.mjs.map +0 -1
  43. package/dist/utils/structs.cjs +0 -21
  44. package/dist/utils/structs.cjs.map +0 -1
  45. package/dist/utils/structs.d.cts +0 -17
  46. package/dist/utils/structs.d.cts.map +0 -1
  47. package/dist/utils/structs.d.mts +0 -17
  48. package/dist/utils/structs.d.mts.map +0 -1
  49. package/dist/utils/structs.mjs +0 -18
  50. package/dist/utils/structs.mjs.map +0 -1
@@ -1,140 +0,0 @@
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_getGrantedExecutionPermissions` 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 GetGrantedExecutionPermissionsParamsStruct: import("@metamask/superstruct").Struct<[] | {} | undefined, null>;
12
- /**
13
- * Superstruct schema for a single granted execution permission.
14
- */
15
- export declare const GrantedExecutionPermissionStruct: import("@metamask/superstruct").Struct<{
16
- context: `0x${string}`;
17
- chainId: `0x${string}`;
18
- from: `0x${string}`;
19
- to: `0x${string}`;
20
- permission: {
21
- data: Record<string, unknown>;
22
- type: string;
23
- isAdjustmentAllowed: boolean;
24
- };
25
- dependencies: {
26
- factory: `0x${string}`;
27
- factoryData: `0x${string}`;
28
- }[];
29
- delegationManager: `0x${string}`;
30
- }, {
31
- chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
32
- from: import("@metamask/superstruct").Struct<`0x${string}`, null>;
33
- to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
34
- permission: import("@metamask/superstruct").Struct<{
35
- data: Record<string, unknown>;
36
- type: string;
37
- isAdjustmentAllowed: boolean;
38
- }, {
39
- type: import("@metamask/superstruct").Struct<string, null>;
40
- isAdjustmentAllowed: import("@metamask/superstruct").Struct<boolean, null>;
41
- data: import("@metamask/superstruct").Struct<Record<string, unknown>, null>;
42
- }>;
43
- context: import("@metamask/superstruct").Struct<`0x${string}`, null>;
44
- dependencies: import("@metamask/superstruct").Struct<{
45
- factory: `0x${string}`;
46
- factoryData: `0x${string}`;
47
- }[], import("@metamask/superstruct").Struct<{
48
- factory: `0x${string}`;
49
- factoryData: `0x${string}`;
50
- }, {
51
- factory: import("@metamask/superstruct").Struct<`0x${string}`, null>;
52
- factoryData: import("@metamask/superstruct").Struct<`0x${string}`, null>;
53
- }>>;
54
- delegationManager: import("@metamask/superstruct").Struct<`0x${string}`, null>;
55
- }>;
56
- /**
57
- * Represents a single granted execution permission.
58
- */
59
- export type GrantedExecutionPermission = Infer<typeof GrantedExecutionPermissionStruct>;
60
- /**
61
- * Superstruct schema for the `wallet_getGrantedExecutionPermissions` result.
62
- */
63
- export declare const GetGrantedExecutionPermissionsResultStruct: import("@metamask/superstruct").Struct<{
64
- context: `0x${string}`;
65
- chainId: `0x${string}`;
66
- from: `0x${string}`;
67
- to: `0x${string}`;
68
- permission: {
69
- data: Record<string, unknown>;
70
- type: string;
71
- isAdjustmentAllowed: boolean;
72
- };
73
- dependencies: {
74
- factory: `0x${string}`;
75
- factoryData: `0x${string}`;
76
- }[];
77
- delegationManager: `0x${string}`;
78
- }[], import("@metamask/superstruct").Struct<{
79
- context: `0x${string}`;
80
- chainId: `0x${string}`;
81
- from: `0x${string}`;
82
- to: `0x${string}`;
83
- permission: {
84
- data: Record<string, unknown>;
85
- type: string;
86
- isAdjustmentAllowed: boolean;
87
- };
88
- dependencies: {
89
- factory: `0x${string}`;
90
- factoryData: `0x${string}`;
91
- }[];
92
- delegationManager: `0x${string}`;
93
- }, {
94
- chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
95
- from: import("@metamask/superstruct").Struct<`0x${string}`, null>;
96
- to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
97
- permission: import("@metamask/superstruct").Struct<{
98
- data: Record<string, unknown>;
99
- type: string;
100
- isAdjustmentAllowed: boolean;
101
- }, {
102
- type: import("@metamask/superstruct").Struct<string, null>;
103
- isAdjustmentAllowed: import("@metamask/superstruct").Struct<boolean, null>;
104
- data: import("@metamask/superstruct").Struct<Record<string, unknown>, null>;
105
- }>;
106
- context: import("@metamask/superstruct").Struct<`0x${string}`, null>;
107
- dependencies: import("@metamask/superstruct").Struct<{
108
- factory: `0x${string}`;
109
- factoryData: `0x${string}`;
110
- }[], import("@metamask/superstruct").Struct<{
111
- factory: `0x${string}`;
112
- factoryData: `0x${string}`;
113
- }, {
114
- factory: import("@metamask/superstruct").Struct<`0x${string}`, null>;
115
- factoryData: import("@metamask/superstruct").Struct<`0x${string}`, null>;
116
- }>>;
117
- delegationManager: import("@metamask/superstruct").Struct<`0x${string}`, null>;
118
- }>>;
119
- /**
120
- * Result type for the `wallet_getGrantedExecutionPermissions` JSON-RPC method.
121
- * Returns an array of all granted permissions that are not yet revoked.
122
- */
123
- export type GetGrantedExecutionPermissionsResult = Json & Infer<typeof GetGrantedExecutionPermissionsResultStruct>;
124
- /**
125
- * Hook type for processing the `wallet_getGrantedExecutionPermissions` request.
126
- */
127
- export type ProcessGetGrantedExecutionPermissionsHook = (req: JsonRpcRequest, context: WalletMiddlewareContext) => Promise<GetGrantedExecutionPermissionsResult>;
128
- /**
129
- * Creates a handler for the `wallet_getGrantedExecutionPermissions` JSON-RPC method.
130
- *
131
- * @param options - The options for the handler.
132
- * @param options.processGetGrantedExecutionPermissions - The function to process the
133
- * get granted execution permissions request.
134
- * @returns A JSON-RPC middleware function that handles the
135
- * `wallet_getGrantedExecutionPermissions` JSON-RPC method.
136
- */
137
- export declare function createWalletGetGrantedExecutionPermissionsHandler({ processGetGrantedExecutionPermissions, }: {
138
- processGetGrantedExecutionPermissions?: ProcessGetGrantedExecutionPermissionsHook;
139
- }): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext>;
140
- //# sourceMappingURL=wallet-get-granted-execution-permissions.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wallet-get-granted-execution-permissions.d.cts","sourceRoot":"","sources":["../../src/methods/wallet-get-granted-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAUnD,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAI5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,0CAA0C,mEAAiB,CAAC;AAazE;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ3C,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAC5C,OAAO,gCAAgC,CACxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEtD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oCAAoC,GAAG,IAAI,GACrD,KAAK,CAAC,OAAO,0CAA0C,CAAC,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,yCAAyC,GAAG,CACtD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAEnD;;;;;;;;GAQG;AACH,wBAAgB,iDAAiD,CAAC,EAChE,qCAAqC,GACtC,EAAE;IACD,qCAAqC,CAAC,EAAE,yCAAyC,CAAC;CACnF,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAcnE"}
@@ -1,140 +0,0 @@
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_getGrantedExecutionPermissions` 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 GetGrantedExecutionPermissionsParamsStruct: import("@metamask/superstruct").Struct<[] | {} | undefined, null>;
12
- /**
13
- * Superstruct schema for a single granted execution permission.
14
- */
15
- export declare const GrantedExecutionPermissionStruct: import("@metamask/superstruct").Struct<{
16
- context: `0x${string}`;
17
- chainId: `0x${string}`;
18
- from: `0x${string}`;
19
- to: `0x${string}`;
20
- permission: {
21
- data: Record<string, unknown>;
22
- type: string;
23
- isAdjustmentAllowed: boolean;
24
- };
25
- dependencies: {
26
- factory: `0x${string}`;
27
- factoryData: `0x${string}`;
28
- }[];
29
- delegationManager: `0x${string}`;
30
- }, {
31
- chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
32
- from: import("@metamask/superstruct").Struct<`0x${string}`, null>;
33
- to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
34
- permission: import("@metamask/superstruct").Struct<{
35
- data: Record<string, unknown>;
36
- type: string;
37
- isAdjustmentAllowed: boolean;
38
- }, {
39
- type: import("@metamask/superstruct").Struct<string, null>;
40
- isAdjustmentAllowed: import("@metamask/superstruct").Struct<boolean, null>;
41
- data: import("@metamask/superstruct").Struct<Record<string, unknown>, null>;
42
- }>;
43
- context: import("@metamask/superstruct").Struct<`0x${string}`, null>;
44
- dependencies: import("@metamask/superstruct").Struct<{
45
- factory: `0x${string}`;
46
- factoryData: `0x${string}`;
47
- }[], import("@metamask/superstruct").Struct<{
48
- factory: `0x${string}`;
49
- factoryData: `0x${string}`;
50
- }, {
51
- factory: import("@metamask/superstruct").Struct<`0x${string}`, null>;
52
- factoryData: import("@metamask/superstruct").Struct<`0x${string}`, null>;
53
- }>>;
54
- delegationManager: import("@metamask/superstruct").Struct<`0x${string}`, null>;
55
- }>;
56
- /**
57
- * Represents a single granted execution permission.
58
- */
59
- export type GrantedExecutionPermission = Infer<typeof GrantedExecutionPermissionStruct>;
60
- /**
61
- * Superstruct schema for the `wallet_getGrantedExecutionPermissions` result.
62
- */
63
- export declare const GetGrantedExecutionPermissionsResultStruct: import("@metamask/superstruct").Struct<{
64
- context: `0x${string}`;
65
- chainId: `0x${string}`;
66
- from: `0x${string}`;
67
- to: `0x${string}`;
68
- permission: {
69
- data: Record<string, unknown>;
70
- type: string;
71
- isAdjustmentAllowed: boolean;
72
- };
73
- dependencies: {
74
- factory: `0x${string}`;
75
- factoryData: `0x${string}`;
76
- }[];
77
- delegationManager: `0x${string}`;
78
- }[], import("@metamask/superstruct").Struct<{
79
- context: `0x${string}`;
80
- chainId: `0x${string}`;
81
- from: `0x${string}`;
82
- to: `0x${string}`;
83
- permission: {
84
- data: Record<string, unknown>;
85
- type: string;
86
- isAdjustmentAllowed: boolean;
87
- };
88
- dependencies: {
89
- factory: `0x${string}`;
90
- factoryData: `0x${string}`;
91
- }[];
92
- delegationManager: `0x${string}`;
93
- }, {
94
- chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
95
- from: import("@metamask/superstruct").Struct<`0x${string}`, null>;
96
- to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
97
- permission: import("@metamask/superstruct").Struct<{
98
- data: Record<string, unknown>;
99
- type: string;
100
- isAdjustmentAllowed: boolean;
101
- }, {
102
- type: import("@metamask/superstruct").Struct<string, null>;
103
- isAdjustmentAllowed: import("@metamask/superstruct").Struct<boolean, null>;
104
- data: import("@metamask/superstruct").Struct<Record<string, unknown>, null>;
105
- }>;
106
- context: import("@metamask/superstruct").Struct<`0x${string}`, null>;
107
- dependencies: import("@metamask/superstruct").Struct<{
108
- factory: `0x${string}`;
109
- factoryData: `0x${string}`;
110
- }[], import("@metamask/superstruct").Struct<{
111
- factory: `0x${string}`;
112
- factoryData: `0x${string}`;
113
- }, {
114
- factory: import("@metamask/superstruct").Struct<`0x${string}`, null>;
115
- factoryData: import("@metamask/superstruct").Struct<`0x${string}`, null>;
116
- }>>;
117
- delegationManager: import("@metamask/superstruct").Struct<`0x${string}`, null>;
118
- }>>;
119
- /**
120
- * Result type for the `wallet_getGrantedExecutionPermissions` JSON-RPC method.
121
- * Returns an array of all granted permissions that are not yet revoked.
122
- */
123
- export type GetGrantedExecutionPermissionsResult = Json & Infer<typeof GetGrantedExecutionPermissionsResultStruct>;
124
- /**
125
- * Hook type for processing the `wallet_getGrantedExecutionPermissions` request.
126
- */
127
- export type ProcessGetGrantedExecutionPermissionsHook = (req: JsonRpcRequest, context: WalletMiddlewareContext) => Promise<GetGrantedExecutionPermissionsResult>;
128
- /**
129
- * Creates a handler for the `wallet_getGrantedExecutionPermissions` JSON-RPC method.
130
- *
131
- * @param options - The options for the handler.
132
- * @param options.processGetGrantedExecutionPermissions - The function to process the
133
- * get granted execution permissions request.
134
- * @returns A JSON-RPC middleware function that handles the
135
- * `wallet_getGrantedExecutionPermissions` JSON-RPC method.
136
- */
137
- export declare function createWalletGetGrantedExecutionPermissionsHandler({ processGetGrantedExecutionPermissions, }: {
138
- processGetGrantedExecutionPermissions?: ProcessGetGrantedExecutionPermissionsHook;
139
- }): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext>;
140
- //# sourceMappingURL=wallet-get-granted-execution-permissions.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wallet-get-granted-execution-permissions.d.mts","sourceRoot":"","sources":["../../src/methods/wallet-get-granted-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAUnD,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAI5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,0CAA0C,mEAAiB,CAAC;AAazE;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ3C,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAC5C,OAAO,gCAAgC,CACxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEtD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oCAAoC,GAAG,IAAI,GACrD,KAAK,CAAC,OAAO,0CAA0C,CAAC,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,yCAAyC,GAAG,CACtD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAEnD;;;;;;;;GAQG;AACH,wBAAgB,iDAAiD,CAAC,EAChE,qCAAqC,GACtC,EAAE;IACD,qCAAqC,CAAC,EAAE,yCAAyC,CAAC;CACnF,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAcnE"}
@@ -1,57 +0,0 @@
1
- import { rpcErrors } from "@metamask/rpc-errors";
2
- import { array, boolean, object, record, string, unknown } from "@metamask/superstruct";
3
- import { HexChecksumAddressStruct, 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_getGrantedExecutionPermissions` 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 GetGrantedExecutionPermissionsParamsStruct = NoParamsStruct;
13
- const DependencyStruct = object({
14
- factory: StrictHexStruct,
15
- factoryData: StrictHexStruct,
16
- });
17
- const PermissionStruct = object({
18
- type: string(),
19
- isAdjustmentAllowed: boolean(),
20
- data: record(string(), unknown()),
21
- });
22
- /**
23
- * Superstruct schema for a single granted execution permission.
24
- */
25
- export const GrantedExecutionPermissionStruct = object({
26
- chainId: StrictHexStruct,
27
- from: HexChecksumAddressStruct,
28
- to: HexChecksumAddressStruct,
29
- permission: PermissionStruct,
30
- context: StrictHexStruct,
31
- dependencies: array(DependencyStruct),
32
- delegationManager: HexChecksumAddressStruct,
33
- });
34
- /**
35
- * Superstruct schema for the `wallet_getGrantedExecutionPermissions` result.
36
- */
37
- export const GetGrantedExecutionPermissionsResultStruct = array(GrantedExecutionPermissionStruct);
38
- /**
39
- * Creates a handler for the `wallet_getGrantedExecutionPermissions` JSON-RPC method.
40
- *
41
- * @param options - The options for the handler.
42
- * @param options.processGetGrantedExecutionPermissions - The function to process the
43
- * get granted execution permissions request.
44
- * @returns A JSON-RPC middleware function that handles the
45
- * `wallet_getGrantedExecutionPermissions` JSON-RPC method.
46
- */
47
- export function createWalletGetGrantedExecutionPermissionsHandler({ processGetGrantedExecutionPermissions, }) {
48
- return async ({ request, context }) => {
49
- if (!processGetGrantedExecutionPermissions) {
50
- throw rpcErrors.methodNotSupported('wallet_getGrantedExecutionPermissions - no middleware configured');
51
- }
52
- const { params } = request;
53
- validateParams(params, GetGrantedExecutionPermissionsParamsStruct);
54
- return await processGetGrantedExecutionPermissions(request, context);
55
- };
56
- }
57
- //# sourceMappingURL=wallet-get-granted-execution-permissions.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wallet-get-granted-execution-permissions.mjs","sourceRoot":"","sources":["../../src/methods/wallet-get-granted-execution-permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AAEjD,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,OAAO,EACR,8BAA8B;AAC/B,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,wBAAwB;AAG5E,OAAO,EAAE,cAAc,EAAE,6BAAyB;AAClD,OAAO,EAAE,cAAc,EAAE,gCAA4B;AAGrD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAAG,cAAc,CAAC;AAEzE,MAAM,gBAAgB,GAAG,MAAM,CAAC;IAC9B,OAAO,EAAE,eAAe;IACxB,WAAW,EAAE,eAAe;CAC7B,CAAC,CAAC;AAEH,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;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC;IACrD,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,wBAAwB;IAC9B,EAAE,EAAE,wBAAwB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,eAAe;IACxB,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC;IACrC,iBAAiB,EAAE,wBAAwB;CAC5C,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAAG,KAAK,CAC7D,gCAAgC,CACjC,CAAC;AAiBF;;;;;;;;GAQG;AACH,MAAM,UAAU,iDAAiD,CAAC,EAChE,qCAAqC,GAGtC;IACC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,qCAAqC,EAAE,CAAC;YAC3C,MAAM,SAAS,CAAC,kBAAkB,CAChC,kEAAkE,CACnE,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,cAAc,CAAC,MAAM,EAAE,0CAA0C,CAAC,CAAC;QAEnE,OAAO,MAAM,qCAAqC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvE,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 object,\n record,\n string,\n unknown,\n} from '@metamask/superstruct';\nimport { HexChecksumAddressStruct, 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_getGrantedExecutionPermissions` 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 GetGrantedExecutionPermissionsParamsStruct = NoParamsStruct;\n\nconst DependencyStruct = object({\n factory: StrictHexStruct,\n factoryData: StrictHexStruct,\n});\n\nconst PermissionStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\n/**\n * Superstruct schema for a single granted execution permission.\n */\nexport const GrantedExecutionPermissionStruct = object({\n chainId: StrictHexStruct,\n from: HexChecksumAddressStruct,\n to: HexChecksumAddressStruct,\n permission: PermissionStruct,\n context: StrictHexStruct,\n dependencies: array(DependencyStruct),\n delegationManager: HexChecksumAddressStruct,\n});\n\n/**\n * Represents a single granted execution permission.\n */\nexport type GrantedExecutionPermission = Infer<\n typeof GrantedExecutionPermissionStruct\n>;\n\n/**\n * Superstruct schema for the `wallet_getGrantedExecutionPermissions` result.\n */\nexport const GetGrantedExecutionPermissionsResultStruct = array(\n GrantedExecutionPermissionStruct,\n);\n\n/**\n * Result type for the `wallet_getGrantedExecutionPermissions` JSON-RPC method.\n * Returns an array of all granted permissions that are not yet revoked.\n */\nexport type GetGrantedExecutionPermissionsResult = Json &\n Infer<typeof GetGrantedExecutionPermissionsResultStruct>;\n\n/**\n * Hook type for processing the `wallet_getGrantedExecutionPermissions` request.\n */\nexport type ProcessGetGrantedExecutionPermissionsHook = (\n req: JsonRpcRequest,\n context: WalletMiddlewareContext,\n) => Promise<GetGrantedExecutionPermissionsResult>;\n\n/**\n * Creates a handler for the `wallet_getGrantedExecutionPermissions` JSON-RPC method.\n *\n * @param options - The options for the handler.\n * @param options.processGetGrantedExecutionPermissions - The function to process the\n * get granted execution permissions request.\n * @returns A JSON-RPC middleware function that handles the\n * `wallet_getGrantedExecutionPermissions` JSON-RPC method.\n */\nexport function createWalletGetGrantedExecutionPermissionsHandler({\n processGetGrantedExecutionPermissions,\n}: {\n processGetGrantedExecutionPermissions?: ProcessGetGrantedExecutionPermissionsHook;\n}): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext> {\n return async ({ request, context }) => {\n if (!processGetGrantedExecutionPermissions) {\n throw rpcErrors.methodNotSupported(\n 'wallet_getGrantedExecutionPermissions - no middleware configured',\n );\n }\n\n const { params } = request;\n\n validateParams(params, GetGrantedExecutionPermissionsParamsStruct);\n\n return await processGetGrantedExecutionPermissions(request, context);\n };\n}\n"]}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createWalletGetSupportedExecutionPermissionsHandler = exports.GetSupportedExecutionPermissionsResultStruct = exports.SupportedExecutionPermissionConfigStruct = exports.GetSupportedExecutionPermissionsParamsStruct = void 0;
4
- const rpc_errors_1 = require("@metamask/rpc-errors");
5
- const superstruct_1 = require("@metamask/superstruct");
6
- const utils_1 = require("@metamask/utils");
7
- const structs_1 = require("../utils/structs.cjs");
8
- const validation_1 = require("../utils/validation.cjs");
9
- /**
10
- * Superstruct schema for the `wallet_getSupportedExecutionPermissions` request params.
11
- *
12
- * This method expects no parameters. Different JSON-RPC clients may send "no params"
13
- * in different ways (omitted, empty array, or empty object), so we accept all three.
14
- */
15
- exports.GetSupportedExecutionPermissionsParamsStruct = structs_1.NoParamsStruct;
16
- /**
17
- * Superstruct schema for a supported permission type configuration.
18
- */
19
- exports.SupportedExecutionPermissionConfigStruct = (0, superstruct_1.object)({
20
- chainIds: (0, superstruct_1.array)(utils_1.StrictHexStruct),
21
- ruleTypes: (0, superstruct_1.array)((0, superstruct_1.string)()),
22
- });
23
- /**
24
- * Superstruct schema for the `wallet_getSupportedExecutionPermissions` result.
25
- */
26
- exports.GetSupportedExecutionPermissionsResultStruct = (0, superstruct_1.record)((0, superstruct_1.string)(), exports.SupportedExecutionPermissionConfigStruct);
27
- /**
28
- * Creates a handler for the `wallet_getSupportedExecutionPermissions` JSON-RPC method.
29
- *
30
- * @param options - The options for the handler.
31
- * @param options.processGetSupportedExecutionPermissions - The function to process the
32
- * get supported execution permissions request.
33
- * @returns A JSON-RPC middleware function that handles the
34
- * `wallet_getSupportedExecutionPermissions` JSON-RPC method.
35
- */
36
- function createWalletGetSupportedExecutionPermissionsHandler({ processGetSupportedExecutionPermissions, }) {
37
- return async ({ request, context }) => {
38
- if (!processGetSupportedExecutionPermissions) {
39
- throw rpc_errors_1.rpcErrors.methodNotSupported('wallet_getSupportedExecutionPermissions - no middleware configured');
40
- }
41
- const { params } = request;
42
- (0, validation_1.validateParams)(params, exports.GetSupportedExecutionPermissionsParamsStruct);
43
- return await processGetSupportedExecutionPermissions(request, context);
44
- };
45
- }
46
- exports.createWalletGetSupportedExecutionPermissionsHandler = createWalletGetSupportedExecutionPermissionsHandler;
47
- //# sourceMappingURL=wallet-get-supported-execution-permissions.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wallet-get-supported-execution-permissions.cjs","sourceRoot":"","sources":["../../src/methods/wallet-get-supported-execution-permissions.ts"],"names":[],"mappings":";;;AACA,qDAAiD;AAEjD,uDAAsE;AACtE,2CAAkD;AAGlD,kDAAkD;AAClD,wDAAqD;AAGrD;;;;;GAKG;AACU,QAAA,4CAA4C,GAAG,wBAAc,CAAC;AAE3E;;GAEG;AACU,QAAA,wCAAwC,GAAG,IAAA,oBAAM,EAAC;IAC7D,QAAQ,EAAE,IAAA,mBAAK,EAAC,uBAAe,CAAC;IAChC,SAAS,EAAE,IAAA,mBAAK,EAAC,IAAA,oBAAM,GAAE,CAAC;CAC3B,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,4CAA4C,GAAG,IAAA,oBAAM,EAChE,IAAA,oBAAM,GAAE,EACR,gDAAwC,CACzC,CAAC;AAiBF;;;;;;;;GAQG;AACH,SAAgB,mDAAmD,CAAC,EAClE,uCAAuC,GAGxC;IACC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,uCAAuC,EAAE,CAAC;YAC7C,MAAM,sBAAS,CAAC,kBAAkB,CAChC,oEAAoE,CACrE,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,IAAA,2BAAc,EAAC,MAAM,EAAE,oDAA4C,CAAC,CAAC;QAErE,OAAO,MAAM,uCAAuC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC,CAAC;AACJ,CAAC;AAlBD,kHAkBC","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"]}
@@ -1,54 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,54 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,43 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1,21 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
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"}