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