Create the "Bulk CSV Download" function for the Bulk Wallet

This commit is contained in:
Hu Yao-Chieh 2018-06-04 08:38:02 +08:00
parent 72aefc03e0
commit 4e0f0c7af5

View file

@ -6708,6 +6708,7 @@ input[type=checkbox] { position: relative; z-index: 20; }
<span><label id="bulklabelcompressed" for="bulkcompressed">Compressed addresses?</label> <input type="checkbox" id="bulkcompressed" checked="checked" /></span> <span><label id="bulklabelcompressed" for="bulkcompressed">Compressed addresses?</label> <input type="checkbox" id="bulkcompressed" checked="checked" /></span>
<span><input type="button" id="bulkgenerate" value="Generate" onclick="ninja.wallets.bulkwallet.buildCSV(document.getElementById('bulklimit').value * 1, document.getElementById('bulkstartindex').value * 1, document.getElementById('bulkcompressed').checked, document.getElementById('bulkpassphrase').value);" /> </span> <span><input type="button" id="bulkgenerate" value="Generate" onclick="ninja.wallets.bulkwallet.buildCSV(document.getElementById('bulklimit').value * 1, document.getElementById('bulkstartindex').value * 1, document.getElementById('bulkcompressed').checked, document.getElementById('bulkpassphrase').value);" /> </span>
<span class="print"><input type="button" name="print" id="bulkprint" value="Print" onclick="window.print();" /></span> <span class="print"><input type="button" name="print" id="bulkprint" value="Print" onclick="window.print();" /></span>
<span><input type="button" name="download" id="bulkdownload" value="Download" onclick="ninja.wallets.bulkwallet.download();" /></span>
</div> </div>
<div id="bulkadvancedcommands" class="row extra"> <div id="bulkadvancedcommands" class="row extra">
<span><label id="bulklabelencrypt" for="bulkencrypt">BIP38 Encrypt?</label> <input type="checkbox" id="bulkencrypt" onchange="ninja.wallets.bulkwallet.toggleEncrypt(this);" /></span> <span><label id="bulklabelencrypt" for="bulkencrypt">BIP38 Encrypt?</label> <input type="checkbox" id="bulkencrypt" onchange="ninja.wallets.bulkwallet.toggleEncrypt(this);" /></span>
@ -10049,6 +10050,24 @@ ninja.wallets.paperwallet = {
document.getElementById("bulkarea").style.display = "none"; document.getElementById("bulkarea").style.display = "none";
}, },
// use this function to download the bulk generated addresses
// parametrs:
// returns:
// save the generated addresses as the format of (index,bitcoinAddress,privateKeyWif)
// save as file name "BitcoinKeys.csv"
download: function () {
let csvContent = "data:text/csv;charset=utf-8,";
csvContent += document.getElementById("bulktextarea").value;
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", "BitcoinKeys.csv");
document.body.appendChild(link);
link.click();
},
// use this function to bulk generate addresses // use this function to bulk generate addresses
// rowLimit: number of Bitcoin Addresses to generate // rowLimit: number of Bitcoin Addresses to generate
// startIndex: add this number to the row index for output purposes // startIndex: add this number to the row index for output purposes