Overview
This guide walks through a complete Node.js/TypeScript integration with the Limitless Exchange API: authentication, market data, EIP-712 order signing with viem, order submission, and WebSocket subscriptions for real-time data.Prerequisites
Install the required dependencies:- pnpm
- npm
- yarn
Environment Variables
Create a.env file (and add it to .gitignore):
1. Authentication
Authenticated REST requests (e.g. submitting orders) are signed with HMAC-SHA256 using your scoped API token. Each request carries three headers —lmts-api-key, lmts-timestamp, and lmts-signature — computed over a canonical message of timestamp, HTTP method, request path (with query string), and body. Public market data (browsing markets, orderbooks) needs no authentication. See Authentication for the full reference.
Generating
lmts-signature by hand on the command line is awkward — for shell usage, run the signRequest helper above (or your SDK) to produce the three headers. See Authentication for ready-to-use signing snippets.2. Fetching Market Data and Caching Venue Info
Fetch market details viaGET /markets/:slug. The response includes venue (exchange, adapter) and tokens (the YES and NO token IDs) for CLOB markets.
1
Fetch market by slug
Call
GET /markets/{slug} to retrieve market data including venue addresses.2
Extract venue and token IDs
Use
venue.exchange as the EIP-712 verifyingContract. Use tokens.yes for YES and tokens.no for NO.3
Cache the venue
Venue data is static per market. Fetch once and reuse for all orders on that market.
3. Creating Signed Orders with viem (EIP-712)
Build the order payload and sign it with viem’ssignTypedData. The domain uses venue.exchange as verifyingContract.
EIP-712 Domain and Types
Signing Logic
USDC uses 6 decimals. Use
parseUnits(value, 6) for amounts. Prices are in dollars; multiply price * shares before scaling.4. Submitting Orders
Submit the signed order toPOST /orders with order, orderType, marketSlug, and ownerId.
5. WebSocket Subscription for Real-Time Data
Connect towss://ws.limitless.exchange with namespace /markets using socket.io-client. Emit subscribe_market_prices with marketAddresses and/or marketSlugs.
Complete End-to-End Example
Reference Summary
Next Steps
EIP-712 Signing
Deep dive into order structure and signing.
Venue System
Token approvals and venue addresses.
WebSocket Events
Full event reference for real-time data.
API Reference
Complete endpoint documentation.