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