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