diff --git a/copay.js b/copay.js index 9149fa071..585fc1677 100644 --- a/copay.js +++ b/copay.js @@ -5,6 +5,7 @@ module.exports.TxProposals = require('./js/models/core/TxProposals'); module.exports.PrivateKey = require('./js/models/core/PrivateKey'); module.exports.Passphrase = require('./js/models/core/Passphrase'); module.exports.Structure = require('./js/models/core/Structure'); +module.exports.AddressIndex = require('./js/models/core/AddressIndex'); // components diff --git a/js/models/core/AddressIndex.js b/js/models/core/AddressIndex.js index b5a4aab68..14e42ffc6 100644 --- a/js/models/core/AddressIndex.js +++ b/js/models/core/AddressIndex.js @@ -37,7 +37,7 @@ AddressIndex.prototype.toObj = function() { }; }; -AddressIndex.prototype._checkIndexRange = function(index, isChange) { +AddressIndex.prototype.checkRange = function(index, isChange) { if ((isChange && index > this.changeIndex) || (!isChange && index > this.receiveIndex)) { throw new Error('Out of bounds at index %d isChange: %d', index, isChange); @@ -45,10 +45,10 @@ AddressIndex.prototype._checkIndexRange = function(index, isChange) { }; -AddressIndex.prorotype.getChangeIndex = function() { +AddressIndex.prototype.getChangeIndex = function() { return this.changeIndex; }; -AddressIndex.prorotype.getReceiveIndex = function() { +AddressIndex.prototype.getReceiveIndex = function() { return this.receiveIndex; }; diff --git a/js/models/core/PrivateKey.js b/js/models/core/PrivateKey.js index d324f1831..7475f9146 100644 --- a/js/models/core/PrivateKey.js +++ b/js/models/core/PrivateKey.js @@ -82,6 +82,9 @@ PrivateKey.prototype.get = function(index,isChange) { }; PrivateKey.prototype.getAll = function(receiveIndex, changeIndex) { + if (typeof receiveIndex === 'undefined' || typeof changeIndex === 'undefined') + throw new Error('Invalid parameters'); + var ret = []; for(var i=0;i