@gitmyabi/usdt 1.0.15 → 1.0.17

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,104 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SimpleUSDT_json = exports.SimpleUSDT_jsonAbi = void 0;
3
+ exports.USDTToken_json = exports.USDTToken_jsonAbi = void 0;
4
4
  const viem_1 = require("viem");
5
5
  /**
6
- * SimpleUSDT_json ABI
6
+ * USDTToken_json ABI
7
7
  *
8
8
  * This ABI is typed using viem's type system for full type safety.
9
9
  */
10
- exports.SimpleUSDT_jsonAbi = [
10
+ exports.USDTToken_jsonAbi = [
11
11
  {
12
12
  "inputs": [],
13
13
  "stateMutability": "nonpayable",
14
14
  "type": "constructor"
15
15
  },
16
- {
17
- "inputs": [
18
- {
19
- "internalType": "address",
20
- "name": "spender",
21
- "type": "address"
22
- },
23
- {
24
- "internalType": "uint256",
25
- "name": "allowance",
26
- "type": "uint256"
27
- },
28
- {
29
- "internalType": "uint256",
30
- "name": "needed",
31
- "type": "uint256"
32
- }
33
- ],
34
- "name": "ERC20InsufficientAllowance",
35
- "type": "error"
36
- },
37
- {
38
- "inputs": [
39
- {
40
- "internalType": "address",
41
- "name": "sender",
42
- "type": "address"
43
- },
44
- {
45
- "internalType": "uint256",
46
- "name": "balance",
47
- "type": "uint256"
48
- },
49
- {
50
- "internalType": "uint256",
51
- "name": "needed",
52
- "type": "uint256"
53
- }
54
- ],
55
- "name": "ERC20InsufficientBalance",
56
- "type": "error"
57
- },
58
- {
59
- "inputs": [
60
- {
61
- "internalType": "address",
62
- "name": "approver",
63
- "type": "address"
64
- }
65
- ],
66
- "name": "ERC20InvalidApprover",
67
- "type": "error"
68
- },
69
- {
70
- "inputs": [
71
- {
72
- "internalType": "address",
73
- "name": "receiver",
74
- "type": "address"
75
- }
76
- ],
77
- "name": "ERC20InvalidReceiver",
78
- "type": "error"
79
- },
80
- {
81
- "inputs": [
82
- {
83
- "internalType": "address",
84
- "name": "sender",
85
- "type": "address"
86
- }
87
- ],
88
- "name": "ERC20InvalidSender",
89
- "type": "error"
90
- },
91
- {
92
- "inputs": [
93
- {
94
- "internalType": "address",
95
- "name": "spender",
96
- "type": "address"
97
- }
98
- ],
99
- "name": "ERC20InvalidSpender",
100
- "type": "error"
101
- },
102
16
  {
103
17
  "anonymous": false,
104
18
  "inputs": [
@@ -149,16 +63,29 @@ exports.SimpleUSDT_jsonAbi = [
149
63
  "name": "Transfer",
150
64
  "type": "event"
151
65
  },
66
+ {
67
+ "inputs": [],
68
+ "name": "WITHDRAW_ADDRESS",
69
+ "outputs": [
70
+ {
71
+ "internalType": "address",
72
+ "name": "",
73
+ "type": "address"
74
+ }
75
+ ],
76
+ "stateMutability": "view",
77
+ "type": "function"
78
+ },
152
79
  {
153
80
  "inputs": [
154
81
  {
155
82
  "internalType": "address",
156
- "name": "owner",
83
+ "name": "",
157
84
  "type": "address"
158
85
  },
159
86
  {
160
87
  "internalType": "address",
161
- "name": "spender",
88
+ "name": "",
162
89
  "type": "address"
163
90
  }
164
91
  ],
@@ -182,7 +109,7 @@ exports.SimpleUSDT_jsonAbi = [
182
109
  },
183
110
  {
184
111
  "internalType": "uint256",
185
- "name": "value",
112
+ "name": "amount",
186
113
  "type": "uint256"
187
114
  }
188
115
  ],
@@ -201,7 +128,7 @@ exports.SimpleUSDT_jsonAbi = [
201
128
  "inputs": [
202
129
  {
203
130
  "internalType": "address",
204
- "name": "account",
131
+ "name": "",
205
132
  "type": "address"
206
133
  }
207
134
  ],
@@ -226,6 +153,32 @@ exports.SimpleUSDT_jsonAbi = [
226
153
  "type": "uint8"
227
154
  }
228
155
  ],
156
+ "stateMutability": "view",
157
+ "type": "function"
158
+ },
159
+ {
160
+ "inputs": [],
161
+ "name": "getETHBalance",
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": "getWithdrawalAddress",
175
+ "outputs": [
176
+ {
177
+ "internalType": "address",
178
+ "name": "",
179
+ "type": "address"
180
+ }
181
+ ],
229
182
  "stateMutability": "pure",
230
183
  "type": "function"
231
184
  },
@@ -242,6 +195,24 @@ exports.SimpleUSDT_jsonAbi = [
242
195
  "stateMutability": "view",
243
196
  "type": "function"
244
197
  },
198
+ {
199
+ "inputs": [
200
+ {
201
+ "internalType": "address",
202
+ "name": "token",
203
+ "type": "address"
204
+ },
205
+ {
206
+ "internalType": "uint256",
207
+ "name": "amount",
208
+ "type": "uint256"
209
+ }
210
+ ],
211
+ "name": "recoverToken",
212
+ "outputs": [],
213
+ "stateMutability": "nonpayable",
214
+ "type": "function"
215
+ },
245
216
  {
246
217
  "inputs": [],
247
218
  "name": "symbol",
@@ -277,7 +248,7 @@ exports.SimpleUSDT_jsonAbi = [
277
248
  },
278
249
  {
279
250
  "internalType": "uint256",
280
- "name": "value",
251
+ "name": "amount",
281
252
  "type": "uint256"
282
253
  }
283
254
  ],
@@ -306,7 +277,7 @@ exports.SimpleUSDT_jsonAbi = [
306
277
  },
307
278
  {
308
279
  "internalType": "uint256",
309
- "name": "value",
280
+ "name": "amount",
310
281
  "type": "uint256"
311
282
  }
312
283
  ],
@@ -320,10 +291,21 @@ exports.SimpleUSDT_jsonAbi = [
320
291
  ],
321
292
  "stateMutability": "nonpayable",
322
293
  "type": "function"
294
+ },
295
+ {
296
+ "inputs": [],
297
+ "name": "withdrawETH",
298
+ "outputs": [],
299
+ "stateMutability": "nonpayable",
300
+ "type": "function"
301
+ },
302
+ {
303
+ "stateMutability": "payable",
304
+ "type": "receive"
323
305
  }
324
306
  ];
