Added raw private key and made homestead default network.
This commit is contained in:
parent
9c1d6051fb
commit
dee0a4bf3e
6
dist/ethers-wallet.js
vendored
6
dist/ethers-wallet.js
vendored
@ -1196,10 +1196,10 @@ function Randomish() {
|
||||
var aesCbc = new aes.ModeOfOperation.cbc(key, this.feedEntropy());
|
||||
var result = new Buffer(0);
|
||||
while (result.length < length) {
|
||||
result = result.concat([result, this.feedEntropy()]);
|
||||
result = Buffer.concat([result, this.feedEntropy()]);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result.slice(0, length);
|
||||
});
|
||||
|
||||
this.feedEntropy();
|
||||
@ -2061,7 +2061,7 @@ function Wallet(privateKey, provider) {
|
||||
value = utils.hexOrBuffer(utils.hexlify(value), fieldInfo.name);
|
||||
|
||||
// Fixed-width field
|
||||
if (fieldInfo.length && value.length !== fieldInfo.length) {
|
||||
if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) {
|
||||
var error = new Error('invalid ' + fieldInfo.name);
|
||||
error.reason = 'wrong length';
|
||||
error.value = value;
|
||||
|
4
dist/ethers-wallet.min.js
vendored
4
dist/ethers-wallet.min.js
vendored
File diff suppressed because one or more lines are too long
@ -60,6 +60,23 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr />
|
||||
<h2>Raw Private Key</h2>
|
||||
<p>
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Private KeyE-mail Address:</th>
|
||||
<td><input type="text" placeholder="(private key)" id="select-privatekey" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<div id="select-submit-privatekey" class="submit disable">Unlock JSON Wallet</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr />
|
||||
<h3>Disclaimer:</h3>
|
||||
<p>
|
||||
@ -109,8 +126,8 @@
|
||||
<tr>
|
||||
<th>Network:</th>
|
||||
<td>
|
||||
<div class="option left selected" id="option-morden">Morden (testnet)</div>
|
||||
<div class="option right" id="option-homestead">Homestead (mainnet)</div>
|
||||
<div class="option left" id="option-morden">Morden (testnet)</div>
|
||||
<div class="option right selected" id="option-homestead">Homestead (mainnet)</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -298,6 +315,30 @@
|
||||
|
||||
})();
|
||||
|
||||
(function() {
|
||||
var inputPrivatekey = document.getElementById('select-privatekey');
|
||||
var submit = document.getElementById('select-submit-privatekey');
|
||||
|
||||
function check() {
|
||||
if (inputPrivatekey.value.match(/^(0x)?[0-9A-fa-f]{64}$/)) {
|
||||
submit.classList.remove('disable');
|
||||
} else {
|
||||
submit.classList.add('disable');
|
||||
}
|
||||
}
|
||||
inputPrivatekey.oninput = check;
|
||||
|
||||
setEnter(inputPrivatekey, submit);
|
||||
|
||||
submit.onclick = function() {
|
||||
if (submit.classList.contains('disable')) { return; }
|
||||
var privateKey = inputPrivatekey.value;
|
||||
if (privateKey.substring(0, 2) !== '0x') { privateKey = '0x' + privateKey; }
|
||||
showWallet(new Wallet(privateKey));
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
var activeWallet = null;
|
||||
|
||||
function showError(error) {
|
||||
@ -433,8 +474,9 @@
|
||||
}
|
||||
|
||||
function showWallet(wallet) {
|
||||
var testnet = document.getElementById('option-morden').classList.contains('selected');
|
||||
activeWallet = wallet;
|
||||
activeWallet.provider = new Wallet.providers.EtherscanProvider({testnet: true});
|
||||
activeWallet.provider = new Wallet.providers.EtherscanProvider({testnet: testnet});
|
||||
|
||||
document.getElementById('screen-select').style.display = 'none';
|
||||
document.getElementById('screen-loading').style.display = 'none';
|
||||
|
Loading…
Reference in New Issue
Block a user