Browse Source

HDWallet: now export all information by default

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
c340f5cf83
  1. 2
      src/hdwallet.js
  2. 8
      test/hdwallet.js

2
src/hdwallet.js

@ -159,6 +159,8 @@ HDWallet.prototype.toBase58 = function(isPrivate) {
}
HDWallet.prototype.toBuffer = function(isPrivate) {
if (isPrivate == undefined) isPrivate = !!this.priv
// Version
var version = isPrivate ? this.network.bip32.private : this.network.bip32.public
var buffer = new Buffer(HDWallet.LENGTH)

8
test/hdwallet.js

@ -71,7 +71,7 @@ describe('HDWallet', function() {
it('exports ' + f.master.base58 + ' (public) correctly', function() {
var hd = HDWallet.fromSeedHex(f.master.seed)
assert.equal(hd.toBase58(), f.master.base58)
assert.equal(hd.toBase58(false), f.master.base58)
})
})
@ -105,7 +105,7 @@ describe('HDWallet', function() {
it('imports ' + f.master.base58Priv + ' (private) correctly', function() {
var hd = HDWallet.fromBase58(f.master.base58Priv)
assert.equal(hd.toBase58(true), f.master.base58Priv)
assert.equal(hd.toBase58(), f.master.base58Priv)
})
})
@ -131,7 +131,7 @@ describe('HDWallet', function() {
it('imports ' + f.master.hexPriv + ' (private) correctly', function() {
var hd = HDWallet.fromHex(f.master.hexPriv)
assert.equal(hd.toBuffer(true).toString('hex'), f.master.hexPriv)
assert.equal(hd.toBuffer().toString('hex'), f.master.hexPriv)
})
})
@ -149,7 +149,7 @@ describe('HDWallet', function() {
it('exports ' + f.master.hex + ' (public) correctly', function() {
var hd = HDWallet.fromSeedHex(f.master.seed)
assert.equal(hd.toHex(), f.master.hex)
assert.equal(hd.toHex(false), f.master.hex)
})
})

Loading…
Cancel
Save