permissionless 0.0.1 → 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.
- package/CHANGELOG.md +7 -0
- package/_cjs/actions/bundler.js +117 -0
- package/_cjs/actions/bundler.js.map +1 -0
- package/_cjs/actions/index.js +11 -0
- package/_cjs/actions/index.js.map +1 -0
- package/_cjs/actions/utils.js +27 -0
- package/_cjs/actions/utils.js.map +1 -0
- package/_cjs/index.js +6 -0
- package/_cjs/index.js.map +1 -0
- package/_cjs/package.json +1 -0
- package/_cjs/types/bundler.js +3 -0
- package/_cjs/types/bundler.js.map +1 -0
- package/_cjs/types/index.js +3 -0
- package/_cjs/types/index.js.map +1 -0
- package/_cjs/types/userOperation.js +3 -0
- package/_cjs/types/userOperation.js.map +1 -0
- package/_esm/actions/bundler.js +384 -0
- package/_esm/actions/bundler.js.map +1 -0
- package/_esm/actions/index.js +3 -0
- package/_esm/actions/index.js.map +1 -0
- package/_esm/actions/utils.js +24 -0
- package/_esm/actions/utils.js.map +1 -0
- package/_esm/index.js +3 -0
- package/_esm/index.js.map +1 -0
- package/_esm/package.json +1 -0
- package/_esm/types/bundler.js +2 -0
- package/_esm/types/bundler.js.map +1 -0
- package/_esm/types/index.js +2 -0
- package/_esm/types/index.js.map +1 -0
- package/_esm/types/userOperation.js +2 -0
- package/_esm/types/userOperation.js.map +1 -0
- package/_types/actions/bundler.d.ts +304 -0
- package/_types/actions/bundler.d.ts.map +1 -0
- package/_types/actions/index.d.ts +3 -0
- package/_types/actions/index.d.ts.map +1 -0
- package/_types/actions/utils.d.ts +2 -0
- package/_types/actions/utils.d.ts.map +1 -0
- package/_types/index.d.ts +3 -0
- package/_types/index.d.ts.map +1 -0
- package/_types/types/bundler.d.ts +115 -0
- package/_types/types/bundler.d.ts.map +1 -0
- package/_types/types/index.d.ts +4 -0
- package/_types/types/index.d.ts.map +1 -0
- package/_types/types/userOperation.d.ts +29 -0
- package/_types/types/userOperation.d.ts.map +1 -0
- package/actions/bundler.ts +446 -0
- package/actions/index.ts +22 -0
- package/actions/package.json +6 -0
- package/actions/utils.ts +25 -0
- package/index.ts +2 -0
- package/package.json +34 -11
- package/tsconfig.build.tsbuildinfo +1 -0
- package/types/bundler.ts +120 -0
- package/types/index.ts +4 -0
- package/types/package.json +6 -0
- package/types/userOperation.ts +30 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type": "module","sideEffects":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../types/bundler.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userOperation.js","sourceRoot":"","sources":["../../types/userOperation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import type { Address } from "abitype";
|
|
2
|
+
import type { Client, Hash } from "viem";
|
|
3
|
+
import type { PartialBy } from "viem/types/utils";
|
|
4
|
+
import type { UserOperation, UserOperationReceipt } from "../types";
|
|
5
|
+
import type { BundlerClient } from "../types/bundler";
|
|
6
|
+
export type SendUserOperationParameters = {
|
|
7
|
+
userOperation: UserOperation;
|
|
8
|
+
entryPoint: Address;
|
|
9
|
+
};
|
|
10
|
+
export type EstimateUserOperationGasParameters = {
|
|
11
|
+
userOperation: PartialBy<UserOperation, "callGasLimit" | "preVerificationGas" | "verificationGasLimit">;
|
|
12
|
+
entryPoint: Address;
|
|
13
|
+
};
|
|
14
|
+
export type EstimateUserOperationGasReturnType = {
|
|
15
|
+
preVerificationGas: bigint;
|
|
16
|
+
verificationGasLimit: bigint;
|
|
17
|
+
callGasLimit: bigint;
|
|
18
|
+
};
|
|
19
|
+
export type GetUserOperationByHash = {
|
|
20
|
+
hash: Hash;
|
|
21
|
+
};
|
|
22
|
+
export type GetUserOperationReceipt = {
|
|
23
|
+
hash: Hash;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Sends user operation to the bundler
|
|
27
|
+
*
|
|
28
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/sendUserOperation
|
|
29
|
+
*
|
|
30
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
31
|
+
* @param args {@link SendUserOperationParameters}.
|
|
32
|
+
* @returns UserOpHash that you can use to track user operation as {@link Hash}.
|
|
33
|
+
*
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* import { createClient } from "viem"
|
|
37
|
+
* import { sendUserOperation } from "permissionless/actions"
|
|
38
|
+
*
|
|
39
|
+
* const bundlerClient = createClient({
|
|
40
|
+
* chain: goerli,
|
|
41
|
+
* transport: http(BUNDLER_URL)
|
|
42
|
+
* })
|
|
43
|
+
*
|
|
44
|
+
* const userOpHash = sendUserOperation(bundlerClient, {
|
|
45
|
+
* userOperation: signedUserOperation,
|
|
46
|
+
* entryPoint: entryPoint
|
|
47
|
+
* })
|
|
48
|
+
*
|
|
49
|
+
* // Return '0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34'
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
export declare const sendUserOperation: (client: BundlerClient, args: SendUserOperationParameters) => Promise<Hash>;
|
|
53
|
+
/**
|
|
54
|
+
* Estimates preVerificationGas, verificationGasLimit and callGasLimit for user operation
|
|
55
|
+
*
|
|
56
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/estimateUserOperationGas
|
|
57
|
+
*
|
|
58
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
59
|
+
* @param args {@link EstimateUserOperationGasParameters}
|
|
60
|
+
* @returns preVerificationGas, verificationGasLimit and callGasLimit as {@link EstimateUserOperationGasReturnType}
|
|
61
|
+
*
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* import { createClient } from "viem"
|
|
65
|
+
* import { sendUserOperation } from "permissionless/actions"
|
|
66
|
+
*
|
|
67
|
+
* const bundlerClient = createClient({
|
|
68
|
+
* chain: goerli,
|
|
69
|
+
* transport: http(BUNDLER_URL)
|
|
70
|
+
* })
|
|
71
|
+
*
|
|
72
|
+
* const gasParameters = estimateUserOperationGas(bundlerClient, {
|
|
73
|
+
* serOperation: signedUserOperation,
|
|
74
|
+
* entryPoint: entryPoint
|
|
75
|
+
* })
|
|
76
|
+
*
|
|
77
|
+
* // Return {preVerificationGas: 43492n, verificationGasLimit: 59436n, callGasLimit: 9000n}
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
export declare const estimateUserOperationGas: (client: BundlerClient, args: EstimateUserOperationGasParameters) => Promise<EstimateUserOperationGasReturnType>;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the supported entrypoints by the bundler service
|
|
83
|
+
*
|
|
84
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/supportedEntryPoints
|
|
85
|
+
*
|
|
86
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
87
|
+
* @returns Supported entryPoints
|
|
88
|
+
*
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* import { createClient } from "viem"
|
|
92
|
+
* import { sendUserOperation } from "permissionless/actions"
|
|
93
|
+
*
|
|
94
|
+
* const bundlerClient = createClient({
|
|
95
|
+
* chain: goerli,
|
|
96
|
+
* transport: http(BUNDLER_URL)
|
|
97
|
+
* })
|
|
98
|
+
*
|
|
99
|
+
* const entryPointsSupported = supportedEntryPoints(bundlerClient)
|
|
100
|
+
* // Return ['0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789']
|
|
101
|
+
*
|
|
102
|
+
*/
|
|
103
|
+
export declare const supportedEntryPoints: (client: BundlerClient) => Promise<Address[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Returns the supported chain id by the bundler service
|
|
106
|
+
*
|
|
107
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/chainId
|
|
108
|
+
*
|
|
109
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
110
|
+
* @returns Supported chain id
|
|
111
|
+
*
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* import { createClient } from "viem"
|
|
115
|
+
* import { sendUserOperation } from "permissionless/actions"
|
|
116
|
+
*
|
|
117
|
+
* const bundlerClient = createClient({
|
|
118
|
+
* chain: goerli,
|
|
119
|
+
* transport: http(BUNDLER_URL)
|
|
120
|
+
* })
|
|
121
|
+
*
|
|
122
|
+
* const chainId = chainId(bundlerClient)
|
|
123
|
+
* // Return 5n for Goerli
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
126
|
+
export declare const chainId: (client: BundlerClient) => Promise<bigint>;
|
|
127
|
+
/**
|
|
128
|
+
* Returns the user operation from userOpHash
|
|
129
|
+
*
|
|
130
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/getUserOperationByHash
|
|
131
|
+
*
|
|
132
|
+
* @param client {@link BundlerClient} that you created using viem's createClient and extended it with bundlerActions.
|
|
133
|
+
* @param args {@link GetUserOperationByHash} UserOpHash that was returned by {@link sendUserOperation}
|
|
134
|
+
* @returns userOperation along with entryPoint, transactionHash, blockHash, blockNumber if found or null
|
|
135
|
+
*
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* import { createClient } from "viem"
|
|
139
|
+
* import { sendUserOperation } from "permissionless/actions"
|
|
140
|
+
*
|
|
141
|
+
* const bundlerClient = createClient({
|
|
142
|
+
* chain: goerli,
|
|
143
|
+
* transport: http(BUNDLER_URL)
|
|
144
|
+
* })
|
|
145
|
+
*
|
|
146
|
+
* getUserOperationByHash(bundlerClient, {hash: userOpHash})
|
|
147
|
+
*
|
|
148
|
+
*/
|
|
149
|
+
export declare const getUserOperationByHash: (client: BundlerClient, { hash }: GetUserOperationByHash) => Promise<{
|
|
150
|
+
userOperation: UserOperation;
|
|
151
|
+
entryPoint: Address;
|
|
152
|
+
transactionHash: Hash;
|
|
153
|
+
blockHash: Hash;
|
|
154
|
+
blockNumber: bigint;
|
|
155
|
+
} | null>;
|
|
156
|
+
declare const bundlerActions: (client: Client) => {
|
|
157
|
+
/**
|
|
158
|
+
*
|
|
159
|
+
* Sends user operation to the bundler
|
|
160
|
+
*
|
|
161
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/sendUserOperation
|
|
162
|
+
*
|
|
163
|
+
* @param args {@link SendUserOperationParameters}.
|
|
164
|
+
* @returns UserOpHash that you can use to track user operation as {@link Hash}.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* import { createClient } from "viem"
|
|
168
|
+
* import { bundlerActions } from "permissionless"
|
|
169
|
+
*
|
|
170
|
+
* const bundlerClient = createClient({
|
|
171
|
+
* chain: goerli,
|
|
172
|
+
* transport: http(BUNDLER_URL)
|
|
173
|
+
* }).extend(bundlerActions)
|
|
174
|
+
*
|
|
175
|
+
* const userOpHash = await bundlerClient.sendUserOperation({
|
|
176
|
+
* userOperation: signedUserOperation,
|
|
177
|
+
* entryPoint: entryPoint
|
|
178
|
+
* })
|
|
179
|
+
*
|
|
180
|
+
* // Return '0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34'
|
|
181
|
+
*/
|
|
182
|
+
sendUserOperation: (args: SendUserOperationParameters) => Promise<Hash>;
|
|
183
|
+
/**
|
|
184
|
+
*
|
|
185
|
+
* Estimates preVerificationGas, verificationGasLimit and callGasLimit for user operation
|
|
186
|
+
*
|
|
187
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/estimateUserOperationGas
|
|
188
|
+
*
|
|
189
|
+
* @param args {@link EstimateUserOperationGasParameters}
|
|
190
|
+
* @returns preVerificationGas, verificationGasLimit and callGasLimit as {@link EstimateUserOperationGasReturnType}
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* import { createClient } from "viem"
|
|
194
|
+
* import { bundlerActions } from "permissionless"
|
|
195
|
+
*
|
|
196
|
+
* const bundlerClient = createClient({
|
|
197
|
+
* chain: goerli,
|
|
198
|
+
* transport: http(BUNDLER_URL)
|
|
199
|
+
* }).extend(bundlerActions)
|
|
200
|
+
*
|
|
201
|
+
* const gasParameters = await bundlerClient.estimateUserOperationGas({
|
|
202
|
+
* userOperation: signedUserOperation,
|
|
203
|
+
* entryPoint: entryPoint
|
|
204
|
+
* })
|
|
205
|
+
*
|
|
206
|
+
* // Return {preVerificationGas: 43492n, verificationGasLimit: 59436n, callGasLimit: 9000n}
|
|
207
|
+
*/
|
|
208
|
+
estimateUserOperationGas: (args: EstimateUserOperationGasParameters) => Promise<EstimateUserOperationGasReturnType>;
|
|
209
|
+
/**
|
|
210
|
+
*
|
|
211
|
+
* Returns the supported entrypoints by the bundler service
|
|
212
|
+
*
|
|
213
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/supportedEntryPoints
|
|
214
|
+
*
|
|
215
|
+
* @returns Supported entryPoints
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* import { createClient } from "viem"
|
|
219
|
+
* import { bundlerActions } from "permissionless"
|
|
220
|
+
*
|
|
221
|
+
* const bundlerClient = createClient({
|
|
222
|
+
* chain: goerli,
|
|
223
|
+
* transport: http(BUNDLER_URL)
|
|
224
|
+
* }).extend(bundlerActions)
|
|
225
|
+
*
|
|
226
|
+
* const supportedEntryPoints = await bundlerClient.supportedEntryPoints()
|
|
227
|
+
*
|
|
228
|
+
* // Return ['0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789']
|
|
229
|
+
*/
|
|
230
|
+
supportedEntryPoints: () => Promise<Address[]>;
|
|
231
|
+
/**
|
|
232
|
+
*
|
|
233
|
+
* Returns the supported chain id by the bundler service
|
|
234
|
+
*
|
|
235
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/chainId
|
|
236
|
+
*
|
|
237
|
+
* @returns Supported chain id
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* import { createClient } from "viem"
|
|
241
|
+
* import { bundlerActions } from "permissionless"
|
|
242
|
+
*
|
|
243
|
+
* const bundlerClient = createClient({
|
|
244
|
+
* chain: goerli,
|
|
245
|
+
* transport: http(BUNDLER_URL)
|
|
246
|
+
* }).extend(bundlerActions)
|
|
247
|
+
*
|
|
248
|
+
* const chainId = await bundlerClient.chainId()
|
|
249
|
+
* // Return 5n for Goerli
|
|
250
|
+
*/
|
|
251
|
+
chainId: () => Promise<bigint>;
|
|
252
|
+
/**
|
|
253
|
+
*
|
|
254
|
+
* Returns the user operation from userOpHash
|
|
255
|
+
*
|
|
256
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/getUserOperationByHash
|
|
257
|
+
*
|
|
258
|
+
* @param args {@link GetUserOperationByHash} UserOpHash that was returned by {@link sendUserOperation}
|
|
259
|
+
* @returns userOperation along with entryPoint, transactionHash, blockHash, blockNumber if found or null
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* import { createClient } from "viem"
|
|
263
|
+
* import { bundlerActions } from "permissionless"
|
|
264
|
+
*
|
|
265
|
+
* const bundlerClient = createClient({
|
|
266
|
+
* chain: goerli,
|
|
267
|
+
* transport: http(BUNDLER_URL)
|
|
268
|
+
* }).extend(bundlerActions)
|
|
269
|
+
*
|
|
270
|
+
* await bundlerClient.getUserOperationByHash(userOpHash)
|
|
271
|
+
*
|
|
272
|
+
*/
|
|
273
|
+
getUserOperationByHash: (args: GetUserOperationByHash) => Promise<{
|
|
274
|
+
userOperation: UserOperation;
|
|
275
|
+
entryPoint: Address;
|
|
276
|
+
transactionHash: Hash;
|
|
277
|
+
blockHash: Hash;
|
|
278
|
+
blockNumber: bigint;
|
|
279
|
+
} | null>;
|
|
280
|
+
/**
|
|
281
|
+
*
|
|
282
|
+
* Returns the user operation receipt from userOpHash
|
|
283
|
+
*
|
|
284
|
+
* - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/getUserOperationReceipt
|
|
285
|
+
*
|
|
286
|
+
* @param args {@link GetUserOperationReceipt} UserOpHash that was returned by {@link sendUserOperation}
|
|
287
|
+
* @returns user operation receipt {@link UserOperationReceipt} if found or null
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* import { createClient } from "viem"
|
|
291
|
+
* import { bundlerActions } from "permissionless"
|
|
292
|
+
*
|
|
293
|
+
* const bundlerClient = createClient({
|
|
294
|
+
* chain: goerli,
|
|
295
|
+
* transport: http(BUNDLER_URL)
|
|
296
|
+
* }).extend(bundlerActions)
|
|
297
|
+
*
|
|
298
|
+
* await bundlerClient.getUserOperationReceipt({hash: userOpHash})
|
|
299
|
+
*
|
|
300
|
+
*/
|
|
301
|
+
getUserOperationReceipt: (args: GetUserOperationReceipt) => Promise<UserOperationReceipt | null>;
|
|
302
|
+
};
|
|
303
|
+
export default bundlerActions;
|
|
304
|
+
//# sourceMappingURL=bundler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../actions/bundler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAIrD,MAAM,MAAM,2BAA2B,GAAG;IACtC,aAAa,EAAE,aAAa,CAAA;IAC5B,UAAU,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,kCAAkC,GAAG;IAC7C,aA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;;;;OAoBG;gCACuB,QAAQ,OAAO,EAAE,CAAC;IAC5C;;;;;;;;;;;;;;;;;;;OAmBG;;IAEH;;;;;;;;;;;;;;;;;;;;OAoBG;mCAC4B,sBAAsB;uBA7NtC,aAAa;oBAChB,OAAO;yBACF,IAAI;mBACV,IAAI;qBACF,MAAM;;IA0NnB;;;;;;;;;;;;;;;;;;;;OAoBG;oCAC6B,uBAAuB;CACzD,CAAA;AAEF,eAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import bundlerActions, { type EstimateUserOperationGasParameters, type EstimateUserOperationGasReturnType, type SendUserOperationParameters, chainId, estimateUserOperationGas, getUserOperationByHash, sendUserOperation, supportedEntryPoints } from "./bundler";
|
|
2
|
+
export { bundlerActions, type SendUserOperationParameters, type EstimateUserOperationGasParameters, type EstimateUserOperationGasReturnType, sendUserOperation, estimateUserOperationGas, supportedEntryPoints, chainId, getUserOperationByHash };
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,EAAE,EACnB,KAAK,kCAAkC,EACvC,KAAK,kCAAkC,EACvC,KAAK,2BAA2B,EAChC,OAAO,EACP,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACvB,MAAM,WAAW,CAAA;AAElB,OAAO,EACH,cAAc,EACd,KAAK,2BAA2B,EAChC,KAAK,kCAAkC,EACvC,KAAK,kCAAkC,EACvC,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,OAAO,EACP,sBAAsB,EACzB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../actions/utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAqBzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { Account, Address, Chain, Client, Hash, Hex, Transport } from "viem";
|
|
2
|
+
import type { PartialBy } from "viem/types/utils";
|
|
3
|
+
import type { UserOperationWithBigIntAsHex } from "./userOperation";
|
|
4
|
+
export type BundlerClient = Client<Transport, Chain | undefined, Account | undefined, BundlerRpcSchema>;
|
|
5
|
+
type BundlerRpcSchema = [
|
|
6
|
+
{
|
|
7
|
+
Method: "eth_sendUserOperation";
|
|
8
|
+
Parameters: [userOperation: UserOperationWithBigIntAsHex, entryPoint: Address];
|
|
9
|
+
ReturnType: Hash;
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
Method: "eth_estimateUserOperationGas";
|
|
13
|
+
Parameters: [
|
|
14
|
+
userOperation: PartialBy<UserOperationWithBigIntAsHex, "callGasLimit" | "preVerificationGas" | "verificationGasLimit">,
|
|
15
|
+
entryPoint: Address
|
|
16
|
+
];
|
|
17
|
+
ReturnType: {
|
|
18
|
+
preVerificationGas: Hex;
|
|
19
|
+
verificationGasLimit: Hex;
|
|
20
|
+
callGasLimit: Hex;
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
Method: "eth_supportedEntryPoints";
|
|
25
|
+
Parameters: [];
|
|
26
|
+
ReturnType: Address[];
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
Method: "eth_chainId";
|
|
30
|
+
Parameters: [];
|
|
31
|
+
ReturnType: Hex;
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
Method: "eth_getUserOperationByHash";
|
|
35
|
+
Parameters: [hash: Hash];
|
|
36
|
+
ReturnType: {
|
|
37
|
+
userOperation: UserOperationWithBigIntAsHex;
|
|
38
|
+
entryPoint: Address;
|
|
39
|
+
transactionHash: Hash;
|
|
40
|
+
blockHash: Hash;
|
|
41
|
+
blockNumber: Hex;
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
Method: "eth_getUserOperationReceipt";
|
|
46
|
+
Parameters: [hash: Hash];
|
|
47
|
+
ReturnType: UserOperationReceiptWithBigIntAsHex;
|
|
48
|
+
}
|
|
49
|
+
];
|
|
50
|
+
export type UserOperationReceipt = {
|
|
51
|
+
userOpHash: Hash;
|
|
52
|
+
sender: Address;
|
|
53
|
+
nonce: bigint;
|
|
54
|
+
actualGasUsed: bigint;
|
|
55
|
+
actualGasCost: bigint;
|
|
56
|
+
success: boolean;
|
|
57
|
+
receipt: {
|
|
58
|
+
transactionHash: Hex;
|
|
59
|
+
transactionIndex: bigint;
|
|
60
|
+
blockHash: Hash;
|
|
61
|
+
blockNumber: bigint;
|
|
62
|
+
from: Address;
|
|
63
|
+
to: Address | null;
|
|
64
|
+
cumulativeGasUsed: bigint;
|
|
65
|
+
status: bigint | null;
|
|
66
|
+
gasUsed: bigint;
|
|
67
|
+
contractAddress: Address | null;
|
|
68
|
+
logsBloom: string;
|
|
69
|
+
effectiveGasPrice: bigint;
|
|
70
|
+
};
|
|
71
|
+
logs: {
|
|
72
|
+
data: Hex;
|
|
73
|
+
blockNumber: bigint;
|
|
74
|
+
blockHash: Hash;
|
|
75
|
+
transactionHash: Hash;
|
|
76
|
+
logIndex: bigint;
|
|
77
|
+
transactionIndex: bigint;
|
|
78
|
+
address: Address;
|
|
79
|
+
topics: Hex[];
|
|
80
|
+
}[];
|
|
81
|
+
};
|
|
82
|
+
type UserOperationReceiptWithBigIntAsHex = {
|
|
83
|
+
userOpHash: Hash;
|
|
84
|
+
sender: Address;
|
|
85
|
+
nonce: Hex;
|
|
86
|
+
actualGasUsed: Hex;
|
|
87
|
+
actualGasCost: Hex;
|
|
88
|
+
success: boolean;
|
|
89
|
+
receipt: {
|
|
90
|
+
transactionHash: Hex;
|
|
91
|
+
transactionIndex: Hex;
|
|
92
|
+
blockHash: Hash;
|
|
93
|
+
blockNumber: Hex;
|
|
94
|
+
from: Address;
|
|
95
|
+
to: Address | null;
|
|
96
|
+
cumulativeGasUsed: Hex;
|
|
97
|
+
status: Hex | null;
|
|
98
|
+
gasUsed: Hex;
|
|
99
|
+
contractAddress: Address | null;
|
|
100
|
+
logsBloom: string;
|
|
101
|
+
effectiveGasPrice: Hex;
|
|
102
|
+
};
|
|
103
|
+
logs: {
|
|
104
|
+
data: Hex;
|
|
105
|
+
blockNumber: Hex;
|
|
106
|
+
blockHash: Hash;
|
|
107
|
+
transactionHash: Hash;
|
|
108
|
+
logIndex: Hex;
|
|
109
|
+
transactionIndex: Hex;
|
|
110
|
+
address: Address;
|
|
111
|
+
topics: Hex[];
|
|
112
|
+
}[];
|
|
113
|
+
};
|
|
114
|
+
export {};
|
|
115
|
+
//# sourceMappingURL=bundler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../types/bundler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAEnE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,OAAO,GAAG,SAAS,EAAE,gBAAgB,CAAC,CAAA;AAEvG,KAAK,gBAAgB,GAAG;IACpB;QACI,MAAM,EAAE,uBAAuB,CAAA;QAC/B,UAAU,EAAE,CAAC,aAAa,EAAE,4BAA4B,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QAC9E,UAAU,EAAE,IAAI,CAAA;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,iBAAiB,EAAE,GAAG,CAAA;KACzB,CAAA;IACD,IAAI,EAAE;QACF,IAAI,EAAE,GAAG,CAAA;QACT,WAAW,EAAE,GAAG,CAAA;QAChB,SAAS,EAAE,IAAI,CAAA;QACf,eAAe,EAAE,IAAI,CAAA;QACrB,QAAQ,EAAE,GAAG,CAAA;QACb,gBAAgB,EAAE,GAAG,CAAA;QACrB,OAAO,EAAE,OAAO,CAAA;QAChB,MAAM,EAAE,GAAG,EAAE,CAAA;KAChB,EAAE,CAAA;CACN,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Address } from "abitype";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
export type UserOperationWithBigIntAsHex = {
|
|
4
|
+
sender: Address;
|
|
5
|
+
nonce: Hex;
|
|
6
|
+
initCode: Hex;
|
|
7
|
+
callData: Hex;
|
|
8
|
+
callGasLimit: Hex;
|
|
9
|
+
verificationGasLimit: Hex;
|
|
10
|
+
preVerificationGas: Hex;
|
|
11
|
+
maxFeePerGas: Hex;
|
|
12
|
+
maxPriorityFeePerGas: Hex;
|
|
13
|
+
paymasterAndData: Hex;
|
|
14
|
+
signature: Hex;
|
|
15
|
+
};
|
|
16
|
+
export type UserOperation = {
|
|
17
|
+
sender: Address;
|
|
18
|
+
nonce: bigint;
|
|
19
|
+
initCode: Hex;
|
|
20
|
+
callData: Hex;
|
|
21
|
+
callGasLimit: bigint;
|
|
22
|
+
verificationGasLimit: bigint;
|
|
23
|
+
preVerificationGas: bigint;
|
|
24
|
+
maxFeePerGas: bigint;
|
|
25
|
+
maxPriorityFeePerGas: bigint;
|
|
26
|
+
paymasterAndData: Hex;
|
|
27
|
+
signature: Hex;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=userOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userOperation.d.ts","sourceRoot":"","sources":["../../types/userOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAE/B,MAAM,MAAM,4BAA4B,GAAG;IACvC,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,EAAE,GAAG,CAAA;IACb,QAAQ,EAAE,GAAG,CAAA;IACb,YAAY,EAAE,GAAG,CAAA;IACjB,oBAAoB,EAAE,GAAG,CAAA;IACzB,kBAAkB,EAAE,GAAG,CAAA;IACvB,YAAY,EAAE,GAAG,CAAA;IACjB,oBAAoB,EAAE,GAAG,CAAA;IACzB,gBAAgB,EAAE,GAAG,CAAA;IACrB,SAAS,EAAE,GAAG,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,GAAG,CAAA;IACb,QAAQ,EAAE,GAAG,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,gBAAgB,EAAE,GAAG,CAAA;IACrB,SAAS,EAAE,GAAG,CAAA;CACjB,CAAA"}
|