@gitmyabi/idstaking 0.0.0-stage → 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,1519 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * IDStaking ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const IDStakingAbi = [
10
+ {
11
+ "inputs": [
12
+ {
13
+ "internalType": "contract IERC20",
14
+ "name": "_token",
15
+ "type": "address"
16
+ }
17
+ ],
18
+ "stateMutability": "nonpayable",
19
+ "type": "constructor"
20
+ },
21
+ {
22
+ "anonymous": false,
23
+ "inputs": [
24
+ {
25
+ "indexed": true,
26
+ "internalType": "bytes32",
27
+ "name": "role",
28
+ "type": "bytes32"
29
+ },
30
+ {
31
+ "indexed": true,
32
+ "internalType": "bytes32",
33
+ "name": "previousAdminRole",
34
+ "type": "bytes32"
35
+ },
36
+ {
37
+ "indexed": true,
38
+ "internalType": "bytes32",
39
+ "name": "newAdminRole",
40
+ "type": "bytes32"
41
+ }
42
+ ],
43
+ "name": "RoleAdminChanged",
44
+ "type": "event"
45
+ },
46
+ {
47
+ "anonymous": false,
48
+ "inputs": [
49
+ {
50
+ "indexed": true,
51
+ "internalType": "bytes32",
52
+ "name": "role",
53
+ "type": "bytes32"
54
+ },
55
+ {
56
+ "indexed": true,
57
+ "internalType": "address",
58
+ "name": "account",
59
+ "type": "address"
60
+ },
61
+ {
62
+ "indexed": true,
63
+ "internalType": "address",
64
+ "name": "sender",
65
+ "type": "address"
66
+ }
67
+ ],
68
+ "name": "RoleGranted",
69
+ "type": "event"
70
+ },
71
+ {
72
+ "anonymous": false,
73
+ "inputs": [
74
+ {
75
+ "indexed": true,
76
+ "internalType": "bytes32",
77
+ "name": "role",
78
+ "type": "bytes32"
79
+ },
80
+ {
81
+ "indexed": true,
82
+ "internalType": "address",
83
+ "name": "account",
84
+ "type": "address"
85
+ },
86
+ {
87
+ "indexed": true,
88
+ "internalType": "address",
89
+ "name": "sender",
90
+ "type": "address"
91
+ }
92
+ ],
93
+ "name": "RoleRevoked",
94
+ "type": "event"
95
+ },
96
+ {
97
+ "anonymous": false,
98
+ "inputs": [
99
+ {
100
+ "indexed": false,
101
+ "internalType": "uint256",
102
+ "name": "id",
103
+ "type": "uint256"
104
+ }
105
+ ],
106
+ "name": "roundCreated",
107
+ "type": "event"
108
+ },
109
+ {
110
+ "anonymous": false,
111
+ "inputs": [
112
+ {
113
+ "indexed": false,
114
+ "internalType": "uint256",
115
+ "name": "roundId",
116
+ "type": "uint256"
117
+ },
118
+ {
119
+ "indexed": false,
120
+ "internalType": "address",
121
+ "name": "staker",
122
+ "type": "address"
123
+ },
124
+ {
125
+ "indexed": false,
126
+ "internalType": "uint256",
127
+ "name": "amount",
128
+ "type": "uint256"
129
+ },
130
+ {
131
+ "indexed": false,
132
+ "internalType": "bool",
133
+ "name": "staked",
134
+ "type": "bool"
135
+ }
136
+ ],
137
+ "name": "selfStake",
138
+ "type": "event"
139
+ },
140
+ {
141
+ "anonymous": false,
142
+ "inputs": [
143
+ {
144
+ "indexed": false,
145
+ "internalType": "address",
146
+ "name": "staker",
147
+ "type": "address"
148
+ },
149
+ {
150
+ "indexed": false,
151
+ "internalType": "uint256",
152
+ "name": "amount",
153
+ "type": "uint256"
154
+ },
155
+ {
156
+ "indexed": false,
157
+ "internalType": "uint256",
158
+ "name": "fromRound",
159
+ "type": "uint256"
160
+ },
161
+ {
162
+ "indexed": false,
163
+ "internalType": "uint256",
164
+ "name": "toRound",
165
+ "type": "uint256"
166
+ }
167
+ ],
168
+ "name": "tokenMigrated",
169
+ "type": "event"
170
+ },
171
+ {
172
+ "anonymous": false,
173
+ "inputs": [
174
+ {
175
+ "indexed": false,
176
+ "internalType": "uint256",
177
+ "name": "roundId",
178
+ "type": "uint256"
179
+ },
180
+ {
181
+ "indexed": false,
182
+ "internalType": "address",
183
+ "name": "staker",
184
+ "type": "address"
185
+ },
186
+ {
187
+ "indexed": false,
188
+ "internalType": "address",
189
+ "name": "user",
190
+ "type": "address"
191
+ },
192
+ {
193
+ "indexed": false,
194
+ "internalType": "uint256",
195
+ "name": "amount",
196
+ "type": "uint256"
197
+ },
198
+ {
199
+ "indexed": false,
200
+ "internalType": "bool",
201
+ "name": "staked",
202
+ "type": "bool"
203
+ }
204
+ ],
205
+ "name": "xStake",
206
+ "type": "event"
207
+ },
208
+ {
209
+ "inputs": [],
210
+ "name": "DEFAULT_ADMIN_ROLE",
211
+ "outputs": [
212
+ {
213
+ "internalType": "bytes32",
214
+ "name": "",
215
+ "type": "bytes32"
216
+ }
217
+ ],
218
+ "stateMutability": "view",
219
+ "type": "function"
220
+ },
221
+ {
222
+ "inputs": [
223
+ {
224
+ "internalType": "address",
225
+ "name": "admin",
226
+ "type": "address"
227
+ }
228
+ ],
229
+ "name": "addAdmin",
230
+ "outputs": [],
231
+ "stateMutability": "nonpayable",
232
+ "type": "function"
233
+ },
234
+ {
235
+ "inputs": [
236
+ {
237
+ "internalType": "uint256",
238
+ "name": "start",
239
+ "type": "uint256"
240
+ },
241
+ {
242
+ "internalType": "uint256",
243
+ "name": "duration",
244
+ "type": "uint256"
245
+ },
246
+ {
247
+ "internalType": "string",
248
+ "name": "meta",
249
+ "type": "string"
250
+ }
251
+ ],
252
+ "name": "createRound",
253
+ "outputs": [],
254
+ "stateMutability": "nonpayable",
255
+ "type": "function"
256
+ },
257
+ {
258
+ "inputs": [
259
+ {
260
+ "internalType": "uint256",
261
+ "name": "roundId",
262
+ "type": "uint256"
263
+ }
264
+ ],
265
+ "name": "fetchRoundMeta",
266
+ "outputs": [
267
+ {
268
+ "internalType": "uint256",
269
+ "name": "start",
270
+ "type": "uint256"
271
+ },
272
+ {
273
+ "internalType": "uint256",
274
+ "name": "duration",
275
+ "type": "uint256"
276
+ },
277
+ {
278
+ "internalType": "uint256",
279
+ "name": "tvl",
280
+ "type": "uint256"
281
+ },
282
+ {
283
+ "internalType": "string",
284
+ "name": "meta",
285
+ "type": "string"
286
+ }
287
+ ],
288
+ "stateMutability": "view",
289
+ "type": "function"
290
+ },
291
+ {
292
+ "inputs": [
293
+ {
294
+ "internalType": "bytes32",
295
+ "name": "role",
296
+ "type": "bytes32"
297
+ }
298
+ ],
299
+ "name": "getRoleAdmin",
300
+ "outputs": [
301
+ {
302
+ "internalType": "bytes32",
303
+ "name": "",
304
+ "type": "bytes32"
305
+ }
306
+ ],
307
+ "stateMutability": "view",
308
+ "type": "function"
309
+ },
310
+ {
311
+ "inputs": [
312
+ {
313
+ "internalType": "address",
314
+ "name": "staker",
315
+ "type": "address"
316
+ },
317
+ {
318
+ "internalType": "address",
319
+ "name": "user",
320
+ "type": "address"
321
+ }
322
+ ],
323
+ "name": "getStakeId",
324
+ "outputs": [
325
+ {
326
+ "internalType": "bytes32",
327
+ "name": "",
328
+ "type": "bytes32"
329
+ }
330
+ ],
331
+ "stateMutability": "pure",
332
+ "type": "function"
333
+ },
334
+ {
335
+ "inputs": [
336
+ {
337
+ "internalType": "uint256",
338
+ "name": "roundId",
339
+ "type": "uint256"
340
+ },
341
+ {
342
+ "internalType": "address",
343
+ "name": "user",
344
+ "type": "address"
345
+ }
346
+ ],
347
+ "name": "getUserStakeForRound",
348
+ "outputs": [
349
+ {
350
+ "internalType": "uint256",
351
+ "name": "",
352
+ "type": "uint256"
353
+ }
354
+ ],
355
+ "stateMutability": "view",
356
+ "type": "function"
357
+ },
358
+ {
359
+ "inputs": [
360
+ {
361
+ "internalType": "uint256",
362
+ "name": "roundId",
363
+ "type": "uint256"
364
+ },
365
+ {
366
+ "internalType": "address",
367
+ "name": "staker",
368
+ "type": "address"
369
+ },
370
+ {
371
+ "internalType": "address",
372
+ "name": "user",
373
+ "type": "address"
374
+ }
375
+ ],
376
+ "name": "getUserXStakeForRound",
377
+ "outputs": [
378
+ {
379
+ "internalType": "uint256",
380
+ "name": "",
381
+ "type": "uint256"
382
+ }
383
+ ],
384
+ "stateMutability": "view",
385
+ "type": "function"
386
+ },
387
+ {
388
+ "inputs": [
389
+ {
390
+ "internalType": "bytes32",
391
+ "name": "role",
392
+ "type": "bytes32"
393
+ },
394
+ {
395
+ "internalType": "address",
396
+ "name": "account",
397
+ "type": "address"
398
+ }
399
+ ],
400
+ "name": "grantRole",
401
+ "outputs": [],
402
+ "stateMutability": "nonpayable",
403
+ "type": "function"
404
+ },
405
+ {
406
+ "inputs": [
407
+ {
408
+ "internalType": "bytes32",
409
+ "name": "role",
410
+ "type": "bytes32"
411
+ },
412
+ {
413
+ "internalType": "address",
414
+ "name": "account",
415
+ "type": "address"
416
+ }
417
+ ],
418
+ "name": "hasRole",
419
+ "outputs": [
420
+ {
421
+ "internalType": "bool",
422
+ "name": "",
423
+ "type": "bool"
424
+ }
425
+ ],
426
+ "stateMutability": "view",
427
+ "type": "function"
428
+ },
429
+ {
430
+ "inputs": [
431
+ {
432
+ "internalType": "uint256",
433
+ "name": "roundId",
434
+ "type": "uint256"
435
+ }
436
+ ],
437
+ "name": "isActiveRound",
438
+ "outputs": [
439
+ {
440
+ "internalType": "bool",
441
+ "name": "isActive",
442
+ "type": "bool"
443
+ }
444
+ ],
445
+ "stateMutability": "view",
446
+ "type": "function"
447
+ },
448
+ {
449
+ "inputs": [],
450
+ "name": "latestRound",
451
+ "outputs": [
452
+ {
453
+ "internalType": "uint256",
454
+ "name": "",
455
+ "type": "uint256"
456
+ }
457
+ ],
458
+ "stateMutability": "view",
459
+ "type": "function"
460
+ },
461
+ {
462
+ "inputs": [
463
+ {
464
+ "internalType": "uint256",
465
+ "name": "fromRound",
466
+ "type": "uint256"
467
+ }
468
+ ],
469
+ "name": "migrateStake",
470
+ "outputs": [],
471
+ "stateMutability": "nonpayable",
472
+ "type": "function"
473
+ },
474
+ {
475
+ "inputs": [
476
+ {
477
+ "internalType": "address",
478
+ "name": "admin",
479
+ "type": "address"
480
+ }
481
+ ],
482
+ "name": "removeAdmin",
483
+ "outputs": [],
484
+ "stateMutability": "nonpayable",
485
+ "type": "function"
486
+ },
487
+ {
488
+ "inputs": [
489
+ {
490
+ "internalType": "bytes32",
491
+ "name": "role",
492
+ "type": "bytes32"
493
+ },
494
+ {
495
+ "internalType": "address",
496
+ "name": "account",
497
+ "type": "address"
498
+ }
499
+ ],
500
+ "name": "renounceRole",
501
+ "outputs": [],
502
+ "stateMutability": "nonpayable",
503
+ "type": "function"
504
+ },
505
+ {
506
+ "inputs": [
507
+ {
508
+ "internalType": "bytes32",
509
+ "name": "role",
510
+ "type": "bytes32"
511
+ },
512
+ {
513
+ "internalType": "address",
514
+ "name": "account",
515
+ "type": "address"
516
+ }
517
+ ],
518
+ "name": "revokeRole",
519
+ "outputs": [],
520
+ "stateMutability": "nonpayable",
521
+ "type": "function"
522
+ },
523
+ {
524
+ "inputs": [
525
+ {
526
+ "internalType": "uint256",
527
+ "name": "roundId",
528
+ "type": "uint256"
529
+ },
530
+ {
531
+ "internalType": "uint256",
532
+ "name": "amount",
533
+ "type": "uint256"
534
+ }
535
+ ],
536
+ "name": "stake",
537
+ "outputs": [],
538
+ "stateMutability": "nonpayable",
539
+ "type": "function"
540
+ },
541
+ {
542
+ "inputs": [
543
+ {
544
+ "internalType": "uint256",
545
+ "name": "roundId",
546
+ "type": "uint256"
547
+ },
548
+ {
549
+ "internalType": "address[]",
550
+ "name": "users",
551
+ "type": "address[]"
552
+ },
553
+ {
554
+ "internalType": "uint256[]",
555
+ "name": "amounts",
556
+ "type": "uint256[]"
557
+ }
558
+ ],
559
+ "name": "stakeUsers",
560
+ "outputs": [],
561
+ "stateMutability": "nonpayable",
562
+ "type": "function"
563
+ },
564
+ {
565
+ "inputs": [
566
+ {
567
+ "internalType": "uint256",
568
+ "name": "",
569
+ "type": "uint256"
570
+ },
571
+ {
572
+ "internalType": "address",
573
+ "name": "",
574
+ "type": "address"
575
+ }
576
+ ],
577
+ "name": "stakes",
578
+ "outputs": [
579
+ {
580
+ "internalType": "uint256",
581
+ "name": "",
582
+ "type": "uint256"
583
+ }
584
+ ],
585
+ "stateMutability": "view",
586
+ "type": "function"
587
+ },
588
+ {
589
+ "inputs": [
590
+ {
591
+ "internalType": "bytes4",
592
+ "name": "interfaceId",
593
+ "type": "bytes4"
594
+ }
595
+ ],
596
+ "name": "supportsInterface",
597
+ "outputs": [
598
+ {
599
+ "internalType": "bool",
600
+ "name": "",
601
+ "type": "bool"
602
+ }
603
+ ],
604
+ "stateMutability": "view",
605
+ "type": "function"
606
+ },
607
+ {
608
+ "inputs": [],
609
+ "name": "token",
610
+ "outputs": [
611
+ {
612
+ "internalType": "contract IERC20",
613
+ "name": "",
614
+ "type": "address"
615
+ }
616
+ ],
617
+ "stateMutability": "view",
618
+ "type": "function"
619
+ },
620
+ {
621
+ "inputs": [],
622
+ "name": "trustedSigner",
623
+ "outputs": [
624
+ {
625
+ "internalType": "address",
626
+ "name": "",
627
+ "type": "address"
628
+ }
629
+ ],
630
+ "stateMutability": "view",
631
+ "type": "function"
632
+ },
633
+ {
634
+ "inputs": [
635
+ {
636
+ "internalType": "uint256",
637
+ "name": "roundId",
638
+ "type": "uint256"
639
+ },
640
+ {
641
+ "internalType": "uint256",
642
+ "name": "amount",
643
+ "type": "uint256"
644
+ }
645
+ ],
646
+ "name": "unstake",
647
+ "outputs": [],
648
+ "stateMutability": "nonpayable",
649
+ "type": "function"
650
+ },
651
+ {
652
+ "inputs": [
653
+ {
654
+ "internalType": "uint256",
655
+ "name": "roundId",
656
+ "type": "uint256"
657
+ },
658
+ {
659
+ "internalType": "address[]",
660
+ "name": "users",
661
+ "type": "address[]"
662
+ }
663
+ ],
664
+ "name": "unstakeUsers",
665
+ "outputs": [],
666
+ "stateMutability": "nonpayable",
667
+ "type": "function"
668
+ },
669
+ {
670
+ "inputs": [
671
+ {
672
+ "internalType": "uint256",
673
+ "name": "",
674
+ "type": "uint256"
675
+ },
676
+ {
677
+ "internalType": "bytes32",
678
+ "name": "",
679
+ "type": "bytes32"
680
+ }
681
+ ],
682
+ "name": "xStakes",
683
+ "outputs": [
684
+ {
685
+ "internalType": "uint256",
686
+ "name": "",
687
+ "type": "uint256"
688
+ }
689
+ ],
690
+ "stateMutability": "view",
691
+ "type": "function"
692
+ }
693
+ ] as const satisfies Abi;
694
+
695
+ /**
696
+ * Type-safe ABI for IDStaking
697
+ */
698
+ export type IDStakingAbi = typeof IDStakingAbi;
699
+
700
+ /**
701
+ * Contract instance type for IDStaking
702
+ */
703
+ // Use any for contract type to avoid complex viem type issues
704
+ // The runtime behavior is type-safe through viem's ABI typing
705
+ export type IDStakingContract = any;
706
+
707
+ /**
708
+ * IDStaking Contract Class
709
+ *
710
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
711
+ *
712
+ * @example
713
+ * ```typescript
714
+ * import { createPublicClient, createWalletClient, http } from 'viem';
715
+ * import { mainnet } from 'viem/chains';
716
+ * import { IDStaking } from 'IDStaking';
717
+ *
718
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
719
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
720
+ *
721
+ * const contract = new IDStaking('0x...', { publicClient, walletClient });
722
+ *
723
+ * // Read functions
724
+ * const result = await contract.balanceOf('0x...');
725
+ *
726
+ * // Write functions
727
+ * const hash = await contract.transfer('0x...', 1000n);
728
+ *
729
+ * // Simulate transactions (dry-run)
730
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
731
+ * console.log('Gas estimate:', simulation.request.gas);
732
+ *
733
+ * // Watch events
734
+ * const unwatch = contract.watch.Transfer((event) => {
735
+ * console.log('Transfer event:', event);
736
+ * });
737
+ * ```
738
+ */
739
+ export class IDStaking {
740
+ private contract: IDStakingContract;
741
+ private contractAddress: Address;
742
+ private publicClient: PublicClient;
743
+
744
+ constructor(
745
+ address: Address,
746
+ clients: {
747
+ publicClient: PublicClient;
748
+ walletClient?: WalletClient;
749
+ }
750
+ ) {
751
+ this.contractAddress = address;
752
+ this.publicClient = clients.publicClient;
753
+ this.contract = getContract({
754
+ address,
755
+ abi: IDStakingAbi,
756
+ client: {
757
+ public: clients.publicClient,
758
+ wallet: clients.walletClient,
759
+ },
760
+ });
761
+ }
762
+
763
+ /**
764
+ * Get the contract address
765
+ */
766
+ get address(): Address {
767
+ return this.contractAddress;
768
+ }
769
+
770
+ /**
771
+ * Get the underlying viem contract instance.
772
+ */
773
+ getContract(): IDStakingContract {
774
+ return this.contract;
775
+ }
776
+
777
+ /**
778
+ * DEFAULT_ADMIN_ROLE
779
+ * view
780
+ */
781
+ async DEFAULT_ADMIN_ROLE(): Promise<`0x${string}`> {
782
+ return this.contract.read.DEFAULT_ADMIN_ROLE() as Promise<`0x${string}`>;
783
+ }
784
+
785
+ /**
786
+ * fetchRoundMeta
787
+ * view
788
+ */
789
+ async fetchRoundMeta(roundId: bigint): Promise<[bigint, bigint, bigint, string]> {
790
+ return this.contract.read.fetchRoundMeta([roundId] as const) as Promise<[bigint, bigint, bigint, string]>;
791
+ }
792
+
793
+ /**
794
+ * getRoleAdmin
795
+ * view
796
+ */
797
+ async getRoleAdmin(role: `0x${string}`): Promise<`0x${string}`> {
798
+ return this.contract.read.getRoleAdmin([role] as const) as Promise<`0x${string}`>;
799
+ }
800
+
801
+ /**
802
+ * getStakeId
803
+ * pure
804
+ */
805
+ async getStakeId(staker: `0x${string}`, user: `0x${string}`): Promise<`0x${string}`> {
806
+ return this.contract.read.getStakeId([staker, user] as const) as Promise<`0x${string}`>;
807
+ }
808
+
809
+ /**
810
+ * getUserStakeForRound
811
+ * view
812
+ */
813
+ async getUserStakeForRound(roundId: bigint, user: `0x${string}`): Promise<bigint> {
814
+ return this.contract.read.getUserStakeForRound([roundId, user] as const) as Promise<bigint>;
815
+ }
816
+
817
+ /**
818
+ * getUserXStakeForRound
819
+ * view
820
+ */
821
+ async getUserXStakeForRound(roundId: bigint, staker: `0x${string}`, user: `0x${string}`): Promise<bigint> {
822
+ return this.contract.read.getUserXStakeForRound([roundId, staker, user] as const) as Promise<bigint>;
823
+ }
824
+
825
+ /**
826
+ * hasRole
827
+ * view
828
+ */
829
+ async hasRole(role: `0x${string}`, account: `0x${string}`): Promise<boolean> {
830
+ return this.contract.read.hasRole([role, account] as const) as Promise<boolean>;
831
+ }
832
+
833
+ /**
834
+ * isActiveRound
835
+ * view
836
+ */
837
+ async isActiveRound(roundId: bigint): Promise<boolean> {
838
+ return this.contract.read.isActiveRound([roundId] as const) as Promise<boolean>;
839
+ }
840
+
841
+ /**
842
+ * latestRound
843
+ * view
844
+ */
845
+ async latestRound(): Promise<bigint> {
846
+ return this.contract.read.latestRound() as Promise<bigint>;
847
+ }
848
+
849
+ /**
850
+ * stakes
851
+ * view
852
+ */
853
+ async stakes(arg0: bigint, arg1: `0x${string}`): Promise<bigint> {
854
+ return this.contract.read.stakes([arg0, arg1] as const) as Promise<bigint>;
855
+ }
856
+
857
+ /**
858
+ * supportsInterface
859
+ * view
860
+ */
861
+ async supportsInterface(interfaceId: `0x${string}`): Promise<boolean> {
862
+ return this.contract.read.supportsInterface([interfaceId] as const) as Promise<boolean>;
863
+ }
864
+
865
+ /**
866
+ * token
867
+ * view
868
+ */
869
+ async token(): Promise<`0x${string}`> {
870
+ return this.contract.read.token() as Promise<`0x${string}`>;
871
+ }
872
+
873
+ /**
874
+ * trustedSigner
875
+ * view
876
+ */
877
+ async trustedSigner(): Promise<`0x${string}`> {
878
+ return this.contract.read.trustedSigner() as Promise<`0x${string}`>;
879
+ }
880
+
881
+ /**
882
+ * xStakes
883
+ * view
884
+ */
885
+ async xStakes(arg0: bigint, arg1: `0x${string}`): Promise<bigint> {
886
+ return this.contract.read.xStakes([arg0, arg1] as const) as Promise<bigint>;
887
+ }
888
+
889
+ /**
890
+ * addAdmin
891
+ * nonpayable
892
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
893
+ */
894
+ async addAdmin(admin: `0x${string}`, options?: {
895
+ accessList?: import('viem').AccessList;
896
+ authorizationList?: import('viem').AuthorizationList;
897
+ chain?: import('viem').Chain | null;
898
+ dataSuffix?: `0x${string}`;
899
+ gas?: bigint;
900
+ gasPrice?: bigint;
901
+ maxFeePerGas?: bigint;
902
+ maxPriorityFeePerGas?: bigint;
903
+ nonce?: number;
904
+ value?: bigint;
905
+ }): Promise<`0x${string}`> {
906
+ if (!this.contract.write) {
907
+ throw new Error('Wallet client is required for write operations');
908
+ }
909
+ return this.contract.write.addAdmin([admin] as const, options) as Promise<`0x${string}`>;
910
+ }
911
+
912
+ /**
913
+ * createRound
914
+ * nonpayable
915
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
916
+ */
917
+ async createRound(start: bigint, duration: bigint, meta: string, options?: {
918
+ accessList?: import('viem').AccessList;
919
+ authorizationList?: import('viem').AuthorizationList;
920
+ chain?: import('viem').Chain | null;
921
+ dataSuffix?: `0x${string}`;
922
+ gas?: bigint;
923
+ gasPrice?: bigint;
924
+ maxFeePerGas?: bigint;
925
+ maxPriorityFeePerGas?: bigint;
926
+ nonce?: number;
927
+ value?: bigint;
928
+ }): Promise<`0x${string}`> {
929
+ if (!this.contract.write) {
930
+ throw new Error('Wallet client is required for write operations');
931
+ }
932
+ return this.contract.write.createRound([start, duration, meta] as const, options) as Promise<`0x${string}`>;
933
+ }
934
+
935
+ /**
936
+ * grantRole
937
+ * nonpayable
938
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
939
+ */
940
+ async grantRole(role: `0x${string}`, account: `0x${string}`, options?: {
941
+ accessList?: import('viem').AccessList;
942
+ authorizationList?: import('viem').AuthorizationList;
943
+ chain?: import('viem').Chain | null;
944
+ dataSuffix?: `0x${string}`;
945
+ gas?: bigint;
946
+ gasPrice?: bigint;
947
+ maxFeePerGas?: bigint;
948
+ maxPriorityFeePerGas?: bigint;
949
+ nonce?: number;
950
+ value?: bigint;
951
+ }): Promise<`0x${string}`> {
952
+ if (!this.contract.write) {
953
+ throw new Error('Wallet client is required for write operations');
954
+ }
955
+ return this.contract.write.grantRole([role, account] as const, options) as Promise<`0x${string}`>;
956
+ }
957
+
958
+ /**
959
+ * migrateStake
960
+ * nonpayable
961
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
962
+ */
963
+ async migrateStake(fromRound: bigint, options?: {
964
+ accessList?: import('viem').AccessList;
965
+ authorizationList?: import('viem').AuthorizationList;
966
+ chain?: import('viem').Chain | null;
967
+ dataSuffix?: `0x${string}`;
968
+ gas?: bigint;
969
+ gasPrice?: bigint;
970
+ maxFeePerGas?: bigint;
971
+ maxPriorityFeePerGas?: bigint;
972
+ nonce?: number;
973
+ value?: bigint;
974
+ }): Promise<`0x${string}`> {
975
+ if (!this.contract.write) {
976
+ throw new Error('Wallet client is required for write operations');
977
+ }
978
+ return this.contract.write.migrateStake([fromRound] as const, options) as Promise<`0x${string}`>;
979
+ }
980
+
981
+ /**
982
+ * removeAdmin
983
+ * nonpayable
984
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
985
+ */
986
+ async removeAdmin(admin: `0x${string}`, options?: {
987
+ accessList?: import('viem').AccessList;
988
+ authorizationList?: import('viem').AuthorizationList;
989
+ chain?: import('viem').Chain | null;
990
+ dataSuffix?: `0x${string}`;
991
+ gas?: bigint;
992
+ gasPrice?: bigint;
993
+ maxFeePerGas?: bigint;
994
+ maxPriorityFeePerGas?: bigint;
995
+ nonce?: number;
996
+ value?: bigint;
997
+ }): Promise<`0x${string}`> {
998
+ if (!this.contract.write) {
999
+ throw new Error('Wallet client is required for write operations');
1000
+ }
1001
+ return this.contract.write.removeAdmin([admin] as const, options) as Promise<`0x${string}`>;
1002
+ }
1003
+
1004
+ /**
1005
+ * renounceRole
1006
+ * nonpayable
1007
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1008
+ */
1009
+ async renounceRole(role: `0x${string}`, account: `0x${string}`, options?: {
1010
+ accessList?: import('viem').AccessList;
1011
+ authorizationList?: import('viem').AuthorizationList;
1012
+ chain?: import('viem').Chain | null;
1013
+ dataSuffix?: `0x${string}`;
1014
+ gas?: bigint;
1015
+ gasPrice?: bigint;
1016
+ maxFeePerGas?: bigint;
1017
+ maxPriorityFeePerGas?: bigint;
1018
+ nonce?: number;
1019
+ value?: bigint;
1020
+ }): Promise<`0x${string}`> {
1021
+ if (!this.contract.write) {
1022
+ throw new Error('Wallet client is required for write operations');
1023
+ }
1024
+ return this.contract.write.renounceRole([role, account] as const, options) as Promise<`0x${string}`>;
1025
+ }
1026
+
1027
+ /**
1028
+ * revokeRole
1029
+ * nonpayable
1030
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1031
+ */
1032
+ async revokeRole(role: `0x${string}`, account: `0x${string}`, options?: {
1033
+ accessList?: import('viem').AccessList;
1034
+ authorizationList?: import('viem').AuthorizationList;
1035
+ chain?: import('viem').Chain | null;
1036
+ dataSuffix?: `0x${string}`;
1037
+ gas?: bigint;
1038
+ gasPrice?: bigint;
1039
+ maxFeePerGas?: bigint;
1040
+ maxPriorityFeePerGas?: bigint;
1041
+ nonce?: number;
1042
+ value?: bigint;
1043
+ }): Promise<`0x${string}`> {
1044
+ if (!this.contract.write) {
1045
+ throw new Error('Wallet client is required for write operations');
1046
+ }
1047
+ return this.contract.write.revokeRole([role, account] as const, options) as Promise<`0x${string}`>;
1048
+ }
1049
+
1050
+ /**
1051
+ * stake
1052
+ * nonpayable
1053
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1054
+ */
1055
+ async stake(roundId: bigint, amount: bigint, options?: {
1056
+ accessList?: import('viem').AccessList;
1057
+ authorizationList?: import('viem').AuthorizationList;
1058
+ chain?: import('viem').Chain | null;
1059
+ dataSuffix?: `0x${string}`;
1060
+ gas?: bigint;
1061
+ gasPrice?: bigint;
1062
+ maxFeePerGas?: bigint;
1063
+ maxPriorityFeePerGas?: bigint;
1064
+ nonce?: number;
1065
+ value?: bigint;
1066
+ }): Promise<`0x${string}`> {
1067
+ if (!this.contract.write) {
1068
+ throw new Error('Wallet client is required for write operations');
1069
+ }
1070
+ return this.contract.write.stake([roundId, amount] as const, options) as Promise<`0x${string}`>;
1071
+ }
1072
+
1073
+ /**
1074
+ * stakeUsers
1075
+ * nonpayable
1076
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1077
+ */
1078
+ async stakeUsers(roundId: bigint, users: `0x${string}`[], amounts: bigint[], options?: {
1079
+ accessList?: import('viem').AccessList;
1080
+ authorizationList?: import('viem').AuthorizationList;
1081
+ chain?: import('viem').Chain | null;
1082
+ dataSuffix?: `0x${string}`;
1083
+ gas?: bigint;
1084
+ gasPrice?: bigint;
1085
+ maxFeePerGas?: bigint;
1086
+ maxPriorityFeePerGas?: bigint;
1087
+ nonce?: number;
1088
+ value?: bigint;
1089
+ }): Promise<`0x${string}`> {
1090
+ if (!this.contract.write) {
1091
+ throw new Error('Wallet client is required for write operations');
1092
+ }
1093
+ return this.contract.write.stakeUsers([roundId, users, amounts] as const, options) as Promise<`0x${string}`>;
1094
+ }
1095
+
1096
+ /**
1097
+ * unstake
1098
+ * nonpayable
1099
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1100
+ */
1101
+ async unstake(roundId: bigint, amount: bigint, options?: {
1102
+ accessList?: import('viem').AccessList;
1103
+ authorizationList?: import('viem').AuthorizationList;
1104
+ chain?: import('viem').Chain | null;
1105
+ dataSuffix?: `0x${string}`;
1106
+ gas?: bigint;
1107
+ gasPrice?: bigint;
1108
+ maxFeePerGas?: bigint;
1109
+ maxPriorityFeePerGas?: bigint;
1110
+ nonce?: number;
1111
+ value?: bigint;
1112
+ }): Promise<`0x${string}`> {
1113
+ if (!this.contract.write) {
1114
+ throw new Error('Wallet client is required for write operations');
1115
+ }
1116
+ return this.contract.write.unstake([roundId, amount] as const, options) as Promise<`0x${string}`>;
1117
+ }
1118
+
1119
+ /**
1120
+ * unstakeUsers
1121
+ * nonpayable
1122
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1123
+ */
1124
+ async unstakeUsers(roundId: bigint, users: `0x${string}`[], options?: {
1125
+ accessList?: import('viem').AccessList;
1126
+ authorizationList?: import('viem').AuthorizationList;
1127
+ chain?: import('viem').Chain | null;
1128
+ dataSuffix?: `0x${string}`;
1129
+ gas?: bigint;
1130
+ gasPrice?: bigint;
1131
+ maxFeePerGas?: bigint;
1132
+ maxPriorityFeePerGas?: bigint;
1133
+ nonce?: number;
1134
+ value?: bigint;
1135
+ }): Promise<`0x${string}`> {
1136
+ if (!this.contract.write) {
1137
+ throw new Error('Wallet client is required for write operations');
1138
+ }
1139
+ return this.contract.write.unstakeUsers([roundId, users] as const, options) as Promise<`0x${string}`>;
1140
+ }
1141
+
1142
+
1143
+
1144
+ /**
1145
+ * Simulate contract write operations (dry-run without sending transaction)
1146
+ *
1147
+ * @example
1148
+ * const result = await contract.simulate.transfer('0x...', 1000n);
1149
+ * console.log('Gas estimate:', result.request.gas);
1150
+ * console.log('Would succeed:', result.result);
1151
+ */
1152
+ get simulate() {
1153
+ const contract = this.contract;
1154
+ if (!contract.simulate) {
1155
+ throw new Error('Public client is required for simulation');
1156
+ }
1157
+ return {
1158
+ /**
1159
+ * Simulate addAdmin
1160
+ * Returns gas estimate and result without sending transaction
1161
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1162
+ */
1163
+ async addAdmin(admin: `0x${string}`, options?: {
1164
+ accessList?: import('viem').AccessList;
1165
+ authorizationList?: import('viem').AuthorizationList;
1166
+ chain?: import('viem').Chain | null;
1167
+ dataSuffix?: `0x${string}`;
1168
+ gas?: bigint;
1169
+ gasPrice?: bigint;
1170
+ maxFeePerGas?: bigint;
1171
+ maxPriorityFeePerGas?: bigint;
1172
+ nonce?: number;
1173
+ value?: bigint;
1174
+ }): Promise<void> {
1175
+ return contract.simulate.addAdmin([admin] as const, options) as Promise<void>;
1176
+ },
1177
+ /**
1178
+ * Simulate createRound
1179
+ * Returns gas estimate and result without sending transaction
1180
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1181
+ */
1182
+ async createRound(start: bigint, duration: bigint, meta: string, options?: {
1183
+ accessList?: import('viem').AccessList;
1184
+ authorizationList?: import('viem').AuthorizationList;
1185
+ chain?: import('viem').Chain | null;
1186
+ dataSuffix?: `0x${string}`;
1187
+ gas?: bigint;
1188
+ gasPrice?: bigint;
1189
+ maxFeePerGas?: bigint;
1190
+ maxPriorityFeePerGas?: bigint;
1191
+ nonce?: number;
1192
+ value?: bigint;
1193
+ }): Promise<void> {
1194
+ return contract.simulate.createRound([start, duration, meta] as const, options) as Promise<void>;
1195
+ },
1196
+ /**
1197
+ * Simulate grantRole
1198
+ * Returns gas estimate and result without sending transaction
1199
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1200
+ */
1201
+ async grantRole(role: `0x${string}`, account: `0x${string}`, options?: {
1202
+ accessList?: import('viem').AccessList;
1203
+ authorizationList?: import('viem').AuthorizationList;
1204
+ chain?: import('viem').Chain | null;
1205
+ dataSuffix?: `0x${string}`;
1206
+ gas?: bigint;
1207
+ gasPrice?: bigint;
1208
+ maxFeePerGas?: bigint;
1209
+ maxPriorityFeePerGas?: bigint;
1210
+ nonce?: number;
1211
+ value?: bigint;
1212
+ }): Promise<void> {
1213
+ return contract.simulate.grantRole([role, account] as const, options) as Promise<void>;
1214
+ },
1215
+ /**
1216
+ * Simulate migrateStake
1217
+ * Returns gas estimate and result without sending transaction
1218
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1219
+ */
1220
+ async migrateStake(fromRound: bigint, options?: {
1221
+ accessList?: import('viem').AccessList;
1222
+ authorizationList?: import('viem').AuthorizationList;
1223
+ chain?: import('viem').Chain | null;
1224
+ dataSuffix?: `0x${string}`;
1225
+ gas?: bigint;
1226
+ gasPrice?: bigint;
1227
+ maxFeePerGas?: bigint;
1228
+ maxPriorityFeePerGas?: bigint;
1229
+ nonce?: number;
1230
+ value?: bigint;
1231
+ }): Promise<void> {
1232
+ return contract.simulate.migrateStake([fromRound] as const, options) as Promise<void>;
1233
+ },
1234
+ /**
1235
+ * Simulate removeAdmin
1236
+ * Returns gas estimate and result without sending transaction
1237
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1238
+ */
1239
+ async removeAdmin(admin: `0x${string}`, options?: {
1240
+ accessList?: import('viem').AccessList;
1241
+ authorizationList?: import('viem').AuthorizationList;
1242
+ chain?: import('viem').Chain | null;
1243
+ dataSuffix?: `0x${string}`;
1244
+ gas?: bigint;
1245
+ gasPrice?: bigint;
1246
+ maxFeePerGas?: bigint;
1247
+ maxPriorityFeePerGas?: bigint;
1248
+ nonce?: number;
1249
+ value?: bigint;
1250
+ }): Promise<void> {
1251
+ return contract.simulate.removeAdmin([admin] as const, options) as Promise<void>;
1252
+ },
1253
+ /**
1254
+ * Simulate renounceRole
1255
+ * Returns gas estimate and result without sending transaction
1256
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1257
+ */
1258
+ async renounceRole(role: `0x${string}`, account: `0x${string}`, options?: {
1259
+ accessList?: import('viem').AccessList;
1260
+ authorizationList?: import('viem').AuthorizationList;
1261
+ chain?: import('viem').Chain | null;
1262
+ dataSuffix?: `0x${string}`;
1263
+ gas?: bigint;
1264
+ gasPrice?: bigint;
1265
+ maxFeePerGas?: bigint;
1266
+ maxPriorityFeePerGas?: bigint;
1267
+ nonce?: number;
1268
+ value?: bigint;
1269
+ }): Promise<void> {
1270
+ return contract.simulate.renounceRole([role, account] as const, options) as Promise<void>;
1271
+ },
1272
+ /**
1273
+ * Simulate revokeRole
1274
+ * Returns gas estimate and result without sending transaction
1275
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1276
+ */
1277
+ async revokeRole(role: `0x${string}`, account: `0x${string}`, options?: {
1278
+ accessList?: import('viem').AccessList;
1279
+ authorizationList?: import('viem').AuthorizationList;
1280
+ chain?: import('viem').Chain | null;
1281
+ dataSuffix?: `0x${string}`;
1282
+ gas?: bigint;
1283
+ gasPrice?: bigint;
1284
+ maxFeePerGas?: bigint;
1285
+ maxPriorityFeePerGas?: bigint;
1286
+ nonce?: number;
1287
+ value?: bigint;
1288
+ }): Promise<void> {
1289
+ return contract.simulate.revokeRole([role, account] as const, options) as Promise<void>;
1290
+ },
1291
+ /**
1292
+ * Simulate stake
1293
+ * Returns gas estimate and result without sending transaction
1294
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1295
+ */
1296
+ async stake(roundId: bigint, amount: bigint, options?: {
1297
+ accessList?: import('viem').AccessList;
1298
+ authorizationList?: import('viem').AuthorizationList;
1299
+ chain?: import('viem').Chain | null;
1300
+ dataSuffix?: `0x${string}`;
1301
+ gas?: bigint;
1302
+ gasPrice?: bigint;
1303
+ maxFeePerGas?: bigint;
1304
+ maxPriorityFeePerGas?: bigint;
1305
+ nonce?: number;
1306
+ value?: bigint;
1307
+ }): Promise<void> {
1308
+ return contract.simulate.stake([roundId, amount] as const, options) as Promise<void>;
1309
+ },
1310
+ /**
1311
+ * Simulate stakeUsers
1312
+ * Returns gas estimate and result without sending transaction
1313
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1314
+ */
1315
+ async stakeUsers(roundId: bigint, users: `0x${string}`[], amounts: bigint[], options?: {
1316
+ accessList?: import('viem').AccessList;
1317
+ authorizationList?: import('viem').AuthorizationList;
1318
+ chain?: import('viem').Chain | null;
1319
+ dataSuffix?: `0x${string}`;
1320
+ gas?: bigint;
1321
+ gasPrice?: bigint;
1322
+ maxFeePerGas?: bigint;
1323
+ maxPriorityFeePerGas?: bigint;
1324
+ nonce?: number;
1325
+ value?: bigint;
1326
+ }): Promise<void> {
1327
+ return contract.simulate.stakeUsers([roundId, users, amounts] as const, options) as Promise<void>;
1328
+ },
1329
+ /**
1330
+ * Simulate unstake
1331
+ * Returns gas estimate and result without sending transaction
1332
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1333
+ */
1334
+ async unstake(roundId: bigint, amount: bigint, options?: {
1335
+ accessList?: import('viem').AccessList;
1336
+ authorizationList?: import('viem').AuthorizationList;
1337
+ chain?: import('viem').Chain | null;
1338
+ dataSuffix?: `0x${string}`;
1339
+ gas?: bigint;
1340
+ gasPrice?: bigint;
1341
+ maxFeePerGas?: bigint;
1342
+ maxPriorityFeePerGas?: bigint;
1343
+ nonce?: number;
1344
+ value?: bigint;
1345
+ }): Promise<void> {
1346
+ return contract.simulate.unstake([roundId, amount] as const, options) as Promise<void>;
1347
+ },
1348
+ /**
1349
+ * Simulate unstakeUsers
1350
+ * Returns gas estimate and result without sending transaction
1351
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1352
+ */
1353
+ async unstakeUsers(roundId: bigint, users: `0x${string}`[], options?: {
1354
+ accessList?: import('viem').AccessList;
1355
+ authorizationList?: import('viem').AuthorizationList;
1356
+ chain?: import('viem').Chain | null;
1357
+ dataSuffix?: `0x${string}`;
1358
+ gas?: bigint;
1359
+ gasPrice?: bigint;
1360
+ maxFeePerGas?: bigint;
1361
+ maxPriorityFeePerGas?: bigint;
1362
+ nonce?: number;
1363
+ value?: bigint;
1364
+ }): Promise<void> {
1365
+ return contract.simulate.unstakeUsers([roundId, users] as const, options) as Promise<void>;
1366
+ }
1367
+ };
1368
+ }
1369
+
1370
+ /**
1371
+ * Watch contract events
1372
+ *
1373
+ * @example
1374
+ * // Watch all Transfer events
1375
+ * const unwatch = contract.watch.Transfer((event) => {
1376
+ * console.log('Transfer:', event);
1377
+ * });
1378
+ *
1379
+ * // Stop watching
1380
+ * unwatch();
1381
+ */
1382
+ get watch() {
1383
+ return {
1384
+ /**
1385
+ * Watch RoleAdminChanged events
1386
+ * @param callback Function to call when event is emitted
1387
+ * @param filter Optional filter for indexed parameters
1388
+ * @returns Unwatch function to stop listening
1389
+ */
1390
+ RoleAdminChanged: (callback: (event: { role: `0x${string}`; previousAdminRole: `0x${string}`; newAdminRole: `0x${string}` }) => void, filter?: { role?: `0x${string}` | `0x${string}`[] | null; previousAdminRole?: `0x${string}` | `0x${string}`[] | null; newAdminRole?: `0x${string}` | `0x${string}`[] | null }) => {
1391
+ return this.publicClient.watchContractEvent({
1392
+ address: this.contractAddress,
1393
+ abi: IDStakingAbi,
1394
+ eventName: 'RoleAdminChanged',
1395
+ args: filter as any,
1396
+ onLogs: (logs: any[]) => {
1397
+ logs.forEach((log: any) => {
1398
+ callback(log.args as any);
1399
+ });
1400
+ },
1401
+ }) as () => void;
1402
+ },
1403
+ /**
1404
+ * Watch RoleGranted events
1405
+ * @param callback Function to call when event is emitted
1406
+ * @param filter Optional filter for indexed parameters
1407
+ * @returns Unwatch function to stop listening
1408
+ */
1409
+ RoleGranted: (callback: (event: { role: `0x${string}`; account: `0x${string}`; sender: `0x${string}` }) => void, filter?: { role?: `0x${string}` | `0x${string}`[] | null; account?: `0x${string}` | `0x${string}`[] | null; sender?: `0x${string}` | `0x${string}`[] | null }) => {
1410
+ return this.publicClient.watchContractEvent({
1411
+ address: this.contractAddress,
1412
+ abi: IDStakingAbi,
1413
+ eventName: 'RoleGranted',
1414
+ args: filter as any,
1415
+ onLogs: (logs: any[]) => {
1416
+ logs.forEach((log: any) => {
1417
+ callback(log.args as any);
1418
+ });
1419
+ },
1420
+ }) as () => void;
1421
+ },
1422
+ /**
1423
+ * Watch RoleRevoked events
1424
+ * @param callback Function to call when event is emitted
1425
+ * @param filter Optional filter for indexed parameters
1426
+ * @returns Unwatch function to stop listening
1427
+ */
1428
+ RoleRevoked: (callback: (event: { role: `0x${string}`; account: `0x${string}`; sender: `0x${string}` }) => void, filter?: { role?: `0x${string}` | `0x${string}`[] | null; account?: `0x${string}` | `0x${string}`[] | null; sender?: `0x${string}` | `0x${string}`[] | null }) => {
1429
+ return this.publicClient.watchContractEvent({
1430
+ address: this.contractAddress,
1431
+ abi: IDStakingAbi,
1432
+ eventName: 'RoleRevoked',
1433
+ args: filter as any,
1434
+ onLogs: (logs: any[]) => {
1435
+ logs.forEach((log: any) => {
1436
+ callback(log.args as any);
1437
+ });
1438
+ },
1439
+ }) as () => void;
1440
+ },
1441
+ /**
1442
+ * Watch roundCreated events
1443
+ * @param callback Function to call when event is emitted
1444
+ * @param filter Optional filter for indexed parameters
1445
+ * @returns Unwatch function to stop listening
1446
+ */
1447
+ roundCreated: (callback: (event: { id: bigint }) => void) => {
1448
+ return this.publicClient.watchContractEvent({
1449
+ address: this.contractAddress,
1450
+ abi: IDStakingAbi,
1451
+ eventName: 'roundCreated',
1452
+
1453
+ onLogs: (logs: any[]) => {
1454
+ logs.forEach((log: any) => {
1455
+ callback(log.args as any);
1456
+ });
1457
+ },
1458
+ }) as () => void;
1459
+ },
1460
+ /**
1461
+ * Watch selfStake events
1462
+ * @param callback Function to call when event is emitted
1463
+ * @param filter Optional filter for indexed parameters
1464
+ * @returns Unwatch function to stop listening
1465
+ */
1466
+ selfStake: (callback: (event: { roundId: bigint; staker: `0x${string}`; amount: bigint; staked: boolean }) => void) => {
1467
+ return this.publicClient.watchContractEvent({
1468
+ address: this.contractAddress,
1469
+ abi: IDStakingAbi,
1470
+ eventName: 'selfStake',
1471
+
1472
+ onLogs: (logs: any[]) => {
1473
+ logs.forEach((log: any) => {
1474
+ callback(log.args as any);
1475
+ });
1476
+ },
1477
+ }) as () => void;
1478
+ },
1479
+ /**
1480
+ * Watch tokenMigrated events
1481
+ * @param callback Function to call when event is emitted
1482
+ * @param filter Optional filter for indexed parameters
1483
+ * @returns Unwatch function to stop listening
1484
+ */
1485
+ tokenMigrated: (callback: (event: { staker: `0x${string}`; amount: bigint; fromRound: bigint; toRound: bigint }) => void) => {
1486
+ return this.publicClient.watchContractEvent({
1487
+ address: this.contractAddress,
1488
+ abi: IDStakingAbi,
1489
+ eventName: 'tokenMigrated',
1490
+
1491
+ onLogs: (logs: any[]) => {
1492
+ logs.forEach((log: any) => {
1493
+ callback(log.args as any);
1494
+ });
1495
+ },
1496
+ }) as () => void;
1497
+ },
1498
+ /**
1499
+ * Watch xStake events
1500
+ * @param callback Function to call when event is emitted
1501
+ * @param filter Optional filter for indexed parameters
1502
+ * @returns Unwatch function to stop listening
1503
+ */
1504
+ xStake: (callback: (event: { roundId: bigint; staker: `0x${string}`; user: `0x${string}`; amount: bigint; staked: boolean }) => void) => {
1505
+ return this.publicClient.watchContractEvent({
1506
+ address: this.contractAddress,
1507
+ abi: IDStakingAbi,
1508
+ eventName: 'xStake',
1509
+
1510
+ onLogs: (logs: any[]) => {
1511
+ logs.forEach((log: any) => {
1512
+ callback(log.args as any);
1513
+ });
1514
+ },
1515
+ }) as () => void;
1516
+ }
1517
+ };
1518
+ }
1519
+ }