<commit_before>var _ = require('lodash')
var Q = require('q')

var bitcoin = require('../cclib').bitcoin
var verify = require('../verify')


/**
 * @class RawTx
 */
function RawTx() {
  this.txb = new bitcoin.TransactionBuilder()
}

/**
 * @param {ComposedTx} composedTx
 * @return {RawTx}
 */
RawTx.fromComposedTx = function(composedTx) {
  verify.ComposedTx(composedTx)

  var rawTx = new RawTx()

  composedTx.getTxIns().forEach(function(txIn) {
    rawTx.txb.addInput(txIn.txId, txIn.outIndex)
  })

  composedTx.getTxOuts().forEach(function(txOut) {
    rawTx.txb.addOutput(bitcoin.Script.fromHex(txOut.script), txOut.value)
  })

  return rawTx
}

/**
 * @param {bitcoinjs-lib.Transaction} tx
 * @return {RawTx}
 */
RawTx.fromTransaction = function(tx) {
  verify.Transaction(tx)
<commit_msg>fix bug with lacking nSequence in RawTx<commit_after>var _ = require('lodash')
var Q = require('q')

var bitcoin = require('../cclib').bitcoin
var verify = require('../verify')


/**
 * @class RawTx
 */
function RawTx() {
  this.txb = new bitcoin.TransactionBuilder()
}

/**
 * @param {ComposedTx} composedTx
 * @return {RawTx}
 */
RawTx.fromComposedTx = function(composedTx) {
  verify.ComposedTx(composedTx)

  var rawTx = new RawTx()

  composedTx.getTxIns().forEach(function(txIn) {
    rawTx.txb.addInput(txIn.txId, txIn.outIndex, txIn.sequence)
  })

  composedTx.getTxOuts().forEach(function(txOut) {
    rawTx.txb.addOutput(bitcoin.Script.fromHex(txOut.script), txOut.value)
  })

  return rawTx
}

/**
 * @param {bitcoinjs-lib.Transaction} tx
 * @return {RawTx}
 */
RawTx.fromTransaction = function(tx) {
  verify.Transaction(tx)

{'fraction_non_alphanumeric': 0.1624923640806353, 'fraction_numerical': 0.0, 'mean_word_length': 4.2, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6563387', 'n_tokens_mistral': 608, 'n_tokens_neox': 595, 'n_words': 99}