Coder Social home page Coder Social logo

hs-client's People

Contributors

boymanjor avatar chjj avatar gdassori avatar nodech avatar pinheadmz avatar randomlogin avatar rithvikvibhu avatar rsmarples avatar tynes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hs-client's Issues

Missing CLI commands for new HTTP endpoints

Node (hsd-cli)

handshake-org/hsd#189

  • Mempool Rejection Filter: GET /mempool/invalid
  • Mempool Rejection Test: GET /mempool/invalid/:hash

bcoin-org/bcoin#889

  • Estimate fee: GET /fee

Other

  • broadcastclaim is implemented in the node client, but has no CLI command:

    hs-client/lib/node.js

    Lines 177 to 180 in d82611c

    broadcastClaim(claim) {
    assert(typeof claim === 'string');
    return this.post('/claim', { claim });
    }

  • a list of rpc commands for help is missing: bcoin-org/bcoin#705

Wallet (hsw-cli)

Implemented in wallet client but no CLI command:

  • Get last N transactions: getLast(id, account, limit)
  • Get range (of TXs by timestamp): getRange(id, account, options)

#16 and handshake-org/hsd#163
Implemented in wallet client but no CLI command:

  • getName
  • getNames
  • getAuctionByName
  • getAuctions
  • getBidsByName
  • getBids
  • getRevealsByName
  • getReveals
  • getResource
  • getNonce
  • createOpen
  • createBid
  • createReveal
  • createRedeem
  • createUpdate
  • createRenewal
  • createTransfer
  • createCancel
  • createFinalize
  • createRevoke

handshake-org/hsd#511

  • deep clean

--api-key option missing from help doc

Maybe this is obvious to people familiar with handshake, but as a new user I would like to have all command line options to the tool im using be easily found rather than inferring command line options from other related tools:


$ ./bin/hsw-cli account list      
Error: Unauthorized (bad API key).
    at WalletClient.request (/home/dwilson/code/hs-client/node_modules/bcurl/lib/client.js:201:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)

$ ./bin/hsw-cli --api-key bikeshed account list
[
  "default",
]

No mention of --api-key in the help output:

$ ./bin/hsw-cli                                
Unrecognized command.
Commands:
  $ listen: Listen for events.
  $ get: View wallet.
  $ master: View wallet master key.
  $ shared add [xpubkey]: Add key to wallet.
  $ shared remove [xpubkey]: Remove key from wallet.
  $ balance: Get wallet balance.
  $ history: View TX history.
  $ pending: View pending TXs.
  $ coins: View wallet coins.
  $ account list: List account names.
  $ account create [account-name]: Create account.
  $ account get [account-name]: Get account details.
  $ address: Derive new address.
  $ change: Derive new change address.
  $ retoken: Create new api key.
  $ send [address] [value]: Send transaction.
  $ mktx [address] [value]: Create transaction.
  $ sign [tx-hex]: Sign transaction.
  $ zap [age?]: Zap pending wallet TXs.
  $ tx [hash]: View transaction details.
  $ blocks: List wallet blocks.
  $ block [height]: View wallet block.
  $ view [tx-hex]: Parse and view transaction.
  $ import [wif|hex]: Import private or public key.
  $ watch [address]: Import an address.
  $ key [address]: Get wallet key by address.
  $ dump [address]: Get wallet key WIF by address.
  $ lock: Lock wallet.
  $ unlock [passphrase] [timeout?]: Unlock wallet.
  $ resend: Resend pending transactions.
  $ rescan [height]: Rescan for transactions.
Other Options:
  --passphrase [passphrase]: For signing/account-creation.
  --account [account-name]: Account name.

Error: proof.hash is not a function

After getting the base64-string I try submitting it to my local hsd server using:
./bin/hsd-rpc sendrawairdrop XXXXKEljZZJWJfXXXXX.........

I get the above error Error: proof.hash is not a function

thanks

Both cli clients use the same port

Requests to hsw and hsd RPC endpoints are done over different ports. However both hsd-cli and hsw-cli use the same environment variable "http-port" which means that you can't use the client on the same machine to issue requests to both endpoints.

Ideally they should look at differently named environment variables.

Unexisting wallet not causing errors.

Some actions, resendwallet for example, will not cause error or show user in any other way that the command has not worked because the provided wallet id is not existing.

Feature Request: add sanity checks to `hsw-cli` when adding/modifying `records`

Some of the data in the HNS root zone are "wrong", e.g., IP addresses being used as the name of NS RRs (instead of as the value of the RR).

i suggest that hsw-cli be extended to include a module that does a syntax/sanity check when records are created/modified, e.g., as in:

    hsw-cli rpc sendupdate easyhandshake '{"records": [ ... ]}'

If you go to any DNS service that let's you edit RRs, they all perform such checks (or at least they should). I suggest taht hsw-cli do the same!

"account get default" throws "Error: connect ECONNREFUSED"

I'm following the instructions and while this is launched:

./bin/hsd --log-level info

and producing some logs continuously, the following command throws the error:

$ ./bin/hsw-cli account get default
Error: connect ECONNREFUSED ::1:12039
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)

Better error, better help when command is missing

Both of these easy-to-make mistakes for new users need to provide better answers:

