@gitmyabi/biz 1.0.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.
- package/README.md +108 -0
- package/contracts/Biz_json.d.ts +801 -0
- package/contracts/Biz_json.js +857 -0
- package/contracts/Biz_json.ts +1057 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +43 -0
|
@@ -0,0 +1,857 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Biz_json = exports.Biz_jsonAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* Biz_json ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.Biz_jsonAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "contract BizGuard",
|
|
15
|
+
"name": "_bizGuard",
|
|
16
|
+
"type": "address"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"stateMutability": "nonpayable",
|
|
20
|
+
"type": "constructor"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"inputs": [],
|
|
24
|
+
"name": "ECDSAInvalidSignature",
|
|
25
|
+
"type": "error"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"inputs": [
|
|
29
|
+
{
|
|
30
|
+
"internalType": "uint256",
|
|
31
|
+
"name": "length",
|
|
32
|
+
"type": "uint256"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"name": "ECDSAInvalidSignatureLength",
|
|
36
|
+
"type": "error"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"inputs": [
|
|
40
|
+
{
|
|
41
|
+
"internalType": "bytes32",
|
|
42
|
+
"name": "s",
|
|
43
|
+
"type": "bytes32"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"name": "ECDSAInvalidSignatureS",
|
|
47
|
+
"type": "error"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"inputs": [],
|
|
51
|
+
"name": "ERC4337Disabled",
|
|
52
|
+
"type": "error"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"inputs": [],
|
|
56
|
+
"name": "Invalid4337ExecutionSelector",
|
|
57
|
+
"type": "error"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"inputs": [],
|
|
61
|
+
"name": "InvalidERC4337Flag",
|
|
62
|
+
"type": "error"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"inputs": [],
|
|
66
|
+
"name": "InvalidSignature",
|
|
67
|
+
"type": "error"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"inputs": [],
|
|
71
|
+
"name": "OnlyEntryPoint",
|
|
72
|
+
"type": "error"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"inputs": [],
|
|
76
|
+
"name": "OnlySelf",
|
|
77
|
+
"type": "error"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"inputs": [],
|
|
81
|
+
"name": "ZeroAddressGuard",
|
|
82
|
+
"type": "error"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"stateMutability": "payable",
|
|
86
|
+
"type": "fallback"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"inputs": [],
|
|
90
|
+
"name": "accountId",
|
|
91
|
+
"outputs": [
|
|
92
|
+
{
|
|
93
|
+
"internalType": "string",
|
|
94
|
+
"name": "",
|
|
95
|
+
"type": "string"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"stateMutability": "pure",
|
|
99
|
+
"type": "function"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"inputs": [],
|
|
103
|
+
"name": "accountStorageBases",
|
|
104
|
+
"outputs": [
|
|
105
|
+
{
|
|
106
|
+
"internalType": "bytes32[]",
|
|
107
|
+
"name": "",
|
|
108
|
+
"type": "bytes32[]"
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"stateMutability": "view",
|
|
112
|
+
"type": "function"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"inputs": [],
|
|
116
|
+
"name": "bizGuard",
|
|
117
|
+
"outputs": [
|
|
118
|
+
{
|
|
119
|
+
"internalType": "contract BizGuard",
|
|
120
|
+
"name": "",
|
|
121
|
+
"type": "address"
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"stateMutability": "view",
|
|
125
|
+
"type": "function"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"inputs": [],
|
|
129
|
+
"name": "entryPoint",
|
|
130
|
+
"outputs": [
|
|
131
|
+
{
|
|
132
|
+
"internalType": "address",
|
|
133
|
+
"name": "",
|
|
134
|
+
"type": "address"
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"stateMutability": "view",
|
|
138
|
+
"type": "function"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"inputs": [
|
|
142
|
+
{
|
|
143
|
+
"internalType": "address",
|
|
144
|
+
"name": "target",
|
|
145
|
+
"type": "address"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"internalType": "uint256",
|
|
149
|
+
"name": "value",
|
|
150
|
+
"type": "uint256"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"internalType": "bytes",
|
|
154
|
+
"name": "data",
|
|
155
|
+
"type": "bytes"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"name": "execute",
|
|
159
|
+
"outputs": [],
|
|
160
|
+
"stateMutability": "payable",
|
|
161
|
+
"type": "function"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"inputs": [
|
|
165
|
+
{
|
|
166
|
+
"internalType": "address",
|
|
167
|
+
"name": "target",
|
|
168
|
+
"type": "address"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"internalType": "uint256",
|
|
172
|
+
"name": "value",
|
|
173
|
+
"type": "uint256"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"internalType": "bytes",
|
|
177
|
+
"name": "data",
|
|
178
|
+
"type": "bytes"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"name": "execute4337Op",
|
|
182
|
+
"outputs": [],
|
|
183
|
+
"stateMutability": "payable",
|
|
184
|
+
"type": "function"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"inputs": [
|
|
188
|
+
{
|
|
189
|
+
"components": [
|
|
190
|
+
{
|
|
191
|
+
"internalType": "address",
|
|
192
|
+
"name": "target",
|
|
193
|
+
"type": "address"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"internalType": "uint256",
|
|
197
|
+
"name": "value",
|
|
198
|
+
"type": "uint256"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"internalType": "bytes",
|
|
202
|
+
"name": "data",
|
|
203
|
+
"type": "bytes"
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"internalType": "struct Biz.Call[]",
|
|
207
|
+
"name": "calls",
|
|
208
|
+
"type": "tuple[]"
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"name": "execute4337Ops",
|
|
212
|
+
"outputs": [],
|
|
213
|
+
"stateMutability": "payable",
|
|
214
|
+
"type": "function"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"inputs": [
|
|
218
|
+
{
|
|
219
|
+
"components": [
|
|
220
|
+
{
|
|
221
|
+
"internalType": "address",
|
|
222
|
+
"name": "target",
|
|
223
|
+
"type": "address"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"internalType": "uint256",
|
|
227
|
+
"name": "value",
|
|
228
|
+
"type": "uint256"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"internalType": "bytes",
|
|
232
|
+
"name": "data",
|
|
233
|
+
"type": "bytes"
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
"internalType": "struct Biz.Call[]",
|
|
237
|
+
"name": "calls",
|
|
238
|
+
"type": "tuple[]"
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"name": "executeBatch",
|
|
242
|
+
"outputs": [],
|
|
243
|
+
"stateMutability": "payable",
|
|
244
|
+
"type": "function"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"inputs": [
|
|
248
|
+
{
|
|
249
|
+
"components": [
|
|
250
|
+
{
|
|
251
|
+
"internalType": "address",
|
|
252
|
+
"name": "target",
|
|
253
|
+
"type": "address"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"internalType": "uint256",
|
|
257
|
+
"name": "value",
|
|
258
|
+
"type": "uint256"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"internalType": "bytes",
|
|
262
|
+
"name": "data",
|
|
263
|
+
"type": "bytes"
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
"internalType": "struct Biz.Call[]",
|
|
267
|
+
"name": "calls",
|
|
268
|
+
"type": "tuple[]"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"internalType": "bytes",
|
|
272
|
+
"name": "signature",
|
|
273
|
+
"type": "bytes"
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"name": "executeWithSignature",
|
|
277
|
+
"outputs": [],
|
|
278
|
+
"stateMutability": "payable",
|
|
279
|
+
"type": "function"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"inputs": [
|
|
283
|
+
{
|
|
284
|
+
"internalType": "bytes32",
|
|
285
|
+
"name": "hash",
|
|
286
|
+
"type": "bytes32"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"internalType": "bytes",
|
|
290
|
+
"name": "signature",
|
|
291
|
+
"type": "bytes"
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
"name": "isValidSignature",
|
|
295
|
+
"outputs": [
|
|
296
|
+
{
|
|
297
|
+
"internalType": "bytes4",
|
|
298
|
+
"name": "isValid",
|
|
299
|
+
"type": "bytes4"
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
"stateMutability": "view",
|
|
303
|
+
"type": "function"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"inputs": [
|
|
307
|
+
{
|
|
308
|
+
"internalType": "address",
|
|
309
|
+
"name": "",
|
|
310
|
+
"type": "address"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"internalType": "address",
|
|
314
|
+
"name": "",
|
|
315
|
+
"type": "address"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"internalType": "uint256[]",
|
|
319
|
+
"name": "",
|
|
320
|
+
"type": "uint256[]"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"internalType": "uint256[]",
|
|
324
|
+
"name": "",
|
|
325
|
+
"type": "uint256[]"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"internalType": "bytes",
|
|
329
|
+
"name": "",
|
|
330
|
+
"type": "bytes"
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"name": "onERC1155BatchReceived",
|
|
334
|
+
"outputs": [
|
|
335
|
+
{
|
|
336
|
+
"internalType": "bytes4",
|
|
337
|
+
"name": "",
|
|
338
|
+
"type": "bytes4"
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
"stateMutability": "pure",
|
|
342
|
+
"type": "function"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"inputs": [
|
|
346
|
+
{
|
|
347
|
+
"internalType": "address",
|
|
348
|
+
"name": "",
|
|
349
|
+
"type": "address"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"internalType": "address",
|
|
353
|
+
"name": "",
|
|
354
|
+
"type": "address"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"internalType": "uint256",
|
|
358
|
+
"name": "",
|
|
359
|
+
"type": "uint256"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"internalType": "uint256",
|
|
363
|
+
"name": "",
|
|
364
|
+
"type": "uint256"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"internalType": "bytes",
|
|
368
|
+
"name": "",
|
|
369
|
+
"type": "bytes"
|
|
370
|
+
}
|
|
371
|
+
],
|
|
372
|
+
"name": "onERC1155Received",
|
|
373
|
+
"outputs": [
|
|
374
|
+
{
|
|
375
|
+
"internalType": "bytes4",
|
|
376
|
+
"name": "",
|
|
377
|
+
"type": "bytes4"
|
|
378
|
+
}
|
|
379
|
+
],
|
|
380
|
+
"stateMutability": "pure",
|
|
381
|
+
"type": "function"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"inputs": [
|
|
385
|
+
{
|
|
386
|
+
"internalType": "address",
|
|
387
|
+
"name": "",
|
|
388
|
+
"type": "address"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"internalType": "address",
|
|
392
|
+
"name": "",
|
|
393
|
+
"type": "address"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"internalType": "uint256",
|
|
397
|
+
"name": "",
|
|
398
|
+
"type": "uint256"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"internalType": "bytes",
|
|
402
|
+
"name": "",
|
|
403
|
+
"type": "bytes"
|
|
404
|
+
}
|
|
405
|
+
],
|
|
406
|
+
"name": "onERC721Received",
|
|
407
|
+
"outputs": [
|
|
408
|
+
{
|
|
409
|
+
"internalType": "bytes4",
|
|
410
|
+
"name": "",
|
|
411
|
+
"type": "bytes4"
|
|
412
|
+
}
|
|
413
|
+
],
|
|
414
|
+
"stateMutability": "pure",
|
|
415
|
+
"type": "function"
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"inputs": [
|
|
419
|
+
{
|
|
420
|
+
"internalType": "address",
|
|
421
|
+
"name": "",
|
|
422
|
+
"type": "address"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"internalType": "uint256",
|
|
426
|
+
"name": "",
|
|
427
|
+
"type": "uint256"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"internalType": "bytes",
|
|
431
|
+
"name": "",
|
|
432
|
+
"type": "bytes"
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
"name": "onTokenTransfer",
|
|
436
|
+
"outputs": [
|
|
437
|
+
{
|
|
438
|
+
"internalType": "bool",
|
|
439
|
+
"name": "",
|
|
440
|
+
"type": "bool"
|
|
441
|
+
}
|
|
442
|
+
],
|
|
443
|
+
"stateMutability": "pure",
|
|
444
|
+
"type": "function"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"inputs": [
|
|
448
|
+
{
|
|
449
|
+
"internalType": "bytes4",
|
|
450
|
+
"name": "interfaceId",
|
|
451
|
+
"type": "bytes4"
|
|
452
|
+
}
|
|
453
|
+
],
|
|
454
|
+
"name": "supportsInterface",
|
|
455
|
+
"outputs": [
|
|
456
|
+
{
|
|
457
|
+
"internalType": "bool",
|
|
458
|
+
"name": "",
|
|
459
|
+
"type": "bool"
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
"stateMutability": "view",
|
|
463
|
+
"type": "function"
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"inputs": [
|
|
467
|
+
{
|
|
468
|
+
"internalType": "address",
|
|
469
|
+
"name": "",
|
|
470
|
+
"type": "address"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"internalType": "address",
|
|
474
|
+
"name": "",
|
|
475
|
+
"type": "address"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"internalType": "address",
|
|
479
|
+
"name": "",
|
|
480
|
+
"type": "address"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"internalType": "uint256",
|
|
484
|
+
"name": "",
|
|
485
|
+
"type": "uint256"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"internalType": "bytes",
|
|
489
|
+
"name": "",
|
|
490
|
+
"type": "bytes"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"internalType": "bytes",
|
|
494
|
+
"name": "",
|
|
495
|
+
"type": "bytes"
|
|
496
|
+
}
|
|
497
|
+
],
|
|
498
|
+
"name": "tokensReceived",
|
|
499
|
+
"outputs": [],
|
|
500
|
+
"stateMutability": "pure",
|
|
501
|
+
"type": "function"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"inputs": [
|
|
505
|
+
{
|
|
506
|
+
"components": [
|
|
507
|
+
{
|
|
508
|
+
"internalType": "address",
|
|
509
|
+
"name": "sender",
|
|
510
|
+
"type": "address"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"internalType": "uint256",
|
|
514
|
+
"name": "nonce",
|
|
515
|
+
"type": "uint256"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"internalType": "bytes",
|
|
519
|
+
"name": "initCode",
|
|
520
|
+
"type": "bytes"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"internalType": "bytes",
|
|
524
|
+
"name": "callData",
|
|
525
|
+
"type": "bytes"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"internalType": "bytes32",
|
|
529
|
+
"name": "accountGasLimits",
|
|
530
|
+
"type": "bytes32"
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"internalType": "uint256",
|
|
534
|
+
"name": "preVerificationGas",
|
|
535
|
+
"type": "uint256"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"internalType": "bytes32",
|
|
539
|
+
"name": "gasFees",
|
|
540
|
+
"type": "bytes32"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"internalType": "bytes",
|
|
544
|
+
"name": "paymasterAndData",
|
|
545
|
+
"type": "bytes"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"internalType": "bytes",
|
|
549
|
+
"name": "signature",
|
|
550
|
+
"type": "bytes"
|
|
551
|
+
}
|
|
552
|
+
],
|
|
553
|
+
"internalType": "struct Biz.PackedUserOperation",
|
|
554
|
+
"name": "userOp",
|
|
555
|
+
"type": "tuple"
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
"internalType": "bytes32",
|
|
559
|
+
"name": "userOpHash",
|
|
560
|
+
"type": "bytes32"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"internalType": "uint256",
|
|
564
|
+
"name": "missingAccountFunds",
|
|
565
|
+
"type": "uint256"
|
|
566
|
+
}
|
|
567
|
+
],
|
|
568
|
+
"name": "validateUserOp",
|
|
569
|
+
"outputs": [
|
|
570
|
+
{
|
|
571
|
+
"internalType": "uint256",
|
|
572
|
+
"name": "validationData",
|
|
573
|
+
"type": "uint256"
|
|
574
|
+
}
|
|
575
|
+
],
|
|
576
|
+
"stateMutability": "nonpayable",
|
|
577
|
+
"type": "function"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"stateMutability": "payable",
|
|
581
|
+
"type": "receive"
|
|
582
|
+
}
|
|
583
|
+
];
|
|
584
|
+
/**
|
|
585
|
+
* Biz_json Contract Class
|
|
586
|
+
*
|
|
587
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
588
|
+
*
|
|
589
|
+
* @example
|
|
590
|
+
* ```typescript
|
|
591
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
592
|
+
* import { mainnet } from 'viem/chains';
|
|
593
|
+
* import { Biz_json } from 'Biz_json';
|
|
594
|
+
*
|
|
595
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
596
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
597
|
+
*
|
|
598
|
+
* const contract = new Biz_json('0x...', { publicClient, walletClient });
|
|
599
|
+
*
|
|
600
|
+
* // Read functions
|
|
601
|
+
* const result = await contract.balanceOf('0x...');
|
|
602
|
+
*
|
|
603
|
+
* // Write functions
|
|
604
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
605
|
+
*
|
|
606
|
+
* // Simulate transactions (dry-run)
|
|
607
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
608
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
609
|
+
*
|
|
610
|
+
* // Watch events
|
|
611
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
612
|
+
* console.log('Transfer event:', event);
|
|
613
|
+
* });
|
|
614
|
+
* ```
|
|
615
|
+
*/
|
|
616
|
+
class Biz_json {
|
|
617
|
+
constructor(address, clients) {
|
|
618
|
+
this.contractAddress = address;
|
|
619
|
+
this.publicClient = clients.publicClient;
|
|
620
|
+
this.contract = (0, viem_1.getContract)({
|
|
621
|
+
address,
|
|
622
|
+
abi: exports.Biz_jsonAbi,
|
|
623
|
+
client: {
|
|
624
|
+
public: clients.publicClient,
|
|
625
|
+
wallet: clients.walletClient,
|
|
626
|
+
},
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Get the contract address
|
|
631
|
+
*/
|
|
632
|
+
get address() {
|
|
633
|
+
return this.contractAddress;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Get the underlying viem contract instance
|
|
637
|
+
*/
|
|
638
|
+
getContract() {
|
|
639
|
+
return this.contract;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* accountId
|
|
643
|
+
* pure
|
|
644
|
+
*/
|
|
645
|
+
async accountId() {
|
|
646
|
+
return this.contract.read.accountId();
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* accountStorageBases
|
|
650
|
+
* view
|
|
651
|
+
*/
|
|
652
|
+
async accountStorageBases() {
|
|
653
|
+
return this.contract.read.accountStorageBases();
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* bizGuard
|
|
657
|
+
* view
|
|
658
|
+
*/
|
|
659
|
+
async bizGuard() {
|
|
660
|
+
return this.contract.read.bizGuard();
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* entryPoint
|
|
664
|
+
* view
|
|
665
|
+
*/
|
|
666
|
+
async entryPoint() {
|
|
667
|
+
return this.contract.read.entryPoint();
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* isValidSignature
|
|
671
|
+
* view
|
|
672
|
+
*/
|
|
673
|
+
async isValidSignature(hash, signature) {
|
|
674
|
+
return this.contract.read.isValidSignature([hash, signature]);
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* onERC1155BatchReceived
|
|
678
|
+
* pure
|
|
679
|
+
*/
|
|
680
|
+
async onERC1155BatchReceived(arg0, arg1, arg2, arg3, arg4) {
|
|
681
|
+
return this.contract.read.onERC1155BatchReceived([arg0, arg1, arg2, arg3, arg4]);
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* onERC1155Received
|
|
685
|
+
* pure
|
|
686
|
+
*/
|
|
687
|
+
async onERC1155Received(arg0, arg1, arg2, arg3, arg4) {
|
|
688
|
+
return this.contract.read.onERC1155Received([arg0, arg1, arg2, arg3, arg4]);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* onERC721Received
|
|
692
|
+
* pure
|
|
693
|
+
*/
|
|
694
|
+
async onERC721Received(arg0, arg1, arg2, arg3) {
|
|
695
|
+
return this.contract.read.onERC721Received([arg0, arg1, arg2, arg3]);
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* onTokenTransfer
|
|
699
|
+
* pure
|
|
700
|
+
*/
|
|
701
|
+
async onTokenTransfer(arg0, arg1, arg2) {
|
|
702
|
+
return this.contract.read.onTokenTransfer([arg0, arg1, arg2]);
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* supportsInterface
|
|
706
|
+
* view
|
|
707
|
+
*/
|
|
708
|
+
async supportsInterface(interfaceId) {
|
|
709
|
+
return this.contract.read.supportsInterface([interfaceId]);
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* tokensReceived
|
|
713
|
+
* pure
|
|
714
|
+
*/
|
|
715
|
+
async tokensReceived(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
716
|
+
return this.contract.read.tokensReceived([arg0, arg1, arg2, arg3, arg4, arg5]);
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* execute
|
|
720
|
+
* payable
|
|
721
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
722
|
+
*/
|
|
723
|
+
async execute(target, value, data, options) {
|
|
724
|
+
if (!this.contract.write) {
|
|
725
|
+
throw new Error('Wallet client is required for write operations');
|
|
726
|
+
}
|
|
727
|
+
return this.contract.write.execute([target, value, data], options);
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* execute4337Op
|
|
731
|
+
* payable
|
|
732
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
733
|
+
*/
|
|
734
|
+
async execute4337Op(target, value, data, options) {
|
|
735
|
+
if (!this.contract.write) {
|
|
736
|
+
throw new Error('Wallet client is required for write operations');
|
|
737
|
+
}
|
|
738
|
+
return this.contract.write.execute4337Op([target, value, data], options);
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* execute4337Ops
|
|
742
|
+
* payable
|
|
743
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
744
|
+
*/
|
|
745
|
+
async execute4337Ops(calls, options) {
|
|
746
|
+
if (!this.contract.write) {
|
|
747
|
+
throw new Error('Wallet client is required for write operations');
|
|
748
|
+
}
|
|
749
|
+
return this.contract.write.execute4337Ops([calls], options);
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* executeBatch
|
|
753
|
+
* payable
|
|
754
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
755
|
+
*/
|
|
756
|
+
async executeBatch(calls, options) {
|
|
757
|
+
if (!this.contract.write) {
|
|
758
|
+
throw new Error('Wallet client is required for write operations');
|
|
759
|
+
}
|
|
760
|
+
return this.contract.write.executeBatch([calls], options);
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* executeWithSignature
|
|
764
|
+
* payable
|
|
765
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
766
|
+
*/
|
|
767
|
+
async executeWithSignature(calls, signature, options) {
|
|
768
|
+
if (!this.contract.write) {
|
|
769
|
+
throw new Error('Wallet client is required for write operations');
|
|
770
|
+
}
|
|
771
|
+
return this.contract.write.executeWithSignature([calls, signature], options);
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* validateUserOp
|
|
775
|
+
* nonpayable
|
|
776
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
777
|
+
*/
|
|
778
|
+
async validateUserOp(userOp, userOpHash, missingAccountFunds, options) {
|
|
779
|
+
if (!this.contract.write) {
|
|
780
|
+
throw new Error('Wallet client is required for write operations');
|
|
781
|
+
}
|
|
782
|
+
return this.contract.write.validateUserOp([userOp, userOpHash, missingAccountFunds], options);
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
786
|
+
*
|
|
787
|
+
* @example
|
|
788
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
789
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
790
|
+
* console.log('Would succeed:', result.result);
|
|
791
|
+
*/
|
|
792
|
+
get simulate() {
|
|
793
|
+
const contract = this.contract;
|
|
794
|
+
if (!contract.simulate) {
|
|
795
|
+
throw new Error('Public client is required for simulation');
|
|
796
|
+
}
|
|
797
|
+
return {
|
|
798
|
+
/**
|
|
799
|
+
* Simulate execute
|
|
800
|
+
* Returns gas estimate and result without sending transaction
|
|
801
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
802
|
+
*/
|
|
803
|
+
async execute(target, value, data, options) {
|
|
804
|
+
return contract.simulate.execute([target, value, data], options);
|
|
805
|
+
},
|
|
806
|
+
/**
|
|
807
|
+
* Simulate execute4337Op
|
|
808
|
+
* Returns gas estimate and result without sending transaction
|
|
809
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
810
|
+
*/
|
|
811
|
+
async execute4337Op(target, value, data, options) {
|
|
812
|
+
return contract.simulate.execute4337Op([target, value, data], options);
|
|
813
|
+
},
|
|
814
|
+
/**
|
|
815
|
+
* Simulate execute4337Ops
|
|
816
|
+
* Returns gas estimate and result without sending transaction
|
|
817
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
818
|
+
*/
|
|
819
|
+
async execute4337Ops(calls, options) {
|
|
820
|
+
return contract.simulate.execute4337Ops([calls], options);
|
|
821
|
+
},
|
|
822
|
+
/**
|
|
823
|
+
* Simulate executeBatch
|
|
824
|
+
* Returns gas estimate and result without sending transaction
|
|
825
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
826
|
+
*/
|
|
827
|
+
async executeBatch(calls, options) {
|
|
828
|
+
return contract.simulate.executeBatch([calls], options);
|
|
829
|
+
},
|
|
830
|
+
/**
|
|
831
|
+
* Simulate executeWithSignature
|
|
832
|
+
* Returns gas estimate and result without sending transaction
|
|
833
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
834
|
+
*/
|
|
835
|
+
async executeWithSignature(calls, signature, options) {
|
|
836
|
+
return contract.simulate.executeWithSignature([calls, signature], options);
|
|
837
|
+
},
|
|
838
|
+
/**
|
|
839
|
+
* Simulate validateUserOp
|
|
840
|
+
* Returns gas estimate and result without sending transaction
|
|
841
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
842
|
+
*/
|
|
843
|
+
async validateUserOp(userOp, userOpHash, missingAccountFunds, options) {
|
|
844
|
+
return contract.simulate.validateUserOp([userOp, userOpHash, missingAccountFunds], options);
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Watch contract events
|
|
850
|
+
*
|
|
851
|
+
* Note: This contract has no events, so watch returns an empty object.
|
|
852
|
+
*/
|
|
853
|
+
get watch() {
|
|
854
|
+
return {};
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
exports.Biz_json = Biz_json;
|