@account-kit/plugingen 4.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/LICENSE +21 -0
  2. package/dist/esm/IPlugin.d.ts +474 -0
  3. package/dist/esm/IPlugin.js +397 -0
  4. package/dist/esm/IPlugin.js.map +1 -0
  5. package/dist/esm/cli.d.ts +2 -0
  6. package/dist/esm/cli.js +40 -0
  7. package/dist/esm/cli.js.map +1 -0
  8. package/dist/esm/commands/generate/index.d.ts +14 -0
  9. package/dist/esm/commands/generate/index.js +179 -0
  10. package/dist/esm/commands/generate/index.js.map +1 -0
  11. package/dist/esm/commands/generate/phases/contract-abi-gen.d.ts +2 -0
  12. package/dist/esm/commands/generate/phases/contract-abi-gen.js +9 -0
  13. package/dist/esm/commands/generate/phases/contract-abi-gen.js.map +1 -0
  14. package/dist/esm/commands/generate/phases/contract-addresses-gen.d.ts +2 -0
  15. package/dist/esm/commands/generate/phases/contract-addresses-gen.js +10 -0
  16. package/dist/esm/commands/generate/phases/contract-addresses-gen.js.map +1 -0
  17. package/dist/esm/commands/generate/phases/execution-abi-gen.d.ts +2 -0
  18. package/dist/esm/commands/generate/phases/execution-abi-gen.js +12 -0
  19. package/dist/esm/commands/generate/phases/execution-abi-gen.js.map +1 -0
  20. package/dist/esm/commands/generate/phases/plugin-actions/index.d.ts +2 -0
  21. package/dist/esm/commands/generate/phases/plugin-actions/index.js +118 -0
  22. package/dist/esm/commands/generate/phases/plugin-actions/index.js.map +1 -0
  23. package/dist/esm/commands/generate/phases/plugin-actions/management-actions.d.ts +2 -0
  24. package/dist/esm/commands/generate/phases/plugin-actions/management-actions.js +105 -0
  25. package/dist/esm/commands/generate/phases/plugin-actions/management-actions.js.map +1 -0
  26. package/dist/esm/commands/generate/phases/plugin-actions/read-actions.d.ts +2 -0
  27. package/dist/esm/commands/generate/phases/plugin-actions/read-actions.js +75 -0
  28. package/dist/esm/commands/generate/phases/plugin-actions/read-actions.js.map +1 -0
  29. package/dist/esm/commands/generate/phases/plugin-generator/get-contract-gen.d.ts +2 -0
  30. package/dist/esm/commands/generate/phases/plugin-generator/get-contract-gen.js +26 -0
  31. package/dist/esm/commands/generate/phases/plugin-generator/get-contract-gen.js.map +1 -0
  32. package/dist/esm/commands/generate/phases/plugin-generator/index.d.ts +2 -0
  33. package/dist/esm/commands/generate/phases/plugin-generator/index.js +20 -0
  34. package/dist/esm/commands/generate/phases/plugin-generator/index.js.map +1 -0
  35. package/dist/esm/commands/generate/phases/plugin-generator/meta-gen.d.ts +2 -0
  36. package/dist/esm/commands/generate/phases/plugin-generator/meta-gen.js +14 -0
  37. package/dist/esm/commands/generate/phases/plugin-generator/meta-gen.js.map +1 -0
  38. package/dist/esm/commands/generate/types.d.ts +16 -0
  39. package/dist/esm/commands/generate/types.js +2 -0
  40. package/dist/esm/commands/generate/types.js.map +1 -0
  41. package/dist/esm/commands/generate/utils.d.ts +4 -0
  42. package/dist/esm/commands/generate/utils.js +16 -0
  43. package/dist/esm/commands/generate/utils.js.map +1 -0
  44. package/dist/esm/commands/init.d.ts +5 -0
  45. package/dist/esm/commands/init.js +76 -0
  46. package/dist/esm/commands/init.js.map +1 -0
  47. package/dist/esm/config.d.ts +36 -0
  48. package/dist/esm/config.js +4 -0
  49. package/dist/esm/config.js.map +1 -0
  50. package/dist/esm/errors.d.ts +14 -0
  51. package/dist/esm/errors.js +37 -0
  52. package/dist/esm/errors.js.map +1 -0
  53. package/dist/esm/exports/config.d.ts +1 -0
  54. package/dist/esm/exports/config.js +2 -0
  55. package/dist/esm/exports/config.js.map +1 -0
  56. package/dist/esm/exports/index.d.ts +4 -0
  57. package/dist/esm/exports/index.js +5 -0
  58. package/dist/esm/exports/index.js.map +1 -0
  59. package/dist/esm/exports/types.d.ts +1 -0
  60. package/dist/esm/exports/types.js +2 -0
  61. package/dist/esm/exports/types.js.map +1 -0
  62. package/dist/esm/logger.d.ts +6 -0
  63. package/dist/esm/logger.js +30 -0
  64. package/dist/esm/logger.js.map +1 -0
  65. package/dist/esm/package.json +1 -0
  66. package/dist/esm/types.d.ts +6 -0
  67. package/dist/esm/types.js +2 -0
  68. package/dist/esm/types.js.map +1 -0
  69. package/dist/esm/utils/findConfig.d.ts +6 -0
  70. package/dist/esm/utils/findConfig.js +21 -0
  71. package/dist/esm/utils/findConfig.js.map +1 -0
  72. package/dist/esm/utils/format.d.ts +1 -0
  73. package/dist/esm/utils/format.js +10 -0
  74. package/dist/esm/utils/format.js.map +1 -0
  75. package/dist/esm/utils/isUsingTypescript.d.ts +1 -0
  76. package/dist/esm/utils/isUsingTypescript.js +19 -0
  77. package/dist/esm/utils/isUsingTypescript.js.map +1 -0
  78. package/dist/esm/utils/loadEnv.d.ts +4 -0
  79. package/dist/esm/utils/loadEnv.js +59 -0
  80. package/dist/esm/utils/loadEnv.js.map +1 -0
  81. package/dist/esm/utils/resolveConfig.d.ts +7 -0
  82. package/dist/esm/utils/resolveConfig.js +12 -0
  83. package/dist/esm/utils/resolveConfig.js.map +1 -0
  84. package/dist/esm/version.d.ts +1 -0
  85. package/dist/esm/version.js +2 -0
  86. package/dist/esm/version.js.map +1 -0
  87. package/dist/types/IPlugin.d.ts +475 -0
  88. package/dist/types/IPlugin.d.ts.map +1 -0
  89. package/dist/types/cli.d.ts +3 -0
  90. package/dist/types/cli.d.ts.map +1 -0
  91. package/dist/types/commands/generate/index.d.ts +17 -0
  92. package/dist/types/commands/generate/index.d.ts.map +1 -0
  93. package/dist/types/commands/generate/phases/contract-abi-gen.d.ts +3 -0
  94. package/dist/types/commands/generate/phases/contract-abi-gen.d.ts.map +1 -0
  95. package/dist/types/commands/generate/phases/contract-addresses-gen.d.ts +3 -0
  96. package/dist/types/commands/generate/phases/contract-addresses-gen.d.ts.map +1 -0
  97. package/dist/types/commands/generate/phases/execution-abi-gen.d.ts +3 -0
  98. package/dist/types/commands/generate/phases/execution-abi-gen.d.ts.map +1 -0
  99. package/dist/types/commands/generate/phases/plugin-actions/index.d.ts +3 -0
  100. package/dist/types/commands/generate/phases/plugin-actions/index.d.ts.map +1 -0
  101. package/dist/types/commands/generate/phases/plugin-actions/management-actions.d.ts +3 -0
  102. package/dist/types/commands/generate/phases/plugin-actions/management-actions.d.ts.map +1 -0
  103. package/dist/types/commands/generate/phases/plugin-actions/read-actions.d.ts +3 -0
  104. package/dist/types/commands/generate/phases/plugin-actions/read-actions.d.ts.map +1 -0
  105. package/dist/types/commands/generate/phases/plugin-generator/get-contract-gen.d.ts +3 -0
  106. package/dist/types/commands/generate/phases/plugin-generator/get-contract-gen.d.ts.map +1 -0
  107. package/dist/types/commands/generate/phases/plugin-generator/index.d.ts +3 -0
  108. package/dist/types/commands/generate/phases/plugin-generator/index.d.ts.map +1 -0
  109. package/dist/types/commands/generate/phases/plugin-generator/meta-gen.d.ts +3 -0
  110. package/dist/types/commands/generate/phases/plugin-generator/meta-gen.d.ts.map +1 -0
  111. package/dist/types/commands/generate/types.d.ts +17 -0
  112. package/dist/types/commands/generate/types.d.ts.map +1 -0
  113. package/dist/types/commands/generate/utils.d.ts +5 -0
  114. package/dist/types/commands/generate/utils.d.ts.map +1 -0
  115. package/dist/types/commands/init.d.ts +8 -0
  116. package/dist/types/commands/init.d.ts.map +1 -0
  117. package/dist/types/config.d.ts +59 -0
  118. package/dist/types/config.d.ts.map +1 -0
  119. package/dist/types/errors.d.ts +15 -0
  120. package/dist/types/errors.d.ts.map +1 -0
  121. package/dist/types/exports/config.d.ts +2 -0
  122. package/dist/types/exports/config.d.ts.map +1 -0
  123. package/dist/types/exports/index.d.ts +5 -0
  124. package/dist/types/exports/index.d.ts.map +1 -0
  125. package/dist/types/exports/types.d.ts +2 -0
  126. package/dist/types/exports/types.d.ts.map +1 -0
  127. package/dist/types/logger.d.ts +7 -0
  128. package/dist/types/logger.d.ts.map +1 -0
  129. package/dist/types/types.d.ts +7 -0
  130. package/dist/types/types.d.ts.map +1 -0
  131. package/dist/types/utils/findConfig.d.ts +15 -0
  132. package/dist/types/utils/findConfig.d.ts.map +1 -0
  133. package/dist/types/utils/format.d.ts +2 -0
  134. package/dist/types/utils/format.d.ts.map +1 -0
  135. package/dist/types/utils/isUsingTypescript.d.ts +2 -0
  136. package/dist/types/utils/isUsingTypescript.d.ts.map +1 -0
  137. package/dist/types/utils/loadEnv.d.ts +5 -0
  138. package/dist/types/utils/loadEnv.d.ts.map +1 -0
  139. package/dist/types/utils/resolveConfig.d.ts +15 -0
  140. package/dist/types/utils/resolveConfig.d.ts.map +1 -0
  141. package/dist/types/version.d.ts +2 -0
  142. package/dist/types/version.d.ts.map +1 -0
  143. package/package.json +83 -0
  144. package/src/IPlugin.ts +396 -0
  145. package/src/cli.ts +44 -0
  146. package/src/commands/generate/index.ts +270 -0
  147. package/src/commands/generate/phases/contract-abi-gen.ts +12 -0
  148. package/src/commands/generate/phases/contract-addresses-gen.ts +18 -0
  149. package/src/commands/generate/phases/execution-abi-gen.ts +20 -0
  150. package/src/commands/generate/phases/plugin-actions/index.ts +151 -0
  151. package/src/commands/generate/phases/plugin-actions/management-actions.ts +141 -0
  152. package/src/commands/generate/phases/plugin-actions/read-actions.ts +97 -0
  153. package/src/commands/generate/phases/plugin-generator/get-contract-gen.ts +30 -0
  154. package/src/commands/generate/phases/plugin-generator/index.ts +27 -0
  155. package/src/commands/generate/phases/plugin-generator/meta-gen.ts +17 -0
  156. package/src/commands/generate/types.ts +18 -0
  157. package/src/commands/generate/utils.ts +26 -0
  158. package/src/commands/init.ts +93 -0
  159. package/src/config.ts +79 -0
  160. package/src/errors.ts +58 -0
  161. package/src/exports/config.ts +1 -0
  162. package/src/exports/index.ts +7 -0
  163. package/src/exports/types.ts +1 -0
  164. package/src/logger.ts +36 -0
  165. package/src/types.ts +11 -0
  166. package/src/utils/findConfig.ts +37 -0
  167. package/src/utils/format.ts +11 -0
  168. package/src/utils/isUsingTypescript.ts +22 -0
  169. package/src/utils/loadEnv.ts +91 -0
  170. package/src/utils/resolveConfig.ts +25 -0
  171. package/src/version.ts +3 -0
