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.

@hydra-sdk/core

HD wallet management, signing, network integration, and Cardano operations.

@hydra-sdk/bridge

Hydra Head lifecycle, WebSocket events, and transaction processing.

@hydra-sdk/transaction

TxBuilder for Plutus, multi-asset, staking, and Hydra transactions.

@hydra-sdk/cardano-wasm

Cardano WASM bindings — Value, Address, Tx, Script, metadata, hashing.

Utilities

Datums, redeemers, policies, metadata, time/slot, and providers.

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

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 Greetings fields, /head API, slotZeroTimestamp) and the stable V2 line (commit-less, incremental deposits).
  • O(1) balance & UTxO reads — a pre-computed in-memory snapshot cache; no I/O per balance call.
  • Dual submit APIsubmitTxSync (Promise) and submitTx (error-first callback).
  • Auto-reconnect — configurable interval and max-attempts; safe cancellation on disconnect().
  • 5 URL formatsws://, 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.