Merge pull request #82 from 67P/dev/list_contributions
Improve list-contributions script
This commit is contained in:
commit
b35dc2049b
@ -15,21 +15,31 @@ module.exports = async function(callback) {
|
||||
console.log(`Using Contribution at: ${kredits.Contribution.contract.address}`);
|
||||
|
||||
const table = new Table({
|
||||
head: ['ID', 'Contributor account', 'Amount', 'Claimed?', 'Vetoed?', 'Description']
|
||||
head: ['ID', 'Contributor ID', 'Description', 'Amount', 'Confirmed?', 'Vetoed?', 'Claimed?']
|
||||
})
|
||||
|
||||
try {
|
||||
let blockNumber = await kredits.provider.getBlockNumber();
|
||||
let contributions = await kredits.Contribution.all()
|
||||
|
||||
contributions.forEach((c) => {
|
||||
const confirmed = !!(c.claimAtBlock < blockNumber)
|
||||
|
||||
table.push([
|
||||
c.id.toString(),
|
||||
c.contributorId,
|
||||
`${c.description}`,
|
||||
c.amount.toString(),
|
||||
c.claimed,
|
||||
confirmed,
|
||||
c.vetoed,
|
||||
`${c.description}`
|
||||
c.claimed,
|
||||
])
|
||||
})
|
||||
|
||||
console.log(table.toString())
|
||||
callback()
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
callback();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user