@gitmyabi/usdt 1.0.17 → 1.0.18

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,593 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.USDTToken_json = exports.USDTToken_jsonAbi = void 0;
4
- const viem_1 = require("viem");
5
- /**
6
- * USDTToken_json ABI
7
- *
8
- * This ABI is typed using viem's type system for full type safety.
9
- */
10
- exports.USDTToken_jsonAbi = [
11
- {
12
- "inputs": [],
13
- "stateMutability": "nonpayable",
14
- "type": "constructor"
15
- },
16
- {
17
- "anonymous": false,
18
- "inputs": [
19
- {
20
- "indexed": true,
21
- "internalType": "address",
22
- "name": "owner",
23
- "type": "address"
24
- },
25
- {
26
- "indexed": true,
27
- "internalType": "address",
28
- "name": "spender",
29
- "type": "address"
30
- },
31
- {
32
- "indexed": false,
33
- "internalType": "uint256",
34
- "name": "value",
35
- "type": "uint256"
36
- }
37
- ],
38
- "name": "Approval",
39
- "type": "event"
40
- },
41
- {
42
- "anonymous": false,
43
- "inputs": [
44
- {
45
- "indexed": true,
46
- "internalType": "address",
47
- "name": "from",
48
- "type": "address"
49
- },
50
- {
51
- "indexed": true,
52
- "internalType": "address",
53
- "name": "to",
54
- "type": "address"
55
- },
56
- {
57
- "indexed": false,
58
- "internalType": "uint256",
59
- "name": "value",
60
- "type": "uint256"
61
- }
62
- ],
63
- "name": "Transfer",
64
- "type": "event"
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
- },
79
- {
80
- "inputs": [
81
- {
82
- "internalType": "address",
83
- "name": "",
84
- "type": "address"
85
- },
86
- {
87
- "internalType": "address",
88
- "name": "",
89
- "type": "address"
90
- }
91
- ],
92
- "name": "allowance",
93
- "outputs": [
94
- {
95
- "internalType": "uint256",
96
- "name": "",
97
- "type": "uint256"
98
- }
99
- ],
100
- "stateMutability": "view",
101
- "type": "function"
102
- },
103
- {
104
- "inputs": [
105
- {
106
- "internalType": "address",
107
- "name": "spender",
108
- "type": "address"
109
- },
110
- {
111
- "internalType": "uint256",
112
- "name": "amount",
113
- "type": "uint256"
114
- }
115
- ],
116
- "name": "approve",
117
- "outputs": [
118
- {
119
- "internalType": "bool",
120
- "name": "",
121
- "type": "bool"
122
- }
123
- ],
124
- "stateMutability": "nonpayable",
125
- "type": "function"
126
- },
127
- {
128
- "inputs": [
129
- {
130
- "internalType": "address",
131
- "name": "",
132
- "type": "address"
133
- }
134
- ],
135
- "name": "balanceOf",
136
- "outputs": [
137
- {
138
- "internalType": "uint256",
139
- "name": "",
140
- "type": "uint256"
141
- }
142
- ],
143
- "stateMutability": "view",
144
- "type": "function"
145
- },
146
- {
147
- "inputs": [],
148
- "name": "decimals",
149
- "outputs": [
150
- {
151
- "internalType": "uint8",
152
- "name": "",
153
- "type": "uint8"
154
- }
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
- ],
182
- "stateMutability": "pure",
183
- "type": "function"
184
- },
185
- {
186
- "inputs": [],
187
- "name": "name",
188
- "outputs": [
189
- {
190
- "internalType": "string",
191
- "name": "",
192
- "type": "string"
193
- }
194
- ],
195
- "stateMutability": "view",
196
- "type": "function"
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
- },
216
- {
217
- "inputs": [],
218
- "name": "symbol",
219
- "outputs": [
220
- {
221
- "internalType": "string",
222
- "name": "",
223
- "type": "string"
224
- }
225
- ],
226
- "stateMutability": "view",
227
- "type": "function"
228
- },
229
- {
230
- "inputs": [],
231
- "name": "totalSupply",
232
- "outputs": [
233
- {
234
- "internalType": "uint256",
235
- "name": "",
236
- "type": "uint256"
237
- }
238
- ],
239
- "stateMutability": "view",
240
- "type": "function"
241
- },
242
- {
243
- "inputs": [
244
- {
245
- "internalType": "address",
246
- "name": "to",
247
- "type": "address"
248
- },
249
- {
250
- "internalType": "uint256",
251
- "name": "amount",
252
- "type": "uint256"
253
- }
254
- ],
255
- "name": "transfer",
256
- "outputs": [
257
- {
258
- "internalType": "bool",
259
- "name": "",
260
- "type": "bool"
261
- }
262
- ],
263
- "stateMutability": "nonpayable",
264
- "type": "function"
265
- },
266
- {
267
- "inputs": [
268
- {
269
- "internalType": "address",
270
- "name": "from",
271
- "type": "address"
272
- },
273
- {
274
- "internalType": "address",
275
- "name": "to",
276
- "type": "address"
277
- },
278
- {
279
- "internalType": "uint256",
280
- "name": "amount",
281
- "type": "uint256"
282
- }
283
- ],
284
- "name": "transferFrom",
285
- "outputs": [
286
- {
287
- "internalType": "bool",
288
- "name": "",
289
- "type": "bool"
290
- }
291
- ],
292
- "stateMutability": "nonpayable",
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"
305
- }
306
- ];
307
- /**
308
- * USDTToken_json Contract Class
309
- *
310
- * Provides a class-based API similar to TypeChain for interacting with the contract.
311
- *
312
- * @example
313
- * ```typescript
314
- * import { createPublicClient, createWalletClient, http } from 'viem';
315
- * import { mainnet } from 'viem/chains';
316
- * import { USDTToken_json } from 'USDTToken_json';
317
- *
318
- * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
319
- * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
320
- *
321
- * const contract = new USDTToken_json('0x...', { publicClient, walletClient });
322
- *
323
- * // Read functions
324
- * const result = await contract.balanceOf('0x...');
325
- *
326
- * // Write functions
327
- * const hash = await contract.transfer('0x...', 1000n);
328
- *
329
- * // Simulate transactions (dry-run)
330
- * const simulation = await contract.simulate.transfer('0x...', 1000n);
331
- * console.log('Gas estimate:', simulation.request.gas);
332
- *
333
- * // Watch events
334
- * const unwatch = contract.watch.Transfer((event) => {
335
- * console.log('Transfer event:', event);
336
- * });
337
- * ```
338
- */
339
- class USDTToken_json {
340
- constructor(address, clients) {
341
- this.contractAddress = address;
342
- this.publicClient = clients.publicClient;
343
- this.contract = (0, viem_1.getContract)({
344
- address,
345
- abi: exports.USDTToken_jsonAbi,
346
- client: {
347
- public: clients.publicClient,
348
- wallet: clients.walletClient,
349
- },
350
- });
351
- }
352
- /**
353
- * Get the contract address
354
- */
355
- get address() {
356
- return this.contractAddress;
357
- }
358
- /**
359
- * Get the underlying viem contract instance
360
- */
361
- getContract() {
362
- return this.contract;
363
- }
364
- /**
365
- * WITHDRAW_ADDRESS
366
- * view
367
- */
368
- async WITHDRAW_ADDRESS() {
369
- return this.contract.read.WITHDRAW_ADDRESS();
370
- }
371
- /**
372
- * allowance
373
- * view
374
- */
375
- async allowance(arg0, arg1) {
376
- return this.contract.read.allowance([arg0, arg1]);
377
- }
378
- /**
379
- * balanceOf
380
- * view
381
- */
382
- async balanceOf(arg0) {
383
- return this.contract.read.balanceOf([arg0]);
384
- }
385
- /**
386
- * decimals
387
- * view
388
- */
389
- async decimals() {
390
- return this.contract.read.decimals();
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
- }
406
- /**
407
- * name
408
- * view
409
- */
410
- async name() {
411
- return this.contract.read.name();
412
- }
413
- /**
414
- * symbol
415
- * view
416
- */
417
- async symbol() {
418
- return this.contract.read.symbol();
419
- }
420
- /**
421
- * totalSupply
422
- * view
423
- */
424
- async totalSupply() {
425
- return this.contract.read.totalSupply();
426
- }
427
- /**
428
- * approve
429
- * nonpayable
430
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
431
- */
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) {
444
- if (!this.contract.write) {
445
- throw new Error('Wallet client is required for write operations');
446
- }
447
- return this.contract.write.recoverToken([token, amount], options);
448
- }
449
- /**
450
- * transfer
451
- * nonpayable
452
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
453
- */
454
- async transfer(to, amount, options) {
455
- if (!this.contract.write) {
456
- throw new Error('Wallet client is required for write operations');
457
- }
458
- return this.contract.write.transfer([to, amount], options);
459
- }
460
- /**
461
- * transferFrom
462
- * nonpayable
463
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
464
- */
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) {
477
- if (!this.contract.write) {
478
- throw new Error('Wallet client is required for write operations');
479
- }
480
- return this.contract.write.withdrawETH(options);
481
- }
482
- /**
483
- * Simulate contract write operations (dry-run without sending transaction)
484
- *
485
- * @example
486
- * const result = await contract.simulate.transfer('0x...', 1000n);
487
- * console.log('Gas estimate:', result.request.gas);
488
- * console.log('Would succeed:', result.result);
489
- */
490
- get simulate() {
491
- const contract = this.contract;
492
- if (!contract.simulate) {
493
- throw new Error('Public client is required for simulation');
494
- }
495
- return {
496
- /**
497
- * Simulate approve
498
- * Returns gas estimate and result without sending transaction
499
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
500
- */
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);
511
- },
512
- /**
513
- * Simulate transfer
514
- * Returns gas estimate and result without sending transaction
515
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
516
- */
517
- async transfer(to, amount, options) {
518
- return contract.simulate.transfer([to, amount], options);
519
- },
520
- /**
521
- * Simulate transferFrom
522
- * Returns gas estimate and result without sending transaction
523
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
524
- */
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);
535
- }
536
- };
537
- }
538
- /**
539
- * Watch contract events
540
- *
541
- * @example
542
- * // Watch all Transfer events
543
- * const unwatch = contract.watch.Transfer((event) => {
544
- * console.log('Transfer:', event);
545
- * });
546
- *
547
- * // Stop watching
548
- * unwatch();
549
- */
550
- get watch() {
551
- return {
552
- /**
553
- * Watch Approval events
554
- * @param callback Function to call when event is emitted
555
- * @param filter Optional filter for indexed parameters
556
- * @returns Unwatch function to stop listening
557
- */
558
- Approval: (callback, filter) => {
559
- return this.publicClient.watchContractEvent({
560
- address: this.contractAddress,
561
- abi: exports.USDTToken_jsonAbi,
562
- eventName: 'Approval',
563
- args: filter,
564
- onLogs: (logs) => {
565
- logs.forEach((log) => {
566
- callback(log.args);
567
- });
568
- },
569
- });
570
- },
571
- /**
572
- * Watch Transfer events
573
- * @param callback Function to call when event is emitted
574
- * @param filter Optional filter for indexed parameters
575
- * @returns Unwatch function to stop listening
576
- */
577
- Transfer: (callback, filter) => {
578
- return this.publicClient.watchContractEvent({
579
- address: this.contractAddress,
580
- abi: exports.USDTToken_jsonAbi,
581
- eventName: 'Transfer',
582
- args: filter,
583
- onLogs: (logs) => {
584
- logs.forEach((log) => {
585
- callback(log.args);
586
- });
587
- },
588
- });
589
- }
590
- };
591
- }
592
- }
593
- exports.USDTToken_json = USDTToken_json;