@gitmyabi/usdt 1.0.12 → 1.0.13

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