@gitmyabi/usdt 1.0.19 → 1.0.21

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