Armory: added to bitcore.js, build.js and browser example
This commit is contained in:
parent
f647af50b7
commit
b26dd77911
|
@ -60,5 +60,6 @@ requireWhenAccessed('WalletKey', './lib/WalletKey');
|
|||
requireWhenAccessed('PeerManager', './lib/PeerManager');
|
||||
requireWhenAccessed('Message', './lib/Message');
|
||||
requireWhenAccessed('Electrum', './lib/Electrum');
|
||||
requireWhenAccessed('Armory', './lib/Armory');
|
||||
module.exports.Buffer = Buffer;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ var pack = function (params) {
|
|||
|
||||
var modules = [
|
||||
'lib/Address',
|
||||
'lib/Armory',
|
||||
'lib/Base58',
|
||||
'lib/BIP32',
|
||||
'lib/Block',
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
textarea {
|
||||
width: 400px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script src="../../browser/bundle.js"></script>
|
||||
Enter you paper wallet seed:<br>
|
||||
<textarea id="seed">aagh hjfj sihk ietj giik wwai awtd uodh hnji
|
||||
soss uaku egod utai itos fijj ihgi jhau jtoo</textarea>
|
||||
<br>
|
||||
<input type="submit" onclick="updateResult()" value="Generate">
|
||||
<div id="result"></div>
|
||||
<pre id="console"></pre>
|
||||
<script>
|
||||
var bitcore = require('bitcore'),
|
||||
Address = bitcore.Address,
|
||||
Armory = bitcore.Armory;
|
||||
|
||||
var logs = document.getElementById('console');
|
||||
function log (msg) {
|
||||
logs.insertAdjacentHTML('beforeend', msg + '\n');
|
||||
}
|
||||
function clear_log () {
|
||||
logs.innerHTML = '';
|
||||
}
|
||||
|
||||
function getSeed() {
|
||||
return document.getElementById('seed').value;
|
||||
}
|
||||
|
||||
function updateResult () {
|
||||
clear_log();
|
||||
var seed = getSeed();
|
||||
|
||||
var a = Armory.fromSeed(seed);
|
||||
log('Armory MPK: ');
|
||||
log('');
|
||||
log('');
|
||||
log('<textarea>' + a.pubkey.toString('hex') + '' + a.chaincode.toString('hex') + '</textarea>');
|
||||
log('');
|
||||
log('');
|
||||
log('Some wallet addresses:');
|
||||
for (var i = 0; i < 5; i++) {
|
||||
log(Address.fromPubKey(a.pubkey).as('base58'));
|
||||
a = a.next();
|
||||
}
|
||||
}
|
||||
|
||||
updateResult();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue