@dashevo/dashcore-lib
Advanced tools
Comparing version 0.18.1 to 0.18.2
@@ -251,2 +251,3 @@ /* eslint-disable */ | ||
* @param {Script} script - An instance of Script | ||
* @param {Network|String} network - either a Network instance, 'livenet', or 'testnet' | ||
* @returns {Object} An object with keys: hashBuffer, type | ||
@@ -402,3 +403,3 @@ * @private | ||
* | ||
* @param {string} json - An JSON string or Object with keys: hash, network and type | ||
* @param {string} obj - An JSON string or Object with keys: hash, network and type | ||
* @returns {Address} A new valid instance of an Address | ||
@@ -405,0 +406,0 @@ */ |
@@ -20,3 +20,3 @@ /* eslint-disable */ | ||
* | ||
* @param {*} - A Buffer, JSON string, or Object | ||
* @param {Buffer|Block.fromObjectParams} arg - A Buffer, JSON string, or Object | ||
* @returns {Block} | ||
@@ -37,3 +37,3 @@ * @constructor | ||
/** | ||
* @param {*} - A Buffer, JSON string or Object | ||
* @param {Buffer|Block.fromObjectParams} arg - A Buffer, JSON string or Object | ||
* @returns {Object} - An object representing block data | ||
@@ -70,3 +70,5 @@ * @throws {TypeError} - If the argument was not recognized | ||
var info = { | ||
/** @type {BlockHeader} */ | ||
header: BlockHeader.fromObject(data.header), | ||
/** @type {Transaction[]} */ | ||
transactions: transactions | ||
@@ -78,3 +80,3 @@ }; | ||
/** | ||
* @param {Object} - A plain JavaScript object | ||
* @property {Block.fromObjectParams} obj - A plain JavaScript object | ||
* @returns {Block} - An instance of block | ||
@@ -88,3 +90,3 @@ */ | ||
/** | ||
* @param {BufferReader} - Block data | ||
* @param {BufferReader} br - Block data | ||
* @returns {Object} - An object representing the block data | ||
@@ -148,3 +150,3 @@ * @private | ||
* @function | ||
* @returns {Object} - A plain object with the block properties | ||
* @returns {BlockHeader.toObjectParams} - A plain object with the block properties | ||
*/ | ||
@@ -177,3 +179,3 @@ Block.prototype.toObject = Block.prototype.toJSON = function toObject() { | ||
/** | ||
* @param {BufferWriter} - An existing instance of BufferWriter | ||
* @param {BufferWriter} bw - An existing instance of BufferWriter | ||
* @returns {BufferWriter} - An instance of BufferWriter representation of the Block | ||
@@ -195,3 +197,3 @@ */ | ||
* Will iterate through each transaction and return an array of hashes | ||
* @returns {Array} - An array with transaction hashes | ||
* @returns {Buffer[]} - An array with transaction hashes | ||
*/ | ||
@@ -213,3 +215,3 @@ Block.prototype.getTransactionHashes = function getTransactionHashes() { | ||
* @link https://en.bitcoin.it/wiki/Protocol_specification#Merkle_Trees | ||
* @returns {Array} - An array with each level of the tree after the other. | ||
* @returns {Buffer[]} - An array with each level of the tree after the other. | ||
*/ | ||
@@ -216,0 +218,0 @@ Block.prototype.getMerkleTree = function getMerkleTree() { |
@@ -21,3 +21,3 @@ /* eslint-disable */ | ||
* | ||
* @param {*} - A Buffer, JSON string, or Object | ||
* @param {BlockHeader.fromObjectParams|Buffer} arg - A Buffer, JSON string, or Object | ||
* @returns {BlockHeader} - An instance of block header | ||
@@ -50,3 +50,3 @@ * @constructor | ||
/** | ||
* @param {*} - A Buffer, JSON string or Object | ||
* @param {BlockHeader.fromObjectParams|Buffer} arg - A Buffer, JSON string or Object | ||
* @returns {Object} - An object representing block header data | ||
@@ -69,3 +69,3 @@ * @throws {TypeError} - If the argument was not recognized | ||
/** | ||
* @param {Object} - A JSON string | ||
* @param {BlockHeader.fromObjectParams} data - A plain JavaScript object | ||
* @returns {Object} - An object representing block header data | ||
@@ -98,3 +98,3 @@ * @private | ||
/** | ||
* @param {Object} - A plain JavaScript object | ||
* @param {BlockHeader.fromObjectParams} obj - A plain JavaScript object | ||
* @returns {BlockHeader} - An instance of block header | ||
@@ -122,3 +122,3 @@ */ | ||
/** | ||
* @param {Buffer} - A buffer of the block header | ||
* @param {Buffer} buf - A buffer of the block header | ||
* @returns {BlockHeader} - An instance of block header | ||
@@ -132,3 +132,3 @@ */ | ||
/** | ||
* @param {string} - A hex encoded buffer of the block header | ||
* @param {string} str - A hex encoded buffer of the block header | ||
* @returns {BlockHeader} - An instance of block header | ||
@@ -142,3 +142,3 @@ */ | ||
/** | ||
* @param {BufferReader} - A BufferReader of the block header | ||
* @param {BufferReader} br - A BufferReader of the block header | ||
* @returns {Object} - An object representing block header data | ||
@@ -159,3 +159,3 @@ * @private | ||
/** | ||
* @param {BufferReader} - A BufferReader of the block header | ||
* @param {BufferReader} br - A BufferReader of the block header | ||
* @returns {BlockHeader} - An instance of block header | ||
@@ -199,3 +199,3 @@ */ | ||
/** | ||
* @param {BufferWriter} - An existing instance BufferWriter | ||
* @param {BufferWriter} bw - An existing instance BufferWriter | ||
* @returns {BufferWriter} - An instance of BufferWriter representation of the BlockHeader | ||
@@ -202,0 +202,0 @@ */ |
@@ -98,3 +98,3 @@ /* eslint-disable */ | ||
/** | ||
* @param {Buffer} - MerkleBlock data in a Buffer object | ||
* @param {Buffer} buf - MerkleBlock data in a Buffer object | ||
* @returns {MerkleBlock} - A MerkleBlock object | ||
@@ -107,3 +107,3 @@ */ | ||
/** | ||
* @param {BufferReader} - MerkleBlock data in a BufferReader object | ||
* @param {BufferReader} br - MerkleBlock data in a BufferReader object | ||
* @returns {MerkleBlock} - A MerkleBlock object | ||
@@ -123,3 +123,3 @@ */ | ||
/** | ||
* @param {BufferWriter} - An existing instance of BufferWriter | ||
* @param {BufferWriter} bw - An existing instance of BufferWriter | ||
* @returns {BufferWriter} - An instance of BufferWriter representation of the MerkleBlock | ||
@@ -282,3 +282,3 @@ */ | ||
/** | ||
* @param {Buffer} - MerkleBlock data | ||
* @param {Buffer} br - MerkleBlock data | ||
* @returns {Object} - An Object representing merkleblock data | ||
@@ -306,4 +306,4 @@ * @private | ||
/** | ||
* @param {Object} - A plain JavaScript object | ||
* @returns {Block} - An instance of block | ||
* @param {Object} obj - A plain JavaScript object | ||
* @returns {MerkleBlock} - An instance of MerkleBlock | ||
*/ | ||
@@ -310,0 +310,0 @@ MerkleBlock.fromObject = function fromObject(obj) { |
@@ -15,2 +15,3 @@ /* eslint-disable */ | ||
* @param {Buffer} payload | ||
* @return Filter | ||
*/ | ||
@@ -32,2 +33,4 @@ BloomFilter.fromBuffer = function fromBuffer(payload) { | ||
/** | ||
* Will return a buffer representation of the address | ||
* | ||
* @memberOf BloomFilter | ||
@@ -34,0 +37,0 @@ * @returns {Buffer} |
@@ -19,2 +19,3 @@ /* eslint-disable */ | ||
* @param {BN|String} y - The Y coordinate | ||
* @param {Boolean} isRed - Force redgomery representation when loading from JSON | ||
* @link https://github.com/indutny/elliptic | ||
@@ -21,0 +22,0 @@ * @augments elliptic.curve.point |
@@ -59,2 +59,6 @@ /* eslint-disable */ | ||
/** | ||
* Return the whole buffer | ||
* @return {Buffer} | ||
*/ | ||
BufferReader.prototype.readAll = function() { | ||
@@ -66,2 +70,6 @@ var buf = this.buf.slice(this.pos, this.buf.length); | ||
/** | ||
* Read the next UInt8 | ||
* @return {number} | ||
*/ | ||
BufferReader.prototype.readUInt8 = function() { | ||
@@ -73,2 +81,6 @@ var val = this.buf.readUInt8(this.pos); | ||
/** | ||
* Read the next UInt16BE | ||
* @return {number} | ||
*/ | ||
BufferReader.prototype.readUInt16BE = function() { | ||
@@ -80,2 +92,6 @@ var val = this.buf.readUInt16BE(this.pos); | ||
/** | ||
* Read the next UInt16LE | ||
* @return {number} | ||
*/ | ||
BufferReader.prototype.readUInt16LE = function() { | ||
@@ -87,2 +103,6 @@ var val = this.buf.readUInt16LE(this.pos); | ||
/** | ||
* Read the next UInt32BE | ||
* @return {number} | ||
*/ | ||
BufferReader.prototype.readUInt32BE = function() { | ||
@@ -94,2 +114,6 @@ var val = this.buf.readUInt32BE(this.pos); | ||
/** | ||
* Read the next UInt32LE | ||
* @return {number} | ||
*/ | ||
BufferReader.prototype.readUInt32LE = function() { | ||
@@ -101,2 +125,6 @@ var val = this.buf.readUInt32LE(this.pos); | ||
/** | ||
* Read the next Int32LE | ||
* @return {number} | ||
*/ | ||
BufferReader.prototype.readInt32LE = function() { | ||
@@ -108,2 +136,6 @@ var val = this.buf.readInt32LE(this.pos); | ||
/** | ||
* Read the next UInt64BEBN | ||
* @return {number} | ||
*/ | ||
BufferReader.prototype.readUInt64BEBN = function() { | ||
@@ -116,2 +148,6 @@ var buf = this.buf.slice(this.pos, this.pos + 8); | ||
/** | ||
* Read the next UInt64LEBN | ||
* @return {number} | ||
*/ | ||
BufferReader.prototype.readUInt64LEBN = function() { | ||
@@ -138,2 +174,6 @@ var second = this.buf.readUInt32LE(this.pos); | ||
/** | ||
* Read the next VarintNum | ||
* @return {number} | ||
*/ | ||
BufferReader.prototype.readVarintNum = function() { | ||
@@ -162,2 +202,3 @@ var first = this.readUInt8(); | ||
* reads a length prepended buffer | ||
* @return {Buffer} | ||
*/ | ||
@@ -172,2 +213,6 @@ BufferReader.prototype.readVarLengthBuffer = function() { | ||
/** | ||
* Read the next VarIntBuffer | ||
* @return {Buffer} | ||
*/ | ||
BufferReader.prototype.readVarintBuf = function() { | ||
@@ -187,2 +232,6 @@ var first = this.buf.readUInt8(this.pos); | ||
/** | ||
* Read the next VarintBN | ||
* @return {BN} | ||
*/ | ||
BufferReader.prototype.readVarintBN = function() { | ||
@@ -202,2 +251,6 @@ var first = this.readUInt8(); | ||
/** | ||
* Reverse buffer locally | ||
* @return {BufferReader} | ||
*/ | ||
BufferReader.prototype.reverse = function() { | ||
@@ -212,2 +265,6 @@ var buf = Buffer.alloc(this.buf.length); | ||
/** | ||
* Read all and reverse | ||
* @return {Buffer} | ||
*/ | ||
BufferReader.prototype.readReverse = function(len) { | ||
@@ -214,0 +271,0 @@ if (_.isUndefined(len)) { |
@@ -24,2 +24,7 @@ /* eslint-disable */ | ||
/** | ||
* Set a list of buffers locally | ||
* @param {Buffer[]} obj.bufs - an array of buffer | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.set = function(obj) { | ||
@@ -30,2 +35,6 @@ this.bufs = obj.bufs || this.bufs || []; | ||
/** | ||
* Returns a buffer which is the concatenation of all the buffers. | ||
* @return {Buffer} | ||
*/ | ||
BufferWriter.prototype.toBuffer = function() { | ||
@@ -35,2 +44,6 @@ return this.concat(); | ||
/** | ||
* Returns a buffer which is the concatenation of all the buffers. | ||
* @return {Buffer} | ||
*/ | ||
BufferWriter.prototype.concat = function() { | ||
@@ -40,2 +53,7 @@ return Buffer.concat(this.bufs); | ||
/** | ||
* Append the buffer locally | ||
* @param {Buffer} buf | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.write = function(buf) { | ||
@@ -47,2 +65,7 @@ assert(bufferUtil.isBuffer(buf)); | ||
/** | ||
* Reverse the buffer passed as argument and writes it locally | ||
* @param {Buffer} buf | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeReverse = function(buf) { | ||
@@ -54,2 +77,7 @@ assert(bufferUtil.isBuffer(buf)); | ||
/** | ||
* Write a UInt8 to the local buffer array | ||
* @param {number} n | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeUInt8 = function(n) { | ||
@@ -62,2 +90,7 @@ var buf = Buffer.alloc(1); | ||
/** | ||
* Write a UInt16BE to the local buffer array | ||
* @param {number} n | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeUInt16BE = function(n) { | ||
@@ -69,3 +102,7 @@ var buf = Buffer.alloc(2); | ||
}; | ||
/** | ||
* Write a UInt16LE to the local buffer array | ||
* @param {number} n | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeUInt16LE = function(n) { | ||
@@ -78,2 +115,7 @@ var buf = Buffer.alloc(2); | ||
/** | ||
* Write a UInt32BE to the local buffer array | ||
* @param {number} n | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeUInt32BE = function(n) { | ||
@@ -86,2 +128,7 @@ var buf = Buffer.alloc(4); | ||
/** | ||
* Write a Int32LE to the local buffer array | ||
* @param {number} n | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeInt32LE = function(n) { | ||
@@ -94,2 +141,7 @@ var buf = Buffer.alloc(4); | ||
/** | ||
* Write a UInt32LE to the local buffer array | ||
* @param {number} n | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeUInt32LE = function(n) { | ||
@@ -102,2 +154,7 @@ var buf = Buffer.alloc(4); | ||
/** | ||
* Write a UInt64BEBN to the local buffer array | ||
* @param {BN} bn | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeUInt64BEBN = function(bn) { | ||
@@ -109,2 +166,7 @@ var buf = bn.toBuffer({size: 8}); | ||
/** | ||
* Write a UInt64LEBN to the local buffer array | ||
* @param {BN} bn | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeUInt64LEBN = function(bn) { | ||
@@ -116,2 +178,7 @@ var buf = bn.toBuffer({size: 8}); | ||
/** | ||
* Write a VarintNum to the local buffer array | ||
* @param {number} n | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeVarintNum = function(n) { | ||
@@ -123,2 +190,7 @@ var buf = BufferWriter.varintBufNum(n); | ||
/** | ||
* Write a varIntBN to the local buffer array | ||
* @param {BN} bn | ||
* @return {BufferWriter} | ||
*/ | ||
BufferWriter.prototype.writeVarintBN = function(bn) { | ||
@@ -130,2 +202,7 @@ var buf = BufferWriter.varintBufBN(bn); | ||
/** | ||
* Return a varInt buffer based on input number | ||
* @param {number} n - a number | ||
* @return Buffer | ||
*/ | ||
BufferWriter.varintBufNum = function(n) { | ||
@@ -152,3 +229,7 @@ var buf = undefined; | ||
}; | ||
/** | ||
* Return a new buffer based on on BN argument | ||
* @param {BN} bn | ||
* @return Buffer | ||
*/ | ||
BufferWriter.varintBufBN = function(bn) { | ||
@@ -155,0 +236,0 @@ var buf = undefined; |
@@ -155,2 +155,3 @@ /* eslint-disable */ | ||
* @param {boolean?} hardened | ||
* @return HDPrivateKey | ||
*/ | ||
@@ -189,2 +190,3 @@ HDPrivateKey.prototype.derive = function(arg, hardened) { | ||
* @param {boolean?} hardened | ||
* @return HDPrivateKey | ||
*/ | ||
@@ -353,2 +355,8 @@ HDPrivateKey.prototype.deriveChild = function(arg, hardened) { | ||
/** | ||
* Creates an HDPrivateKey from a string representation | ||
* | ||
* @param {String} arg | ||
* @return {HDPrivateKey} | ||
*/ | ||
HDPrivateKey.fromString = function(arg) { | ||
@@ -359,2 +367,8 @@ $.checkArgument(_.isString(arg), 'No valid string was provided'); | ||
/** | ||
* Creates an HDPrivateKey from an object | ||
* | ||
* @param {Object} arg | ||
* @return {HDPrivateKey} | ||
*/ | ||
HDPrivateKey.fromObject = function(arg) { | ||
@@ -610,3 +624,3 @@ $.checkArgument(_.isObject(arg), 'No valid argument was provided'); | ||
* | ||
* @return {string} | ||
* @return {Buffer} | ||
*/ | ||
@@ -613,0 +627,0 @@ HDPrivateKey.prototype.toBuffer = function() { |
@@ -115,2 +115,4 @@ /* eslint-disable */ | ||
* @param {string|number} arg | ||
* @param {boolean} [hardened=false] | ||
* @return HDPublicKey | ||
*/ | ||
@@ -145,2 +147,4 @@ HDPublicKey.prototype.derive = function(arg, hardened) { | ||
* @param {string|number} arg | ||
* @param {boolean?} hardened | ||
* @return HDPublicKey | ||
*/ | ||
@@ -393,2 +397,7 @@ HDPublicKey.prototype.deriveChild = function(arg, hardened) { | ||
/** | ||
* Creates an HDPublicKey from a string representation | ||
* @param {String} arg | ||
* @return {HDPublicKey} | ||
*/ | ||
HDPublicKey.fromString = function(arg) { | ||
@@ -399,2 +408,7 @@ $.checkArgument(_.isString(arg), 'No valid string was provided'); | ||
/** | ||
* Creates an HDPublicKey from an object | ||
* @param {Object} arg | ||
* @return {HDPublicKey} | ||
*/ | ||
HDPublicKey.fromObject = function(arg) { | ||
@@ -401,0 +415,0 @@ $.checkArgument(_.isObject(arg), 'No valid argument was provided'); |
@@ -21,3 +21,3 @@ /* eslint-disable */ | ||
* @constructor | ||
* @param {String} message | ||
* @param {string} message | ||
* @returns {Message} | ||
@@ -35,4 +35,12 @@ */ | ||
/** | ||
* Magic bytes for Dash | ||
* @type {Buffer} | ||
*/ | ||
Message.MAGIC_BYTES = Buffer.from('DarkCoin Signed Message:\n'); | ||
/** | ||
* Return a Buffer hash prefixed with MAGIC_BYTES | ||
* @return {Buffer} | ||
*/ | ||
Message.prototype.magicHash = function magicHash() { | ||
@@ -39,0 +47,0 @@ var prefix1 = BufferWriter.varintBufNum(Message.MAGIC_BYTES.length); |
@@ -11,5 +11,20 @@ /* eslint-disable */ | ||
function Opcode(num) { | ||
/** | ||
* Instantiate a Opcode from it's Opcode string or number | ||
* | ||
* @example | ||
* ```javascript | ||
* | ||
* var opcode = new Opcode(42); | ||
* var opcode2 = new Opcode('OP_NOP'); | ||
* | ||
* ``` | ||
* | ||
* @param {string|number} arg - The opcode number or string | ||
* @returns {Opcode} A new Opcode instance | ||
* @constructor | ||
*/ | ||
function Opcode(arg) { | ||
if (!(this instanceof Opcode)) { | ||
return new Opcode(num); | ||
return new Opcode(arg); | ||
} | ||
@@ -19,8 +34,8 @@ | ||
if (_.isNumber(num)) { | ||
value = num; | ||
} else if (_.isString(num)) { | ||
value = Opcode.map[num]; | ||
if (_.isNumber(arg)) { | ||
value = arg; | ||
} else if (_.isString(arg)) { | ||
value = Opcode.map[arg]; | ||
} else { | ||
throw new TypeError('Unrecognized num type: "' + typeof(num) + '" for Opcode'); | ||
throw new TypeError('Unrecognized num type: "' + typeof(arg) + '" for Opcode'); | ||
} | ||
@@ -35,2 +50,8 @@ | ||
/** | ||
* Instantiate a PrivateKey from a Buffer with the DER or WIF representation | ||
* | ||
* @param {Buffer} buf | ||
* @return {Opcode} | ||
*/ | ||
Opcode.fromBuffer = function(buf) { | ||
@@ -41,2 +62,9 @@ $.checkArgument(BufferUtil.isBuffer(buf)); | ||
/** | ||
* Instantiate a Opcode from it's string format | ||
* | ||
* @function | ||
* @param {number} num - The Opcode number | ||
* @return {Opcode} | ||
*/ | ||
Opcode.fromNumber = function(num) { | ||
@@ -47,2 +75,9 @@ $.checkArgument(_.isNumber(num)); | ||
/** | ||
* Instantiate a Opcode from it's string format | ||
* | ||
* @function | ||
* @param {string} str - The Opcode in string format | ||
* @return {Opcode} | ||
*/ | ||
Opcode.fromString = function(str) { | ||
@@ -57,2 +92,8 @@ $.checkArgument(_.isString(str)); | ||
/** | ||
* Will return the Opcode as an hex | ||
* | ||
* @return {string} | ||
*/ | ||
Opcode.prototype.toHex = function() { | ||
@@ -62,2 +103,7 @@ return this.num.toString(16); | ||
/** | ||
* Will return the opcode as a buffer | ||
* | ||
* @returns {Buffer} A buffer of the opcode | ||
*/ | ||
Opcode.prototype.toBuffer = function() { | ||
@@ -67,2 +113,7 @@ return Buffer.from(this.toHex(), 'hex'); | ||
/** | ||
* Will output the opcode as a number | ||
* | ||
* @returns {number} | ||
*/ | ||
Opcode.prototype.toNumber = function() { | ||
@@ -72,2 +123,7 @@ return this.num; | ||
/** | ||
* Will output the opcode encoded as hex string | ||
* | ||
* @returns {string} | ||
*/ | ||
Opcode.prototype.toString = function() { | ||
@@ -81,2 +137,7 @@ var str = Opcode.reverseMap[this.num]; | ||
/** | ||
* Return a new opcode from a smallInt | ||
* @param {number} n - a small int | ||
* @return {Opcode} | ||
*/ | ||
Opcode.smallInt = function(n) { | ||
@@ -83,0 +144,0 @@ $.checkArgument(_.isNumber(n), 'Invalid Argument: n should be number'); |
@@ -195,7 +195,8 @@ /* eslint-disable */ | ||
* @param {string} buf - An WIF string | ||
* @param {Network|string=} network - a {@link Network} object, or a string with the network name | ||
* @returns {Object} An object with keys: bn, network and compressed | ||
* @private | ||
*/ | ||
PrivateKey._transformWIF = function(str, network) { | ||
return PrivateKey._transformBuffer(Base58Check.decode(str), network); | ||
PrivateKey._transformWIF = function(buf, network) { | ||
return PrivateKey._transformBuffer(Base58Check.decode(buf), network); | ||
}; | ||
@@ -202,0 +203,0 @@ |
@@ -22,2 +22,4 @@ /* eslint-disable */ | ||
/** | ||
* Instantiate an Input from an Object | ||
* | ||
* @param params | ||
@@ -56,2 +58,8 @@ * @returns {Input|*} | ||
/** | ||
* Instantiate an Input from an Object | ||
* | ||
* @param {Object} obj - An Object containing satoshis and script | ||
* @returns {Input} A instance of an Input | ||
*/ | ||
Input.fromObject = function(obj) { | ||
@@ -83,2 +91,6 @@ $.checkArgument(_.isObject(obj)); | ||
/** | ||
* @function | ||
* @returns {Object} A plain object with the input information | ||
*/ | ||
Input.prototype.toObject = Input.prototype.toJSON = function toObject() { | ||
@@ -101,2 +113,9 @@ var obj = { | ||
/** | ||
* Set a script from a Buffer | ||
* Replace any previously set script | ||
* | ||
* @param {Buffer} br | ||
* @return {Input} | ||
*/ | ||
Input.fromBufferReader = function(br) { | ||
@@ -113,2 +132,7 @@ var input = new Input(); | ||
/** | ||
* Will return a BufferWriter instance with Input representation as value | ||
* @params {BufferWriter} writer? | ||
* @returns {BufferWriter} writer | ||
*/ | ||
Input.prototype.toBufferWriter = function(writer) { | ||
@@ -127,2 +151,9 @@ if (!writer) { | ||
/** | ||
* Set script from a Script, a buffer or it's String representation. | ||
* Replace any previously set script | ||
* | ||
* @param {Script|Buffer|String} script | ||
* @return {Input} | ||
*/ | ||
Input.prototype.setScript = function(script) { | ||
@@ -173,2 +204,6 @@ this._script = null; | ||
/** | ||
* Answer if the input is final based on it's sequence number | ||
* @return {boolean} | ||
*/ | ||
Input.prototype.isFinal = function() { | ||
@@ -186,2 +221,9 @@ return this.sequenceNumber !== 4294967295; | ||
/** | ||
* Verifies the signature and returns if it's valid or not | ||
* | ||
* @param {Transaction} transaction | ||
* @param {Object} signature | ||
* @return {boolean} | ||
*/ | ||
Input.prototype.isValidSignature = function(transaction, signature) { | ||
@@ -200,3 +242,3 @@ // FIXME: Refactor signature so this is not necessary | ||
/** | ||
* @returns true if this is a coinbase input (represents no input) | ||
* @returns {Boolean} true if this is a coinbase input (represents no input) | ||
*/ | ||
@@ -203,0 +245,0 @@ Input.prototype.isNull = function() { |
@@ -18,2 +18,4 @@ /* eslint-disable */ | ||
/** | ||
* Instantiate an Output from an Object | ||
* @param args | ||
@@ -87,2 +89,7 @@ * @returns {Output} | ||
/** | ||
* @function | ||
* Tests if the satoshis amount is invalid | ||
* @returns {String|Boolean} return reason as string if invalid, or false | ||
*/ | ||
Output.prototype.invalidSatoshis = function() { | ||
@@ -101,2 +108,6 @@ if (this._satoshis > MAX_SAFE_INTEGER) { | ||
/** | ||
* @function | ||
* @returns {Object} A plain object with the output information | ||
*/ | ||
Output.prototype.toObject = Output.prototype.toJSON = function toObject() { | ||
@@ -110,2 +121,8 @@ var obj = { | ||
/** | ||
* Instantiate an Output from an Object | ||
* | ||
* @param {Object} data - An Object containing satoshis and script | ||
* @returns {Output} A instance of an Output | ||
*/ | ||
Output.fromObject = function(data) { | ||
@@ -115,2 +132,9 @@ return new Output(data); | ||
/** | ||
* Set a script from a Buffer | ||
* Replace any previously set script | ||
* | ||
* @param {Buffer} buffer | ||
* @return {Output} | ||
*/ | ||
Output.prototype.setScriptFromBuffer = function(buffer) { | ||
@@ -130,2 +154,9 @@ this._scriptBuffer = buffer; | ||
/** | ||
* Set a script from a Script, a buffer or it's String representation. | ||
* Replace any previously set script | ||
* | ||
* @param {Script|Buffer|String} script | ||
* @return {Output} | ||
*/ | ||
Output.prototype.setScript = function(script) { | ||
@@ -148,2 +179,7 @@ if (script instanceof Script) { | ||
/** | ||
* Will return a string formatted for the console | ||
* | ||
* @returns {string} Output | ||
*/ | ||
Output.prototype.inspect = function() { | ||
@@ -159,2 +195,7 @@ var scriptStr; | ||
/** | ||
* Will create an Output from a bufferReader | ||
* | ||
* @returns {Output} output | ||
*/ | ||
Output.fromBufferReader = function(br) { | ||
@@ -172,2 +213,8 @@ var obj = {}; | ||
/** | ||
* Will return a BufferWriter instance with Output as value | ||
* | ||
* @params {BufferWriter} writer? | ||
* @returns {BufferWriter} writer | ||
*/ | ||
Output.prototype.toBufferWriter = function(writer) { | ||
@@ -174,0 +221,0 @@ if (!writer) { |
@@ -818,3 +818,3 @@ /* eslint-disable */ | ||
* | ||
* @param {(string|Address|Array.<Transaction.toObject>)} address | ||
* @param {(string|Address|Array.<Transaction.toObjectParams>)} address | ||
* @param {number} amount in satoshis | ||
@@ -1195,2 +1195,7 @@ * @return {Transaction} this, for chaining | ||
/** | ||
* Check whether the transaction is fully signed | ||
* | ||
* @return {boolean} | ||
*/ | ||
Transaction.prototype.isFullySigned = function() { | ||
@@ -1210,2 +1215,8 @@ _.each(this.inputs, function(input) { | ||
/** | ||
* Check whether the signature is valid | ||
* | ||
* @param signature | ||
* @return {Boolean} | ||
*/ | ||
Transaction.prototype.isValidSignature = function(signature) { | ||
@@ -1233,2 +1244,4 @@ var self = this; | ||
* CheckTransaction in bitcoin core. | ||
* | ||
* @return {Boolean|String} true or reason for failure as a string | ||
*/ | ||
@@ -1297,2 +1310,3 @@ Transaction.prototype.verify = function() { | ||
* Analogous to bitcoind's IsCoinBase function in transaction.h | ||
* @returns {boolean} | ||
*/ | ||
@@ -1306,2 +1320,3 @@ Transaction.prototype.isCoinbase = function() { | ||
* transaction that provides a sufficiently higher fee (RBF). | ||
* @returns {boolean} | ||
*/ | ||
@@ -1416,3 +1431,3 @@ Transaction.prototype.isRBF = function() { | ||
/** | ||
* @param {number} satoshisToBurn | ||
* @param {Number} satoshisToBurn | ||
* @param {Buffer} publicKeyHash | ||
@@ -1440,3 +1455,3 @@ * @return {Transaction} | ||
* | ||
* @param {number} outputIndex | ||
* @param {Number} outputIndex | ||
* @return {Buffer} | ||
@@ -1443,0 +1458,0 @@ */ |
@@ -80,5 +80,5 @@ /* eslint-disable */ | ||
*/ | ||
Unit.fromObject = function fromObject(data){ | ||
$.checkArgument(_.isObject(data), 'Argument is expected to be an object'); | ||
return new Unit(data.amount, data.code); | ||
Unit.fromObject = function fromObject(json){ | ||
$.checkArgument(_.isObject(json), 'Argument is expected to be an object'); | ||
return new Unit(json.amount, json.code); | ||
}; | ||
@@ -85,0 +85,0 @@ |
@@ -79,4 +79,4 @@ /* eslint-disable */ | ||
*/ | ||
URI.fromObject = function fromObject(json) { | ||
return new URI(json); | ||
URI.fromObject = function fromObject(data) { | ||
return new URI(data); | ||
}; | ||
@@ -94,3 +94,3 @@ | ||
* | ||
* @param {string|Object} data - A bitcoin URI string or an Object | ||
* @param {string|Object} arg - A bitcoin URI string or an Object | ||
* @param {Array.<string>=} knownParams - Required non-standard params | ||
@@ -179,2 +179,6 @@ * @returns {boolean} Result of uri validation | ||
/** | ||
* @function | ||
* @returns {Object} - A plain object with the URI properties | ||
*/ | ||
URI.prototype.toObject = URI.prototype.toJSON = function toObject() { | ||
@@ -181,0 +185,0 @@ var json = {}; |
{ | ||
"name": "@dashevo/dashcore-lib", | ||
"version": "0.18.1", | ||
"version": "0.18.2", | ||
"description": "A pure and powerful JavaScript Dash library.", | ||
@@ -99,2 +99,3 @@ "author": "Dash Core Group, Inc. <dev@dash.org>", | ||
}, | ||
"types": "index.d.ts", | ||
"bugs": { | ||
@@ -101,0 +102,0 @@ "url": "https://github.com/dashevo/dashcore-lib/issues" |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3036008
268
46602