@gitmyabi/usdt 1.0.1 → 1.0.2
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.
- package/README.md +3 -3
- package/contracts/{USDT_json.d.ts → USDToken_json.d.ts} +42 -233
- package/contracts/{USDT_json.js → USDToken_json.js} +54 -228
- package/contracts/{USDT_json.ts → USDToken_json.ts} +59 -303
- package/contracts/index.d.ts +2 -2
- package/contracts/index.js +4 -4
- package/contracts/index.ts +2 -2
- package/package.json +3 -3
|
@@ -1,47 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.USDToken_json = exports.USDToken_jsonAbi = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* USDToken_json ABI
|
|
7
7
|
*
|
|
8
8
|
* This ABI is typed using viem's type system for full type safety.
|
|
9
9
|
*/
|
|
10
|
-
exports.
|
|
10
|
+
exports.USDToken_jsonAbi = [
|
|
11
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": "decimals_",
|
|
26
|
-
"type": "uint256"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"internalType": "uint256",
|
|
30
|
-
"name": "initialBalance_",
|
|
31
|
-
"type": "uint256"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"internalType": "address",
|
|
35
|
-
"name": "tokenOwner",
|
|
36
|
-
"type": "address"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"internalType": "address payable",
|
|
40
|
-
"name": "feeReceiver_",
|
|
41
|
-
"type": "address"
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
"stateMutability": "payable",
|
|
12
|
+
"inputs": [],
|
|
13
|
+
"stateMutability": "nonpayable",
|
|
45
14
|
"type": "constructor"
|
|
46
15
|
},
|
|
47
16
|
{
|
|
@@ -113,42 +82,16 @@ exports.USDT_jsonAbi = [
|
|
|
113
82
|
"name": "Transfer",
|
|
114
83
|
"type": "event"
|
|
115
84
|
},
|
|
116
|
-
{
|
|
117
|
-
"inputs": [],
|
|
118
|
-
"name": "Optimization",
|
|
119
|
-
"outputs": [
|
|
120
|
-
{
|
|
121
|
-
"internalType": "uint256",
|
|
122
|
-
"name": "",
|
|
123
|
-
"type": "uint256"
|
|
124
|
-
}
|
|
125
|
-
],
|
|
126
|
-
"stateMutability": "view",
|
|
127
|
-
"type": "function"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"inputs": [],
|
|
131
|
-
"name": "_owner",
|
|
132
|
-
"outputs": [
|
|
133
|
-
{
|
|
134
|
-
"internalType": "address",
|
|
135
|
-
"name": "",
|
|
136
|
-
"type": "address"
|
|
137
|
-
}
|
|
138
|
-
],
|
|
139
|
-
"stateMutability": "view",
|
|
140
|
-
"type": "function"
|
|
141
|
-
},
|
|
142
85
|
{
|
|
143
86
|
"inputs": [
|
|
144
87
|
{
|
|
145
88
|
"internalType": "address",
|
|
146
|
-
"name": "
|
|
89
|
+
"name": "",
|
|
147
90
|
"type": "address"
|
|
148
91
|
},
|
|
149
92
|
{
|
|
150
93
|
"internalType": "address",
|
|
151
|
-
"name": "
|
|
94
|
+
"name": "",
|
|
152
95
|
"type": "address"
|
|
153
96
|
}
|
|
154
97
|
],
|
|
@@ -191,7 +134,7 @@ exports.USDT_jsonAbi = [
|
|
|
191
134
|
"inputs": [
|
|
192
135
|
{
|
|
193
136
|
"internalType": "address",
|
|
194
|
-
"name": "
|
|
137
|
+
"name": "",
|
|
195
138
|
"type": "address"
|
|
196
139
|
}
|
|
197
140
|
],
|
|
@@ -211,62 +154,14 @@ exports.USDT_jsonAbi = [
|
|
|
211
154
|
"name": "decimals",
|
|
212
155
|
"outputs": [
|
|
213
156
|
{
|
|
214
|
-
"internalType": "
|
|
157
|
+
"internalType": "uint8",
|
|
215
158
|
"name": "",
|
|
216
|
-
"type": "
|
|
159
|
+
"type": "uint8"
|
|
217
160
|
}
|
|
218
161
|
],
|
|
219
162
|
"stateMutability": "view",
|
|
220
163
|
"type": "function"
|
|
221
164
|
},
|
|
222
|
-
{
|
|
223
|
-
"inputs": [
|
|
224
|
-
{
|
|
225
|
-
"internalType": "address",
|
|
226
|
-
"name": "spender",
|
|
227
|
-
"type": "address"
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"internalType": "uint256",
|
|
231
|
-
"name": "subtractedValue",
|
|
232
|
-
"type": "uint256"
|
|
233
|
-
}
|
|
234
|
-
],
|
|
235
|
-
"name": "decreaseAllowance",
|
|
236
|
-
"outputs": [
|
|
237
|
-
{
|
|
238
|
-
"internalType": "bool",
|
|
239
|
-
"name": "",
|
|
240
|
-
"type": "bool"
|
|
241
|
-
}
|
|
242
|
-
],
|
|
243
|
-
"stateMutability": "nonpayable",
|
|
244
|
-
"type": "function"
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
"inputs": [
|
|
248
|
-
{
|
|
249
|
-
"internalType": "address",
|
|
250
|
-
"name": "spender",
|
|
251
|
-
"type": "address"
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"internalType": "uint256",
|
|
255
|
-
"name": "addedValue",
|
|
256
|
-
"type": "uint256"
|
|
257
|
-
}
|
|
258
|
-
],
|
|
259
|
-
"name": "increaseAllowance",
|
|
260
|
-
"outputs": [
|
|
261
|
-
{
|
|
262
|
-
"internalType": "bool",
|
|
263
|
-
"name": "",
|
|
264
|
-
"type": "bool"
|
|
265
|
-
}
|
|
266
|
-
],
|
|
267
|
-
"stateMutability": "nonpayable",
|
|
268
|
-
"type": "function"
|
|
269
|
-
},
|
|
270
165
|
{
|
|
271
166
|
"inputs": [],
|
|
272
167
|
"name": "name",
|
|
@@ -293,24 +188,6 @@ exports.USDT_jsonAbi = [
|
|
|
293
188
|
"stateMutability": "view",
|
|
294
189
|
"type": "function"
|
|
295
190
|
},
|
|
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
191
|
{
|
|
315
192
|
"inputs": [],
|
|
316
193
|
"name": "renounceOwnership",
|
|
@@ -331,6 +208,19 @@ exports.USDT_jsonAbi = [
|
|
|
331
208
|
"stateMutability": "view",
|
|
332
209
|
"type": "function"
|
|
333
210
|
},
|
|
211
|
+
{
|
|
212
|
+
"inputs": [],
|
|
213
|
+
"name": "tokenImage",
|
|
214
|
+
"outputs": [
|
|
215
|
+
{
|
|
216
|
+
"internalType": "string",
|
|
217
|
+
"name": "",
|
|
218
|
+
"type": "string"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"stateMutability": "pure",
|
|
222
|
+
"type": "function"
|
|
223
|
+
},
|
|
334
224
|
{
|
|
335
225
|
"inputs": [],
|
|
336
226
|
"name": "totalSupply",
|
|
@@ -348,7 +238,7 @@ exports.USDT_jsonAbi = [
|
|
|
348
238
|
"inputs": [
|
|
349
239
|
{
|
|
350
240
|
"internalType": "address",
|
|
351
|
-
"name": "
|
|
241
|
+
"name": "to",
|
|
352
242
|
"type": "address"
|
|
353
243
|
},
|
|
354
244
|
{
|
|
@@ -372,12 +262,12 @@ exports.USDT_jsonAbi = [
|
|
|
372
262
|
"inputs": [
|
|
373
263
|
{
|
|
374
264
|
"internalType": "address",
|
|
375
|
-
"name": "
|
|
265
|
+
"name": "from",
|
|
376
266
|
"type": "address"
|
|
377
267
|
},
|
|
378
268
|
{
|
|
379
269
|
"internalType": "address",
|
|
380
|
-
"name": "
|
|
270
|
+
"name": "to",
|
|
381
271
|
"type": "address"
|
|
382
272
|
},
|
|
383
273
|
{
|
|
@@ -412,7 +302,7 @@ exports.USDT_jsonAbi = [
|
|
|
412
302
|
}
|
|
413
303
|
];
|
|
414
304
|
/**
|
|
415
|
-
*
|
|
305
|
+
* USDToken_json Contract Class
|
|
416
306
|
*
|
|
417
307
|
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
418
308
|
*
|
|
@@ -420,12 +310,12 @@ exports.USDT_jsonAbi = [
|
|
|
420
310
|
* ```typescript
|
|
421
311
|
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
422
312
|
* import { mainnet } from 'viem/chains';
|
|
423
|
-
* import {
|
|
313
|
+
* import { USDToken_json } from 'USDToken_json';
|
|
424
314
|
*
|
|
425
315
|
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
426
316
|
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
427
317
|
*
|
|
428
|
-
* const contract = new
|
|
318
|
+
* const contract = new USDToken_json('0x...', { publicClient, walletClient });
|
|
429
319
|
*
|
|
430
320
|
* // Read functions
|
|
431
321
|
* const result = await contract.balanceOf('0x...');
|
|
@@ -443,13 +333,13 @@ exports.USDT_jsonAbi = [
|
|
|
443
333
|
* });
|
|
444
334
|
* ```
|
|
445
335
|
*/
|
|
446
|
-
class
|
|
336
|
+
class USDToken_json {
|
|
447
337
|
constructor(address, clients) {
|
|
448
338
|
this.contractAddress = address;
|
|
449
339
|
this.publicClient = clients.publicClient;
|
|
450
340
|
this.contract = (0, viem_1.getContract)({
|
|
451
341
|
address,
|
|
452
|
-
abi: exports.
|
|
342
|
+
abi: exports.USDToken_jsonAbi,
|
|
453
343
|
client: {
|
|
454
344
|
public: clients.publicClient,
|
|
455
345
|
wallet: clients.walletClient,
|
|
@@ -468,33 +358,19 @@ class USDT_json {
|
|
|
468
358
|
getContract() {
|
|
469
359
|
return this.contract;
|
|
470
360
|
}
|
|
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
361
|
/**
|
|
486
362
|
* allowance
|
|
487
363
|
* view
|
|
488
364
|
*/
|
|
489
|
-
async allowance(
|
|
490
|
-
return this.contract.read.allowance([
|
|
365
|
+
async allowance(arg0, arg1) {
|
|
366
|
+
return this.contract.read.allowance([arg0, arg1]);
|
|
491
367
|
}
|
|
492
368
|
/**
|
|
493
369
|
* balanceOf
|
|
494
370
|
* view
|
|
495
371
|
*/
|
|
496
|
-
async balanceOf(
|
|
497
|
-
return this.contract.read.balanceOf([
|
|
372
|
+
async balanceOf(arg0) {
|
|
373
|
+
return this.contract.read.balanceOf([arg0]);
|
|
498
374
|
}
|
|
499
375
|
/**
|
|
500
376
|
* decimals
|
|
@@ -524,6 +400,13 @@ class USDT_json {
|
|
|
524
400
|
async symbol() {
|
|
525
401
|
return this.contract.read.symbol();
|
|
526
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* tokenImage
|
|
405
|
+
* pure
|
|
406
|
+
*/
|
|
407
|
+
async tokenImage() {
|
|
408
|
+
return this.contract.read.tokenImage();
|
|
409
|
+
}
|
|
527
410
|
/**
|
|
528
411
|
* totalSupply
|
|
529
412
|
* view
|
|
@@ -542,39 +425,6 @@ class USDT_json {
|
|
|
542
425
|
}
|
|
543
426
|
return this.contract.write.approve([spender, amount], options);
|
|
544
427
|
}
|
|
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
428
|
/**
|
|
579
429
|
* renounceOwnership
|
|
580
430
|
* nonpayable
|
|
@@ -591,22 +441,22 @@ class USDT_json {
|
|
|
591
441
|
* nonpayable
|
|
592
442
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
593
443
|
*/
|
|
594
|
-
async transfer(
|
|
444
|
+
async transfer(to, amount, options) {
|
|
595
445
|
if (!this.contract.write) {
|
|
596
446
|
throw new Error('Wallet client is required for write operations');
|
|
597
447
|
}
|
|
598
|
-
return this.contract.write.transfer([
|
|
448
|
+
return this.contract.write.transfer([to, amount], options);
|
|
599
449
|
}
|
|
600
450
|
/**
|
|
601
451
|
* transferFrom
|
|
602
452
|
* nonpayable
|
|
603
453
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
604
454
|
*/
|
|
605
|
-
async transferFrom(
|
|
455
|
+
async transferFrom(from, to, amount, options) {
|
|
606
456
|
if (!this.contract.write) {
|
|
607
457
|
throw new Error('Wallet client is required for write operations');
|
|
608
458
|
}
|
|
609
|
-
return this.contract.write.transferFrom([
|
|
459
|
+
return this.contract.write.transferFrom([from, to, amount], options);
|
|
610
460
|
}
|
|
611
461
|
/**
|
|
612
462
|
* transferOwnership
|
|
@@ -641,30 +491,6 @@ class USDT_json {
|
|
|
641
491
|
async approve(spender, amount, options) {
|
|
642
492
|
return contract.simulate.approve([spender, amount], options);
|
|
643
493
|
},
|
|
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
494
|
/**
|
|
669
495
|
* Simulate renounceOwnership
|
|
670
496
|
* Returns gas estimate and result without sending transaction
|
|
@@ -678,16 +504,16 @@ class USDT_json {
|
|
|
678
504
|
* Returns gas estimate and result without sending transaction
|
|
679
505
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
680
506
|
*/
|
|
681
|
-
async transfer(
|
|
682
|
-
return contract.simulate.transfer([
|
|
507
|
+
async transfer(to, amount, options) {
|
|
508
|
+
return contract.simulate.transfer([to, amount], options);
|
|
683
509
|
},
|
|
684
510
|
/**
|
|
685
511
|
* Simulate transferFrom
|
|
686
512
|
* Returns gas estimate and result without sending transaction
|
|
687
513
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
688
514
|
*/
|
|
689
|
-
async transferFrom(
|
|
690
|
-
return contract.simulate.transferFrom([
|
|
515
|
+
async transferFrom(from, to, amount, options) {
|
|
516
|
+
return contract.simulate.transferFrom([from, to, amount], options);
|
|
691
517
|
},
|
|
692
518
|
/**
|
|
693
519
|
* Simulate transferOwnership
|
|
@@ -722,7 +548,7 @@ class USDT_json {
|
|
|
722
548
|
Approval: (callback, filter) => {
|
|
723
549
|
return this.publicClient.watchContractEvent({
|
|
724
550
|
address: this.contractAddress,
|
|
725
|
-
abi: exports.
|
|
551
|
+
abi: exports.USDToken_jsonAbi,
|
|
726
552
|
eventName: 'Approval',
|
|
727
553
|
args: filter,
|
|
728
554
|
onLogs: (logs) => {
|
|
@@ -741,7 +567,7 @@ class USDT_json {
|
|
|
741
567
|
OwnershipTransferred: (callback, filter) => {
|
|
742
568
|
return this.publicClient.watchContractEvent({
|
|
743
569
|
address: this.contractAddress,
|
|
744
|
-
abi: exports.
|
|
570
|
+
abi: exports.USDToken_jsonAbi,
|
|
745
571
|
eventName: 'OwnershipTransferred',
|
|
746
572
|
args: filter,
|
|
747
573
|
onLogs: (logs) => {
|
|
@@ -760,7 +586,7 @@ class USDT_json {
|
|
|
760
586
|
Transfer: (callback, filter) => {
|
|
761
587
|
return this.publicClient.watchContractEvent({
|
|
762
588
|
address: this.contractAddress,
|
|
763
|
-
abi: exports.
|
|
589
|
+
abi: exports.USDToken_jsonAbi,
|
|
764
590
|
eventName: 'Transfer',
|
|
765
591
|
args: filter,
|
|
766
592
|
onLogs: (logs) => {
|
|
@@ -773,4 +599,4 @@ class USDT_json {
|
|
|
773
599
|
};
|
|
774
600
|
}
|
|
775
601
|
}
|
|
776
|
-
exports.
|
|
602
|
+
exports.USDToken_json = USDToken_json;
|