TypeScript libraries for building apps on Hiero networks: Node.js services, browser apps and React Native apps.
@hiero-hackers/enterprise-core sends transactions: accounts, tokens, topics, files, smart contracts and schedules, each behind a typed service. @hiero-hackers/enterprise-mirror reads the network's history from the mirror node, with no dependencies and no keys. Both wrap the plumbing a production service needs around the Hiero SDK: a shared client, input checks, typed errors, pagination and rate limiting.
This repository publishes two packages. Both run on Node.js 18 or later, in browsers and in React Native.
Core, to send transactions. It uses the app's own Hiero SDK (a peer dependency), so install both:
npm install @hiero-hackers/enterprise-core @hiero-ledger/sdkMirror, to read from the mirror node:
npm install @hiero-hackers/enterprise-mirrorUse them together or on their own.
| Package | Node.js 18+ | Browsers | React Native |
|---|---|---|---|
enterprise-core |
✓ gRPC | ✓ gRPC-web, through the SDK's WebClient |
✓ gRPC-web, through the SDK's NativeClient, with react-native-get-random-values |
enterprise-mirror |
✓ fetch |
✓ fetch |
✓ fetch |
- Each package ships one ESM and one CommonJS build for every platform. Core leaves
@hiero-ledger/sdkto your app, so your bundler picks the SDK's own browser or React Native build. - Environment variables are read only on Node.js. Elsewhere, pass a config object:
new HieroContext({ ... })orcreateMirrorNodeClient({ ... }). - Custom and local networks need gRPC-web proxies for the consensus nodes; mainnet, testnet and previewnet have them built in.
- Users can read code that runs in their browser or on their phone, so don't put an operator private key there. Core can sign through a wallet, KMS or backend instead, with
operatorPublicKeyandoperatorSigner.
The core and mirror READMEs have the setup, and samples has a Vite app and an Expo app.
Writes need an operator account to sign and pay the fee. On testnet you can create one for free in the Hedera Developer Portal. Set it in the environment:
HIERO_NETWORK=testnet
HIERO_OPERATOR_ID=0.0.12345
HIERO_OPERATOR_KEY=<your private key>
HIERO_OPERATOR_KEY_TYPE=ecdsa # or ed25519, or derCreate a topic and post a message to it:
import { HieroContext, TopicService } from "@hiero-hackers/enterprise-core";
const context = new HieroContext(); // reads the HIERO_* variables
const topics = new TopicService(context);
const { topicId } = await topics.createTopic({ topicMemo: "order events" });
const { sequenceNumber } = await topics.submitMessage({
topicId,
message: "order 42 shipped",
});
console.log(`message ${sequenceNumber} on topic ${topicId}`);
context.close();message 1 on topic 0.0.5005123
In a server, create the context and services once at startup and call context.close() on shutdown.
Reads need no account:
import {
AccountRepository,
createMirrorNodeClient,
tinybarToHbarExact,
} from "@hiero-hackers/enterprise-mirror";
const mirror = createMirrorNodeClient({ network: "mainnet" });
const account = await new AccountRepository(mirror).findByAccountId("0.0.800");
console.log(`${account.accountId} holds ${tinybarToHbarExact(account.balance)} ℏ`);0.0.800 holds 133361877.79077463 ℏ
A Hiero network has two kinds of servers:
- Consensus nodes order and execute transactions.
enterprise-coretalks to them through the SDK. Every transaction is validated, built, signed by the operator, submitted, and returns its receipt. - Mirror nodes store the history and serve it through a free REST API.
enterprise-mirroris a typed client for that API.
Core — one service per part of the network:
| Service | Covers |
|---|---|
AccountService |
Accounts, HBAR / token / NFT transfers, allowances, balances, signature checks |
TokenService |
Fungible tokens and NFTs: create, mint, burn, freeze, pause, KYC, fees, airdrops |
TopicService |
Topics: create, update, delete, submit messages, subscribe |
FileService |
Files: create, append, update, delete, read |
ContractService |
Smart contracts: deploy, execute, update, delete, read-only calls, gas estimates, hook storage |
ScheduleService |
Scheduled transactions: sign, cancel, inspect |
NetworkService |
Transaction receipts and records, network version, atomic batches |
- Input is checked before sending. Bad input fails with
INPUT_INVALIDand costs no fee. - Many write methods have a
schedule…version, so several keys can sign the same transaction. - Listeners get an event before and after every transaction and consensus node query, for logs and metrics.
Mirror — the whole mirror node REST API:
- Repositories for accounts, tokens, NFTs, topics, transactions, contracts, blocks, schedules and network state
- Every list returns a
Pagewithnext();collectAllandpaginateread all pages - Client-side rate limiting and retries
- Large numbers keep their full precision
- Helpers for tinybar ⇄ ℏ, token decimals and consensus timestamps
The core and mirror READMEs list every export. samples/examples has a runnable script for each service, and samples has Express, Fastify and NestJS servers, a Vite browser app and an Expo React Native app.
The API reference for both packages is generated from the source comments with TypeDoc. It lists every exported service, repository, option and result type, with each method's parameters, return value, errors and, for many methods, a code example. Build it locally and open docs/api/index.html:
pnpm install
pnpm run docsCore throws HieroError and mirror throws MirrorError. Both have a code you can check:
import {
AccountService,
HieroContext,
HieroError,
HieroErrorCodes,
} from "@hiero-hackers/enterprise-core";
const context = new HieroContext();
const accounts = new AccountService(context);
try {
await accounts.transferHbar("0.0.1234", 5, context.operatorAccountId);
} catch (err) {
if (err instanceof HieroError && err.code === HieroErrorCodes.InputInvalid) {
// Rejected before sending; no fee was charged.
}
throw err;
}- Pre-1.0. Minor releases can break the API.
- Browsers and React Native are only checked by bundling. CI runs the tests on Node.js 22 and 24, and bundles both packages for browsers and React Native without running them there.
- Not every SDK feature is wrapped. Batch transactions, hooks and fee estimates are on the roadmap. Until then,
context.clientgives you the SDK client directly.
Contributions welcome. See CONTRIBUTING.md to get started, or open an issue to ask a question. Maintainers release with RELEASE.md.
Apache-2.0 — see LICENSE