add id to keyring.
This commit is contained in:
parent
64ae8c7767
commit
d11f4deef1
@ -39,6 +39,7 @@ function KeyRing(options) {
|
|||||||
this.m = 1;
|
this.m = 1;
|
||||||
this.n = 1;
|
this.n = 1;
|
||||||
this.witness = false;
|
this.witness = false;
|
||||||
|
this.id = null;
|
||||||
this.name = null;
|
this.name = null;
|
||||||
this.account = 0;
|
this.account = 0;
|
||||||
this.change = 0;
|
this.change = 0;
|
||||||
@ -75,6 +76,7 @@ KeyRing.prototype.fromOptions = function fromOptions(options) {
|
|||||||
this.m = options.m || 1;
|
this.m = options.m || 1;
|
||||||
this.n = options.n || 1;
|
this.n = options.n || 1;
|
||||||
this.witness = options.witness || false;
|
this.witness = options.witness || false;
|
||||||
|
this.id = options.id;
|
||||||
this.name = options.name;
|
this.name = options.name;
|
||||||
this.account = options.account;
|
this.account = options.account;
|
||||||
this.change = options.change;
|
this.change = options.change;
|
||||||
@ -578,6 +580,7 @@ KeyRing.prototype.toJSON = function toJSON() {
|
|||||||
m: this.m,
|
m: this.m,
|
||||||
n: this.n,
|
n: this.n,
|
||||||
witness: this.witness,
|
witness: this.witness,
|
||||||
|
id: this.id,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
account: this.account,
|
account: this.account,
|
||||||
change: this.change,
|
change: this.change,
|
||||||
@ -604,6 +607,7 @@ KeyRing.prototype.fromJSON = function fromJSON(json) {
|
|||||||
this.m = json.m;
|
this.m = json.m;
|
||||||
this.n = json.n;
|
this.n = json.n;
|
||||||
this.witness = json.witness;
|
this.witness = json.witness;
|
||||||
|
this.id = json.id;
|
||||||
this.name = json.name;
|
this.name = json.name;
|
||||||
this.account = json.account;
|
this.account = json.account;
|
||||||
this.change = json.change;
|
this.change = json.change;
|
||||||
@ -640,6 +644,7 @@ KeyRing.prototype.toRaw = function toRaw(writer) {
|
|||||||
p.writeU8(this.m);
|
p.writeU8(this.m);
|
||||||
p.writeU8(this.n);
|
p.writeU8(this.n);
|
||||||
p.writeU8(this.witness ? 1 : 0);
|
p.writeU8(this.witness ? 1 : 0);
|
||||||
|
p.writeVarString(this.id, 'utf8');
|
||||||
p.writeVarString(this.name, 'utf8');
|
p.writeVarString(this.name, 'utf8');
|
||||||
p.writeU32(this.account);
|
p.writeU32(this.account);
|
||||||
p.writeU32(this.change);
|
p.writeU32(this.change);
|
||||||
@ -671,6 +676,7 @@ KeyRing.prototype.fromRaw = function fromRaw(data) {
|
|||||||
this.m = p.readU8();
|
this.m = p.readU8();
|
||||||
this.n = p.readU8();
|
this.n = p.readU8();
|
||||||
this.witness = p.readU8() === 1;
|
this.witness = p.readU8() === 1;
|
||||||
|
this.id = p.readVarString('utf8');
|
||||||
this.name = p.readVarString('utf8');
|
this.name = p.readVarString('utf8');
|
||||||
this.account = p.readU32();
|
this.account = p.readU32();
|
||||||
this.change = p.readU32();
|
this.change = p.readU32();
|
||||||
|
|||||||
@ -1967,6 +1967,7 @@ Account.prototype.deriveAddress = function deriveAddress(change, index) {
|
|||||||
return new bcoin.keyring({
|
return new bcoin.keyring({
|
||||||
network: this.network,
|
network: this.network,
|
||||||
key: key.publicKey,
|
key: key.publicKey,
|
||||||
|
id: this.id,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
account: this.accountIndex,
|
account: this.accountIndex,
|
||||||
change: change,
|
change: change,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user