Merge pull request #81 from Dcousens/tostring
EC*Key.toString now returns hex instead of WIF
This commit is contained in:
commit
eca20ad297
2 changed files with 10 additions and 14 deletions
|
@ -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;
|
||||
|
|
|
@ -33,20 +33,16 @@ describe('HDWallet', function() {
|
|||
})
|
||||
|
||||
describe('constructor & seed deserialization', function() {
|
||||
var expectedPrivKey, seed;
|
||||
|
||||
beforeEach(function(){
|
||||
expectedPrivKey = 'KwkW62Lzm4a7Eo5nPLezrVjWBGFh2KMfpyf4Swz9NmfsVaLoeXv9'
|
||||
seed = [
|
||||
99, 114, 97, 122, 121, 32, 104, 111, 114, 115, 101, 32, 98,
|
||||
97, 116, 116, 101, 114, 121, 32, 115, 116, 97, 112, 108, 101
|
||||
]
|
||||
})
|
||||
var expectedPrivateKey = '0fd71c652e847ba7ea7956e3cf3fc0a0985871846b1b2c23b9c6a29a38cee86001';
|
||||
var seed = [
|
||||
99, 114, 97, 122, 121, 32, 104, 111, 114, 115, 101, 32, 98,
|
||||
97, 116, 116, 101, 114, 121, 32, 115, 116, 97, 112, 108, 101
|
||||
];
|
||||
|
||||
it('creates from binary seed', function() {
|
||||
var hd = new HDWallet(seed)
|
||||
|
||||
assert.equal(hd.priv, expectedPrivKey)
|
||||
assert.equal(hd.priv.toHex(), expectedPrivateKey)
|
||||
assert(hd.pub)
|
||||
})
|
||||
|
||||
|
@ -54,7 +50,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.toHex(), expectedPrivateKey)
|
||||
assert(hd.pub)
|
||||
})
|
||||
})
|
||||
|
@ -63,7 +59,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.toHex(), expectedPrivateKey)
|
||||
assert(hd.pub)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue