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