Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
inputs.forEach((input, i) => {
const utxo = new TxInputType()
utxo.setPrevHash(fromHexString(input.txid))
utxo.setPrevIndex(input.vout)
if (input.sequence !== undefined) utxo.setSequence(input.sequence)
utxo.setScriptType(translateInputScriptType(input.scriptType))
utxo.setAddressNList(input.addressNList)
utxo.setAmount(Number(input.amount))
unsignedTx.addInputs(utxo, i)
})
inputTx.tx.vin.forEach((vin, i) => {
const txInput = new TxInputType()
if (vin.coinbase !== undefined) {
txInput.setPrevHash(fromHexString("\0".repeat(64)))
txInput.setPrevIndex(0xffffffff)
txInput.setScriptSig(fromHexString(vin.coinbase))
txInput.setSequence(vin.sequence)
} else {
txInput.setPrevHash(fromHexString(vin.txid))
txInput.setPrevIndex(vin.vout)
txInput.setScriptSig(fromHexString(vin.scriptSig.hex))
txInput.setSequence(vin.sequence)
}
tx.addInputs(txInput, i)
})