@gitmyabi/usdt 1.0.10 → 1.0.12

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