add jsdocs for inv, getdata and notfound

This commit is contained in:
Braydon Fuller 2015-03-16 11:27:05 -04:00
parent 50d7d37034
commit 4c4d53a4c5
3 changed files with 39 additions and 0 deletions

View File

@ -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);

View File

@ -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)]);
};

View File

@ -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)]);
};