minor import script improvements
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

waiting for transactions and logging earlier for better debugging
This commit is contained in:
bumi 2022-10-23 16:03:37 +02:00
parent 1c097f37a6
commit f71ff4ce9a
3 changed files with 12 additions and 7 deletions

View File

@ -6,6 +6,8 @@ async function main() {
await kredits.init(); await kredits.init();
console.log(`Using Contribution at: ${kredits.Contribution.contract.address}`); console.log(`Using Contribution at: ${kredits.Contribution.contract.address}`);
const count = await kredits.Contribution.count;
console.log(`Currently ${count} entries`);
try { try {
const data = fs.readFileSync("./data/contributions.json"); const data = fs.readFileSync("./data/contributions.json");
@ -28,11 +30,11 @@ async function main() {
c.hashDigest, c.hashFunction, c.hashSize, c.hashDigest, c.hashFunction, c.hashSize,
confirmedAtBlock, c.vetoed confirmedAtBlock, c.vetoed
); );
// await result.wait(); console.log(`Adding contribution #${contributionId}: ${result.hash}`);
console.log(`Added contribution #${contributionId}: ${result.hash}`); await result.wait();
}; };
} catch(e) { } catch(e) {
console.log(e); console.error(e);
} }
} }

View File

@ -6,7 +6,8 @@ async function main() {
await kredits.init(); await kredits.init();
console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`); console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`);
const count = await kredits.Contributor.count;
console.log(`Currently ${count} entries`);
try { try {
const data = fs.readFileSync("./data/contributors.json"); const data = fs.readFileSync("./data/contributors.json");
const contributors = JSON.parse(data); const contributors = JSON.parse(data);
@ -22,11 +23,11 @@ async function main() {
contributor.hashFunction, contributor.hashFunction,
contributor.hashSize, contributor.hashSize,
); );
// await result.wait(); console.log(`Adding contributor #${contributorId}: ${result.hash}`);
console.log(`Added contributor #${contributorId}: ${result.hash}`); await result.wait();
}; };
} catch(e) { } catch(e) {
console.log(e); console.error(e);
} }
} }

View File

@ -6,6 +6,8 @@ async function main() {
await kredits.init(); await kredits.init();
console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`); console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`);
const count = await kredits.Contributors.count;
console.log(`Currently ${count} entries`);
const table = new Table({ const table = new Table({
head: ['ID', 'Account', 'Name', 'Core?', 'Balance', 'Kredits earned', 'Contributions count', 'IPFS'] head: ['ID', 'Account', 'Name', 'Core?', 'Balance', 'Kredits earned', 'Contributions count', 'IPFS']