How to use the bsv.util function in bsv

To help you get started, we’ve selected a few bsv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deanmlittle / bsv-p2p / lib / inventory.js View on Github external
'use strict';

var bsv = require('bsv');
var $ = bsv.util.preconditions;
var Buffer = require('buffer').Buffer;
var reverse = require('buffer-reverse');
var BufferReader = bsv.encoding.BufferReader;
var BufferWriter = bsv.encoding.BufferWriter;
var _ = bsv.deps._;

/**
 * A constructor for inventory related Bitcoin messages such as
 * "getdata", "inv" and "notfound".
 * @param {Object} obj
 * @param {Number} obj.type - Inventory.TYPE
 * @param {Buffer} obj.hash - The hash for the inventory
 * @constructor
 */
function Inventory(obj) {
  this.type = obj.type;