From 8d5d6dbd889877895629cc275ff160ec6db098d5 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 19 May 2016 18:27:27 -0700 Subject: [PATCH] update docs pertaining to address maps. --- lib/bcoin/input.js | 4 ++-- lib/bcoin/output.js | 2 +- lib/bcoin/tx.js | 8 ++++---- lib/bcoin/types.js | 16 ++++++++++++++-- lib/bcoin/wallet.js | 3 ++- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/lib/bcoin/input.js b/lib/bcoin/input.js index 0c0f5da8..37557e9d 100644 --- a/lib/bcoin/input.js +++ b/lib/bcoin/input.js @@ -207,8 +207,8 @@ Input.prototype.isCoinbase = function isCoinbase() { /** * Test the input against an address, an - * array of addresses, or a map of addresses. - * @param {String|String[]|Object} addressMap + * array of addresses, or a map of hashes. + * @param {Hash|Hash[]|AddressHashMap} addressMap * @returns {Boolean} Whether the input matched. */ diff --git a/lib/bcoin/output.js b/lib/bcoin/output.js index b9512b9e..0e054ae2 100644 --- a/lib/bcoin/output.js +++ b/lib/bcoin/output.js @@ -99,7 +99,7 @@ Output.prototype.getHash = function getHash() { /** * Test the output against an address, an * array of addresses, or a map of addresses. - * @param {String|String[]|Object} addressMap + * @param {Hash|Hash[]|AddressHashMap} addressMap * @returns {Boolean} Whether the output matched. */ diff --git a/lib/bcoin/tx.js b/lib/bcoin/tx.js index 00f06b90..b726834f 100644 --- a/lib/bcoin/tx.js +++ b/lib/bcoin/tx.js @@ -835,8 +835,8 @@ TX.prototype.getHashes = function getHashes() { /** * Test the inputs against an address, an - * array of addresses, or a map of addresses. - * @param {Base58Address|Base58Address[]|Object} addressMap + * array of address hashes, or a map of address hashes. + * @param {Hash|Hash[]|AddressHashMap} addressMap * @param {Number?} index * @returns {Boolean} Whether the transaction matched. */ @@ -866,8 +866,8 @@ TX.prototype.testInputs = function testInputs(addressMap, index) { /** * Test the outputs against an address, an - * array of addresses, or a map of addresses. - * @param {Base58Address|Base58Address[]|Object} addressMap + * array of address hashes, or a map of address hashes. + * @param {Hash|Hash[]|AddressHashMap} addressMap * @param {Number?} index * @returns {Boolean} Whether the transaction matched. */ diff --git a/lib/bcoin/types.js b/lib/bcoin/types.js index 382dfc63..04ff8aa7 100644 --- a/lib/bcoin/types.js +++ b/lib/bcoin/types.js @@ -47,6 +47,18 @@ * @global */ +/** + * A map of addresses ({@link Base58Address} -> value). + * @typedef {Object} AddressMap + * @global + */ + +/** + * A map of address hashes ({@link Hash} -> value). + * @typedef {Object} AddressHashMap + * @global + */ + /** * @typedef {Object} ParsedURI * @property {Base58Address} address @@ -107,8 +119,8 @@ * A satoshi amount. This is technically a * JS double float, but it is regularly * enforced to be less than 53 bits and - * less than MAX_MONEY regularly in - * various functions. + * less than MAX_MONEY in various + * functions. * @typedef {Number} Amount * @global */ diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index cc43fe84..fe6cd7d9 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -21,7 +21,8 @@ var BufferWriter = require('./writer'); * present, no coins will be available. * @param {(HDPrivateKey|HDPublicKey)?} options.master - Master HD key. If not * present, it will be generated. - * @param {Object?} options.addressMap - Map of addresses to paths (internal). + * @param {AddressHashMap?} options.addressMap - Map of address + * hashes to paths (internal). * @param {Boolean?} options.witness - Whether to use witness programs. * @param {Number?} options.accountIndex - The BIP44 account index (default=0). * @param {Number?} options.receiveDepth - The index of the _next_ receiving