Add bitcoinAddress convenience func to BIP32key

This commit is contained in:
Andreas Brekken 2014-01-10 16:47:14 +07:00
parent 3e6796a660
commit be7406d9a9

View file

@ -1,4 +1,5 @@
var util = require('./util'), var util = require('./util'),
Address = require('./address'),
conv = require('./convert'), conv = require('./convert'),
ECKey = require('./eckey').ECKey, ECKey = require('./eckey').ECKey,
ECPubKey = require('./eckey').ECPubKey, ECPubKey = require('./eckey').ECPubKey,
@ -130,4 +131,8 @@ BIP32key.fromMasterKey = function(seed) {
BIP32key.prototype.getKey = function() { return this.key } BIP32key.prototype.getKey = function() { return this.key }
BIP32key.prototype.bitcoinAddress = function() {
return new Address(util.sha256ripe160(this.getPub().key))
}
module.exports = BIP32key; module.exports = BIP32key;