@pimlico/alto 0.0.0-staging.20240606T110517 → 0.0.2

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 (230) hide show
  1. package/LICENSE +674 -0
  2. package/lib/executor/executor.js +6 -0
  3. package/lib/executor/executor.js.map +1 -1
  4. package/lib/executor/executorManager.js +1 -0
  5. package/lib/executor/executorManager.js.map +1 -1
  6. package/lib/executor/utils.js +3 -1
  7. package/lib/executor/utils.js.map +1 -1
  8. package/lib/rpc/server.js +2 -1
  9. package/lib/rpc/server.js.map +1 -1
  10. package/lib/types/mempool.d.ts +2 -1
  11. package/package.json +11 -12
  12. package/esm/cli/alto.d.ts +0 -6
  13. package/esm/cli/alto.js +0 -92
  14. package/esm/cli/alto.js.map +0 -1
  15. package/esm/cli/config/bundler.d.ts +0 -391
  16. package/esm/cli/config/bundler.js +0 -132
  17. package/esm/cli/config/bundler.js.map +0 -1
  18. package/esm/cli/config/index.d.ts +0 -3
  19. package/esm/cli/config/index.js +0 -3
  20. package/esm/cli/config/index.js.map +0 -1
  21. package/esm/cli/config/options.d.ts +0 -11
  22. package/esm/cli/config/options.js +0 -336
  23. package/esm/cli/config/options.js.map +0 -1
  24. package/esm/cli/customTransport.d.ts +0 -14
  25. package/esm/cli/customTransport.js +0 -53
  26. package/esm/cli/customTransport.js.map +0 -1
  27. package/esm/cli/handler.d.ts +0 -3
  28. package/esm/cli/handler.js +0 -116
  29. package/esm/cli/handler.js.map +0 -1
  30. package/esm/cli/index.d.ts +0 -4
  31. package/esm/cli/index.js +0 -4
  32. package/esm/cli/index.js.map +0 -1
  33. package/esm/cli/instrumentation.d.ts +0 -2
  34. package/esm/cli/instrumentation.js +0 -39
  35. package/esm/cli/instrumentation.js.map +0 -1
  36. package/esm/cli/setupServer.d.ts +0 -17
  37. package/esm/cli/setupServer.js +0 -155
  38. package/esm/cli/setupServer.js.map +0 -1
  39. package/esm/cli/util.d.ts +0 -22
  40. package/esm/cli/util.js +0 -30
  41. package/esm/cli/util.js.map +0 -1
  42. package/esm/executor/executor.d.ts +0 -54
  43. package/esm/executor/executor.js +0 -637
  44. package/esm/executor/executor.js.map +0 -1
  45. package/esm/executor/executorManager.d.ts +0 -34
  46. package/esm/executor/executorManager.js +0 -401
  47. package/esm/executor/executorManager.js.map +0 -1
  48. package/esm/executor/index.d.ts +0 -5
  49. package/esm/executor/index.js +0 -5
  50. package/esm/executor/index.js.map +0 -1
  51. package/esm/executor/senderManager.d.ts +0 -17
  52. package/esm/executor/senderManager.js +0 -160
  53. package/esm/executor/senderManager.js.map +0 -1
  54. package/esm/executor/test/utils.d.ts +0 -13
  55. package/esm/executor/test/utils.js +0 -75
  56. package/esm/executor/test/utils.js.map +0 -1
  57. package/esm/executor/utils.d.ts +0 -32
  58. package/esm/executor/utils.js +0 -239
  59. package/esm/executor/utils.js.map +0 -1
  60. package/esm/index.d.ts +0 -2
  61. package/esm/index.js +0 -2
  62. package/esm/index.js.map +0 -1
  63. package/esm/mempool/index.d.ts +0 -5
  64. package/esm/mempool/index.js +0 -5
  65. package/esm/mempool/index.js.map +0 -1
  66. package/esm/mempool/mempool.d.ts +0 -64
  67. package/esm/mempool/mempool.js +0 -489
  68. package/esm/mempool/mempool.js.map +0 -1
  69. package/esm/mempool/monitoring.d.ts +0 -10
  70. package/esm/mempool/monitoring.js +0 -34
  71. package/esm/mempool/monitoring.js.map +0 -1
  72. package/esm/mempool/nullMempool.d.ts +0 -15
  73. package/esm/mempool/nullMempool.js +0 -36
  74. package/esm/mempool/nullMempool.js.map +0 -1
  75. package/esm/mempool/reputationManager.d.ts +0 -115
  76. package/esm/mempool/reputationManager.js +0 -397
  77. package/esm/mempool/reputationManager.js.map +0 -1
  78. package/esm/mempool/store.d.ts +0 -22
  79. package/esm/mempool/store.js +0 -123
  80. package/esm/mempool/store.js.map +0 -1
  81. package/esm/rpc/EntryPointSimulationsV07.d.ts +0 -58
  82. package/esm/rpc/EntryPointSimulationsV07.js +0 -407
  83. package/esm/rpc/EntryPointSimulationsV07.js.map +0 -1
  84. package/esm/rpc/ExecuteSimulator.d.ts +0 -37
  85. package/esm/rpc/ExecuteSimulator.js +0 -48
  86. package/esm/rpc/ExecuteSimulator.js.map +0 -1
  87. package/esm/rpc/gasEstimation.d.ts +0 -17
  88. package/esm/rpc/gasEstimation.js +0 -410
  89. package/esm/rpc/gasEstimation.js.map +0 -1
  90. package/esm/rpc/index.d.ts +0 -5
  91. package/esm/rpc/index.js +0 -5
  92. package/esm/rpc/index.js.map +0 -1
  93. package/esm/rpc/nonceQueuer.d.ts +0 -25
  94. package/esm/rpc/nonceQueuer.js +0 -135
  95. package/esm/rpc/nonceQueuer.js.map +0 -1
  96. package/esm/rpc/rpcHandler.d.ts +0 -64
  97. package/esm/rpc/rpcHandler.js +0 -727
  98. package/esm/rpc/rpcHandler.js.map +0 -1
  99. package/esm/rpc/server.d.ts +0 -31
  100. package/esm/rpc/server.js +0 -238
  101. package/esm/rpc/server.js.map +0 -1
  102. package/esm/rpc/validation/BundlerCollectorTracerV06.d.ts +0 -102
  103. package/esm/rpc/validation/BundlerCollectorTracerV06.js +0 -255
  104. package/esm/rpc/validation/BundlerCollectorTracerV06.js.map +0 -1
  105. package/esm/rpc/validation/BundlerCollectorTracerV07.d.ts +0 -102
  106. package/esm/rpc/validation/BundlerCollectorTracerV07.js +0 -254
  107. package/esm/rpc/validation/BundlerCollectorTracerV07.js.map +0 -1
  108. package/esm/rpc/validation/SafeValidator.d.ts +0 -35
  109. package/esm/rpc/validation/SafeValidator.js +0 -487
  110. package/esm/rpc/validation/SafeValidator.js.map +0 -1
  111. package/esm/rpc/validation/TracerResultParserV06.d.ts +0 -13
  112. package/esm/rpc/validation/TracerResultParserV06.js +0 -578
  113. package/esm/rpc/validation/TracerResultParserV06.js.map +0 -1
  114. package/esm/rpc/validation/TracerResultParserV07.d.ts +0 -33
  115. package/esm/rpc/validation/TracerResultParserV07.js +0 -557
  116. package/esm/rpc/validation/TracerResultParserV07.js.map +0 -1
  117. package/esm/rpc/validation/UnsafeValidator.d.ts +0 -63
  118. package/esm/rpc/validation/UnsafeValidator.js +0 -257
  119. package/esm/rpc/validation/UnsafeValidator.js.map +0 -1
  120. package/esm/rpc/validation/index.d.ts +0 -3
  121. package/esm/rpc/validation/index.js +0 -3
  122. package/esm/rpc/validation/index.js.map +0 -1
  123. package/esm/rpc/validation/tracer.d.ts +0 -122
  124. package/esm/rpc/validation/tracer.js +0 -82
  125. package/esm/rpc/validation/tracer.js.map +0 -1
  126. package/esm/types/contracts/BundleBulker.d.ts +0 -120
  127. package/esm/types/contracts/BundleBulker.js +0 -157
  128. package/esm/types/contracts/BundleBulker.js.map +0 -1
  129. package/esm/types/contracts/CallEngine.d.ts +0 -28
  130. package/esm/types/contracts/CallEngine.js +0 -37
  131. package/esm/types/contracts/CallEngine.js.map +0 -1
  132. package/esm/types/contracts/CodeHashGetter.d.ts +0 -37
  133. package/esm/types/contracts/CodeHashGetter.js +0 -45
  134. package/esm/types/contracts/CodeHashGetter.js.map +0 -1
  135. package/esm/types/contracts/EntryPoint.d.ts +0 -1789
  136. package/esm/types/contracts/EntryPoint.js +0 -2304
  137. package/esm/types/contracts/EntryPoint.js.map +0 -1
  138. package/esm/types/contracts/EntryPointSimulations.d.ts +0 -153
  139. package/esm/types/contracts/EntryPointSimulations.js +0 -15
  140. package/esm/types/contracts/EntryPointSimulations.js.map +0 -1
  141. package/esm/types/contracts/IOpInflator.d.ts +0 -61
  142. package/esm/types/contracts/IOpInflator.js +0 -80
  143. package/esm/types/contracts/IOpInflator.js.map +0 -1
  144. package/esm/types/contracts/IPaymaster.d.ts +0 -3
  145. package/esm/types/contracts/IPaymaster.js +0 -117
  146. package/esm/types/contracts/IPaymaster.js.map +0 -1
  147. package/esm/types/contracts/Inflator.d.ts +0 -65
  148. package/esm/types/contracts/Inflator.js +0 -84
  149. package/esm/types/contracts/Inflator.js.map +0 -1
  150. package/esm/types/contracts/PerOpInflator.d.ts +0 -176
  151. package/esm/types/contracts/PerOpInflator.js +0 -229
  152. package/esm/types/contracts/PerOpInflator.js.map +0 -1
  153. package/esm/types/contracts/PimlicoEntryPointSimulations.d.ts +0 -23
  154. package/esm/types/contracts/PimlicoEntryPointSimulations.js +0 -33
  155. package/esm/types/contracts/PimlicoEntryPointSimulations.js.map +0 -1
  156. package/esm/types/contracts/SenderCreator.d.ts +0 -4
  157. package/esm/types/contracts/SenderCreator.js +0 -23
  158. package/esm/types/contracts/SenderCreator.js.map +0 -1
  159. package/esm/types/contracts/SimpleAccountFactory.d.ts +0 -57
  160. package/esm/types/contracts/SimpleAccountFactory.js +0 -76
  161. package/esm/types/contracts/SimpleAccountFactory.js.map +0 -1
  162. package/esm/types/contracts/TestOpcodesAccount.d.ts +0 -4
  163. package/esm/types/contracts/TestOpcodesAccount.js +0 -281
  164. package/esm/types/contracts/TestOpcodesAccount.js.map +0 -1
  165. package/esm/types/contracts/TestOpcodesAccountFactory.d.ts +0 -4
  166. package/esm/types/contracts/TestOpcodesAccountFactory.js +0 -23
  167. package/esm/types/contracts/TestOpcodesAccountFactory.js.map +0 -1
  168. package/esm/types/contracts/TestStorageAccount.d.ts +0 -4
  169. package/esm/types/contracts/TestStorageAccount.js +0 -313
  170. package/esm/types/contracts/TestStorageAccount.js.map +0 -1
  171. package/esm/types/contracts/index.d.ts +0 -17
  172. package/esm/types/contracts/index.js +0 -17
  173. package/esm/types/contracts/index.js.map +0 -1
  174. package/esm/types/gasPrice.d.ts +0 -110
  175. package/esm/types/gasPrice.js +0 -52
  176. package/esm/types/gasPrice.js.map +0 -1
  177. package/esm/types/index.d.ts +0 -11
  178. package/esm/types/index.js +0 -11
  179. package/esm/types/index.js.map +0 -1
  180. package/esm/types/interfaces.d.ts +0 -26
  181. package/esm/types/interfaces.js +0 -2
  182. package/esm/types/interfaces.js.map +0 -1
  183. package/esm/types/mempool.d.ts +0 -78
  184. package/esm/types/mempool.js +0 -16
  185. package/esm/types/mempool.js.map +0 -1
  186. package/esm/types/schemas.d.ts +0 -4791
  187. package/esm/types/schemas.js +0 -497
  188. package/esm/types/schemas.js.map +0 -1
  189. package/esm/types/test/validationTestErrors.d.ts +0 -3
  190. package/esm/types/test/validationTestErrors.js +0 -229
  191. package/esm/types/test/validationTestErrors.js.map +0 -1
  192. package/esm/types/utils.d.ts +0 -24
  193. package/esm/types/utils.js +0 -30
  194. package/esm/types/utils.js.map +0 -1
  195. package/esm/types/validation.d.ts +0 -14327
  196. package/esm/types/validation.js +0 -304
  197. package/esm/types/validation.js.map +0 -1
  198. package/esm/utils/bigInt.d.ts +0 -3
  199. package/esm/utils/bigInt.js +0 -9
  200. package/esm/utils/bigInt.js.map +0 -1
  201. package/esm/utils/compressionHandler.d.ts +0 -11
  202. package/esm/utils/compressionHandler.js +0 -39
  203. package/esm/utils/compressionHandler.js.map +0 -1
  204. package/esm/utils/gasPriceManager.d.ts +0 -34
  205. package/esm/utils/gasPriceManager.js +0 -338
  206. package/esm/utils/gasPriceManager.js.map +0 -1
  207. package/esm/utils/helpers.d.ts +0 -4
  208. package/esm/utils/helpers.js +0 -13
  209. package/esm/utils/helpers.js.map +0 -1
  210. package/esm/utils/index.d.ts +0 -11
  211. package/esm/utils/index.js +0 -10
  212. package/esm/utils/index.js.map +0 -1
  213. package/esm/utils/logger.d.ts +0 -6
  214. package/esm/utils/logger.js +0 -76
  215. package/esm/utils/logger.js.map +0 -1
  216. package/esm/utils/metrics.d.ts +0 -22
  217. package/esm/utils/metrics.js +0 -150
  218. package/esm/utils/metrics.js.map +0 -1
  219. package/esm/utils/rpc-reply.d.ts +0 -17
  220. package/esm/utils/rpc-reply.js +0 -41
  221. package/esm/utils/rpc-reply.js.map +0 -1
  222. package/esm/utils/test.d.ts +0 -17
  223. package/esm/utils/test.js +0 -130
  224. package/esm/utils/test.js.map +0 -1
  225. package/esm/utils/userop.d.ts +0 -49
  226. package/esm/utils/userop.js +0 -408
  227. package/esm/utils/userop.js.map +0 -1
  228. package/esm/utils/validation.d.ts +0 -65
  229. package/esm/utils/validation.js +0 -461
  230. package/esm/utils/validation.js.map +0 -1
