Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dashevo/dashcore-lib

Package Overview
Dependencies
Maintainers
11
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dashevo/dashcore-lib - npm Package Compare versions

Comparing version 0.17.11 to 0.17.12

lib/errors/WrongOutPointError.js

3

lib/errors/index.js

@@ -65,1 +65,4 @@ /* eslint-disable */

};
module.exports.WrongOutPointError = require('./WrongOutPointError');
module.exports.WrongPublicKeyHashError = require('./WrongPublicKeyHashError');

@@ -22,6 +22,2 @@ /* eslint-disable */

var Input = require('./input');
var PublicKeyHashInput = Input.PublicKeyHash;
var PublicKeyInput = Input.PublicKey;
var MultiSigScriptHashInput = Input.MultiSigScriptHash;
var MultiSigInput = Input.MultiSig;
var Output = require('./output');

@@ -32,3 +28,11 @@ var Script = require('../script');

var Payload = require('./payload');
var Opcode = require('../opcode');
var PublicKeyHashInput = Input.PublicKeyHash;
var PublicKeyInput = Input.PublicKey;
var MultiSigScriptHashInput = Input.MultiSigScriptHash;
var MultiSigInput = Input.MultiSig;
var registeredTransactionTypes = Payload.constants.registeredTransactionTypes;
var WrongOutPointError = errors.WrongOutPointError;
var WrongPublicKeyHashError = errors.WrongPublicKeyHashError;

@@ -113,2 +117,21 @@ /**

/**
* @param {Buffer} outPointBuffer
* @return {{outputIndex: number, transactionHash: string}}
*/
Transaction.parseOutPointBuffer = function parseOutPointBuffer(outPointBuffer) {
if (outPointBuffer.length !== 36) {
throw new WrongOutPointError('OutPoint buffer length expected to be 36 bytes');
}
var bufferReader = new BufferReader(outPointBuffer);
var transactionHash = bufferReader.read(32).toString('hex');
var outputIndex = bufferReader.readUInt32LE(4);
return {
transactionHash: transactionHash,
outputIndex: outputIndex
};
};
var hashProperty = {

@@ -1375,2 +1398,6 @@ configurable: false,

/**
* @param {number} fundingAmount
* @return {Transaction}
*/
Transaction.prototype.addFundingOutput = function addFundingOutput(fundingAmount) {

@@ -1386,2 +1413,42 @@ var script = new Script().add('OP_RETURN');

/**
* @param {number} satoshisToBurn
* @param {Buffer} publicKeyHash
* @return {Transaction}
*/
Transaction.prototype.addBurnOutput = function addBurnOutput(satoshisToBurn, publicKeyHash) {
if (publicKeyHash.length !== 20) {
throw new WrongPublicKeyHashError('Expect public key hash to be 20 bytes long');
}
var script = new Script()
.add(Opcode.OP_RETURN)
.add(publicKeyHash);
var output = new Output({
satoshis: satoshisToBurn,
script: script
});
this.addOutput(output);
return this;
};
/**
* Gives an OutPoint buffer for the output at a given index
*
* @param {number} outputIndex
* @return {Buffer}
*/
Transaction.prototype.getOutPointBuffer = function getOutPointBuffer(outputIndex) {
if (!this.outputs[outputIndex]) {
throw new WrongOutPointError("There's no output with such index in the transaction");
}
var binaryTransactionHash = Buffer.from(this.hash, 'hex');
var indexBuffer = Buffer.alloc(4);
indexBuffer.writeUInt32LE(outputIndex, 0);
return Buffer.concat([binaryTransactionHash, indexBuffer]);
};
module.exports = Transaction;

2

package.json
{
"name": "@dashevo/dashcore-lib",
"version": "0.17.11",
"version": "0.17.12",
"description": "A pure and powerful JavaScript Dash library.",

@@ -5,0 +5,0 @@ "author": "Dash Core Group, Inc. <dev@dash.org>",

@@ -123,3 +123,3 @@ /* eslint-disable */

var parsed = new Transaction(expectedCommitementHex);
console.log(parsed.hash);
var actualCommitementHex = parsed.toString();

@@ -126,0 +126,0 @@ expect(actualCommitementHex).to.be.equal(expectedCommitementHex);

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc