@hashlock-tech/sdk
TypeScript SDK for the Hashlock Markets developer API —
non-custodial cross-chain atomic swaps (BTC ↔ EVM/TRON). Runs on Node 18+, browsers, and edge runtimes
(native fetch / WebSocket, zero runtime dependencies).
⚠️ Sandbox / testnet preview (0.x) — defaults to api-dev.hashlock.markets, testnets only,
pre-mainnet. The API may change before the stable 1.0. Not for mainnet funds.
npm i @hashlock-tech/sdk
import { HashlockClient, newSecret, verifyWebhook, MakerFeed } from '@hashlock-tech/sdk';
const client = new HashlockClient({ apiKey: process.env.HASHLOCK_API_KEY! });
await client.me();
const page = await client.listSwaps({ limit: 20 });
for await (const swap of client.swaps()) { }
const ok = await verifyWebhook({ secret, rawBody, signature: req.headers['x-hashlock-signature'], timestamp: req.headers['x-hashlock-timestamp'] });
const feed = new MakerFeed({ apiKey, onRfq: (rfq) => feed.quote(rfq.id, '650000') });
await feed.connect();
Settlement is custody-agnostic: buildFund / buildClaim / buildRefund return unsigned transactions —
sign with your wallet or HSM (see ../examples/fireblocks) and broadcast(...)
(or let your custody provider broadcast). See the root README for the full swap lifecycle.
Build
npm install && npm run build
npm run typecheck
MIT