(includeCreate)
| 643 | } |
| 644 | |
| 645 | async function selectCheckpoint(includeCreate) { |
| 646 | if (await securityToken.methods.currentCheckpointId().call() > 0) { |
| 647 | let options = []; |
| 648 | let fix = 1; //Checkpoint 0 is not included, so I need to add 1 to fit indexes for checkpoints and options |
| 649 | let checkpoints = (await getCheckpoints()).map(function (c) { return c.timestamp }); |
| 650 | if (includeCreate) { |
| 651 | options.push('Create new checkpoint'); |
| 652 | fix = 0; //If this option is added, fix isn't needed. |
| 653 | } |
| 654 | options = options.concat(checkpoints); |
| 655 | |
| 656 | return readlineSync.keyInSelect(options, 'Select a checkpoint:', { cancel: false }) + fix; |
| 657 | } else { |
| 658 | return 0; |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | async function getCheckpoints() { |
| 663 | let result = []; |
no test coverage detected