@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.
- package/CHANGELOG.md +4 -0
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/dist/methods/wallet-get-granted-execution-permissions.cjs +61 -0
- package/dist/methods/wallet-get-granted-execution-permissions.cjs.map +1 -0
- package/dist/methods/wallet-get-granted-execution-permissions.d.cts +140 -0
- package/dist/methods/wallet-get-granted-execution-permissions.d.cts.map +1 -0
- package/dist/methods/wallet-get-granted-execution-permissions.d.mts +140 -0
- package/dist/methods/wallet-get-granted-execution-permissions.d.mts.map +1 -0
- package/dist/methods/wallet-get-granted-execution-permissions.mjs +57 -0
- package/dist/methods/wallet-get-granted-execution-permissions.mjs.map +1 -0
- package/dist/methods/wallet-get-supported-execution-permissions.cjs +47 -0
- package/dist/methods/wallet-get-supported-execution-permissions.cjs.map +1 -0
- package/dist/methods/wallet-get-supported-execution-permissions.d.cts +54 -0
- package/dist/methods/wallet-get-supported-execution-permissions.d.cts.map +1 -0
- package/dist/methods/wallet-get-supported-execution-permissions.d.mts +54 -0
- package/dist/methods/wallet-get-supported-execution-permissions.d.mts.map +1 -0
- package/dist/methods/wallet-get-supported-execution-permissions.mjs +43 -0
- package/dist/methods/wallet-get-supported-execution-permissions.mjs.map +1 -0
- package/dist/methods/wallet-request-execution-permissions.cjs +2 -9
- package/dist/methods/wallet-request-execution-permissions.cjs.map +1 -1
- package/dist/methods/wallet-request-execution-permissions.d.cts +16 -54
- package/dist/methods/wallet-request-execution-permissions.d.cts.map +1 -1
- package/dist/methods/wallet-request-execution-permissions.d.mts +16 -54
- package/dist/methods/wallet-request-execution-permissions.d.mts.map +1 -1
- package/dist/methods/wallet-request-execution-permissions.mjs +2 -9
- package/dist/methods/wallet-request-execution-permissions.mjs.map +1 -1
- package/dist/utils/structs.cjs +21 -0
- package/dist/utils/structs.cjs.map +1 -0
- package/dist/utils/structs.d.cts +17 -0
- package/dist/utils/structs.d.cts.map +1 -0
- package/dist/utils/structs.d.mts +17 -0
- package/dist/utils/structs.d.mts.map +1 -0
- package/dist/utils/structs.mjs +18 -0
- package/dist/utils/structs.mjs.map +1 -0
- package/dist/wallet.cjs +11 -1
- package/dist/wallet.cjs.map +1 -1
- package/dist/wallet.d.cts +7 -1
- package/dist/wallet.d.cts.map +1 -1
- package/dist/wallet.d.mts +7 -1
- package/dist/wallet.d.mts.map +1 -1
- package/dist/wallet.mjs +11 -1
- package/dist/wallet.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Support for `wallet_getSupportedExecutionPermissions` and `wallet_getGrantedExecutionPermissions` RPC methods ([#7603](https://github.com/MetaMask/core/pull/7603))
|
|
13
|
+
|
|
10
14
|
### Changed
|
|
11
15
|
|
|
12
16
|
- Upgrade `@metamask/utils` from `^11.8.1` to `^11.9.0` ([#7511](https://github.com/MetaMask/core/pull/7511))
|
package/dist/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.createFetchMiddleware = void 0;
|
|
17
|
+
exports.GetSupportedExecutionPermissionsResultStruct = exports.SupportedExecutionPermissionConfigStruct = exports.GetGrantedExecutionPermissionsResultStruct = exports.GrantedExecutionPermissionStruct = exports.createFetchMiddleware = void 0;
|
|
18
18
|
__exportStar(require("./block-cache.cjs"), exports);
|
|
19
19
|
__exportStar(require("./block-ref-rewrite.cjs"), exports);
|
|
20
20
|
__exportStar(require("./block-ref.cjs"), exports);
|
|
@@ -22,6 +22,12 @@ __exportStar(require("./block-tracker-inspector.cjs"), exports);
|
|
|
22
22
|
var fetch_1 = require("./fetch.cjs");
|
|
23
23
|
Object.defineProperty(exports, "createFetchMiddleware", { enumerable: true, get: function () { return fetch_1.createFetchMiddleware; } });
|
|
24
24
|
__exportStar(require("./inflight-cache.cjs"), exports);
|
|
25
|
+
var wallet_get_granted_execution_permissions_1 = require("./methods/wallet-get-granted-execution-permissions.cjs");
|
|
26
|
+
Object.defineProperty(exports, "GrantedExecutionPermissionStruct", { enumerable: true, get: function () { return wallet_get_granted_execution_permissions_1.GrantedExecutionPermissionStruct; } });
|
|
27
|
+
Object.defineProperty(exports, "GetGrantedExecutionPermissionsResultStruct", { enumerable: true, get: function () { return wallet_get_granted_execution_permissions_1.GetGrantedExecutionPermissionsResultStruct; } });
|
|
28
|
+
var wallet_get_supported_execution_permissions_1 = require("./methods/wallet-get-supported-execution-permissions.cjs");
|
|
29
|
+
Object.defineProperty(exports, "SupportedExecutionPermissionConfigStruct", { enumerable: true, get: function () { return wallet_get_supported_execution_permissions_1.SupportedExecutionPermissionConfigStruct; } });
|
|
30
|
+
Object.defineProperty(exports, "GetSupportedExecutionPermissionsResultStruct", { enumerable: true, get: function () { return wallet_get_supported_execution_permissions_1.GetSupportedExecutionPermissionsResultStruct; } });
|
|
25
31
|
__exportStar(require("./providerAsMiddleware.cjs"), exports);
|
|
26
32
|
__exportStar(require("./retryOnEmpty.cjs"), exports);
|
|
27
33
|
__exportStar(require("./wallet.cjs"), exports);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAA8B;AAC9B,0DAAoC;AACpC,kDAA4B;AAC5B,gEAA0C;AAC1C,qCAAgD;AAAvC,8GAAA,qBAAqB,OAAA;AAC9B,uDAAiC;
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAA8B;AAC9B,0DAAoC;AACpC,kDAA4B;AAC5B,gEAA0C;AAC1C,qCAAgD;AAAvC,8GAAA,qBAAqB,OAAA;AAC9B,uDAAiC;AAiBjC,mHAG4D;AAF1D,4JAAA,gCAAgC,OAAA;AAChC,sKAAA,0CAA0C,OAAA;AAO5C,uHAG8D;AAF5D,sKAAA,wCAAwC,OAAA;AACxC,0KAAA,4CAA4C,OAAA;AAE9C,6DAAuC;AACvC,qDAA+B;AAC/B,+CAAyB","sourcesContent":["export * from './block-cache';\nexport * from './block-ref-rewrite';\nexport * from './block-ref';\nexport * from './block-tracker-inspector';\nexport { createFetchMiddleware } from './fetch';\nexport * from './inflight-cache';\nexport type {\n PermissionDependency,\n RequestExecutionPermissionsRequestParams,\n RequestExecutionPermissionsResult,\n ProcessRequestExecutionPermissionsHook,\n} from './methods/wallet-request-execution-permissions';\nexport type {\n ProcessRevokeExecutionPermissionHook,\n RevokeExecutionPermissionRequestParams,\n RevokeExecutionPermissionResult,\n} from './methods/wallet-revoke-execution-permission';\nexport type {\n GrantedExecutionPermission,\n GetGrantedExecutionPermissionsResult,\n ProcessGetGrantedExecutionPermissionsHook,\n} from './methods/wallet-get-granted-execution-permissions';\nexport {\n GrantedExecutionPermissionStruct,\n GetGrantedExecutionPermissionsResultStruct,\n} from './methods/wallet-get-granted-execution-permissions';\nexport type {\n SupportedExecutionPermissionConfig,\n GetSupportedExecutionPermissionsResult,\n ProcessGetSupportedExecutionPermissionsHook,\n} from './methods/wallet-get-supported-execution-permissions';\nexport {\n SupportedExecutionPermissionConfigStruct,\n GetSupportedExecutionPermissionsResultStruct,\n} from './methods/wallet-get-supported-execution-permissions';\nexport * from './providerAsMiddleware';\nexport * from './retryOnEmpty';\nexport * from './wallet';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -4,8 +4,12 @@ export * from "./block-ref.cjs";
|
|
|
4
4
|
export * from "./block-tracker-inspector.cjs";
|
|
5
5
|
export { createFetchMiddleware } from "./fetch.cjs";
|
|
6
6
|
export * from "./inflight-cache.cjs";
|
|
7
|
-
export type { RequestExecutionPermissionsRequestParams, RequestExecutionPermissionsResult, ProcessRequestExecutionPermissionsHook, } from "./methods/wallet-request-execution-permissions.cjs";
|
|
7
|
+
export type { PermissionDependency, RequestExecutionPermissionsRequestParams, RequestExecutionPermissionsResult, ProcessRequestExecutionPermissionsHook, } from "./methods/wallet-request-execution-permissions.cjs";
|
|
8
8
|
export type { ProcessRevokeExecutionPermissionHook, RevokeExecutionPermissionRequestParams, RevokeExecutionPermissionResult, } from "./methods/wallet-revoke-execution-permission.cjs";
|
|
9
|
+
export type { GrantedExecutionPermission, GetGrantedExecutionPermissionsResult, ProcessGetGrantedExecutionPermissionsHook, } from "./methods/wallet-get-granted-execution-permissions.cjs";
|
|
10
|
+
export { GrantedExecutionPermissionStruct, GetGrantedExecutionPermissionsResultStruct, } from "./methods/wallet-get-granted-execution-permissions.cjs";
|
|
11
|
+
export type { SupportedExecutionPermissionConfig, GetSupportedExecutionPermissionsResult, ProcessGetSupportedExecutionPermissionsHook, } from "./methods/wallet-get-supported-execution-permissions.cjs";
|
|
12
|
+
export { SupportedExecutionPermissionConfigStruct, GetSupportedExecutionPermissionsResultStruct, } from "./methods/wallet-get-supported-execution-permissions.cjs";
|
|
9
13
|
export * from "./providerAsMiddleware.cjs";
|
|
10
14
|
export * from "./retryOnEmpty.cjs";
|
|
11
15
|
export * from "./wallet.cjs";
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,wCAAoC;AACpC,gCAA4B;AAC5B,8CAA0C;AAC1C,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,qCAAiC;AACjC,YAAY,EACV,wCAAwC,EACxC,iCAAiC,EACjC,sCAAsC,GACvC,2DAAuD;AACxD,YAAY,EACV,oCAAoC,EACpC,sCAAsC,EACtC,+BAA+B,GAChC,yDAAqD;AACtD,2CAAuC;AACvC,mCAA+B;AAC/B,6BAAyB"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,wCAAoC;AACpC,gCAA4B;AAC5B,8CAA0C;AAC1C,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,qCAAiC;AACjC,YAAY,EACV,oBAAoB,EACpB,wCAAwC,EACxC,iCAAiC,EACjC,sCAAsC,GACvC,2DAAuD;AACxD,YAAY,EACV,oCAAoC,EACpC,sCAAsC,EACtC,+BAA+B,GAChC,yDAAqD;AACtD,YAAY,EACV,0BAA0B,EAC1B,oCAAoC,EACpC,yCAAyC,GAC1C,+DAA2D;AAC5D,OAAO,EACL,gCAAgC,EAChC,0CAA0C,GAC3C,+DAA2D;AAC5D,YAAY,EACV,kCAAkC,EAClC,sCAAsC,EACtC,2CAA2C,GAC5C,iEAA6D;AAC9D,OAAO,EACL,wCAAwC,EACxC,4CAA4C,GAC7C,iEAA6D;AAC9D,2CAAuC;AACvC,mCAA+B;AAC/B,6BAAyB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -4,8 +4,12 @@ export * from "./block-ref.mjs";
|
|
|
4
4
|
export * from "./block-tracker-inspector.mjs";
|
|
5
5
|
export { createFetchMiddleware } from "./fetch.mjs";
|
|
6
6
|
export * from "./inflight-cache.mjs";
|
|
7
|
-
export type { RequestExecutionPermissionsRequestParams, RequestExecutionPermissionsResult, ProcessRequestExecutionPermissionsHook, } from "./methods/wallet-request-execution-permissions.mjs";
|
|
7
|
+
export type { PermissionDependency, RequestExecutionPermissionsRequestParams, RequestExecutionPermissionsResult, ProcessRequestExecutionPermissionsHook, } from "./methods/wallet-request-execution-permissions.mjs";
|
|
8
8
|
export type { ProcessRevokeExecutionPermissionHook, RevokeExecutionPermissionRequestParams, RevokeExecutionPermissionResult, } from "./methods/wallet-revoke-execution-permission.mjs";
|
|
9
|
+
export type { GrantedExecutionPermission, GetGrantedExecutionPermissionsResult, ProcessGetGrantedExecutionPermissionsHook, } from "./methods/wallet-get-granted-execution-permissions.mjs";
|
|
10
|
+
export { GrantedExecutionPermissionStruct, GetGrantedExecutionPermissionsResultStruct, } from "./methods/wallet-get-granted-execution-permissions.mjs";
|
|
11
|
+
export type { SupportedExecutionPermissionConfig, GetSupportedExecutionPermissionsResult, ProcessGetSupportedExecutionPermissionsHook, } from "./methods/wallet-get-supported-execution-permissions.mjs";
|
|
12
|
+
export { SupportedExecutionPermissionConfigStruct, GetSupportedExecutionPermissionsResultStruct, } from "./methods/wallet-get-supported-execution-permissions.mjs";
|
|
9
13
|
export * from "./providerAsMiddleware.mjs";
|
|
10
14
|
export * from "./retryOnEmpty.mjs";
|
|
11
15
|
export * from "./wallet.mjs";
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,wCAAoC;AACpC,gCAA4B;AAC5B,8CAA0C;AAC1C,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,qCAAiC;AACjC,YAAY,EACV,wCAAwC,EACxC,iCAAiC,EACjC,sCAAsC,GACvC,2DAAuD;AACxD,YAAY,EACV,oCAAoC,EACpC,sCAAsC,EACtC,+BAA+B,GAChC,yDAAqD;AACtD,2CAAuC;AACvC,mCAA+B;AAC/B,6BAAyB"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,wCAAoC;AACpC,gCAA4B;AAC5B,8CAA0C;AAC1C,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,qCAAiC;AACjC,YAAY,EACV,oBAAoB,EACpB,wCAAwC,EACxC,iCAAiC,EACjC,sCAAsC,GACvC,2DAAuD;AACxD,YAAY,EACV,oCAAoC,EACpC,sCAAsC,EACtC,+BAA+B,GAChC,yDAAqD;AACtD,YAAY,EACV,0BAA0B,EAC1B,oCAAoC,EACpC,yCAAyC,GAC1C,+DAA2D;AAC5D,OAAO,EACL,gCAAgC,EAChC,0CAA0C,GAC3C,+DAA2D;AAC5D,YAAY,EACV,kCAAkC,EAClC,sCAAsC,EACtC,2CAA2C,GAC5C,iEAA6D;AAC9D,OAAO,EACL,wCAAwC,EACxC,4CAA4C,GAC7C,iEAA6D;AAC9D,2CAAuC;AACvC,mCAA+B;AAC/B,6BAAyB"}
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,8 @@ export * from "./block-ref.mjs";
|
|
|
4
4
|
export * from "./block-tracker-inspector.mjs";
|
|
5
5
|
export { createFetchMiddleware } from "./fetch.mjs";
|
|
6
6
|
export * from "./inflight-cache.mjs";
|
|
7
|
+
export { GrantedExecutionPermissionStruct, GetGrantedExecutionPermissionsResultStruct } from "./methods/wallet-get-granted-execution-permissions.mjs";
|
|
8
|
+
export { SupportedExecutionPermissionConfigStruct, GetSupportedExecutionPermissionsResultStruct } from "./methods/wallet-get-supported-execution-permissions.mjs";
|
|
7
9
|
export * from "./providerAsMiddleware.mjs";
|
|
8
10
|
export * from "./retryOnEmpty.mjs";
|
|
9
11
|
export * from "./wallet.mjs";
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,wCAAoC;AACpC,gCAA4B;AAC5B,8CAA0C;AAC1C,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,qCAAiC;
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAA8B;AAC9B,wCAAoC;AACpC,gCAA4B;AAC5B,8CAA0C;AAC1C,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,qCAAiC;AAiBjC,OAAO,EACL,gCAAgC,EAChC,0CAA0C,EAC3C,+DAA2D;AAM5D,OAAO,EACL,wCAAwC,EACxC,4CAA4C,EAC7C,iEAA6D;AAC9D,2CAAuC;AACvC,mCAA+B;AAC/B,6BAAyB","sourcesContent":["export * from './block-cache';\nexport * from './block-ref-rewrite';\nexport * from './block-ref';\nexport * from './block-tracker-inspector';\nexport { createFetchMiddleware } from './fetch';\nexport * from './inflight-cache';\nexport type {\n PermissionDependency,\n RequestExecutionPermissionsRequestParams,\n RequestExecutionPermissionsResult,\n ProcessRequestExecutionPermissionsHook,\n} from './methods/wallet-request-execution-permissions';\nexport type {\n ProcessRevokeExecutionPermissionHook,\n RevokeExecutionPermissionRequestParams,\n RevokeExecutionPermissionResult,\n} from './methods/wallet-revoke-execution-permission';\nexport type {\n GrantedExecutionPermission,\n GetGrantedExecutionPermissionsResult,\n ProcessGetGrantedExecutionPermissionsHook,\n} from './methods/wallet-get-granted-execution-permissions';\nexport {\n GrantedExecutionPermissionStruct,\n GetGrantedExecutionPermissionsResultStruct,\n} from './methods/wallet-get-granted-execution-permissions';\nexport type {\n SupportedExecutionPermissionConfig,\n GetSupportedExecutionPermissionsResult,\n ProcessGetSupportedExecutionPermissionsHook,\n} from './methods/wallet-get-supported-execution-permissions';\nexport {\n SupportedExecutionPermissionConfigStruct,\n GetSupportedExecutionPermissionsResultStruct,\n} from './methods/wallet-get-supported-execution-permissions';\nexport * from './providerAsMiddleware';\nexport * from './retryOnEmpty';\nexport * from './wallet';\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createWalletGetGrantedExecutionPermissionsHandler = exports.GetGrantedExecutionPermissionsResultStruct = exports.GrantedExecutionPermissionStruct = exports.GetGrantedExecutionPermissionsParamsStruct = 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_getGrantedExecutionPermissions` 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.GetGrantedExecutionPermissionsParamsStruct = structs_1.NoParamsStruct;
|
|
16
|
+
const DependencyStruct = (0, superstruct_1.object)({
|
|
17
|
+
factory: utils_1.StrictHexStruct,
|
|
18
|
+
factoryData: utils_1.StrictHexStruct,
|
|
19
|
+
});
|
|
20
|
+
const PermissionStruct = (0, superstruct_1.object)({
|
|
21
|
+
type: (0, superstruct_1.string)(),
|
|
22
|
+
isAdjustmentAllowed: (0, superstruct_1.boolean)(),
|
|
23
|
+
data: (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.unknown)()),
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Superstruct schema for a single granted execution permission.
|
|
27
|
+
*/
|
|
28
|
+
exports.GrantedExecutionPermissionStruct = (0, superstruct_1.object)({
|
|
29
|
+
chainId: utils_1.StrictHexStruct,
|
|
30
|
+
from: utils_1.HexChecksumAddressStruct,
|
|
31
|
+
to: utils_1.HexChecksumAddressStruct,
|
|
32
|
+
permission: PermissionStruct,
|
|
33
|
+
context: utils_1.StrictHexStruct,
|
|
34
|
+
dependencies: (0, superstruct_1.array)(DependencyStruct),
|
|
35
|
+
delegationManager: utils_1.HexChecksumAddressStruct,
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Superstruct schema for the `wallet_getGrantedExecutionPermissions` result.
|
|
39
|
+
*/
|
|
40
|
+
exports.GetGrantedExecutionPermissionsResultStruct = (0, superstruct_1.array)(exports.GrantedExecutionPermissionStruct);
|
|
41
|
+
/**
|
|
42
|
+
* Creates a handler for the `wallet_getGrantedExecutionPermissions` JSON-RPC method.
|
|
43
|
+
*
|
|
44
|
+
* @param options - The options for the handler.
|
|
45
|
+
* @param options.processGetGrantedExecutionPermissions - The function to process the
|
|
46
|
+
* get granted execution permissions request.
|
|
47
|
+
* @returns A JSON-RPC middleware function that handles the
|
|
48
|
+
* `wallet_getGrantedExecutionPermissions` JSON-RPC method.
|
|
49
|
+
*/
|
|
50
|
+
function createWalletGetGrantedExecutionPermissionsHandler({ processGetGrantedExecutionPermissions, }) {
|
|
51
|
+
return async ({ request, context }) => {
|
|
52
|
+
if (!processGetGrantedExecutionPermissions) {
|
|
53
|
+
throw rpc_errors_1.rpcErrors.methodNotSupported('wallet_getGrantedExecutionPermissions - no middleware configured');
|
|
54
|
+
}
|
|
55
|
+
const { params } = request;
|
|
56
|
+
(0, validation_1.validateParams)(params, exports.GetGrantedExecutionPermissionsParamsStruct);
|
|
57
|
+
return await processGetGrantedExecutionPermissions(request, context);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.createWalletGetGrantedExecutionPermissionsHandler = createWalletGetGrantedExecutionPermissionsHandler;
|
|
61
|
+
//# sourceMappingURL=wallet-get-granted-execution-permissions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-get-granted-execution-permissions.cjs","sourceRoot":"","sources":["../../src/methods/wallet-get-granted-execution-permissions.ts"],"names":[],"mappings":";;;AACA,qDAAiD;AAEjD,uDAO+B;AAC/B,2CAA4E;AAG5E,kDAAkD;AAClD,wDAAqD;AAGrD;;;;;GAKG;AACU,QAAA,0CAA0C,GAAG,wBAAc,CAAC;AAEzE,MAAM,gBAAgB,GAAG,IAAA,oBAAM,EAAC;IAC9B,OAAO,EAAE,uBAAe;IACxB,WAAW,EAAE,uBAAe;CAC7B,CAAC,CAAC;AAEH,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;;GAEG;AACU,QAAA,gCAAgC,GAAG,IAAA,oBAAM,EAAC;IACrD,OAAO,EAAE,uBAAe;IACxB,IAAI,EAAE,gCAAwB;IAC9B,EAAE,EAAE,gCAAwB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,uBAAe;IACxB,YAAY,EAAE,IAAA,mBAAK,EAAC,gBAAgB,CAAC;IACrC,iBAAiB,EAAE,gCAAwB;CAC5C,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,0CAA0C,GAAG,IAAA,mBAAK,EAC7D,wCAAgC,CACjC,CAAC;AAiBF;;;;;;;;GAQG;AACH,SAAgB,iDAAiD,CAAC,EAChE,qCAAqC,GAGtC;IACC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,qCAAqC,EAAE,CAAC;YAC3C,MAAM,sBAAS,CAAC,kBAAkB,CAChC,kEAAkE,CACnE,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,IAAA,2BAAc,EAAC,MAAM,EAAE,kDAA0C,CAAC,CAAC;QAEnE,OAAO,MAAM,qCAAqC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC,CAAC;AACJ,CAAC;AAlBD,8GAkBC","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"]}
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|