diff --git a/lib/messages/commands/getdata.js b/lib/messages/commands/getdata.js index d23c82e..4035e6e 100644 --- a/lib/messages/commands/getdata.js +++ b/lib/messages/commands/getdata.js @@ -11,6 +11,11 @@ var _ = bitcore.deps._; var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); +/** + * @param {Object|Array} - options - If options is an array will use as "inventory" + * @param {Array} options.inventory - An array of inventory items + * @constructor + */ function GetdataMessage(options) { if (!(this instanceof GetdataMessage)) { return new GetdataMessage(options); diff --git a/lib/messages/commands/inv.js b/lib/messages/commands/inv.js index 9c359b4..9f5065c 100644 --- a/lib/messages/commands/inv.js +++ b/lib/messages/commands/inv.js @@ -11,6 +11,11 @@ var _ = bitcore.deps._; var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); +/** + * @param {Object|Array} - options - If options is an array will use as "inventory" + * @param {Array} options.inventory - An array of inventory items + * @constructor + */ function InvMessage(options) { if (!(this instanceof InvMessage)) { return new InvMessage(options); @@ -33,14 +38,26 @@ function InvMessage(options) { } inherits(InvMessage, Message); +/** + * @param {Buffer|String} hash - The hash of the transaction inventory item + * @returns {InvMessage} + */ InvMessage.forTransaction = function(hash) { return new InvMessage([Inventory.forTransaction(hash)]); }; +/** + * @param {Buffer|String} hash - The hash of the block inventory item + * @returns {InvMessage} + */ InvMessage.forBlock = function(hash) { return new InvMessage([Inventory.forBlock(hash)]); }; +/** + * @param {Buffer|String} hash - The hash of the filtered block inventory item + * @returns {InvMessage} + */ InvMessage.forFilteredBlock = function(hash) { return new InvMessage([Inventory.forFilteredBlock(hash)]); }; diff --git a/lib/messages/commands/notfound.js b/lib/messages/commands/notfound.js index 61caa47..8e124a2 100644 --- a/lib/messages/commands/notfound.js +++ b/lib/messages/commands/notfound.js @@ -11,6 +11,11 @@ var _ = bitcore.deps._; var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); +/** + * @param {Object|Array} - options - If options is an array will use as "inventory" + * @param {Array} options.inventory - An array of inventory items + * @constructor + */ function NotfoundMessage(options) { if (!(this instanceof NotfoundMessage)) { return new NotfoundMessage(options); @@ -33,14 +38,26 @@ function NotfoundMessage(options) { } inherits(NotfoundMessage, Message); +/** + * @param {Buffer|String} hash - The hash of the transaction inventory item + * @returns {InvMessage} + */ NotfoundMessage.forTransaction = function(hash) { return new NotfoundMessage([Inventory.forTransaction(hash)]); }; +/** + * @param {Buffer|String} hash - The hash of the block inventory item + * @returns {InvMessage} + */ NotfoundMessage.forBlock = function(hash) { return new NotfoundMessage([Inventory.forBlock(hash)]); }; +/** + * @param {Buffer|String} hash - The hash of the filtered block inventory item + * @returns {InvMessage} + */ NotfoundMessage.forFilteredBlock = function(hash) { return new NotfoundMessage([Inventory.forFilteredBlock(hash)]); };