@gitmyabi/kernel 1.0.17 → 1.0.18

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.
@@ -1,1178 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Kernel_json = exports.Kernel_jsonAbi = void 0;
4
- const viem_1 = require("viem");
5
- /**
6
- * Kernel_json ABI
7
- *
8
- * This ABI is typed using viem's type system for full type safety.
9
- */
10
- exports.Kernel_jsonAbi = [
11
- {
12
- "inputs": [
13
- {
14
- "internalType": "contract IEntryPoint",
15
- "name": "_entryPoint",
16
- "type": "address"
17
- }
18
- ],
19
- "stateMutability": "nonpayable",
20
- "type": "constructor"
21
- },
22
- {
23
- "inputs": [],
24
- "name": "AlreadyInitialized",
25
- "type": "error"
26
- },
27
- {
28
- "inputs": [],
29
- "name": "DeprecatedOperation",
30
- "type": "error"
31
- },
32
- {
33
- "inputs": [],
34
- "name": "DisabledMode",
35
- "type": "error"
36
- },
37
- {
38
- "inputs": [],
39
- "name": "NotAuthorizedCaller",
40
- "type": "error"
41
- },
42
- {
43
- "inputs": [],
44
- "name": "NotEntryPoint",
45
- "type": "error"
46
- },
47
- {
48
- "anonymous": false,
49
- "inputs": [
50
- {
51
- "indexed": true,
52
- "internalType": "address",
53
- "name": "oldValidator",
54
- "type": "address"
55
- },
56
- {
57
- "indexed": true,
58
- "internalType": "address",
59
- "name": "newValidator",
60
- "type": "address"
61
- }
62
- ],
63
- "name": "DefaultValidatorChanged",
64
- "type": "event"
65
- },
66
- {
67
- "anonymous": false,
68
- "inputs": [
69
- {
70
- "indexed": true,
71
- "internalType": "bytes4",
72
- "name": "selector",
73
- "type": "bytes4"
74
- },
75
- {
76
- "indexed": true,
77
- "internalType": "address",
78
- "name": "executor",
79
- "type": "address"
80
- },
81
- {
82
- "indexed": true,
83
- "internalType": "address",
84
- "name": "validator",
85
- "type": "address"
86
- }
87
- ],
88
- "name": "ExecutionChanged",
89
- "type": "event"
90
- },
91
- {
92
- "anonymous": false,
93
- "inputs": [
94
- {
95
- "indexed": false,
96
- "internalType": "address",
97
- "name": "sender",
98
- "type": "address"
99
- },
100
- {
101
- "indexed": false,
102
- "internalType": "uint256",
103
- "name": "amount",
104
- "type": "uint256"
105
- }
106
- ],
107
- "name": "Received",
108
- "type": "event"
109
- },
110
- {
111
- "anonymous": false,
112
- "inputs": [
113
- {
114
- "indexed": true,
115
- "internalType": "address",
116
- "name": "newImplementation",
117
- "type": "address"
118
- }
119
- ],
120
- "name": "Upgraded",
121
- "type": "event"
122
- },
123
- {
124
- "stateMutability": "payable",
125
- "type": "fallback"
126
- },
127
- {
128
- "inputs": [
129
- {
130
- "internalType": "bytes4",
131
- "name": "_disableFlag",
132
- "type": "bytes4"
133
- }
134
- ],
135
- "name": "disableMode",
136
- "outputs": [],
137
- "stateMutability": "payable",
138
- "type": "function"
139
- },
140
- {
141
- "inputs": [],
142
- "name": "eip712Domain",
143
- "outputs": [
144
- {
145
- "internalType": "bytes1",
146
- "name": "fields",
147
- "type": "bytes1"
148
- },
149
- {
150
- "internalType": "string",
151
- "name": "name",
152
- "type": "string"
153
- },
154
- {
155
- "internalType": "string",
156
- "name": "version",
157
- "type": "string"
158
- },
159
- {
160
- "internalType": "uint256",
161
- "name": "chainId",
162
- "type": "uint256"
163
- },
164
- {
165
- "internalType": "address",
166
- "name": "verifyingContract",
167
- "type": "address"
168
- },
169
- {
170
- "internalType": "bytes32",
171
- "name": "salt",
172
- "type": "bytes32"
173
- },
174
- {
175
- "internalType": "uint256[]",
176
- "name": "extensions",
177
- "type": "uint256[]"
178
- }
179
- ],
180
- "stateMutability": "view",
181
- "type": "function"
182
- },
183
- {
184
- "inputs": [],
185
- "name": "entryPoint",
186
- "outputs": [
187
- {
188
- "internalType": "contract IEntryPoint",
189
- "name": "",
190
- "type": "address"
191
- }
192
- ],
193
- "stateMutability": "view",
194
- "type": "function"
195
- },
196
- {
197
- "inputs": [
198
- {
199
- "internalType": "address",
200
- "name": "to",
201
- "type": "address"
202
- },
203
- {
204
- "internalType": "uint256",
205
- "name": "value",
206
- "type": "uint256"
207
- },
208
- {
209
- "internalType": "bytes",
210
- "name": "data",
211
- "type": "bytes"
212
- },
213
- {
214
- "internalType": "enum Operation",
215
- "name": "_operation",
216
- "type": "uint8"
217
- }
218
- ],
219
- "name": "execute",
220
- "outputs": [],
221
- "stateMutability": "payable",
222
- "type": "function"
223
- },
224
- {
225
- "inputs": [
226
- {
227
- "components": [
228
- {
229
- "internalType": "address",
230
- "name": "to",
231
- "type": "address"
232
- },
233
- {
234
- "internalType": "uint256",
235
- "name": "value",
236
- "type": "uint256"
237
- },
238
- {
239
- "internalType": "bytes",
240
- "name": "data",
241
- "type": "bytes"
242
- }
243
- ],
244
- "internalType": "struct Call[]",
245
- "name": "calls",
246
- "type": "tuple[]"
247
- }
248
- ],
249
- "name": "executeBatch",
250
- "outputs": [],
251
- "stateMutability": "payable",
252
- "type": "function"
253
- },
254
- {
255
- "inputs": [
256
- {
257
- "internalType": "address",
258
- "name": "to",
259
- "type": "address"
260
- },
261
- {
262
- "internalType": "bytes",
263
- "name": "data",
264
- "type": "bytes"
265
- }
266
- ],
267
- "name": "executeDelegateCall",
268
- "outputs": [],
269
- "stateMutability": "payable",
270
- "type": "function"
271
- },
272
- {
273
- "inputs": [],
274
- "name": "getDefaultValidator",
275
- "outputs": [
276
- {
277
- "internalType": "contract IKernelValidator",
278
- "name": "validator",
279
- "type": "address"
280
- }
281
- ],
282
- "stateMutability": "view",
283
- "type": "function"
284
- },
285
- {
286
- "inputs": [],
287
- "name": "getDisabledMode",
288
- "outputs": [
289
- {
290
- "internalType": "bytes4",
291
- "name": "disabled",
292
- "type": "bytes4"
293
- }
294
- ],
295
- "stateMutability": "view",
296
- "type": "function"
297
- },
298
- {
299
- "inputs": [
300
- {
301
- "internalType": "bytes4",
302
- "name": "_selector",
303
- "type": "bytes4"
304
- }
305
- ],
306
- "name": "getExecution",
307
- "outputs": [
308
- {
309
- "components": [
310
- {
311
- "internalType": "ValidAfter",
312
- "name": "validAfter",
313
- "type": "uint48"
314
- },
315
- {
316
- "internalType": "ValidUntil",
317
- "name": "validUntil",
318
- "type": "uint48"
319
- },
320
- {
321
- "internalType": "address",
322
- "name": "executor",
323
- "type": "address"
324
- },
325
- {
326
- "internalType": "contract IKernelValidator",
327
- "name": "validator",
328
- "type": "address"
329
- }
330
- ],
331
- "internalType": "struct ExecutionDetail",
332
- "name": "",
333
- "type": "tuple"
334
- }
335
- ],
336
- "stateMutability": "view",
337
- "type": "function"
338
- },
339
- {
340
- "inputs": [],
341
- "name": "getLastDisabledTime",
342
- "outputs": [
343
- {
344
- "internalType": "uint48",
345
- "name": "",
346
- "type": "uint48"
347
- }
348
- ],
349
- "stateMutability": "view",
350
- "type": "function"
351
- },
352
- {
353
- "inputs": [
354
- {
355
- "internalType": "uint192",
356
- "name": "key",
357
- "type": "uint192"
358
- }
359
- ],
360
- "name": "getNonce",
361
- "outputs": [
362
- {
363
- "internalType": "uint256",
364
- "name": "",
365
- "type": "uint256"
366
- }
367
- ],
368
- "stateMutability": "view",
369
- "type": "function"
370
- },
371
- {
372
- "inputs": [],
373
- "name": "getNonce",
374
- "outputs": [
375
- {
376
- "internalType": "uint256",
377
- "name": "",
378
- "type": "uint256"
379
- }
380
- ],
381
- "stateMutability": "view",
382
- "type": "function"
383
- },
384
- {
385
- "inputs": [
386
- {
387
- "internalType": "contract IKernelValidator",
388
- "name": "_defaultValidator",
389
- "type": "address"
390
- },
391
- {
392
- "internalType": "bytes",
393
- "name": "_data",
394
- "type": "bytes"
395
- }
396
- ],
397
- "name": "initialize",
398
- "outputs": [],
399
- "stateMutability": "payable",
400
- "type": "function"
401
- },
402
- {
403
- "inputs": [
404
- {
405
- "internalType": "bytes32",
406
- "name": "hash",
407
- "type": "bytes32"
408
- },
409
- {
410
- "internalType": "bytes",
411
- "name": "signature",
412
- "type": "bytes"
413
- }
414
- ],
415
- "name": "isValidSignature",
416
- "outputs": [
417
- {
418
- "internalType": "bytes4",
419
- "name": "",
420
- "type": "bytes4"
421
- }
422
- ],
423
- "stateMutability": "view",
424
- "type": "function"
425
- },
426
- {
427
- "inputs": [],
428
- "name": "name",
429
- "outputs": [
430
- {
431
- "internalType": "string",
432
- "name": "",
433
- "type": "string"
434
- }
435
- ],
436
- "stateMutability": "view",
437
- "type": "function"
438
- },
439
- {
440
- "inputs": [
441
- {
442
- "internalType": "address",
443
- "name": "",
444
- "type": "address"
445
- },
446
- {
447
- "internalType": "address",
448
- "name": "",
449
- "type": "address"
450
- },
451
- {
452
- "internalType": "uint256[]",
453
- "name": "",
454
- "type": "uint256[]"
455
- },
456
- {
457
- "internalType": "uint256[]",
458
- "name": "",
459
- "type": "uint256[]"
460
- },
461
- {
462
- "internalType": "bytes",
463
- "name": "",
464
- "type": "bytes"
465
- }
466
- ],
467
- "name": "onERC1155BatchReceived",
468
- "outputs": [
469
- {
470
- "internalType": "bytes4",
471
- "name": "",
472
- "type": "bytes4"
473
- }
474
- ],
475
- "stateMutability": "pure",
476
- "type": "function"
477
- },
478
- {
479
- "inputs": [
480
- {
481
- "internalType": "address",
482
- "name": "",
483
- "type": "address"
484
- },
485
- {
486
- "internalType": "address",
487
- "name": "",
488
- "type": "address"
489
- },
490
- {
491
- "internalType": "uint256",
492
- "name": "",
493
- "type": "uint256"
494
- },
495
- {
496
- "internalType": "uint256",
497
- "name": "",
498
- "type": "uint256"
499
- },
500
- {
501
- "internalType": "bytes",
502
- "name": "",
503
- "type": "bytes"
504
- }
505
- ],
506
- "name": "onERC1155Received",
507
- "outputs": [
508
- {
509
- "internalType": "bytes4",
510
- "name": "",
511
- "type": "bytes4"
512
- }
513
- ],
514
- "stateMutability": "pure",
515
- "type": "function"
516
- },
517
- {
518
- "inputs": [
519
- {
520
- "internalType": "address",
521
- "name": "",
522
- "type": "address"
523
- },
524
- {
525
- "internalType": "address",
526
- "name": "",
527
- "type": "address"
528
- },
529
- {
530
- "internalType": "uint256",
531
- "name": "",
532
- "type": "uint256"
533
- },
534
- {
535
- "internalType": "bytes",
536
- "name": "",
537
- "type": "bytes"
538
- }
539
- ],
540
- "name": "onERC721Received",
541
- "outputs": [
542
- {
543
- "internalType": "bytes4",
544
- "name": "",
545
- "type": "bytes4"
546
- }
547
- ],
548
- "stateMutability": "pure",
549
- "type": "function"
550
- },
551
- {
552
- "inputs": [
553
- {
554
- "internalType": "contract IKernelValidator",
555
- "name": "_defaultValidator",
556
- "type": "address"
557
- },
558
- {
559
- "internalType": "bytes",
560
- "name": "_data",
561
- "type": "bytes"
562
- }
563
- ],
564
- "name": "setDefaultValidator",
565
- "outputs": [],
566
- "stateMutability": "payable",
567
- "type": "function"
568
- },
569
- {
570
- "inputs": [
571
- {
572
- "internalType": "bytes4",
573
- "name": "_selector",
574
- "type": "bytes4"
575
- },
576
- {
577
- "internalType": "address",
578
- "name": "_executor",
579
- "type": "address"
580
- },
581
- {
582
- "internalType": "contract IKernelValidator",
583
- "name": "_validator",
584
- "type": "address"
585
- },
586
- {
587
- "internalType": "ValidUntil",
588
- "name": "_validUntil",
589
- "type": "uint48"
590
- },
591
- {
592
- "internalType": "ValidAfter",
593
- "name": "_validAfter",
594
- "type": "uint48"
595
- },
596
- {
597
- "internalType": "bytes",
598
- "name": "_enableData",
599
- "type": "bytes"
600
- }
601
- ],
602
- "name": "setExecution",
603
- "outputs": [],
604
- "stateMutability": "payable",
605
- "type": "function"
606
- },
607
- {
608
- "inputs": [
609
- {
610
- "internalType": "address",
611
- "name": "_newImplementation",
612
- "type": "address"
613
- }
614
- ],
615
- "name": "upgradeTo",
616
- "outputs": [],
617
- "stateMutability": "payable",
618
- "type": "function"
619
- },
620
- {
621
- "inputs": [
622
- {
623
- "internalType": "bytes32",
624
- "name": "hash",
625
- "type": "bytes32"
626
- },
627
- {
628
- "internalType": "bytes",
629
- "name": "signature",
630
- "type": "bytes"
631
- }
632
- ],
633
- "name": "validateSignature",
634
- "outputs": [
635
- {
636
- "internalType": "ValidationData",
637
- "name": "",
638
- "type": "uint256"
639
- }
640
- ],
641
- "stateMutability": "view",
642
- "type": "function"
643
- },
644
- {
645
- "inputs": [
646
- {
647
- "components": [
648
- {
649
- "internalType": "address",
650
- "name": "sender",
651
- "type": "address"
652
- },
653
- {
654
- "internalType": "uint256",
655
- "name": "nonce",
656
- "type": "uint256"
657
- },
658
- {
659
- "internalType": "bytes",
660
- "name": "initCode",
661
- "type": "bytes"
662
- },
663
- {
664
- "internalType": "bytes",
665
- "name": "callData",
666
- "type": "bytes"
667
- },
668
- {
669
- "internalType": "uint256",
670
- "name": "callGasLimit",
671
- "type": "uint256"
672
- },
673
- {
674
- "internalType": "uint256",
675
- "name": "verificationGasLimit",
676
- "type": "uint256"
677
- },
678
- {
679
- "internalType": "uint256",
680
- "name": "preVerificationGas",
681
- "type": "uint256"
682
- },
683
- {
684
- "internalType": "uint256",
685
- "name": "maxFeePerGas",
686
- "type": "uint256"
687
- },
688
- {
689
- "internalType": "uint256",
690
- "name": "maxPriorityFeePerGas",
691
- "type": "uint256"
692
- },
693
- {
694
- "internalType": "bytes",
695
- "name": "paymasterAndData",
696
- "type": "bytes"
697
- },
698
- {
699
- "internalType": "bytes",
700
- "name": "signature",
701
- "type": "bytes"
702
- }
703
- ],
704
- "internalType": "struct UserOperation",
705
- "name": "_userOp",
706
- "type": "tuple"
707
- },
708
- {
709
- "internalType": "bytes32",
710
- "name": "userOpHash",
711
- "type": "bytes32"
712
- },
713
- {
714
- "internalType": "uint256",
715
- "name": "missingAccountFunds",
716
- "type": "uint256"
717
- }
718
- ],
719
- "name": "validateUserOp",
720
- "outputs": [
721
- {
722
- "internalType": "ValidationData",
723
- "name": "validationData",
724
- "type": "uint256"
725
- }
726
- ],
727
- "stateMutability": "payable",
728
- "type": "function"
729
- },
730
- {
731
- "inputs": [],
732
- "name": "version",
733
- "outputs": [
734
- {
735
- "internalType": "string",
736
- "name": "",
737
- "type": "string"
738
- }
739
- ],
740
- "stateMutability": "view",
741
- "type": "function"
742
- },
743
- {
744
- "stateMutability": "payable",
745
- "type": "receive"
746
- }
747
- ];
748
- /**
749
- * Kernel_json Contract Class
750
- *
751
- * Provides a class-based API similar to TypeChain for interacting with the contract.
752
- *
753
- * @example
754
- * ```typescript
755
- * import { createPublicClient, createWalletClient, http } from 'viem';
756
- * import { mainnet } from 'viem/chains';
757
- * import { Kernel_json } from 'Kernel_json';
758
- *
759
- * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
760
- * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
761
- *
762
- * const contract = new Kernel_json('0x...', { publicClient, walletClient });
763
- *
764
- * // Read functions
765
- * const result = await contract.balanceOf('0x...');
766
- *
767
- * // Write functions
768
- * const hash = await contract.transfer('0x...', 1000n);
769
- *
770
- * // Simulate transactions (dry-run)
771
- * const simulation = await contract.simulate.transfer('0x...', 1000n);
772
- * console.log('Gas estimate:', simulation.request.gas);
773
- *
774
- * // Watch events
775
- * const unwatch = contract.watch.Transfer((event) => {
776
- * console.log('Transfer event:', event);
777
- * });
778
- * ```
779
- */
780
- class Kernel_json {
781
- constructor(address, clients) {
782
- this.contractAddress = address;
783
- this.publicClient = clients.publicClient;
784
- this.contract = (0, viem_1.getContract)({
785
- address,
786
- abi: exports.Kernel_jsonAbi,
787
- client: {
788
- public: clients.publicClient,
789
- wallet: clients.walletClient,
790
- },
791
- });
792
- }
793
- /**
794
- * Get the contract address
795
- */
796
- get address() {
797
- return this.contractAddress;
798
- }
799
- /**
800
- * Get the underlying viem contract instance
801
- */
802
- getContract() {
803
- return this.contract;
804
- }
805
- /**
806
- * eip712Domain
807
- * view
808
- */
809
- async eip712Domain() {
810
- return this.contract.read.eip712Domain();
811
- }
812
- /**
813
- * entryPoint
814
- * view
815
- */
816
- async entryPoint() {
817
- return this.contract.read.entryPoint();
818
- }
819
- /**
820
- * getDefaultValidator
821
- * view
822
- */
823
- async getDefaultValidator() {
824
- return this.contract.read.getDefaultValidator();
825
- }
826
- /**
827
- * getDisabledMode
828
- * view
829
- */
830
- async getDisabledMode() {
831
- return this.contract.read.getDisabledMode();
832
- }
833
- /**
834
- * getExecution
835
- * view
836
- */
837
- async getExecution(_selector) {
838
- return this.contract.read.getExecution([_selector]);
839
- }
840
- /**
841
- * getLastDisabledTime
842
- * view
843
- */
844
- async getLastDisabledTime() {
845
- return this.contract.read.getLastDisabledTime();
846
- }
847
- async getNonce(...args) {
848
- return this.contract.read.getNonce(args);
849
- }
850
- /**
851
- * isValidSignature
852
- * view
853
- */
854
- async isValidSignature(hash, signature) {
855
- return this.contract.read.isValidSignature([hash, signature]);
856
- }
857
- /**
858
- * name
859
- * view
860
- */
861
- async name() {
862
- return this.contract.read.name();
863
- }
864
- /**
865
- * onERC1155BatchReceived
866
- * pure
867
- */
868
- async onERC1155BatchReceived(arg0, arg1, arg2, arg3, arg4) {
869
- return this.contract.read.onERC1155BatchReceived([arg0, arg1, arg2, arg3, arg4]);
870
- }
871
- /**
872
- * onERC1155Received
873
- * pure
874
- */
875
- async onERC1155Received(arg0, arg1, arg2, arg3, arg4) {
876
- return this.contract.read.onERC1155Received([arg0, arg1, arg2, arg3, arg4]);
877
- }
878
- /**
879
- * onERC721Received
880
- * pure
881
- */
882
- async onERC721Received(arg0, arg1, arg2, arg3) {
883
- return this.contract.read.onERC721Received([arg0, arg1, arg2, arg3]);
884
- }
885
- /**
886
- * validateSignature
887
- * view
888
- */
889
- async validateSignature(hash, signature) {
890
- return this.contract.read.validateSignature([hash, signature]);
891
- }
892
- /**
893
- * version
894
- * view
895
- */
896
- async version() {
897
- return this.contract.read.version();
898
- }
899
- /**
900
- * disableMode
901
- * payable
902
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
903
- */
904
- async disableMode(_disableFlag, options) {
905
- if (!this.contract.write) {
906
- throw new Error('Wallet client is required for write operations');
907
- }
908
- return this.contract.write.disableMode([_disableFlag], options);
909
- }
910
- /**
911
- * execute
912
- * payable
913
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
914
- */
915
- async execute(to, value, data, _operation, options) {
916
- if (!this.contract.write) {
917
- throw new Error('Wallet client is required for write operations');
918
- }
919
- return this.contract.write.execute([to, value, data, _operation], options);
920
- }
921
- /**
922
- * executeBatch
923
- * payable
924
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
925
- */
926
- async executeBatch(calls, options) {
927
- if (!this.contract.write) {
928
- throw new Error('Wallet client is required for write operations');
929
- }
930
- return this.contract.write.executeBatch([calls], options);
931
- }
932
- /**
933
- * executeDelegateCall
934
- * payable
935
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
936
- */
937
- async executeDelegateCall(to, data, options) {
938
- if (!this.contract.write) {
939
- throw new Error('Wallet client is required for write operations');
940
- }
941
- return this.contract.write.executeDelegateCall([to, data], options);
942
- }
943
- /**
944
- * initialize
945
- * payable
946
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
947
- */
948
- async initialize(_defaultValidator, _data, options) {
949
- if (!this.contract.write) {
950
- throw new Error('Wallet client is required for write operations');
951
- }
952
- return this.contract.write.initialize([_defaultValidator, _data], options);
953
- }
954
- /**
955
- * setDefaultValidator
956
- * payable
957
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
958
- */
959
- async setDefaultValidator(_defaultValidator, _data, options) {
960
- if (!this.contract.write) {
961
- throw new Error('Wallet client is required for write operations');
962
- }
963
- return this.contract.write.setDefaultValidator([_defaultValidator, _data], options);
964
- }
965
- /**
966
- * setExecution
967
- * payable
968
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
969
- */
970
- async setExecution(_selector, _executor, _validator, _validUntil, _validAfter, _enableData, options) {
971
- if (!this.contract.write) {
972
- throw new Error('Wallet client is required for write operations');
973
- }
974
- return this.contract.write.setExecution([_selector, _executor, _validator, _validUntil, _validAfter, _enableData], options);
975
- }
976
- /**
977
- * upgradeTo
978
- * payable
979
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
980
- */
981
- async upgradeTo(_newImplementation, options) {
982
- if (!this.contract.write) {
983
- throw new Error('Wallet client is required for write operations');
984
- }
985
- return this.contract.write.upgradeTo([_newImplementation], options);
986
- }
987
- /**
988
- * validateUserOp
989
- * payable
990
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
991
- */
992
- async validateUserOp(_userOp, userOpHash, missingAccountFunds, options) {
993
- if (!this.contract.write) {
994
- throw new Error('Wallet client is required for write operations');
995
- }
996
- return this.contract.write.validateUserOp([_userOp, userOpHash, missingAccountFunds], options);
997
- }
998
- /**
999
- * Simulate contract write operations (dry-run without sending transaction)
1000
- *
1001
- * @example
1002
- * const result = await contract.simulate.transfer('0x...', 1000n);
1003
- * console.log('Gas estimate:', result.request.gas);
1004
- * console.log('Would succeed:', result.result);
1005
- */
1006
- get simulate() {
1007
- const contract = this.contract;
1008
- if (!contract.simulate) {
1009
- throw new Error('Public client is required for simulation');
1010
- }
1011
- return {
1012
- /**
1013
- * Simulate disableMode
1014
- * Returns gas estimate and result without sending transaction
1015
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
1016
- */
1017
- async disableMode(_disableFlag, options) {
1018
- return contract.simulate.disableMode([_disableFlag], options);
1019
- },
1020
- /**
1021
- * Simulate execute
1022
- * Returns gas estimate and result without sending transaction
1023
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
1024
- */
1025
- async execute(to, value, data, _operation, options) {
1026
- return contract.simulate.execute([to, value, data, _operation], options);
1027
- },
1028
- /**
1029
- * Simulate executeBatch
1030
- * Returns gas estimate and result without sending transaction
1031
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
1032
- */
1033
- async executeBatch(calls, options) {
1034
- return contract.simulate.executeBatch([calls], options);
1035
- },
1036
- /**
1037
- * Simulate executeDelegateCall
1038
- * Returns gas estimate and result without sending transaction
1039
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
1040
- */
1041
- async executeDelegateCall(to, data, options) {
1042
- return contract.simulate.executeDelegateCall([to, data], options);
1043
- },
1044
- /**
1045
- * Simulate initialize
1046
- * Returns gas estimate and result without sending transaction
1047
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
1048
- */
1049
- async initialize(_defaultValidator, _data, options) {
1050
- return contract.simulate.initialize([_defaultValidator, _data], options);
1051
- },
1052
- /**
1053
- * Simulate setDefaultValidator
1054
- * Returns gas estimate and result without sending transaction
1055
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
1056
- */
1057
- async setDefaultValidator(_defaultValidator, _data, options) {
1058
- return contract.simulate.setDefaultValidator([_defaultValidator, _data], options);
1059
- },
1060
- /**
1061
- * Simulate setExecution
1062
- * Returns gas estimate and result without sending transaction
1063
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
1064
- */
1065
- async setExecution(_selector, _executor, _validator, _validUntil, _validAfter, _enableData, options) {
1066
- return contract.simulate.setExecution([_selector, _executor, _validator, _validUntil, _validAfter, _enableData], options);
1067
- },
1068
- /**
1069
- * Simulate upgradeTo
1070
- * Returns gas estimate and result without sending transaction
1071
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
1072
- */
1073
- async upgradeTo(_newImplementation, options) {
1074
- return contract.simulate.upgradeTo([_newImplementation], options);
1075
- },
1076
- /**
1077
- * Simulate validateUserOp
1078
- * Returns gas estimate and result without sending transaction
1079
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
1080
- */
1081
- async validateUserOp(_userOp, userOpHash, missingAccountFunds, options) {
1082
- return contract.simulate.validateUserOp([_userOp, userOpHash, missingAccountFunds], options);
1083
- }
1084
- };
1085
- }
1086
- /**
1087
- * Watch contract events
1088
- *
1089
- * @example
1090
- * // Watch all Transfer events
1091
- * const unwatch = contract.watch.Transfer((event) => {
1092
- * console.log('Transfer:', event);
1093
- * });
1094
- *
1095
- * // Stop watching
1096
- * unwatch();
1097
- */
1098
- get watch() {
1099
- return {
1100
- /**
1101
- * Watch DefaultValidatorChanged events
1102
- * @param callback Function to call when event is emitted
1103
- * @param filter Optional filter for indexed parameters
1104
- * @returns Unwatch function to stop listening
1105
- */
1106
- DefaultValidatorChanged: (callback, filter) => {
1107
- return this.publicClient.watchContractEvent({
1108
- address: this.contractAddress,
1109
- abi: exports.Kernel_jsonAbi,
1110
- eventName: 'DefaultValidatorChanged',
1111
- args: filter,
1112
- onLogs: (logs) => {
1113
- logs.forEach((log) => {
1114
- callback(log.args);
1115
- });
1116
- },
1117
- });
1118
- },
1119
- /**
1120
- * Watch ExecutionChanged events
1121
- * @param callback Function to call when event is emitted
1122
- * @param filter Optional filter for indexed parameters
1123
- * @returns Unwatch function to stop listening
1124
- */
1125
- ExecutionChanged: (callback, filter) => {
1126
- return this.publicClient.watchContractEvent({
1127
- address: this.contractAddress,
1128
- abi: exports.Kernel_jsonAbi,
1129
- eventName: 'ExecutionChanged',
1130
- args: filter,
1131
- onLogs: (logs) => {
1132
- logs.forEach((log) => {
1133
- callback(log.args);
1134
- });
1135
- },
1136
- });
1137
- },
1138
- /**
1139
- * Watch Received events
1140
- * @param callback Function to call when event is emitted
1141
- * @param filter Optional filter for indexed parameters
1142
- * @returns Unwatch function to stop listening
1143
- */
1144
- Received: (callback) => {
1145
- return this.publicClient.watchContractEvent({
1146
- address: this.contractAddress,
1147
- abi: exports.Kernel_jsonAbi,
1148
- eventName: 'Received',
1149
- onLogs: (logs) => {
1150
- logs.forEach((log) => {
1151
- callback(log.args);
1152
- });
1153
- },
1154
- });
1155
- },
1156
- /**
1157
- * Watch Upgraded events
1158
- * @param callback Function to call when event is emitted
1159
- * @param filter Optional filter for indexed parameters
1160
- * @returns Unwatch function to stop listening
1161
- */
1162
- Upgraded: (callback, filter) => {
1163
- return this.publicClient.watchContractEvent({
1164
- address: this.contractAddress,
1165
- abi: exports.Kernel_jsonAbi,
1166
- eventName: 'Upgraded',
1167
- args: filter,
1168
- onLogs: (logs) => {
1169
- logs.forEach((log) => {
1170
- callback(log.args);
1171
- });
1172
- },
1173
- });
1174
- }
1175
- };
1176
- }
1177
- }
1178
- exports.Kernel_json = Kernel_json;