Skip to content

Commit 4c91044

Browse files
authored
Resolve yarn peer dependency warnings (#123)
* Resolve yarn peer dependency warnings * Fix linting (scripts and configuration, linting still fails) * Fix linting for all packages, other than smart-accounts-kit * Fix linting errors in smart-accounts-kit - Mark @typescript-eslint/explicit-function-return-type and @typescript-eslint/naming-convention as warning only * Minor fixes: - improve error handling in validate-contract-deployments scripts - fix comment
1 parent 1c4f8b4 commit 4c91044

55 files changed

Lines changed: 1440 additions & 1632 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.yarnrc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ plugins:
1717
spec: 'https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js'
1818

1919
npmMinimalAgeGate: 4320
20+
21+
packageExtensions:
22+
"eslint-plugin-n@*":
23+
peerDependencies:
24+
typescript: "*"

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,29 @@
3030
"@lavamoat/allow-scripts": "^3.4.0",
3131
"@lavamoat/preinstall-always-fail": "^2.1.1",
3232
"@metamask/create-release-branch": "^4.1.1",
33-
"@metamask/eslint-config": "^12.0.0",
34-
"@metamask/eslint-config-nodejs": "^12.0.0",
35-
"@metamask/eslint-config-typescript": "^12.0.0",
33+
"@metamask/eslint-config": "14.1.0",
34+
"@metamask/eslint-config-nodejs": "14.0.0",
35+
"@metamask/eslint-config-typescript": "14.0.0",
3636
"@types/keccak": "^3.0.4",
37-
"@typescript-eslint/eslint-plugin": "^5.42.1",
38-
"@typescript-eslint/parser": "^5.42.1",
3937
"@yarnpkg/types": "^4.0.1",
4038
"abitype": "^1.0.2",
4139
"buffer": "^6.0.3",
42-
"eslint": "^8.56.0",
43-
"eslint-config-prettier": "^8.5.0",
40+
"eslint": "^9.0.0",
41+
"eslint-config-prettier": "^9.1.0",
4442
"eslint-config-turbo": "^1.11.3",
4543
"eslint-import-resolver-typescript": "^3.6.1",
46-
"eslint-plugin-import": "^2.29.1",
47-
"eslint-plugin-jsdoc": "^41.1.2",
48-
"eslint-plugin-n": "^15.7.0",
49-
"eslint-plugin-prettier": "latest",
50-
"eslint-plugin-promise": "^6.1.1",
44+
"eslint-plugin-import-x": "^4.0.0",
45+
"eslint-plugin-jsdoc": "^50.2.4",
46+
"eslint-plugin-n": "^17.10.3",
47+
"eslint-plugin-prettier": "^5.2.6",
48+
"eslint-plugin-promise": "^7.1.0",
5149
"keccak": "^3.0.4",
5250
"lodash": "^4.17.21",
5351
"nodemon": "^3.1.0",
5452
"prettier": "^3.3.3",
5553
"turbo": "latest",
56-
"typescript": "5.0.4",
54+
"typescript": "5.5.4",
55+
"typescript-eslint": "^8.0.0",
5756
"viem": "2.31.4",
5857
"webauthn-p256": "^0.0.10"
5958
},
@@ -67,7 +66,8 @@
6766
"lavamoat": {
6867
"allowScripts": {
6968
"@lavamoat/preinstall-always-fail": false,
70-
"keccak": false
69+
"keccak": false,
70+
"eslint-plugin-import-x>unrs-resolver": false
7171
}
7272
}
7373
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line
2+
export { default } from '../../shared/config/base.eslint.mjs';

packages/7715-permission-types/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"scripts": {
4444
"build": "yarn typecheck && tsup",
4545
"typecheck": "tsc --noEmit",
46+
"lint": "eslint . --cache --ext js,ts",
4647
"changelog:update": "../../scripts/update-changelog.sh @metamask/7715-permission-types",
4748
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/7715-permission-types"
4849
},
@@ -53,7 +54,9 @@
5354
"devDependencies": {
5455
"@metamask/auto-changelog": "^5.0.2",
5556
"compare-versions": "^6.1.1",
57+
"eslint": "^9.39.2",
58+
"prettier": "^3.5.3",
5659
"tsup": "^8.5.0",
57-
"typescript": "5.0.4"
60+
"typescript": "5.5.4"
5861
}
5962
}

packages/7715-permission-types/src/types.ts

Lines changed: 79 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
////////////////////////////////////////////////////
1+
// //////////////////////////////////////////////////
22
// General Types
3-
////////////////////////////////////////////////////
3+
// //////////////////////////////////////////////////
44

55
/**
66
* A hex-encoded string.
@@ -12,17 +12,17 @@ export type Hex = `0x${string}`;
1212
*/
1313
export type KeyType = 'secp256r1' | 'secp256k1' | 'ed25519' | 'schnorr';
1414

