@gitmyabi/give 0.0.0-stage → 1.0.1

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