
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@helium/http
Advanced tools
@helium/httpAn HTTP client for interfacing with the Helium blockchain. For more documentation on the underlying REST API, see the section on the Helium Developer Site.
$ yarn add @helium/http
# or
$ npm install @helium/http
By default, the client will be initialized with the production network: https://api.helium.io
import { Client } from '@helium/http'
const client = new Client()
client.network.endpoint //= https://api.helium.io/v1
To specify a specific network, such as staging, the client can be initialized with a Network instance
import { Client, Network } from '@helium/http'
const client = new Client(Network.staging)
client.network.endpoint //= https://api.helium.wtf/v1
| Network | Base URL | Version |
|---|---|---|
Network.production | https://api.helium.io | v1 |
Network.staging | https://api.helium.wtf | v1 |
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:
for await (const account of client.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:
const list = await client.accounts.list()
await list.take(20) //= first 20 accounts
await list.take(20) //= next 20 accounts
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:
const firstPage = await client.accounts.list()
firstPage.data //= [Account, Account, ...]
firstPage.hasMore //= true
const nextPage = await firstPage.nextPage()
firstPage.data //= [Account, Account, ...]
firstPage.hasMore //= false
await client.accounts.get('an-account-address')
await client.accounts.list()
await client.accounts.getStats('an-account-address')
// get by block height
await client.blocks.get(12345)
// alternatively get by block hash
await client.blocks.get('a-block-hash')
await client.blocks.list()
await client.blocks.getHeight()
await client.stats.get()
await client.account('an-account-address').activity.list()
// optionally filter by transaction types
await client.account('an-account-address').activity.list({
filterTypes: ['payment_v1' ]
})
// inititalize block by height
const block = await client.blocks.get(12345)
// alternatively initialize block by hash
const block = await client.blocks.get('fake-hash')
await block.transactions.list()
const serializedTxn = 'a-base64-serialized-txn'
const pendingTxn = await client.transactions.submit(serializedTxn)
pendingTxn //= PendingTransaction
See @helium/transactions for instructions on constructing a serialized 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.
const pendingTxnsList = await client.pendingTransactions.get('fake-pending-txn-hash')
pendingTxns = await pendingTxnsList.take(100)
const list = await client.account('fake-address').pendingTransactions.list()
const pendingTxns = await list.take(10)
pendingTxns //= [PendingTransacion]
await client.elections.get('hash')
const list = await client.elections.list()
const elections = await list.take(10)
await client.oracle.getCurrentPrice()
const list = await client.cities.list()
const cities = await list.take(10)
const list = await client.cities.list({ query: 'san francisco' })
const cities = await list.take(10)
const city = await client.cities.get('city-id')
const list = await client.city('city-id').hotspots.list()
const hotspots = await list.take(10)
FAQs
HTTP library for interacting with the Helium blockchain API
The npm package @helium/http receives a total of 532 weekly downloads. As such, @helium/http popularity was classified as not popular.
We found that @helium/http demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.