The JavaScript SDK for interacting with a Hiero based network
Note
The project has been transfered from the https://github.com/hashgraph org and therefore the namespace is at several locations still based on hashgraph
and hedera
.
We are working activly on migration the namespace fully to hiero.
NOTE: v1 of the SDK is deprecated and support will be discontinued after October 2021. Please install the latest version 2.x or migrate from v1 to the latest 2.x version. You can reference the migration documentation.
# with NPM
$ npm install --save @hashgraph/sdk
# with Yarn
$ yarn add @hashgraph/sdk
# with PNPM
$ pnpm add @hashgraph/sdk
- Taskfile tool installation
- Node.js: It is recommended to use Node.js v20 or higher for best performance and compatibility. The package may also work with Node.js v16, but this version has not been officially tested.
# with npm
$ npm install -g @go-task/cli
# with homebrew
$ brew install go-task
- pNpm package manager installation
# with npm
$ npm install -g pnpm
# with homebrew
$ brew install pnpm
After downloading the repo run:
-
task install
-
task build
to build the SDK
The Hiero JavaScript SDK provides comprehensive support for React Native environments, including Expo. To ensure seamless integration, follow the guidelines based on your Expo version:
✅ Hiero Javascript SDK Version 2.60 and Above
For projects using SDK version 2.60 and above, Expo SDK version 51+ is supported, the SDK requires the react-native-get-random-values
package in order to work.
To install it, run:
npm install react-native-get-random-values
After installation, the native dependency must be linked for the respective platforms:
🔗 Linking for Native Platforms
- iOS: Run the following command to install the native modules:
cd ios && pod install
Then, rebuild the iOS project.
- Android: Rebuild the Android project to link the dependency
npm install @ethersproject/shims
Import it before importing the SDK as shown below:
import '@ethersproject/shims';
import {
Client,
PrivateKey
AccountBalance,
} from "@hashgraph/sdk";
...
The Hiero JavaScript SDK does not currently support the following:
- React Native Bare
See examples.
Every example can be executed using the following command from the root directory: node examples/[name-of-example].js
For detailed information on configuring the SDK, including environment variables and client settings, please refer to the CONFIGURATION.md file.
- To start the integration tests follow the next steps:
- Run the local node
- Run
task test:integration:node
- Stop the local node
- To start unit tests follow the next steps:
- Run
task test:unit
(Note: the local node should not be running)
- Run
Whether you’re fixing bugs, enhancing features, or improving documentation, your contributions are important — let’s build something great together! Please read our contributing guide to see how you can get involved.
Hiero uses the Linux Foundation Decentralised Trust Code of Conduct.