@gitmyabi-stg/lpt 0.0.1

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