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