add id to keyring.

This commit is contained in:
Christopher Jeffrey 2016-06-27 16:34:39 -07:00
parent 64ae8c7767
commit d11f4deef1
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 7 additions and 0 deletions

View File

@ -39,6 +39,7 @@ function KeyRing(options) {
this.m = 1;
this.n = 1;
this.witness = false;
this.id = null;
this.name = null;
this.account = 0;
this.change = 0;
@ -75,6 +76,7 @@ KeyRing.prototype.fromOptions = function fromOptions(options) {
this.m = options.m || 1;
this.n = options.n || 1;
this.witness = options.witness || false;
this.id = options.id;
this.name = options.name;
this.account = options.account;
this.change = options.change;
@ -578,6 +580,7 @@ KeyRing.prototype.toJSON = function toJSON() {
m: this.m,
n: this.n,
witness: this.witness,
id: this.id,
name: this.name,
account: this.account,
change: this.change,
@ -604,6 +607,7 @@ KeyRing.prototype.fromJSON = function fromJSON(json) {
this.m = json.m;
this.n = json.n;
this.witness = json.witness;
this.id = json.id;
this.name = json.name;
this.account = json.account;
this.change = json.change;
@ -640,6 +644,7 @@ KeyRing.prototype.toRaw = function toRaw(writer) {
p.writeU8(this.m);
p.writeU8(this.n);
p.writeU8(this.witness ? 1 : 0);
p.writeVarString(this.id, 'utf8');
p.writeVarString(this.name, 'utf8');
p.writeU32(this.account);
p.writeU32(this.change);
@ -671,6 +676,7 @@ KeyRing.prototype.fromRaw = function fromRaw(data) {
this.m = p.readU8();
this.n = p.readU8();
this.witness = p.readU8() === 1;
this.id = p.readVarString('utf8');
this.name = p.readVarString('utf8');
this.account = p.readU32();
this.change = p.readU32();

View File

@ -1967,6 +1967,7 @@ Account.prototype.deriveAddress = function deriveAddress(change, index) {
return new bcoin.keyring({
network: this.network,
key: key.publicKey,
id: this.id,
name: this.name,
account: this.accountIndex,
change: change,