@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.
- package/CHANGELOG.md +0 -4
- package/dist/index.cjs +1 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +0 -2
- package/dist/index.mjs.map +1 -1
- package/dist/methods/wallet-request-execution-permissions.cjs +9 -2
- package/dist/methods/wallet-request-execution-permissions.cjs.map +1 -1
- package/dist/methods/wallet-request-execution-permissions.d.cts +54 -16
- package/dist/methods/wallet-request-execution-permissions.d.cts.map +1 -1
- package/dist/methods/wallet-request-execution-permissions.d.mts +54 -16
- package/dist/methods/wallet-request-execution-permissions.d.mts.map +1 -1
- package/dist/methods/wallet-request-execution-permissions.mjs +9 -2
- package/dist/methods/wallet-request-execution-permissions.mjs.map +1 -1
- package/dist/wallet.cjs +1 -11
- package/dist/wallet.cjs.map +1 -1
- package/dist/wallet.d.cts +1 -7
- package/dist/wallet.d.cts.map +1 -1
- package/dist/wallet.d.mts +1 -7
- package/dist/wallet.d.mts.map +1 -1
- package/dist/wallet.mjs +1 -11
- package/dist/wallet.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/methods/wallet-get-granted-execution-permissions.cjs +0 -61
- package/dist/methods/wallet-get-granted-execution-permissions.cjs.map +0 -1
- package/dist/methods/wallet-get-granted-execution-permissions.d.cts +0 -140
- package/dist/methods/wallet-get-granted-execution-permissions.d.cts.map +0 -1
- package/dist/methods/wallet-get-granted-execution-permissions.d.mts +0 -140
- package/dist/methods/wallet-get-granted-execution-permissions.d.mts.map +0 -1
- package/dist/methods/wallet-get-granted-execution-permissions.mjs +0 -57
- package/dist/methods/wallet-get-granted-execution-permissions.mjs.map +0 -1
- package/dist/methods/wallet-get-supported-execution-permissions.cjs +0 -47
- package/dist/methods/wallet-get-supported-execution-permissions.cjs.map +0 -1
- package/dist/methods/wallet-get-supported-execution-permissions.d.cts +0 -54
- package/dist/methods/wallet-get-supported-execution-permissions.d.cts.map +0 -1
- package/dist/methods/wallet-get-supported-execution-permissions.d.mts +0 -54
- package/dist/methods/wallet-get-supported-execution-permissions.d.mts.map +0 -1
- package/dist/methods/wallet-get-supported-execution-permissions.mjs +0 -43
- package/dist/methods/wallet-get-supported-execution-permissions.mjs.map +0 -1
- package/dist/utils/structs.cjs +0 -21
- package/dist/utils/structs.cjs.map +0 -1
- package/dist/utils/structs.d.cts +0 -17
- package/dist/utils/structs.d.cts.map +0 -1
- package/dist/utils/structs.d.mts +0 -17
- package/dist/utils/structs.d.mts.map +0 -1
- package/dist/utils/structs.mjs +0 -18
- package/dist/utils/structs.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,6 @@ 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
|
-
|
|
14
10
|
### Changed
|
|
15
11
|
|
|
16
12
|
- 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.
|
|
17
|
+
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,12 +22,6 @@ __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; } });
|
|
31
25
|
__exportStar(require("./providerAsMiddleware.cjs"), exports);
|
|
32
26
|
__exportStar(require("./retryOnEmpty.cjs"), exports);
|
|
33
27
|
__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;AAWjC,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 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 * from './providerAsMiddleware';\nexport * from './retryOnEmpty';\nexport * from './wallet';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -4,12 +4,8 @@ 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 {
|
|
7
|
+
export type { 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";
|
|
13
9
|
export * from "./providerAsMiddleware.cjs";
|
|
14
10
|
export * from "./retryOnEmpty.cjs";
|
|
15
11
|
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,
|
|
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"}
|
package/dist/index.d.mts
CHANGED
|
@@ -4,12 +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 type {
|
|
7
|
+
export type { 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";
|
|
13
9
|
export * from "./providerAsMiddleware.mjs";
|
|
14
10
|
export * from "./retryOnEmpty.mjs";
|
|
15
11
|
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,
|
|
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"}
|
package/dist/index.mjs
CHANGED
|
@@ -4,8 +4,6 @@ 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";
|
|
9
7
|
export * from "./providerAsMiddleware.mjs";
|
|
10
8
|
export * from "./retryOnEmpty.mjs";
|
|
11
9
|
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;AAWjC,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 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 * from './providerAsMiddleware';\nexport * from './retryOnEmpty';\nexport * from './wallet';\n"]}
|
|
@@ -12,12 +12,19 @@ const PermissionStruct = (0, superstruct_1.object)({
|
|
|
12
12
|
});
|
|
13
13
|
const RuleStruct = (0, superstruct_1.object)({
|
|
14
14
|
type: (0, superstruct_1.string)(),
|
|
15
|
+
isAdjustmentAllowed: (0, superstruct_1.boolean)(),
|
|
15
16
|
data: (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.unknown)()),
|
|
16
17
|
});
|
|
18
|
+
const AccountSignerStruct = (0, superstruct_1.object)({
|
|
19
|
+
type: (0, superstruct_1.literal)('account'),
|
|
20
|
+
data: (0, superstruct_1.object)({
|
|
21
|
+
address: utils_1.HexChecksumAddressStruct,
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
17
24
|
const PermissionRequestStruct = (0, superstruct_1.object)({
|
|
18
25
|
chainId: utils_1.StrictHexStruct,
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
address: (0, superstruct_1.optional)(utils_1.HexChecksumAddressStruct),
|
|
27
|
+
signer: AccountSignerStruct,
|
|
21
28
|
permission: PermissionStruct,
|
|
22
29
|
rules: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.array)(RuleStruct), (0, superstruct_1.literal)(null)])),
|
|
23
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-request-execution-permissions.cjs","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":";;;AACA,qDAAiD;AAEjD,uDAU+B;AAC/B,2CAA4E;AAG5E,wDAAqD;AAGrD,MAAM,gBAAgB,GAAG,IAAA,oBAAM,EAAC;IAC9B,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,mBAAmB,EAAE,IAAA,qBAAO,GAAE;IAC9B,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,GAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,IAAA,oBAAM,EAAC;IACxB,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,GAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IACrC,OAAO,EAAE,uBAAe;IACxB,
|
|
1
|
+
{"version":3,"file":"wallet-request-execution-permissions.cjs","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":";;;AACA,qDAAiD;AAEjD,uDAU+B;AAC/B,2CAA4E;AAG5E,wDAAqD;AAGrD,MAAM,gBAAgB,GAAG,IAAA,oBAAM,EAAC;IAC9B,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,mBAAmB,EAAE,IAAA,qBAAO,GAAE;IAC9B,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,GAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,IAAA,oBAAM,EAAC;IACxB,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,mBAAmB,EAAE,IAAA,qBAAO,GAAE;IAC9B,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,GAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,IAAA,oBAAM,EAAC;IACjC,IAAI,EAAE,IAAA,qBAAO,EAAC,SAAS,CAAC;IACxB,IAAI,EAAE,IAAA,oBAAM,EAAC;QACX,OAAO,EAAE,gCAAwB;KAClC,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IACrC,OAAO,EAAE,uBAAe;IACxB,OAAO,EAAE,IAAA,sBAAQ,EAAC,gCAAwB,CAAC;IAC3C,MAAM,EAAE,mBAAmB;IAC3B,UAAU,EAAE,gBAAgB;IAC5B,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,UAAU,CAAC,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAC3D,CAAC,CAAC;AAEU,QAAA,iCAAiC,GAAG,IAAA,mBAAK,EAAC,uBAAuB,CAAC,CAAC;AAkBhF;;;;;;;;GAQG;AACH,SAAgB,8CAA8C,CAAC,EAC7D,kCAAkC,GAGnC;IACC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,kCAAkC,EAAE,CAAC;YACxC,MAAM,sBAAS,CAAC,kBAAkB,CAChC,+DAA+D,CAChE,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,IAAA,2BAAc,EAAC,MAAM,EAAE,yCAAiC,CAAC,CAAC;QAE1D,OAAO,MAAM,kCAAkC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC;AACJ,CAAC;AAlBD,wGAkBC","sourcesContent":["import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine/v2';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n literal,\n object,\n optional,\n record,\n string,\n union,\n unknown,\n} from '@metamask/superstruct';\nimport { HexChecksumAddressStruct, StrictHexStruct } from '@metamask/utils';\nimport type { Hex, Json, JsonRpcRequest } from '@metamask/utils';\n\nimport { validateParams } from '../utils/validation';\nimport type { WalletMiddlewareContext } from '../wallet';\n\nconst PermissionStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\nconst RuleStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\nconst AccountSignerStruct = object({\n type: literal('account'),\n data: object({\n address: HexChecksumAddressStruct,\n }),\n});\n\nconst PermissionRequestStruct = object({\n chainId: StrictHexStruct,\n address: optional(HexChecksumAddressStruct),\n signer: AccountSignerStruct,\n permission: PermissionStruct,\n rules: optional(union([array(RuleStruct), literal(null)])),\n});\n\nexport const RequestExecutionPermissionsStruct = array(PermissionRequestStruct);\n\n// RequestExecutionPermissions API types\nexport type RequestExecutionPermissionsRequestParams = Infer<\n typeof RequestExecutionPermissionsStruct\n>;\n\nexport type RequestExecutionPermissionsResult = Json &\n (Infer<typeof PermissionRequestStruct> & {\n context: Hex;\n })[];\n\nexport type ProcessRequestExecutionPermissionsHook = (\n request: RequestExecutionPermissionsRequestParams,\n req: JsonRpcRequest,\n context: WalletMiddlewareContext,\n) => Promise<RequestExecutionPermissionsResult>;\n\n/**\n * Creates a handler for the `wallet_requestExecutionPermissions` JSON-RPC method.\n *\n * @param options - The options for the handler.\n * @param options.processRequestExecutionPermissions - The function to process the\n * request execution permissions request.\n * @returns A JSON-RPC middleware function that handles the\n * `wallet_requestExecutionPermissions` JSON-RPC method.\n */\nexport function createWalletRequestExecutionPermissionsHandler({\n processRequestExecutionPermissions,\n}: {\n processRequestExecutionPermissions?: ProcessRequestExecutionPermissionsHook;\n}): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext> {\n return async ({ request, context }) => {\n if (!processRequestExecutionPermissions) {\n throw rpcErrors.methodNotSupported(\n 'wallet_requestExecutionPermissions - no middleware configured',\n );\n }\n\n const { params } = request;\n\n validateParams(params, RequestExecutionPermissionsStruct);\n\n return await processRequestExecutionPermissions(params, request, context);\n };\n}\n"]}
|
|
@@ -4,21 +4,39 @@ import type { Hex, Json, JsonRpcRequest } from "@metamask/utils";
|
|
|
4
4
|
import type { WalletMiddlewareContext } from "../wallet.cjs";
|
|
5
5
|
declare const PermissionRequestStruct: import("@metamask/superstruct").Struct<{
|
|
6
6
|
chainId: `0x${string}`;
|
|
7
|
-
|
|
7
|
+
signer: {
|
|
8
|
+
data: {
|
|
9
|
+
address: `0x${string}`;
|
|
10
|
+
};
|
|
11
|
+
type: "account";
|
|
12
|
+
};
|
|
8
13
|
permission: {
|
|
9
14
|
data: Record<string, unknown>;
|
|
10
15
|
type: string;
|
|
11
16
|
isAdjustmentAllowed: boolean;
|
|
12
17
|
};
|
|
13
|
-
|
|
18
|
+
address?: `0x${string}` | undefined;
|
|
14
19
|
rules?: {
|
|
15
20
|
data: Record<string, unknown>;
|
|
16
21
|
type: string;
|
|
22
|
+
isAdjustmentAllowed: boolean;
|
|
17
23
|
}[] | null | undefined;
|
|
18
24
|
}, {
|
|
19
25
|
chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
address: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
|
|
27
|
+
signer: import("@metamask/superstruct").Struct<{
|
|
28
|
+
data: {
|
|
29
|
+
address: `0x${string}`;
|
|
30
|
+
};
|
|
31
|
+
type: "account";
|
|
32
|
+
}, {
|
|
33
|
+
type: import("@metamask/superstruct").Struct<"account", "account">;
|
|
34
|
+
data: import("@metamask/superstruct").Struct<{
|
|
35
|
+
address: `0x${string}`;
|
|
36
|
+
}, {
|
|
37
|
+
address: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
38
|
+
}>;
|
|
39
|
+
}>;
|
|
22
40
|
permission: import("@metamask/superstruct").Struct<{
|
|
23
41
|
data: Record<string, unknown>;
|
|
24
42
|
type: string;
|
|
@@ -31,38 +49,63 @@ declare const PermissionRequestStruct: import("@metamask/superstruct").Struct<{
|
|
|
31
49
|
rules: import("@metamask/superstruct").Struct<{
|
|
32
50
|
data: Record<string, unknown>;
|
|
33
51
|
type: string;
|
|
52
|
+
isAdjustmentAllowed: boolean;
|
|
34
53
|
}[] | null | undefined, null>;
|
|
35
54
|
}>;
|
|
36
55
|
export declare const RequestExecutionPermissionsStruct: import("@metamask/superstruct").Struct<{
|
|
37
56
|
chainId: `0x${string}`;
|
|
38
|
-
|
|
57
|
+
signer: {
|
|
58
|
+
data: {
|
|
59
|
+
address: `0x${string}`;
|
|
60
|
+
};
|
|
61
|
+
type: "account";
|
|
62
|
+
};
|
|
39
63
|
permission: {
|
|
40
64
|
data: Record<string, unknown>;
|
|
41
65
|
type: string;
|
|
42
66
|
isAdjustmentAllowed: boolean;
|
|
43
67
|
};
|
|
44
|
-
|
|
68
|
+
address?: `0x${string}` | undefined;
|
|
45
69
|
rules?: {
|
|
46
70
|
data: Record<string, unknown>;
|
|
47
71
|
type: string;
|
|
72
|
+
isAdjustmentAllowed: boolean;
|
|
48
73
|
}[] | null | undefined;
|
|
49
74
|
}[], import("@metamask/superstruct").Struct<{
|
|
50
75
|
chainId: `0x${string}`;
|
|
51
|
-
|
|
76
|
+
signer: {
|
|
77
|
+
data: {
|
|
78
|
+
address: `0x${string}`;
|
|
79
|
+
};
|
|
80
|
+
type: "account";
|
|
81
|
+
};
|
|
52
82
|
permission: {
|
|
53
83
|
data: Record<string, unknown>;
|
|
54
84
|
type: string;
|
|
55
85
|
isAdjustmentAllowed: boolean;
|
|
56
86
|
};
|
|
57
|
-
|
|
87
|
+
address?: `0x${string}` | undefined;
|
|
58
88
|
rules?: {
|
|
59
89
|
data: Record<string, unknown>;
|
|
60
90
|
type: string;
|
|
91
|
+
isAdjustmentAllowed: boolean;
|
|
61
92
|
}[] | null | undefined;
|
|
62
93
|
}, {
|
|
63
94
|
chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
64
|
-
|
|
65
|
-
|
|
95
|
+
address: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
|
|
96
|
+
signer: import("@metamask/superstruct").Struct<{
|
|
97
|
+
data: {
|
|
98
|
+
address: `0x${string}`;
|
|
99
|
+
};
|
|
100
|
+
type: "account";
|
|
101
|
+
}, {
|
|
102
|
+
type: import("@metamask/superstruct").Struct<"account", "account">;
|
|
103
|
+
data: import("@metamask/superstruct").Struct<{
|
|
104
|
+
address: `0x${string}`;
|
|
105
|
+
}, {
|
|
106
|
+
address: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
107
|
+
}>;
|
|
108
|
+
}>;
|
|
66
109
|
permission: import("@metamask/superstruct").Struct<{
|
|
67
110
|
data: Record<string, unknown>;
|
|
68
111
|
type: string;
|
|
@@ -75,17 +118,12 @@ export declare const RequestExecutionPermissionsStruct: import("@metamask/supers
|
|
|
75
118
|
rules: import("@metamask/superstruct").Struct<{
|
|
76
119
|
data: Record<string, unknown>;
|
|
77
120
|
type: string;
|
|
121
|
+
isAdjustmentAllowed: boolean;
|
|
78
122
|
}[] | null | undefined, null>;
|
|
79
123
|
}>>;
|
|
80
124
|
export type RequestExecutionPermissionsRequestParams = Infer<typeof RequestExecutionPermissionsStruct>;
|
|
81
|
-
export type PermissionDependency = {
|
|
82
|
-
factory: Hex;
|
|
83
|
-
factoryData: Hex;
|
|
84
|
-
};
|
|
85
125
|
export type RequestExecutionPermissionsResult = Json & (Infer<typeof PermissionRequestStruct> & {
|
|
86
126
|
context: Hex;
|
|
87
|
-
dependencies: PermissionDependency[];
|
|
88
|
-
delegationManager: Hex;
|
|
89
127
|
})[];
|
|
90
128
|
export type ProcessRequestExecutionPermissionsHook = (request: RequestExecutionPermissionsRequestParams, req: JsonRpcRequest, context: WalletMiddlewareContext) => Promise<RequestExecutionPermissionsResult>;
|
|
91
129
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-request-execution-permissions.d.cts","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAGjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;
|
|
1
|
+
{"version":3,"file":"wallet-request-execution-permissions.d.cts","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAGjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;AAqBzD,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiC,CAAC;AAGhF,MAAM,MAAM,wCAAwC,GAAG,KAAK,CAC1D,OAAO,iCAAiC,CACzC,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,IAAI,GAClD,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;IACvC,OAAO,EAAE,GAAG,CAAC;CACd,CAAC,EAAE,CAAC;AAEP,MAAM,MAAM,sCAAsC,GAAG,CACnD,OAAO,EAAE,wCAAwC,EACjD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,iCAAiC,CAAC,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,8CAA8C,CAAC,EAC7D,kCAAkC,GACnC,EAAE;IACD,kCAAkC,CAAC,EAAE,sCAAsC,CAAC;CAC7E,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAcnE"}
|
|
@@ -4,21 +4,39 @@ import type { Hex, Json, JsonRpcRequest } from "@metamask/utils";
|
|
|
4
4
|
import type { WalletMiddlewareContext } from "../wallet.mjs";
|
|
5
5
|
declare const PermissionRequestStruct: import("@metamask/superstruct").Struct<{
|
|
6
6
|
chainId: `0x${string}`;
|
|
7
|
-
|
|
7
|
+
signer: {
|
|
8
|
+
data: {
|
|
9
|
+
address: `0x${string}`;
|
|
10
|
+
};
|
|
11
|
+
type: "account";
|
|
12
|
+
};
|
|
8
13
|
permission: {
|
|
9
14
|
data: Record<string, unknown>;
|
|
10
15
|
type: string;
|
|
11
16
|
isAdjustmentAllowed: boolean;
|
|
12
17
|
};
|
|
13
|
-
|
|
18
|
+
address?: `0x${string}` | undefined;
|
|
14
19
|
rules?: {
|
|
15
20
|
data: Record<string, unknown>;
|
|
16
21
|
type: string;
|
|
22
|
+
isAdjustmentAllowed: boolean;
|
|
17
23
|
}[] | null | undefined;
|
|
18
24
|
}, {
|
|
19
25
|
chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
address: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
|
|
27
|
+
signer: import("@metamask/superstruct").Struct<{
|
|
28
|
+
data: {
|
|
29
|
+
address: `0x${string}`;
|
|
30
|
+
};
|
|
31
|
+
type: "account";
|
|
32
|
+
}, {
|
|
33
|
+
type: import("@metamask/superstruct").Struct<"account", "account">;
|
|
34
|
+
data: import("@metamask/superstruct").Struct<{
|
|
35
|
+
address: `0x${string}`;
|
|
36
|
+
}, {
|
|
37
|
+
address: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
38
|
+
}>;
|
|
39
|
+
}>;
|
|
22
40
|
permission: import("@metamask/superstruct").Struct<{
|
|
23
41
|
data: Record<string, unknown>;
|
|
24
42
|
type: string;
|
|
@@ -31,38 +49,63 @@ declare const PermissionRequestStruct: import("@metamask/superstruct").Struct<{
|
|
|
31
49
|
rules: import("@metamask/superstruct").Struct<{
|
|
32
50
|
data: Record<string, unknown>;
|
|
33
51
|
type: string;
|
|
52
|
+
isAdjustmentAllowed: boolean;
|
|
34
53
|
}[] | null | undefined, null>;
|
|
35
54
|
}>;
|
|
36
55
|
export declare const RequestExecutionPermissionsStruct: import("@metamask/superstruct").Struct<{
|
|
37
56
|
chainId: `0x${string}`;
|
|
38
|
-
|
|
57
|
+
signer: {
|
|
58
|
+
data: {
|
|
59
|
+
address: `0x${string}`;
|
|
60
|
+
};
|
|
61
|
+
type: "account";
|
|
62
|
+
};
|
|
39
63
|
permission: {
|
|
40
64
|
data: Record<string, unknown>;
|
|
41
65
|
type: string;
|
|
42
66
|
isAdjustmentAllowed: boolean;
|
|
43
67
|
};
|
|
44
|
-
|
|
68
|
+
address?: `0x${string}` | undefined;
|
|
45
69
|
rules?: {
|
|
46
70
|
data: Record<string, unknown>;
|
|
47
71
|
type: string;
|
|
72
|
+
isAdjustmentAllowed: boolean;
|
|
48
73
|
}[] | null | undefined;
|
|
49
74
|
}[], import("@metamask/superstruct").Struct<{
|
|
50
75
|
chainId: `0x${string}`;
|
|
51
|
-
|
|
76
|
+
signer: {
|
|
77
|
+
data: {
|
|
78
|
+
address: `0x${string}`;
|
|
79
|
+
};
|
|
80
|
+
type: "account";
|
|
81
|
+
};
|
|
52
82
|
permission: {
|
|
53
83
|
data: Record<string, unknown>;
|
|
54
84
|
type: string;
|
|
55
85
|
isAdjustmentAllowed: boolean;
|
|
56
86
|
};
|
|
57
|
-
|
|
87
|
+
address?: `0x${string}` | undefined;
|
|
58
88
|
rules?: {
|
|
59
89
|
data: Record<string, unknown>;
|
|
60
90
|
type: string;
|
|
91
|
+
isAdjustmentAllowed: boolean;
|
|
61
92
|
}[] | null | undefined;
|
|
62
93
|
}, {
|
|
63
94
|
chainId: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
64
|
-
|
|
65
|
-
|
|
95
|
+
address: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
|
|
96
|
+
signer: import("@metamask/superstruct").Struct<{
|
|
97
|
+
data: {
|
|
98
|
+
address: `0x${string}`;
|
|
99
|
+
};
|
|
100
|
+
type: "account";
|
|
101
|
+
}, {
|
|
102
|
+
type: import("@metamask/superstruct").Struct<"account", "account">;
|
|
103
|
+
data: import("@metamask/superstruct").Struct<{
|
|
104
|
+
address: `0x${string}`;
|
|
105
|
+
}, {
|
|
106
|
+
address: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
107
|
+
}>;
|
|
108
|
+
}>;
|
|
66
109
|
permission: import("@metamask/superstruct").Struct<{
|
|
67
110
|
data: Record<string, unknown>;
|
|
68
111
|
type: string;
|
|
@@ -75,17 +118,12 @@ export declare const RequestExecutionPermissionsStruct: import("@metamask/supers
|
|
|
75
118
|
rules: import("@metamask/superstruct").Struct<{
|
|
76
119
|
data: Record<string, unknown>;
|
|
77
120
|
type: string;
|
|
121
|
+
isAdjustmentAllowed: boolean;
|
|
78
122
|
}[] | null | undefined, null>;
|
|
79
123
|
}>>;
|
|
80
124
|
export type RequestExecutionPermissionsRequestParams = Infer<typeof RequestExecutionPermissionsStruct>;
|
|
81
|
-
export type PermissionDependency = {
|
|
82
|
-
factory: Hex;
|
|
83
|
-
factoryData: Hex;
|
|
84
|
-
};
|
|
85
125
|
export type RequestExecutionPermissionsResult = Json & (Infer<typeof PermissionRequestStruct> & {
|
|
86
126
|
context: Hex;
|
|
87
|
-
dependencies: PermissionDependency[];
|
|
88
|
-
delegationManager: Hex;
|
|
89
127
|
})[];
|
|
90
128
|
export type ProcessRequestExecutionPermissionsHook = (request: RequestExecutionPermissionsRequestParams, req: JsonRpcRequest, context: WalletMiddlewareContext) => Promise<RequestExecutionPermissionsResult>;
|
|
91
129
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-request-execution-permissions.d.mts","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAGjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;
|
|
1
|
+
{"version":3,"file":"wallet-request-execution-permissions.d.mts","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAqC;AAEtE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,wBAAwB;AAGjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAkB;AAqBzD,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiC,CAAC;AAGhF,MAAM,MAAM,wCAAwC,GAAG,KAAK,CAC1D,OAAO,iCAAiC,CACzC,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,IAAI,GAClD,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;IACvC,OAAO,EAAE,GAAG,CAAC;CACd,CAAC,EAAE,CAAC;AAEP,MAAM,MAAM,sCAAsC,GAAG,CACnD,OAAO,EAAE,wCAAwC,EACjD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,iCAAiC,CAAC,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,8CAA8C,CAAC,EAC7D,kCAAkC,GACnC,EAAE;IACD,kCAAkC,CAAC,EAAE,sCAAsC,CAAC;CAC7E,GAAG,iBAAiB,CAAC,cAAc,EAAE,IAAI,EAAE,uBAAuB,CAAC,CAcnE"}
|
|
@@ -9,12 +9,19 @@ const PermissionStruct = object({
|
|
|
9
9
|
});
|
|
10
10
|
const RuleStruct = object({
|
|
11
11
|
type: string(),
|
|
12
|
+
isAdjustmentAllowed: boolean(),
|
|
12
13
|
data: record(string(), unknown()),
|
|
13
14
|
});
|
|
15
|
+
const AccountSignerStruct = object({
|
|
16
|
+
type: literal('account'),
|
|
17
|
+
data: object({
|
|
18
|
+
address: HexChecksumAddressStruct,
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
14
21
|
const PermissionRequestStruct = object({
|
|
15
22
|
chainId: StrictHexStruct,
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
address: optional(HexChecksumAddressStruct),
|
|
24
|
+
signer: AccountSignerStruct,
|
|
18
25
|
permission: PermissionStruct,
|
|
19
26
|
rules: optional(union([array(RuleStruct), literal(null)])),
|
|
20
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-request-execution-permissions.mjs","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AAEjD,OAAO,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACR,8BAA8B;AAC/B,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,wBAAwB;AAG5E,OAAO,EAAE,cAAc,EAAE,gCAA4B;AAGrD,MAAM,gBAAgB,GAAG,MAAM,CAAC;IAC9B,IAAI,EAAE,MAAM,EAAE;IACd,mBAAmB,EAAE,OAAO,EAAE;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,EAAE;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,MAAM,CAAC;IACrC,OAAO,EAAE,eAAe;IACxB,
|
|
1
|
+
{"version":3,"file":"wallet-request-execution-permissions.mjs","sourceRoot":"","sources":["../../src/methods/wallet-request-execution-permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AAEjD,OAAO,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACR,8BAA8B;AAC/B,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,wBAAwB;AAG5E,OAAO,EAAE,cAAc,EAAE,gCAA4B;AAGrD,MAAM,gBAAgB,GAAG,MAAM,CAAC;IAC9B,IAAI,EAAE,MAAM,EAAE;IACd,mBAAmB,EAAE,OAAO,EAAE;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,EAAE;IACd,mBAAmB,EAAE,OAAO,EAAE;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,MAAM,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,wBAAwB;KAClC,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,MAAM,CAAC;IACrC,OAAO,EAAE,eAAe;IACxB,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC;IAC3C,MAAM,EAAE,mBAAmB;IAC3B,UAAU,EAAE,gBAAgB;IAC5B,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAkBhF;;;;;;;;GAQG;AACH,MAAM,UAAU,8CAA8C,CAAC,EAC7D,kCAAkC,GAGnC;IACC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC,kCAAkC,EAAE,CAAC;YACxC,MAAM,SAAS,CAAC,kBAAkB,CAChC,+DAA+D,CAChE,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE3B,cAAc,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAAC;QAE1D,OAAO,MAAM,kCAAkC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { JsonRpcMiddleware } from '@metamask/json-rpc-engine/v2';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n literal,\n object,\n optional,\n record,\n string,\n union,\n unknown,\n} from '@metamask/superstruct';\nimport { HexChecksumAddressStruct, StrictHexStruct } from '@metamask/utils';\nimport type { Hex, Json, JsonRpcRequest } from '@metamask/utils';\n\nimport { validateParams } from '../utils/validation';\nimport type { WalletMiddlewareContext } from '../wallet';\n\nconst PermissionStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\nconst RuleStruct = object({\n type: string(),\n isAdjustmentAllowed: boolean(),\n data: record(string(), unknown()),\n});\n\nconst AccountSignerStruct = object({\n type: literal('account'),\n data: object({\n address: HexChecksumAddressStruct,\n }),\n});\n\nconst PermissionRequestStruct = object({\n chainId: StrictHexStruct,\n address: optional(HexChecksumAddressStruct),\n signer: AccountSignerStruct,\n permission: PermissionStruct,\n rules: optional(union([array(RuleStruct), literal(null)])),\n});\n\nexport const RequestExecutionPermissionsStruct = array(PermissionRequestStruct);\n\n// RequestExecutionPermissions API types\nexport type RequestExecutionPermissionsRequestParams = Infer<\n typeof RequestExecutionPermissionsStruct\n>;\n\nexport type RequestExecutionPermissionsResult = Json &\n (Infer<typeof PermissionRequestStruct> & {\n context: Hex;\n })[];\n\nexport type ProcessRequestExecutionPermissionsHook = (\n request: RequestExecutionPermissionsRequestParams,\n req: JsonRpcRequest,\n context: WalletMiddlewareContext,\n) => Promise<RequestExecutionPermissionsResult>;\n\n/**\n * Creates a handler for the `wallet_requestExecutionPermissions` JSON-RPC method.\n *\n * @param options - The options for the handler.\n * @param options.processRequestExecutionPermissions - The function to process the\n * request execution permissions request.\n * @returns A JSON-RPC middleware function that handles the\n * `wallet_requestExecutionPermissions` JSON-RPC method.\n */\nexport function createWalletRequestExecutionPermissionsHandler({\n processRequestExecutionPermissions,\n}: {\n processRequestExecutionPermissions?: ProcessRequestExecutionPermissionsHook;\n}): JsonRpcMiddleware<JsonRpcRequest, Json, WalletMiddlewareContext> {\n return async ({ request, context }) => {\n if (!processRequestExecutionPermissions) {\n throw rpcErrors.methodNotSupported(\n 'wallet_requestExecutionPermissions - no middleware configured',\n );\n }\n\n const { params } = request;\n\n validateParams(params, RequestExecutionPermissionsStruct);\n\n return await processRequestExecutionPermissions(params, request, context);\n };\n}\n"]}
|
package/dist/wallet.cjs
CHANGED
|
@@ -28,8 +28,6 @@ const sigUtil = __importStar(require("@metamask/eth-sig-util"));
|
|
|
28
28
|
const v2_1 = require("@metamask/json-rpc-engine/v2");
|
|
29
29
|
const rpc_errors_1 = require("@metamask/rpc-errors");
|
|
30
30
|
const utils_1 = require("@metamask/utils");
|
|
31
|
-
const wallet_get_granted_execution_permissions_1 = require("./methods/wallet-get-granted-execution-permissions.cjs");
|
|
32
|
-
const wallet_get_supported_execution_permissions_1 = require("./methods/wallet-get-supported-execution-permissions.cjs");
|
|
33
31
|
const wallet_request_execution_permissions_1 = require("./methods/wallet-request-execution-permissions.cjs");
|
|
34
32
|
const wallet_revoke_execution_permission_1 = require("./methods/wallet-revoke-execution-permission.cjs");
|
|
35
33
|
const common_1 = require("./utils/common.cjs");
|
|
@@ -52,11 +50,9 @@ const validation_1 = require("./utils/validation.cjs");
|
|
|
52
50
|
* @param options.processTypedMessageV4 - The function to process the typed message v4 request.
|
|
53
51
|
* @param options.processRequestExecutionPermissions - The function to process the request execution permissions request.
|
|
54
52
|
* @param options.processRevokeExecutionPermission - The function to process the revoke execution permission request.
|
|
55
|
-
* @param options.processGetGrantedExecutionPermissions - The function to process the get granted execution permissions request.
|
|
56
|
-
* @param options.processGetSupportedExecutionPermissions - The function to process the get supported execution permissions request.
|
|
57
53
|
* @returns A JSON-RPC middleware that handles wallet-related JSON-RPC methods.
|
|
58
54
|
*/
|
|
59
|
-
function createWalletMiddleware({ getAccounts, processDecryptMessage, processEncryptionPublicKey, processPersonalMessage, processTransaction, processSignTransaction, processTypedMessage, processTypedMessageV3, processTypedMessageV4, processRequestExecutionPermissions, processRevokeExecutionPermission,
|
|
55
|
+
function createWalletMiddleware({ getAccounts, processDecryptMessage, processEncryptionPublicKey, processPersonalMessage, processTransaction, processSignTransaction, processTypedMessage, processTypedMessageV3, processTypedMessageV4, processRequestExecutionPermissions, processRevokeExecutionPermission, }) {
|
|
60
56
|
if (!getAccounts) {
|
|
61
57
|
throw new Error('opts.getAccounts is required');
|
|
62
58
|
}
|
|
@@ -82,12 +78,6 @@ function createWalletMiddleware({ getAccounts, processDecryptMessage, processEnc
|
|
|
82
78
|
wallet_revokeExecutionPermission: (0, wallet_revoke_execution_permission_1.createWalletRevokeExecutionPermissionHandler)({
|
|
83
79
|
processRevokeExecutionPermission,
|
|
84
80
|
}),
|
|
85
|
-
wallet_getGrantedExecutionPermissions: (0, wallet_get_granted_execution_permissions_1.createWalletGetGrantedExecutionPermissionsHandler)({
|
|
86
|
-
processGetGrantedExecutionPermissions,
|
|
87
|
-
}),
|
|
88
|
-
wallet_getSupportedExecutionPermissions: (0, wallet_get_supported_execution_permissions_1.createWalletGetSupportedExecutionPermissionsHandler)({
|
|
89
|
-
processGetSupportedExecutionPermissions,
|
|
90
|
-
}),
|
|
91
81
|
});
|
|
92
82
|
//
|
|
93
83
|
// account lookups
|