From f4bd4e82d46fa1f149d62a55cc0a14654e471e20 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Fri, 5 Jul 2019 14:45:36 -0700 Subject: [PATCH] node client: add method for fetching block header --- lib/node.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/node.js b/lib/node.js index 5728a3d..34f36ab 100644 --- a/lib/node.js +++ b/lib/node.js @@ -146,6 +146,17 @@ class NodeClient extends Client { return this.get(`/block/${block}`); } + /** + * Retrieve a block header. + * @param {Hash|Number} block + * @returns {Promise} + */ + + getBlockHeader(block) { + assert(typeof block === 'string' || typeof block === 'number'); + return this.get(`/header/${block}`); + } + /** * Add a transaction to the mempool and broadcast it. * @param {TX} tx