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

13 lines (11 loc) 446 B
const getBlockByHash = require('./getBlockByHash'); module.exports = async (bridgeState, db, heightOrTag, showFullTxs = false) => { let height = heightOrTag; if (heightOrTag === 'latest') { height = bridgeState.blockHeight; } else if (typeof height === 'string' && height.indexOf('0x') === 0) { height = parseInt(height, 16); } const blockDoc = await db.getBlock(height); return getBlockByHash(db, blockDoc, showFullTxs); };