From 6af9ee68e2a314d8741ae16f544ef5755722df0c Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Fri, 30 May 2014 15:07:52 -0300 Subject: [PATCH] include derivation path in tx proposal --- js/models/core/PrivateKey.js | 12 ++++++++++-- js/models/core/PublicKeyRing.js | 11 ++++++++++- js/models/core/TxProposals.js | 1 + js/models/core/Wallet.js | 16 ++++++++++++---- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/js/models/core/PrivateKey.js b/js/models/core/PrivateKey.js index 086f2561b..cc2a4d715 100644 --- a/js/models/core/PrivateKey.js +++ b/js/models/core/PrivateKey.js @@ -61,8 +61,11 @@ PrivateKey.prototype._getHK = function(path) { return this.bip.derive(path); }; -PrivateKey.prototype.get = function(index,isChange) { - var path = Structure.FullBranch(index, isChange); +PrivateKey.prototype.getForPaths = function(paths) { + return paths.map(this.getForPath.bind(this)); +}; + +PrivateKey.prototype.getForPath = function(path) { var pk = this.privateKeyCache[path]; if (!pk) { var derivedHK = this._getHK(path); @@ -73,6 +76,11 @@ PrivateKey.prototype.get = function(index,isChange) { return wk; }; +PrivateKey.prototype.get = function(index,isChange) { + var path = Structure.FullBranch(index, isChange); + return this.getForPath(path); +}; + PrivateKey.prototype.getAll = function(addressIndex, changeAddressIndex) { var ret = []; for(var i=0;i