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