Getting started
Installation
The package is dependency-free TypeScript. It runs in browsers, Node, edge runtimes and workers — anything with fetch.
Install
Shell
npm install hivexph-sdk
# pnpm add hivexph-sdk
# yarn add hivexph-sdk
# bun add hivexph-sdkRequirements
TypeScript 5+ and a runtime with a global fetch. Browser signing additionally requires the Hive Keychain extension; backend signing requires the account and key environment variables described in the configuration section.
Important
Never import a backend configuration module into browser code. Key environment variables must only be readable in a server runtime.
First client
hive.ts
import { HiveClient } from "hivexph-sdk";
export const hive = new HiveClient({
// Optional: override the default public RPC node.
endpoint: "https://api.hive.blog",
});
const props = await hive.rpc.getDynamicGlobalProperties();
console.log(props.head_block_number);