pass index around.
This commit is contained in:
parent
51b0d83444
commit
7de73c670c
@ -37,6 +37,7 @@ function Address(options) {
|
|||||||
this.derived = !!options.derived;
|
this.derived = !!options.derived;
|
||||||
|
|
||||||
this.key = bcoin.keypair(options);
|
this.key = bcoin.keypair(options);
|
||||||
|
this.index = options.index;
|
||||||
this.path = options.path;
|
this.path = options.path;
|
||||||
|
|
||||||
this.type = options.type || 'pubkeyhash';
|
this.type = options.type || 'pubkeyhash';
|
||||||
@ -519,6 +520,7 @@ Address.prototype.toJSON = function toJSON(encrypt) {
|
|||||||
label: this.label,
|
label: this.label,
|
||||||
change: this.change,
|
change: this.change,
|
||||||
derived: this.derived,
|
derived: this.derived,
|
||||||
|
index: this.index,
|
||||||
path: this.path,
|
path: this.path,
|
||||||
address: this.getKeyAddress(),
|
address: this.getKeyAddress(),
|
||||||
scriptAddress: this.getScriptAddress(),
|
scriptAddress: this.getScriptAddress(),
|
||||||
@ -545,6 +547,7 @@ Address.fromJSON = function fromJSON(json, decrypt) {
|
|||||||
label: json.label,
|
label: json.label,
|
||||||
change: json.change,
|
change: json.change,
|
||||||
derived: json.derived,
|
derived: json.derived,
|
||||||
|
index: json.index,
|
||||||
path: json.path,
|
path: json.path,
|
||||||
key: bcoin.keypair.fromJSON(json.key, decrypt),
|
key: bcoin.keypair.fromJSON(json.key, decrypt),
|
||||||
type: json.type,
|
type: json.type,
|
||||||
|
|||||||
@ -168,6 +168,7 @@ function Wallet(options) {
|
|||||||
privateKey: key.privateKey,
|
privateKey: key.privateKey,
|
||||||
publicKey: key.publicKey,
|
publicKey: key.publicKey,
|
||||||
compressed: key.compressed,
|
compressed: key.compressed,
|
||||||
|
index: key.index,
|
||||||
path: key.path,
|
path: key.path,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
subtype: this.subtype,
|
subtype: this.subtype,
|
||||||
@ -192,6 +193,7 @@ function Wallet(options) {
|
|||||||
privateKey: key.privateKey,
|
privateKey: key.privateKey,
|
||||||
publicKey: key.publicKey,
|
publicKey: key.publicKey,
|
||||||
compressed: key.compressed,
|
compressed: key.compressed,
|
||||||
|
index: key.index,
|
||||||
path: key.path,
|
path: key.path,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
subtype: this.subtype,
|
subtype: this.subtype,
|
||||||
@ -561,6 +563,7 @@ Wallet.prototype.createAddress = function createAddress(change, index) {
|
|||||||
privateKey: key.privateKey,
|
privateKey: key.privateKey,
|
||||||
publicKey: key.publicKey,
|
publicKey: key.publicKey,
|
||||||
compressed: key.compressed,
|
compressed: key.compressed,
|
||||||
|
index: key.index,
|
||||||
path: key.path,
|
path: key.path,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
subtype: this.subtype,
|
subtype: this.subtype,
|
||||||
@ -751,7 +754,11 @@ Wallet.prototype.createKey = function createKey(change, index) {
|
|||||||
privateKey: key.privateKey,
|
privateKey: key.privateKey,
|
||||||
publicKey: key.publicKey,
|
publicKey: key.publicKey,
|
||||||
compressed: true,
|
compressed: true,
|
||||||
path: 'm/' + (change ? 1 : 0) + '/' + index
|
index: index,
|
||||||
|
path: 'm'
|
||||||
|
// + (this.derivation === 'bip45' ? '/' + this.cosignerIndex : '')
|
||||||
|
+ '/' + (change ? 1 : 0)
|
||||||
|
+ '/' + index
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user