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