UNPKG

@blockfrost/blockfrost-cardano-cli

Version:

Drop-in(ish) replacement for cardano-cli powered by Blockfrost

41 lines (40 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Tip = void 0; const base_command_1 = require("../../helpers/base-command"); // cardano-cli response // { // "epoch": 169, // "hash": "20e300831de50acf6a07d8df023454381d5eb3e6fdf93f9f8f694ae0db355355", // "slot": 43037061, // "block": 3088166, // "era": "Alonzo", // "syncProgress": "100.00" // } // interface TipResponse { // epoch: number | null; // hash: string; // slot: number | null; // block: number | null; // era: string; // syncProgress: '100.00'; // } class Tip extends base_command_1.BaseCommand { constructor() { super(...arguments); this.doWork = async () => { const client = await this.getClient(); const latestBlock = await client.blocksLatest(); const response = { epoch: latestBlock.epoch, hash: latestBlock.hash, slot: latestBlock.slot, block: latestBlock.height, era: 'Alonzo', syncProgress: '100.00', }; return response; }; } } exports.Tip = Tip;