walletkey: fix getType in toJSON.

This commit is contained in:
Christopher Jeffrey 2017-06-17 18:49:28 -07:00
parent 3db140e119
commit 7129370b2b
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -7,10 +7,11 @@
'use strict';
var KeyRing = require('../primitives/keyring');
var util = require('../utils/util');
var Path = require('./path');
var Address = require('../primitives/address');
var KeyRing = require('../primitives/keyring');
var Script = require('../script/script');
var Path = require('./path');
/**
* Represents a key ring which amounts to an address.
@ -133,7 +134,7 @@ WalletKey.prototype.toJSON = function toJSON() {
publicKey: this.publicKey.toString('hex'),
script: this.script ? this.script.toRaw().toString('hex') : null,
program: this.witness ? this.getProgram().toRaw().toString('hex') : null,
type: Script.typesByVal[this.getType()].toLowerCase(),
type: Address.typesByVal[this.getType()].toLowerCase(),
address: this.getAddress('string')
};
};