From be7406d9a9fd523836019023e002a5ff273ed1b1 Mon Sep 17 00:00:00 2001 From: Andreas Brekken Date: Fri, 10 Jan 2014 16:47:14 +0700 Subject: [PATCH] Add bitcoinAddress convenience func to BIP32key --- src/bip32.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bip32.js b/src/bip32.js index 306550a..2bc3079 100644 --- a/src/bip32.js +++ b/src/bip32.js @@ -1,4 +1,5 @@ var util = require('./util'), + Address = require('./address'), conv = require('./convert'), ECKey = require('./eckey').ECKey, ECPubKey = require('./eckey').ECPubKey, @@ -130,4 +131,8 @@ BIP32key.fromMasterKey = function(seed) { BIP32key.prototype.getKey = function() { return this.key } +BIP32key.prototype.bitcoinAddress = function() { + return new Address(util.sha256ripe160(this.getPub().key)) +} + module.exports = BIP32key;