@gitmyabi/usdt 1.0.6 → 1.0.8
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/Tether_json.d.ts +865 -0
- package/contracts/Tether_json.js +905 -0
- package/contracts/Tether_json.ts +1148 -0
- package/contracts/index.d.ts +2 -2
- package/contracts/index.js +4 -4
- package/contracts/index.ts +2 -2
- package/package.json +3 -3
- package/contracts/TetherUSDT_json.d.ts +0 -486
- package/contracts/TetherUSDT_json.js +0 -552
- package/contracts/TetherUSDT_json.ts +0 -654
|
@@ -0,0 +1,1148 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tether_json ABI
|
|
6
|
+
*
|
|
7
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
8
|
+
*/
|
|
9
|
+
export const Tether_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": "tokenOwner",
|
|
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": "account",
|
|
47
|
+
"type": "address"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"indexed": false,
|
|
51
|
+
"internalType": "uint256",
|
|
52
|
+
"name": "amount",
|
|
53
|
+
"type": "uint256"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"name": "Freeze",
|
|
57
|
+
"type": "event"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"anonymous": false,
|
|
61
|
+
"inputs": [
|
|
62
|
+
{
|
|
63
|
+
"indexed": true,
|
|
64
|
+
"internalType": "address",
|
|
65
|
+
"name": "previousOwner",
|
|
66
|
+
"type": "address"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"indexed": true,
|
|
70
|
+
"internalType": "address",
|
|
71
|
+
"name": "newOwner",
|
|
72
|
+
"type": "address"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"name": "OwnershipTransferred",
|
|
76
|
+
"type": "event"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"anonymous": false,
|
|
80
|
+
"inputs": [
|
|
81
|
+
{
|
|
82
|
+
"indexed": true,
|
|
83
|
+
"internalType": "address",
|
|
84
|
+
"name": "from",
|
|
85
|
+
"type": "address"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"indexed": true,
|
|
89
|
+
"internalType": "address",
|
|
90
|
+
"name": "to",
|
|
91
|
+
"type": "address"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"indexed": false,
|
|
95
|
+
"internalType": "uint256",
|
|
96
|
+
"name": "value",
|
|
97
|
+
"type": "uint256"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"name": "Transfer",
|
|
101
|
+
"type": "event"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"anonymous": false,
|
|
105
|
+
"inputs": [
|
|
106
|
+
{
|
|
107
|
+
"indexed": true,
|
|
108
|
+
"internalType": "address",
|
|
109
|
+
"name": "account",
|
|
110
|
+
"type": "address"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"indexed": false,
|
|
114
|
+
"internalType": "uint256",
|
|
115
|
+
"name": "amount",
|
|
116
|
+
"type": "uint256"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"name": "Unfreeze",
|
|
120
|
+
"type": "event"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"inputs": [
|
|
124
|
+
{
|
|
125
|
+
"internalType": "address",
|
|
126
|
+
"name": "tokenOwner",
|
|
127
|
+
"type": "address"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"internalType": "address",
|
|
131
|
+
"name": "spender",
|
|
132
|
+
"type": "address"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"name": "allowance",
|
|
136
|
+
"outputs": [
|
|
137
|
+
{
|
|
138
|
+
"internalType": "uint256",
|
|
139
|
+
"name": "",
|
|
140
|
+
"type": "uint256"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"stateMutability": "view",
|
|
144
|
+
"type": "function"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"inputs": [
|
|
148
|
+
{
|
|
149
|
+
"internalType": "address",
|
|
150
|
+
"name": "spender",
|
|
151
|
+
"type": "address"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"internalType": "uint256",
|
|
155
|
+
"name": "amount",
|
|
156
|
+
"type": "uint256"
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"name": "approve",
|
|
160
|
+
"outputs": [
|
|
161
|
+
{
|
|
162
|
+
"internalType": "bool",
|
|
163
|
+
"name": "",
|
|
164
|
+
"type": "bool"
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"stateMutability": "nonpayable",
|
|
168
|
+
"type": "function"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"inputs": [
|
|
172
|
+
{
|
|
173
|
+
"internalType": "address",
|
|
174
|
+
"name": "account",
|
|
175
|
+
"type": "address"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"name": "availableBalanceOf",
|
|
179
|
+
"outputs": [
|
|
180
|
+
{
|
|
181
|
+
"internalType": "uint256",
|
|
182
|
+
"name": "",
|
|
183
|
+
"type": "uint256"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"stateMutability": "view",
|
|
187
|
+
"type": "function"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"inputs": [
|
|
191
|
+
{
|
|
192
|
+
"internalType": "address",
|
|
193
|
+
"name": "account",
|
|
194
|
+
"type": "address"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"name": "balanceOf",
|
|
198
|
+
"outputs": [
|
|
199
|
+
{
|
|
200
|
+
"internalType": "uint256",
|
|
201
|
+
"name": "",
|
|
202
|
+
"type": "uint256"
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
"stateMutability": "view",
|
|
206
|
+
"type": "function"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"inputs": [],
|
|
210
|
+
"name": "decimals",
|
|
211
|
+
"outputs": [
|
|
212
|
+
{
|
|
213
|
+
"internalType": "uint8",
|
|
214
|
+
"name": "",
|
|
215
|
+
"type": "uint8"
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
"stateMutability": "view",
|
|
219
|
+
"type": "function"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"inputs": [
|
|
223
|
+
{
|
|
224
|
+
"internalType": "address",
|
|
225
|
+
"name": "spender",
|
|
226
|
+
"type": "address"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"internalType": "uint256",
|
|
230
|
+
"name": "subtractedValue",
|
|
231
|
+
"type": "uint256"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"name": "decreaseAllowance",
|
|
235
|
+
"outputs": [
|
|
236
|
+
{
|
|
237
|
+
"internalType": "bool",
|
|
238
|
+
"name": "",
|
|
239
|
+
"type": "bool"
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
"stateMutability": "nonpayable",
|
|
243
|
+
"type": "function"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"inputs": [
|
|
247
|
+
{
|
|
248
|
+
"internalType": "address",
|
|
249
|
+
"name": "account",
|
|
250
|
+
"type": "address"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"internalType": "uint256",
|
|
254
|
+
"name": "amount",
|
|
255
|
+
"type": "uint256"
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
"name": "freezeBalance",
|
|
259
|
+
"outputs": [
|
|
260
|
+
{
|
|
261
|
+
"internalType": "bool",
|
|
262
|
+
"name": "",
|
|
263
|
+
"type": "bool"
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
"stateMutability": "nonpayable",
|
|
267
|
+
"type": "function"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"inputs": [
|
|
271
|
+
{
|
|
272
|
+
"internalType": "address",
|
|
273
|
+
"name": "account",
|
|
274
|
+
"type": "address"
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
"name": "frozenBalanceOf",
|
|
278
|
+
"outputs": [
|
|
279
|
+
{
|
|
280
|
+
"internalType": "uint256",
|
|
281
|
+
"name": "",
|
|
282
|
+
"type": "uint256"
|
|
283
|
+
}
|
|
284
|
+
],
|
|
285
|
+
"stateMutability": "view",
|
|
286
|
+
"type": "function"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"inputs": [
|
|
290
|
+
{
|
|
291
|
+
"internalType": "address",
|
|
292
|
+
"name": "spender",
|
|
293
|
+
"type": "address"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"internalType": "uint256",
|
|
297
|
+
"name": "addedValue",
|
|
298
|
+
"type": "uint256"
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"name": "increaseAllowance",
|
|
302
|
+
"outputs": [
|
|
303
|
+
{
|
|
304
|
+
"internalType": "bool",
|
|
305
|
+
"name": "",
|
|
306
|
+
"type": "bool"
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
"stateMutability": "nonpayable",
|
|
310
|
+
"type": "function"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"inputs": [],
|
|
314
|
+
"name": "name",
|
|
315
|
+
"outputs": [
|
|
316
|
+
{
|
|
317
|
+
"internalType": "string",
|
|
318
|
+
"name": "",
|
|
319
|
+
"type": "string"
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"stateMutability": "view",
|
|
323
|
+
"type": "function"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"inputs": [],
|
|
327
|
+
"name": "owner",
|
|
328
|
+
"outputs": [
|
|
329
|
+
{
|
|
330
|
+
"internalType": "address",
|
|
331
|
+
"name": "",
|
|
332
|
+
"type": "address"
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
"stateMutability": "view",
|
|
336
|
+
"type": "function"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"inputs": [],
|
|
340
|
+
"name": "symbol",
|
|
341
|
+
"outputs": [
|
|
342
|
+
{
|
|
343
|
+
"internalType": "string",
|
|
344
|
+
"name": "",
|
|
345
|
+
"type": "string"
|
|
346
|
+
}
|
|
347
|
+
],
|
|
348
|
+
"stateMutability": "view",
|
|
349
|
+
"type": "function"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"inputs": [],
|
|
353
|
+
"name": "totalSupply",
|
|
354
|
+
"outputs": [
|
|
355
|
+
{
|
|
356
|
+
"internalType": "uint256",
|
|
357
|
+
"name": "",
|
|
358
|
+
"type": "uint256"
|
|
359
|
+
}
|
|
360
|
+
],
|
|
361
|
+
"stateMutability": "view",
|
|
362
|
+
"type": "function"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"inputs": [
|
|
366
|
+
{
|
|
367
|
+
"internalType": "address",
|
|
368
|
+
"name": "to",
|
|
369
|
+
"type": "address"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"internalType": "uint256",
|
|
373
|
+
"name": "amount",
|
|
374
|
+
"type": "uint256"
|
|
375
|
+
}
|
|
376
|
+
],
|
|
377
|
+
"name": "transfer",
|
|
378
|
+
"outputs": [
|
|
379
|
+
{
|
|
380
|
+
"internalType": "bool",
|
|
381
|
+
"name": "",
|
|
382
|
+
"type": "bool"
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
"stateMutability": "nonpayable",
|
|
386
|
+
"type": "function"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"inputs": [
|
|
390
|
+
{
|
|
391
|
+
"internalType": "address",
|
|
392
|
+
"name": "from",
|
|
393
|
+
"type": "address"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"internalType": "address",
|
|
397
|
+
"name": "to",
|
|
398
|
+
"type": "address"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"internalType": "uint256",
|
|
402
|
+
"name": "amount",
|
|
403
|
+
"type": "uint256"
|
|
404
|
+
}
|
|
405
|
+
],
|
|
406
|
+
"name": "transferFrom",
|
|
407
|
+
"outputs": [
|
|
408
|
+
{
|
|
409
|
+
"internalType": "bool",
|
|
410
|
+
"name": "",
|
|
411
|
+
"type": "bool"
|
|
412
|
+
}
|
|
413
|
+
],
|
|
414
|
+
"stateMutability": "nonpayable",
|
|
415
|
+
"type": "function"
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"inputs": [
|
|
419
|
+
{
|
|
420
|
+
"internalType": "address",
|
|
421
|
+
"name": "newOwner",
|
|
422
|
+
"type": "address"
|
|
423
|
+
}
|
|
424
|
+
],
|
|
425
|
+
"name": "transferOwnership",
|
|
426
|
+
"outputs": [
|
|
427
|
+
{
|
|
428
|
+
"internalType": "bool",
|
|
429
|
+
"name": "",
|
|
430
|
+
"type": "bool"
|
|
431
|
+
}
|
|
432
|
+
],
|
|
433
|
+
"stateMutability": "nonpayable",
|
|
434
|
+
"type": "function"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"inputs": [
|
|
438
|
+
{
|
|
439
|
+
"internalType": "address",
|
|
440
|
+
"name": "to",
|
|
441
|
+
"type": "address"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"internalType": "uint256",
|
|
445
|
+
"name": "amount",
|
|
446
|
+
"type": "uint256"
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
"name": "transferWithFreeze",
|
|
450
|
+
"outputs": [
|
|
451
|
+
{
|
|
452
|
+
"internalType": "bool",
|
|
453
|
+
"name": "",
|
|
454
|
+
"type": "bool"
|
|
455
|
+
}
|
|
456
|
+
],
|
|
457
|
+
"stateMutability": "nonpayable",
|
|
458
|
+
"type": "function"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"inputs": [
|
|
462
|
+
{
|
|
463
|
+
"internalType": "address",
|
|
464
|
+
"name": "account",
|
|
465
|
+
"type": "address"
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"internalType": "uint256",
|
|
469
|
+
"name": "amount",
|
|
470
|
+
"type": "uint256"
|
|
471
|
+
}
|
|
472
|
+
],
|
|
473
|
+
"name": "unfreezeBalance",
|
|
474
|
+
"outputs": [
|
|
475
|
+
{
|
|
476
|
+
"internalType": "bool",
|
|
477
|
+
"name": "",
|
|
478
|
+
"type": "bool"
|
|
479
|
+
}
|
|
480
|
+
],
|
|
481
|
+
"stateMutability": "nonpayable",
|
|
482
|
+
"type": "function"
|
|
483
|
+
}
|
|
484
|
+
] as const satisfies Abi;
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Type-safe ABI for Tether_json
|
|
488
|
+
*/
|
|
489
|
+
export type Tether_jsonAbi = typeof Tether_jsonAbi;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Contract instance type for Tether_json
|
|
493
|
+
*/
|
|
494
|
+
// Use any for contract type to avoid complex viem type issues
|
|
495
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
496
|
+
export type Tether_jsonContract = any;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Tether_json Contract Class
|
|
500
|
+
*
|
|
501
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
502
|
+
*
|
|
503
|
+
* @example
|
|
504
|
+
* ```typescript
|
|
505
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
506
|
+
* import { mainnet } from 'viem/chains';
|
|
507
|
+
* import { Tether_json } from 'Tether_json';
|
|
508
|
+
*
|
|
509
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
510
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
511
|
+
*
|
|
512
|
+
* const contract = new Tether_json('0x...', { publicClient, walletClient });
|
|
513
|
+
*
|
|
514
|
+
* // Read functions
|
|
515
|
+
* const result = await contract.balanceOf('0x...');
|
|
516
|
+
*
|
|
517
|
+
* // Write functions
|
|
518
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
519
|
+
*
|
|
520
|
+
* // Simulate transactions (dry-run)
|
|
521
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
522
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
523
|
+
*
|
|
524
|
+
* // Watch events
|
|
525
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
526
|
+
* console.log('Transfer event:', event);
|
|
527
|
+
* });
|
|
528
|
+
* ```
|
|
529
|
+
*/
|
|
530
|
+
export class Tether_json {
|
|
531
|
+
private contract: Tether_jsonContract;
|
|
532
|
+
private contractAddress: Address;
|
|
533
|
+
private publicClient: PublicClient;
|
|
534
|
+
|
|
535
|
+
constructor(
|
|
536
|
+
address: Address,
|
|
537
|
+
clients: {
|
|
538
|
+
publicClient: PublicClient;
|
|
539
|
+
walletClient?: WalletClient;
|
|
540
|
+
}
|
|
541
|
+
) {
|
|
542
|
+
this.contractAddress = address;
|
|
543
|
+
this.publicClient = clients.publicClient;
|
|
544
|
+
this.contract = getContract({
|
|
545
|
+
address,
|
|
546
|
+
abi: Tether_jsonAbi,
|
|
547
|
+
client: {
|
|
548
|
+
public: clients.publicClient,
|
|
549
|
+
wallet: clients.walletClient,
|
|
550
|
+
},
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Get the contract address
|
|
556
|
+
*/
|
|
557
|
+
get address(): Address {
|
|
558
|
+
return this.contractAddress;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Get the underlying viem contract instance
|
|
563
|
+
*/
|
|
564
|
+
getContract(): Tether_jsonContract {
|
|
565
|
+
return this.contract;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* allowance
|
|
570
|
+
* view
|
|
571
|
+
*/
|
|
572
|
+
async allowance(tokenOwner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
|
|
573
|
+
return this.contract.read.allowance([tokenOwner, spender] as const) as Promise<bigint>;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* availableBalanceOf
|
|
578
|
+
* view
|
|
579
|
+
*/
|
|
580
|
+
async availableBalanceOf(account: `0x${string}`): Promise<bigint> {
|
|
581
|
+
return this.contract.read.availableBalanceOf([account] as const) as Promise<bigint>;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* balanceOf
|
|
586
|
+
* view
|
|
587
|
+
*/
|
|
588
|
+
async balanceOf(account: `0x${string}`): Promise<bigint> {
|
|
589
|
+
return this.contract.read.balanceOf([account] as const) as Promise<bigint>;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* decimals
|
|
594
|
+
* view
|
|
595
|
+
*/
|
|
596
|
+
async decimals(): Promise<bigint> {
|
|
597
|
+
return this.contract.read.decimals() as Promise<bigint>;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* frozenBalanceOf
|
|
602
|
+
* view
|
|
603
|
+
*/
|
|
604
|
+
async frozenBalanceOf(account: `0x${string}`): Promise<bigint> {
|
|
605
|
+
return this.contract.read.frozenBalanceOf([account] as const) as Promise<bigint>;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* name
|
|
610
|
+
* view
|
|
611
|
+
*/
|
|
612
|
+
async name(): Promise<string> {
|
|
613
|
+
return this.contract.read.name() as Promise<string>;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* owner
|
|
618
|
+
* view
|
|
619
|
+
*/
|
|
620
|
+
async owner(): Promise<`0x${string}`> {
|
|
621
|
+
return this.contract.read.owner() as Promise<`0x${string}`>;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* symbol
|
|
626
|
+
* view
|
|
627
|
+
*/
|
|
628
|
+
async symbol(): Promise<string> {
|
|
629
|
+
return this.contract.read.symbol() as Promise<string>;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* totalSupply
|
|
634
|
+
* view
|
|
635
|
+
*/
|
|
636
|
+
async totalSupply(): Promise<bigint> {
|
|
637
|
+
return this.contract.read.totalSupply() as Promise<bigint>;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* approve
|
|
642
|
+
* nonpayable
|
|
643
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
644
|
+
*/
|
|
645
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
646
|
+
accessList?: import('viem').AccessList;
|
|
647
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
648
|
+
chain?: import('viem').Chain | null;
|
|
649
|
+
dataSuffix?: `0x${string}`;
|
|
650
|
+
gas?: bigint;
|
|
651
|
+
gasPrice?: bigint;
|
|
652
|
+
maxFeePerGas?: bigint;
|
|
653
|
+
maxPriorityFeePerGas?: bigint;
|
|
654
|
+
nonce?: number;
|
|
655
|
+
value?: bigint;
|
|
656
|
+
}): Promise<`0x${string}`> {
|
|
657
|
+
if (!this.contract.write) {
|
|
658
|
+
throw new Error('Wallet client is required for write operations');
|
|
659
|
+
}
|
|
660
|
+
return this.contract.write.approve([spender, amount] as const, options) as Promise<`0x${string}`>;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* decreaseAllowance
|
|
665
|
+
* nonpayable
|
|
666
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
667
|
+
*/
|
|
668
|
+
async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
|
|
669
|
+
accessList?: import('viem').AccessList;
|
|
670
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
671
|
+
chain?: import('viem').Chain | null;
|
|
672
|
+
dataSuffix?: `0x${string}`;
|
|
673
|
+
gas?: bigint;
|
|
674
|
+
gasPrice?: bigint;
|
|
675
|
+
maxFeePerGas?: bigint;
|
|
676
|
+
maxPriorityFeePerGas?: bigint;
|
|
677
|
+
nonce?: number;
|
|
678
|
+
value?: bigint;
|
|
679
|
+
}): Promise<`0x${string}`> {
|
|
680
|
+
if (!this.contract.write) {
|
|
681
|
+
throw new Error('Wallet client is required for write operations');
|
|
682
|
+
}
|
|
683
|
+
return this.contract.write.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<`0x${string}`>;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* freezeBalance
|
|
688
|
+
* nonpayable
|
|
689
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
690
|
+
*/
|
|
691
|
+
async freezeBalance(account: `0x${string}`, amount: bigint, options?: {
|
|
692
|
+
accessList?: import('viem').AccessList;
|
|
693
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
694
|
+
chain?: import('viem').Chain | null;
|
|
695
|
+
dataSuffix?: `0x${string}`;
|
|
696
|
+
gas?: bigint;
|
|
697
|
+
gasPrice?: bigint;
|
|
698
|
+
maxFeePerGas?: bigint;
|
|
699
|
+
maxPriorityFeePerGas?: bigint;
|
|
700
|
+
nonce?: number;
|
|
701
|
+
value?: bigint;
|
|
702
|
+
}): Promise<`0x${string}`> {
|
|
703
|
+
if (!this.contract.write) {
|
|
704
|
+
throw new Error('Wallet client is required for write operations');
|
|
705
|
+
}
|
|
706
|
+
return this.contract.write.freezeBalance([account, amount] as const, options) as Promise<`0x${string}`>;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* increaseAllowance
|
|
711
|
+
* nonpayable
|
|
712
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
713
|
+
*/
|
|
714
|
+
async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
|
|
715
|
+
accessList?: import('viem').AccessList;
|
|
716
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
717
|
+
chain?: import('viem').Chain | null;
|
|
718
|
+
dataSuffix?: `0x${string}`;
|
|
719
|
+
gas?: bigint;
|
|
720
|
+
gasPrice?: bigint;
|
|
721
|
+
maxFeePerGas?: bigint;
|
|
722
|
+
maxPriorityFeePerGas?: bigint;
|
|
723
|
+
nonce?: number;
|
|
724
|
+
value?: bigint;
|
|
725
|
+
}): Promise<`0x${string}`> {
|
|
726
|
+
if (!this.contract.write) {
|
|
727
|
+
throw new Error('Wallet client is required for write operations');
|
|
728
|
+
}
|
|
729
|
+
return this.contract.write.increaseAllowance([spender, addedValue] as const, options) as Promise<`0x${string}`>;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* transfer
|
|
734
|
+
* nonpayable
|
|
735
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
736
|
+
*/
|
|
737
|
+
async transfer(to: `0x${string}`, amount: bigint, options?: {
|
|
738
|
+
accessList?: import('viem').AccessList;
|
|
739
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
740
|
+
chain?: import('viem').Chain | null;
|
|
741
|
+
dataSuffix?: `0x${string}`;
|
|
742
|
+
gas?: bigint;
|
|
743
|
+
gasPrice?: bigint;
|
|
744
|
+
maxFeePerGas?: bigint;
|
|
745
|
+
maxPriorityFeePerGas?: bigint;
|
|
746
|
+
nonce?: number;
|
|
747
|
+
value?: bigint;
|
|
748
|
+
}): Promise<`0x${string}`> {
|
|
749
|
+
if (!this.contract.write) {
|
|
750
|
+
throw new Error('Wallet client is required for write operations');
|
|
751
|
+
}
|
|
752
|
+
return this.contract.write.transfer([to, amount] as const, options) as Promise<`0x${string}`>;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* transferFrom
|
|
757
|
+
* nonpayable
|
|
758
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
759
|
+
*/
|
|
760
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
|
|
761
|
+
accessList?: import('viem').AccessList;
|
|
762
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
763
|
+
chain?: import('viem').Chain | null;
|
|
764
|
+
dataSuffix?: `0x${string}`;
|
|
765
|
+
gas?: bigint;
|
|
766
|
+
gasPrice?: bigint;
|
|
767
|
+
maxFeePerGas?: bigint;
|
|
768
|
+
maxPriorityFeePerGas?: bigint;
|
|
769
|
+
nonce?: number;
|
|
770
|
+
value?: bigint;
|
|
771
|
+
}): Promise<`0x${string}`> {
|
|
772
|
+
if (!this.contract.write) {
|
|
773
|
+
throw new Error('Wallet client is required for write operations');
|
|
774
|
+
}
|
|
775
|
+
return this.contract.write.transferFrom([from, to, amount] as const, options) as Promise<`0x${string}`>;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* transferOwnership
|
|
780
|
+
* nonpayable
|
|
781
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
782
|
+
*/
|
|
783
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
784
|
+
accessList?: import('viem').AccessList;
|
|
785
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
786
|
+
chain?: import('viem').Chain | null;
|
|
787
|
+
dataSuffix?: `0x${string}`;
|
|
788
|
+
gas?: bigint;
|
|
789
|
+
gasPrice?: bigint;
|
|
790
|
+
maxFeePerGas?: bigint;
|
|
791
|
+
maxPriorityFeePerGas?: bigint;
|
|
792
|
+
nonce?: number;
|
|
793
|
+
value?: bigint;
|
|
794
|
+
}): Promise<`0x${string}`> {
|
|
795
|
+
if (!this.contract.write) {
|
|
796
|
+
throw new Error('Wallet client is required for write operations');
|
|
797
|
+
}
|
|
798
|
+
return this.contract.write.transferOwnership([newOwner] as const, options) as Promise<`0x${string}`>;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* transferWithFreeze
|
|
803
|
+
* nonpayable
|
|
804
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
805
|
+
*/
|
|
806
|
+
async transferWithFreeze(to: `0x${string}`, amount: bigint, options?: {
|
|
807
|
+
accessList?: import('viem').AccessList;
|
|
808
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
809
|
+
chain?: import('viem').Chain | null;
|
|
810
|
+
dataSuffix?: `0x${string}`;
|
|
811
|
+
gas?: bigint;
|
|
812
|
+
gasPrice?: bigint;
|
|
813
|
+
maxFeePerGas?: bigint;
|
|
814
|
+
maxPriorityFeePerGas?: bigint;
|
|
815
|
+
nonce?: number;
|
|
816
|
+
value?: bigint;
|
|
817
|
+
}): Promise<`0x${string}`> {
|
|
818
|
+
if (!this.contract.write) {
|
|
819
|
+
throw new Error('Wallet client is required for write operations');
|
|
820
|
+
}
|
|
821
|
+
return this.contract.write.transferWithFreeze([to, amount] as const, options) as Promise<`0x${string}`>;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* unfreezeBalance
|
|
826
|
+
* nonpayable
|
|
827
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
828
|
+
*/
|
|
829
|
+
async unfreezeBalance(account: `0x${string}`, amount: bigint, options?: {
|
|
830
|
+
accessList?: import('viem').AccessList;
|
|
831
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
832
|
+
chain?: import('viem').Chain | null;
|
|
833
|
+
dataSuffix?: `0x${string}`;
|
|
834
|
+
gas?: bigint;
|
|
835
|
+
gasPrice?: bigint;
|
|
836
|
+
maxFeePerGas?: bigint;
|
|
837
|
+
maxPriorityFeePerGas?: bigint;
|
|
838
|
+
nonce?: number;
|
|
839
|
+
value?: bigint;
|
|
840
|
+
}): Promise<`0x${string}`> {
|
|
841
|
+
if (!this.contract.write) {
|
|
842
|
+
throw new Error('Wallet client is required for write operations');
|
|
843
|
+
}
|
|
844
|
+
return this.contract.write.unfreezeBalance([account, amount] as const, options) as Promise<`0x${string}`>;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
851
|
+
*
|
|
852
|
+
* @example
|
|
853
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
854
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
855
|
+
* console.log('Would succeed:', result.result);
|
|
856
|
+
*/
|
|
857
|
+
get simulate() {
|
|
858
|
+
const contract = this.contract;
|
|
859
|
+
if (!contract.simulate) {
|
|
860
|
+
throw new Error('Public client is required for simulation');
|
|
861
|
+
}
|
|
862
|
+
return {
|
|
863
|
+
/**
|
|
864
|
+
* Simulate approve
|
|
865
|
+
* Returns gas estimate and result without sending transaction
|
|
866
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
867
|
+
*/
|
|
868
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
869
|
+
accessList?: import('viem').AccessList;
|
|
870
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
871
|
+
chain?: import('viem').Chain | null;
|
|
872
|
+
dataSuffix?: `0x${string}`;
|
|
873
|
+
gas?: bigint;
|
|
874
|
+
gasPrice?: bigint;
|
|
875
|
+
maxFeePerGas?: bigint;
|
|
876
|
+
maxPriorityFeePerGas?: bigint;
|
|
877
|
+
nonce?: number;
|
|
878
|
+
value?: bigint;
|
|
879
|
+
}): Promise<boolean> {
|
|
880
|
+
return contract.simulate.approve([spender, amount] as const, options) as Promise<boolean>;
|
|
881
|
+
},
|
|
882
|
+
/**
|
|
883
|
+
* Simulate decreaseAllowance
|
|
884
|
+
* Returns gas estimate and result without sending transaction
|
|
885
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
886
|
+
*/
|
|
887
|
+
async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
|
|
888
|
+
accessList?: import('viem').AccessList;
|
|
889
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
890
|
+
chain?: import('viem').Chain | null;
|
|
891
|
+
dataSuffix?: `0x${string}`;
|
|
892
|
+
gas?: bigint;
|
|
893
|
+
gasPrice?: bigint;
|
|
894
|
+
maxFeePerGas?: bigint;
|
|
895
|
+
maxPriorityFeePerGas?: bigint;
|
|
896
|
+
nonce?: number;
|
|
897
|
+
value?: bigint;
|
|
898
|
+
}): Promise<boolean> {
|
|
899
|
+
return contract.simulate.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<boolean>;
|
|
900
|
+
},
|
|
901
|
+
/**
|
|
902
|
+
* Simulate freezeBalance
|
|
903
|
+
* Returns gas estimate and result without sending transaction
|
|
904
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
905
|
+
*/
|
|
906
|
+
async freezeBalance(account: `0x${string}`, amount: bigint, options?: {
|
|
907
|
+
accessList?: import('viem').AccessList;
|
|
908
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
909
|
+
chain?: import('viem').Chain | null;
|
|
910
|
+
dataSuffix?: `0x${string}`;
|
|
911
|
+
gas?: bigint;
|
|
912
|
+
gasPrice?: bigint;
|
|
913
|
+
maxFeePerGas?: bigint;
|
|
914
|
+
maxPriorityFeePerGas?: bigint;
|
|
915
|
+
nonce?: number;
|
|
916
|
+
value?: bigint;
|
|
917
|
+
}): Promise<boolean> {
|
|
918
|
+
return contract.simulate.freezeBalance([account, amount] as const, options) as Promise<boolean>;
|
|
919
|
+
},
|
|
920
|
+
/**
|
|
921
|
+
* Simulate increaseAllowance
|
|
922
|
+
* Returns gas estimate and result without sending transaction
|
|
923
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
924
|
+
*/
|
|
925
|
+
async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
|
|
926
|
+
accessList?: import('viem').AccessList;
|
|
927
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
928
|
+
chain?: import('viem').Chain | null;
|
|
929
|
+
dataSuffix?: `0x${string}`;
|
|
930
|
+
gas?: bigint;
|
|
931
|
+
gasPrice?: bigint;
|
|
932
|
+
maxFeePerGas?: bigint;
|
|
933
|
+
maxPriorityFeePerGas?: bigint;
|
|
934
|
+
nonce?: number;
|
|
935
|
+
value?: bigint;
|
|
936
|
+
}): Promise<boolean> {
|
|
937
|
+
return contract.simulate.increaseAllowance([spender, addedValue] as const, options) as Promise<boolean>;
|
|
938
|
+
},
|
|
939
|
+
/**
|
|
940
|
+
* Simulate transfer
|
|
941
|
+
* Returns gas estimate and result without sending transaction
|
|
942
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
943
|
+
*/
|
|
944
|
+
async transfer(to: `0x${string}`, amount: bigint, options?: {
|
|
945
|
+
accessList?: import('viem').AccessList;
|
|
946
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
947
|
+
chain?: import('viem').Chain | null;
|
|
948
|
+
dataSuffix?: `0x${string}`;
|
|
949
|
+
gas?: bigint;
|
|
950
|
+
gasPrice?: bigint;
|
|
951
|
+
maxFeePerGas?: bigint;
|
|
952
|
+
maxPriorityFeePerGas?: bigint;
|
|
953
|
+
nonce?: number;
|
|
954
|
+
value?: bigint;
|
|
955
|
+
}): Promise<boolean> {
|
|
956
|
+
return contract.simulate.transfer([to, amount] as const, options) as Promise<boolean>;
|
|
957
|
+
},
|
|
958
|
+
/**
|
|
959
|
+
* Simulate transferFrom
|
|
960
|
+
* Returns gas estimate and result without sending transaction
|
|
961
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
962
|
+
*/
|
|
963
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
|
|
964
|
+
accessList?: import('viem').AccessList;
|
|
965
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
966
|
+
chain?: import('viem').Chain | null;
|
|
967
|
+
dataSuffix?: `0x${string}`;
|
|
968
|
+
gas?: bigint;
|
|
969
|
+
gasPrice?: bigint;
|
|
970
|
+
maxFeePerGas?: bigint;
|
|
971
|
+
maxPriorityFeePerGas?: bigint;
|
|
972
|
+
nonce?: number;
|
|
973
|
+
value?: bigint;
|
|
974
|
+
}): Promise<boolean> {
|
|
975
|
+
return contract.simulate.transferFrom([from, to, amount] as const, options) as Promise<boolean>;
|
|
976
|
+
},
|
|
977
|
+
/**
|
|
978
|
+
* Simulate transferOwnership
|
|
979
|
+
* Returns gas estimate and result without sending transaction
|
|
980
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
981
|
+
*/
|
|
982
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
983
|
+
accessList?: import('viem').AccessList;
|
|
984
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
985
|
+
chain?: import('viem').Chain | null;
|
|
986
|
+
dataSuffix?: `0x${string}`;
|
|
987
|
+
gas?: bigint;
|
|
988
|
+
gasPrice?: bigint;
|
|
989
|
+
maxFeePerGas?: bigint;
|
|
990
|
+
maxPriorityFeePerGas?: bigint;
|
|
991
|
+
nonce?: number;
|
|
992
|
+
value?: bigint;
|
|
993
|
+
}): Promise<boolean> {
|
|
994
|
+
return contract.simulate.transferOwnership([newOwner] as const, options) as Promise<boolean>;
|
|
995
|
+
},
|
|
996
|
+
/**
|
|
997
|
+
* Simulate transferWithFreeze
|
|
998
|
+
* Returns gas estimate and result without sending transaction
|
|
999
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1000
|
+
*/
|
|
1001
|
+
async transferWithFreeze(to: `0x${string}`, amount: bigint, options?: {
|
|
1002
|
+
accessList?: import('viem').AccessList;
|
|
1003
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1004
|
+
chain?: import('viem').Chain | null;
|
|
1005
|
+
dataSuffix?: `0x${string}`;
|
|
1006
|
+
gas?: bigint;
|
|
1007
|
+
gasPrice?: bigint;
|
|
1008
|
+
maxFeePerGas?: bigint;
|
|
1009
|
+
maxPriorityFeePerGas?: bigint;
|
|
1010
|
+
nonce?: number;
|
|
1011
|
+
value?: bigint;
|
|
1012
|
+
}): Promise<boolean> {
|
|
1013
|
+
return contract.simulate.transferWithFreeze([to, amount] as const, options) as Promise<boolean>;
|
|
1014
|
+
},
|
|
1015
|
+
/**
|
|
1016
|
+
* Simulate unfreezeBalance
|
|
1017
|
+
* Returns gas estimate and result without sending transaction
|
|
1018
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1019
|
+
*/
|
|
1020
|
+
async unfreezeBalance(account: `0x${string}`, amount: bigint, options?: {
|
|
1021
|
+
accessList?: import('viem').AccessList;
|
|
1022
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1023
|
+
chain?: import('viem').Chain | null;
|
|
1024
|
+
dataSuffix?: `0x${string}`;
|
|
1025
|
+
gas?: bigint;
|
|
1026
|
+
gasPrice?: bigint;
|
|
1027
|
+
maxFeePerGas?: bigint;
|
|
1028
|
+
maxPriorityFeePerGas?: bigint;
|
|
1029
|
+
nonce?: number;
|
|
1030
|
+
value?: bigint;
|
|
1031
|
+
}): Promise<boolean> {
|
|
1032
|
+
return contract.simulate.unfreezeBalance([account, amount] as const, options) as Promise<boolean>;
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* Watch contract events
|
|
1039
|
+
*
|
|
1040
|
+
* @example
|
|
1041
|
+
* // Watch all Transfer events
|
|
1042
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1043
|
+
* console.log('Transfer:', event);
|
|
1044
|
+
* });
|
|
1045
|
+
*
|
|
1046
|
+
* // Stop watching
|
|
1047
|
+
* unwatch();
|
|
1048
|
+
*/
|
|
1049
|
+
get watch() {
|
|
1050
|
+
return {
|
|
1051
|
+
/**
|
|
1052
|
+
* Watch Approval events
|
|
1053
|
+
* @param callback Function to call when event is emitted
|
|
1054
|
+
* @param filter Optional filter for indexed parameters
|
|
1055
|
+
* @returns Unwatch function to stop listening
|
|
1056
|
+
*/
|
|
1057
|
+
Approval: (callback: (event: { tokenOwner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { tokenOwner: `0x${string}`; spender: `0x${string}` }) => {
|
|
1058
|
+
return this.publicClient.watchContractEvent({
|
|
1059
|
+
address: this.contractAddress,
|
|
1060
|
+
abi: Tether_jsonAbi,
|
|
1061
|
+
eventName: 'Approval',
|
|
1062
|
+
args: filter,
|
|
1063
|
+
onLogs: (logs: any[]) => {
|
|
1064
|
+
logs.forEach((log: any) => {
|
|
1065
|
+
callback(log.args as any);
|
|
1066
|
+
});
|
|
1067
|
+
},
|
|
1068
|
+
}) as () => void;
|
|
1069
|
+
},
|
|
1070
|
+
/**
|
|
1071
|
+
* Watch Freeze events
|
|
1072
|
+
* @param callback Function to call when event is emitted
|
|
1073
|
+
* @param filter Optional filter for indexed parameters
|
|
1074
|
+
* @returns Unwatch function to stop listening
|
|
1075
|
+
*/
|
|
1076
|
+
Freeze: (callback: (event: { account: `0x${string}`; amount: bigint }) => void, filter?: { account: `0x${string}` }) => {
|
|
1077
|
+
return this.publicClient.watchContractEvent({
|
|
1078
|
+
address: this.contractAddress,
|
|
1079
|
+
abi: Tether_jsonAbi,
|
|
1080
|
+
eventName: 'Freeze',
|
|
1081
|
+
args: filter,
|
|
1082
|
+
onLogs: (logs: any[]) => {
|
|
1083
|
+
logs.forEach((log: any) => {
|
|
1084
|
+
callback(log.args as any);
|
|
1085
|
+
});
|
|
1086
|
+
},
|
|
1087
|
+
}) as () => void;
|
|
1088
|
+
},
|
|
1089
|
+
/**
|
|
1090
|
+
* Watch OwnershipTransferred events
|
|
1091
|
+
* @param callback Function to call when event is emitted
|
|
1092
|
+
* @param filter Optional filter for indexed parameters
|
|
1093
|
+
* @returns Unwatch function to stop listening
|
|
1094
|
+
*/
|
|
1095
|
+
OwnershipTransferred: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void, filter?: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => {
|
|
1096
|
+
return this.publicClient.watchContractEvent({
|
|
1097
|
+
address: this.contractAddress,
|
|
1098
|
+
abi: Tether_jsonAbi,
|
|
1099
|
+
eventName: 'OwnershipTransferred',
|
|
1100
|
+
args: filter,
|
|
1101
|
+
onLogs: (logs: any[]) => {
|
|
1102
|
+
logs.forEach((log: any) => {
|
|
1103
|
+
callback(log.args as any);
|
|
1104
|
+
});
|
|
1105
|
+
},
|
|
1106
|
+
}) as () => void;
|
|
1107
|
+
},
|
|
1108
|
+
/**
|
|
1109
|
+
* Watch Transfer events
|
|
1110
|
+
* @param callback Function to call when event is emitted
|
|
1111
|
+
* @param filter Optional filter for indexed parameters
|
|
1112
|
+
* @returns Unwatch function to stop listening
|
|
1113
|
+
*/
|
|
1114
|
+
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from: `0x${string}`; to: `0x${string}` }) => {
|
|
1115
|
+
return this.publicClient.watchContractEvent({
|
|
1116
|
+
address: this.contractAddress,
|
|
1117
|
+
abi: Tether_jsonAbi,
|
|
1118
|
+
eventName: 'Transfer',
|
|
1119
|
+
args: filter,
|
|
1120
|
+
onLogs: (logs: any[]) => {
|
|
1121
|
+
logs.forEach((log: any) => {
|
|
1122
|
+
callback(log.args as any);
|
|
1123
|
+
});
|
|
1124
|
+
},
|
|
1125
|
+
}) as () => void;
|
|
1126
|
+
},
|
|
1127
|
+
/**
|
|
1128
|
+
* Watch Unfreeze events
|
|
1129
|
+
* @param callback Function to call when event is emitted
|
|
1130
|
+
* @param filter Optional filter for indexed parameters
|
|
1131
|
+
* @returns Unwatch function to stop listening
|
|
1132
|
+
*/
|
|
1133
|
+
Unfreeze: (callback: (event: { account: `0x${string}`; amount: bigint }) => void, filter?: { account: `0x${string}` }) => {
|
|
1134
|
+
return this.publicClient.watchContractEvent({
|
|
1135
|
+
address: this.contractAddress,
|
|
1136
|
+
abi: Tether_jsonAbi,
|
|
1137
|
+
eventName: 'Unfreeze',
|
|
1138
|
+
args: filter,
|
|
1139
|
+
onLogs: (logs: any[]) => {
|
|
1140
|
+
logs.forEach((log: any) => {
|
|
1141
|
+
callback(log.args as any);
|
|
1142
|
+
});
|
|
1143
|
+
},
|
|
1144
|
+
}) as () => void;
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
}
|