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