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