package/src/IPlugin.ts ADDED
@@ -0,0 +1,396 @@
1
+ export const IPluginAbi = [
2
+ {
3
+ type: "function",
4
+ name: "onInstall",
5
+ inputs: [{ name: "data", type: "bytes", internalType: "bytes" }],
6
+ outputs: [],
7
+ stateMutability: "nonpayable",
8
+ },
9
+ {
10
+ type: "function",
11
+ name: "onUninstall",
12
+ inputs: [{ name: "data", type: "bytes", internalType: "bytes" }],
13
+ outputs: [],
14
+ stateMutability: "nonpayable",
15
+ },
16
+ {
17
+ type: "function",
18
+ name: "pluginManifest",
19
+ inputs: [],
20
+ outputs: [
21
+ {
22
+ name: "",
23
+ type: "tuple",
24
+ internalType: "struct PluginManifest",
25
+ components: [
26
+ { name: "interfaceIds", type: "bytes4[]", internalType: "bytes4[]" },
27
+ {
28
+ name: "dependencyInterfaceIds",
29
+ type: "bytes4[]",
30
+ internalType: "bytes4[]",
31
+ },
32
+ {
33
+ name: "executionFunctions",
34
+ type: "bytes4[]",
35
+ internalType: "bytes4[]",
36
+ },
37
+ {
38
+ name: "permittedExecutionSelectors",
39
+ type: "bytes4[]",
40
+ internalType: "bytes4[]",
41
+ },
42
+ {
43
+ name: "permitAnyExternalAddress",
44
+ type: "bool",
45
+ internalType: "bool",
46
+ },
47
+ { name: "canSpendNativeToken", type: "bool", internalType: "bool" },
48
+ {
49
+ name: "permittedExternalCalls",
50
+ type: "tuple[]",
51
+ internalType: "struct ManifestExternalCallPermission[]",
52
+ components: [
53
+ {
54
+ name: "externalAddress",
55
+ type: "address",
56
+ internalType: "address",
57
+ },
58
+ { name: "permitAnySelector", type: "bool", internalType: "bool" },
59
+ { name: "selectors", type: "bytes4[]", internalType: "bytes4[]" },
60
+ ],
61
+ },
62
+ {
63
+ name: "userOpValidationFunctions",
64
+ type: "tuple[]",
65
+ internalType: "struct ManifestAssociatedFunction[]",
66
+ components: [
67
+ {
68
+ name: "executionSelector",
69
+ type: "bytes4",
70
+ internalType: "bytes4",
71
+ },
72
+ {
73
+ name: "associatedFunction",
74
+ type: "tuple",
75
+ internalType: "struct ManifestFunction",
76
+ components: [
77
+ {
78
+ name: "functionType",
79
+ type: "uint8",
80
+ internalType: "enum ManifestAssociatedFunctionType",
81
+ },
82
+ { name: "functionId", type: "uint8", internalType: "uint8" },
83
+ {
84
+ name: "dependencyIndex",
85
+ type: "uint256",
86
+ internalType: "uint256",
87
+ },
88
+ ],
89
+ },
90
+ ],
91
+ },
92
+ {
93
+ name: "runtimeValidationFunctions",
94
+ type: "tuple[]",
95
+ internalType: "struct ManifestAssociatedFunction[]",
96
+ components: [
97
+ {
98
+ name: "executionSelector",
99
+ type: "bytes4",
100
+ internalType: "bytes4",
101
+ },
102
+ {
103
+ name: "associatedFunction",
104
+ type: "tuple",
105
+ internalType: "struct ManifestFunction",
106
+ components: [
107
+ {
108
+ name: "functionType",
109
+ type: "uint8",
110
+ internalType: "enum ManifestAssociatedFunctionType",
111
+ },
112
+ { name: "functionId", type: "uint8", internalType: "uint8" },
113
+ {
114
+ name: "dependencyIndex",
115
+ type: "uint256",
116
+ internalType: "uint256",
117
+ },
118
+ ],
119
+ },
120
+ ],
121
+ },
122
+ {
123
+ name: "preUserOpValidationHooks",
124
+ type: "tuple[]",
125
+ internalType: "struct ManifestAssociatedFunction[]",
126
+ components: [
127
+ {
128
+ name: "executionSelector",
129
+ type: "bytes4",
130
+ internalType: "bytes4",
131
+ },
132
+ {
133
+ name: "associatedFunction",
134
+ type: "tuple",
135
+ internalType: "struct ManifestFunction",
136
+ components: [
137
+ {
138
+ name: "functionType",
139
+ type: "uint8",
140
+ internalType: "enum ManifestAssociatedFunctionType",
141
+ },
142
+ { name: "functionId", type: "uint8", internalType: "uint8" },
143
+ {
144
+ name: "dependencyIndex",
145
+ type: "uint256",
146
+ internalType: "uint256",
147
+ },
148
+ ],
149
+ },
150
+ ],
151
+ },
152
+ {
153
+ name: "preRuntimeValidationHooks",
154
+ type: "tuple[]",
155
+ internalType: "struct ManifestAssociatedFunction[]",
156
+ components: [
157
+ {
158
+ name: "executionSelector",
159
+ type: "bytes4",
160
+ internalType: "bytes4",
161
+ },
162
+ {
163
+ name: "associatedFunction",
164
+ type: "tuple",
165
+ internalType: "struct ManifestFunction",
166
+ components: [
167
+ {
168
+ name: "functionType",
169
+ type: "uint8",
170
+ internalType: "enum ManifestAssociatedFunctionType",
171
+ },
172
+ { name: "functionId", type: "uint8", internalType: "uint8" },
173
+ {
174
+ name: "dependencyIndex",
175
+ type: "uint256",
176
+ internalType: "uint256",
177
+ },
178
+ ],
179
+ },
180
+ ],
181
+ },
182
+ {
183
+ name: "executionHooks",
184
+ type: "tuple[]",
185
+ internalType: "struct ManifestExecutionHook[]",
186
+ components: [
187
+ {
188
+ name: "executionSelector",
189
+ type: "bytes4",
190
+ internalType: "bytes4",
191
+ },
192
+ {
193
+ name: "preExecHook",
194
+ type: "tuple",
195
+ internalType: "struct ManifestFunction",
196
+ components: [
197
+ {
198
+ name: "functionType",
199
+ type: "uint8",
200
+ internalType: "enum ManifestAssociatedFunctionType",
201
+ },
202
+ { name: "functionId", type: "uint8", internalType: "uint8" },
203
+ {
204
+ name: "dependencyIndex",
205
+ type: "uint256",
206
+ internalType: "uint256",
207
+ },
208
+ ],
209
+ },
210
+ {
211
+ name: "postExecHook",
212
+ type: "tuple",
213
+ internalType: "struct ManifestFunction",
214
+ components: [
215
+ {
216
+ name: "functionType",
217
+ type: "uint8",
218
+ internalType: "enum ManifestAssociatedFunctionType",
219
+ },
220
+ { name: "functionId", type: "uint8", internalType: "uint8" },
221
+ {
222
+ name: "dependencyIndex",
223
+ type: "uint256",
224
+ internalType: "uint256",
225
+ },
226
+ ],
227
+ },
228
+ ],
229
+ },
230
+ ],
231
+ },
232
+ ],
233
+ stateMutability: "pure",
234
+ },
235
+ {
236
+ type: "function",
237
+ name: "pluginMetadata",
238
+ inputs: [],
239
+ outputs: [
240
+ {
241
+ name: "",
242
+ type: "tuple",
243
+ internalType: "struct PluginMetadata",
244
+ components: [
245
+ { name: "name", type: "string", internalType: "string" },
246
+ { name: "version", type: "string", internalType: "string" },
247
+ { name: "author", type: "string", internalType: "string" },
248
+ {
249
+ name: "permissionDescriptors",
250
+ type: "tuple[]",
251
+ internalType: "struct SelectorPermission[]",
252
+ components: [
253
+ {
254
+ name: "functionSelector",
255
+ type: "bytes4",
256
+ internalType: "bytes4",
257
+ },
258
+ {
259
+ name: "permissionDescription",
260
+ type: "string",
261
+ internalType: "string",
262
+ },
263
+ ],
264
+ },
265
+ ],
266
+ },
267
+ ],
268
+ stateMutability: "pure",
269
+ },
270
+ {
271
+ type: "function",
272
+ name: "postExecutionHook",
273
+ inputs: [
274
+ { name: "functionId", type: "uint8", internalType: "uint8" },
275
+ { name: "preExecHookData", type: "bytes", internalType: "bytes" },
276
+ ],
277
+ outputs: [],
278
+ stateMutability: "nonpayable",
279
+ },
280
+ {
281
+ type: "function",
282
+ name: "preExecutionHook",
283
+ inputs: [
284
+ { name: "functionId", type: "uint8", internalType: "uint8" },
285
+ { name: "sender", type: "address", internalType: "address" },
286
+ { name: "value", type: "uint256", internalType: "uint256" },
287
+ { name: "data", type: "bytes", internalType: "bytes" },
288
+ ],
289
+ outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
290
+ stateMutability: "nonpayable",
291
+ },
292
+ {
293
+ type: "function",
294
+ name: "preRuntimeValidationHook",
295
+ inputs: [
296
+ { name: "functionId", type: "uint8", internalType: "uint8" },
297
+ { name: "sender", type: "address", internalType: "address" },
298
+ { name: "value", type: "uint256", internalType: "uint256" },
299
+ { name: "data", type: "bytes", internalType: "bytes" },
300
+ ],
301
+ outputs: [],
302
+ stateMutability: "nonpayable",
303
+ },
304
+ {
305
+ type: "function",
306
+ name: "preUserOpValidationHook",
307
+ inputs: [
308
+ { name: "functionId", type: "uint8", internalType: "uint8" },
309
+ {
310
+ name: "userOp",
311
+ type: "tuple",
312
+ internalType: "struct UserOperation",
313
+ components: [
314
+ { name: "sender", type: "address", internalType: "address" },
315
+ { name: "nonce", type: "uint256", internalType: "uint256" },
316
+ { name: "initCode", type: "bytes", internalType: "bytes" },
317
+ { name: "callData", type: "bytes", internalType: "bytes" },
318
+ { name: "callGasLimit", type: "uint256", internalType: "uint256" },
319
+ {
320
+ name: "verificationGasLimit",
321
+ type: "uint256",
322
+ internalType: "uint256",
323
+ },
324
+ {
325
+ name: "preVerificationGas",
326
+ type: "uint256",
327
+ internalType: "uint256",
328
+ },
329
+ { name: "maxFeePerGas", type: "uint256", internalType: "uint256" },
330
+ {
331
+ name: "maxPriorityFeePerGas",
332
+ type: "uint256",
333
+ internalType: "uint256",
334
+ },
335
+ { name: "paymasterAndData", type: "bytes", internalType: "bytes" },
336
+ { name: "signature", type: "bytes", internalType: "bytes" },
337
+ ],
338
+ },
339
+ { name: "userOpHash", type: "bytes32", internalType: "bytes32" },
340
+ ],
341
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
342
+ stateMutability: "nonpayable",
343
+ },
344
+ {
345
+ type: "function",
346
+ name: "runtimeValidationFunction",
347
+ inputs: [
348
+ { name: "functionId", type: "uint8", internalType: "uint8" },
349
+ { name: "sender", type: "address", internalType: "address" },
350
+ { name: "value", type: "uint256", internalType: "uint256" },
351
+ { name: "data", type: "bytes", internalType: "bytes" },
352
+ ],
353
+ outputs: [],
354
+ stateMutability: "nonpayable",
355
+ },
356
+ {
357
+ type: "function",
358
+ name: "userOpValidationFunction",
359
+ inputs: [
360
+ { name: "functionId", type: "uint8", internalType: "uint8" },
361
+ {
362
+ name: "userOp",
363
+ type: "tuple",
364
+ internalType: "struct UserOperation",
365
+ components: [
366
+ { name: "sender", type: "address", internalType: "address" },
367
+ { name: "nonce", type: "uint256", internalType: "uint256" },
368
+ { name: "initCode", type: "bytes", internalType: "bytes" },
369
+ { name: "callData", type: "bytes", internalType: "bytes" },
370
+ { name: "callGasLimit", type: "uint256", internalType: "uint256" },
371
+ {
372
+ name: "verificationGasLimit",
373
+ type: "uint256",
374
+ internalType: "uint256",
375
+ },
376
+ {
377
+ name: "preVerificationGas",
378
+ type: "uint256",
379
+ internalType: "uint256",
380
+ },
381
+ { name: "maxFeePerGas", type: "uint256", internalType: "uint256" },
382
+ {
383
+ name: "maxPriorityFeePerGas",
384
+ type: "uint256",
385
+ internalType: "uint256",
386
+ },
387
+ { name: "paymasterAndData", type: "bytes", internalType: "bytes" },
388
+ { name: "signature", type: "bytes", internalType: "bytes" },
389
+ ],
390
+ },
391
+ { name: "userOpHash", type: "bytes32", internalType: "bytes32" },
392
+ ],
393
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
394
+ stateMutability: "nonpayable",
395
+ },
396
+ ] as const;
package/src/cli.ts ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ import { cac } from "cac";
3
+ import { generate, type GenerateOptions } from "./commands/generate/index.js";
4
+ import { init, type InitOptions } from "./commands/init.js";
5
+ import * as logger from "./logger.js";
6
+ import { VERSION } from "./version.js";
7
+
8
+ const cli = cac("plugingen");
9
+
10
+ cli
11
+ .command("init", "Initialize a new plugingen config")
12
+ .option("-c, --config <path>", "[string] path to config file")
13
+ .option("-r, --root <path>", "[string] root path to resolve config from")
14
+ .example((name) => `${name} init`)
15
+ .action(async (options: InitOptions) => init(options));
16
+
17
+ cli
18
+ .command(
19
+ "generate",
20
+ "Generate code for all of the plugins configured within the plugingen config"
21
+ )
22
+ .option("-c, --config <path>", "[string] path to config file")
23
+ .option("-r, --root <path>", "[string] root path to resolve config from")
24
+ .example((name) => `${name} generate`)
25
+ .action(async (options: GenerateOptions) => generate(options));
26
+
27
+ cli.help();
28
+ cli.version(VERSION);
29
+
30
+ void (async () => {
31
+ try {
32
+ // Parse CLI args without running command
33
+ cli.parse(process.argv, { run: false });
34
+ if (!cli.matchedCommand) {
35
+ if (cli.args.length === 0) {
36
+ if (!cli.options.help && !cli.options.version) cli.outputHelp();
37
+ } else throw new Error(`Unknown command: ${cli.args.join(" ")}`);
38
+ }
39
+ await cli.runMatchedCommand();
40
+ } catch (error) {
41
+ logger.error(`\n${(error as Error).message}`);
42
+ process.exit(1);
43
+ }
44
+ })();