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