@limitless-exchange/sdk 1.0.3 โ 1.0.5
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 +105 -33
- package/dist/index.d.mts +479 -51
- package/dist/index.d.ts +479 -51
- package/dist/index.js +550 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +539 -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.5** | 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.5 Release**: Adds `FAK` limit-order support and `postOnly` for `GTC` orders, with updated docs and examples. 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,7 @@ 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.
|
|
93
94
|
|
|
94
95
|
### Market Pages & Navigation (No Authentication Required)
|
|
95
96
|
|
|
@@ -120,7 +121,7 @@ if ('pagination' in markets) {
|
|
|
120
121
|
}
|
|
121
122
|
```
|
|
122
123
|
|
|
123
|
-
Detailed guide: [docs/market-pages/README.md](
|
|
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)
|
|
124
125
|
|
|
125
126
|
### Authentication
|
|
126
127
|
|
|
@@ -157,6 +158,21 @@ LIMITLESS_API_KEY=sk_live_your_api_key_here
|
|
|
157
158
|
PRIVATE_KEY=0x...
|
|
158
159
|
```
|
|
159
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
|
+
|
|
160
176
|
### Token Approvals
|
|
161
177
|
|
|
162
178
|
**Important**: Before placing orders, you must approve tokens for the exchange contracts. This is a **one-time setup** per wallet.
|
|
@@ -220,7 +236,7 @@ if (market.negRiskRequestId) {
|
|
|
220
236
|
}
|
|
221
237
|
```
|
|
222
238
|
|
|
223
|
-
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).
|
|
224
240
|
|
|
225
241
|
### Trading on NegRisk Markets
|
|
226
242
|
|
|
@@ -256,7 +272,61 @@ const order = await orderClient.createOrder({
|
|
|
256
272
|
|
|
257
273
|
**Important**: Always use the **submarket slug** for NegRisk orders, not the group market slug!
|
|
258
274
|
|
|
259
|
-
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).
|
|
276
|
+
|
|
277
|
+
### GTC Orders (Limit Orders)
|
|
278
|
+
|
|
279
|
+
GTC orders use `price` + `size` and can optionally set `postOnly` to reject an order that would immediately match.
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
import { OrderClient, Side, OrderType } from '@limitless-exchange/sdk';
|
|
283
|
+
|
|
284
|
+
const gtcOrder = await orderClient.createOrder({
|
|
285
|
+
tokenId: marketDetails.tokens.yes,
|
|
286
|
+
price: 0.42,
|
|
287
|
+
size: 10,
|
|
288
|
+
side: Side.BUY,
|
|
289
|
+
orderType: OrderType.GTC,
|
|
290
|
+
marketSlug: 'market-slug',
|
|
291
|
+
postOnly: true, // Supported only for GTC
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
console.log(gtcOrder.order.id);
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
For complete examples, see [docs/code-samples/clob-gtc-order.ts](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/code-samples/clob-gtc-order.ts).
|
|
298
|
+
|
|
299
|
+
### FAK Orders (Fill-and-Kill Limit Orders)
|
|
300
|
+
|
|
301
|
+
FAK orders use the same `price` + `size` construction as `GTC`, but they only consume immediately available liquidity and cancel any remainder.
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
import { OrderClient, Side, OrderType } from '@limitless-exchange/sdk';
|
|
305
|
+
|
|
306
|
+
const fakOrder = await orderClient.createOrder({
|
|
307
|
+
tokenId: marketDetails.tokens.yes,
|
|
308
|
+
price: 0.45,
|
|
309
|
+
size: 10,
|
|
310
|
+
side: Side.BUY,
|
|
311
|
+
orderType: OrderType.FAK,
|
|
312
|
+
marketSlug: 'market-slug',
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
if (fakOrder.makerMatches && fakOrder.makerMatches.length > 0) {
|
|
316
|
+
console.log(`FAK matched immediately with ${fakOrder.makerMatches.length} fill(s)`);
|
|
317
|
+
} else {
|
|
318
|
+
console.log('FAK remainder was cancelled.');
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Key Differences from GTC**:
|
|
323
|
+
|
|
324
|
+
- FAK uses `price` + `size` like GTC
|
|
325
|
+
- Executes immediately up to the available size
|
|
326
|
+
- Any unfilled remainder is cancelled
|
|
327
|
+
- `postOnly` is not supported for FAK
|
|
328
|
+
|
|
329
|
+
For complete examples, see [docs/code-samples/clob-fak-order.ts](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/code-samples/clob-fak-order.ts).
|
|
260
330
|
|
|
261
331
|
### FOK Orders (Fill-or-Kill Market Orders)
|
|
262
332
|
|
|
@@ -303,7 +373,7 @@ if (buyOrder.makerMatches && buyOrder.makerMatches.length > 0) {
|
|
|
303
373
|
- All-or-nothing execution (no partial fills)
|
|
304
374
|
- Best for immediate execution at market price
|
|
305
375
|
|
|
306
|
-
For complete examples, see [docs/code-samples/clob-fok-order.ts](
|
|
376
|
+
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).
|
|
307
377
|
|
|
308
378
|
### Error Handling & Retry
|
|
309
379
|
|
|
@@ -343,7 +413,7 @@ class TradingService {
|
|
|
343
413
|
- Callback hooks for monitoring retry attempts
|
|
344
414
|
- Three approaches: decorator, wrapper function, or global client wrapper
|
|
345
415
|
|
|
346
|
-
For detailed documentation, see the [Error Handling & Retry Guide](
|
|
416
|
+
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).
|
|
347
417
|
|
|
348
418
|
## API Documentation
|
|
349
419
|
|
|
@@ -370,20 +440,20 @@ await httpClient.post('/endpoint', { data });
|
|
|
370
440
|
|
|
371
441
|
## Documentation
|
|
372
442
|
|
|
373
|
-
For detailed documentation, see the [docs](
|
|
443
|
+
For detailed documentation, see the [docs](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/tree/main/limitless-exchange-sdk/docs) directory:
|
|
374
444
|
|
|
375
|
-
- **[Complete Documentation](
|
|
376
|
-
- **[Authentication Guide](
|
|
377
|
-
- **[Trading & Orders](
|
|
378
|
-
- **[Market Data](
|
|
379
|
-
- **[Portfolio & Positions](
|
|
380
|
-
- **[WebSocket Streaming](
|
|
381
|
-
- **[Error Handling & Retry](
|
|
382
|
-
- **[Logging](
|
|
445
|
+
- **[Complete Documentation](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/README.md)** - Full SDK documentation
|
|
446
|
+
- **[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
|
|
447
|
+
- **[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
|
|
448
|
+
- **[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
|
|
449
|
+
- **[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
|
|
450
|
+
- **[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
|
|
451
|
+
- **[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
|
|
452
|
+
- **[Logging](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/docs/logging/LOGGING.md)** - Logging configuration
|
|
383
453
|
|
|
384
454
|
## Code Examples
|
|
385
455
|
|
|
386
|
-
Production-ready code samples are available in [docs/code-samples](
|
|
456
|
+
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):
|
|
387
457
|
|
|
388
458
|
### Authentication Examples
|
|
389
459
|
|
|
@@ -397,24 +467,24 @@ Production-ready code samples are available in [docs/code-samples](./docs/code-s
|
|
|
397
467
|
**CLOB Markets:**
|
|
398
468
|
|
|
399
469
|
- `clob-fok-order.ts` - Fill-or-Kill market orders
|
|
400
|
-
- `clob-gtc-order.ts` - Good-Til-Cancelled limit orders
|
|
470
|
+
- `clob-gtc-order.ts` - Good-Til-Cancelled limit orders with `postOnly`
|
|
471
|
+
- `clob-fak-order.ts` - Fill-And-Kill limit orders
|
|
401
472
|
|
|
402
473
|
**NegRisk Markets:**
|
|
403
474
|
|
|
404
475
|
- `negrisk-fok-order.ts` - FOK orders on group markets
|
|
405
|
-
- `negrisk-gtc-
|
|
476
|
+
- `negrisk-gtc-order.ts` - GTC orders on NegRisk submarkets
|
|
406
477
|
|
|
407
478
|
### Market Data Examples
|
|
408
479
|
|
|
409
480
|
- `get-active-markets.ts` - Fetching active markets with sorting and pagination
|
|
410
481
|
- `orderbook.ts` - Fetching and analyzing orderbooks
|
|
411
482
|
- `positions.ts` - Portfolio and position tracking
|
|
412
|
-
- `trading.ts` - Complete trading workflow
|
|
483
|
+
- `fluent-api-trading-workflow.ts` - Complete trading workflow
|
|
413
484
|
|
|
414
485
|
### Real-Time Examples
|
|
415
486
|
|
|
416
|
-
- `websocket-
|
|
417
|
-
- `websocket-orderbook.ts` - Live orderbook streaming
|
|
487
|
+
- `websocket-events.ts` - Real-time trading events and subscriptions
|
|
418
488
|
|
|
419
489
|
## Development
|
|
420
490
|
|
|
@@ -482,43 +552,45 @@ docs/
|
|
|
482
552
|
|
|
483
553
|
## Changelog
|
|
484
554
|
|
|
485
|
-
### v1.0.
|
|
555
|
+
### v1.0.5
|
|
486
556
|
|
|
487
|
-
**Release Date**:
|
|
557
|
+
**Release Date**: April 2026
|
|
488
558
|
|
|
489
|
-
Latest release with
|
|
559
|
+
Latest release with `FAK` limit-order support and `postOnly` for `GTC` orders.
|
|
490
560
|
|
|
491
561
|
#### Highlights
|
|
492
562
|
|
|
493
563
|
- โ
**Production-Ready**: Thoroughly tested and validated against Base mainnet
|
|
494
564
|
- ๐ **Type-Safe**: Full TypeScript support with comprehensive type definitions
|
|
495
|
-
- ๐ **Well-Documented**:
|
|
565
|
+
- ๐ **Well-Documented**: 18 production-ready code samples + comprehensive guides
|
|
496
566
|
- โก **Performance Optimized**: Venue caching system and connection pooling
|
|
497
567
|
- ๐ **Robust Error Handling**: Automatic retry logic with multiple strategies
|
|
498
568
|
- ๐ **Real-Time Updates**: WebSocket support for orderbook and position streaming
|
|
499
569
|
- ๐ฏ **NegRisk Support**: Full support for group markets with multiple outcomes
|
|
500
570
|
- ๐งญ **Market Pages API**: Navigation tree, by-path resolver with 301 handling, page-scoped markets, property keys
|
|
571
|
+
- ๐งพ **More Trading Semantics**: `FAK` limit orders plus `postOnly` on `GTC`
|
|
501
572
|
|
|
502
573
|
#### Core Features
|
|
503
574
|
|
|
504
575
|
- **Authentication**: API key authentication, EIP-712 signing, EOA support
|
|
505
576
|
- **Market Data**: Active markets with sorting, orderbook access, venue caching
|
|
506
577
|
- **Market Pages & Navigation**: `/navigation`, `/market-pages/by-path`, `/market-pages/:id/markets`, `/property-keys`
|
|
507
|
-
- **Order Management**: GTC and FOK orders, tick alignment, automatic signing
|
|
578
|
+
- **Order Management**: GTC, FAK, and FOK orders, GTC `postOnly`, tick alignment, automatic signing, IEEE-safe create-order payload parsing
|
|
508
579
|
- **Portfolio**: Position tracking, user history
|
|
509
580
|
- **WebSocket**: Real-time orderbook, price updates, event streaming
|
|
510
581
|
- **Error Handling**: Decorator and wrapper retry patterns, configurable strategies
|
|
511
582
|
- **Token Approvals**: Complete setup script, CLOB and NegRisk workflows
|
|
512
583
|
|
|
513
|
-
#### Documentation Enhancements (v1.0.
|
|
584
|
+
#### Documentation Enhancements (v1.0.5)
|
|
514
585
|
|
|
515
|
-
- Added
|
|
586
|
+
- Added `FAK` order examples to README and code samples
|
|
587
|
+
- Added `postOnly` usage to `GTC` examples and delegated-order samples
|
|
516
588
|
- Created comprehensive CHANGELOG.md following Keep a Changelog format
|
|
517
|
-
- All
|
|
589
|
+
- All 18 code samples include step-by-step comments and error handling
|
|
518
590
|
- Detailed guides for authentication, trading, markets, portfolio, and WebSocket
|
|
519
591
|
- Added market-pages guide and README quick-start for navigation-driven discovery
|
|
520
592
|
|
|
521
|
-
For complete release notes, see [CHANGELOG.md](
|
|
593
|
+
For complete release notes, see [CHANGELOG.md](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/CHANGELOG.md).
|
|
522
594
|
|
|
523
595
|
---
|
|
524
596
|
|
|
@@ -532,4 +604,4 @@ For complete release notes, see [CHANGELOG.md](./CHANGELOG.md).
|
|
|
532
604
|
|
|
533
605
|
## License
|
|
534
606
|
|
|
535
|
-
MIT - See [LICENSE](
|
|
607
|
+
MIT - See [LICENSE](https://github.com/limitless-labs-group/limitless-exchange-ts-sdk/blob/main/limitless-exchange-sdk/LICENSE) file for details
|