fix example.html (keymodule)

This commit is contained in:
Matias Alejo Garcia 2014-03-28 23:54:59 -03:00
parent 26b7f89f39
commit 7504637d92
2 changed files with 13 additions and 17 deletions

View File

@ -59,11 +59,13 @@ var run = function() {
console.log('TX HEX IS: ', txHex);
};
// browser example compatibility
if (module) {
// This is just for browser & mocha compatibility
if (typeof module !== 'undefined') {
module.exports.run = run;
}
if (require.main === module) {
if (require.main === module) {
run();
}
} else {
run();
}

View File

@ -14,9 +14,9 @@
<script type="text/javascript">
var Address = require('bitcore').Address;
print = function(s){
print = function(s,s2,s3){
var div = document.getElementById('content');
div.innerHTML += s + '<br />';
div.innerHTML += s + (s2||'') + (s3||'') + '<br />';
};
print('<hr> <h1>Address</h1>' );
@ -39,21 +39,16 @@
}
});
print('<hr> <h1>KeyModule</h1>' );
print('<hr> <h1>Key</h1>' );
/*
Using bitcore root module
*/
var bitcore = require('bitcore');
var k = bitcore.KeyModule.Key.generateSync();
var k = bitcore.Key.generateSync();
print ('Generate Key Pair:');
print ('Private:' + bitcore.buffertools.toHex(k.private));
print ('Public:' + bitcore.buffertools.toHex(k.public));
print('<hr> <h1>PeerManager</h1>' );
var p = new bitcore.PeerManager();
print('<hr> <h1>Util</h1>' );
var coinUtil = bitcore.util;
@ -81,6 +76,7 @@
var WalletKey = bitcore.WalletKey;
var networks = bitcore.networks;
var priv = 'L4cEVwoNDeYdCQfFJAGkGKPnE2TmqLEuBn4znQChD2ojjQRJVKpU';
var s = new WalletKey({
network: networks.livenet
@ -91,11 +87,9 @@
print("Public: " + o.pub);
print("Addr: " + o.addr);
var module = { exports: {} };
print('<hr><h1>TransactionBuilder</h1>');
console.log = print;
</script>
<script src="./CreateAndSignTx.js"></script>
<script>
run();
</script>
</body>
</html>