handshake-org / hs-client Goto Github PK
View Code? Open in Web Editor NEWREST, websocket, and RPC client for hsd
License: Other
REST, websocket, and RPC client for hsd
License: Other
GET /mempool/invalid
GET /mempool/invalid/:hash
GET /fee
Other
broadcastclaim
is implemented in the node client, but has no CLI command:
Lines 177 to 180 in d82611c
a list of rpc commands for help
is missing: bcoin-org/bcoin#705
Implemented in wallet client but no CLI command:
getLast(id, account, limit)
getRange(id, account, options)
#16 and handshake-org/hsd#163
Implemented in wallet client but no CLI command:
The title is pretty descriptive. Connected issues: bcoin-org/bcoin#889
Reproducing: hsd-cli fee
When I attempt
./bin/hsd-cli rpc getnameinfo foobar-ąčęėįšųūž-„mumble“
I get a reply Invalid name.
Any name that I try, containing any one of these letters, seems not to work. Yet, these names do seem to be valid when accessed via a block-explorer... Am I missing something, or is this a bug?
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.
https://discord.com/channels/822591034202521641/956214168170684476/957872183047254036
lukeburns/ — Today at 10:22 PM
i mean for the wallet.unlock(pass, timeout) method
it spits out { succeed: true } for pass i put in
which is not informative
if it's already unlocked, then it didn't succeed
pinheadmz — Today at 10:22 PM
Fix it then
lukeburns/ — Today at 10:23 PM
good idea
i will do that
but not now
😉
so it goes
hs-client codebase has moved to https://github.com/handshake-org/hsd. This repository is autogenerated from there (handshake-org/hsd#796)
Any further patches/issues related to hs-client should be submitted there.
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
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.
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.
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!
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)
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.
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);
})();
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?
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?
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
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
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.