An HTTP client for interfacing with the Helium blockchain. For more documentation on the underlying REST API, see the section on the Helium Developer Site.
Resource lists implement an asynchronous iterator, which allows for paginating over the whole collection while abstracting the underlying pages and cursors. This is great for an infinite scrolling UI, for example.
The asynchronous iterator can be used directly via the for-await-of syntax:
forawait (constaccountofclient.accounts.list()) { account//= Account // do something with account
// after some condition is met, stop iterating if (someConditionMet) break }
There is also a helper, take, which returns the items in chunks:
constlist = awaitclient.accounts.list()
awaitlist.take(20) //= first 20 accounts awaitlist.take(20) //= next 20 accounts
This returns a ResourceList of pending transactions. In the case that a transaction fails and is submitted again it will return multiple pending transactions.
@helium/http
An HTTP client for interfacing with the Helium blockchain. For more documentation on the underlying REST API, see the section on the Helium Developer Site.
Installation
Usage
Initializing the Client
By default, the client will be initialized with the production network:
https://api.helium.io
To specify a specific network, such as staging, the client can be initialized with a
Network
instanceAvailable Networks
Network.production
Network.staging
Paginating Results
Automatic Pagination
Resource lists implement an asynchronous iterator, which allows for paginating over the whole collection while abstracting the underlying pages and cursors. This is great for an infinite scrolling UI, for example.
The asynchronous iterator can be used directly via the
for-await-of
syntax:There is also a helper,
take
, which returns the items in chunks:Manual Pagination
If you're on an older version of Node.js or simply want to use the built-in pagination directly, the following methods are provided:
Resources
Accounts
Get an Account
List Accounts
Get an Accounts Stats
Blocks
Get a Block
List Blocks
Current Block Height
Stats
Get Network Stats
Transactions
Get Transaction Activity for an Account
Get Transactions from a Block
Submit a New Transaction
See
@helium/transactions
for instructions on constructing a serialized transaction.Pending Transactions
Check Status of Pending Transaction
This returns a ResourceList of pending transactions. In the case that a transaction fails and is submitted again it will return multiple pending transactions.
List Pending Transactions for an Account
Election Groups
Get an Election Group
List Election Groups
Price Oracle
Get the Current Oracle Price
Cities
List all cities with hotspots
Search for a city
Get specific city data
List hotspots in a city