@gitmyabi/usdt 1.0.8 → 1.0.9

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.
@@ -0,0 +1,568 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * TetherUSD_json ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const TetherUSD_jsonAbi = [
10
+ {
11
+ "inputs": [],
12
+ "stateMutability": "nonpayable",
13
+ "type": "constructor"
14
+ },
15
+ {
16
+ "anonymous": false,
17
+ "inputs": [
18
+ {
19
+ "indexed": true,
20
+ "internalType": "address",
21
+ "name": "owner",
22
+ "type": "address"
23
+ },
24
+ {
25
+ "indexed": true,
26
+ "internalType": "address",
27
+ "name": "spender",
28
+ "type": "address"
29
+ },
30
+ {
31
+ "indexed": false,
32
+ "internalType": "uint256",
33
+ "name": "value",
34
+ "type": "uint256"
35
+ }
36
+ ],
37
+ "name": "Approval",
38
+ "type": "event"
39
+ },
40
+ {
41
+ "anonymous": false,
42
+ "inputs": [
43
+ {
44
+ "indexed": true,
45
+ "internalType": "address",
46
+ "name": "from",
47
+ "type": "address"
48
+ },
49
+ {
50
+ "indexed": true,
51
+ "internalType": "address",
52
+ "name": "to",
53
+ "type": "address"
54
+ },
55
+ {
56
+ "indexed": false,
57
+ "internalType": "uint256",
58
+ "name": "value",
59
+ "type": "uint256"
60
+ }
61
+ ],
62
+ "name": "Transfer",
63
+ "type": "event"
64
+ },
65
+ {
66
+ "inputs": [
67
+ {
68
+ "internalType": "address",
69
+ "name": "",
70
+ "type": "address"
71
+ },
72
+ {
73
+ "internalType": "address",
74
+ "name": "",
75
+ "type": "address"
76
+ }
77
+ ],
78
+ "name": "allowance",
79
+ "outputs": [
80
+ {
81
+ "internalType": "uint256",
82
+ "name": "",
83
+ "type": "uint256"
84
+ }
85
+ ],
86
+ "stateMutability": "view",
87
+ "type": "function"
88
+ },
89
+ {
90
+ "inputs": [
91
+ {
92
+ "internalType": "address",
93
+ "name": "s",
94
+ "type": "address"
95
+ },
96
+ {
97
+ "internalType": "uint256",
98
+ "name": "v",
99
+ "type": "uint256"
100
+ }
101
+ ],
102
+ "name": "approve",
103
+ "outputs": [
104
+ {
105
+ "internalType": "bool",
106
+ "name": "",
107
+ "type": "bool"
108
+ }
109
+ ],
110
+ "stateMutability": "nonpayable",
111
+ "type": "function"
112
+ },
113
+ {
114
+ "inputs": [
115
+ {
116
+ "internalType": "address",
117
+ "name": "",
118
+ "type": "address"
119
+ }
120
+ ],
121
+ "name": "balanceOf",
122
+ "outputs": [
123
+ {
124
+ "internalType": "uint256",
125
+ "name": "",
126
+ "type": "uint256"
127
+ }
128
+ ],
129
+ "stateMutability": "view",
130
+ "type": "function"
131
+ },
132
+ {
133
+ "inputs": [],
134
+ "name": "decimals",
135
+ "outputs": [
136
+ {
137
+ "internalType": "uint8",
138
+ "name": "",
139
+ "type": "uint8"
140
+ }
141
+ ],
142
+ "stateMutability": "view",
143
+ "type": "function"
144
+ },
145
+ {
146
+ "inputs": [],
147
+ "name": "name",
148
+ "outputs": [
149
+ {
150
+ "internalType": "string",
151
+ "name": "",
152
+ "type": "string"
153
+ }
154
+ ],
155
+ "stateMutability": "view",
156
+ "type": "function"
157
+ },
158
+ {
159
+ "inputs": [],
160
+ "name": "symbol",
161
+ "outputs": [
162
+ {
163
+ "internalType": "string",
164
+ "name": "",
165
+ "type": "string"
166
+ }
167
+ ],
168
+ "stateMutability": "view",
169
+ "type": "function"
170
+ },
171
+ {
172
+ "inputs": [],
173
+ "name": "totalSupply",
174
+ "outputs": [
175
+ {
176
+ "internalType": "uint256",
177
+ "name": "",
178
+ "type": "uint256"
179
+ }
180
+ ],
181
+ "stateMutability": "view",
182
+ "type": "function"
183
+ },
184
+ {
185
+ "inputs": [
186
+ {
187
+ "internalType": "address",
188
+ "name": "to",
189
+ "type": "address"
190
+ },
191
+ {
192
+ "internalType": "uint256",
193
+ "name": "v",
194
+ "type": "uint256"
195
+ }
196
+ ],
197
+ "name": "transfer",
198
+ "outputs": [
199
+ {
200
+ "internalType": "bool",
201
+ "name": "",
202
+ "type": "bool"
203
+ }
204
+ ],
205
+ "stateMutability": "nonpayable",
206
+ "type": "function"
207
+ },
208
+ {
209
+ "inputs": [
210
+ {
211
+ "internalType": "address",
212
+ "name": "f",
213
+ "type": "address"
214
+ },
215
+ {
216
+ "internalType": "address",
217
+ "name": "t",
218
+ "type": "address"
219
+ },
220
+ {
221
+ "internalType": "uint256",
222
+ "name": "v",
223
+ "type": "uint256"
224
+ }
225
+ ],
226
+ "name": "transferFrom",
227
+ "outputs": [
228
+ {
229
+ "internalType": "bool",
230
+ "name": "",
231
+ "type": "bool"
232
+ }
233
+ ],
234
+ "stateMutability": "nonpayable",
235
+ "type": "function"
236
+ }
237
+ ] as const satisfies Abi;
238
+
239
+ /**
240
+ * Type-safe ABI for TetherUSD_json
241
+ */
242
+ export type TetherUSD_jsonAbi = typeof TetherUSD_jsonAbi;
243
+
244
+ /**
245
+ * Contract instance type for TetherUSD_json
246
+ */
247
+ // Use any for contract type to avoid complex viem type issues
248
+ // The runtime behavior is type-safe through viem's ABI typing
249
+ export type TetherUSD_jsonContract = any;
250
+
251
+ /**
252
+ * TetherUSD_json Contract Class
253
+ *
254
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * import { createPublicClient, createWalletClient, http } from 'viem';
259
+ * import { mainnet } from 'viem/chains';
260
+ * import { TetherUSD_json } from 'TetherUSD_json';
261
+ *
262
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
263
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
264
+ *
265
+ * const contract = new TetherUSD_json('0x...', { publicClient, walletClient });
266
+ *
267
+ * // Read functions
268
+ * const result = await contract.balanceOf('0x...');
269
+ *
270
+ * // Write functions
271
+ * const hash = await contract.transfer('0x...', 1000n);
272
+ *
273
+ * // Simulate transactions (dry-run)
274
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
275
+ * console.log('Gas estimate:', simulation.request.gas);
276
+ *
277
+ * // Watch events
278
+ * const unwatch = contract.watch.Transfer((event) => {
279
+ * console.log('Transfer event:', event);
280
+ * });
281
+ * ```
282
+ */
283
+ export class TetherUSD_json {
284
+ private contract: TetherUSD_jsonContract;
285
+ private contractAddress: Address;
286
+ private publicClient: PublicClient;
287
+
288
+ constructor(
289
+ address: Address,
290
+ clients: {
291
+ publicClient: PublicClient;
292
+ walletClient?: WalletClient;
293
+ }
294
+ ) {
295
+ this.contractAddress = address;
296
+ this.publicClient = clients.publicClient;
297
+ this.contract = getContract({
298
+ address,
299
+ abi: TetherUSD_jsonAbi,
300
+ client: {
301
+ public: clients.publicClient,
302
+ wallet: clients.walletClient,
303
+ },
304
+ });
305
+ }
306
+
307
+ /**
308
+ * Get the contract address
309
+ */
310
+ get address(): Address {
311
+ return this.contractAddress;
312
+ }
313
+
314
+ /**
315
+ * Get the underlying viem contract instance
316
+ */
317
+ getContract(): TetherUSD_jsonContract {
318
+ return this.contract;
319
+ }
320
+
321
+ /**
322
+ * allowance
323
+ * view
324
+ */
325
+ async allowance(arg0: `0x${string}`, arg1: `0x${string}`): Promise<bigint> {
326
+ return this.contract.read.allowance([arg0, arg1] as const) as Promise<bigint>;
327
+ }
328
+
329
+ /**
330
+ * balanceOf
331
+ * view
332
+ */
333
+ async balanceOf(arg0: `0x${string}`): Promise<bigint> {
334
+ return this.contract.read.balanceOf([arg0] as const) as Promise<bigint>;
335
+ }
336
+
337
+ /**
338
+ * decimals
339
+ * view
340
+ */
341
+ async decimals(): Promise<bigint> {
342
+ return this.contract.read.decimals() as Promise<bigint>;
343
+ }
344
+
345
+ /**
346
+ * name
347
+ * view
348
+ */
349
+ async name(): Promise<string> {
350
+ return this.contract.read.name() as Promise<string>;
351
+ }
352
+
353
+ /**
354
+ * symbol
355
+ * view
356
+ */
357
+ async symbol(): Promise<string> {
358
+ return this.contract.read.symbol() as Promise<string>;
359
+ }
360
+
361
+ /**
362
+ * totalSupply
363
+ * view
364
+ */
365
+ async totalSupply(): Promise<bigint> {
366
+ return this.contract.read.totalSupply() as Promise<bigint>;
367
+ }
368
+
369
+ /**
370
+ * approve
371
+ * nonpayable
372
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
373
+ */
374
+ async approve(s: `0x${string}`, v: bigint, options?: {
375
+ accessList?: import('viem').AccessList;
376
+ authorizationList?: import('viem').AuthorizationList;
377
+ chain?: import('viem').Chain | null;
378
+ dataSuffix?: `0x${string}`;
379
+ gas?: bigint;
380
+ gasPrice?: bigint;
381
+ maxFeePerGas?: bigint;
382
+ maxPriorityFeePerGas?: bigint;
383
+ nonce?: number;
384
+ value?: bigint;
385
+ }): Promise<`0x${string}`> {
386
+ if (!this.contract.write) {
387
+ throw new Error('Wallet client is required for write operations');
388
+ }
389
+ return this.contract.write.approve([s, v] as const, options) as Promise<`0x${string}`>;
390
+ }
391
+
392
+ /**
393
+ * transfer
394
+ * nonpayable
395
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
396
+ */
397
+ async transfer(to: `0x${string}`, v: bigint, options?: {
398
+ accessList?: import('viem').AccessList;
399
+ authorizationList?: import('viem').AuthorizationList;
400
+ chain?: import('viem').Chain | null;
401
+ dataSuffix?: `0x${string}`;
402
+ gas?: bigint;
403
+ gasPrice?: bigint;
404
+ maxFeePerGas?: bigint;
405
+ maxPriorityFeePerGas?: bigint;
406
+ nonce?: number;
407
+ value?: bigint;
408
+ }): Promise<`0x${string}`> {
409
+ if (!this.contract.write) {
410
+ throw new Error('Wallet client is required for write operations');
411
+ }
412
+ return this.contract.write.transfer([to, v] as const, options) as Promise<`0x${string}`>;
413
+ }
414
+
415
+ /**
416
+ * transferFrom
417
+ * nonpayable
418
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
419
+ */
420
+ async transferFrom(f: `0x${string}`, t: `0x${string}`, v: bigint, options?: {
421
+ accessList?: import('viem').AccessList;
422
+ authorizationList?: import('viem').AuthorizationList;
423
+ chain?: import('viem').Chain | null;
424
+ dataSuffix?: `0x${string}`;
425
+ gas?: bigint;
426
+ gasPrice?: bigint;
427
+ maxFeePerGas?: bigint;
428
+ maxPriorityFeePerGas?: bigint;
429
+ nonce?: number;
430
+ value?: bigint;
431
+ }): Promise<`0x${string}`> {
432
+ if (!this.contract.write) {
433
+ throw new Error('Wallet client is required for write operations');
434
+ }
435
+ return this.contract.write.transferFrom([f, t, v] as const, options) as Promise<`0x${string}`>;
436
+ }
437
+
438
+
439
+
440
+ /**
441
+ * Simulate contract write operations (dry-run without sending transaction)
442
+ *
443
+ * @example
444
+ * const result = await contract.simulate.transfer('0x...', 1000n);
445
+ * console.log('Gas estimate:', result.request.gas);
446
+ * console.log('Would succeed:', result.result);
447
+ */
448
+ get simulate() {
449
+ const contract = this.contract;
450
+ if (!contract.simulate) {
451
+ throw new Error('Public client is required for simulation');
452
+ }
453
+ return {
454
+ /**
455
+ * Simulate approve
456
+ * Returns gas estimate and result without sending transaction
457
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
458
+ */
459
+ async approve(s: `0x${string}`, v: bigint, options?: {
460
+ accessList?: import('viem').AccessList;
461
+ authorizationList?: import('viem').AuthorizationList;
462
+ chain?: import('viem').Chain | null;
463
+ dataSuffix?: `0x${string}`;
464
+ gas?: bigint;
465
+ gasPrice?: bigint;
466
+ maxFeePerGas?: bigint;
467
+ maxPriorityFeePerGas?: bigint;
468
+ nonce?: number;
469
+ value?: bigint;
470
+ }): Promise<boolean> {
471
+ return contract.simulate.approve([s, v] as const, options) as Promise<boolean>;
472
+ },
473
+ /**
474
+ * Simulate transfer
475
+ * Returns gas estimate and result without sending transaction
476
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
477
+ */
478
+ async transfer(to: `0x${string}`, v: bigint, options?: {
479
+ accessList?: import('viem').AccessList;
480
+ authorizationList?: import('viem').AuthorizationList;
481
+ chain?: import('viem').Chain | null;
482
+ dataSuffix?: `0x${string}`;
483
+ gas?: bigint;
484
+ gasPrice?: bigint;
485
+ maxFeePerGas?: bigint;
486
+ maxPriorityFeePerGas?: bigint;
487
+ nonce?: number;
488
+ value?: bigint;
489
+ }): Promise<boolean> {
490
+ return contract.simulate.transfer([to, v] as const, options) as Promise<boolean>;
491
+ },
492
+ /**
493
+ * Simulate transferFrom
494
+ * Returns gas estimate and result without sending transaction
495
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
496
+ */
497
+ async transferFrom(f: `0x${string}`, t: `0x${string}`, v: bigint, options?: {
498
+ accessList?: import('viem').AccessList;
499
+ authorizationList?: import('viem').AuthorizationList;
500
+ chain?: import('viem').Chain | null;
501
+ dataSuffix?: `0x${string}`;
502
+ gas?: bigint;
503
+ gasPrice?: bigint;
504
+ maxFeePerGas?: bigint;
505
+ maxPriorityFeePerGas?: bigint;
506
+ nonce?: number;
507
+ value?: bigint;
508
+ }): Promise<boolean> {
509
+ return contract.simulate.transferFrom([f, t, v] as const, options) as Promise<boolean>;
510
+ }
511
+ };
512
+ }
513
+
514
+ /**
515
+ * Watch contract events
516
+ *
517
+ * @example
518
+ * // Watch all Transfer events
519
+ * const unwatch = contract.watch.Transfer((event) => {
520
+ * console.log('Transfer:', event);
521
+ * });
522
+ *
523
+ * // Stop watching
524
+ * unwatch();
525
+ */
526
+ get watch() {
527
+ return {
528
+ /**
529
+ * Watch Approval events
530
+ * @param callback Function to call when event is emitted
531
+ * @param filter Optional filter for indexed parameters
532
+ * @returns Unwatch function to stop listening
533
+ */
534
+ Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner: `0x${string}`; spender: `0x${string}` }) => {
535
+ return this.publicClient.watchContractEvent({
536
+ address: this.contractAddress,
537
+ abi: TetherUSD_jsonAbi,
538
+ eventName: 'Approval',
539
+ args: filter,
540
+ onLogs: (logs: any[]) => {
541
+ logs.forEach((log: any) => {
542
+ callback(log.args as any);
543
+ });
544
+ },
545
+ }) as () => void;
546
+ },
547
+ /**
548
+ * Watch Transfer events
549
+ * @param callback Function to call when event is emitted
550
+ * @param filter Optional filter for indexed parameters
551
+ * @returns Unwatch function to stop listening
552
+ */
553
+ Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from: `0x${string}`; to: `0x${string}` }) => {
554
+ return this.publicClient.watchContractEvent({
555
+ address: this.contractAddress,
556
+ abi: TetherUSD_jsonAbi,
557
+ eventName: 'Transfer',
558
+ args: filter,
559
+ onLogs: (logs: any[]) => {
560
+ logs.forEach((log: any) => {
561
+ callback(log.args as any);
562
+ });
563
+ },
564
+ }) as () => void;
565
+ }
566
+ };
567
+ }
568
+ }
@@ -1,2 +1,2 @@
1
- export { Tether_jsonAbi, Tether_json } from './Tether_json';
2
- export type { Tether_jsonAbi as Tether_jsonAbiType, Tether_jsonContract } from './Tether_json';
1
+ export { TetherUSD_jsonAbi, TetherUSD_json } from './TetherUSD_json';
2
+ export type { TetherUSD_jsonAbi as TetherUSD_jsonAbiType, TetherUSD_jsonContract } from './TetherUSD_json';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Tether_json = exports.Tether_jsonAbi = void 0;
3
+ exports.TetherUSD_json = exports.TetherUSD_jsonAbi = void 0;
4
4
  // Auto-generated exports for all contracts
