@gitmyabi/usdt 1.0.29 → 1.0.30

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