Browse Source

fix example.html (keymodule)

patch-2
Matias Alejo Garcia 11 years ago
parent
commit
7504637d92
  1. 10
      examples/CreateAndSignTx.js
  2. 20
      examples/example.html

10
examples/CreateAndSignTx.js

@ -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();
}

20
examples/example.html

@ -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>

Loading…
Cancel
Save