@limitless-exchange/sdk 1.0.4 → 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 +71 -17
- package/dist/index.d.mts +47 -2
- package/dist/index.d.ts +47 -2
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -4
- 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
|
|
|
@@ -274,6 +274,60 @@ const order = await orderClient.createOrder({
|
|
|
274
274
|
|
|
275
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
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).
|
|
330
|
+
|
|
277
331
|
### FOK Orders (Fill-or-Kill Market Orders)
|
|
278
332
|
|
|
279
333
|
FOK orders execute immediately at the best available price or cancel entirely. Unlike GTC orders that use `price` + `size`, FOK orders use `makerAmount`.
|
|
@@ -413,24 +467,24 @@ Production-ready code samples are available in [docs/code-samples](https://githu
|
|
|
413
467
|
**CLOB Markets:**
|
|
414
468
|
|
|
415
469
|
- `clob-fok-order.ts` - Fill-or-Kill market orders
|
|
416
|
-
- `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
|
|
417
472
|
|
|
418
473
|
**NegRisk Markets:**
|
|
419
474
|
|
|
420
475
|
- `negrisk-fok-order.ts` - FOK orders on group markets
|
|
421
|
-
- `negrisk-gtc-
|
|
476
|
+
- `negrisk-gtc-order.ts` - GTC orders on NegRisk submarkets
|
|
422
477
|
|
|
423
478
|
### Market Data Examples
|
|
424
479
|
|
|
425
480
|
- `get-active-markets.ts` - Fetching active markets with sorting and pagination
|
|
426
481
|
- `orderbook.ts` - Fetching and analyzing orderbooks
|
|
427
482
|
- `positions.ts` - Portfolio and position tracking
|
|
428
|
-
- `trading.ts` - Complete trading workflow
|
|
483
|
+
- `fluent-api-trading-workflow.ts` - Complete trading workflow
|
|
429
484
|
|
|
430
485
|
### Real-Time Examples
|
|
431
486
|
|
|
432
|
-
- `websocket-
|
|
433
|
-
- `websocket-orderbook.ts` - Live orderbook streaming
|
|
487
|
+
- `websocket-events.ts` - Real-time trading events and subscriptions
|
|
434
488
|
|
|
435
489
|
## Development
|
|
436
490
|
|
|
@@ -498,41 +552,41 @@ docs/
|
|
|
498
552
|
|
|
499
553
|
## Changelog
|
|
500
554
|
|
|
501
|
-
### v1.0.
|
|
555
|
+
### v1.0.5
|
|
502
556
|
|
|
503
|
-
**Release Date**:
|
|
557
|
+
**Release Date**: April 2026
|
|
504
558
|
|
|
505
|
-
Latest release with
|
|
559
|
+
Latest release with `FAK` limit-order support and `postOnly` for `GTC` orders.
|
|
506
560
|
|
|
507
561
|
#### Highlights
|
|
508
562
|
|
|
509
563
|
- ✅ **Production-Ready**: Thoroughly tested and validated against Base mainnet
|
|
510
564
|
- 🔒 **Type-Safe**: Full TypeScript support with comprehensive type definitions
|
|
511
|
-
- 📚 **Well-Documented**:
|
|
565
|
+
- 📚 **Well-Documented**: 18 production-ready code samples + comprehensive guides
|
|
512
566
|
- ⚡ **Performance Optimized**: Venue caching system and connection pooling
|
|
513
567
|
- 🔄 **Robust Error Handling**: Automatic retry logic with multiple strategies
|
|
514
568
|
- 🌐 **Real-Time Updates**: WebSocket support for orderbook and position streaming
|
|
515
569
|
- 🎯 **NegRisk Support**: Full support for group markets with multiple outcomes
|
|
516
570
|
- 🧭 **Market Pages API**: Navigation tree, by-path resolver with 301 handling, page-scoped markets, property keys
|
|
517
|
-
-
|
|
571
|
+
- 🧾 **More Trading Semantics**: `FAK` limit orders plus `postOnly` on `GTC`
|
|
518
572
|
|
|
519
573
|
#### Core Features
|
|
520
574
|
|
|
521
575
|
- **Authentication**: API key authentication, EIP-712 signing, EOA support
|
|
522
576
|
- **Market Data**: Active markets with sorting, orderbook access, venue caching
|
|
523
577
|
- **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
|
|
578
|
+
- **Order Management**: GTC, FAK, and FOK orders, GTC `postOnly`, tick alignment, automatic signing, IEEE-safe create-order payload parsing
|
|
525
579
|
- **Portfolio**: Position tracking, user history
|
|
526
580
|
- **WebSocket**: Real-time orderbook, price updates, event streaming
|
|
527
581
|
- **Error Handling**: Decorator and wrapper retry patterns, configurable strategies
|
|
528
582
|
- **Token Approvals**: Complete setup script, CLOB and NegRisk workflows
|
|
529
583
|
|
|
530
|
-
#### Documentation Enhancements (v1.0.
|
|
584
|
+
#### Documentation Enhancements (v1.0.5)
|
|
531
585
|
|
|
532
|
-
- Added
|
|
533
|
-
- Added
|
|
586
|
+
- Added `FAK` order examples to README and code samples
|
|
587
|
+
- Added `postOnly` usage to `GTC` examples and delegated-order samples
|
|
534
588
|
- Created comprehensive CHANGELOG.md following Keep a Changelog format
|
|
535
|
-
- All
|
|
589
|
+
- All 18 code samples include step-by-step comments and error handling
|
|
536
590
|
- Detailed guides for authentication, trading, markets, portfolio, and WebSocket
|
|
537
591
|
- Added market-pages guide and README quick-start for navigation-driven discovery
|
|
538
592
|
|
package/dist/index.d.mts
CHANGED
|
@@ -295,6 +295,8 @@ declare enum Side {
|
|
|
295
295
|
declare enum OrderType {
|
|
296
296
|
/** Fill-or-Kill: Execute immediately or cancel */
|
|
297
297
|
FOK = "FOK",
|
|
298
|
+
/** Fill-And-Kill: Limit-like order that fills what it can and kills the remainder */
|
|
299
|
+
FAK = "FAK",
|
|
298
300
|
/** Good-Til-Cancelled: Remain on orderbook until filled or cancelled */
|
|
299
301
|
GTC = "GTC"
|
|
300
302
|
}
|
|
@@ -424,12 +426,49 @@ interface GTCOrderArgs extends BaseOrderArgs {
|
|
|
424
426
|
* Number of shares to trade
|
|
425
427
|
*/
|
|
426
428
|
size: number;
|
|
429
|
+
/**
|
|
430
|
+
* When true, rejects the order if it would immediately match.
|
|
431
|
+
* Supported only for GTC orders.
|
|
432
|
+
* @defaultValue false
|
|
433
|
+
*/
|
|
434
|
+
postOnly?: boolean;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Arguments for FAK (Fill-And-Kill) limit orders.
|
|
438
|
+
*
|
|
439
|
+
* @remarks
|
|
440
|
+
* FAK orders use the same price/size construction as GTC, but the unmatched
|
|
441
|
+
* remainder is killed instead of resting on the orderbook. PostOnly is not
|
|
442
|
+
* supported for FAK and is rejected by the API.
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```typescript
|
|
446
|
+
* // BUY: Fill up to 10 shares at 0.55 price, kill remainder
|
|
447
|
+
* {
|
|
448
|
+
* tokenId: '123...',
|
|
449
|
+
* price: 0.55,
|
|
450
|
+
* size: 10,
|
|
451
|
+
* side: Side.BUY
|
|
452
|
+
* }
|
|
453
|
+
* ```
|
|
454
|
+
*
|
|
455
|
+
* @public
|
|
456
|
+
*/
|
|
457
|
+
interface FAKOrderArgs extends BaseOrderArgs {
|
|
458
|
+
/**
|
|
459
|
+
* Price per share (0.0 to 1.0)
|
|
460
|
+
*/
|
|
461
|
+
price: number;
|
|
462
|
+
/**
|
|
463
|
+
* Number of shares to trade
|
|
464
|
+
*/
|
|
465
|
+
size: number;
|
|
427
466
|
}
|
|
428
467
|
/**
|
|
429
468
|
* Union type for all order arguments.
|
|
430
469
|
* @public
|
|
431
470
|
*/
|
|
432
|
-
type OrderArgs = FOKOrderArgs | GTCOrderArgs;
|
|
471
|
+
type OrderArgs = FOKOrderArgs | GTCOrderArgs | FAKOrderArgs;
|
|
433
472
|
/**
|
|
434
473
|
* Unsigned order payload.
|
|
435
474
|
* @public
|
|
@@ -519,6 +558,11 @@ interface NewOrderPayload {
|
|
|
519
558
|
* Owner ID from user profile
|
|
520
559
|
*/
|
|
521
560
|
ownerId: number;
|
|
561
|
+
/**
|
|
562
|
+
* When true, rejects the order if it would immediately match.
|
|
563
|
+
* Supported only for GTC orders.
|
|
564
|
+
*/
|
|
565
|
+
postOnly?: boolean;
|
|
522
566
|
}
|
|
523
567
|
/**
|
|
524
568
|
* Clean order data returned from API.
|
|
@@ -709,6 +753,7 @@ interface CreateDelegatedOrderRequest {
|
|
|
709
753
|
marketSlug: string;
|
|
710
754
|
ownerId: number;
|
|
711
755
|
onBehalfOf?: number;
|
|
756
|
+
postOnly?: boolean;
|
|
712
757
|
}
|
|
713
758
|
/**
|
|
714
759
|
* Cancel endpoint response.
|
|
@@ -4204,4 +4249,4 @@ declare class Client {
|
|
|
4204
4249
|
newWebSocketClient(config?: WebSocketConfig): WebSocketClient;
|
|
4205
4250
|
}
|
|
4206
4251
|
|
|
4207
|
-
export { type AMMPosition, APIError, type ActiveMarketsParams, type ActiveMarketsResponse, type ActiveMarketsSortBy, type AmmPriceEntry, type ApiToken, type ApiTokenProfile, ApiTokenService, AuthenticationError, BASE_SEPOLIA_CHAIN_ID, type BaseOrderArgs, type BreadcrumbItem, type CLOBPosition, CONTRACT_ADDRESSES, type CancelResponse, Client, type CollateralToken, ConsoleLogger, type CreateDelegatedOrderParams, type CreateDelegatedOrderRequest, type CreatePartnerAccountEOAHeaders, type CreatePartnerAccountInput, type CreatedOrder, type CursorPagination, DEFAULT_API_URL, DEFAULT_CHAIN_ID, DEFAULT_WS_URL, type DelegatedOrderResponse, DelegatedOrderService, type DelegatedOrderSubmission, type DeriveApiTokenInput, type DeriveApiTokenResponse, type FOKOrderArgs, type FillEvent, type FilterGroup, type FilterGroupOption, type GTCOrderArgs, type HMACCredentials, type HistoryEntry, type HistoryResponse, HttpClient, type HttpClientConfig, type HttpRawResponse, type ILogger, type LatestTrade, Market, type MarketCreatedEvent, type MarketCreator, MarketFetcher, type Market$1 as MarketInterface, type MarketMetadata, type MarketOutcome, type MarketPage, MarketPageFetcher, type MarketPageFilterPrimitive, type MarketPageFilterValue, type MarketPageMarketsCursorResponse, type MarketPageMarketsOffsetResponse, type MarketPageMarketsParams, type MarketPageMarketsResponse, type MarketPageSort, type MarketPageSortField, type MarketResolvedEvent, type MarketSettings, type MarketTokens, type MarketUpdate, type MarketsResponse, type ModeInfo, type NavigationNode, type NewOrderPayload, type NewPriceData, NoOpLogger, type OffsetPagination, type OrderArgs, type OrderBook, OrderBuilder, OrderClient, type OrderClientConfig, type OrderMatch, type OrderResponse, OrderSigner, type OrderSigningConfig, OrderType, type OrderUpdate, OrderValidationError, type OrderbookData, type OrderbookEntry, type OrderbookUpdate, type PartnerAccountResponse, PartnerAccountService, type PartnerCapabilities, PortfolioFetcher, type PortfolioPositionsResponse, type PortfolioSummary, type Position, type PositionMarket, type PositionSide, type PriceOracleMetadata, type PriceUpdate, type PropertyKey, type PropertyOption, RateLimitError, type ReferralData, RetryConfig, type RetryConfigOptions, RetryableClient, SIGNING_MESSAGE_TEMPLATE, ScopeAccountCreation, ScopeDelegatedSigning, ScopeTrading, Side, SignatureType, type SignedOrder, type SubscriptionChannel, type SubscriptionOptions, type TokenBalance, type TradeEvent, type TradePrices, type TradingMode, type TransactionEvent, type UnsignedOrder, type UpdatePartnerCapabilitiesInput, type UserData, type UserProfile, type UserRank, ValidationError, type Venue, WebSocketClient, type WebSocketConfig, type WebSocketEvents, WebSocketState, ZERO_ADDRESS, buildHMACMessage, computeHMACSignature, getContractAddress, retryOnErrors, toFiniteInteger, toFiniteNumber, validateOrderArgs, validateSignedOrder, validateUnsignedOrder, withRetry };
|
|
4252
|
+
export { type AMMPosition, APIError, type ActiveMarketsParams, type ActiveMarketsResponse, type ActiveMarketsSortBy, type AmmPriceEntry, type ApiToken, type ApiTokenProfile, ApiTokenService, AuthenticationError, BASE_SEPOLIA_CHAIN_ID, type BaseOrderArgs, type BreadcrumbItem, type CLOBPosition, CONTRACT_ADDRESSES, type CancelResponse, Client, type CollateralToken, ConsoleLogger, type CreateDelegatedOrderParams, type CreateDelegatedOrderRequest, type CreatePartnerAccountEOAHeaders, type CreatePartnerAccountInput, type CreatedOrder, type CursorPagination, DEFAULT_API_URL, DEFAULT_CHAIN_ID, DEFAULT_WS_URL, type DelegatedOrderResponse, DelegatedOrderService, type DelegatedOrderSubmission, type DeriveApiTokenInput, type DeriveApiTokenResponse, type FAKOrderArgs, type FOKOrderArgs, type FillEvent, type FilterGroup, type FilterGroupOption, type GTCOrderArgs, type HMACCredentials, type HistoryEntry, type HistoryResponse, HttpClient, type HttpClientConfig, type HttpRawResponse, type ILogger, type LatestTrade, Market, type MarketCreatedEvent, type MarketCreator, MarketFetcher, type Market$1 as MarketInterface, type MarketMetadata, type MarketOutcome, type MarketPage, MarketPageFetcher, type MarketPageFilterPrimitive, type MarketPageFilterValue, type MarketPageMarketsCursorResponse, type MarketPageMarketsOffsetResponse, type MarketPageMarketsParams, type MarketPageMarketsResponse, type MarketPageSort, type MarketPageSortField, type MarketResolvedEvent, type MarketSettings, type MarketTokens, type MarketUpdate, type MarketsResponse, type ModeInfo, type NavigationNode, type NewOrderPayload, type NewPriceData, NoOpLogger, type OffsetPagination, type OrderArgs, type OrderBook, OrderBuilder, OrderClient, type OrderClientConfig, type OrderMatch, type OrderResponse, OrderSigner, type OrderSigningConfig, OrderType, type OrderUpdate, OrderValidationError, type OrderbookData, type OrderbookEntry, type OrderbookUpdate, type PartnerAccountResponse, PartnerAccountService, type PartnerCapabilities, PortfolioFetcher, type PortfolioPositionsResponse, type PortfolioSummary, type Position, type PositionMarket, type PositionSide, type PriceOracleMetadata, type PriceUpdate, type PropertyKey, type PropertyOption, RateLimitError, type ReferralData, RetryConfig, type RetryConfigOptions, RetryableClient, SIGNING_MESSAGE_TEMPLATE, ScopeAccountCreation, ScopeDelegatedSigning, ScopeTrading, Side, SignatureType, type SignedOrder, type SubscriptionChannel, type SubscriptionOptions, type TokenBalance, type TradeEvent, type TradePrices, type TradingMode, type TransactionEvent, type UnsignedOrder, type UpdatePartnerCapabilitiesInput, type UserData, type UserProfile, type UserRank, ValidationError, type Venue, WebSocketClient, type WebSocketConfig, type WebSocketEvents, WebSocketState, ZERO_ADDRESS, buildHMACMessage, computeHMACSignature, getContractAddress, retryOnErrors, toFiniteInteger, toFiniteNumber, validateOrderArgs, validateSignedOrder, validateUnsignedOrder, withRetry };
|
package/dist/index.d.ts
CHANGED
|
@@ -295,6 +295,8 @@ declare enum Side {
|
|
|
295
295
|
declare enum OrderType {
|
|
296
296
|
/** Fill-or-Kill: Execute immediately or cancel */
|
|
297
297
|
FOK = "FOK",
|
|
298
|
+
/** Fill-And-Kill: Limit-like order that fills what it can and kills the remainder */
|
|
299
|
+
FAK = "FAK",
|
|
298
300
|
/** Good-Til-Cancelled: Remain on orderbook until filled or cancelled */
|
|
299
301
|
GTC = "GTC"
|
|
300
302
|
}
|
|
@@ -424,12 +426,49 @@ interface GTCOrderArgs extends BaseOrderArgs {
|
|
|
424
426
|
* Number of shares to trade
|
|
425
427
|
*/
|
|
426
428
|
size: number;
|
|
429
|
+
/**
|
|
430
|
+
* When true, rejects the order if it would immediately match.
|
|
431
|
+
* Supported only for GTC orders.
|
|
432
|
+
* @defaultValue false
|
|
433
|
+
*/
|
|
434
|
+
postOnly?: boolean;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Arguments for FAK (Fill-And-Kill) limit orders.
|
|
438
|
+
*
|
|
439
|
+
* @remarks
|
|
440
|
+
* FAK orders use the same price/size construction as GTC, but the unmatched
|
|
441
|
+
* remainder is killed instead of resting on the orderbook. PostOnly is not
|
|
442
|
+
* supported for FAK and is rejected by the API.
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```typescript
|
|
446
|
+
* // BUY: Fill up to 10 shares at 0.55 price, kill remainder
|
|
447
|
+
* {
|
|
448
|
+
* tokenId: '123...',
|
|
449
|
+
* price: 0.55,
|
|
450
|
+
* size: 10,
|
|
451
|
+
* side: Side.BUY
|
|
452
|
+
* }
|
|
453
|
+
* ```
|
|
454
|
+
*
|
|
455
|
+
* @public
|
|
456
|
+
*/
|
|
457
|
+
interface FAKOrderArgs extends BaseOrderArgs {
|
|
458
|
+
/**
|
|
459
|
+
* Price per share (0.0 to 1.0)
|
|
460
|
+
*/
|
|
461
|
+
price: number;
|
|
462
|
+
/**
|
|
463
|
+
* Number of shares to trade
|
|
464
|
+
*/
|
|
465
|
+
size: number;
|
|
427
466
|
}
|
|
428
467
|
/**
|
|
429
468
|
* Union type for all order arguments.
|
|
430
469
|
* @public
|
|
431
470
|
*/
|
|
432
|
-
type OrderArgs = FOKOrderArgs | GTCOrderArgs;
|
|
471
|
+
type OrderArgs = FOKOrderArgs | GTCOrderArgs | FAKOrderArgs;
|
|
433
472
|
/**
|
|
434
473
|
* Unsigned order payload.
|
|
435
474
|
* @public
|
|
@@ -519,6 +558,11 @@ interface NewOrderPayload {
|
|
|
519
558
|
* Owner ID from user profile
|
|
520
559
|
*/
|
|
521
560
|
ownerId: number;
|
|
561
|
+
/**
|
|
562
|
+
* When true, rejects the order if it would immediately match.
|
|
563
|
+
* Supported only for GTC orders.
|
|
564
|
+
*/
|
|
565
|
+
postOnly?: boolean;
|
|
522
566
|
}
|
|
523
567
|
/**
|
|
524
568
|
* Clean order data returned from API.
|
|
@@ -709,6 +753,7 @@ interface CreateDelegatedOrderRequest {
|
|
|
709
753
|
marketSlug: string;
|
|
710
754
|
ownerId: number;
|
|
711
755
|
onBehalfOf?: number;
|
|
756
|
+
postOnly?: boolean;
|
|
712
757
|
}
|
|
713
758
|
/**
|
|
714
759
|
* Cancel endpoint response.
|
|
@@ -4204,4 +4249,4 @@ declare class Client {
|
|
|
4204
4249
|
newWebSocketClient(config?: WebSocketConfig): WebSocketClient;
|
|
4205
4250
|
}
|
|
4206
4251
|
|
|
4207
|
-
export { type AMMPosition, APIError, type ActiveMarketsParams, type ActiveMarketsResponse, type ActiveMarketsSortBy, type AmmPriceEntry, type ApiToken, type ApiTokenProfile, ApiTokenService, AuthenticationError, BASE_SEPOLIA_CHAIN_ID, type BaseOrderArgs, type BreadcrumbItem, type CLOBPosition, CONTRACT_ADDRESSES, type CancelResponse, Client, type CollateralToken, ConsoleLogger, type CreateDelegatedOrderParams, type CreateDelegatedOrderRequest, type CreatePartnerAccountEOAHeaders, type CreatePartnerAccountInput, type CreatedOrder, type CursorPagination, DEFAULT_API_URL, DEFAULT_CHAIN_ID, DEFAULT_WS_URL, type DelegatedOrderResponse, DelegatedOrderService, type DelegatedOrderSubmission, type DeriveApiTokenInput, type DeriveApiTokenResponse, type FOKOrderArgs, type FillEvent, type FilterGroup, type FilterGroupOption, type GTCOrderArgs, type HMACCredentials, type HistoryEntry, type HistoryResponse, HttpClient, type HttpClientConfig, type HttpRawResponse, type ILogger, type LatestTrade, Market, type MarketCreatedEvent, type MarketCreator, MarketFetcher, type Market$1 as MarketInterface, type MarketMetadata, type MarketOutcome, type MarketPage, MarketPageFetcher, type MarketPageFilterPrimitive, type MarketPageFilterValue, type MarketPageMarketsCursorResponse, type MarketPageMarketsOffsetResponse, type MarketPageMarketsParams, type MarketPageMarketsResponse, type MarketPageSort, type MarketPageSortField, type MarketResolvedEvent, type MarketSettings, type MarketTokens, type MarketUpdate, type MarketsResponse, type ModeInfo, type NavigationNode, type NewOrderPayload, type NewPriceData, NoOpLogger, type OffsetPagination, type OrderArgs, type OrderBook, OrderBuilder, OrderClient, type OrderClientConfig, type OrderMatch, type OrderResponse, OrderSigner, type OrderSigningConfig, OrderType, type OrderUpdate, OrderValidationError, type OrderbookData, type OrderbookEntry, type OrderbookUpdate, type PartnerAccountResponse, PartnerAccountService, type PartnerCapabilities, PortfolioFetcher, type PortfolioPositionsResponse, type PortfolioSummary, type Position, type PositionMarket, type PositionSide, type PriceOracleMetadata, type PriceUpdate, type PropertyKey, type PropertyOption, RateLimitError, type ReferralData, RetryConfig, type RetryConfigOptions, RetryableClient, SIGNING_MESSAGE_TEMPLATE, ScopeAccountCreation, ScopeDelegatedSigning, ScopeTrading, Side, SignatureType, type SignedOrder, type SubscriptionChannel, type SubscriptionOptions, type TokenBalance, type TradeEvent, type TradePrices, type TradingMode, type TransactionEvent, type UnsignedOrder, type UpdatePartnerCapabilitiesInput, type UserData, type UserProfile, type UserRank, ValidationError, type Venue, WebSocketClient, type WebSocketConfig, type WebSocketEvents, WebSocketState, ZERO_ADDRESS, buildHMACMessage, computeHMACSignature, getContractAddress, retryOnErrors, toFiniteInteger, toFiniteNumber, validateOrderArgs, validateSignedOrder, validateUnsignedOrder, withRetry };
|
|
4252
|
+
export { type AMMPosition, APIError, type ActiveMarketsParams, type ActiveMarketsResponse, type ActiveMarketsSortBy, type AmmPriceEntry, type ApiToken, type ApiTokenProfile, ApiTokenService, AuthenticationError, BASE_SEPOLIA_CHAIN_ID, type BaseOrderArgs, type BreadcrumbItem, type CLOBPosition, CONTRACT_ADDRESSES, type CancelResponse, Client, type CollateralToken, ConsoleLogger, type CreateDelegatedOrderParams, type CreateDelegatedOrderRequest, type CreatePartnerAccountEOAHeaders, type CreatePartnerAccountInput, type CreatedOrder, type CursorPagination, DEFAULT_API_URL, DEFAULT_CHAIN_ID, DEFAULT_WS_URL, type DelegatedOrderResponse, DelegatedOrderService, type DelegatedOrderSubmission, type DeriveApiTokenInput, type DeriveApiTokenResponse, type FAKOrderArgs, type FOKOrderArgs, type FillEvent, type FilterGroup, type FilterGroupOption, type GTCOrderArgs, type HMACCredentials, type HistoryEntry, type HistoryResponse, HttpClient, type HttpClientConfig, type HttpRawResponse, type ILogger, type LatestTrade, Market, type MarketCreatedEvent, type MarketCreator, MarketFetcher, type Market$1 as MarketInterface, type MarketMetadata, type MarketOutcome, type MarketPage, MarketPageFetcher, type MarketPageFilterPrimitive, type MarketPageFilterValue, type MarketPageMarketsCursorResponse, type MarketPageMarketsOffsetResponse, type MarketPageMarketsParams, type MarketPageMarketsResponse, type MarketPageSort, type MarketPageSortField, type MarketResolvedEvent, type MarketSettings, type MarketTokens, type MarketUpdate, type MarketsResponse, type ModeInfo, type NavigationNode, type NewOrderPayload, type NewPriceData, NoOpLogger, type OffsetPagination, type OrderArgs, type OrderBook, OrderBuilder, OrderClient, type OrderClientConfig, type OrderMatch, type OrderResponse, OrderSigner, type OrderSigningConfig, OrderType, type OrderUpdate, OrderValidationError, type OrderbookData, type OrderbookEntry, type OrderbookUpdate, type PartnerAccountResponse, PartnerAccountService, type PartnerCapabilities, PortfolioFetcher, type PortfolioPositionsResponse, type PortfolioSummary, type Position, type PositionMarket, type PositionSide, type PriceOracleMetadata, type PriceUpdate, type PropertyKey, type PropertyOption, RateLimitError, type ReferralData, RetryConfig, type RetryConfigOptions, RetryableClient, SIGNING_MESSAGE_TEMPLATE, ScopeAccountCreation, ScopeDelegatedSigning, ScopeTrading, Side, SignatureType, type SignedOrder, type SubscriptionChannel, type SubscriptionOptions, type TokenBalance, type TradeEvent, type TradePrices, type TradingMode, type TransactionEvent, type UnsignedOrder, type UpdatePartnerCapabilitiesInput, type UserData, type UserProfile, type UserRank, ValidationError, type Venue, WebSocketClient, type WebSocketConfig, type WebSocketEvents, WebSocketState, ZERO_ADDRESS, buildHMACMessage, computeHMACSignature, getContractAddress, retryOnErrors, toFiniteInteger, toFiniteNumber, validateOrderArgs, validateSignedOrder, validateUnsignedOrder, withRetry };
|
package/dist/index.js
CHANGED
|
@@ -134,6 +134,7 @@ var Side = /* @__PURE__ */ ((Side2) => {
|
|
|
134
134
|
})(Side || {});
|
|
135
135
|
var OrderType = /* @__PURE__ */ ((OrderType2) => {
|
|
136
136
|
OrderType2["FOK"] = "FOK";
|
|
137
|
+
OrderType2["FAK"] = "FAK";
|
|
137
138
|
OrderType2["GTC"] = "GTC";
|
|
138
139
|
return OrderType2;
|
|
139
140
|
})(OrderType || {});
|
|
@@ -247,8 +248,8 @@ function isNodeRuntime() {
|
|
|
247
248
|
return typeof process !== "undefined" && !!process.versions?.node;
|
|
248
249
|
}
|
|
249
250
|
function resolveSdkVersion() {
|
|
250
|
-
if ("1.0.
|
|
251
|
-
return "1.0.
|
|
251
|
+
if ("1.0.5") {
|
|
252
|
+
return "1.0.5";
|
|
252
253
|
}
|
|
253
254
|
return "0.0.0";
|
|
254
255
|
}
|
|
@@ -1319,6 +1320,7 @@ var DelegatedOrderService = class {
|
|
|
1319
1320
|
const feeRateBps = params.feeRateBps && params.feeRateBps > 0 ? params.feeRateBps : DEFAULT_DELEGATED_FEE_RATE_BPS;
|
|
1320
1321
|
const builder = new OrderBuilder(ZERO_ADDRESS, feeRateBps);
|
|
1321
1322
|
const unsignedOrder = builder.buildOrder(params.args);
|
|
1323
|
+
const postOnly = params.orderType === "GTC" /* GTC */ && "postOnly" in params.args && params.args.postOnly !== void 0 ? params.args.postOnly : void 0;
|
|
1322
1324
|
const payload = {
|
|
1323
1325
|
order: {
|
|
1324
1326
|
salt: unsignedOrder.salt,
|
|
@@ -1338,7 +1340,8 @@ var DelegatedOrderService = class {
|
|
|
1338
1340
|
orderType: params.orderType,
|
|
1339
1341
|
marketSlug: params.marketSlug,
|
|
1340
1342
|
ownerId: params.onBehalfOf,
|
|
1341
|
-
onBehalfOf: params.onBehalfOf
|
|
1343
|
+
onBehalfOf: params.onBehalfOf,
|
|
1344
|
+
...postOnly !== void 0 ? { postOnly } : {}
|
|
1342
1345
|
};
|
|
1343
1346
|
this.logger.debug("Creating delegated order", {
|
|
1344
1347
|
marketSlug: params.marketSlug,
|
|
@@ -2159,6 +2162,7 @@ var OrderClient = class {
|
|
|
2159
2162
|
takerAmount: unsignedOrder.takerAmount
|
|
2160
2163
|
});
|
|
2161
2164
|
const signature = await this.orderSigner.signOrder(unsignedOrder, dynamicSigningConfig);
|
|
2165
|
+
const postOnly = params.orderType === "GTC" /* GTC */ && "postOnly" in params && params.postOnly !== void 0 ? params.postOnly : void 0;
|
|
2162
2166
|
const payload = {
|
|
2163
2167
|
order: {
|
|
2164
2168
|
...unsignedOrder,
|
|
@@ -2166,7 +2170,8 @@ var OrderClient = class {
|
|
|
2166
2170
|
},
|
|
2167
2171
|
orderType: params.orderType,
|
|
2168
2172
|
marketSlug: params.marketSlug,
|
|
2169
|
-
ownerId: userData.userId
|
|
2173
|
+
ownerId: userData.userId,
|
|
2174
|
+
...postOnly !== void 0 ? { postOnly } : {}
|
|
2170
2175
|
};
|
|
2171
2176
|
this.logger.debug("Submitting order to API", payload);
|
|
2172
2177
|
const apiResponse = await this.httpClient.post("/orders", payload);
|