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