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