@limitless-exchange/sdk 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -38
- package/dist/index.d.mts +728 -54
- package/dist/index.d.ts +728 -54
- package/dist/index.js +773 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +761 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Limitless Exchange TypeScript SDK
|
|
2
2
|
|
|
3
|
-
**v1.0.
|
|
3
|
+
**v1.0.4** | Production-Ready | Type-Safe | Fully Documented
|
|
4
4
|
|
|
5
5
|
A TypeScript SDK for interacting with the Limitless Exchange platform, providing type-safe access to CLOB and NegRisk prediction markets.
|
|
6
6
|
|
|
7
|
-
> 🎉 **v1.0.
|
|
7
|
+
> 🎉 **v1.0.4 Release**: Adds IEEE-aware numeric parsing improvements for `createOrder()` response payload fields (`makerAmount`, `takerAmount`, `price`, `salt`) when API returns numeric strings. See [Changelog](#changelog) for details.
|
|
8
8
|
|
|
9
9
|
## ⚠️ Disclaimer
|
|
10
10
|
|
|
@@ -41,6 +41,7 @@ For production use, we strongly recommend:
|
|
|
41
41
|
- ✅ **NegRisk Markets**: Full support for group markets with multiple outcomes
|
|
42
42
|
- ✅ **Error Handling & Retry**: Automatic retry logic for rate limits and transient failures
|
|
43
43
|
- ✅ **Type Safety**: Full TypeScript support with comprehensive type definitions
|
|
44
|
+
- ✅ **IEEE-Safe Order Payload Parsing**: `createOrder()` handles `makerAmount`, `takerAmount`, `price`, and `salt` returned as JSON strings
|
|
44
45
|
- ✅ **TSDoc Documentation**: Complete API documentation with examples
|
|
45
46
|
- ✅ **WebSocket**: Real-time price and position updates with API key auth
|
|
46
47
|
|
|
@@ -89,7 +90,38 @@ const page2 = await marketFetcher.getActiveMarkets({
|
|
|
89
90
|
});
|
|
90
91
|
```
|
|
91
92
|
|
|
92
|
-
See [examples/project-integration/src/active-markets.ts](
|
|
93
|
+
See [examples/project-integration/src/active-markets.ts](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/examples/project-integration/src/active-markets.ts) for more examples.
|
|
94
|
+
|
|
95
|
+
### Market Pages & Navigation (No Authentication Required)
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { HttpClient, MarketPageFetcher } from '@limitless-exchange/sdk';
|
|
99
|
+
|
|
100
|
+
const httpClient = new HttpClient({
|
|
101
|
+
baseURL: 'https://api.limitless.exchange',
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const pageFetcher = new MarketPageFetcher(httpClient);
|
|
105
|
+
|
|
106
|
+
// Resolve a page from URL path
|
|
107
|
+
const page = await pageFetcher.getMarketPageByPath('/crypto');
|
|
108
|
+
|
|
109
|
+
// Fetch page markets with dynamic filters
|
|
110
|
+
const markets = await pageFetcher.getMarkets(page.id, {
|
|
111
|
+
limit: 20,
|
|
112
|
+
sort: '-updatedAt',
|
|
113
|
+
filters: {
|
|
114
|
+
duration: 'hourly',
|
|
115
|
+
ticker: ['btc', 'eth'],
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if ('pagination' in markets) {
|
|
120
|
+
console.log(`Total markets: ${markets.pagination.total}`);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Detailed guide: [docs/market-pages/README.md](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/market-pages/README.md)
|
|
93
125
|
|
|
94
126
|
### Authentication
|
|
95
127
|
|
|
@@ -122,10 +154,25 @@ Create a `.env` file:
|
|
|
122
154
|
# Required for authenticated endpoints
|
|
123
155
|
LIMITLESS_API_KEY=sk_live_your_api_key_here
|
|
124
156
|
|
|
125
|
-
#
|
|
157
|
+
# REQUIRED: Private key for order signing (EIP-712)
|
|
126
158
|
PRIVATE_KEY=0x...
|
|
127
159
|
```
|
|
128
160
|
|
|
161
|
+
### Partner API Token v3 / HMAC Usage
|
|
162
|
+
|
|
163
|
+
The SDK also supports partner-scoped HMAC credentials for api-token v3 workflows such as token self-service, partner-account creation, and delegated trading.
|
|
164
|
+
|
|
165
|
+
Use HMAC credentials only in a backend or BFF service. Do not expose partner HMAC secrets in browser bundles, frontend environment variables, or client-side storage.
|
|
166
|
+
|
|
167
|
+
Recommended setup:
|
|
168
|
+
|
|
169
|
+
- Keep public market and market-page reads in the browser.
|
|
170
|
+
- Store the real HMAC `tokenId` / `secret` on your backend.
|
|
171
|
+
- Use this SDK server-side to sign partner-authenticated requests.
|
|
172
|
+
- Expose only your own app-specific endpoints to the frontend.
|
|
173
|
+
|
|
174
|
+
See [`docs/code-samples/api-key-v3/`](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/tree/main/limitless-exchange-sdk/docs/code-samples/api-key-v3) for the partner HMAC examples.
|
|
175
|
+
|
|
129
176
|
### Token Approvals
|
|
130
177
|
|
|
131
178
|
**Important**: Before placing orders, you must approve tokens for the exchange contracts. This is a **one-time setup** per wallet.
|
|
@@ -189,7 +236,7 @@ if (market.negRiskRequestId) {
|
|
|
189
236
|
}
|
|
190
237
|
```
|
|
191
238
|
|
|
192
|
-
For complete examples, see [docs/code-samples/setup-approvals.ts](
|
|
239
|
+
For complete examples, see [docs/code-samples/setup-approvals.ts](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/code-samples/setup-approvals.ts).
|
|
193
240
|
|
|
194
241
|
### Trading on NegRisk Markets
|
|
195
242
|
|
|
@@ -225,7 +272,7 @@ const order = await orderClient.createOrder({
|
|
|
225
272
|
|
|
226
273
|
**Important**: Always use the **submarket slug** for NegRisk orders, not the group market slug!
|
|
227
274
|
|
|
228
|
-
For more details, see the [NegRisk Trading Guide](
|
|
275
|
+
For more details, see the [NegRisk Trading Guide](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/orders/README.md#negrisk-markets).
|
|
229
276
|
|
|
230
277
|
### FOK Orders (Fill-or-Kill Market Orders)
|
|
231
278
|
|
|
@@ -272,7 +319,7 @@ if (buyOrder.makerMatches && buyOrder.makerMatches.length > 0) {
|
|
|
272
319
|
- All-or-nothing execution (no partial fills)
|
|
273
320
|
- Best for immediate execution at market price
|
|
274
321
|
|
|
275
|
-
For complete examples, see [docs/code-samples/clob-fok-order.ts](
|
|
322
|
+
For complete examples, see [docs/code-samples/clob-fok-order.ts](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/code-samples/clob-fok-order.ts).
|
|
276
323
|
|
|
277
324
|
### Error Handling & Retry
|
|
278
325
|
|
|
@@ -312,7 +359,7 @@ class TradingService {
|
|
|
312
359
|
- Callback hooks for monitoring retry attempts
|
|
313
360
|
- Three approaches: decorator, wrapper function, or global client wrapper
|
|
314
361
|
|
|
315
|
-
For detailed documentation, see the [Error Handling & Retry Guide](
|
|
362
|
+
For detailed documentation, see the [Error Handling & Retry Guide](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/api/README.md).
|
|
316
363
|
|
|
317
364
|
## API Documentation
|
|
318
365
|
|
|
@@ -325,7 +372,7 @@ HTTP client with API key authentication.
|
|
|
325
372
|
```typescript
|
|
326
373
|
const httpClient = new HttpClient({
|
|
327
374
|
baseURL: 'https://api.limitless.exchange',
|
|
328
|
-
apiKey: process.env.LIMITLESS_API_KEY, //
|
|
375
|
+
apiKey: process.env.LIMITLESS_API_KEY, // you are allowed to pass it that way, otherwise will be loaded from .env
|
|
329
376
|
timeout: 30000,
|
|
330
377
|
});
|
|
331
378
|
|
|
@@ -339,20 +386,20 @@ await httpClient.post('/endpoint', { data });
|
|
|
339
386
|
|
|
340
387
|
## Documentation
|
|
341
388
|
|
|
342
|
-
For detailed documentation, see the [docs](
|
|
389
|
+
For detailed documentation, see the [docs](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/tree/main/limitless-exchange-sdk/docs) directory:
|
|
343
390
|
|
|
344
|
-
- **[Complete Documentation](
|
|
345
|
-
- **[Authentication Guide](
|
|
346
|
-
- **[Trading & Orders](
|
|
347
|
-
- **[Market Data](
|
|
348
|
-
- **[Portfolio & Positions](
|
|
349
|
-
- **[WebSocket Streaming](
|
|
350
|
-
- **[Error Handling & Retry](
|
|
351
|
-
- **[Logging](
|
|
391
|
+
- **[Complete Documentation](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/README.md)** - Full SDK documentation
|
|
392
|
+
- **[Authentication Guide](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/api/README.md)** - API key authentication and HTTP client
|
|
393
|
+
- **[Trading & Orders](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/orders/README.md)** - Order creation, management, and NegRisk markets
|
|
394
|
+
- **[Market Data](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/markets/README.md)** - Market discovery and orderbook access
|
|
395
|
+
- **[Portfolio & Positions](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/portfolio/README.md)** - Position tracking and user history
|
|
396
|
+
- **[WebSocket Streaming](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/websocket/README.md)** - Real-time data updates
|
|
397
|
+
- **[Error Handling & Retry](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/api/README.md)** - API error handling and retry mechanisms
|
|
398
|
+
- **[Logging](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/logging/LOGGING.md)** - Logging configuration
|
|
352
399
|
|
|
353
400
|
## Code Examples
|
|
354
401
|
|
|
355
|
-
Production-ready code samples are available in [docs/code-samples](
|
|
402
|
+
Production-ready code samples are available in [docs/code-samples](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/tree/main/limitless-exchange-sdk/docs/code-samples):
|
|
356
403
|
|
|
357
404
|
### Authentication Examples
|
|
358
405
|
|
|
@@ -451,11 +498,11 @@ docs/
|
|
|
451
498
|
|
|
452
499
|
## Changelog
|
|
453
500
|
|
|
454
|
-
### v1.0.
|
|
501
|
+
### v1.0.4
|
|
455
502
|
|
|
456
|
-
**Release Date**:
|
|
503
|
+
**Release Date**: March 2026
|
|
457
504
|
|
|
458
|
-
|
|
505
|
+
Latest release with IEEE-safe numeric parsing improvements focused on `createOrder()` response payload fields.
|
|
459
506
|
|
|
460
507
|
#### Highlights
|
|
461
508
|
|
|
@@ -466,25 +513,30 @@ This is the first stable, production-ready release of the Limitless Exchange Typ
|
|
|
466
513
|
- 🔄 **Robust Error Handling**: Automatic retry logic with multiple strategies
|
|
467
514
|
- 🌐 **Real-Time Updates**: WebSocket support for orderbook and position streaming
|
|
468
515
|
- 🎯 **NegRisk Support**: Full support for group markets with multiple outcomes
|
|
516
|
+
- 🧭 **Market Pages API**: Navigation tree, by-path resolver with 301 handling, page-scoped markets, property keys
|
|
517
|
+
- 🔢 **IEEE-Aware CreateOrder Parsing**: Normalizes `makerAmount`, `takerAmount`, `price`, and `salt` when returned as JSON strings
|
|
469
518
|
|
|
470
519
|
#### Core Features
|
|
471
520
|
|
|
472
521
|
- **Authentication**: API key authentication, EIP-712 signing, EOA support
|
|
473
522
|
- **Market Data**: Active markets with sorting, orderbook access, venue caching
|
|
474
|
-
- **
|
|
523
|
+
- **Market Pages & Navigation**: `/navigation`, `/market-pages/by-path`, `/market-pages/:id/markets`, `/property-keys`
|
|
524
|
+
- **Order Management**: GTC and FOK orders, tick alignment, automatic signing, IEEE-safe create-order payload parsing
|
|
475
525
|
- **Portfolio**: Position tracking, user history
|
|
476
526
|
- **WebSocket**: Real-time orderbook, price updates, event streaming
|
|
477
527
|
- **Error Handling**: Decorator and wrapper retry patterns, configurable strategies
|
|
478
528
|
- **Token Approvals**: Complete setup script, CLOB and NegRisk workflows
|
|
479
529
|
|
|
480
|
-
#### Documentation Enhancements (v1.0.
|
|
530
|
+
#### Documentation Enhancements (v1.0.4)
|
|
481
531
|
|
|
532
|
+
- Added release notes for IEEE-safe numeric parsing adjustments
|
|
482
533
|
- Added FOK order examples to README with clear `makerAmount` semantics
|
|
483
534
|
- Created comprehensive CHANGELOG.md following Keep a Changelog format
|
|
484
535
|
- All 17 code samples include step-by-step comments and error handling
|
|
485
536
|
- Detailed guides for authentication, trading, markets, portfolio, and WebSocket
|
|
537
|
+
- Added market-pages guide and README quick-start for navigation-driven discovery
|
|
486
538
|
|
|
487
|
-
For complete release notes, see [CHANGELOG.md](
|
|
539
|
+
For complete release notes, see [CHANGELOG.md](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/CHANGELOG.md).
|
|
488
540
|
|
|
489
541
|
---
|
|
490
542
|
|
|
@@ -496,18 +548,6 @@ For complete release notes, see [CHANGELOG.md](./CHANGELOG.md).
|
|
|
496
548
|
|
|
497
549
|
---
|
|
498
550
|
|
|
499
|
-
## LTS Support Policy
|
|
500
|
-
|
|
501
|
-
**v1.0.2 LTS** will receive:
|
|
502
|
-
|
|
503
|
-
- Security updates and critical bug fixes
|
|
504
|
-
- Compatibility maintenance with Limitless Exchange API
|
|
505
|
-
- Community support and issue resolution
|
|
506
|
-
- Documentation updates and improvements
|
|
507
|
-
- Long-term stability for production deployments
|
|
508
|
-
|
|
509
|
-
**Recommended for production use.** We commit to maintaining backward compatibility and providing timely security updates for this LTS release.
|
|
510
|
-
|
|
511
551
|
## License
|
|
512
552
|
|
|
513
|
-
MIT - See [LICENSE](
|
|
553
|
+
MIT - See [LICENSE](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/LICENSE) file for details
|