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