Skip to content

Commit

Permalink
save drop info
Browse files Browse the repository at this point in the history
  • Loading branch information
galekseev committed Apr 23, 2024
1 parent fa9ff4e commit 0d6cdf2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/gen_qr_lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ async function main (settings) {
}
console.log('total:', amounts.length);
const drop = makeDrop(accounts, amounts);

console.log(`root: ${drop.root}`, amounts.reduce((acc, v) => acc + v, 0n).toString());
const totalAmount = amounts.reduce((acc, v) => acc + v, 0n);
console.log(`root: ${drop.root} ${totalAmount}`);

let indices = [];
for (let i = 0; i < amounts.length; i++) {
Expand Down Expand Up @@ -162,7 +162,16 @@ async function main (settings) {
index: indices[i],
});
}
fs.writeFileSync(settings.fileLinks, JSON.stringify(info, null, 1));

const fileContent = {
count: amounts.length,
root: drop.root,
amount: totalAmount.toString(),
version: settings.version,
codes: info,
};

fs.writeFileSync(settings.fileLinks, JSON.stringify(fileContent, null, 1));
}

if (!settings.flagNoDeploy) {
Expand Down

0 comments on commit 0d6cdf2

Please sign in to comment.