helium-js
helium-js copied to clipboard
Usage Documentation
Hi,
there seems to be a big lack of documentation about the usage of the libraries etc...
At least neither this repo nor docs.helium.com have any documentation about this lib whatsoever...
The few README.mds that there are barely cover anything to be honest...
For most people the simplest things such as show me the rewards for hotspot XYZ
seem very opaque
Furthermore what I believe is the correct way does not seem to yield any data such as:
c = new Client()
console.log(c.network.endpoint) // 'https://api.helium.io/v1'
h = await c.hotspots.get('112KJt2aU2iRcFJ4irQXGEppejvk7vRcjrL2QxXFSsBSy1mury8t') // Hotspot address taken at random
r = await h.rewards.list({min_time:"2021-08-03T00:00:00.000Z",max_time:"2021-08-04T00:00:00.000Z"})
r yields:
ResourceList {
data: [],
fetchMore: [Function: bound list] AsyncFunction,
cursor: undefined
}
This suggests that there isnt any rewards but a quick curl reveals the exact opposite:
curl -qs https://api.helium.io/v1/hotspots/112KJt2aU2iRcFJ4irQXGEppejvk7vRcjrL2QxXFSsBSy1mury8t/rewards\?min_time\=2021-08-03T00%3A00%3A00.000Z\&max_time\=2021-08-04T00%3A00%3A00.000Z | jq .
{
"data": [],
"cursor": "eyJlbmRfYmxvY2siOjk0OTYxOSwiYmxvY2siOjk1MTAwMCwiYW5jaG9yX2Jsb2NrIjo5NTEwMDB9"
}
curl https://api.helium.io/v1/hotspots/112KJt2aU2iRcFJ4irQXGEppejvk7vRcjrL2QxXFSsBSy1mury8t/rewards\?min_time\=2021-08-03T00%3A00%3A00.000Z\&max_time\=2021-08-04T00%3A00%3A00.000Z\&cursor\=eyJlbmRfYmxvY2siOjk0OTYxOSwiYmxvY2siOjk1MTAwMCwiYW5jaG9yX2Jsb2NrIjo5NTEwMDB9 | jq .
{
"data": [
{
"timestamp": "2021-08-03T22:32:32.000000Z",
"hash": "hFwYP8LGL--yNE-y1WvKaK-kMnKLAc67LvQGk1bQ2sg",
"gateway": "112KJt2aU2iRcFJ4irQXGEppejvk7vRcjrL2QxXFSsBSy1mury8t",
"block": 950952,
"amount": 1312042,
"account": "13yfG77dATNdJQu5fSon5Yyg7R6U3CRuhS4aVQUxus95fe6nZ5m"
},
....
]
}
So what's up with that?