API Reference
API Reference
Per-package reference for the Hydra SDK — core, bridge, transaction, cardano-wasm, and the utility namespaces.
The Hydra SDK is four packages plus a comprehensive utilities collection. Each page below documents the constructors, methods, parameters, and return types for one package.
Installation
Install the packages you need. Always include @hydra-sdk/cardano-wasm — it is the WASM core every package imports through, and must be a direct dependency for your bundler to configure it.
npm install @hydra-sdk/core @hydra-sdk/cardano-wasm
npm install @hydra-sdk/bridge @hydra-sdk/cardano-wasm
npm install @hydra-sdk/transaction @hydra-sdk/cardano-wasm
npm install @hydra-sdk/core @hydra-sdk/bridge @hydra-sdk/transaction @hydra-sdk/cardano-wasm
Package notes
A few things worth knowing before you dive into the per-package pages.
core — NETWORK_ID is a Record, not an enum
NETWORK_ID is a Record<Network, number> with keys 'MAINNET' | 'PREPROD' | 'PREVIEW' (there is no TESTNET):
import { AppWallet, NETWORK_ID } from '@hydra-sdk/core'
// NETWORK_ID = { MAINNET: 1, PREPROD: 0, PREVIEW: 0 }
const wallet = new AppWallet({
networkId: NETWORK_ID.MAINNET, // 1
key: { type: 'mnemonic', words: AppWallet.brew() }
})
bridge — key features
- hydra-node v1.3.0 through V2 — supports the v1.3.0 line (extended
Greetingsfields,/headAPI,slotZeroTimestamp) and the stable V2 line (commit-less, incrementaldeposits). - O(1) balance & UTxO reads — a pre-computed in-memory snapshot cache; no I/O per balance call.
- Dual submit API —
submitTxSync(Promise) andsubmitTx(error-first callback). - Auto-reconnect — configurable interval and max-attempts; safe cancellation on
disconnect(). - 5 URL formats —
ws://,wss://,http://,https://, and gateway with?X-Api-Key=.
cardano-wasm — bundler tips
When running in the browser, add
vite-plugin-wasm and vite-plugin-top-level-await, and exclude @hydra-sdk/cardano-wasm from optimizeDeps. See Configuration for full bundler setup.What's new
Release notes and version-by-version changes live in the Changelog.
