Methods for node HTTP routes: getNameByHash, getNameResource, getNameProof, grindName#11
Closed
wi-ski wants to merge 2 commits intohandshake-org:masterfrom
Closed
Methods for node HTTP routes: getNameByHash, getNameResource, getNameProof, grindName#11wi-ski wants to merge 2 commits intohandshake-org:masterfrom
wi-ski wants to merge 2 commits intohandshake-org:masterfrom
Conversation
tynes
suggested changes
May 5, 2019
Contributor
tynes
left a comment
There was a problem hiding this comment.
I like the asserts to cause errors on the client side, I think that some of the asserts could be smarter though, like getNameByHash will take any string - name hashes are 32 bytes long.
The other methods don't have asserts, so maybe its better to not introduce them in this PR so that this PR is just about adding the methods, and then we can open an issue to discuss adding asserts for each method
|
|
||
| /** | ||
| * Get nameinfo for a given name. | ||
| * @returns {Promise}g |
|
|
||
| grindName(size) { | ||
| assert(typeof size === 'number'); | ||
| return this.get(`/grind?size=${size}`); |
Contributor
There was a problem hiding this comment.
Query params can be passed in an object, so you would want something more like:
return this.get('/grind', { size })
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary & Context
The following changes implement the following methods.
The follow the specfication outlined here: handshake-org/hsd#142 (comment)
It is intended to be used against the changes introduced in this PR: handshake-org/hsd#168 for HSD.
They are covered by tests here: https://github.com/handshake-org/hsd/pull/168/files#diff-bbe506ab5582252a30d6872d35fd8ce6L21