@gitmyabi/kernel 1.0.0 → 1.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.
@@ -0,0 +1,931 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * KERNEL_json ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const KERNEL_jsonAbi = [
10
+ {
11
+ "inputs": [
12
+ {
13
+ "internalType": "address",
14
+ "name": "safeAddress",
15
+ "type": "address"
16
+ }
17
+ ],
18
+ "stateMutability": "nonpayable",
19
+ "type": "constructor"
20
+ },
21
+ {
22
+ "inputs": [],
23
+ "name": "InvalidShortString",
24
+ "type": "error"
25
+ },
26
+ {
27
+ "inputs": [
28
+ {
29
+ "internalType": "string",
30
+ "name": "str",
31
+ "type": "string"
32
+ }
33
+ ],
34
+ "name": "StringTooLong",
35
+ "type": "error"
36
+ },
37
+ {
38
+ "anonymous": false,
39
+ "inputs": [
40
+ {
41
+ "indexed": true,
42
+ "internalType": "address",
43
+ "name": "owner",
44
+ "type": "address"
45
+ },
46
+ {
47
+ "indexed": true,
48
+ "internalType": "address",
49
+ "name": "spender",
50
+ "type": "address"
51
+ },
52
+ {
53
+ "indexed": false,
54
+ "internalType": "uint256",
55
+ "name": "value",
56
+ "type": "uint256"
57
+ }
58
+ ],
59
+ "name": "Approval",
60
+ "type": "event"
61
+ },
62
+ {
63
+ "anonymous": false,
64
+ "inputs": [],
65
+ "name": "EIP712DomainChanged",
66
+ "type": "event"
67
+ },
68
+ {
69
+ "anonymous": false,
70
+ "inputs": [
71
+ {
72
+ "indexed": true,
73
+ "internalType": "address",
74
+ "name": "from",
75
+ "type": "address"
76
+ },
77
+ {
78
+ "indexed": true,
79
+ "internalType": "address",
80
+ "name": "to",
81
+ "type": "address"
82
+ },
83
+ {
84
+ "indexed": false,
85
+ "internalType": "uint256",
86
+ "name": "value",
87
+ "type": "uint256"
88
+ }
89
+ ],
90
+ "name": "Transfer",
91
+ "type": "event"
92
+ },
93
+ {
94
+ "inputs": [],
95
+ "name": "DOMAIN_SEPARATOR",
96
+ "outputs": [
97
+ {
98
+ "internalType": "bytes32",
99
+ "name": "",
100
+ "type": "bytes32"
101
+ }
102
+ ],
103
+ "stateMutability": "view",
104
+ "type": "function"
105
+ },
106
+ {
107
+ "inputs": [
108
+ {
109
+ "internalType": "address",
110
+ "name": "owner",
111
+ "type": "address"
112
+ },
113
+ {
114
+ "internalType": "address",
115
+ "name": "spender",
116
+ "type": "address"
117
+ }
118
+ ],
119
+ "name": "allowance",
120
+ "outputs": [
121
+ {
122
+ "internalType": "uint256",
123
+ "name": "",
124
+ "type": "uint256"
125
+ }
126
+ ],
127
+ "stateMutability": "view",
128
+ "type": "function"
129
+ },
130
+ {
131
+ "inputs": [
132
+ {
133
+ "internalType": "address",
134
+ "name": "spender",
135
+ "type": "address"
136
+ },
137
+ {
138
+ "internalType": "uint256",
139
+ "name": "amount",
140
+ "type": "uint256"
141
+ }
142
+ ],
143
+ "name": "approve",
144
+ "outputs": [
145
+ {
146
+ "internalType": "bool",
147
+ "name": "",
148
+ "type": "bool"
149
+ }
150
+ ],
151
+ "stateMutability": "nonpayable",
152
+ "type": "function"
153
+ },
154
+ {
155
+ "inputs": [
156
+ {
157
+ "internalType": "address",
158
+ "name": "account",
159
+ "type": "address"
160
+ }
161
+ ],
162
+ "name": "balanceOf",
163
+ "outputs": [
164
+ {
165
+ "internalType": "uint256",
166
+ "name": "",
167
+ "type": "uint256"
168
+ }
169
+ ],
170
+ "stateMutability": "view",
171
+ "type": "function"
172
+ },
173
+ {
174
+ "inputs": [],
175
+ "name": "decimals",
176
+ "outputs": [
177
+ {
178
+ "internalType": "uint8",
179
+ "name": "",
180
+ "type": "uint8"
181
+ }
182
+ ],
183
+ "stateMutability": "view",
184
+ "type": "function"
185
+ },
186
+ {
187
+ "inputs": [
188
+ {
189
+ "internalType": "address",
190
+ "name": "spender",
191
+ "type": "address"
192
+ },
193
+ {
194
+ "internalType": "uint256",
195
+ "name": "subtractedValue",
196
+ "type": "uint256"
197
+ }
198
+ ],
199
+ "name": "decreaseAllowance",
200
+ "outputs": [
201
+ {
202
+ "internalType": "bool",
203
+ "name": "",
204
+ "type": "bool"
205
+ }
206
+ ],
207
+ "stateMutability": "nonpayable",
208
+ "type": "function"
209
+ },
210
+ {
211
+ "inputs": [],
212
+ "name": "eip712Domain",
213
+ "outputs": [
214
+ {
215
+ "internalType": "bytes1",
216
+ "name": "fields",
217
+ "type": "bytes1"
218
+ },
219
+ {
220
+ "internalType": "string",
221
+ "name": "name",
222
+ "type": "string"
223
+ },
224
+ {
225
+ "internalType": "string",
226
+ "name": "version",
227
+ "type": "string"
228
+ },
229
+ {
230
+ "internalType": "uint256",
231
+ "name": "chainId",
232
+ "type": "uint256"
233
+ },
234
+ {
235
+ "internalType": "address",
236
+ "name": "verifyingContract",
237
+ "type": "address"
238
+ },
239
+ {
240
+ "internalType": "bytes32",
241
+ "name": "salt",
242
+ "type": "bytes32"
243
+ },
244
+ {
245
+ "internalType": "uint256[]",
246
+ "name": "extensions",
247
+ "type": "uint256[]"
248
+ }
249
+ ],
250
+ "stateMutability": "view",
251
+ "type": "function"
252
+ },
253
+ {
254
+ "inputs": [
255
+ {
256
+ "internalType": "address",
257
+ "name": "spender",
258
+ "type": "address"
259
+ },
260
+ {
261
+ "internalType": "uint256",
262
+ "name": "addedValue",
263
+ "type": "uint256"
264
+ }
265
+ ],
266
+ "name": "increaseAllowance",
267
+ "outputs": [
268
+ {
269
+ "internalType": "bool",
270
+ "name": "",
271
+ "type": "bool"
272
+ }
273
+ ],
274
+ "stateMutability": "nonpayable",
275
+ "type": "function"
276
+ },
277
+ {
278
+ "inputs": [],
279
+ "name": "name",
280
+ "outputs": [
281
+ {
282
+ "internalType": "string",
283
+ "name": "",
284
+ "type": "string"
285
+ }
286
+ ],
287
+ "stateMutability": "view",
288
+ "type": "function"
289
+ },
290
+ {
291
+ "inputs": [
292
+ {
293
+ "internalType": "address",
294
+ "name": "owner",
295
+ "type": "address"
296
+ }
297
+ ],
298
+ "name": "nonces",
299
+ "outputs": [
300
+ {
301
+ "internalType": "uint256",
302
+ "name": "",
303
+ "type": "uint256"
304
+ }
305
+ ],
306
+ "stateMutability": "view",
307
+ "type": "function"
308
+ },
309
+ {
310
+ "inputs": [
311
+ {
312
+ "internalType": "address",
313
+ "name": "owner",
314
+ "type": "address"
315
+ },
316
+ {
317
+ "internalType": "address",
318
+ "name": "spender",
319
+ "type": "address"
320
+ },
321
+ {
322
+ "internalType": "uint256",
323
+ "name": "value",
324
+ "type": "uint256"
325
+ },
326
+ {
327
+ "internalType": "uint256",
328
+ "name": "deadline",
329
+ "type": "uint256"
330
+ },
331
+ {
332
+ "internalType": "uint8",
333
+ "name": "v",
334
+ "type": "uint8"
335
+ },
336
+ {
337
+ "internalType": "bytes32",
338
+ "name": "r",
339
+ "type": "bytes32"
340
+ },
341
+ {
342
+ "internalType": "bytes32",
343
+ "name": "s",
344
+ "type": "bytes32"
345
+ }
346
+ ],
347
+ "name": "permit",
348
+ "outputs": [],
349
+ "stateMutability": "nonpayable",
350
+ "type": "function"
351
+ },
352
+ {
353
+ "inputs": [],
354
+ "name": "symbol",
355
+ "outputs": [
356
+ {
357
+ "internalType": "string",
358
+ "name": "",
359
+ "type": "string"
360
+ }
361
+ ],
362
+ "stateMutability": "view",
363
+ "type": "function"
364
+ },
365
+ {
366
+ "inputs": [],
367
+ "name": "totalSupply",
368
+ "outputs": [
369
+ {
370
+ "internalType": "uint256",
371
+ "name": "",
372
+ "type": "uint256"
373
+ }
374
+ ],
375
+ "stateMutability": "view",
376
+ "type": "function"
377
+ },
378
+ {
379
+ "inputs": [
380
+ {
381
+ "internalType": "address",
382
+ "name": "to",
383
+ "type": "address"
384
+ },
385
+ {
386
+ "internalType": "uint256",
387
+ "name": "amount",
388
+ "type": "uint256"
389
+ }
390
+ ],
391
+ "name": "transfer",
392
+ "outputs": [
393
+ {
394
+ "internalType": "bool",
395
+ "name": "",
396
+ "type": "bool"
397
+ }
398
+ ],
399
+ "stateMutability": "nonpayable",
400
+ "type": "function"
401
+ },
402
+ {
403
+ "inputs": [
404
+ {
405
+ "internalType": "address",
406
+ "name": "from",
407
+ "type": "address"
408
+ },
409
+ {
410
+ "internalType": "address",
411
+ "name": "to",
412
+ "type": "address"
413
+ },
414
+ {
415
+ "internalType": "uint256",
416
+ "name": "amount",
417
+ "type": "uint256"
418
+ }
419
+ ],
420
+ "name": "transferFrom",
421
+ "outputs": [
422
+ {
423
+ "internalType": "bool",
424
+ "name": "",
425
+ "type": "bool"
426
+ }
427
+ ],
428
+ "stateMutability": "nonpayable",
429
+ "type": "function"
430
+ }
431
+ ] as const satisfies Abi;
432
+
433
+ /**
434
+ * Type-safe ABI for KERNEL_json
435
+ */
436
+ export type KERNEL_jsonAbi = typeof KERNEL_jsonAbi;
437
+
438
+ /**
439
+ * Contract instance type for KERNEL_json
440
+ */
441
+ // Use any for contract type to avoid complex viem type issues
442
+ // The runtime behavior is type-safe through viem's ABI typing
443
+ export type KERNEL_jsonContract = any;
444
+
445
+ /**
446
+ * KERNEL_json Contract Class
447
+ *
448
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
449
+ *
450
+ * @example
451
+ * ```typescript
452
+ * import { createPublicClient, createWalletClient, http } from 'viem';
453
+ * import { mainnet } from 'viem/chains';
454
+ * import { KERNEL_json } from 'KERNEL_json';
455
+ *
456
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
457
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
458
+ *
459
+ * const contract = new KERNEL_json('0x...', { publicClient, walletClient });
460
+ *
461
+ * // Read functions
462
+ * const result = await contract.balanceOf('0x...');
463
+ *
464
+ * // Write functions
465
+ * const hash = await contract.transfer('0x...', 1000n);
466
+ *
467
+ * // Simulate transactions (dry-run)
468
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
469
+ * console.log('Gas estimate:', simulation.request.gas);
470
+ *
471
+ * // Watch events
472
+ * const unwatch = contract.watch.Transfer((event) => {
473
+ * console.log('Transfer event:', event);
474
+ * });
475
+ * ```
476
+ */
477
+ export class KERNEL_json {
478
+ private contract: KERNEL_jsonContract;
479
+ private contractAddress: Address;
480
+ private publicClient: PublicClient;
481
+
482
+ constructor(
483
+ address: Address,
484
+ clients: {
485
+ publicClient: PublicClient;
486
+ walletClient?: WalletClient;
487
+ }
488
+ ) {
489
+ this.contractAddress = address;
490
+ this.publicClient = clients.publicClient;
491
+ this.contract = getContract({
492
+ address,
493
+ abi: KERNEL_jsonAbi,
494
+ client: {
495
+ public: clients.publicClient,
496
+ wallet: clients.walletClient,
497
+ },
498
+ });
499
+ }
500
+
501
+ /**
502
+ * Get the contract address
503
+ */
504
+ get address(): Address {
505
+ return this.contractAddress;
506
+ }
507
+
508
+ /**
509
+ * Get the underlying viem contract instance
510
+ */
511
+ getContract(): KERNEL_jsonContract {
512
+ return this.contract;
513
+ }
514
+
515
+ /**
516
+ * DOMAIN_SEPARATOR
517
+ * view
518
+ */
519
+ async DOMAIN_SEPARATOR(): Promise<`0x${string}`> {
520
+ return this.contract.read.DOMAIN_SEPARATOR() as Promise<`0x${string}`>;
521
+ }
522
+
523
+ /**
524
+ * allowance
525
+ * view
526
+ */
527
+ async allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
528
+ return this.contract.read.allowance([owner, spender] as const) as Promise<bigint>;
529
+ }
530
+
531
+ /**
532
+ * balanceOf
533
+ * view
534
+ */
535
+ async balanceOf(account: `0x${string}`): Promise<bigint> {
536
+ return this.contract.read.balanceOf([account] as const) as Promise<bigint>;
537
+ }
538
+
539
+ /**
540
+ * decimals
541
+ * view
542
+ */
543
+ async decimals(): Promise<bigint> {
544
+ return this.contract.read.decimals() as Promise<bigint>;
545
+ }
546
+
547
+ /**
548
+ * eip712Domain
549
+ * view
550
+ */
551
+ async eip712Domain(): Promise<[`0x${string}`, string, string, bigint, `0x${string}`, `0x${string}`, bigint[]]> {
552
+ return this.contract.read.eip712Domain() as Promise<[`0x${string}`, string, string, bigint, `0x${string}`, `0x${string}`, bigint[]]>;
553
+ }
554
+
555
+ /**
556
+ * name
557
+ * view
558
+ */
559
+ async name(): Promise<string> {
560
+ return this.contract.read.name() as Promise<string>;
561
+ }
562
+
563
+ /**
564
+ * nonces
565
+ * view
566
+ */
567
+ async nonces(owner: `0x${string}`): Promise<bigint> {
568
+ return this.contract.read.nonces([owner] as const) as Promise<bigint>;
569
+ }
570
+
571
+ /**
572
+ * symbol
573
+ * view
574
+ */
575
+ async symbol(): Promise<string> {
576
+ return this.contract.read.symbol() as Promise<string>;
577
+ }
578
+
579
+ /**
580
+ * totalSupply
581
+ * view
582
+ */
583
+ async totalSupply(): Promise<bigint> {
584
+ return this.contract.read.totalSupply() as Promise<bigint>;
585
+ }
586
+
587
+ /**
588
+ * approve
589
+ * nonpayable
590
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
591
+ */
592
+ async approve(spender: `0x${string}`, amount: bigint, options?: {
593
+ accessList?: import('viem').AccessList;
594
+ authorizationList?: import('viem').AuthorizationList;
595
+ chain?: import('viem').Chain | null;
596
+ dataSuffix?: `0x${string}`;
597
+ gas?: bigint;
598
+ gasPrice?: bigint;
599
+ maxFeePerGas?: bigint;
600
+ maxPriorityFeePerGas?: bigint;
601
+ nonce?: number;
602
+ value?: bigint;
603
+ }): Promise<`0x${string}`> {
604
+ if (!this.contract.write) {
605
+ throw new Error('Wallet client is required for write operations');
606
+ }
607
+ return this.contract.write.approve([spender, amount] as const, options) as Promise<`0x${string}`>;
608
+ }
609
+
610
+ /**
611
+ * decreaseAllowance
612
+ * nonpayable
613
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
614
+ */
615
+ async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
616
+ accessList?: import('viem').AccessList;
617
+ authorizationList?: import('viem').AuthorizationList;
618
+ chain?: import('viem').Chain | null;
619
+ dataSuffix?: `0x${string}`;
620
+ gas?: bigint;
621
+ gasPrice?: bigint;
622
+ maxFeePerGas?: bigint;
623
+ maxPriorityFeePerGas?: bigint;
624
+ nonce?: number;
625
+ value?: bigint;
626
+ }): Promise<`0x${string}`> {
627
+ if (!this.contract.write) {
628
+ throw new Error('Wallet client is required for write operations');
629
+ }
630
+ return this.contract.write.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<`0x${string}`>;
631
+ }
632
+
633
+ /**
634
+ * increaseAllowance
635
+ * nonpayable
636
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
637
+ */
638
+ async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
639
+ accessList?: import('viem').AccessList;
640
+ authorizationList?: import('viem').AuthorizationList;
641
+ chain?: import('viem').Chain | null;
642
+ dataSuffix?: `0x${string}`;
643
+ gas?: bigint;
644
+ gasPrice?: bigint;
645
+ maxFeePerGas?: bigint;
646
+ maxPriorityFeePerGas?: bigint;
647
+ nonce?: number;
648
+ value?: bigint;
649
+ }): Promise<`0x${string}`> {
650
+ if (!this.contract.write) {
651
+ throw new Error('Wallet client is required for write operations');
652
+ }
653
+ return this.contract.write.increaseAllowance([spender, addedValue] as const, options) as Promise<`0x${string}`>;
654
+ }
655
+
656
+ /**
657
+ * permit
658
+ * nonpayable
659
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
660
+ */
661
+ async permit(owner: `0x${string}`, spender: `0x${string}`, value: bigint, deadline: bigint, v: bigint, r: `0x${string}`, s: `0x${string}`, options?: {
662
+ accessList?: import('viem').AccessList;
663
+ authorizationList?: import('viem').AuthorizationList;
664
+ chain?: import('viem').Chain | null;
665
+ dataSuffix?: `0x${string}`;
666
+ gas?: bigint;
667
+ gasPrice?: bigint;
668
+ maxFeePerGas?: bigint;
669
+ maxPriorityFeePerGas?: bigint;
670
+ nonce?: number;
671
+ value?: bigint;
672
+ }): Promise<`0x${string}`> {
673
+ if (!this.contract.write) {
674
+ throw new Error('Wallet client is required for write operations');
675
+ }
676
+ return this.contract.write.permit([owner, spender, value, deadline, v, r, s] as const, options) as Promise<`0x${string}`>;
677
+ }
678
+
679
+ /**
680
+ * transfer
681
+ * nonpayable
682
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
683
+ */
684
+ async transfer(to: `0x${string}`, amount: bigint, options?: {
685
+ accessList?: import('viem').AccessList;
686
+ authorizationList?: import('viem').AuthorizationList;
687
+ chain?: import('viem').Chain | null;
688
+ dataSuffix?: `0x${string}`;
689
+ gas?: bigint;
690
+ gasPrice?: bigint;
691
+ maxFeePerGas?: bigint;
692
+ maxPriorityFeePerGas?: bigint;
693
+ nonce?: number;
694
+ value?: bigint;
695
+ }): Promise<`0x${string}`> {
696
+ if (!this.contract.write) {
697
+ throw new Error('Wallet client is required for write operations');
698
+ }
699
+ return this.contract.write.transfer([to, amount] as const, options) as Promise<`0x${string}`>;
700
+ }
701
+
702
+ /**
703
+ * transferFrom
704
+ * nonpayable
705
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
706
+ */
707
+ async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
708
+ accessList?: import('viem').AccessList;
709
+ authorizationList?: import('viem').AuthorizationList;
710
+ chain?: import('viem').Chain | null;
711
+ dataSuffix?: `0x${string}`;
712
+ gas?: bigint;
713
+ gasPrice?: bigint;
714
+ maxFeePerGas?: bigint;
715
+ maxPriorityFeePerGas?: bigint;
716
+ nonce?: number;
717
+ value?: bigint;
718
+ }): Promise<`0x${string}`> {
719
+ if (!this.contract.write) {
720
+ throw new Error('Wallet client is required for write operations');
721
+ }
722
+ return this.contract.write.transferFrom([from, to, amount] as const, options) as Promise<`0x${string}`>;
723
+ }
724
+
725
+
726
+
727
+ /**
728
+ * Simulate contract write operations (dry-run without sending transaction)
729
+ *
730
+ * @example
731
+ * const result = await contract.simulate.transfer('0x...', 1000n);
732
+ * console.log('Gas estimate:', result.request.gas);
733
+ * console.log('Would succeed:', result.result);
734
+ */
735
+ get simulate() {
736
+ const contract = this.contract;
737
+ if (!contract.simulate) {
738
+ throw new Error('Public client is required for simulation');
739
+ }
740
+ return {
741
+ /**
742
+ * Simulate approve
743
+ * Returns gas estimate and result without sending transaction
744
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
745
+ */
746
+ async approve(spender: `0x${string}`, amount: bigint, options?: {
747
+ accessList?: import('viem').AccessList;
748
+ authorizationList?: import('viem').AuthorizationList;
749
+ chain?: import('viem').Chain | null;
750
+ dataSuffix?: `0x${string}`;
751
+ gas?: bigint;
752
+ gasPrice?: bigint;
753
+ maxFeePerGas?: bigint;
754
+ maxPriorityFeePerGas?: bigint;
755
+ nonce?: number;
756
+ value?: bigint;
757
+ }): Promise<boolean> {
758
+ return contract.simulate.approve([spender, amount] as const, options) as Promise<boolean>;
759
+ },
760
+ /**
761
+ * Simulate decreaseAllowance
762
+ * Returns gas estimate and result without sending transaction
763
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
764
+ */
765
+ async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
766
+ accessList?: import('viem').AccessList;
767
+ authorizationList?: import('viem').AuthorizationList;
768
+ chain?: import('viem').Chain | null;
769
+ dataSuffix?: `0x${string}`;
770
+ gas?: bigint;
771
+ gasPrice?: bigint;
772
+ maxFeePerGas?: bigint;
773
+ maxPriorityFeePerGas?: bigint;
774
+ nonce?: number;
775
+ value?: bigint;
776
+ }): Promise<boolean> {
777
+ return contract.simulate.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<boolean>;
778
+ },
779
+ /**
780
+ * Simulate increaseAllowance
781
+ * Returns gas estimate and result without sending transaction
782
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
783
+ */
784
+ async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
785
+ accessList?: import('viem').AccessList;
786
+ authorizationList?: import('viem').AuthorizationList;
787
+ chain?: import('viem').Chain | null;
788
+ dataSuffix?: `0x${string}`;
789
+ gas?: bigint;
790
+ gasPrice?: bigint;
791
+ maxFeePerGas?: bigint;
792
+ maxPriorityFeePerGas?: bigint;
793
+ nonce?: number;
794
+ value?: bigint;
795
+ }): Promise<boolean> {
796
+ return contract.simulate.increaseAllowance([spender, addedValue] as const, options) as Promise<boolean>;
797
+ },
798
+ /**
799
+ * Simulate permit
800
+ * Returns gas estimate and result without sending transaction
801
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
802
+ */
803
+ async permit(owner: `0x${string}`, spender: `0x${string}`, value: bigint, deadline: bigint, v: bigint, r: `0x${string}`, s: `0x${string}`, options?: {
804
+ accessList?: import('viem').AccessList;
805
+ authorizationList?: import('viem').AuthorizationList;
806
+ chain?: import('viem').Chain | null;
807
+ dataSuffix?: `0x${string}`;
808
+ gas?: bigint;
809
+ gasPrice?: bigint;
810
+ maxFeePerGas?: bigint;
811
+ maxPriorityFeePerGas?: bigint;
812
+ nonce?: number;
813
+ value?: bigint;
814
+ }): Promise<void> {
815
+ return contract.simulate.permit([owner, spender, value, deadline, v, r, s] as const, options) as Promise<void>;
816
+ },
817
+ /**
818
+ * Simulate transfer
819
+ * Returns gas estimate and result without sending transaction
820
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
821
+ */
822
+ async transfer(to: `0x${string}`, amount: bigint, options?: {
823
+ accessList?: import('viem').AccessList;
824
+ authorizationList?: import('viem').AuthorizationList;
825
+ chain?: import('viem').Chain | null;
826
+ dataSuffix?: `0x${string}`;
827
+ gas?: bigint;
828
+ gasPrice?: bigint;
829
+ maxFeePerGas?: bigint;
830
+ maxPriorityFeePerGas?: bigint;
831
+ nonce?: number;
832
+ value?: bigint;
833
+ }): Promise<boolean> {
834
+ return contract.simulate.transfer([to, amount] as const, options) as Promise<boolean>;
835
+ },
836
+ /**
837
+ * Simulate transferFrom
838
+ * Returns gas estimate and result without sending transaction
839
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
840
+ */
841
+ async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
842
+ accessList?: import('viem').AccessList;
843
+ authorizationList?: import('viem').AuthorizationList;
844
+ chain?: import('viem').Chain | null;
845
+ dataSuffix?: `0x${string}`;
846
+ gas?: bigint;
847
+ gasPrice?: bigint;
848
+ maxFeePerGas?: bigint;
849
+ maxPriorityFeePerGas?: bigint;
850
+ nonce?: number;
851
+ value?: bigint;
852
+ }): Promise<boolean> {
853
+ return contract.simulate.transferFrom([from, to, amount] as const, options) as Promise<boolean>;
854
+ }
855
+ };
856
+ }
857
+
858
+ /**
859
+ * Watch contract events
860
+ *
861
+ * @example
862
+ * // Watch all Transfer events
863
+ * const unwatch = contract.watch.Transfer((event) => {
864
+ * console.log('Transfer:', event);
865
+ * });
866
+ *
867
+ * // Stop watching
868
+ * unwatch();
869
+ */
870
+ get watch() {
871
+ return {
872
+ /**
873
+ * Watch Approval events
874
+ * @param callback Function to call when event is emitted
875
+ * @param filter Optional filter for indexed parameters
876
+ * @returns Unwatch function to stop listening
877
+ */
878
+ Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner: `0x${string}`; spender: `0x${string}` }) => {
879
+ return this.publicClient.watchContractEvent({
880
+ address: this.contractAddress,
881
+ abi: KERNEL_jsonAbi,
882
+ eventName: 'Approval',
883
+ args: filter,
884
+ onLogs: (logs: any[]) => {
885
+ logs.forEach((log: any) => {
886
+ callback(log.args as any);
887
+ });
888
+ },
889
+ }) as () => void;
890
+ },
891
+ /**
892
+ * Watch EIP712DomainChanged events
893
+ * @param callback Function to call when event is emitted
894
+ * @param filter Optional filter for indexed parameters
895
+ * @returns Unwatch function to stop listening
896
+ */
897
+ EIP712DomainChanged: (callback: (event: { }) => void) => {
898
+ return this.publicClient.watchContractEvent({
899
+ address: this.contractAddress,
900
+ abi: KERNEL_jsonAbi,
901
+ eventName: 'EIP712DomainChanged',
902
+
903
+ onLogs: (logs: any[]) => {
904
+ logs.forEach((log: any) => {
905
+ callback(log.args as any);
906
+ });
907
+ },
908
+ }) as () => void;
909
+ },
910
+ /**
911
+ * Watch Transfer events
912
+ * @param callback Function to call when event is emitted
913
+ * @param filter Optional filter for indexed parameters
914
+ * @returns Unwatch function to stop listening
915
+ */
916
+ Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from: `0x${string}`; to: `0x${string}` }) => {
917
+ return this.publicClient.watchContractEvent({
918
+ address: this.contractAddress,
919
+ abi: KERNEL_jsonAbi,
920
+ eventName: 'Transfer',
921
+ args: filter,
922
+ onLogs: (logs: any[]) => {
923
+ logs.forEach((log: any) => {
924
+ callback(log.args as any);
925
+ });
926
+ },
927
+ }) as () => void;
928
+ }
929
+ };
930
+ }
931
+ }