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