From 6544f94ef697bbf5afaff57a5ce8304d78b41b92 Mon Sep 17 00:00:00 2001 From: Will Dembinski Date: Sat, 4 May 2019 14:01:16 -0700 Subject: [PATCH 1/2] Implement getnameinfo and getnamehash --- lib/node.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/node.js b/lib/node.js index 7d6a0ae..b8cca1e 100644 --- a/lib/node.js +++ b/lib/node.js @@ -62,6 +62,26 @@ class NodeClient extends Client { return this.get('/'); } + /** + * Get nameinfo for a given name. + * @returns {Promise}g + */ + + getNameInfo(name) { + assert(typeof name === 'string'); + return this.get(`/info/name/${name}`); + } + + /** + * Get nameinfo for a given name. + * @returns {Promise} + */ + + getNameByHash(nameHash) { + assert(typeof nameHash === 'string'); + return this.get(`/name/hash/${nameHash}`); + } + /** * Get coins that pertain to an address from the mempool or chain database. * Takes into account spent coins in the mempool. From 13612acffdb8aae60981cce1dd7eadc08bee4b09 Mon Sep 17 00:00:00 2001 From: Will Dembinski Date: Sun, 5 May 2019 11:39:50 -0700 Subject: [PATCH 2/2] Implement grindname, getproof, and getresource --- lib/node.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/node.js b/lib/node.js index b8cca1e..7e14ace 100644 --- a/lib/node.js +++ b/lib/node.js @@ -82,6 +82,36 @@ class NodeClient extends Client { return this.get(`/name/hash/${nameHash}`); } + /** + * Get resource for a given name. + * @returns {Promise} + */ + + getNameResource(name) { + assert(typeof name === 'string'); + return this.get(`/resource/name/${name}`); + } + + /** + * Get proof for a given name. + * @returns {Promise} + */ + + getNameProof(name) { + assert(typeof name === 'string'); + return this.get(`/proof/name/${name}`); + } + + /** + * Grind a name. + * @returns {Promise} + */ + + grindName(size) { + assert(typeof size === 'number'); + return this.get(`/grind?size=${size}`); + } + /** * Get coins that pertain to an address from the mempool or chain database. * Takes into account spent coins in the mempool.