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