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