Finish contributor import script
This commit is contained in:
parent
990e2a9649
commit
1521e272f9
@ -1,3 +1,4 @@
|
|||||||
|
const fs = require('fs');
|
||||||
const Kredits = require('../../lib/kredits');
|
const Kredits = require('../../lib/kredits');
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
@ -6,21 +7,27 @@ async function main() {
|
|||||||
|
|
||||||
console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`);
|
console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`);
|
||||||
|
|
||||||
const data = fs.readFileSync("./data/contributors.json");
|
try {
|
||||||
const contributors = JSON.parse(data);
|
const data = fs.readFileSync("./data/contributors.json");
|
||||||
|
const contributors = JSON.parse(data);
|
||||||
|
const ids = Object.keys(contributors)
|
||||||
|
.map(k => parseInt(k))
|
||||||
|
.sort(function(a, b){return a-b});
|
||||||
|
|
||||||
const ids = Object.keys(contributors).map(k => parseInt(k)).sort();
|
for (const contributorId of ids) {
|
||||||
for (const contributorId of ids) {
|
const contributor = contributors[contributorId.toString()];
|
||||||
const contributor = contributors[contributorId.toString()];
|
const result = await kredits.Contributor.contract.addContributor(
|
||||||
const result = kredits.Contributor.contract.addContributor({
|
contributor.account,
|
||||||
account: contributor.account,
|
contributor.hashDigest,
|
||||||
hashDigest: contirbutor.hashDigest,
|
contributor.hashFunction,
|
||||||
hashFunction: contributor.hashFunction,
|
contributor.hashSize,
|
||||||
hashSize: contributr.hashSize,
|
);
|
||||||
});
|
// await result.wait();
|
||||||
// await result.wait();
|
console.log(`Added contributor #${contributorId}: ${result.hash}`);
|
||||||
console.log(`Added contributor #${id}: ${result.hash}`);
|
};
|
||||||
};
|
} catch(e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user