2016-08-04 10:21:49 +03:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Ethereum Wallet</title>
|
2016-08-05 03:12:50 +03:00
|
|
|
<link rel="stylesheet" type="text/css" href="../style.css">
|
2016-08-04 10:21:49 +03:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="centerer" id="screen-select">
|
|
|
|
<div class="centered">
|
|
|
|
<h1>Ethereum Wallet Tool</h1>
|
|
|
|
<hr />
|
|
|
|
<h2>Summon Brain Wallet</h2>
|
|
|
|
<p>
|
|
|
|
A brain wallet generates an <i>Ethereum</i> wallet from a username and a password
|
|
|
|
without using any servers to store your information. If you lose your username
|
|
|
|
or password, <b>no one</b> can help you recover them. Anyone who can guess your
|
|
|
|
username and password can steal your funds. Brain wallets should <b>not</b> be
|
|
|
|
considered a safe way to store large amounts of ether nor for long periods of time.
|
|
|
|
</p>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>E-mail Address:</th>
|
|
|
|
<td><input type="text" placeholder="(e-mail address)" id="select-brainwallet-username" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Password:</th>
|
|
|
|
<td><input type="password" placeholder="(password)" id="select-brainwallet-password" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Confirm Password:</th>
|
|
|
|
<td><input type="password" placeholder="(same password)" id="select-brainwallet-confirm-password" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td> </td>
|
|
|
|
<td>
|
|
|
|
<div id="select-submit-brainwallet" class="submit disable">Summon Brain Wallet</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<hr />
|
|
|
|
<h2>Load JSON Wallet</h2>
|
|
|
|
<p>
|
|
|
|
If you have a JSON wallet file from <i>geth</i> or from the initial <i>Ethereum</i>
|
|
|
|
crowd sale, you can decrypt it here. No information is shared with <b>any</b>
|
|
|
|
server.
|
|
|
|
</p>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>JSON Wallet:</th>
|
|
|
|
<td><div class="file" id="select-wallet-drop">Drop JSON wallet file here</div><input type="file" id="select-wallet-file" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Password:</th>
|
|
|
|
<td><input type="password" placeholder="(password)" id="select-wallet-password" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td> </td>
|
|
|
|
<td>
|
|
|
|
<div id="select-submit-wallet" class="submit disable">Unlock JSON Wallet</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
<hr />
|
|
|
|
<h2>Mnemonic Phrase Wallet</h2>
|
|
|
|
<p>
|
|
|
|
If you have a 12 word mnemonic phrase, you can generate your wallet here.
|
|
|
|
No information is shared with <b>any</b> server.
|
|
|
|
</p>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>Mnemonic Phrase:</th>
|
|
|
|
<td><input type="text" placeholder="(mnemonic phrase)" id="select-mnemonic-phrase" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Path:</th>
|
|
|
|
<td><input type="text" placeholder="(path)" id="select-mnemonic-path" value="m/44'/60'/0'/0/0" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td> </td>
|
|
|
|
<td>
|
|
|
|
<div id="select-submit-mnemonic" class="submit disable">Derive Wallet</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2016-08-08 07:18:01 +03:00
|
|
|
<hr />
|
|
|
|
<h2>Raw Private Key</h2>
|
|
|
|
<p>
|
|
|
|
</p>
|
|
|
|
<table>
|
|
|
|
<tr>
|
2016-08-09 00:12:27 +03:00
|
|
|
<th>Private Key:</th>
|
2016-08-08 07:18:01 +03:00
|
|
|
<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>
|
|
|
|
|
2016-08-04 10:21:49 +03:00
|
|
|
<hr />
|
|
|
|
<h3>Disclaimer:</h3>
|
|
|
|
<p>
|
|
|
|
This is beta software, with no warranty. <b>Use at your own risk.</b>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="centerer hidden" id="screen-loading">
|
|
|
|
<div class="centered">
|
|
|
|
<h1>Loading Wallet</h1>
|
|
|
|
<hr />
|
|
|
|
<h2 id="loading-header"></h2>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>Progress:</th>
|
|
|
|
<td>
|
|
|
|
<input type="text" readonly="readonly" class="readonly" id="loading-status" value="" /></div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td> </td>
|
|
|
|
<td>
|
|
|
|
<div id="loading-cancel" class="submit">Cancel</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<hr />
|
|
|
|
<h3>Disclaimer:</h3>
|
|
|
|
<p>
|
|
|
|
This is beta software, with no warranty. <b>Use at your own risk.</b>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="centerer hidden" id="screen-wallet">
|
|
|
|
<div class="centered">
|
|
|
|
<h1>Ethereum Wallet<span id="wallet-username" class="username right"></span></h1>
|
|
|
|
<hr />
|
|
|
|
<h3>Wallet Details:</h3>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>Address:</th>
|
|
|
|
<td>
|
|
|
|
<input type="text" readonly="readonly" class="readonly" id="wallet-address" value="" /></div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Network:</th>
|
|
|
|
<td>
|
2017-04-06 00:14:09 +03:00
|
|
|
<div class="option left" id="option-testnet">Testnet (Ropsten)</div>
|
|
|
|
<div class="option right selected" id="option-mainnet">Mainnet (Homestead)</div>
|
2016-08-04 10:21:49 +03:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Balance:</th>
|
|
|
|
<td>
|
|
|
|
<input type="text" readonly="readonly" class="readonly" id="wallet-balance" value="0.0" /></div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Nonce:</th>
|
|
|
|
<td>
|
|
|
|
<input type="text" readonly="readonly" class="readonly" id="wallet-transaction-count" value="0" /></div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td> </td>
|
|
|
|
<td>
|
|
|
|
<div id="wallet-submit-refresh" class="submit">Refresh</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<h3>Send Ether:</h3>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>Target Address:</th>
|
|
|
|
<td><input type="text" placeholder="(target address)" id="wallet-send-target-address" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Amount:</th>
|
|
|
|
<td><input type="text" placeholder="(amount)" id="wallet-send-amount" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td> </td>
|
|
|
|
<td>
|
|
|
|
<div id="wallet-submit-send" class="submit disable">Send Ether</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<h3>Session Activity</h3>
|
|
|
|
<div id="wallet-activity" class="activity"></div>
|
|
|
|
|
|
|
|
<hr />
|
|
|
|
<h3>Disclaimer:</h3>
|
|
|
|
<p>
|
|
|
|
This is beta software, with no warranty. <b>Use at your own risk.</b>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
<script type="text/javascript" src="../../dist/ethers.js"></script>
|
2016-08-04 10:21:49 +03:00
|
|
|
<script type="text/javascript">
|
|
|
|
function setEnter(source, target) {
|
|
|
|
source.onkeyup = function(e) {
|
|
|
|
if (e.which === 13) { target.click(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var cancelScrypt = false;
|
|
|
|
document.getElementById('loading-cancel').onclick = function() {
|
|
|
|
cancelScrypt = true;
|
|
|
|
};
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
var updateLoading = (function() {
|
|
|
|
var loadingStatus = document.getElementById('loading-status');
|
|
|
|
return (function(progress) {
|
|
|
|
loadingStatus.value = (parseInt(progress * 100)) + '%';
|
|
|
|
return cancelScrypt;
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
|
2016-08-04 10:21:49 +03:00
|
|
|
(function() {
|
|
|
|
var inputUsername = document.getElementById('select-brainwallet-username');
|
|
|
|
var inputPassword = document.getElementById('select-brainwallet-password');
|
|
|
|
var inputConfirmPassword = document.getElementById('select-brainwallet-confirm-password');
|
|
|
|
var submit = document.getElementById('select-submit-brainwallet');
|
|
|
|
|
|
|
|
function checkBrainwallet() {
|
|
|
|
if (inputUsername.value && inputPassword.value && inputPassword.value === inputConfirmPassword.value) {
|
|
|
|
submit.classList.remove('disable');
|
|
|
|
} else {
|
|
|
|
submit.classList.add('disable');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inputUsername.oninput = checkBrainwallet;
|
|
|
|
inputPassword.oninput = checkBrainwallet;
|
|
|
|
inputConfirmPassword.oninput = checkBrainwallet;
|
|
|
|
|
|
|
|
setEnter(inputUsername, submit);
|
|
|
|
setEnter(inputPassword, submit);
|
|
|
|
setEnter(inputConfirmPassword, submit);
|
|
|
|
|
|
|
|
submit.onclick = function() {
|
|
|
|
if (submit.classList.contains('disable')) { return; }
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
var username = new ethers.utils.toUtf8Bytes(inputUsername.value);
|
|
|
|
var password = new ethers.utils.toUtf8Bytes(inputPassword.value);
|
2016-08-04 10:21:49 +03:00
|
|
|
|
|
|
|
showLoading('Summoning Brain Wallet...');
|
|
|
|
|
|
|
|
cancelScrypt = false;
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
ethers.Wallet.fromBrainWallet(username, password, updateLoading).then(function(wallet) {
|
|
|
|
showWallet(wallet);
|
|
|
|
document.getElementById('wallet-username').textContent = inputUsername.value;
|
2016-08-04 10:21:49 +03:00
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
}, function (error) {
|
|
|
|
if (error.message !== 'cancelled') {
|
|
|
|
alert('Unknown error');
|
2016-08-04 10:21:49 +03:00
|
|
|
}
|
2017-04-06 00:14:09 +03:00
|
|
|
showSelect();
|
2016-08-04 10:21:49 +03:00
|
|
|
});
|
|
|
|
};
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
var inputFile = document.getElementById('select-wallet-file');
|
|
|
|
var targetDrop = document.getElementById('select-wallet-drop');
|
|
|
|
var inputPassword = document.getElementById('select-wallet-password');
|
|
|
|
var submit = document.getElementById('select-submit-wallet');
|
|
|
|
|
|
|
|
function check() {
|
|
|
|
if (inputFile.files && inputFile.files.length === 1) {
|
|
|
|
submit.classList.remove('disable');
|
|
|
|
targetDrop.textContent = inputFile.files[0].name;
|
|
|
|
} else {
|
|
|
|
submit.classList.add('disable');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inputFile.onchange = check;
|
|
|
|
inputPassword.oninput = check;
|
|
|
|
|
|
|
|
setEnter(inputPassword, submit);
|
|
|
|
|
2016-08-05 03:12:50 +03:00
|
|
|
inputFile.addEventListener('dragover', function(event) {
|
2016-08-04 10:21:49 +03:00
|
|
|
event.preventDefault();
|
|
|
|
event.stopPropagation();
|
|
|
|
targetDrop.classList.add('highlight');
|
|
|
|
}, true);
|
|
|
|
|
2016-08-05 03:12:50 +03:00
|
|
|
inputFile.addEventListener('drop', function(event) {
|
2016-08-04 10:21:49 +03:00
|
|
|
targetDrop.classList.remove('highlight');
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
submit.onclick = function() {
|
|
|
|
if (submit.classList.contains('disable')) { return; }
|
|
|
|
|
|
|
|
var fileReader = new FileReader();
|
|
|
|
fileReader.onload = function(e) {
|
|
|
|
var json = e.target.result;
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
if (ethers.Wallet.isCrowdsaleWallet(json)) {
|
2016-08-04 10:21:49 +03:00
|
|
|
showWallet(Wallet.decryptCrowdsale(json, password));
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
} else if (ethers.Wallet.isValidWallet(json)) {
|
2016-08-04 10:21:49 +03:00
|
|
|
showLoading('Decrypting Wallet...');
|
2017-04-06 00:14:09 +03:00
|
|
|
var password = new ethers.Wallet.utils.Buffer(inputPassword.value);
|
2016-08-04 10:21:49 +03:00
|
|
|
|
|
|
|
cancelScrypt = false;
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
ethers.Wallet.decrypt(json, password, function(error, wallet, progress) {
|
2016-08-04 10:21:49 +03:00
|
|
|
if (error) {
|
|
|
|
if (error.message === 'invalid password') {
|
|
|
|
alert('Wrong Password');
|
|
|
|
} else {
|
|
|
|
console.log(error);
|
|
|
|
alert('Error Decrypting Wallet');
|
|
|
|
}
|
|
|
|
showSelect();
|
|
|
|
|
|
|
|
} else if (wallet) {
|
|
|
|
showWallet(wallet);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
updateLoading(progress);
|
|
|
|
}
|
|
|
|
|
|
|
|
return cancelScrypt;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
alert('Unknown JSON wallet format');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
fileReader.readAsText(inputFile.files[0]);
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
2016-08-08 07:18:01 +03:00
|
|
|
(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; }
|
2017-04-06 00:14:09 +03:00
|
|
|
showWallet(new ethers.Wallet(privateKey));
|
2016-08-08 07:18:01 +03:00
|
|
|
}
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
2016-08-04 10:21:49 +03:00
|
|
|
var activeWallet = null;
|
|
|
|
|
|
|
|
function showError(error) {
|
|
|
|
alert('Error \u2014 ' + error.message);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Refresh balance and transaction count in the UI
|
|
|
|
var refresh = (function() {
|
|
|
|
var inputBalance = document.getElementById('wallet-balance');
|
|
|
|
var inputTransactionCount = document.getElementById('wallet-transaction-count');
|
|
|
|
var submit = document.getElementById('wallet-submit-refresh');
|
|
|
|
|
|
|
|
function refresh() {
|
|
|
|
addActivity('> Refreshing details...');
|
|
|
|
activeWallet.getBalance('pending').then(function(balance) {
|
|
|
|
addActivity('< Balance: ' + balance.toString(10));
|
2017-04-06 00:14:09 +03:00
|
|
|
inputBalance.value = ethers.utils.formatEther(balance, {commify: true});
|
2016-08-04 10:21:49 +03:00
|
|
|
}, function(error) {
|
|
|
|
showError(error);
|
|
|
|
});
|
|
|
|
activeWallet.getTransactionCount('pending').then(function(transactionCount) {
|
|
|
|
addActivity('< TransactionCount: ' + transactionCount);
|
|
|
|
inputTransactionCount.value = transactionCount;
|
|
|
|
}, function(error) {
|
|
|
|
showError(error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
submit.onclick = refresh;
|
|
|
|
|
|
|
|
return refresh;
|
|
|
|
})();
|
|
|
|
|
|
|
|
var addActivity = (function() {
|
|
|
|
var activity = document.getElementById('wallet-activity');
|
|
|
|
return function(message, url) {
|
|
|
|
var line = document.createElement('a');
|
|
|
|
line.textContent = message;
|
|
|
|
if (url) { line.setAttribute('href', url); }
|
|
|
|
activity.appendChild(line);
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
|
|
|
|
// Set up the wallet page
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
var inputTargetAddress = document.getElementById('wallet-send-target-address');
|
|
|
|
var inputAmount = document.getElementById('wallet-send-amount');
|
|
|
|
var submit = document.getElementById('wallet-submit-send');
|
|
|
|
|
|
|
|
// Validate the address and value (to enable the send button)
|
|
|
|
function check() {
|
|
|
|
try {
|
2017-04-06 00:14:09 +03:00
|
|
|
ethers.utils.getAddress(inputTargetAddress.value);
|
|
|
|
ethers.utils.parseEther(inputAmount.value);
|
2016-08-04 10:21:49 +03:00
|
|
|
} catch (error) {
|
|
|
|
submit.classList.add('disable');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
submit.classList.remove('disable');
|
|
|
|
}
|
|
|
|
inputTargetAddress.oninput = check;
|
|
|
|
inputAmount.oninput = check;
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
var optionTestnet = document.getElementById('option-testnet');
|
|
|
|
var optionMainnet = document.getElementById('option-mainnet');
|
2016-08-04 10:21:49 +03:00
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
// Select the testnet network
|
|
|
|
optionTestnet.onclick = function() {
|
|
|
|
if (optionTestnet.classList.contains('selected')) { return; }
|
|
|
|
addActivity('! Switched network: Testnet');
|
|
|
|
activeWallet.provider = new ethers.providers.getDefaultProvider(true);
|
|
|
|
optionTestnet.classList.add('selected');
|
|
|
|
optionMainnet.classList.remove('selected');
|
2016-08-04 10:21:49 +03:00
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
// Select the mainnet network
|
|
|
|
optionMainnet.onclick = function() {
|
|
|
|
if (optionMainnet.classList.contains('selected')) { return; }
|
|
|
|
addActivity('! Switched network: Mainnet');
|
|
|
|
activeWallet.provider = new ethers.providers.getDefaultProvider(false);
|
|
|
|
optionTestnet.classList.remove('selected');
|
|
|
|
optionMainnet.classList.add('selected');
|
2016-08-04 10:21:49 +03:00
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Send ether
|
|
|
|
submit.onclick = function() {
|
2016-08-04 10:43:59 +03:00
|
|
|
|
|
|
|
// Matt (from Etherscan) is working on a gasPrice API call, which
|
|
|
|
// should be done within a week or so.
|
2017-04-06 00:14:09 +03:00
|
|
|
// @TODO
|
2016-08-04 10:21:49 +03:00
|
|
|
var gasPrice = (activeWallet.provider.testnet ? 0x4a817c800: 0xba43b7400);
|
|
|
|
console.log('GasPrice: ' + gasPrice);
|
|
|
|
|
2017-04-06 00:14:09 +03:00
|
|
|
var targetAddress = ethers.utils.getAddress(inputTargetAddress.value);
|
|
|
|
var amountWei = ethers.utils.parseEther(inputAmount.value);
|
2016-08-04 10:21:49 +03:00
|
|
|
activeWallet.send(targetAddress, amountWei, {
|
|
|
|
gasPrice: gasPrice,
|
|
|
|
gasLimit: 21000,
|
|
|
|
}).then(function(txid) {
|
|
|
|
var url = (activeWallet.provider.testnet ? 'https://testnet.etherscan.io/tx/': 'https://etherscan.io/tx/') + txid;
|
|
|
|
addActivity('< Transaction sent: ' + txid.substring(0, 20) + '...', url);
|
|
|
|
alert('Success!');
|
|
|
|
|
|
|
|
inputTargetAddress.value = '';
|
|
|
|
inputAmount.value = '';
|
|
|
|
submit.classList.add('disable');
|
|
|
|
|
|
|
|
refresh();
|
|
|
|
}, function(error) {
|
|
|
|
showError(error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
|
|
|
|
function showSelect() {
|
|
|
|
document.getElementById('screen-select').style.display = 'block';
|
|
|
|
document.getElementById('screen-loading').style.display = 'none';
|
|
|
|
document.getElementById('screen-wallet').style.display = 'none';
|
|
|
|
}
|
|
|
|
|
|
|
|
function showLoading(title) {
|
|
|
|
document.getElementById('screen-select').style.display = 'none';
|
|
|
|
document.getElementById('screen-loading').style.display = 'block';
|
|
|
|
document.getElementById('screen-wallet').style.display = 'none';
|
|
|
|
|
|
|
|
document.getElementById('loading-header').textContent = title;
|
|
|
|
}
|
|
|
|
|
|
|
|
function showWallet(wallet) {
|
2017-04-06 00:14:09 +03:00
|
|
|
var testnet = document.getElementById('option-testnet').classList.contains('selected');
|
2016-08-04 10:21:49 +03:00
|
|
|
activeWallet = wallet;
|
2017-04-06 00:14:09 +03:00
|
|
|
activeWallet.provider = new ethers.providers.getDefaultProvider(testnet);
|
2016-08-04 10:21:49 +03:00
|
|
|
|
|
|
|
document.getElementById('screen-select').style.display = 'none';
|
|
|
|
document.getElementById('screen-loading').style.display = 'none';
|
|
|
|
document.getElementById('screen-wallet').style.display = 'block';
|
|
|
|
|
|
|
|
var inputWalletAddress = document.getElementById('wallet-address');
|
|
|
|
inputWalletAddress.value = wallet.address;
|
|
|
|
inputWalletAddress.onclick = function() {
|
|
|
|
this.select();
|
|
|
|
};
|
|
|
|
|
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
//var privateKey = '0x3141592653589793238462643383279502884197169399375105820974944592';
|
|
|
|
//showWallet(new Wallet(privateKey));
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|