@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.
- package/README.md +3 -3
- package/contracts/{SimpleUSDT_json.d.ts → USDTToken_json.d.ts} +162 -90
- package/contracts/{SimpleUSDT_json.js → USDTToken_json.js} +161 -120
- package/contracts/{SimpleUSDT_json.ts → USDTToken_json.ts} +214 -124
- package/contracts/index.d.ts +2 -2
- package/contracts/index.js +4 -4
- package/contracts/index.ts +2 -2
- package/package.json +3 -3
|
@@ -2,102 +2,16 @@ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType }
|
|
|
2
2
|
import { getContract } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* USDTToken_json ABI
|
|
6
6
|
*
|
|
7
7
|
* This ABI is typed using viem's type system for full type safety.
|
|
8
8
|
*/
|
|
9
|
-
export const
|
|
9
|
+
export const USDTToken_jsonAbi = [
|
|
10
10
|
{
|
|
11
11
|
"inputs": [],
|
|
12
12
|
"stateMutability": "nonpayable",
|
|
13
13
|
"type": "constructor"
|
|
14
14
|
},
|
|
15
|
-
{
|
|
16
|
-
"inputs": [
|
|
17
|
-
{
|
|
18
|
-
"internalType": "address",
|
|
19
|
-
"name": "spender",
|
|
20
|
-
"type": "address"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"internalType": "uint256",
|
|
24
|
-
"name": "allowance",
|
|
25
|
-
"type": "uint256"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"internalType": "uint256",
|
|
29
|
-
"name": "needed",
|
|
30
|
-
"type": "uint256"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"name": "ERC20InsufficientAllowance",
|
|
34
|
-
"type": "error"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"inputs": [
|
|
38
|
-
{
|
|
39
|
-
"internalType": "address",
|
|
40
|
-
"name": "sender",
|
|
41
|
-
"type": "address"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"internalType": "uint256",
|
|
45
|
-
"name": "balance",
|
|
46
|
-
"type": "uint256"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"internalType": "uint256",
|
|
50
|
-
"name": "needed",
|
|
51
|
-
"type": "uint256"
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
"name": "ERC20InsufficientBalance",
|
|
55
|
-
"type": "error"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"inputs": [
|
|
59
|
-
{
|
|
60
|
-
"internalType": "address",
|
|
61
|
-
"name": "approver",
|
|
62
|
-
"type": "address"
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
"name": "ERC20InvalidApprover",
|
|
66
|
-
"type": "error"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"inputs": [
|
|
70
|
-
{
|
|
71
|
-
"internalType": "address",
|
|
72
|
-
"name": "receiver",
|
|
73
|
-
"type": "address"
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
"name": "ERC20InvalidReceiver",
|
|
77
|
-
"type": "error"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"inputs": [
|
|
81
|
-
{
|
|
82
|
-
"internalType": "address",
|
|
83
|
-
"name": "sender",
|
|
84
|
-
"type": "address"
|
|
85
|
-
}
|
|
86
|
-
],
|
|
87
|
-
"name": "ERC20InvalidSender",
|
|
88
|
-
"type": "error"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"inputs": [
|
|
92
|
-
{
|
|
93
|
-
"internalType": "address",
|
|
94
|
-
"name": "spender",
|
|
95
|
-
"type": "address"
|
|
96
|
-
}
|
|
97
|
-
],
|
|
98
|
-
"name": "ERC20InvalidSpender",
|
|
99
|
-
"type": "error"
|
|
100
|
-
},
|
|
101
15
|
{
|
|
102
16
|
"anonymous": false,
|
|
103
17
|
"inputs": [
|
|
@@ -148,16 +62,29 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
148
62
|
"name": "Transfer",
|
|
149
63
|
"type": "event"
|
|
150
64
|
},
|
|
65
|
+
{
|
|
66
|
+
"inputs": [],
|
|
67
|
+
"name": "WITHDRAW_ADDRESS",
|
|
68
|
+
"outputs": [
|
|
69
|
+
{
|
|
70
|
+
"internalType": "address",
|
|
71
|
+
"name": "",
|
|
72
|
+
"type": "address"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"stateMutability": "view",
|
|
76
|
+
"type": "function"
|
|
77
|
+
},
|
|
151
78
|
{
|
|
152
79
|
"inputs": [
|
|
153
80
|
{
|
|
154
81
|
"internalType": "address",
|
|
155
|
-
"name": "
|
|
82
|
+
"name": "",
|
|
156
83
|
"type": "address"
|
|
157
84
|
},
|
|
158
85
|
{
|
|
159
86
|
"internalType": "address",
|
|
160
|
-
"name": "
|
|
87
|
+
"name": "",
|
|
161
88
|
"type": "address"
|
|
162
89
|
}
|
|
163
90
|
],
|
|
@@ -181,7 +108,7 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
181
108
|
},
|
|
182
109
|
{
|
|
183
110
|
"internalType": "uint256",
|
|
184
|
-
"name": "
|
|
111
|
+
"name": "amount",
|
|
185
112
|
"type": "uint256"
|
|
186
113
|
}
|
|
187
114
|
],
|
|
@@ -200,7 +127,7 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
200
127
|
"inputs": [
|
|
201
128
|
{
|
|
202
129
|
"internalType": "address",
|
|
203
|
-
"name": "
|
|
130
|
+
"name": "",
|
|
204
131
|
"type": "address"
|
|
205
132
|
}
|
|
206
133
|
],
|
|
@@ -225,6 +152,32 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
225
152
|
"type": "uint8"
|
|
226
153
|
}
|
|
227
154
|
],
|
|
155
|
+
"stateMutability": "view",
|
|
156
|
+
"type": "function"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"inputs": [],
|
|
160
|
+
"name": "getETHBalance",
|
|
161
|
+
"outputs": [
|
|
162
|
+
{
|
|
163
|
+
"internalType": "uint256",
|
|
164
|
+
"name": "",
|
|
165
|
+
"type": "uint256"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"stateMutability": "view",
|
|
169
|
+
"type": "function"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"inputs": [],
|
|
173
|
+
"name": "getWithdrawalAddress",
|
|
174
|
+
"outputs": [
|
|
175
|
+
{
|
|
176
|
+
"internalType": "address",
|
|
177
|
+
"name": "",
|
|
178
|
+
"type": "address"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
228
181
|
"stateMutability": "pure",
|
|
229
182
|
"type": "function"
|
|
230
183
|
},
|
|
@@ -241,6 +194,24 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
241
194
|
"stateMutability": "view",
|
|
242
195
|
"type": "function"
|
|
243
196
|
},
|
|
197
|
+
{
|
|
198
|
+
"inputs": [
|
|
199
|
+
{
|
|
200
|
+
"internalType": "address",
|
|
201
|
+
"name": "token",
|
|
202
|
+
"type": "address"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"internalType": "uint256",
|
|
206
|
+
"name": "amount",
|
|
207
|
+
"type": "uint256"
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"name": "recoverToken",
|
|
211
|
+
"outputs": [],
|
|
212
|
+
"stateMutability": "nonpayable",
|
|
213
|
+
"type": "function"
|
|
214
|
+
},
|
|
244
215
|
{
|
|
245
216
|
"inputs": [],
|
|
246
217
|
"name": "symbol",
|
|
@@ -276,7 +247,7 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
276
247
|
},
|
|
277
248
|
{
|
|
278
249
|
"internalType": "uint256",
|
|
279
|
-
"name": "
|
|
250
|
+
"name": "amount",
|
|
280
251
|
"type": "uint256"
|
|
281
252
|
}
|
|
282
253
|
],
|
|
@@ -305,7 +276,7 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
305
276
|
},
|
|
306
277
|
{
|
|
307
278
|
"internalType": "uint256",
|
|
308
|
-
"name": "
|
|
279
|
+
"name": "amount",
|
|
309
280
|
"type": "uint256"
|
|
310
281
|
}
|
|
311
282
|
],
|
|
@@ -319,23 +290,34 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
319
290
|
],
|
|
320
291
|
"stateMutability": "nonpayable",
|
|
321
292
|
"type": "function"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"inputs": [],
|
|
296
|
+
"name": "withdrawETH",
|
|
297
|
+
"outputs": [],
|
|
298
|
+
"stateMutability": "nonpayable",
|
|
299
|
+
"type": "function"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"stateMutability": "payable",
|
|
303
|
+
"type": "receive"
|
|
322
304
|
}
|
|
323
305
|
] as const satisfies Abi;
|
|
324
306
|
|
|
325
307
|
/**
|
|
326
|
-
* Type-safe ABI for
|
|
308
|
+
* Type-safe ABI for USDTToken_json
|
|
327
309
|
*/
|
|
328
|
-
export type
|
|
310
|
+
export type USDTToken_jsonAbi = typeof USDTToken_jsonAbi;
|
|
329
311
|
|
|
330
312
|
/**
|
|
331
|
-
* Contract instance type for
|
|
313
|
+
* Contract instance type for USDTToken_json
|
|
332
314
|
*/
|
|
333
315
|
// Use any for contract type to avoid complex viem type issues
|
|
334
316
|
// The runtime behavior is type-safe through viem's ABI typing
|
|
335
|
-
export type
|
|
317
|
+
export type USDTToken_jsonContract = any;
|
|
336
318
|
|
|
337
319
|
/**
|
|
338
|
-
*
|
|
320
|
+
* USDTToken_json Contract Class
|
|
339
321
|
*
|
|
340
322
|
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
341
323
|
*
|
|
@@ -343,12 +325,12 @@ export type SimpleUSDT_jsonContract = any;
|
|
|
343
325
|
* ```typescript
|
|
344
326
|
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
345
327
|
* import { mainnet } from 'viem/chains';
|
|
346
|
-
* import {
|
|
328
|
+
* import { USDTToken_json } from 'USDTToken_json';
|
|
347
329
|
*
|
|
348
330
|
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
349
331
|
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
350
332
|
*
|
|
351
|
-
* const contract = new
|
|
333
|
+
* const contract = new USDTToken_json('0x...', { publicClient, walletClient });
|
|
352
334
|
*
|
|
353
335
|
* // Read functions
|
|
354
336
|
* const result = await contract.balanceOf('0x...');
|
|
@@ -366,8 +348,8 @@ export type SimpleUSDT_jsonContract = any;
|
|
|
366
348
|
* });
|
|
367
349
|
* ```
|
|
368
350
|
*/
|
|
369
|
-
export class
|
|
370
|
-
private contract:
|
|
351
|
+
export class USDTToken_json {
|
|
352
|
+
private contract: USDTToken_jsonContract;
|
|
371
353
|
private contractAddress: Address;
|
|
372
354
|
private publicClient: PublicClient;
|
|
373
355
|
|
|
@@ -382,7 +364,7 @@ export class SimpleUSDT_json {
|
|
|
382
364
|
this.publicClient = clients.publicClient;
|
|
383
365
|
this.contract = getContract({
|
|
384
366
|
address,
|
|
385
|
-
abi:
|
|
367
|
+
abi: USDTToken_jsonAbi,
|
|
386
368
|
client: {
|
|
387
369
|
public: clients.publicClient,
|
|
388
370
|
wallet: clients.walletClient,
|
|
@@ -400,34 +382,58 @@ export class SimpleUSDT_json {
|
|
|
400
382
|
/**
|
|
401
383
|
* Get the underlying viem contract instance
|
|
402
384
|
*/
|
|
403
|
-
getContract():
|
|
385
|
+
getContract(): USDTToken_jsonContract {
|
|
404
386
|
return this.contract;
|
|
405
387
|
}
|
|
406
388
|
|
|
389
|
+
/**
|
|
390
|
+
* WITHDRAW_ADDRESS
|
|
391
|
+
* view
|
|
392
|
+
*/
|
|
393
|
+
async WITHDRAW_ADDRESS(): Promise<`0x${string}`> {
|
|
394
|
+
return this.contract.read.WITHDRAW_ADDRESS() as Promise<`0x${string}`>;
|
|
395
|
+
}
|
|
396
|
+
|
|
407
397
|
/**
|
|
408
398
|
* allowance
|
|
409
399
|
* view
|
|
410
400
|
*/
|
|
411
|
-
async allowance(
|
|
412
|
-
return this.contract.read.allowance([
|
|
401
|
+
async allowance(arg0: `0x${string}`, arg1: `0x${string}`): Promise<bigint> {
|
|
402
|
+
return this.contract.read.allowance([arg0, arg1] as const) as Promise<bigint>;
|
|
413
403
|
}
|
|
414
404
|
|
|
415
405
|
/**
|
|
416
406
|
* balanceOf
|
|
417
407
|
* view
|
|
418
408
|
*/
|
|
419
|
-
async balanceOf(
|
|
420
|
-
return this.contract.read.balanceOf([
|
|
409
|
+
async balanceOf(arg0: `0x${string}`): Promise<bigint> {
|
|
410
|
+
return this.contract.read.balanceOf([arg0] as const) as Promise<bigint>;
|
|
421
411
|
}
|
|
422
412
|
|
|
423
413
|
/**
|
|
424
414
|
* decimals
|
|
425
|
-
*
|
|
415
|
+
* view
|
|
426
416
|
*/
|
|
427
417
|
async decimals(): Promise<bigint> {
|
|
428
418
|
return this.contract.read.decimals() as Promise<bigint>;
|
|
429
419
|
}
|
|
430
420
|
|
|
421
|
+
/**
|
|
422
|
+
* getETHBalance
|
|
423
|
+
* view
|
|
424
|
+
*/
|
|
425
|
+
async getETHBalance(): Promise<bigint> {
|
|
426
|
+
return this.contract.read.getETHBalance() as Promise<bigint>;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* getWithdrawalAddress
|
|
431
|
+
* pure
|
|
432
|
+
*/
|
|
433
|
+
async getWithdrawalAddress(): Promise<`0x${string}`> {
|
|
434
|
+
return this.contract.read.getWithdrawalAddress() as Promise<`0x${string}`>;
|
|
435
|
+
}
|
|
436
|
+
|
|
431
437
|
/**
|
|
432
438
|
* name
|
|
433
439
|
* view
|
|
@@ -457,7 +463,7 @@ export class SimpleUSDT_json {
|
|
|
457
463
|
* nonpayable
|
|
458
464
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
459
465
|
*/
|
|
460
|
-
async approve(spender: `0x${string}`,
|
|
466
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
461
467
|
accessList?: import('viem').AccessList;
|
|
462
468
|
authorizationList?: import('viem').AuthorizationList;
|
|
463
469
|
chain?: import('viem').Chain | null;
|
|
@@ -472,7 +478,30 @@ export class SimpleUSDT_json {
|
|
|
472
478
|
if (!this.contract.write) {
|
|
473
479
|
throw new Error('Wallet client is required for write operations');
|
|
474
480
|
}
|
|
475
|
-
return this.contract.write.approve([spender,
|
|
481
|
+
return this.contract.write.approve([spender, amount] as const, options) as Promise<`0x${string}`>;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* recoverToken
|
|
486
|
+
* nonpayable
|
|
487
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
488
|
+
*/
|
|
489
|
+
async recoverToken(token: `0x${string}`, amount: bigint, options?: {
|
|
490
|
+
accessList?: import('viem').AccessList;
|
|
491
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
492
|
+
chain?: import('viem').Chain | null;
|
|
493
|
+
dataSuffix?: `0x${string}`;
|
|
494
|
+
gas?: bigint;
|
|
495
|
+
gasPrice?: bigint;
|
|
496
|
+
maxFeePerGas?: bigint;
|
|
497
|
+
maxPriorityFeePerGas?: bigint;
|
|
498
|
+
nonce?: number;
|
|
499
|
+
value?: bigint;
|
|
500
|
+
}): Promise<`0x${string}`> {
|
|
501
|
+
if (!this.contract.write) {
|
|
502
|
+
throw new Error('Wallet client is required for write operations');
|
|
503
|
+
}
|
|
504
|
+
return this.contract.write.recoverToken([token, amount] as const, options) as Promise<`0x${string}`>;
|
|
476
505
|
}
|
|
477
506
|
|
|
478
507
|
/**
|
|
@@ -480,7 +509,7 @@ export class SimpleUSDT_json {
|
|
|
480
509
|
* nonpayable
|
|
481
510
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
482
511
|
*/
|
|
483
|
-
async transfer(to: `0x${string}`,
|
|
512
|
+
async transfer(to: `0x${string}`, amount: bigint, options?: {
|
|
484
513
|
accessList?: import('viem').AccessList;
|
|
485
514
|
authorizationList?: import('viem').AuthorizationList;
|
|
486
515
|
chain?: import('viem').Chain | null;
|
|
@@ -495,7 +524,7 @@ export class SimpleUSDT_json {
|
|
|
495
524
|
if (!this.contract.write) {
|
|
496
525
|
throw new Error('Wallet client is required for write operations');
|
|
497
526
|
}
|
|
498
|
-
return this.contract.write.transfer([to,
|
|
527
|
+
return this.contract.write.transfer([to, amount] as const, options) as Promise<`0x${string}`>;
|
|
499
528
|
}
|
|
500
529
|
|
|
501
530
|
/**
|
|
@@ -503,7 +532,7 @@ export class SimpleUSDT_json {
|
|
|
503
532
|
* nonpayable
|
|
504
533
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
505
534
|
*/
|
|
506
|
-
async transferFrom(from: `0x${string}`, to: `0x${string}`,
|
|
535
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
|
|
507
536
|
accessList?: import('viem').AccessList;
|
|
508
537
|
authorizationList?: import('viem').AuthorizationList;
|
|
509
538
|
chain?: import('viem').Chain | null;
|
|
@@ -518,7 +547,30 @@ export class SimpleUSDT_json {
|
|
|
518
547
|
if (!this.contract.write) {
|
|
519
548
|
throw new Error('Wallet client is required for write operations');
|
|
520
549
|
}
|
|
521
|
-
return this.contract.write.transferFrom([from, to,
|
|
550
|
+
return this.contract.write.transferFrom([from, to, amount] as const, options) as Promise<`0x${string}`>;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* withdrawETH
|
|
555
|
+
* nonpayable
|
|
556
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
557
|
+
*/
|
|
558
|
+
async withdrawETH(options?: {
|
|
559
|
+
accessList?: import('viem').AccessList;
|
|
560
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
561
|
+
chain?: import('viem').Chain | null;
|
|
562
|
+
dataSuffix?: `0x${string}`;
|
|
563
|
+
gas?: bigint;
|
|
564
|
+
gasPrice?: bigint;
|
|
565
|
+
maxFeePerGas?: bigint;
|
|
566
|
+
maxPriorityFeePerGas?: bigint;
|
|
567
|
+
nonce?: number;
|
|
568
|
+
value?: bigint;
|
|
569
|
+
}): Promise<`0x${string}`> {
|
|
570
|
+
if (!this.contract.write) {
|
|
571
|
+
throw new Error('Wallet client is required for write operations');
|
|
572
|
+
}
|
|
573
|
+
return this.contract.write.withdrawETH(options) as Promise<`0x${string}`>;
|
|
522
574
|
}
|
|
523
575
|
|
|
524
576
|
|
|
@@ -542,7 +594,7 @@ export class SimpleUSDT_json {
|
|
|
542
594
|
* Returns gas estimate and result without sending transaction
|
|
543
595
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
544
596
|
*/
|
|
545
|
-
async approve(spender: `0x${string}`,
|
|
597
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
546
598
|
accessList?: import('viem').AccessList;
|
|
547
599
|
authorizationList?: import('viem').AuthorizationList;
|
|
548
600
|
chain?: import('viem').Chain | null;
|
|
@@ -554,14 +606,33 @@ export class SimpleUSDT_json {
|
|
|
554
606
|
nonce?: number;
|
|
555
607
|
value?: bigint;
|
|
556
608
|
}): Promise<boolean> {
|
|
557
|
-
return contract.simulate.approve([spender,
|
|
609
|
+
return contract.simulate.approve([spender, amount] as const, options) as Promise<boolean>;
|
|
610
|
+
},
|
|
611
|
+
/**
|
|
612
|
+
* Simulate recoverToken
|
|
613
|
+
* Returns gas estimate and result without sending transaction
|
|
614
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
615
|
+
*/
|
|
616
|
+
async recoverToken(token: `0x${string}`, amount: bigint, options?: {
|
|
617
|
+
accessList?: import('viem').AccessList;
|
|
618
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
619
|
+
chain?: import('viem').Chain | null;
|
|
620
|
+
dataSuffix?: `0x${string}`;
|
|
621
|
+
gas?: bigint;
|
|
622
|
+
gasPrice?: bigint;
|
|
623
|
+
maxFeePerGas?: bigint;
|
|
624
|
+
maxPriorityFeePerGas?: bigint;
|
|
625
|
+
nonce?: number;
|
|
626
|
+
value?: bigint;
|
|
627
|
+
}): Promise<void> {
|
|
628
|
+
return contract.simulate.recoverToken([token, amount] as const, options) as Promise<void>;
|
|
558
629
|
},
|
|
559
630
|
/**
|
|
560
631
|
* Simulate transfer
|
|
561
632
|
* Returns gas estimate and result without sending transaction
|
|
562
633
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
563
634
|
*/
|
|
564
|
-
async transfer(to: `0x${string}`,
|
|
635
|
+
async transfer(to: `0x${string}`, amount: bigint, options?: {
|
|
565
636
|
accessList?: import('viem').AccessList;
|
|
566
637
|
authorizationList?: import('viem').AuthorizationList;
|
|
567
638
|
chain?: import('viem').Chain | null;
|
|
@@ -573,14 +644,14 @@ export class SimpleUSDT_json {
|
|
|
573
644
|
nonce?: number;
|
|
574
645
|
value?: bigint;
|
|
575
646
|
}): Promise<boolean> {
|
|
576
|
-
return contract.simulate.transfer([to,
|
|
647
|
+
return contract.simulate.transfer([to, amount] as const, options) as Promise<boolean>;
|
|
577
648
|
},
|
|
578
649
|
/**
|
|
579
650
|
* Simulate transferFrom
|
|
580
651
|
* Returns gas estimate and result without sending transaction
|
|
581
652
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
582
653
|
*/
|
|
583
|
-
async transferFrom(from: `0x${string}`, to: `0x${string}`,
|
|
654
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
|
|
584
655
|
accessList?: import('viem').AccessList;
|
|
585
656
|
authorizationList?: import('viem').AuthorizationList;
|
|
586
657
|
chain?: import('viem').Chain | null;
|
|
@@ -592,7 +663,26 @@ export class SimpleUSDT_json {
|
|
|
592
663
|
nonce?: number;
|
|
593
664
|
value?: bigint;
|
|
594
665
|
}): Promise<boolean> {
|
|
595
|
-
return contract.simulate.transferFrom([from, to,
|
|
666
|
+
return contract.simulate.transferFrom([from, to, amount] as const, options) as Promise<boolean>;
|
|
667
|
+
},
|
|
668
|
+
/**
|
|
669
|
+
* Simulate withdrawETH
|
|
670
|
+
* Returns gas estimate and result without sending transaction
|
|
671
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
672
|
+
*/
|
|
673
|
+
async withdrawETH(options?: {
|
|
674
|
+
accessList?: import('viem').AccessList;
|
|
675
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
676
|
+
chain?: import('viem').Chain | null;
|
|
677
|
+
dataSuffix?: `0x${string}`;
|
|
678
|
+
gas?: bigint;
|
|
679
|
+
gasPrice?: bigint;
|
|
680
|
+
maxFeePerGas?: bigint;
|
|
681
|
+
maxPriorityFeePerGas?: bigint;
|
|
682
|
+
nonce?: number;
|
|
683
|
+
value?: bigint;
|
|
684
|
+
}): Promise<void> {
|
|
685
|
+
return contract.simulate.withdrawETH(options) as Promise<void>;
|
|
596
686
|
}
|
|
597
687
|
};
|
|
598
688
|
}
|
|
@@ -620,7 +710,7 @@ export class SimpleUSDT_json {
|
|
|
620
710
|
Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner: `0x${string}`; spender: `0x${string}` }) => {
|
|
621
711
|
return this.publicClient.watchContractEvent({
|
|
622
712
|
address: this.contractAddress,
|
|
623
|
-
abi:
|
|
713
|
+
abi: USDTToken_jsonAbi,
|
|
624
714
|
eventName: 'Approval',
|
|
625
715
|
args: filter,
|
|
626
716
|
onLogs: (logs: any[]) => {
|
|
@@ -639,7 +729,7 @@ export class SimpleUSDT_json {
|
|
|
639
729
|
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from: `0x${string}`; to: `0x${string}` }) => {
|
|
640
730
|
return this.publicClient.watchContractEvent({
|
|
641
731
|
address: this.contractAddress,
|
|
642
|
-
abi:
|
|
732
|
+
abi: USDTToken_jsonAbi,
|
|
643
733
|
eventName: 'Transfer',
|
|
644
734
|
args: filter,
|
|
645
735
|
onLogs: (logs: any[]) => {
|
package/contracts/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { USDTToken_jsonAbi, USDTToken_json } from './USDTToken_json';
|
|
2
|
+
export type { USDTToken_jsonAbi as USDTToken_jsonAbiType, USDTToken_jsonContract } from './USDTToken_json';
|
package/contracts/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.USDTToken_json = exports.USDTToken_jsonAbi = void 0;
|
|
4
4
|
// Auto-generated exports for all contracts
|
|
5
|
-
var
|
|
6
|
-
Object.defineProperty(exports, "
|
|
7
|
-
Object.defineProperty(exports, "
|
|
5
|
+
var USDTToken_json_1 = require("./USDTToken_json");
|
|
6
|
+
Object.defineProperty(exports, "USDTToken_jsonAbi", { enumerable: true, get: function () { return USDTToken_json_1.USDTToken_jsonAbi; } });
|
|
7
|
+
Object.defineProperty(exports, "USDTToken_json", { enumerable: true, get: function () { return USDTToken_json_1.USDTToken_json; } });
|
package/contracts/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Auto-generated exports for all contracts
|
|
2
|
-
export {
|
|
3
|
-
export type {
|
|
2
|
+
export { USDTToken_jsonAbi, USDTToken_json } from './USDTToken_json';
|
|
3
|
+
export type { USDTToken_jsonAbi as USDTToken_jsonAbiType, USDTToken_jsonContract } from './USDTToken_json';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitmyabi/usdt",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Auto-generated TypeScript type bindings for USDT (build etherscan-usdt-
|
|
3
|
+
"version": "1.0.17",
|
|
4
|
+
"description": "Auto-generated TypeScript type bindings for USDT (build etherscan-usdt-0f4bab45-1786223915089, commit 07ea2dd, branch etherscan)",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"url": "https://github.com/etherscan/usdt"
|
|
40
40
|
},
|
|
41
41
|
"branch": "etherscan",
|
|
42
|
-
"shortHash": "
|
|
42
|
+
"shortHash": "07ea2dd"
|
|
43
43
|
}
|