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