UNPKG

leap-node

Version:

[![codecov](https://codecov.io/gh/leapdao/leap-node/branch/master/graph/badge.svg)](https://codecov.io/gh/leapdao/leap-node) [![Docker Repository on Quay](https://quay.io/repository/leapdao/leap-node/status "Docker Repository on Quay")](https://quay.io/re

15 lines (12 loc) 398 B
const { Tx } = require('leap-core'); const { bufferToHex } = require('ethereumjs-util'); module.exports = async (db, tx) => { if (tx.inputs && tx.inputs.length > 0 && tx.inputs[0].prevout) { const prevTxHash = bufferToHex(tx.inputs[0].prevout.hash); const txDoc = await db.getTransaction(prevTxHash); if (txDoc) { return Tx.fromJSON(txDoc.txData); } } return null; };