Hydrex SDK Docs
TypeScript SDK for the Hydrex concentrated-liquidity AMM on Base — swap tokens, manage positions, stake, and more.
Installation
What's included
Everything you need to build on Hydrex.
Swaps & Routing
Build exact-input and exact-output swaps with optimal route finding across concentrated liquidity pools.
Liquidity Management
Mint, increase, decrease, and collect fees on concentrated liquidity positions with tick math utilities.
Gauges & Staking
Stake LP tokens, claim rewards, vote on gauge weights, and manage veNFT-based governance power.
ERC4626 Vaults
First-class support for boosted vault tokens — BoostedRoute automatically wraps/unwraps around swaps.
oHYDX Options
Convert oHYDX option tokens into liquid HYDX or locked veNFT positions with exercise quote helpers.
Account Automation
Approve conduit contracts for automated veNFT management, liquid gauge automation, and history tracking.
Quick Start
Build a swap in minutes.
import {
Token,
Pool,
Route,
Trade,
TradeType,
SwapRouter,
ChainId,
WNATIVE,
Percent,
CurrencyAmount,
} from '@hydrexfi/hydrex-sdk';
const USDC = new Token(ChainId.Base, '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', 6, 'USDC');
const WETH = WNATIVE[ChainId.Base];
const route = new Route([pool], USDC, WETH);
const trade = Trade.createUncheckedTrade({
route,
inputAmount: CurrencyAmount.fromRawAmount(USDC, '1000000'), // 1 USDC
outputAmount: CurrencyAmount.fromRawAmount(WETH, estimatedOut),
tradeType: TradeType.EXACT_INPUT,
});
const { calldata, value } = SwapRouter.swapCallParameters(trade, {
slippageTolerance: new Percent(50, 10_000),
recipient: '0xYourWallet',
deadline: Math.floor(Date.now() / 1000) + 1200,
});
Supported Networks
| Network | Chain ID | Status |
|---|---|---|
| Base | 8453 | Mainnet |
| Base Sepolia | 84532 | Testnet |