From b03dfe1c5fb0f6d008a81f9ebd2442e29d3707c8 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 21 Jun 2022 00:28:57 -0600 Subject: [PATCH] =?utf8?q?fix(generate):=20use=20Duff,=20not=20Dash...=20u?= =?utf8?q?hg=20=F0=9F=A4=A6=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/crowdnode.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bin/crowdnode.js b/bin/crowdnode.js index a867b56..943eaa8 100755 --- a/bin/crowdnode.js +++ b/bin/crowdnode.js @@ -301,11 +301,14 @@ async function generate(name) { note = `\n(for pubkey address ${pub})`; } + let testDash = 0.01; + let testDuff = toDuff(testDash); + let err = await Fs.access(filepath).catch(Object); if (!err) { // TODO show QR anyway //wif = await Fs.readFile(filepath, 'utf8') - //showQr(pub, 0.01); + //showQr(pub, testDuff); console.info(`'${filepath}' already exists (will not overwrite)`); process.exit(0); return; @@ -314,13 +317,13 @@ async function generate(name) { await Fs.writeFile(filepath, wif, "utf8").then(function () { console.info(``); console.info( - `Use the QR Code below to load a test deposit of Đ0.01 onto your staking key.`, + `Use the QR Code below to load a test deposit of Đ${testDash} onto your staking key.`, ); console.info(``); - showQr(pub, 0.01); + showQr(pub, testDuff); console.info(``); console.info( - `Use the QR Code above to load a test deposit of Đ0.01 onto your staking key.`, + `Use the QR Code above to load a test deposit of Đ${testDash} onto your staking key.`, ); console.info(``); console.info(`Generated ${filepath} ${note}`); @@ -613,6 +616,10 @@ function toDash(duffs) { return (duffs / DUFFS).toFixed(8); } +function toDuff(dash) { + return Math.round(parseFloat(dash) * DUFFS); +} + // Run main().catch(function (err) { -- 2.25.1