@ledgerhq/coin-hedera
Version:
Ledger Hedera Coin integration
24 lines • 1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBlockInfo = void 0;
const constants_1 = require("../constants");
const utils_1 = require("./utils");
/**
* Retrieves synthetic block information based on the provided block height.
*
* @param blockHeight - The height of the block for which to retrieve information.
* @param blockWindowSeconds - The duration in seconds that defines the synthetic block window (default is SYNTHETIC_BLOCK_WINDOW_SECONDS).
* @returns An object containing the block height, block hash, and block time.
*/
const getBlockInfo = async (blockHeight, blockWindowSeconds = constants_1.SYNTHETIC_BLOCK_WINDOW_SECONDS) => {
const seconds = blockHeight * blockWindowSeconds;
const hash = (0, utils_1.getBlockHash)(blockHeight);
const time = new Date(seconds * 1000);
return {
height: blockHeight,
hash,
time,
};
};
exports.getBlockInfo = getBlockInfo;
//# sourceMappingURL=getBlockInfo.js.map