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