Working code examples for the HyperMid Partner API and SDKs.
HyperMid is a unified swap, bridge, and fiat on-ramp API that aggregates liquidity across 90+ blockchain networks. It combines:
- LI.FI for EVM cross-chain swaps and bridges
- Near Intents (1Click) for non-EVM chains (NEAR, TON, Tron, XRP, Dogecoin, and more)
- RampNow for fiat-to-crypto on-ramp
A single API integration gives your app access to all providers, with automatic route selection, partner fee attribution, and unified status tracking.
API Base URL: https://api.hypermid.io
Authentication: Optional X-API-Key header. Anonymous access gets 100 req/min; keyed access gets 2000 req/min with partner fee attribution.
cd typescript
npm install
npx tsx src/01-basic-quote.tsSet your API key (optional):
export HYPERMID_API_KEY=your_api_key_herecd go
go run ./basic_quote/cd rust
cargo run --bin basic_quote| File | Description |
|---|---|
01-basic-quote.ts |
Simple quote: ETH to USDC on Arbitrum. Minimal API interaction, no wallet needed. |
02-cross-chain-swap.ts |
Full LI.FI swap lifecycle using executeSwap() with transaction signing and status polling. |
03-near-intents-swap.ts |
Near Intents swap (NEAR to USDC) with wallet-based deposit and submitDeposit(). |
04-manual-deposit.ts |
Manual deposit flow (XRP to ETH) for chains without wallet connectors. QR code / copy-address pattern. |
05-onramp-checkout.ts |
Fiat on-ramp: USD to ETH via RampNow. Checkout session creation and order status polling. |
06-multi-chain-quote.ts |
Compare quotes across multiple routes and destinations using getQuote() and getRoutes(). |
07-partner-analytics.ts |
Partner profile, volume stats, transaction history, and webhook management. Requires API key. |
08-webhook-server.ts |
Express webhook receiver with HMAC-SHA256 signature verification using verifyWebhookSignature(). |
09-polling-status.ts |
Status polling patterns: LI.FI by tx hash, Near Intents by deposit address, custom exponential backoff. |
10-error-handling.ts |
Handling HyperMidError, HyperMidTimeoutError, HyperMidNetworkError. Rate limit retry and graceful fallback. |
| Directory | Description |
|---|---|
basic_quote/ |
Simple quote using raw HTTP. Demonstrates the API envelope parsing pattern. |
cross_chain_swap/ |
Full swap lifecycle: execute, sign, poll status. |
onramp/ |
Fiat on-ramp: create checkout, poll order status. |
webhook_server/ |
HTTP webhook receiver with HMAC-SHA256 signature verification. |
| Binary | Description |
|---|---|
basic_quote |
Simple quote using reqwest. Typed API response deserialization. |
cross_chain_swap |
Full swap lifecycle: execute, sign, poll status. |
onramp |
Fiat on-ramp: checkout session and order polling. |
HyperMid routes swaps through the best available provider:
lifi— EVM cross-chain swaps. Returns atransactionRequestthat you sign with your wallet (ethers.js, viem, go-ethereum, etc.).near-intents— Non-EVM and cross-ecosystem swaps. Returns adepositAddresswhere you send tokens. Supports both wallet-based and manual deposits.
wallet— You send tokens programmatically and callsubmitDeposit()with the tx hash for faster detection.manual— Display the deposit address to the user (QR code, copy button). The system auto-detects incoming deposits.
EVM chains use standard chain IDs. Non-EVM chains use the 900000000 + N convention:
| Chain | ID |
|---|---|
| Ethereum | 1 |
| Arbitrum | 42161 |
| Polygon | 137 |
| Base | 8453 |
| NEAR | 900000001 |
| TON | 900000002 |
| Tron | 900000003 |
| XRP | 900000004 |
| Token | Chain | Address |
|---|---|---|
| ETH (native) | Any EVM | 0x0000000000000000000000000000000000000000 |
| USDC | Ethereum | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
| USDC | Arbitrum | 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 |
| USDT | Polygon | 0xc2132D05D31c914a87C6611C10748AEb04B58e8F |
- TypeScript: @hypermid/sdk (npm)
- Go: github.com/Hypermid/hypermid-sdk-go
- Rust: github.com/Hypermid/hypermid-sdk-rust
- API Docs: https://docs.hypermid.io
| Variable | Required | Description |
|---|---|---|
HYPERMID_API_KEY |
No | API key for authenticated access (2000 req/min, partner fees). |
HYPERMID_WEBHOOK_SECRET |
For webhooks | Webhook signing secret from createWebhook(). |
MIT