@gitmyabi/dusd 0.0.0-stage → 1.0.1

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