Browse Source

Changes default EC*Key.toString behaviour to Hex

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
e9fdfecfea
  1. 4
      src/eckey.js
  2. 6
      test/hdwallet.js

4
src/eckey.js

@ -96,7 +96,7 @@ ECKey.prototype.toBase64 = function() {
return convert.bytesToBase64(this.toBytes())
}
ECKey.prototype.toString = ECKey.prototype.toWif
ECKey.prototype.toString = ECKey.prototype.toHex
ECKey.prototype.getAddress = function(version) {
return this.getPub().getAddress(version)
@ -170,7 +170,7 @@ ECPubKey.prototype.toWif = function(version) {
return base58.checkEncode(this.toBytes(), version)
}
ECPubKey.prototype.toString = ECPubKey.prototype.toWif
ECPubKey.prototype.toString = ECPubKey.prototype.toHex
ECPubKey.prototype.getAddress = function(version) {
var version = version || Network.mainnet.addressVersion;

6
test/hdwallet.js

@ -46,7 +46,7 @@ describe('HDWallet', function() {
it('creates from binary seed', function() {
var hd = new HDWallet(seed)
assert.equal(hd.priv, expectedPrivKey)
assert.equal(hd.priv.toWif(), expectedPrivKey)
assert(hd.pub)
})
@ -54,7 +54,7 @@ describe('HDWallet', function() {
it('creates from hex seed', function() {
var hd = HDWallet.fromSeedHex(b2h(seed))
assert.equal(hd.priv, expectedPrivKey)
assert.equal(hd.priv.toWif(), expectedPrivKey)
assert(hd.pub)
})
})
@ -63,7 +63,7 @@ describe('HDWallet', function() {
it('creates from string seed', function() {
var hd = HDWallet.fromSeedString(convert.bytesToString(seed))
assert.equal(hd.priv, expectedPrivKey)
assert.equal(hd.priv.toWif(), expectedPrivKey)
assert(hd.pub)
})
})

Loading…
Cancel
Save