pass index around.
This commit is contained in:
parent
51b0d83444
commit
7de73c670c
@ -37,6 +37,7 @@ function Address(options) {
|
||||
this.derived = !!options.derived;
|
||||
|
||||
this.key = bcoin.keypair(options);
|
||||
this.index = options.index;
|
||||
this.path = options.path;
|
||||
|
||||
this.type = options.type || 'pubkeyhash';
|
||||
@ -519,6 +520,7 @@ Address.prototype.toJSON = function toJSON(encrypt) {
|
||||
label: this.label,
|
||||
change: this.change,
|
||||
derived: this.derived,
|
||||
index: this.index,
|
||||
path: this.path,
|
||||
address: this.getKeyAddress(),
|
||||
scriptAddress: this.getScriptAddress(),
|
||||
@ -545,6 +547,7 @@ Address.fromJSON = function fromJSON(json, decrypt) {
|
||||
label: json.label,
|
||||
change: json.change,
|
||||
derived: json.derived,
|
||||
index: json.index,
|
||||
path: json.path,
|
||||
key: bcoin.keypair.fromJSON(json.key, decrypt),
|
||||
type: json.type,
|
||||
|
||||
@ -168,6 +168,7 @@ function Wallet(options) {
|
||||
privateKey: key.privateKey,
|
||||
publicKey: key.publicKey,
|
||||
compressed: key.compressed,
|
||||
index: key.index,
|
||||
path: key.path,
|
||||
type: this.type,
|
||||
subtype: this.subtype,
|
||||
@ -192,6 +193,7 @@ function Wallet(options) {
|
||||
privateKey: key.privateKey,
|
||||
publicKey: key.publicKey,
|
||||
compressed: key.compressed,
|
||||
index: key.index,
|
||||
path: key.path,
|
||||
type: this.type,
|
||||
subtype: this.subtype,
|
||||
@ -561,6 +563,7 @@ Wallet.prototype.createAddress = function createAddress(change, index) {
|
||||
privateKey: key.privateKey,
|
||||
publicKey: key.publicKey,
|
||||
compressed: key.compressed,
|
||||
index: key.index,
|
||||
path: key.path,
|
||||
type: this.type,
|
||||
subtype: this.subtype,
|
||||
@ -751,7 +754,11 @@ Wallet.prototype.createKey = function createKey(change, index) {
|
||||
privateKey: key.privateKey,
|
||||
publicKey: key.publicKey,
|
||||
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