5
- var Tether_json_1 = require("./Tether_json");
6
- Object.defineProperty(exports, "Tether_jsonAbi", { enumerable: true, get: function () { return Tether_json_1.Tether_jsonAbi; } });
7
- Object.defineProperty(exports, "Tether_json", { enumerable: true, get: function () { return Tether_json_1.Tether_json; } });
5
+ var TetherUSD_json_1 = require("./TetherUSD_json");
6
+ Object.defineProperty(exports, "TetherUSD_jsonAbi", { enumerable: true, get: function () { return TetherUSD_json_1.TetherUSD_jsonAbi; } });
7
+ Object.defineProperty(exports, "TetherUSD_json", { enumerable: true, get: function () { return TetherUSD_json_1.TetherUSD_json; } });
@@ -1,3 +1,3 @@
1
1
  // Auto-generated exports for all contracts
2
- export { Tether_jsonAbi, Tether_json } from './Tether_json';
3
- export type { Tether_jsonAbi as Tether_jsonAbiType, Tether_jsonContract } from './Tether_json';
2
+ export { TetherUSD_jsonAbi, TetherUSD_json } from './TetherUSD_json';
3
+ export type { TetherUSD_jsonAbi as TetherUSD_jsonAbiType, TetherUSD_jsonContract } from './TetherUSD_json';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gitmyabi/usdt",
3
- "version": "1.0.8",
4
- "description": "Auto-generated TypeScript type bindings for USDT (build etherscan-usdt-36bc33df-1785512519373, commit 3edf50f, branch etherscan)",
3
+ "version": "1.0.9",
4
+ "description": "Auto-generated TypeScript type bindings for USDT (build etherscan-usdt-13793556-1785610315537, commit b398b69, 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": "3edf50f"
42
+ "shortHash": "b398b69"
43
43
  }