15-
////////////////////////////////////////////////////
15+
// //////////////////////////////////////////////////
1616
// Signer Types
17-
////////////////////////////////////////////////////
17+
// //////////////////////////////////////////////////
1818

1919
/**
2020
* A wallet is the signer for these permissions
2121
* `data` is not necessary for this signer type as the wallet is both the signer and grantor of these permissions
2222
*/
2323
export type WalletSigner = {
2424
type: 'wallet';
25-
data: {};
25+
data: object;
2626
};
2727

2828
/**
@@ -63,16 +63,19 @@ export type AccountSigner = {
6363

6464
export type Signer = WalletSigner | KeySigner | MultiKeySigner | AccountSigner;
6565

66-
////////////////////////////////////////////////////
66+
// //////////////////////////////////////////////////
6767
// Permission Types
68-
////////////////////////////////////////////////////
68+
// //////////////////////////////////////////////////
6969

7070
/**
7171
* A base permission type that all permissions must extend.
7272
* `isAdjustmentAllowed` defines a boolean value that allows DApp to define whether the "permission" can be attenuated–adjusted to meet the user's terms.
73-
* @property type - is an enum defined by the ERCs
74-
* @property isAdjustmentAllowed - is a boolean that indicates whether the permission can be adjusted.
75-
* @property data - is a record of the data that is associated with the permission, and the structure is defined by the ERCs.
73+
*
74+
* type - is an enum defined by the ERCs
75+
*
76+
* isAdjustmentAllowed - is a boolean that indicates whether the permission can be adjusted.
77+
*
78+
* data - is a record of the data that is associated with the permission, and the structure is defined by the ERCs.
7679
*/
7780
export type BasePermission = {
7881
type: string;
@@ -83,34 +86,42 @@ export type BasePermission = {
8386
/**
8487
* A base rule type that all rules must extend.
8588
* `isAdjustmentAllowed` defines a boolean value that allows DApp to define whether the "rule" can be attenuated–adjusted to meet the user's terms.
86-
* @property type - is an enum defined by the ERCs
87-
* @property isAdjustmentAllowed - is a boolean that indicates whether the rule can be adjusted.
88-
* @property data - is a record of the data that is associated with the rule, and the structure is defined by the ERCs.
89+
*
90+
* type - is an enum defined by the ERCs
91+
*
92+
* isAdjustmentAllowed - is a boolean that indicates whether the rule can be adjusted.
93+
*
94+
* data - is a record of the data that is associated with the rule, and the structure is defined by the ERCs.
8995
*/
9096
export type Rule = {
9197
type: string;
9298
isAdjustmentAllowed: boolean;
9399
data: Record<string, any>;
94100
};
95101

96-
////////////////////////////////////////////////////
102+
// //////////////////////////////////////////////////
97103
// MetaMask Permission Types
98-
////////////////////////////////////////////////////
104+
// //////////////////////////////////////////////////
99105

100106
/**
101107
* Base data for all MetaMask permissions.
102-
* @property justification - is a human-readable explanation of why the permission is being requested.
108+
*
109+
* justification - is a human-readable explanation of why the permission is being requested.
103110
*/
104111
export type MetaMaskBasePermissionData = {
105112
justification?: string | null;
106113
};
107114

108115
/**
109116
* A permission to stream native tokens.
110-
* @property data.initialAmount - is the initial amount of the native token to be streamed. Defaults to 0.
111-
* @property data.maxAmount - is the maximum amount of the native token to be streamed. Defaults to Max Uint256.
112-
* @property data.amountPerSecond - is the amount of the native token to be streamed per second.
113-
* @property data.startTime - is the start time of the stream. Defaults to current time.
117+
*
118+
* data.initialAmount - is the initial amount of the native token to be streamed. Defaults to 0.
119+
*
120+
* data.maxAmount - is the maximum amount of the native token to be streamed. Defaults to Max Uint256.
121+
*
122+
* data.amountPerSecond - is the amount of the native token to be streamed per second.
123+
*
124+
* data.startTime - is the start time of the stream. Defaults to current time.
114125
*/
115126
export type NativeTokenStreamPermission = BasePermission & {
116127
type: 'native-token-stream';
@@ -124,9 +135,12 @@ export type NativeTokenStreamPermission = BasePermission & {
124135

125136
/**
126137
* A permission to stream native tokens periodically.
127-
* @property data.periodAmount - is the amount of the native token to be streamed per period.
128-
* @property data.periodDuration - is the duration of the period in seconds.
129-
* @property data.startTime - is the start time of the stream. Defaults to current time.
138+
*
139+
* data.periodAmount - is the amount of the native token to be streamed per period.
140+
*
141+
* data.periodDuration - is the duration of the period in seconds.
142+
*
143+
* data.startTime - is the start time of the stream. Defaults to current time.
130144
*/
131145
export type NativeTokenPeriodicPermission = BasePermission & {
132146
type: 'native-token-periodic';
@@ -139,11 +153,16 @@ export type NativeTokenPeriodicPermission = BasePermission & {
139153

140154
/**
141155
* A permission to stream ERC20 tokens.
142-
* @property data.initialAmount - is the initial amount of the ERC20 token to be streamed. Defaults to 0.
143-
* @property data.maxAmount - is the maximum amount of the ERC20 token to be streamed. Defaults to Max Uint256.
144-
* @property data.amountPerSecond - is the amount of the ERC20 token to be streamed per second.
145-
* @property data.startTime - is the start time of the stream. Defaults to current time.
146-
* @property data.tokenAddress - is the address of the ERC20 token to be streamed.
156+
*
157+
* data.initialAmount - is the initial amount of the ERC20 token to be streamed. Defaults to 0.
158+
*
159+
* data.maxAmount - is the maximum amount of the ERC20 token to be streamed. Defaults to Max Uint256.
160+
*
161+
* data.amountPerSecond - is the amount of the ERC20 token to be streamed per second.
162+
*
163+
* data.startTime - is the start time of the stream. Defaults to current time.
164+
*
165+
* data.tokenAddress - is the address of the ERC20 token to be streamed.
147166
*/
148167
export type Erc20TokenStreamPermission = BasePermission & {
149168
type: 'erc20-token-stream';
@@ -158,10 +177,14 @@ export type Erc20TokenStreamPermission = BasePermission & {
158177

159178
/**
160179
* A permission to stream ERC20 tokens periodically.
161-
* @property data.periodAmount - is the amount of the ERC20 token to be streamed per period.
162-
* @property data.periodDuration - is the duration of the period in seconds.
163-
* @property data.startTime - is the start time of the stream. Defaults to current time.
164-
* @property data.tokenAddress - is the address of the ERC20 token to be streamed per period.
180+
*
181+
* data.periodAmount - is the amount of the ERC20 token to be streamed per period.
182+
*
183+
* data.periodDuration - is the duration of the period in seconds.
184+
*
185+
* data.startTime - is the start time of the stream. Defaults to current time.
186+
*
187+
* data.tokenAddress - is the address of the ERC20 token to be streamed per period.
165188
*/
166189
export type Erc20TokenPeriodicPermission = BasePermission & {
167190
type: 'erc20-token-periodic';
@@ -183,9 +206,10 @@ export type Erc20TokenRevocationPermission = BasePermission & {
183206

184207
/**
185208
* A custom permission.
186-
* @property data - is a record of the data that is associated with the permission, and the structure is defined by the ERCs.
209+
*
210+
* data - is a record of the data that is associated with the permission, and the structure is defined by the ERCs.
187211
*/
188-
// TODO: Consider openning up permission types with Custom / Unknown permissions in subseqential versions.
212+
// TODO: Consider opening up permission types with Custom / Unknown permissions in subsequent versions.
189213
// export type CustomPermission = BasePermission & {
190214
// type: 'custom';
191215
// data: MetaMaskBasePermissionData & Record<string, unknown>;
@@ -201,17 +225,22 @@ export type PermissionTypes =
201225
| Erc20TokenPeriodicPermission
202226
| Erc20TokenRevocationPermission;
203227

204-
////////////////////////////////////////////////////
228+
// //////////////////////////////////////////////////
205229
// Permission Requests
206-
////////////////////////////////////////////////////
230+
// //////////////////////////////////////////////////
207231

208232
/**
209233
* Parameters for the `wallet_requestExecutionPermissions` JSON-RPC method.
210-
* @property chainId - chainId defines the chain with EIP-155 which applies to this permission request and all addresses can be found defined by other parameters.
211-
* @property address - address identifies the account being targetted for this permission request which is useful when a connection has been established and multiple accounts have been exposed. It is optional to let the user choose which account to grant permission for.
212-
* @property signer - signer is a field that identifies the key or account associated with the permission or alternatively the wallet will manage the session. See the "Signers" section for details.
213-
* @property permission - permission defines the allowed behavior the signer can do on behalf of the account. See the "Permission" section for details.
214-
* @property rules - rules defined the restrictions or conditions that a signer MUST abide by when using a permission to act on behalf of an account. See the "Rule" section for details.
234+
*
235+
* chainId - chainId defines the chain with EIP-155 which applies to this permission request and all addresses can be found defined by other parameters.
236+
*
237+
* address - address identifies the account being targetted for this permission request which is useful when a connection has been established and multiple accounts have been exposed. It is optional to let the user choose which account to grant permission for.
238+
*
239+
* signer - signer is a field that identifies the key or account associated with the permission or alternatively the wallet will manage the session. See the "Signers" section for details.
240+
*
241+
* permission - permission defines the allowed behavior the signer can do on behalf of the account. See the "Permission" section for details.
242+
*
243+
* rules - rules defined the restrictions or conditions that a signer MUST abide by when using a permission to act on behalf of an account. See the "Rule" section for details.
215244
*/
216245
export type PermissionRequest<
217246
TSigner extends Signer,
@@ -227,9 +256,12 @@ export type PermissionRequest<
227256
/**
228257
* Response from the `wallet_requestExecutionPermissions` JSON-RPC method.
229258
* First note that the response contains all of the parameters of the original request and it is not guaranteed that the values received are equivalent to those requested.
230-
* @property context - is a catch-all to identify a permission for revoking permissions or submitting userOps, and can contain non-identifying data as well. It MAY be the `context` as defined in ERC-7679 and ERC-7710.
231-
* @property dependencyInfo - is an array of objects, each containing fields for `factory` and `factoryData` as defined in ERC-4337. Either both `factory` and `factoryData` must be specified in an entry, or neither. This array is used describe accounts that are not yet deployed but MUST be deployed in order for a permission to be successfully redeemed.
232-
* @property signerMeta - is dependent on the account type. If the signer type is `wallet` then it's not required. If the signer type is `key` or `keys` then `userOpBuilder` is required as defined in ERC-7679. If the signer type is `account` then `delegationManager` is required as defined in ERC-7710.
259+
*
260+
* context - is a catch-all to identify a permission for revoking permissions or submitting userOps, and can contain non-identifying data as well. It MAY be the `context` as defined in ERC-7679 and ERC-7710.
261+
*
262+
* dependencyInfo - is an array of objects, each containing fields for `factory` and `factoryData` as defined in ERC-4337. Either both `factory` and `factoryData` must be specified in an entry, or neither. This array is used describe accounts that are not yet deployed but MUST be deployed in order for a permission to be successfully redeemed.
263+
*
264+
* signerMeta - is dependent on the account type. If the signer type is `wallet` then it's not required. If the signer type is `key` or `keys` then `userOpBuilder` is required as defined in ERC-7679. If the signer type is `account` then `delegationManager` is required as defined in ERC-7710.
233265
*/
234266
export type PermissionResponse<
235267
TSigner extends Signer,
@@ -250,7 +282,8 @@ export type PermissionResponse<
250282

251283
/**
252284
* Parameters for the `wallet_revokeExecutionPermission` JSON-RPC method.
253-
* @property permissionContext - the context identifier for the permission to be revoked
285+
*
286+
* permissionContext - the context identifier for the permission to be revoked
254287
*/
255288
export type RevokeExecutionPermissionRequestParams = {
256289
permissionContext: Hex;
@@ -260,4 +293,4 @@ export type RevokeExecutionPermissionRequestParams = {
260293
* Response from the `wallet_revokeExecutionPermission` JSON-RPC method.
261294
* The wallet will respond with an empty response when successful.
262295
*/
263-
export type RevokeExecutionPermissionResponseResult = {};
296+
export type RevokeExecutionPermissionResponseResult = Record<string, never>;

packages/delegation-abis/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
},
5656
"devDependencies": {
5757
"@metamask/auto-changelog": "^5.0.2",
58+
"prettier": "^3.5.3",
5859
"tsup": "^8.5.0",
59-
"typescript": "5.0.4"
60+
"typescript": "5.5.4"
6061
}
6162
}

packages/delegation-core/.eslintrc.cjs

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line
2+
export { default } from '../../shared/config/base.eslint.mjs';

packages/delegation-core/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@
6565
},
6666
"devDependencies": {
6767
"@metamask/auto-changelog": "^5.0.2",
68-
"@types/node": "^20.10.6",
68+
"@types/node": "^20.19.0",
69+
"eslint": "^9.39.2",
70+
"prettier": "^3.5.3",
6971
"tsup": "^8.5.0",
70-
"typescript": "5.0.4",
72+
"typescript": "5.5.4",
7173
"vitest": "^3.2.4"
7274
},
7375
"dependencies": {

packages/delegation-core/src/caveats/allowedCalldata.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export function createAllowedCalldataTerms(
3737
/**
3838
* Creates terms for an AllowedCalldata caveat that ensures the provided execution calldata
3939
* matches the expected calldata at the specified index.
40+
*
4041
* @param terms - The terms for the AllowedCalldata caveat.
4142
* @param encodingOptions - The encoding options for the result.
4243
* @returns The terms as the calldata itself.

0 commit comments

Comments
 (0)