# hsd-rpc
AssertionError [ERR_ASSERTION]: Assertion failed.
    at NodeClient.execute (/root/n/lib/node_modules/hs-client/node_modules/bcurl/lib/client.js:279:5)
    at NodeClient.execute (/root/n/lib/node_modules/hs-client/lib/node.js:44:18)
    at CLI.rpc (/root/n/lib/node_modules/hs-client/bin/hsd-cli:159:34)
    at CLI.open (/root/n/lib/node_modules/hs-client/bin/hsd-cli:195:20)
    at /root/n/lib/node_modules/hs-client/bin/hsd-cli:220:13
    at Object.<anonymous> (/root/n/lib/node_modules/hs-client/bin/hsd-cli:222:3)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)


# hsd-rpc help
Select a command.

Issue with documentation

Hi there!

This portion of the documentation: https://handshake-org.github.io/api-docs/?javascript#sendupdate

Has this block:

const {NodeClient} = require('hs-client');
const {Network} = require('hsd');
const network = Network.get('regtest');

const clientOptions = {
  network: network.type,
  port: network.rpcPort,
  apiKey: 'api-key'
}

const client = new NodeClient(clientOptions);

(async () => {
  const result = await client.execute('sendupdate', [ $name, '{"ttl":172800,"ns":["[email protected]"]}' ]);
  console.log(result);
})();

and following this will yield the error:

 Param #1 must be a object.

I believe you can get away with doing...

const {NodeClient} = require('hs-client');
const {Network} = require('hsd');
const network = Network.get('regtest');

const clientOptions = {
  network: network.type,
  port: network.rpcPort,
  apiKey: 'api-key'
}

const client = new NodeClient(clientOptions);

(async () => {
  const result = await client.execute('sendupdate', [ $name, {"ttl":172800,"ns":["[email protected]"]} ]);
  console.log(result);
})();

hsw-cli sent HNS to two addresses?

I tried sending some HNS to another wallet as a test:

./bin/hsw-cli send --value=2 --address=hs1...

but hnscan.com lists two recipients it seems; one indeed the address I specified on the command line which received 2 HNS, but another one that I apparently transfered more than 4000 HNS to. What did I do wrong here?

Unhandled AssertionError on the RPC endpoint

The bcurl API raises an assertion error when an empty method is passed to the RPC execute method (https://github.com/bcoin-org/bcurl/blob/master/lib/client.js#L310).

The way the execute is used in the hsd and hsw client (super().execute) throw this bad exception right as a client response, when passing an empty method to the rpc command:

$ ./bin/hsd-cli rpc
AssertionError [ERR_ASSERTION]: Assertion failed.

This could be both a problem of bcurl, that doesn't throw an RPCError exception, or of the hs-client, that should catch the raw assertion and throw the error.

Knowing nothing, I tend to think that bcurl developers thought the execute method as private.

Intially I thought that a way to fix this could be to call the super().execute() inside a try\catch, and raise an RPCError.. but the RPCError is not exported by the client module, so I went into a loop and back to think as a bcurl "issue" (at least the dependency should be changed to export the class).

What do you think?

hsw-cli should (?) filter environment variables for wallet-*

To reproduce:

start hsd with custom ports:
$ hsd --network=regtest --memory=true --http-port=10000 --wallet-http-port=20000

set environment variables:

$ export HSD_HTTP_PORT=10000
$ export HSD_WALLET_HTTP_PORT=20000

make client calls:

$ hsd-cli info                       # success
$ hsw-cli wallets                    # fails, gets redirected to NODE HTTP PORT (10000)
# hsw-cli wallets --http-port=20000  # success

so, hsw-cli might want to filter environment variablels to correctly parse WALLET_HTTP_PORT

Wrong block height in name info

I want to get the block height of the name auction closed.

According to the documentation, we can get the name auction closed height using the method getnameinfo. The height property is the auction started block height instead of the expected auction closed block height.

For example, this is the name info we got to skit:

{ start: { reserved: false, week: 0, start: 2016 },
  info: 
   { name: 'skit',
     nameHash: 'b476898ecb2138b09d7c8e9f0995bed0a1cd002eae42bae46a0ef8e30315f07c',
     state: 'CLOSED',
     height: 2209,
     renewal: 4407,
     owner: 
      { hash: '4af926146f7a896c999c2377be5a4c09cba44df11148cbc059691424d047a969',
        index: 0 },
     value: 60000000,
     highest: 66000000,
     data: '00',
     transfer: 0,
     revoked: 0,
     claimed: 0,
     renewals: 0,
     registered: true,
     expired: false,
     weak: false,
     stats: 
      { renewalPeriodStart: 4407,
        renewalPeriodEnd: 109527,
        blocksUntilExpire: 104567,
        daysUntilExpire: 726.16 } } }

This is the auction details we can see in namebase website:

RELEASE DATE
02/14/20 · Block # 2016
AUCTION START DATE
02/15/20 · Block # 2209
LAST DAY TO SEND BID
02/20/20 · Block # 2964
AUCTION CLOSE DATE
03/01/20 · Block # 4406
CURRENT BLOCK HEIGHT
Block # 5001

The skit name info should have height 4406, but it has the height 2209.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.