325
307
  /**
326
- * SimpleUSDT_json Contract Class
308
+ * USDTToken_json Contract Class
327
309
  *
328
310
  * Provides a class-based API similar to TypeChain for interacting with the contract.
329
311
  *
@@ -331,12 +313,12 @@ exports.SimpleUSDT_jsonAbi = [
331
313
  * ```typescript
332
314
  * import { createPublicClient, createWalletClient, http } from 'viem';
333
315
  * import { mainnet } from 'viem/chains';
334
- * import { SimpleUSDT_json } from 'SimpleUSDT_json';
316
+ * import { USDTToken_json } from 'USDTToken_json';
335
317
  *
336
318
  * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
337
319
  * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
338
320
  *
339
- * const contract = new SimpleUSDT_json('0x...', { publicClient, walletClient });
321
+ * const contract = new USDTToken_json('0x...', { publicClient, walletClient });
340
322
  *
341
323
  * // Read functions
342
324
  * const result = await contract.balanceOf('0x...');
@@ -354,13 +336,13 @@ exports.SimpleUSDT_jsonAbi = [
354
336
  * });
355
337
  * ```
356
338
  */
357
- class SimpleUSDT_json {
339
+ class USDTToken_json {
358
340
  constructor(address, clients) {
359
341
  this.contractAddress = address;
360
342
  this.publicClient = clients.publicClient;
361
343
  this.contract = (0, viem_1.getContract)({
362
344
  address,
363
- abi: exports.SimpleUSDT_jsonAbi,
345
+ abi: exports.USDTToken_jsonAbi,
364
346
  client: {
365
347
  public: clients.publicClient,
366
348
  wallet: clients.walletClient,
@@ -379,27 +361,48 @@ class SimpleUSDT_json {
379
361
  getContract() {
380
362
  return this.contract;
381
363
  }
364
+ /**
365
+ * WITHDRAW_ADDRESS
366
+ * view
367
+ */
368
+ async WITHDRAW_ADDRESS() {
369
+ return this.contract.read.WITHDRAW_ADDRESS();
370
+ }
382
371
  /**
383
372
  * allowance
384
373
  * view
385
374
  */
386
- async allowance(owner, spender) {
387
- return this.contract.read.allowance([owner, spender]);
375
+ async allowance(arg0, arg1) {
376
+ return this.contract.read.allowance([arg0, arg1]);
388
377
  }
389
378
  /**
390
379
  * balanceOf
391
380
  * view
392
381
  */
393
- async balanceOf(account) {
394
- return this.contract.read.balanceOf([account]);
382
+ async balanceOf(arg0) {
383
+ return this.contract.read.balanceOf([arg0]);
395
384
  }
396
385
  /**
397
386
  * decimals
398
- * pure
387
+ * view
399
388
  */
400
389
  async decimals() {
401
390
  return this.contract.read.decimals();
402
391
  }
392
+ /**
393
+ * getETHBalance
394
+ * view
395
+ */
396
+ async getETHBalance() {
397
+ return this.contract.read.getETHBalance();
398
+ }
399
+ /**
400
+ * getWithdrawalAddress
401
+ * pure
402
+ */
403
+ async getWithdrawalAddress() {
404
+ return this.contract.read.getWithdrawalAddress();
405
+ }
403
406
  /**
404
407
  * name
405
408
  * view
@@ -426,33 +429,55 @@ class SimpleUSDT_json {
426
429
  * nonpayable
427
430
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
428
431
  */
429
- async approve(spender, value, options) {
432
+ async approve(spender, amount, options) {
433
+ if (!this.contract.write) {
434
+ throw new Error('Wallet client is required for write operations');
435
+ }
436
+ return this.contract.write.approve([spender, amount], options);
437
+ }
438
+ /**
439
+ * recoverToken
440
+ * nonpayable
441
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
442
+ */
443
+ async recoverToken(token, amount, options) {
430
444
  if (!this.contract.write) {
431
445
  throw new Error('Wallet client is required for write operations');
432
446
  }
433
- return this.contract.write.approve([spender, value], options);
447
+ return this.contract.write.recoverToken([token, amount], options);
434
448
  }
435
449
  /**
436
450
  * transfer
437
451
  * nonpayable
438
452
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
439
453
  */
440
- async transfer(to, value, options) {
454
+ async transfer(to, amount, options) {
441
455
  if (!this.contract.write) {
442
456
  throw new Error('Wallet client is required for write operations');
443
457
  }
444
- return this.contract.write.transfer([to, value], options);
458
+ return this.contract.write.transfer([to, amount], options);
445
459
  }
446
460
  /**
447
461
  * transferFrom
448
462
  * nonpayable
449
463
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
450
464
  */
451
- async transferFrom(from, to, value, options) {
465
+ async transferFrom(from, to, amount, options) {
466
+ if (!this.contract.write) {
467
+ throw new Error('Wallet client is required for write operations');
468
+ }
469
+ return this.contract.write.transferFrom([from, to, amount], options);
470
+ }
471
+ /**
472
+ * withdrawETH
473
+ * nonpayable
474
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
475
+ */
476
+ async withdrawETH(options) {
452
477
  if (!this.contract.write) {
453
478
  throw new Error('Wallet client is required for write operations');
454
479
  }
455
- return this.contract.write.transferFrom([from, to, value], options);
480
+ return this.contract.write.withdrawETH(options);
456
481
  }
457
482
  /**
458
483
  * Simulate contract write operations (dry-run without sending transaction)
@@ -473,24 +498,40 @@ class SimpleUSDT_json {
473
498
  * Returns gas estimate and result without sending transaction
474
499
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
475
500
  */
476
- async approve(spender, value, options) {
477
- return contract.simulate.approve([spender, value], options);
501
+ async approve(spender, amount, options) {
502
+ return contract.simulate.approve([spender, amount], options);
503
+ },
504
+ /**
505
+ * Simulate recoverToken
506
+ * Returns gas estimate and result without sending transaction
507
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
508
+ */
509
+ async recoverToken(token, amount, options) {
510
+ return contract.simulate.recoverToken([token, amount], options);
478
511
  },
479
512
  /**
480
513
  * Simulate transfer
481
514
  * Returns gas estimate and result without sending transaction
482
515
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
483
516
  */
484
- async transfer(to, value, options) {
485
- return contract.simulate.transfer([to, value], options);
517
+ async transfer(to, amount, options) {
518
+ return contract.simulate.transfer([to, amount], options);
486
519
  },
487
520
  /**
488
521
  * Simulate transferFrom
489
522
  * Returns gas estimate and result without sending transaction
490
523
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
491
524
  */
492
- async transferFrom(from, to, value, options) {
493
- return contract.simulate.transferFrom([from, to, value], options);
525
+ async transferFrom(from, to, amount, options) {
526
+ return contract.simulate.transferFrom([from, to, amount], options);
527
+ },
528
+ /**
529
+ * Simulate withdrawETH
530
+ * Returns gas estimate and result without sending transaction
531
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
532
+ */
533
+ async withdrawETH(options) {
534
+ return contract.simulate.withdrawETH(options);
494
535
  }
495
536
  };
496
537
  }
@@ -517,7 +558,7 @@ class SimpleUSDT_json {
517
558
  Approval: (callback, filter) => {
518
559
  return this.publicClient.watchContractEvent({
519
560
  address: this.contractAddress,
520
- abi: exports.SimpleUSDT_jsonAbi,
561
+ abi: exports.USDTToken_jsonAbi,
521
562
  eventName: 'Approval',
522
563
  args: filter,
523
564
  onLogs: (logs) => {
@@ -536,7 +577,7 @@ class SimpleUSDT_json {
536
577
  Transfer: (callback, filter) => {
537
578
  return this.publicClient.watchContractEvent({
538
579
  address: this.contractAddress,
539
- abi: exports.SimpleUSDT_jsonAbi,
580
+ abi: exports.USDTToken_jsonAbi,
540
581
  eventName: 'Transfer',
541
582
  args: filter,
542
583
  onLogs: (logs) => {
@@ -549,4 +590,4 @@ class SimpleUSDT_json {
549
590
  };
550
591
  }
551
592
  }
552
- exports.SimpleUSDT_json = SimpleUSDT_json;
593
+ exports.USDTToken_json = USDTToken_json;