@@ -34,7 +34,7 @@ import {
34
34
TransferResult ,
35
35
Perm ,
36
36
} from '../../../types' ;
37
- import { numberToBigNumber , valueToWei } from '../../../utils/convert' ;
37
+ import { numberToBigNumber , valueToWei , dateToBigNumber } from '../../../utils/convert' ;
38
38
39
39
interface AddScheduleSubscribeAsyncParams extends SubscribeAsyncParams {
40
40
eventName : VestingEscrowWalletEvents . AddSchedule ;
@@ -178,6 +178,119 @@ interface GetVestingEscrowWalletLogsAsyncParams extends GetLogs {
178
178
( params : GetUnpauseLogsAsyncParams ) : Promise < LogWithDecodedArgs < VestingEscrowWalletUnpauseEventArgs > [ ] > ;
179
179
}
180
180
181
+ interface SchedulesParams {
182
+ beneficiary : string ;
183
+ index : number ;
184
+ }
185
+
186
+ interface TemplateNamesParams {
187
+ index : number ;
188
+ }
189
+
190
+ interface BeneficiariesParams {
191
+ index : number ;
192
+ }
193
+
194
+ interface ChangeTreasuryWalletParams extends TxParams {
195
+ newTreasuryWallet : string ;
196
+ }
197
+
198
+ interface DepositTokensParams extends TxParams {
199
+ numberOfTokens : number ;
200
+ }
201
+
202
+ interface SendToTreasuryParams extends TxParams {
203
+ amount : number ;
204
+ }
205
+
206
+ interface PushAvailableTokensParams extends TxParams {
207
+ beneficiary : string ;
208
+ }
209
+
210
+ interface AddTemplateParams extends TxParams {
211
+ name : string ;
212
+ numberOfTokens : number ;
213
+ duration : number ;
214
+ frequency : number ;
215
+ }
216
+
217
+ interface RemoveTemplateParams extends TxParams {
218
+ name : string ;
219
+ }
220
+
221
+ interface AddScheduleParams extends TxParams {
222
+ beneficiary : string ;
223
+ templateName : string ;
224
+ numberOfTokens : number ;
225
+ duration : number ;
226
+ frequency : number ;
227
+ startTime ?: Date ;
228
+ }
229
+
230
+ interface AddScheduleFromTemplateParams extends TxParams {
231
+ beneficiary : string ;
232
+ templateName : string ;
233
+ startTime ?: Date ;
234
+ }
235
+
236
+ interface ModifyScheduleParams extends TxParams {
237
+ beneficiary : string ;
238
+ templateName : string ;
239
+ startTime ?: Date ;
240
+ }
241
+
242
+ interface RevokeScheduleParams extends TxParams {
243
+ beneficiary : string ;
244
+ templateName : string ;
245
+ }
246
+
247
+ interface RevokeAllSchedulesParams extends TxParams {
248
+ beneficiary : string ;
249
+ }
250
+
251
+ interface GetScheduleParams {
252
+ beneficiary : string ;
253
+ templateName : string ;
254
+ }
255
+
256
+ interface GetTemplateNamesParams {
257
+ beneficiary : string ;
258
+ }
259
+
260
+ interface GetScheduleCountParams {
261
+ beneficiary : string ;
262
+ }
263
+
264
+ interface PushAvailableTokensMultiParams extends TxParams {
265
+ fromIndex : number ;
266
+ toIndex : number ;
267
+ }
268
+
269
+ interface AddScheduleMultiParams extends TxParams {
270
+ beneficiaries : string [ ] ;
271
+ templateNames : string [ ] ;
272
+ numberOfTokens : number [ ] ;
273
+ durations : number [ ] ;
274
+ frequencies : number [ ] ;
275
+ startTimes : Date [ ] ;
276
+ }
277
+
278
+ interface AddScheduleFromTemplateMultiParams extends TxParams {
279
+ beneficiaries : string [ ] ;
280
+ templateNames : string [ ] ;
281
+ startTimes : Date [ ] ;
282
+ }
283
+
284
+ interface RevokeSchedulesMultiParams extends TxParams {
285
+ beneficiaries : string [ ] ;
286
+ }
287
+
288
+ interface ModifyScheduleMultiParams extends TxParams {
289
+ beneficiaries : string [ ] ;
290
+ templateNames : string [ ] ;
291
+ startTimes : Date [ ] ;
292
+ }
293
+
181
294
/**
182
295
* This class includes the functionality related to interacting with the Vesting Escrow Wallet contract.
183
296
*/
@@ -225,39 +338,76 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
225
338
return ( await this . contract ) . unassignedTokens . callAsync ( ) ;
226
339
} ;
227
340
228
- public schedules = async ( ) => {
229
- return ( await this . contract ) . schedules . callAsync ( ) ;
341
+ public schedules = async ( params : SchedulesParams ) => {
342
+ return ( await this . contract ) . schedules . callAsync ( params . beneficiary , numberToBigNumber ( params . index ) ) ;
230
343
} ;
231
344
232
- public templateNames = async ( ) => {
233
- return ( await this . contract ) . templateNames . callAsync ( ) ;
345
+ public templateNames = async ( params : TemplateNamesParams ) => {
346
+ return ( await this . contract ) . templateNames . callAsync ( numberToBigNumber ( params . index ) ) ;
234
347
} ;
235
348
236
- public beneficiaries = async ( ) => {
237
- return ( await this . contract ) . beneficiaries . callAsync ( ) ;
349
+ public beneficiaries = async ( params : BeneficiariesParams ) => {
350
+ return ( await this . contract ) . beneficiaries . callAsync ( numberToBigNumber ( params . index ) ) ;
238
351
} ;
239
352
240
353
public getDataStore = async ( ) => {
241
354
return ( await this . contract ) . getDataStore . callAsync ( ) ;
242
355
} ;
243
356
244
- public changeTreasuryWallet = async ( ) => { } ;
357
+ public changeTreasuryWallet = async ( params : ChangeTreasuryWalletParams ) => {
358
+ return ( await this . contract ) . changeTreasuryWallet . sendTransactionAsync (
359
+ params . newTreasuryWallet ,
360
+ params . txData ,
361
+ params . safetyFactor ,
362
+ ) ;
363
+ } ;
245
364
246
- public depositTokens = async ( ) => { } ;
365
+ public depositTokens = async ( params : DepositTokensParams ) => {
366
+ return ( await this . contract ) . depositTokens . sendTransactionAsync (
367
+ numberToBigNumber ( params . numberOfTokens ) ,
368
+ params . txData ,
369
+ params . safetyFactor ,
370
+ ) ;
371
+ } ;
247
372
248
- public sendToTreasury = async ( ) => { } ;
373
+ public sendToTreasury = async ( params : SendToTreasuryParams ) => {
374
+ return ( await this . contract ) . sendToTreasury . sendTransactionAsync (
375
+ numberToBigNumber ( params . amount ) ,
376
+ params . txData ,
377
+ params . safetyFactor ,
378
+ ) ;
379
+ } ;
249
380
250
381
public getTreasuryWallet = async ( ) => {
251
382
return ( await this . contract ) . getTreasuryWallet . callAsync ( ) ;
252
383
} ;
253
384
254
- public pushAvailableTokens = async ( ) => { } ;
385
+ public pushAvailableTokens = async ( params : PushAvailableTokensParams ) => {
386
+ return ( await this . contract ) . pushAvailableTokens . sendTransactionAsync (
387
+ params . beneficiary ,
388
+ params . txData ,
389
+ params . safetyFactor ,
390
+ ) ;
391
+ } ;
255
392
256
- public pullAvailableTokens = async ( ) => { } ;
393
+ public pullAvailableTokens = async ( params : TxParams ) => {
394
+ return ( await this . contract ) . pullAvailableTokens . sendTransactionAsync ( params . txData , params . safetyFactor ) ;
395
+ } ;
257
396
258
- public addTemplate = async ( ) => { } ;
397
+ public addTemplate = async ( params : AddTemplateParams ) => {
398
+ return ( await this . contract ) . addTemplate . sendTransactionAsync (
399
+ params . name ,
400
+ numberToBigNumber ( params . numberOfTokens ) ,
401
+ numberToBigNumber ( params . duration ) ,
402
+ numberToBigNumber ( params . frequency ) ,
403
+ params . txData ,
404
+ params . safetyFactor ,
405
+ ) ;
406
+ } ;
259
407
260
- public removeTemplate = async ( ) => { } ;
408
+ public removeTemplate = async ( params : RemoveTemplateParams ) => {
409
+ return ( await this . contract ) . removeTemplate . sendTransactionAsync ( params . name , params . txData , params . safetyFactor ) ;
410
+ } ;
261
411
262
412
public getTemplateCount = async ( ) => {
263
413
return ( await this . contract ) . getTreasuryWallet . callAsync ( ) ;
@@ -267,37 +417,142 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
267
417
return ( await this . contract ) . getTreasuryWallet . callAsync ( ) ;
268
418
} ;
269
419
270
- public addSchedule = async ( ) => { } ;
420
+ public addSchedule = async ( params : AddScheduleParams ) => {
421
+ let startTime = new BigNumber ( 0 ) ;
422
+ if ( params . startTime ) {
423
+ startTime = dateToBigNumber ( params . startTime ) ;
424
+ }
425
+
426
+ return ( await this . contract ) . addSchedule . sendTransactionAsync (
427
+ params . beneficiary ,
428
+ params . templateName ,
429
+ numberToBigNumber ( params . numberOfTokens ) ,
430
+ numberToBigNumber ( params . duration ) ,
431
+ numberToBigNumber ( params . frequency ) ,
432
+ startTime ,
433
+ params . txData ,
434
+ params . safetyFactor ,
435
+ ) ;
436
+ } ;
271
437
272
- public addScheduleFromTemplate = async ( ) => { } ;
438
+ public addScheduleFromTemplate = async ( params : AddScheduleFromTemplateParams ) => {
439
+ let startTime = new BigNumber ( 0 ) ;
440
+ if ( params . startTime ) {
441
+ startTime = dateToBigNumber ( params . startTime ) ;
442
+ }
443
+ return ( await this . contract ) . addScheduleFromTemplate . sendTransactionAsync (
444
+ params . beneficiary ,
445
+ params . templateName ,
446
+ startTime ,
447
+ params . txData ,
448
+ params . safetyFactor ,
449
+ ) ;
450
+ } ;
273
451
274
- public modifySchedule = async ( ) => { } ;
452
+ public modifySchedule = async ( params : ModifyScheduleParams ) => {
453
+ let startTime = new BigNumber ( 0 ) ;
454
+ if ( params . startTime ) {
455
+ startTime = dateToBigNumber ( params . startTime ) ;
456
+ }
457
+ return ( await this . contract ) . modifySchedule . sendTransactionAsync (
458
+ params . beneficiary ,
459
+ params . templateName ,
460
+ startTime ,
461
+ params . txData ,
462
+ params . safetyFactor ,
463
+ ) ;
464
+ } ;
275
465
276
- public revokeSchedule = async ( ) => { } ;
466
+ public revokeSchedule = async ( params : RevokeScheduleParams ) => {
467
+ return ( await this . contract ) . revokeSchedule . sendTransactionAsync (
468
+ params . beneficiary ,
469
+ params . templateName ,
470
+ params . txData ,
471
+ params . safetyFactor ,
472
+ ) ;
473
+ } ;
277
474
278
- public revokeAllSchedules = async ( ) => { } ;
475
+ public revokeAllSchedules = async ( params : RevokeAllSchedulesParams ) => {
476
+ return ( await this . contract ) . revokeAllSchedules . sendTransactionAsync (
477
+ params . beneficiary ,
478
+ params . txData ,
479
+ params . safetyFactor ,
480
+ ) ;
481
+ } ;
279
482
280
- public getSchedule = async ( ) => {
281
- return ( await this . contract ) . getSchedule . callAsync ( ) ;
483
+ public getSchedule = async ( params : GetScheduleParams ) => {
484
+ return ( await this . contract ) . getSchedule . callAsync ( params . beneficiary , params . templateName ) ;
282
485
} ;
283
486
284
- public getTemplateNames = async ( ) => {
285
- return ( await this . contract ) . getTemplateNames . callAsync ( ) ;
487
+ public getTemplateNames = async ( params : GetTemplateNamesParams ) => {
488
+ return ( await this . contract ) . getTemplateNames . callAsync ( params . beneficiary ) ;
286
489
} ;
287
490
288
- public getScheduleCount = async ( ) => {
289
- return ( await this . contract ) . getScheduleCount . callAsync ( ) ;
491
+ public getScheduleCount = async ( params : GetScheduleCountParams ) => {
492
+ return ( await this . contract ) . getScheduleCount . callAsync ( params . beneficiary ) ;
290
493
} ;
291
494
292
- public pushAvailableTokensMulti = async ( ) => { } ;
495
+ public pushAvailableTokensMulti = async ( params : PushAvailableTokensMultiParams ) => {
496
+ return ( await this . contract ) . pushAvailableTokensMulti . sendTransactionAsync (
497
+ numberToBigNumber ( params . fromIndex ) ,
498
+ numberToBigNumber ( params . toIndex ) ,
499
+ params . txData ,
500
+ params . safetyFactor ,
501
+ ) ;
502
+ } ;
293
503
294
- public addScheduleMulti = async ( ) => { } ;
504
+ public addScheduleMulti = async ( params : AddScheduleMultiParams ) => {
505
+ return ( await this . contract ) . addScheduleMulti . sendTransactionAsync (
506
+ params . beneficiaries ,
507
+ params . templateNames ,
508
+ params . numberOfTokens . map ( number => {
509
+ return numberToBigNumber ( number ) ;
510
+ } ) ,
511
+ params . durations . map ( duration => {
512
+ return numberToBigNumber ( duration ) ;
513
+ } ) ,
514
+ params . frequencies . map ( frequency => {
515
+ return numberToBigNumber ( frequency ) ;
516
+ } ) ,
517
+ params . startTimes . map ( startTime => {
518
+ return dateToBigNumber ( startTime ) ;
519
+ } ) ,
520
+ params . txData ,
521
+ params . safetyFactor ,
522
+ ) ;
523
+ } ;
295
524
296
- public addScheduleFromTemplateMulti = async ( ) => { } ;
525
+ public addScheduleFromTemplateMulti = async ( params : AddScheduleFromTemplateMultiParams ) => {
526
+ return ( await this . contract ) . addScheduleFromTemplateMulti . sendTransactionAsync (
527
+ params . beneficiaries ,
528
+ params . templateNames ,
529
+ params . startTimes . map ( startTime => {
530
+ return dateToBigNumber ( startTime ) ;
531
+ } ) ,
532
+ params . txData ,
533
+ params . safetyFactor ,
534
+ ) ;
535
+ } ;
297
536
298
- public revokeSchedulesMulti = async ( ) => { } ;
537
+ public revokeSchedulesMulti = async ( params : RevokeSchedulesMultiParams ) => {
538
+ return ( await this . contract ) . revokeSchedulesMulti . sendTransactionAsync (
539
+ params . beneficiaries ,
540
+ params . txData ,
541
+ params . safetyFactor ,
542
+ ) ;
543
+ } ;
299
544
300
- public modifyScheduleMulti = async ( ) => { } ;
545
+ public modifyScheduleMulti = async ( params : ModifyScheduleMultiParams ) => {
546
+ return ( await this . contract ) . modifyScheduleMulti . sendTransactionAsync (
547
+ params . beneficiaries ,
548
+ params . templateNames ,
549
+ params . startTimes . map ( startTime => {
550
+ return dateToBigNumber ( startTime ) ;
551
+ } ) ,
552
+ params . txData ,
553
+ params . safetyFactor ,
554
+ ) ;
555
+ } ;
301
556
302
557
/**
303
558
* Subscribe to an event type emitted by the contract.
0 commit comments