hookmind
v0.1.1
Published
HookMind Protocol SDK — AI-powered dynamic fees and IL insurance for Uniswap v4 on Unichain
Downloads
206
Maintainers
Readme
hookmind
TypeScript SDK for the HookMind Protocol — AI-powered dynamic fees and impermanent loss insurance for Uniswap v4 on Unichain.
Install
npm install hookmind
# or
pnpm add hookmindQuick start
import { Agent, HookMindClient } from "hookmind";
// Read-only — no API key required for public endpoints
const client = new HookMindClient();
const pools = await client.getPools();
// Authenticated — pass your API key
const agent = new Agent({ apiKey: "hm_..." });
const signals = await agent.getSignals(10);
const fee = await agent.getFee("0xb60e6d...");Classes
Agent
Full-featured client for authenticated API access. Handles ECDSA signing, WebSocket subscriptions, and all write operations.
const agent = new Agent({
apiKey: "hm_your_key",
baseUrl: "https://hookmind-api.fly.dev", // optional
timeout: 30_000, // optional, ms
});
// Signals
const signals = await agent.getSignals(20);
await agent.submitSignal(signalInput, "0x_private_key");
// Pools & fees
const pool = await agent.getPool("0xb60e6d...");
const fee = await agent.getFee("0xb60e6d...");
const sim = await agent.simulateFee({ baseFee: 300, sigma2: 5000, sigma2Max: 10000 });
// IL Insurance vault
const stats = await agent.getVaultStats();
const quote = await agent.getQuote({ lpAddress: "0xABC..." });
// Operators
await agent.registerOperator("0x_ecdsa_public_key");
// Real-time WebSocket stream
const unsub = agent.subscribe((event) => console.log(event));
// later:
unsub();
agent.closeSubscription();HookMindClient
Lightweight read-only client. No API key required for public endpoints.
const client = new HookMindClient({ apiKey: "hm_..." }); // key optional
const pools = await client.getPools();
const signals = await client.getSignals(50);
const fee = await client.getFee("0xb60e6d...");
const stats = await client.getVaultStats();
// Offline utilities
const signer = HookMindClient.verifySignature(poolId, feeBps, volScore, nonce, chainId, sig);
const pct = HookMindClient.formatFee(500); // → "0.0500%"
const risk = HookMindClient.volatilityRisk(7500); // → "HIGH"HookMindWS
Low-level WebSocket client with exponential backoff reconnection.
import { HookMindWS } from "hookmind";
const ws = new HookMindWS("wss://hookmind-api.fly.dev/ws/signals", jwtToken);
ws.connect();
const unsub = ws.onEvent((event) => console.log(event.type, event.data));
// later:
ws.close();Types
import type {
Signal, SignalInput, PoolData, FeeRecommendation,
SimulateParams, SimulationResult,
VaultStats, ILQuote, ILQuoteParams,
Operator, ApiKey, PingResult, Tier, WSEvent,
} from "hookmind";
import { HookMindError } from "hookmind";Error handling
Every method throws HookMindError on API errors:
try {
await agent.getPool("0xbad...");
} catch (err) {
if (err instanceof HookMindError) {
console.error(err.code, err.status, err.message);
}
}Links
License
MIT © 2026 HookMind Protocol Contributors
