@gitmyabi/citty 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,1040 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * CittyCoin_json ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const CittyCoin_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": false,
128
+ "internalType": "address",
129
+ "name": "target",
130
+ "type": "address"
131
+ }
132
+ ],
133
+ "name": "AccountFrozen",
134
+ "type": "event"
135
+ },
136
+ {
137
+ "anonymous": false,
138
+ "inputs": [
139
+ {
140
+ "indexed": false,
141
+ "internalType": "address",
142
+ "name": "target",
143
+ "type": "address"
144
+ }
145
+ ],
146
+ "name": "AccountUnfrozen",
147
+ "type": "event"
148
+ },
149
+ {
150
+ "anonymous": false,
151
+ "inputs": [
152
+ {
153
+ "indexed": true,
154
+ "internalType": "address",
155
+ "name": "owner",
156
+ "type": "address"
157
+ },
158
+ {
159
+ "indexed": true,
160
+ "internalType": "address",
161
+ "name": "spender",
162
+ "type": "address"
163
+ },
164
+ {
165
+ "indexed": false,
166
+ "internalType": "uint256",
167
+ "name": "value",
168
+ "type": "uint256"
169
+ }
170
+ ],
171
+ "name": "Approval",
172
+ "type": "event"
173
+ },
174
+ {
175
+ "anonymous": false,
176
+ "inputs": [
177
+ {
178
+ "indexed": true,
179
+ "internalType": "address",
180
+ "name": "previousOwner",
181
+ "type": "address"
182
+ },
183
+ {
184
+ "indexed": true,
185
+ "internalType": "address",
186
+ "name": "newOwner",
187
+ "type": "address"
188
+ }
189
+ ],
190
+ "name": "OwnershipTransferred",
191
+ "type": "event"
192
+ },
193
+ {
194
+ "anonymous": false,
195
+ "inputs": [
196
+ {
197
+ "indexed": true,
198
+ "internalType": "address",
199
+ "name": "from",
200
+ "type": "address"
201
+ },
202
+ {
203
+ "indexed": true,
204
+ "internalType": "address",
205
+ "name": "to",
206
+ "type": "address"
207
+ },
208
+ {
209
+ "indexed": false,
210
+ "internalType": "uint256",
211
+ "name": "value",
212
+ "type": "uint256"
213
+ }
214
+ ],
215
+ "name": "Transfer",
216
+ "type": "event"
217
+ },
218
+ {
219
+ "inputs": [
220
+ {
221
+ "internalType": "address",
222
+ "name": "owner",
223
+ "type": "address"
224
+ },
225
+ {
226
+ "internalType": "address",
227
+ "name": "spender",
228
+ "type": "address"
229
+ }
230
+ ],
231
+ "name": "allowance",
232
+ "outputs": [
233
+ {
234
+ "internalType": "uint256",
235
+ "name": "",
236
+ "type": "uint256"
237
+ }
238
+ ],
239
+ "stateMutability": "view",
240
+ "type": "function"
241
+ },
242
+ {
243
+ "inputs": [
244
+ {
245
+ "internalType": "address",
246
+ "name": "spender",
247
+ "type": "address"
248
+ },
249
+ {
250
+ "internalType": "uint256",
251
+ "name": "value",
252
+ "type": "uint256"
253
+ }
254
+ ],
255
+ "name": "approve",
256
+ "outputs": [
257
+ {
258
+ "internalType": "bool",
259
+ "name": "",
260
+ "type": "bool"
261
+ }
262
+ ],
263
+ "stateMutability": "nonpayable",
264
+ "type": "function"
265
+ },
266
+ {
267
+ "inputs": [
268
+ {
269
+ "internalType": "address",
270
+ "name": "account",
271
+ "type": "address"
272
+ }
273
+ ],
274
+ "name": "balanceOf",
275
+ "outputs": [
276
+ {
277
+ "internalType": "uint256",
278
+ "name": "",
279
+ "type": "uint256"
280
+ }
281
+ ],
282
+ "stateMutability": "view",
283
+ "type": "function"
284
+ },
285
+ {
286
+ "inputs": [],
287
+ "name": "decimals",
288
+ "outputs": [
289
+ {
290
+ "internalType": "uint8",
291
+ "name": "",
292
+ "type": "uint8"
293
+ }
294
+ ],
295
+ "stateMutability": "view",
296
+ "type": "function"
297
+ },
298
+ {
299
+ "inputs": [
300
+ {
301
+ "internalType": "address",
302
+ "name": "target",
303
+ "type": "address"
304
+ }
305
+ ],
306
+ "name": "freezeAccount",
307
+ "outputs": [],
308
+ "stateMutability": "nonpayable",
309
+ "type": "function"
310
+ },
311
+ {
312
+ "inputs": [
313
+ {
314
+ "internalType": "address",
315
+ "name": "",
316
+ "type": "address"
317
+ }
318
+ ],
319
+ "name": "frozenAccounts",
320
+ "outputs": [
321
+ {
322
+ "internalType": "bool",
323
+ "name": "",
324
+ "type": "bool"
325
+ }
326
+ ],
327
+ "stateMutability": "view",
328
+ "type": "function"
329
+ },
330
+ {
331
+ "inputs": [],
332
+ "name": "name",
333
+ "outputs": [
334
+ {
335
+ "internalType": "string",
336
+ "name": "",
337
+ "type": "string"
338
+ }
339
+ ],
340
+ "stateMutability": "view",
341
+ "type": "function"
342
+ },
343
+ {
344
+ "inputs": [],
345
+ "name": "owner",
346
+ "outputs": [
347
+ {
348
+ "internalType": "address",
349
+ "name": "",
350
+ "type": "address"
351
+ }
352
+ ],
353
+ "stateMutability": "view",
354
+ "type": "function"
355
+ },
356
+ {
357
+ "inputs": [],
358
+ "name": "renounceOwnership",
359
+ "outputs": [],
360
+ "stateMutability": "nonpayable",
361
+ "type": "function"
362
+ },
363
+ {
364
+ "inputs": [],
365
+ "name": "symbol",
366
+ "outputs": [
367
+ {
368
+ "internalType": "string",
369
+ "name": "",
370
+ "type": "string"
371
+ }
372
+ ],
373
+ "stateMutability": "view",
374
+ "type": "function"
375
+ },
376
+ {
377
+ "inputs": [],
378
+ "name": "totalSupply",
379
+ "outputs": [
380
+ {
381
+ "internalType": "uint256",
382
+ "name": "",
383
+ "type": "uint256"
384
+ }
385
+ ],
386
+ "stateMutability": "view",
387
+ "type": "function"
388
+ },
389
+ {
390
+ "inputs": [
391
+ {
392
+ "internalType": "address",
393
+ "name": "to",
394
+ "type": "address"
395
+ },
396
+ {
397
+ "internalType": "uint256",
398
+ "name": "amount",
399
+ "type": "uint256"
400
+ }
401
+ ],
402
+ "name": "transfer",
403
+ "outputs": [
404
+ {
405
+ "internalType": "bool",
406
+ "name": "",
407
+ "type": "bool"
408
+ }
409
+ ],
410
+ "stateMutability": "nonpayable",
411
+ "type": "function"
412
+ },
413
+ {
414
+ "inputs": [
415
+ {
416
+ "internalType": "address",
417
+ "name": "from",
418
+ "type": "address"
419
+ },
420
+ {
421
+ "internalType": "address",
422
+ "name": "to",
423
+ "type": "address"
424
+ },
425
+ {
426
+ "internalType": "uint256",
427
+ "name": "amount",
428
+ "type": "uint256"
429
+ }
430
+ ],
431
+ "name": "transferFrom",
432
+ "outputs": [
433
+ {
434
+ "internalType": "bool",
435
+ "name": "",
436
+ "type": "bool"
437
+ }
438
+ ],
439
+ "stateMutability": "nonpayable",
440
+ "type": "function"
441
+ },
442
+ {
443
+ "inputs": [
444
+ {
445
+ "internalType": "address",
446
+ "name": "newOwner",
447
+ "type": "address"
448
+ }
449
+ ],
450
+ "name": "transferOwnership",
451
+ "outputs": [],
452
+ "stateMutability": "nonpayable",
453
+ "type": "function"
454
+ },
455
+ {
456
+ "inputs": [
457
+ {
458
+ "internalType": "address",
459
+ "name": "target",
460
+ "type": "address"
461
+ }
462
+ ],
463
+ "name": "unfreezeAccount",
464
+ "outputs": [],
465
+ "stateMutability": "nonpayable",
466
+ "type": "function"
467
+ }
468
+ ] as const satisfies Abi;
469
+
470
+ /**
471
+ * Type-safe ABI for CittyCoin_json
472
+ */
473
+ export type CittyCoin_jsonAbi = typeof CittyCoin_jsonAbi;
474
+
475
+ /**
476
+ * Contract instance type for CittyCoin_json
477
+ */
478
+ // Use any for contract type to avoid complex viem type issues
479
+ // The runtime behavior is type-safe through viem's ABI typing
480
+ export type CittyCoin_jsonContract = any;
481
+
482
+ /**
483
+ * CittyCoin_json Contract Class
484
+ *
485
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
486
+ *
487
+ * @example
488
+ * ```typescript
489
+ * import { createPublicClient, createWalletClient, http } from 'viem';
490
+ * import { mainnet } from 'viem/chains';
491
+ * import { CittyCoin_json } from 'CittyCoin_json';
492
+ *
493
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
494
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
495
+ *
496
+ * const contract = new CittyCoin_json('0x...', { publicClient, walletClient });
497
+ *
498
+ * // Read functions
499
+ * const result = await contract.balanceOf('0x...');
500
+ *
501
+ * // Write functions
502
+ * const hash = await contract.transfer('0x...', 1000n);
503
+ *
504
+ * // Simulate transactions (dry-run)
505
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
506
+ * console.log('Gas estimate:', simulation.request.gas);
507
+ *
508
+ * // Watch events
509
+ * const unwatch = contract.watch.Transfer((event) => {
510
+ * console.log('Transfer event:', event);
511
+ * });
512
+ * ```
513
+ */
514
+ export class CittyCoin_json {
515
+ private contract: CittyCoin_jsonContract;
516
+ private contractAddress: Address;
517
+ private publicClient: PublicClient;
518
+
519
+ constructor(
520
+ address: Address,
521
+ clients: {
522
+ publicClient: PublicClient;
523
+ walletClient?: WalletClient;
524
+ }
525
+ ) {
526
+ this.contractAddress = address;
527
+ this.publicClient = clients.publicClient;
528
+ this.contract = getContract({
529
+ address,
530
+ abi: CittyCoin_jsonAbi,
531
+ client: {
532
+ public: clients.publicClient,
533
+ wallet: clients.walletClient,
534
+ },
535
+ });
536
+ }
537
+
538
+ /**
539
+ * Get the contract address
540
+ */
541
+ get address(): Address {
542
+ return this.contractAddress;
543
+ }
544
+
545
+ /**
546
+ * Get the underlying viem contract instance
547
+ */
548
+ getContract(): CittyCoin_jsonContract {
549
+ return this.contract;
550
+ }
551
+
552
+ /**
553
+ * allowance
554
+ * view
555
+ */
556
+ async allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
557
+ return this.contract.read.allowance([owner, spender] as const) as Promise<bigint>;
558
+ }
559
+
560
+ /**
561
+ * balanceOf
562
+ * view
563
+ */
564
+ async balanceOf(account: `0x${string}`): Promise<bigint> {
565
+ return this.contract.read.balanceOf([account] as const) as Promise<bigint>;
566
+ }
567
+
568
+ /**
569
+ * decimals
570
+ * view
571
+ */
572
+ async decimals(): Promise<bigint> {
573
+ return this.contract.read.decimals() as Promise<bigint>;
574
+ }
575
+
576
+ /**
577
+ * frozenAccounts
578
+ * view
579
+ */
580
+ async frozenAccounts(arg0: `0x${string}`): Promise<boolean> {
581
+ return this.contract.read.frozenAccounts([arg0] as const) as Promise<boolean>;
582
+ }
583
+
584
+ /**
585
+ * name
586
+ * view
587
+ */
588
+ async name(): Promise<string> {
589
+ return this.contract.read.name() as Promise<string>;
590
+ }
591
+
592
+ /**
593
+ * owner
594
+ * view
595
+ */
596
+ async owner(): Promise<`0x${string}`> {
597
+ return this.contract.read.owner() as Promise<`0x${string}`>;
598
+ }
599
+
600
+ /**
601
+ * symbol
602
+ * view
603
+ */
604
+ async symbol(): Promise<string> {
605
+ return this.contract.read.symbol() as Promise<string>;
606
+ }
607
+
608
+ /**
609
+ * totalSupply
610
+ * view
611
+ */
612
+ async totalSupply(): Promise<bigint> {
613
+ return this.contract.read.totalSupply() as Promise<bigint>;
614
+ }
615
+
616
+ /**
617
+ * approve
618
+ * nonpayable
619
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
620
+ */
621
+ async approve(spender: `0x${string}`, value: bigint, options?: {
622
+ accessList?: import('viem').AccessList;
623
+ authorizationList?: import('viem').AuthorizationList;
624
+ chain?: import('viem').Chain | null;
625
+ dataSuffix?: `0x${string}`;
626
+ gas?: bigint;
627
+ gasPrice?: bigint;
628
+ maxFeePerGas?: bigint;
629
+ maxPriorityFeePerGas?: bigint;
630
+ nonce?: number;
631
+ value?: bigint;
632
+ }): Promise<`0x${string}`> {
633
+ if (!this.contract.write) {
634
+ throw new Error('Wallet client is required for write operations');
635
+ }
636
+ return this.contract.write.approve([spender, value] as const, options) as Promise<`0x${string}`>;
637
+ }
638
+
639
+ /**
640
+ * freezeAccount
641
+ * nonpayable
642
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
643
+ */
644
+ async freezeAccount(target: `0x${string}`, 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.freezeAccount([target] as const, options) as Promise<`0x${string}`>;
660
+ }
661
+
662
+ /**
663
+ * renounceOwnership
664
+ * nonpayable
665
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
666
+ */
667
+ async renounceOwnership(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.renounceOwnership(options) as Promise<`0x${string}`>;
683
+ }
684
+
685
+ /**
686
+ * transfer
687
+ * nonpayable
688
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
689
+ */
690
+ async transfer(to: `0x${string}`, 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.transfer([to, amount] as const, options) as Promise<`0x${string}`>;
706
+ }
707
+
708
+ /**
709
+ * transferFrom
710
+ * nonpayable
711
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
712
+ */
713
+ async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: 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.transferFrom([from, to, amount] as const, options) as Promise<`0x${string}`>;
729
+ }
730
+
731
+ /**
732
+ * transferOwnership
733
+ * nonpayable
734
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
735
+ */
736
+ async transferOwnership(newOwner: `0x${string}`, 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.transferOwnership([newOwner] as const, options) as Promise<`0x${string}`>;
752
+ }
753
+
754
+ /**
755
+ * unfreezeAccount
756
+ * nonpayable
757
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
758
+ */
759
+ async unfreezeAccount(target: `0x${string}`, 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.unfreezeAccount([target] as const, options) as Promise<`0x${string}`>;
775
+ }
776
+
777
+
778
+
779
+ /**
780
+ * Simulate contract write operations (dry-run without sending transaction)
781
+ *
782
+ * @example
783
+ * const result = await contract.simulate.transfer('0x...', 1000n);
784
+ * console.log('Gas estimate:', result.request.gas);
785
+ * console.log('Would succeed:', result.result);
786
+ */
787
+ get simulate() {
788
+ const contract = this.contract;
789
+ if (!contract.simulate) {
790
+ throw new Error('Public client is required for simulation');
791
+ }
792
+ return {
793
+ /**
794
+ * Simulate approve
795
+ * Returns gas estimate and result without sending transaction
796
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
797
+ */
798
+ async approve(spender: `0x${string}`, value: bigint, options?: {
799
+ accessList?: import('viem').AccessList;
800
+ authorizationList?: import('viem').AuthorizationList;
801
+ chain?: import('viem').Chain | null;
802
+ dataSuffix?: `0x${string}`;
803
+ gas?: bigint;
804
+ gasPrice?: bigint;
805
+ maxFeePerGas?: bigint;
806
+ maxPriorityFeePerGas?: bigint;
807
+ nonce?: number;
808
+ value?: bigint;
809
+ }): Promise<boolean> {
810
+ return contract.simulate.approve([spender, value] as const, options) as Promise<boolean>;
811
+ },
812
+ /**
813
+ * Simulate freezeAccount
814
+ * Returns gas estimate and result without sending transaction
815
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
816
+ */
817
+ async freezeAccount(target: `0x${string}`, options?: {
818
+ accessList?: import('viem').AccessList;
819
+ authorizationList?: import('viem').AuthorizationList;
820
+ chain?: import('viem').Chain | null;
821
+ dataSuffix?: `0x${string}`;
822
+ gas?: bigint;
823
+ gasPrice?: bigint;
824
+ maxFeePerGas?: bigint;
825
+ maxPriorityFeePerGas?: bigint;
826
+ nonce?: number;
827
+ value?: bigint;
828
+ }): Promise<void> {
829
+ return contract.simulate.freezeAccount([target] as const, options) as Promise<void>;
830
+ },
831
+ /**
832
+ * Simulate renounceOwnership
833
+ * Returns gas estimate and result without sending transaction
834
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
835
+ */
836
+ async renounceOwnership(options?: {
837
+ accessList?: import('viem').AccessList;
838
+ authorizationList?: import('viem').AuthorizationList;
839
+ chain?: import('viem').Chain | null;
840
+ dataSuffix?: `0x${string}`;
841
+ gas?: bigint;
842
+ gasPrice?: bigint;
843
+ maxFeePerGas?: bigint;
844
+ maxPriorityFeePerGas?: bigint;
845
+ nonce?: number;
846
+ value?: bigint;
847
+ }): Promise<void> {
848
+ return contract.simulate.renounceOwnership(options) as Promise<void>;
849
+ },
850
+ /**
851
+ * Simulate transfer
852
+ * Returns gas estimate and result without sending transaction
853
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
854
+ */
855
+ async transfer(to: `0x${string}`, amount: bigint, options?: {
856
+ accessList?: import('viem').AccessList;
857
+ authorizationList?: import('viem').AuthorizationList;
858
+ chain?: import('viem').Chain | null;
859
+ dataSuffix?: `0x${string}`;
860
+ gas?: bigint;
861
+ gasPrice?: bigint;
862
+ maxFeePerGas?: bigint;
863
+ maxPriorityFeePerGas?: bigint;
864
+ nonce?: number;
865
+ value?: bigint;
866
+ }): Promise<boolean> {
867
+ return contract.simulate.transfer([to, amount] as const, options) as Promise<boolean>;
868
+ },
869
+ /**
870
+ * Simulate transferFrom
871
+ * Returns gas estimate and result without sending transaction
872
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
873
+ */
874
+ async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, 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<boolean> {
886
+ return contract.simulate.transferFrom([from, to, amount] as const, options) as Promise<boolean>;
887
+ },
888
+ /**
889
+ * Simulate transferOwnership
890
+ * Returns gas estimate and result without sending transaction
891
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
892
+ */
893
+ async transferOwnership(newOwner: `0x${string}`, options?: {
894
+ accessList?: import('viem').AccessList;
895
+ authorizationList?: import('viem').AuthorizationList;
896
+ chain?: import('viem').Chain | null;
897
+ dataSuffix?: `0x${string}`;
898
+ gas?: bigint;
899
+ gasPrice?: bigint;
900
+ maxFeePerGas?: bigint;
901
+ maxPriorityFeePerGas?: bigint;
902
+ nonce?: number;
903
+ value?: bigint;
904
+ }): Promise<void> {
905
+ return contract.simulate.transferOwnership([newOwner] as const, options) as Promise<void>;
906
+ },
907
+ /**
908
+ * Simulate unfreezeAccount
909
+ * Returns gas estimate and result without sending transaction
910
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
911
+ */
912
+ async unfreezeAccount(target: `0x${string}`, options?: {
913
+ accessList?: import('viem').AccessList;
914
+ authorizationList?: import('viem').AuthorizationList;
915
+ chain?: import('viem').Chain | null;
916
+ dataSuffix?: `0x${string}`;
917
+ gas?: bigint;
918
+ gasPrice?: bigint;
919
+ maxFeePerGas?: bigint;
920
+ maxPriorityFeePerGas?: bigint;
921
+ nonce?: number;
922
+ value?: bigint;
923
+ }): Promise<void> {
924
+ return contract.simulate.unfreezeAccount([target] as const, options) as Promise<void>;
925
+ }
926
+ };
927
+ }
928
+
929
+ /**
930
+ * Watch contract events
931
+ *
932
+ * @example
933
+ * // Watch all Transfer events
934
+ * const unwatch = contract.watch.Transfer((event) => {
935
+ * console.log('Transfer:', event);
936
+ * });
937
+ *
938
+ * // Stop watching
939
+ * unwatch();
940
+ */
941
+ get watch() {
942
+ return {
943
+ /**
944
+ * Watch AccountFrozen events
945
+ * @param callback Function to call when event is emitted
946
+ * @param filter Optional filter for indexed parameters
947
+ * @returns Unwatch function to stop listening
948
+ */
949
+ AccountFrozen: (callback: (event: { target: `0x${string}` }) => void) => {
950
+ return this.publicClient.watchContractEvent({
951
+ address: this.contractAddress,
952
+ abi: CittyCoin_jsonAbi,
953
+ eventName: 'AccountFrozen',
954
+
955
+ onLogs: (logs: any[]) => {
956
+ logs.forEach((log: any) => {
957
+ callback(log.args as any);
958
+ });
959
+ },
960
+ }) as () => void;
961
+ },
962
+ /**
963
+ * Watch AccountUnfrozen events
964
+ * @param callback Function to call when event is emitted
965
+ * @param filter Optional filter for indexed parameters
966
+ * @returns Unwatch function to stop listening
967
+ */
968
+ AccountUnfrozen: (callback: (event: { target: `0x${string}` }) => void) => {
969
+ return this.publicClient.watchContractEvent({
970
+ address: this.contractAddress,
971
+ abi: CittyCoin_jsonAbi,
972
+ eventName: 'AccountUnfrozen',
973
+
974
+ onLogs: (logs: any[]) => {
975
+ logs.forEach((log: any) => {
976
+ callback(log.args as any);
977
+ });
978
+ },
979
+ }) as () => void;
980
+ },
981
+ /**
982
+ * Watch Approval events
983
+ * @param callback Function to call when event is emitted
984
+ * @param filter Optional filter for indexed parameters
985
+ * @returns Unwatch function to stop listening
986
+ */
987
+ Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner: `0x${string}`; spender: `0x${string}` }) => {
988
+ return this.publicClient.watchContractEvent({
989
+ address: this.contractAddress,
990
+ abi: CittyCoin_jsonAbi,
991
+ eventName: 'Approval',
992
+ args: filter,
993
+ onLogs: (logs: any[]) => {
994
+ logs.forEach((log: any) => {
995
+ callback(log.args as any);
996
+ });
997
+ },
998
+ }) as () => void;
999
+ },
1000
+ /**
1001
+ * Watch OwnershipTransferred events
1002
+ * @param callback Function to call when event is emitted
1003
+ * @param filter Optional filter for indexed parameters
1004
+ * @returns Unwatch function to stop listening
1005
+ */
1006
+ OwnershipTransferred: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void, filter?: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => {
1007
+ return this.publicClient.watchContractEvent({
1008
+ address: this.contractAddress,
1009
+ abi: CittyCoin_jsonAbi,
1010
+ eventName: 'OwnershipTransferred',
1011
+ args: filter,
1012
+ onLogs: (logs: any[]) => {
1013
+ logs.forEach((log: any) => {
1014
+ callback(log.args as any);
1015
+ });
1016
+ },
1017
+ }) as () => void;
1018
+ },
1019
+ /**
1020
+ * Watch Transfer events
1021
+ * @param callback Function to call when event is emitted
1022
+ * @param filter Optional filter for indexed parameters
1023
+ * @returns Unwatch function to stop listening
1024
+ */
1025
+ Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from: `0x${string}`; to: `0x${string}` }) => {
1026
+ return this.publicClient.watchContractEvent({
1027
+ address: this.contractAddress,
1028
+ abi: CittyCoin_jsonAbi,
1029
+ eventName: 'Transfer',
1030
+ args: filter,
1031
+ onLogs: (logs: any[]) => {
1032
+ logs.forEach((log: any) => {
1033
+ callback(log.args as any);
1034
+ });
1035
+ },
1036
+ }) as () => void;
1037
+ }
1038
+ };
1039
+ }
1040
+ }