Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods for node HTTP routes: getNameByHash, getNameResource, getNameProof, grindName #11

Closed
wants to merge 2 commits into from

Conversation

wi-ski
Copy link

@wi-ski wi-ski commented May 5, 2019

Change Summary & Context

The following changes implement the following methods.

  1. getNameByHash
  2. getNameResource
  3. getNameProof
  4. grindName

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

Copy link
Contributor

@tynes tynes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@@ -62,6 +62,56 @@ class NodeClient extends Client {
return this.get('/');
}

/**
* Get nameinfo for a given name.
* @returns {Promise}g
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra g character here


grindName(size) {
assert(typeof size === 'number');
return this.get(`/grind?size=${size}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query params can be passed in an object, so you would want something more like:

return this.get('/grind', { size })

@wi-ski wi-ski closed this Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants