@gitmyabi/usdt 1.0.15 → 1.0.16
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 → UERC20_json.d.ts} +244 -83
- package/contracts/{SimpleUSDT_json.js → UERC20_json.js} +287 -104
- package/contracts/{SimpleUSDT_json.ts → UERC20_json.ts} +323 -110
- 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,100 +2,54 @@ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType }
|
|
|
2
2
|
import { getContract } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* UERC20_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 UERC20_jsonAbi = [
|
|
10
10
|
{
|
|
11
11
|
"inputs": [],
|
|
12
12
|
"stateMutability": "nonpayable",
|
|
13
13
|
"type": "constructor"
|
|
14
14
|
},
|
|
15
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",
|
|
16
|
+
"inputs": [],
|
|
17
|
+
"name": "AllowanceOverflow",
|
|
34
18
|
"type": "error"
|
|
35
19
|
},
|
|
36
20
|
{
|
|
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",
|
|
21
|
+
"inputs": [],
|
|
22
|
+
"name": "AllowanceUnderflow",
|
|
55
23
|
"type": "error"
|
|
56
24
|
},
|
|
57
25
|
{
|
|
58
|
-
"inputs": [
|
|
59
|
-
|
|
60
|
-
"internalType": "address",
|
|
61
|
-
"name": "approver",
|
|
62
|
-
"type": "address"
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
"name": "ERC20InvalidApprover",
|
|
26
|
+
"inputs": [],
|
|
27
|
+
"name": "InsufficientAllowance",
|
|
66
28
|
"type": "error"
|
|
67
29
|
},
|
|
68
30
|
{
|
|
69
|
-
"inputs": [
|
|
70
|
-
|
|
71
|
-
"internalType": "address",
|
|
72
|
-
"name": "receiver",
|
|
73
|
-
"type": "address"
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
"name": "ERC20InvalidReceiver",
|
|
31
|
+
"inputs": [],
|
|
32
|
+
"name": "InsufficientBalance",
|
|
77
33
|
"type": "error"
|
|
78
34
|
},
|
|
79
35
|
{
|
|
80
|
-
"inputs": [
|
|
81
|
-
|
|
82
|
-
"internalType": "address",
|
|
83
|
-
"name": "sender",
|
|
84
|
-
"type": "address"
|
|
85
|
-
}
|
|
86
|
-
],
|
|
87
|
-
"name": "ERC20InvalidSender",
|
|
36
|
+
"inputs": [],
|
|
37
|
+
"name": "InvalidPermit",
|
|
88
38
|
"type": "error"
|
|
89
39
|
},
|
|
90
40
|
{
|
|
91
|
-
"inputs": [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"
|
|
41
|
+
"inputs": [],
|
|
42
|
+
"name": "Permit2AllowanceIsFixedAtInfinity",
|
|
43
|
+
"type": "error"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"inputs": [],
|
|
47
|
+
"name": "PermitExpired",
|
|
48
|
+
"type": "error"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"inputs": [],
|
|
52
|
+
"name": "TotalSupplyOverflow",
|
|
99
53
|
"type": "error"
|
|
100
54
|
},
|
|
101
55
|
{
|
|
@@ -116,7 +70,7 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
116
70
|
{
|
|
117
71
|
"indexed": false,
|
|
118
72
|
"internalType": "uint256",
|
|
119
|
-
"name": "
|
|
73
|
+
"name": "amount",
|
|
120
74
|
"type": "uint256"
|
|
121
75
|
}
|
|
122
76
|
],
|
|
@@ -141,13 +95,26 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
141
95
|
{
|
|
142
96
|
"indexed": false,
|
|
143
97
|
"internalType": "uint256",
|
|
144
|
-
"name": "
|
|
98
|
+
"name": "amount",
|
|
145
99
|
"type": "uint256"
|
|
146
100
|
}
|
|
147
101
|
],
|
|
148
102
|
"name": "Transfer",
|
|
149
103
|
"type": "event"
|
|
150
104
|
},
|
|
105
|
+
{
|
|
106
|
+
"inputs": [],
|
|
107
|
+
"name": "DOMAIN_SEPARATOR",
|
|
108
|
+
"outputs": [
|
|
109
|
+
{
|
|
110
|
+
"internalType": "bytes32",
|
|
111
|
+
"name": "result",
|
|
112
|
+
"type": "bytes32"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"stateMutability": "view",
|
|
116
|
+
"type": "function"
|
|
117
|
+
},
|
|
151
118
|
{
|
|
152
119
|
"inputs": [
|
|
153
120
|
{
|
|
@@ -165,7 +132,7 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
165
132
|
"outputs": [
|
|
166
133
|
{
|
|
167
134
|
"internalType": "uint256",
|
|
168
|
-
"name": "",
|
|
135
|
+
"name": "result",
|
|
169
136
|
"type": "uint256"
|
|
170
137
|
}
|
|
171
138
|
],
|
|
@@ -181,7 +148,7 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
181
148
|
},
|
|
182
149
|
{
|
|
183
150
|
"internalType": "uint256",
|
|
184
|
-
"name": "
|
|
151
|
+
"name": "amount",
|
|
185
152
|
"type": "uint256"
|
|
186
153
|
}
|
|
187
154
|
],
|
|
@@ -200,7 +167,7 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
200
167
|
"inputs": [
|
|
201
168
|
{
|
|
202
169
|
"internalType": "address",
|
|
203
|
-
"name": "
|
|
170
|
+
"name": "owner",
|
|
204
171
|
"type": "address"
|
|
205
172
|
}
|
|
206
173
|
],
|
|
@@ -208,13 +175,26 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
208
175
|
"outputs": [
|
|
209
176
|
{
|
|
210
177
|
"internalType": "uint256",
|
|
211
|
-
"name": "",
|
|
178
|
+
"name": "result",
|
|
212
179
|
"type": "uint256"
|
|
213
180
|
}
|
|
214
181
|
],
|
|
215
182
|
"stateMutability": "view",
|
|
216
183
|
"type": "function"
|
|
217
184
|
},
|
|
185
|
+
{
|
|
186
|
+
"inputs": [],
|
|
187
|
+
"name": "creator",
|
|
188
|
+
"outputs": [
|
|
189
|
+
{
|
|
190
|
+
"internalType": "address",
|
|
191
|
+
"name": "",
|
|
192
|
+
"type": "address"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
"stateMutability": "view",
|
|
196
|
+
"type": "function"
|
|
197
|
+
},
|
|
218
198
|
{
|
|
219
199
|
"inputs": [],
|
|
220
200
|
"name": "decimals",
|
|
@@ -225,7 +205,48 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
225
205
|
"type": "uint8"
|
|
226
206
|
}
|
|
227
207
|
],
|
|
228
|
-
"stateMutability": "
|
|
208
|
+
"stateMutability": "view",
|
|
209
|
+
"type": "function"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"inputs": [],
|
|
213
|
+
"name": "graffiti",
|
|
214
|
+
"outputs": [
|
|
215
|
+
{
|
|
216
|
+
"internalType": "bytes32",
|
|
217
|
+
"name": "",
|
|
218
|
+
"type": "bytes32"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"stateMutability": "view",
|
|
222
|
+
"type": "function"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"inputs": [],
|
|
226
|
+
"name": "metadata",
|
|
227
|
+
"outputs": [
|
|
228
|
+
{
|
|
229
|
+
"internalType": "string",
|
|
230
|
+
"name": "description",
|
|
231
|
+
"type": "string"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"internalType": "string",
|
|
235
|
+
"name": "website",
|
|
236
|
+
"type": "string"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"internalType": "string",
|
|
240
|
+
"name": "image",
|
|
241
|
+
"type": "string"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"internalType": "bytes",
|
|
245
|
+
"name": "extraData",
|
|
246
|
+
"type": "bytes"
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
"stateMutability": "view",
|
|
229
250
|
"type": "function"
|
|
230
251
|
},
|
|
231
252
|
{
|
|
@@ -241,6 +262,87 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
241
262
|
"stateMutability": "view",
|
|
242
263
|
"type": "function"
|
|
243
264
|
},
|
|
265
|
+
{
|
|
266
|
+
"inputs": [
|
|
267
|
+
{
|
|
268
|
+
"internalType": "address",
|
|
269
|
+
"name": "owner",
|
|
270
|
+
"type": "address"
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
"name": "nonces",
|
|
274
|
+
"outputs": [
|
|
275
|
+
{
|
|
276
|
+
"internalType": "uint256",
|
|
277
|
+
"name": "result",
|
|
278
|
+
"type": "uint256"
|
|
279
|
+
}
|
|
280
|
+
],
|
|
281
|
+
"stateMutability": "view",
|
|
282
|
+
"type": "function"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"inputs": [
|
|
286
|
+
{
|
|
287
|
+
"internalType": "address",
|
|
288
|
+
"name": "owner",
|
|
289
|
+
"type": "address"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"internalType": "address",
|
|
293
|
+
"name": "spender",
|
|
294
|
+
"type": "address"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"internalType": "uint256",
|
|
298
|
+
"name": "value",
|
|
299
|
+
"type": "uint256"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"internalType": "uint256",
|
|
303
|
+
"name": "deadline",
|
|
304
|
+
"type": "uint256"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"internalType": "uint8",
|
|
308
|
+
"name": "v",
|
|
309
|
+
"type": "uint8"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"internalType": "bytes32",
|
|
313
|
+
"name": "r",
|
|
314
|
+
"type": "bytes32"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"internalType": "bytes32",
|
|
318
|
+
"name": "s",
|
|
319
|
+
"type": "bytes32"
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"name": "permit",
|
|
323
|
+
"outputs": [],
|
|
324
|
+
"stateMutability": "nonpayable",
|
|
325
|
+
"type": "function"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"inputs": [
|
|
329
|
+
{
|
|
330
|
+
"internalType": "bytes4",
|
|
331
|
+
"name": "_interfaceId",
|
|
332
|
+
"type": "bytes4"
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
"name": "supportsInterface",
|
|
336
|
+
"outputs": [
|
|
337
|
+
{
|
|
338
|
+
"internalType": "bool",
|
|
339
|
+
"name": "",
|
|
340
|
+
"type": "bool"
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
"stateMutability": "view",
|
|
344
|
+
"type": "function"
|
|
345
|
+
},
|
|
244
346
|
{
|
|
245
347
|
"inputs": [],
|
|
246
348
|
"name": "symbol",
|
|
@@ -254,13 +356,26 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
254
356
|
"stateMutability": "view",
|
|
255
357
|
"type": "function"
|
|
256
358
|
},
|
|
359
|
+
{
|
|
360
|
+
"inputs": [],
|
|
361
|
+
"name": "tokenURI",
|
|
362
|
+
"outputs": [
|
|
363
|
+
{
|
|
364
|
+
"internalType": "string",
|
|
365
|
+
"name": "",
|
|
366
|
+
"type": "string"
|
|
367
|
+
}
|
|
368
|
+
],
|
|
369
|
+
"stateMutability": "view",
|
|
370
|
+
"type": "function"
|
|
371
|
+
},
|
|
257
372
|
{
|
|
258
373
|
"inputs": [],
|
|
259
374
|
"name": "totalSupply",
|
|
260
375
|
"outputs": [
|
|
261
376
|
{
|
|
262
377
|
"internalType": "uint256",
|
|
263
|
-
"name": "",
|
|
378
|
+
"name": "result",
|
|
264
379
|
"type": "uint256"
|
|
265
380
|
}
|
|
266
381
|
],
|
|
@@ -276,7 +391,7 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
276
391
|
},
|
|
277
392
|
{
|
|
278
393
|
"internalType": "uint256",
|
|
279
|
-
"name": "
|
|
394
|
+
"name": "amount",
|
|
280
395
|
"type": "uint256"
|
|
281
396
|
}
|
|
282
397
|
],
|
|
@@ -305,7 +420,7 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
305
420
|
},
|
|
306
421
|
{
|
|
307
422
|
"internalType": "uint256",
|
|
308
|
-
"name": "
|
|
423
|
+
"name": "amount",
|
|
309
424
|
"type": "uint256"
|
|
310
425
|
}
|
|
311
426
|
],
|
|
@@ -323,19 +438,19 @@ export const SimpleUSDT_jsonAbi = [
|
|
|
323
438
|
] as const satisfies Abi;
|
|
324
439
|
|
|
325
440
|
/**
|
|
326
|
-
* Type-safe ABI for
|
|
441
|
+
* Type-safe ABI for UERC20_json
|
|
327
442
|
*/
|
|
328
|
-
export type
|
|
443
|
+
export type UERC20_jsonAbi = typeof UERC20_jsonAbi;
|
|
329
444
|
|
|
330
445
|
/**
|
|
331
|
-
* Contract instance type for
|
|
446
|
+
* Contract instance type for UERC20_json
|
|
332
447
|
*/
|
|
333
448
|
// Use any for contract type to avoid complex viem type issues
|
|
334
449
|
// The runtime behavior is type-safe through viem's ABI typing
|
|
335
|
-
export type
|
|
450
|
+
export type UERC20_jsonContract = any;
|
|
336
451
|
|
|
337
452
|
/**
|
|
338
|
-
*
|
|
453
|
+
* UERC20_json Contract Class
|
|
339
454
|
*
|
|
340
455
|
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
341
456
|
*
|
|
@@ -343,12 +458,12 @@ export type SimpleUSDT_jsonContract = any;
|
|
|
343
458
|
* ```typescript
|
|
344
459
|
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
345
460
|
* import { mainnet } from 'viem/chains';
|
|
346
|
-
* import {
|
|
461
|
+
* import { UERC20_json } from 'UERC20_json';
|
|
347
462
|
*
|
|
348
463
|
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
349
464
|
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
350
465
|
*
|
|
351
|
-
* const contract = new
|
|
466
|
+
* const contract = new UERC20_json('0x...', { publicClient, walletClient });
|
|
352
467
|
*
|
|
353
468
|
* // Read functions
|
|
354
469
|
* const result = await contract.balanceOf('0x...');
|
|
@@ -366,8 +481,8 @@ export type SimpleUSDT_jsonContract = any;
|
|
|
366
481
|
* });
|
|
367
482
|
* ```
|
|
368
483
|
*/
|
|
369
|
-
export class
|
|
370
|
-
private contract:
|
|
484
|
+
export class UERC20_json {
|
|
485
|
+
private contract: UERC20_jsonContract;
|
|
371
486
|
private contractAddress: Address;
|
|
372
487
|
private publicClient: PublicClient;
|
|
373
488
|
|
|
@@ -382,7 +497,7 @@ export class SimpleUSDT_json {
|
|
|
382
497
|
this.publicClient = clients.publicClient;
|
|
383
498
|
this.contract = getContract({
|
|
384
499
|
address,
|
|
385
|
-
abi:
|
|
500
|
+
abi: UERC20_jsonAbi,
|
|
386
501
|
client: {
|
|
387
502
|
public: clients.publicClient,
|
|
388
503
|
wallet: clients.walletClient,
|
|
@@ -400,10 +515,18 @@ export class SimpleUSDT_json {
|
|
|
400
515
|
/**
|
|
401
516
|
* Get the underlying viem contract instance
|
|
402
517
|
*/
|
|
403
|
-
getContract():
|
|
518
|
+
getContract(): UERC20_jsonContract {
|
|
404
519
|
return this.contract;
|
|
405
520
|
}
|
|
406
521
|
|
|
522
|
+
/**
|
|
523
|
+
* DOMAIN_SEPARATOR
|
|
524
|
+
* view
|
|
525
|
+
*/
|
|
526
|
+
async DOMAIN_SEPARATOR(): Promise<`0x${string}`> {
|
|
527
|
+
return this.contract.read.DOMAIN_SEPARATOR() as Promise<`0x${string}`>;
|
|
528
|
+
}
|
|
529
|
+
|
|
407
530
|
/**
|
|
408
531
|
* allowance
|
|
409
532
|
* view
|
|
@@ -416,18 +539,42 @@ export class SimpleUSDT_json {
|
|
|
416
539
|
* balanceOf
|
|
417
540
|
* view
|
|
418
541
|
*/
|
|
419
|
-
async balanceOf(
|
|
420
|
-
return this.contract.read.balanceOf([
|
|
542
|
+
async balanceOf(owner: `0x${string}`): Promise<bigint> {
|
|
543
|
+
return this.contract.read.balanceOf([owner] as const) as Promise<bigint>;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* creator
|
|
548
|
+
* view
|
|
549
|
+
*/
|
|
550
|
+
async creator(): Promise<`0x${string}`> {
|
|
551
|
+
return this.contract.read.creator() as Promise<`0x${string}`>;
|
|
421
552
|
}
|
|
422
553
|
|
|
423
554
|
/**
|
|
424
555
|
* decimals
|
|
425
|
-
*
|
|
556
|
+
* view
|
|
426
557
|
*/
|
|
427
558
|
async decimals(): Promise<bigint> {
|
|
428
559
|
return this.contract.read.decimals() as Promise<bigint>;
|
|
429
560
|
}
|
|
430
561
|
|
|
562
|
+
/**
|
|
563
|
+
* graffiti
|
|
564
|
+
* view
|
|
565
|
+
*/
|
|
566
|
+
async graffiti(): Promise<`0x${string}`> {
|
|
567
|
+
return this.contract.read.graffiti() as Promise<`0x${string}`>;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* metadata
|
|
572
|
+
* view
|
|
573
|
+
*/
|
|
574
|
+
async metadata(): Promise<[string, string, string, `0x${string}`]> {
|
|
575
|
+
return this.contract.read.metadata() as Promise<[string, string, string, `0x${string}`]>;
|
|
576
|
+
}
|
|
577
|
+
|
|
431
578
|
/**
|
|
432
579
|
* name
|
|
433
580
|
* view
|
|
@@ -436,6 +583,22 @@ export class SimpleUSDT_json {
|
|
|
436
583
|
return this.contract.read.name() as Promise<string>;
|
|
437
584
|
}
|
|
438
585
|
|
|
586
|
+
/**
|
|
587
|
+
* nonces
|
|
588
|
+
* view
|
|
589
|
+
*/
|
|
590
|
+
async nonces(owner: `0x${string}`): Promise<bigint> {
|
|
591
|
+
return this.contract.read.nonces([owner] as const) as Promise<bigint>;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* supportsInterface
|
|
596
|
+
* view
|
|
597
|
+
*/
|
|
598
|
+
async supportsInterface(_interfaceId: `0x${string}`): Promise<boolean> {
|
|
599
|
+
return this.contract.read.supportsInterface([_interfaceId] as const) as Promise<boolean>;
|
|
600
|
+
}
|
|
601
|
+
|
|
439
602
|
/**
|
|
440
603
|
* symbol
|
|
441
604
|
* view
|
|
@@ -444,6 +607,14 @@ export class SimpleUSDT_json {
|
|
|
444
607
|
return this.contract.read.symbol() as Promise<string>;
|
|
445
608
|
}
|
|
446
609
|
|
|
610
|
+
/**
|
|
611
|
+
* tokenURI
|
|
612
|
+
* view
|
|
613
|
+
*/
|
|
614
|
+
async tokenURI(): Promise<string> {
|
|
615
|
+
return this.contract.read.tokenURI() as Promise<string>;
|
|
616
|
+
}
|
|
617
|
+
|
|
447
618
|
/**
|
|
448
619
|
* totalSupply
|
|
449
620
|
* view
|
|
@@ -457,7 +628,7 @@ export class SimpleUSDT_json {
|
|
|
457
628
|
* nonpayable
|
|
458
629
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
459
630
|
*/
|
|
460
|
-
async approve(spender: `0x${string}`,
|
|
631
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
461
632
|
accessList?: import('viem').AccessList;
|
|
462
633
|
authorizationList?: import('viem').AuthorizationList;
|
|
463
634
|
chain?: import('viem').Chain | null;
|
|
@@ -472,7 +643,30 @@ export class SimpleUSDT_json {
|
|
|
472
643
|
if (!this.contract.write) {
|
|
473
644
|
throw new Error('Wallet client is required for write operations');
|
|
474
645
|
}
|
|
475
|
-
return this.contract.write.approve([spender,
|
|
646
|
+
return this.contract.write.approve([spender, amount] as const, options) as Promise<`0x${string}`>;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* permit
|
|
651
|
+
* nonpayable
|
|
652
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
653
|
+
*/
|
|
654
|
+
async permit(owner: `0x${string}`, spender: `0x${string}`, value: bigint, deadline: bigint, v: bigint, r: `0x${string}`, s: `0x${string}`, options?: {
|
|
655
|
+
accessList?: import('viem').AccessList;
|
|
656
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
657
|
+
chain?: import('viem').Chain | null;
|
|
658
|
+
dataSuffix?: `0x${string}`;
|
|
659
|
+
gas?: bigint;
|
|
660
|
+
gasPrice?: bigint;
|
|
661
|
+
maxFeePerGas?: bigint;
|
|
662
|
+
maxPriorityFeePerGas?: bigint;
|
|
663
|
+
nonce?: number;
|
|
664
|
+
value?: bigint;
|
|
665
|
+
}): Promise<`0x${string}`> {
|
|
666
|
+
if (!this.contract.write) {
|
|
667
|
+
throw new Error('Wallet client is required for write operations');
|
|
668
|
+
}
|
|
669
|
+
return this.contract.write.permit([owner, spender, value, deadline, v, r, s] as const, options) as Promise<`0x${string}`>;
|
|
476
670
|
}
|
|
477
671
|
|
|
478
672
|
/**
|
|
@@ -480,7 +674,7 @@ export class SimpleUSDT_json {
|
|
|
480
674
|
* nonpayable
|
|
481
675
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
482
676
|
*/
|
|
483
|
-
async transfer(to: `0x${string}`,
|
|
677
|
+
async transfer(to: `0x${string}`, amount: bigint, options?: {
|
|
484
678
|
accessList?: import('viem').AccessList;
|
|
485
679
|
authorizationList?: import('viem').AuthorizationList;
|
|
486
680
|
chain?: import('viem').Chain | null;
|
|
@@ -495,7 +689,7 @@ export class SimpleUSDT_json {
|
|
|
495
689
|
if (!this.contract.write) {
|
|
496
690
|
throw new Error('Wallet client is required for write operations');
|
|
497
691
|
}
|
|
498
|
-
return this.contract.write.transfer([to,
|
|
692
|
+
return this.contract.write.transfer([to, amount] as const, options) as Promise<`0x${string}`>;
|
|
499
693
|
}
|
|
500
694
|
|
|
501
695
|
/**
|
|
@@ -503,7 +697,7 @@ export class SimpleUSDT_json {
|
|
|
503
697
|
* nonpayable
|
|
504
698
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
505
699
|
*/
|
|
506
|
-
async transferFrom(from: `0x${string}`, to: `0x${string}`,
|
|
700
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
|
|
507
701
|
accessList?: import('viem').AccessList;
|
|
508
702
|
authorizationList?: import('viem').AuthorizationList;
|
|
509
703
|
chain?: import('viem').Chain | null;
|
|
@@ -518,7 +712,7 @@ export class SimpleUSDT_json {
|
|
|
518
712
|
if (!this.contract.write) {
|
|
519
713
|
throw new Error('Wallet client is required for write operations');
|
|
520
714
|
}
|
|
521
|
-
return this.contract.write.transferFrom([from, to,
|
|
715
|
+
return this.contract.write.transferFrom([from, to, amount] as const, options) as Promise<`0x${string}`>;
|
|
522
716
|
}
|
|
523
717
|
|
|
524
718
|
|
|
@@ -542,7 +736,7 @@ export class SimpleUSDT_json {
|
|
|
542
736
|
* Returns gas estimate and result without sending transaction
|
|
543
737
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
544
738
|
*/
|
|
545
|
-
async approve(spender: `0x${string}`,
|
|
739
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
546
740
|
accessList?: import('viem').AccessList;
|
|
547
741
|
authorizationList?: import('viem').AuthorizationList;
|
|
548
742
|
chain?: import('viem').Chain | null;
|
|
@@ -554,14 +748,33 @@ export class SimpleUSDT_json {
|
|
|
554
748
|
nonce?: number;
|
|
555
749
|
value?: bigint;
|
|
556
750
|
}): Promise<boolean> {
|
|
557
|
-
return contract.simulate.approve([spender,
|
|
751
|
+
return contract.simulate.approve([spender, amount] as const, options) as Promise<boolean>;
|
|
752
|
+
},
|
|
753
|
+
/**
|
|
754
|
+
* Simulate permit
|
|
755
|
+
* Returns gas estimate and result without sending transaction
|
|
756
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
757
|
+
*/
|
|
758
|
+
async permit(owner: `0x${string}`, spender: `0x${string}`, value: bigint, deadline: bigint, v: bigint, r: `0x${string}`, s: `0x${string}`, options?: {
|
|
759
|
+
accessList?: import('viem').AccessList;
|
|
760
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
761
|
+
chain?: import('viem').Chain | null;
|
|
762
|
+
dataSuffix?: `0x${string}`;
|
|
763
|
+
gas?: bigint;
|
|
764
|
+
gasPrice?: bigint;
|
|
765
|
+
maxFeePerGas?: bigint;
|
|
766
|
+
maxPriorityFeePerGas?: bigint;
|
|
767
|
+
nonce?: number;
|
|
768
|
+
value?: bigint;
|
|
769
|
+
}): Promise<void> {
|
|
770
|
+
return contract.simulate.permit([owner, spender, value, deadline, v, r, s] as const, options) as Promise<void>;
|
|
558
771
|
},
|
|
559
772
|
/**
|
|
560
773
|
* Simulate transfer
|
|
561
774
|
* Returns gas estimate and result without sending transaction
|
|
562
775
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
563
776
|
*/
|
|
564
|
-
async transfer(to: `0x${string}`,
|
|
777
|
+
async transfer(to: `0x${string}`, amount: bigint, options?: {
|
|
565
778
|
accessList?: import('viem').AccessList;
|
|
566
779
|
authorizationList?: import('viem').AuthorizationList;
|
|
567
780
|
chain?: import('viem').Chain | null;
|
|
@@ -573,14 +786,14 @@ export class SimpleUSDT_json {
|
|
|
573
786
|
nonce?: number;
|
|
574
787
|
value?: bigint;
|
|
575
788
|
}): Promise<boolean> {
|
|
576
|
-
return contract.simulate.transfer([to,
|
|
789
|
+
return contract.simulate.transfer([to, amount] as const, options) as Promise<boolean>;
|
|
577
790
|
},
|
|
578
791
|
/**
|
|
579
792
|
* Simulate transferFrom
|
|
580
793
|
* Returns gas estimate and result without sending transaction
|
|
581
794
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
582
795
|
*/
|
|
583
|
-
async transferFrom(from: `0x${string}`, to: `0x${string}`,
|
|
796
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
|
|
584
797
|
accessList?: import('viem').AccessList;
|
|
585
798
|
authorizationList?: import('viem').AuthorizationList;
|
|
586
799
|
chain?: import('viem').Chain | null;
|
|
@@ -592,7 +805,7 @@ export class SimpleUSDT_json {
|
|
|
592
805
|
nonce?: number;
|
|
593
806
|
value?: bigint;
|
|
594
807
|
}): Promise<boolean> {
|
|
595
|
-
return contract.simulate.transferFrom([from, to,
|
|
808
|
+
return contract.simulate.transferFrom([from, to, amount] as const, options) as Promise<boolean>;
|
|
596
809
|
}
|
|
597
810
|
};
|
|
598
811
|
}
|
|
@@ -617,10 +830,10 @@ export class SimpleUSDT_json {
|
|
|
617
830
|
* @param filter Optional filter for indexed parameters
|
|
618
831
|
* @returns Unwatch function to stop listening
|
|
619
832
|
*/
|
|
620
|
-
Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`;
|
|
833
|
+
Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; amount: bigint }) => void, filter?: { owner: `0x${string}`; spender: `0x${string}` }) => {
|
|
621
834
|
return this.publicClient.watchContractEvent({
|
|
622
835
|
address: this.contractAddress,
|
|
623
|
-
abi:
|
|
836
|
+
abi: UERC20_jsonAbi,
|
|
624
837
|
eventName: 'Approval',
|
|
625
838
|
args: filter,
|
|
626
839
|
onLogs: (logs: any[]) => {
|
|
@@ -636,10 +849,10 @@ export class SimpleUSDT_json {
|
|
|
636
849
|
* @param filter Optional filter for indexed parameters
|
|
637
850
|
* @returns Unwatch function to stop listening
|
|
638
851
|
*/
|
|
639
|
-
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`;
|
|
852
|
+
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; amount: bigint }) => void, filter?: { from: `0x${string}`; to: `0x${string}` }) => {
|
|
640
853
|
return this.publicClient.watchContractEvent({
|
|
641
854
|
address: this.contractAddress,
|
|
642
|
-
abi:
|
|
855
|
+
abi: UERC20_jsonAbi,
|
|
643
856
|
eventName: 'Transfer',
|
|
644
857
|
args: filter,
|
|
645
858
|
onLogs: (logs: any[]) => {
|