@gitmyabi/usdt 1.0.29 → 1.0.30

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