Install
Install hive-tx
Add hive-tx to a Node.js project or load the ESM file in a browser.
Node.js
Node.js 20 or later is required.
- Open a terminal in the project directory.
- Install the package.
npm install hive-tx --save
You can use pnpm or yarn. The package name is hive-tx.
Import the library
Use an ESM import:
import { Transaction, PrivateKey, callRPC } from 'hive-tx'
Use a CommonJS require:
const { Transaction, PrivateKey, callRPC } = require('hive-tx')
Use hive-tx 7.2.1 or later for CommonJS. Version 7.2.0 CommonJS is not valid.
Browser
Load the ESM build from a CDN:
<script type="module">
import { Transaction, PrivateKey } from
'https://cdn.jsdelivr.net/npm/hive-tx@7/dist/index.mjs'
</script>
What the package contains
| File | Use |
|---|---|
dist/index.mjs | ESM for Node.js, browsers, workers, and serverless runtimes |
dist/index.cjs | CommonJS for Node.js and CommonJS bundlers |
dist/index.d.mts | TypeScript types for ESM |
dist/index.d.cts | TypeScript types for CommonJS |
The application selects the correct file through the exports field in package.json.