@gitmyabi-stg/brbtc 0.0.1

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