Fix JSDoc for script
This commit is contained in:
parent
d688222769
commit
c1a1571535
|
@ -214,7 +214,7 @@ Script.prototype.inspect = function() {
|
|||
// script classification methods
|
||||
|
||||
/**
|
||||
* @returns true if this is a pay to pubkey hash output script
|
||||
* @returns {boolean} if this is a pay to pubkey hash output script
|
||||
*/
|
||||
Script.prototype.isPublicKeyHashOut = function() {
|
||||
return !!(this.chunks.length === 5 &&
|
||||
|
@ -226,7 +226,7 @@ Script.prototype.isPublicKeyHashOut = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns true if this is a pay to public key hash input script
|
||||
* @returns {boolean} if this is a pay to public key hash input script
|
||||
*/
|
||||
Script.prototype.isPublicKeyHashIn = function() {
|
||||
return this.chunks.length === 2 &&
|
||||
|
@ -242,7 +242,7 @@ Script.prototype.getPublicKeyHash = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns true if this is a public key output script
|
||||
* @returns {boolean} if this is a public key output script
|
||||
*/
|
||||
Script.prototype.isPublicKeyOut = function() {
|
||||
return this.chunks.length === 2 &&
|
||||
|
@ -252,7 +252,7 @@ Script.prototype.isPublicKeyOut = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns true if this is a pay to public key input script
|
||||
* @returns {boolean} if this is a pay to public key input script
|
||||
*/
|
||||
Script.prototype.isPublicKeyIn = function() {
|
||||
return this.chunks.length === 1 &&
|
||||
|
@ -262,7 +262,7 @@ Script.prototype.isPublicKeyIn = function() {
|
|||
|
||||
|
||||
/**
|
||||
* @returns true if this is a p2sh output script
|
||||
* @returns {boolean} if this is a p2sh output script
|
||||
*/
|
||||
Script.prototype.isScriptHashOut = function() {
|
||||
var buf = this.toBuffer();
|
||||
|
@ -273,7 +273,7 @@ Script.prototype.isScriptHashOut = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns true if this is a p2sh input script
|
||||
* @returns {boolean} if this is a p2sh input script
|
||||
* Note that these are frequently indistinguishable from pubkeyhashin
|
||||
*/
|
||||
Script.prototype.isScriptHashIn = function() {
|
||||
|
@ -294,7 +294,7 @@ Script.prototype.isScriptHashIn = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns true if this is a mutlsig output script
|
||||
* @returns {boolean} if this is a mutlsig output script
|
||||
*/
|
||||
Script.prototype.isMultisigOut = function() {
|
||||
return (this.chunks.length > 3 &&
|
||||
|
@ -308,7 +308,7 @@ Script.prototype.isMultisigOut = function() {
|
|||
|
||||
|
||||
/**
|
||||
* @returns true if this is a multisig input script
|
||||
* @returns {boolean} if this is a multisig input script
|
||||
*/
|
||||
Script.prototype.isMultisigIn = function() {
|
||||
return this.chunks.length >= 2 &&
|
||||
|
@ -321,7 +321,7 @@ Script.prototype.isMultisigIn = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns true if this is an OP_RETURN data script
|
||||
* @returns {boolean} if this is an OP_RETURN data script
|
||||
*/
|
||||
Script.prototype.isDataOut = function() {
|
||||
return this.chunks.length >= 1 &&
|
||||
|
@ -350,7 +350,7 @@ Script.prototype.getData = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns true if the script is only composed of data pushing
|
||||
* @returns {boolean} if the script is only composed of data pushing
|
||||
* opcodes or small int opcodes (OP_0, OP_1, ..., OP_16)
|
||||
*/
|
||||
Script.prototype.isPushOnly = function() {
|
||||
|
@ -398,7 +398,7 @@ Script.prototype.classify = function() {
|
|||
|
||||
|
||||
/**
|
||||
* @returns true if script is one of the known types
|
||||
* @returns {boolean} if script is one of the known types
|
||||
*/
|
||||
Script.prototype.isStandard = function() {
|
||||
// TODO: Add BIP62 compliance
|
||||
|
@ -531,7 +531,7 @@ Script.prototype.removeCodeseparators = function() {
|
|||
// high level script builder methods
|
||||
|
||||
/**
|
||||
* @returns a new Multisig output script for given public keys,
|
||||
* @returns {Script} a new Multisig output script for given public keys,
|
||||
* requiring m of those public keys to spend
|
||||
* @param {PublicKey[]} publicKeys - list of all public keys controlling the output
|
||||
* @param {number} threshold - amount of required signatures to spend the output
|
||||
|
@ -569,7 +569,7 @@ Script.buildMultisigOut = function(publicKeys, threshold, opts) {
|
|||
* @param {boolean=} opts.noSorting don't sort the given public keys before creating the script (false by default)
|
||||
* @param {Script=} opts.cachedMultisig don't recalculate the redeemScript
|
||||
*
|
||||
* @returns Script
|
||||
* @returns {Script}
|
||||
*/
|
||||
Script.buildP2SHMultisigIn = function(pubkeys, threshold, signatures, opts) {
|
||||
$.checkArgument(_.isArray(pubkeys));
|
||||
|
@ -586,7 +586,7 @@ Script.buildP2SHMultisigIn = function(pubkeys, threshold, signatures, opts) {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns a new pay to public key hash output for the given
|
||||
* @returns {Script} a new pay to public key hash output for the given
|
||||
* address or public key
|
||||
* @param {(Address|PublicKey)} to - destination address or public key
|
||||
*/
|
||||
|
@ -608,7 +608,7 @@ Script.buildPublicKeyHashOut = function(to) {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns a new pay to public key output for the given
|
||||
* @returns {Script} a new pay to public key output for the given
|
||||
* public key
|
||||
*/
|
||||
Script.buildPublicKeyOut = function(pubkey) {
|
||||
|
@ -620,7 +620,7 @@ Script.buildPublicKeyOut = function(pubkey) {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns a new OP_RETURN script with data
|
||||
* @returns {Script} a new OP_RETURN script with data
|
||||
* @param {(string|Buffer)} to - the data to embed in the output
|
||||
*/
|
||||
Script.buildDataOut = function(data) {
|
||||
|
@ -639,7 +639,7 @@ Script.buildDataOut = function(data) {
|
|||
/**
|
||||
* @param {Script|Address} script - the redeemScript for the new p2sh output.
|
||||
* It can also be a p2sh address
|
||||
* @returns Script new pay to script hash script for given script
|
||||
* @returns {Script} new pay to script hash script for given script
|
||||
*/
|
||||
Script.buildScriptHashOut = function(script) {
|
||||
$.checkArgument(script instanceof Script ||
|
||||
|
@ -675,21 +675,21 @@ Script.buildPublicKeyHashIn = function(publicKey, signature, sigtype) {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns Script an empty script
|
||||
* @returns {Script} an empty script
|
||||
*/
|
||||
Script.empty = function() {
|
||||
return new Script();
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns Script a new pay to script hash script that pays to this script
|
||||
* @returns {Script} a new pay to script hash script that pays to this script
|
||||
*/
|
||||
Script.prototype.toScriptHashOut = function() {
|
||||
return Script.buildScriptHashOut(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return Script a script built from the address
|
||||
* @return {Script} a script built from the address
|
||||
*/
|
||||
Script.fromAddress = function(address) {
|
||||
address = Address(address);
|
||||
|
@ -702,7 +702,7 @@ Script.fromAddress = function(address) {
|
|||
};
|
||||
|
||||
/**
|
||||
* @return Address the associated address for this script
|
||||
* @return {Address} the associated address for this script
|
||||
*/
|
||||
Script.prototype.toAddress = function(network) {
|
||||
network = Networks.get(network);
|
||||
|
@ -741,8 +741,8 @@ Script.prototype.findAndDelete = function(script) {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns true if the chunk {i} is the smallest way to push that particular data.
|
||||
* Comes from bitcoind's script interpreter CheckMinimalPush function
|
||||
* @returns {boolean} if the chunk {i} is the smallest way to push that particular data.
|
||||
*/
|
||||
Script.prototype.checkMinimalPush = function(i) {
|
||||
var chunk = this.chunks[i];
|
||||
|
|
Loading…
Reference in New Issue