diff --git a/bin/bcoin-cli b/bin/bcoin-cli index 268cc04..cb48173 100755 --- a/bin/bcoin-cli +++ b/bin/bcoin-cli @@ -60,6 +60,11 @@ class CLI { this.log(info); } + async getUptime() { + const uptime = await this.client.getUptime(); + this.log(uptime); + } + async getTX() { const hash = this.config.str(0, ''); @@ -173,6 +178,9 @@ class CLI { case 'info': await this.getInfo(); break; + case 'uptime': + await this.getUptime(); + break; case 'broadcast': await this.broadcast(); break; diff --git a/lib/node.js b/lib/node.js index 5728a3d..a0020d2 100644 --- a/lib/node.js +++ b/lib/node.js @@ -62,6 +62,15 @@ class NodeClient extends Client { return this.get('/'); } + /** + * Get server uptime. + * @returns {Promise} + */ + + getUptime() { + return this.get('/uptime'); + } + /** * Get coins that pertain to an address from the mempool or chain database. * Takes into account spent coins in the mempool.