@@ -1,408 +0,0 @@
1
- import { EntryPointV06Abi, EntryPointV07Abi } from "../types/index.js";
2
- import * as sentry from "@sentry/node";
3
- import { decodeEventLog, encodeAbiParameters, getAddress, keccak256, toHex, concat, slice, pad } from "viem";
4
- import { areAddressesEqual } from "./helpers.js";
5
- // Type predicate check if the UserOperation is V06.
6
- export function isVersion06(operation) {
7
- return "initCode" in operation && "paymasterAndData" in operation;
8
- }
9
- // Type predicate to check if the UserOperation is V07.
10
- export function isVersion07(operation) {
11
- return "factory" in operation && "paymaster" in operation;
12
- }
13
- export function getInitCode(unpackedUserOperation) {
14
- return unpackedUserOperation.factory
15
- ? concat([
16
- unpackedUserOperation.factory,
17
- unpackedUserOperation.factoryData || "0x"
18
- ])
19
- : "0x";
20
- }
21
- export function unPackInitCode(initCode) {
22
- if (initCode === "0x") {
23
- return {
24
- factory: null,
25
- factoryData: null
26
- };
27
- }
28
- return {
29
- factory: getAddress(slice(initCode, 0, 20)),
30
- factoryData: slice(initCode, 20)
31
- };
32
- }
33
- export function getAccountGasLimits(unpackedUserOperation) {
34
- return concat([
35
- pad(toHex(unpackedUserOperation.verificationGasLimit), {
36
- size: 16
37
- }),
38
- pad(toHex(unpackedUserOperation.callGasLimit), { size: 16 })
39
- ]);
40
- }
41
- export function unpackAccountGasLimits(accountGasLimits) {
42
- return {
43
- verificationGasLimit: BigInt(slice(accountGasLimits, 0, 16)),
44
- callGasLimit: BigInt(slice(accountGasLimits, 16))
45
- };
46
- }
47
- export function getGasLimits(unpackedUserOperation) {
48
- return concat([
49
- pad(toHex(unpackedUserOperation.maxPriorityFeePerGas), {
50
- size: 16
51
- }),
52
- pad(toHex(unpackedUserOperation.maxFeePerGas), { size: 16 })
53
- ]);
54
- }
55
- export function unpackGasLimits(gasLimits) {
56
- return {
57
- maxPriorityFeePerGas: BigInt(slice(gasLimits, 0, 16)),
58
- maxFeePerGas: BigInt(slice(gasLimits, 16))
59
- };
60
- }
61
- export function getPaymasterAndData(unpackedUserOperation) {
62
- return unpackedUserOperation.paymaster
63
- ? concat([
64
- unpackedUserOperation.paymaster,
65
- pad(toHex(unpackedUserOperation.paymasterVerificationGasLimit || 0n), {
66
- size: 16
67
- }),
68
- pad(toHex(unpackedUserOperation.paymasterPostOpGasLimit || 0n), {
69
- size: 16
70
- }),
71
- unpackedUserOperation.paymasterData || "0x"
72
- ])
73
- : "0x";
74
- }
75
- export function unpackPaymasterAndData(paymasterAndData) {
76
- if (paymasterAndData === "0x") {
77
- return {
78
- paymaster: null,
79
- paymasterVerificationGasLimit: null,
80
- paymasterPostOpGasLimit: null,
81
- paymasterData: null
82
- };
83
- }
84
- return {
85
- paymaster: getAddress(slice(paymasterAndData, 0, 20)),
86
- paymasterVerificationGasLimit: BigInt(slice(paymasterAndData, 20, 36)),
87
- paymasterPostOpGasLimit: BigInt(slice(paymasterAndData, 36, 52)),
88
- paymasterData: slice(paymasterAndData, 52)
89
- };
90
- }
91
- export function toPackedUserOperation(unpackedUserOperation) {
92
- return {
93
- sender: unpackedUserOperation.sender,
94
- nonce: unpackedUserOperation.nonce,
95
- initCode: getInitCode(unpackedUserOperation),
96
- callData: unpackedUserOperation.callData,
97
- accountGasLimits: getAccountGasLimits(unpackedUserOperation),
98
- preVerificationGas: unpackedUserOperation.preVerificationGas,
99
- gasFees: getGasLimits(unpackedUserOperation),
100
- paymasterAndData: getPaymasterAndData(unpackedUserOperation),
101
- signature: unpackedUserOperation.signature
102
- };
103
- }
104
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
105
- export function deepHexlify(obj) {
106
- if (typeof obj === "function") {
107
- return undefined;
108
- }
109
- if (obj == null || typeof obj === "string" || typeof obj === "boolean") {
110
- return obj;
111
- }
112
- if (typeof obj === "bigint") {
113
- return toHex(obj);
114
- }
115
- if (obj._isBigNumber != null || typeof obj !== "object") {
116
- return toHex(obj).replace(/^0x0/, "0x");
117
- }
118
- if (Array.isArray(obj)) {
119
- return obj.map((member) => deepHexlify(member));
120
- }
121
- return Object.keys(obj).reduce(
122
- // biome-ignore lint/suspicious/noExplicitAny: it's a recursive function, so it's hard to type
123
- (set, key) => {
124
- set[key] = deepHexlify(obj[key]);
125
- return set;
126
- }, {});
127
- }
128
- export function getAddressFromInitCodeOrPaymasterAndData(data) {
129
- if (!data) {
130
- return null;
131
- }
132
- if (data.length >= 42) {
133
- return getAddress(data.slice(0, 42));
134
- }
135
- return null;
136
- }
137
- export const transactionIncluded = async (isVersion06, txHash, publicClient, entryPoint) => {
138
- try {
139
- const rcp = await publicClient.getTransactionReceipt({ hash: txHash });
140
- if (rcp.status === "success") {
141
- // find if any logs are UserOperationEvent or AccountDeployed
142
- const r = rcp.logs
143
- .map((l) => {
144
- if (areAddressesEqual(l.address, entryPoint)) {
145
- try {
146
- const log = decodeEventLog({
147
- abi: isVersion06
148
- ? EntryPointV06Abi
149
- : EntryPointV07Abi,
150
- data: l.data,
151
- topics: l.topics
152
- });
153
- if (log.eventName === "AccountDeployed") {
154
- return {
155
- userOperationHash: log.args.userOpHash,
156
- success: !!log.args.factory,
157
- accountDeployed: true
158
- };
159
- }
160
- if (log.eventName === "UserOperationEvent") {
161
- return {
162
- userOperationHash: log.args.userOpHash,
163
- success: !!log.args.success,
164
- accountDeployed: false
165
- };
166
- }
167
- return undefined;
168
- }
169
- catch (_e) {
170
- sentry.captureException(_e);
171
- return undefined;
172
- }
173
- }
174
- return undefined;
175
- })
176
- .reduce((result, log) => {
177
- if (log) {
178
- result[log.userOperationHash] = {
179
- userOperationHash: log.userOperationHash,
180
- accountDeployed: log.accountDeployed ||
181
- result[log.userOperationHash]
182
- ?.accountDeployed,
183
- success: log.success ||
184
- result[log.userOperationHash]?.success
185
- };
186
- return result;
187
- }
188
- return result;
189
- }, {});
190
- const success = Object.values(r).reduce((x, v) => x || v.success, false);
191
- if (success) {
192
- return {
193
- status: "included",
194
- ...r
195
- };
196
- }
197
- return {
198
- status: "reverted"
199
- };
200
- }
201
- return {
202
- status: "failed"
203
- };
204
- }
205
- catch (_e) {
206
- return {
207
- status: "not_found"
208
- };
209
- }
210
- };
211
- export const getUserOperationHashV06 = (userOperation, entryPointAddress, chainId) => {
212
- const hash = keccak256(encodeAbiParameters([
213
- {
214
- name: "sender",
215
- type: "address"
216
- },
217
- {
218
- name: "nonce",
219
- type: "uint256"
220
- },
221
- {
222
- name: "initCodeHash",
223
- type: "bytes32"
224
- },
225
- {
226
- name: "callDataHash",
227
- type: "bytes32"
228
- },
229
- {
230
- name: "callGasLimit",
231
- type: "uint256"
232
- },
233
- {
234
- name: "verificationGasLimit",
235
- type: "uint256"
236
- },
237
- {
238
- name: "preVerificationGas",
239
- type: "uint256"
240
- },
241
- {
242
- name: "maxFeePerGas",
243
- type: "uint256"
244
- },
245
- {
246
- name: "maxPriorityFeePerGas",
247
- type: "uint256"
248
- },
249
- {
250
- name: "paymasterAndDataHash",
251
- type: "bytes32"
252
- }
253
- ], [
254
- userOperation.sender,
255
- userOperation.nonce,
256
- keccak256(userOperation.initCode),
257
- keccak256(userOperation.callData),
258
- userOperation.callGasLimit,
259
- userOperation.verificationGasLimit,
260
- userOperation.preVerificationGas,
261
- userOperation.maxFeePerGas,
262
- userOperation.maxPriorityFeePerGas,
263
- keccak256(userOperation.paymasterAndData)
264
- ]));
265
- return keccak256(encodeAbiParameters([
266
- {
267
- name: "userOpHash",
268
- type: "bytes32"
269
- },
270
- {
271
- name: "entryPointAddress",
272
- type: "address"
273
- },
274
- {
275
- name: "chainId",
276
- type: "uint256"
277
- }
278
- ], [hash, entryPointAddress, BigInt(chainId)]));
279
- };
280
- export const getUserOperationHashV07 = (userOperation, entryPointAddress, chainId) => {
281
- const hash = keccak256(encodeAbiParameters([
282
- {
283
- name: "sender",
284
- type: "address"
285
- },
286
- {
287
- name: "nonce",
288
- type: "uint256"
289
- },
290
- {
291
- name: "initCodeHash",
292
- type: "bytes32"
293
- },
294
- {
295
- name: "callDataHash",
296
- type: "bytes32"
297
- },
298
- {
299
- name: "accountGasLimits",
300
- type: "bytes32"
301
- },
302
- {
303
- name: "preVerificationGas",
304
- type: "uint256"
305
- },
306
- {
307
- name: "gasFees",
308
- type: "bytes32"
309
- },
310
- {
311
- name: "paymasterAndDataHash",
312
- type: "bytes32"
313
- }
314
- ], [
315
- userOperation.sender,
316
- userOperation.nonce,
317
- keccak256(userOperation.initCode),
318
- keccak256(userOperation.callData),
319
- userOperation.accountGasLimits,
320
- userOperation.preVerificationGas,
321
- userOperation.gasFees,
322
- keccak256(userOperation.paymasterAndData)
323
- ]));
324
- return keccak256(encodeAbiParameters([
325
- {
326
- name: "userOpHash",
327
- type: "bytes32"
328
- },
329
- {
330
- name: "entryPointAddress",
331
- type: "address"
332
- },
333
- {
334
- name: "chainId",
335
- type: "uint256"
336
- }
337
- ], [hash, entryPointAddress, BigInt(chainId)]));
338
- };
339
- export const getUserOperationHash = (userOperation, entryPointAddress, chainId) => {
340
- if (isVersion06(userOperation)) {
341
- return getUserOperationHashV06(userOperation, entryPointAddress, chainId);
342
- }
343
- return getUserOperationHashV07(toPackedUserOperation(userOperation), entryPointAddress, chainId);
344
- };
345
- export const getNonceKeyAndValue = (nonce) => {
346
- const nonceKey = nonce >> 64n; // first 192 bits of nonce
347
- const userOperationNonceValue = nonce & 0xffffffffffffffffn; // last 64 bits of nonce
348
- return [nonceKey, userOperationNonceValue];
349
- };
350
- export function toUnpackedUserOperation(packedUserOperation) {
351
- const { factory, factoryData } = unPackInitCode(packedUserOperation.initCode);
352
- const { callGasLimit, verificationGasLimit } = unpackAccountGasLimits(packedUserOperation.accountGasLimits);
353
- const { maxFeePerGas, maxPriorityFeePerGas } = unpackGasLimits(packedUserOperation.gasFees);
354
- const { paymaster, paymasterVerificationGasLimit, paymasterPostOpGasLimit, paymasterData } = unpackPaymasterAndData(packedUserOperation.paymasterAndData);
355
- return {
356
- sender: packedUserOperation.sender,
357
- nonce: packedUserOperation.nonce,
358
- factory: factory,
359
- factoryData: factoryData,
360
- callData: packedUserOperation.callData,
361
- callGasLimit: callGasLimit,
362
- verificationGasLimit: verificationGasLimit,
363
- preVerificationGas: packedUserOperation.preVerificationGas,
364
- maxFeePerGas: maxFeePerGas,
365
- maxPriorityFeePerGas: maxPriorityFeePerGas,
366
- paymaster: paymaster,
367
- paymasterVerificationGasLimit: paymasterVerificationGasLimit,
368
- paymasterPostOpGasLimit: paymasterPostOpGasLimit,
369
- paymasterData: paymasterData,
370
- signature: packedUserOperation.signature
371
- };
372
- }
373
- /*
374
- function pack(
375
- UserOperation calldata userOp
376
- ) internal pure returns (bytes memory ret) {
377
- address sender = getSender(userOp);
378
- uint256 nonce = userOp.nonce;
379
- bytes32 hashInitCode = calldataKeccak(userOp.initCode);
380
- bytes32 hashCallData = calldataKeccak(userOp.callData);
381
- uint256 callGasLimit = userOp.callGasLimit;
382
- uint256 verificationGasLimit = userOp.verificationGasLimit;
383
- uint256 preVerificationGas = userOp.preVerificationGas;
384
- uint256 maxFeePerGas = userOp.maxFeePerGas;
385
- uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;
386
- bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);
387
-
388
- return abi.encode(
389
- sender, nonce,
390
- hashInitCode, hashCallData,
391
- callGasLimit, verificationGasLimit, preVerificationGas,
392
- maxFeePerGas, maxPriorityFeePerGas,
393
- hashPaymasterAndData
394
- );
395
- }
396
-
397
-
398
- const encodedData = encodeAbiParameters(
399
- [
400
- { name: 'x', type: 'string' },
401
- { name: 'y', type: 'uint' },
402
- { name: 'z', type: 'bool' }
403
- ],
404
- ['wagmi', 420n, true]
405
- )
406
-
407
- */
408
- //# sourceMappingURL=userop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"userop.js","sourceRoot":"","sources":["../../utils/userop.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAMhB,gBAAgB,EACnB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;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D,YAAY,EAAE,YAAY;QAC1B,oBAAoB,EAAE,oBAAoB;QAC1C,SAAS,EAAE,SAAS;QACpB,6BAA6B,EAAE,6BAA6B;QAC5D,uBAAuB,EAAE,uBAAuB;QAChD,aAAa,EAAE,aAAa;QAC5B,SAAS,EAAE,mBAAmB,CAAC,SAAS;KAC3C,CAAA;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCE"}
@@ -1,65 +0,0 @@
1
- import { type Address, type ChainType, type PackedUserOperation, type UserOperation, type UserOperationV06 } from "../types/index.js";
2
- import { type Chain, ContractFunctionRevertedError, EstimateGasExecutionError, FeeCapTooLowError, InsufficientFundsError, IntrinsicGasTooLowError, NonceTooLowError, type PublicClient, type Transport } from "viem";
3
- import type { GasPriceManager } from "./gasPriceManager.js";
4
- export interface GasOverheads {
5
- /**
6
- * fixed overhead for entire handleOp bundle.
7
- */
8
- fixed: number;
9
- /**
10
- * per userOp overhead, added on top of the above fixed per-bundle.
11
- */
12
- perUserOp: number;
13
- /**
14
- * overhead for userOp word (32 bytes) block
15
- */
16
- perUserOpWord: number;
17
- /**
18
- * zero byte cost, for calldata gas cost calculations
19
- */
20
- zeroByte: number;
21
- /**
22
- * non-zero byte cost, for calldata gas cost calculations
23
- */
24
- nonZeroByte: number;
25
- /**
26
- * expected bundle size, to split per-bundle overhead between all ops.
27
- */
28
- bundleSize: number;
29
- /**
30
- * expected length of the userOp signature.
31
- */
32
- sigSize: number;
33
- }
34
- export declare const DefaultGasOverheads: GasOverheads;
35
- /**
36
- * pack the userOperation
37
- * @param op
38
- * "false" to pack entire UserOp, for calculating the calldata cost of putting it on-chain.
39
- */
40
- export declare function packUserOpV06(op: UserOperationV06): `0x${string}`;
41
- export declare function removeZeroBytesFromUserOp<T extends UserOperation>(userOpearation: T): T extends UserOperationV06 ? UserOperationV06 : PackedUserOperation;
42
- export declare function packUserOpV07(op: PackedUserOperation): `0x${string}`;
43
- export declare function calcPreVerificationGas(publicClient: PublicClient<Transport, Chain>, userOperation: UserOperation, entryPoint: Address, chainId: number, chainType: ChainType, gasPriceManager: GasPriceManager, validate: boolean, // when calculating preVerificationGas for validation
44
- overheads?: GasOverheads): Promise<bigint>;
45
- export declare function calcVerificationGasAndCallGasLimit(userOperation: UserOperation, executionResult: {
46
- preOpGas: bigint;
47
- paid: bigint;
48
- }, chainId: number, callDataResult?: {
49
- gasUsed: bigint;
50
- }): {
51
- verificationGasLimit: bigint;
52
- callGasLimit: bigint;
53
- };
54
- /**
55
- * calculate the preVerificationGas of the given UserOperation
56
- * preVerificationGas (by definition) is the cost overhead that can't be calculated on-chain.
57
- * it is based on parameters that are defined by the Ethereum protocol for external transactions.
58
- * @param userOp filled userOp to calculate. The only possible missing fields can be the signature and preVerificationGas itself
59
- * @param overheads gas overheads to use, to override the default values
60
- */
61
- export declare function calcDefaultPreVerificationGas(userOperation: UserOperation, overheads?: Partial<GasOverheads>): bigint;
62
- export declare function calcOptimismPreVerificationGas(publicClient: PublicClient<Transport, Chain>, op: UserOperation, entryPoint: Address, staticFee: bigint, gasPriceManager: GasPriceManager, verify?: boolean): Promise<bigint>;
63
- export declare function calcArbitrumPreVerificationGas(publicClient: PublicClient<Transport, Chain | undefined>, op: UserOperation, entryPoint: Address, staticFee: bigint): Promise<bigint>;
64
- export declare function parseViemError(err: unknown): NonceTooLowError | FeeCapTooLowError | InsufficientFundsError | IntrinsicGasTooLowError | ContractFunctionRevertedError | EstimateGasExecutionError | undefined;
65
- //# sourceMappingURL=validation.d.ts.map