()
| 790 | } |
| 791 | |
| 792 | async function getApprovalsArray() { |
| 793 | let address = readlineSync.question('Enter an address to filter or leave empty to get all the approvals: ', { |
| 794 | limit: function (input) { |
| 795 | return web3.utils.isAddress(input); |
| 796 | }, |
| 797 | limitMessage: "Must be a valid address", |
| 798 | defaultInput: gbl.constants.ADDRESS_ZERO |
| 799 | }); |
| 800 | if (address == gbl.constants.ADDRESS_ZERO) { |
| 801 | return await getApprovals(); |
| 802 | } else { |
| 803 | let approvals = await getApprovalsToAnAddress(address); |
| 804 | if (!approvals.length) { |
| 805 | console.log(chalk.red(`\nThe address is not listed\n`)) |
| 806 | } |
| 807 | return approvals; |
| 808 | } |
| 809 | } |
| 810 | |
| 811 | function printMatmRow(from, to, allowance, time, description) { |
| 812 | console.log(`\nDescription: ${web3.utils.toAscii(description)}\nFrom ${from} to ${to}\nAllowance: ${web3.utils.fromWei(allowance)}\nExpiry time: ${moment.unix(time).format('MMMM Do YYYY HH:mm')}\n`); |
no test coverage detected