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