@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/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { AxiosRequestConfig } from 'axios';
1
+ import { AxiosRequestConfig, RawAxiosResponseHeaders, AxiosResponseHeaders } from 'axios';
2
2
  import { ethers } from 'ethers';
3
3
 
4
4
  /**
@@ -167,63 +167,113 @@ interface UserData {
167
167
  }
168
168
 
169
169
  /**
170
- * Logger interface for SDK integration.
171
- * Allows users to inject their own logging implementation.
172
- *
170
+ * API token, HMAC auth, and partner capability types.
173
171
  * @public
174
172
  */
175
- interface ILogger {
176
- /**
177
- * Log debug information (verbose, development only)
178
- */
179
- debug(message: string, meta?: Record<string, any>): void;
180
- /**
181
- * Log informational messages
182
- */
183
- info(message: string, meta?: Record<string, any>): void;
184
- /**
185
- * Log warning messages
186
- */
187
- warn(message: string, meta?: Record<string, any>): void;
188
- /**
189
- * Log error messages
190
- */
191
- error(message: string, error?: Error, meta?: Record<string, any>): void;
173
+ /**
174
+ * HMAC credentials for scoped API-token authentication.
175
+ * @public
176
+ */
177
+ interface HMACCredentials {
178
+ tokenId: string;
179
+ secret: string;
192
180
  }
193
181
  /**
194
- * No-op logger (default) - does nothing.
195
- * Zero performance overhead when logging is not needed.
196
- *
197
- * @internal
182
+ * Profile reference embedded in API-token responses.
183
+ * @public
198
184
  */
199
- declare class NoOpLogger implements ILogger {
200
- debug(): void;
201
- info(): void;
202
- warn(): void;
203
- error(): void;
185
+ interface ApiTokenProfile {
186
+ id: number;
187
+ account: string;
204
188
  }
205
189
  /**
206
- * Simple console logger for development.
207
- * Can be used as a starting point or for debugging.
208
- *
209
- * @example
210
- * ```typescript
211
- * import { ConsoleLogger } from '@limitless-exchange/sdk';
212
- *
213
- * const logger = new ConsoleLogger('debug');
214
- * const authenticator = new Authenticator(httpClient, signer, logger);
215
- * ```
216
- *
190
+ * Request payload for self-service token derivation.
191
+ * `label` is token metadata only and does not affect any profile display name.
217
192
  * @public
218
193
  */
219
- declare class ConsoleLogger implements ILogger {
220
- private level;
221
- constructor(level?: 'debug' | 'info' | 'warn' | 'error');
222
- private shouldLog;
223
- debug(message: string, meta?: Record<string, any>): void;
224
- info(message: string, meta?: Record<string, any>): void;
225
- warn(message: string, meta?: Record<string, any>): void;
226
- error(message: string, error?: Error, meta?: Record<string, any>): void;
194
+ interface DeriveApiTokenInput {
195
+ label?: string;
196
+ scopes?: string[];
197
+ }
198
+ /**
199
+ * One-time token derivation response.
200
+ * @public
201
+ */
202
+ interface DeriveApiTokenResponse {
203
+ apiKey: string;
204
+ secret: string;
205
+ tokenId: string;
206
+ createdAt: string;
207
+ scopes: string[];
208
+ profile: ApiTokenProfile;
209
+ }
210
+ /**
211
+ * Active token list item.
212
+ * @public
213
+ */
214
+ interface ApiToken {
215
+ tokenId: string;
216
+ label: string | null;
217
+ scopes: string[];
218
+ createdAt: string;
219
+ lastUsedAt: string | null;
220
+ }
221
+ /**
222
+ * Partner self-service capability config.
223
+ * @public
224
+ */
225
+ interface PartnerCapabilities {
226
+ partnerProfileId: number;
227
+ tokenManagementEnabled: boolean;
228
+ allowedScopes: string[];
229
+ }
230
+ /**
231
+ * Update partner capabilities request.
232
+ * @public
233
+ */
234
+ interface UpdatePartnerCapabilitiesInput {
235
+ tokenManagementEnabled: boolean;
236
+ allowedScopes: string[];
237
+ }
238
+ /**
239
+ * Scope constants.
240
+ * @public
241
+ */
242
+ declare const ScopeTrading = "trading";
243
+ declare const ScopeAccountCreation = "account_creation";
244
+ declare const ScopeDelegatedSigning = "delegated_signing";
245
+
246
+ /**
247
+ * Partner-account creation types.
248
+ * @public
249
+ */
250
+ /**
251
+ * Partner-owned profile creation payload.
252
+ * `displayName` is the public profile name for the created partner account.
253
+ * If omitted, the backend defaults it to the created or verified account address.
254
+ * The backend currently enforces a maximum length of 44 characters.
255
+ * @public
256
+ */
257
+ interface CreatePartnerAccountInput {
258
+ displayName?: string;
259
+ createServerWallet?: boolean;
260
+ }
261
+ /**
262
+ * EOA verification headers for partner-account creation.
263
+ * @public
264
+ */
265
+ interface CreatePartnerAccountEOAHeaders {
266
+ account: string;
267
+ signingMessage: string;
268
+ signature: string;
269
+ }
270
+ /**
271
+ * Partner-account creation response.
272
+ * @public
273
+ */
274
+ interface PartnerAccountResponse {
275
+ profileId: number;
276
+ account: string;
227
277
  }
228
278
 
229
279
  /**
@@ -506,8 +556,11 @@ interface CreatedOrder {
506
556
  signatureType: number;
507
557
  /**
508
558
  * Unique salt for order identification
559
+ *
560
+ * @remarks
561
+ * May be returned as a string when value exceeds JavaScript safe integer range.
509
562
  */
510
- salt: number;
563
+ salt: number | string;
511
564
  /**
512
565
  * Maker address
513
566
  */
@@ -615,6 +668,121 @@ interface OrderSigningConfig {
615
668
  contractAddress: string;
616
669
  }
617
670
 
671
+ /**
672
+ * Delegated-order creation parameters.
673
+ * @public
674
+ */
675
+ interface CreateDelegatedOrderParams {
676
+ marketSlug: string;
677
+ orderType: OrderType;
678
+ onBehalfOf: number;
679
+ feeRateBps?: number;
680
+ args: OrderArgs;
681
+ }
682
+ /**
683
+ * Order submission payload where signature may be omitted.
684
+ * @public
685
+ */
686
+ interface DelegatedOrderSubmission {
687
+ salt: number;
688
+ maker: string;
689
+ signer: string;
690
+ taker: string;
691
+ tokenId: string;
692
+ makerAmount: number;
693
+ takerAmount: number;
694
+ expiration: string;
695
+ nonce: number;
696
+ feeRateBps: number;
697
+ side: Side;
698
+ signatureType: SignatureType;
699
+ price?: number;
700
+ signature?: string;
701
+ }
702
+ /**
703
+ * POST /orders payload for delegated flows.
704
+ * @public
705
+ */
706
+ interface CreateDelegatedOrderRequest {
707
+ order: DelegatedOrderSubmission;
708
+ orderType: OrderType;
709
+ marketSlug: string;
710
+ ownerId: number;
711
+ onBehalfOf?: number;
712
+ }
713
+ /**
714
+ * Cancel endpoint response.
715
+ * @public
716
+ */
717
+ interface CancelResponse {
718
+ message: string;
719
+ }
720
+ /**
721
+ * Re-export of the normal order response for delegated-create helpers.
722
+ * @public
723
+ */
724
+ type DelegatedOrderResponse = OrderResponse;
725
+
726
+ /**
727
+ * Logger interface for SDK integration.
728
+ * Allows users to inject their own logging implementation.
729
+ *
730
+ * @public
731
+ */
732
+ interface ILogger {
733
+ /**
734
+ * Log debug information (verbose, development only)
735
+ */
736
+ debug(message: string, meta?: Record<string, any>): void;
737
+ /**
738
+ * Log informational messages
739
+ */
740
+ info(message: string, meta?: Record<string, any>): void;
741
+ /**
742
+ * Log warning messages
743
+ */
744
+ warn(message: string, meta?: Record<string, any>): void;
745
+ /**
746
+ * Log error messages
747
+ */
748
+ error(message: string, error?: Error, meta?: Record<string, any>): void;
749
+ }
750
+ /**
751
+ * No-op logger (default) - does nothing.
752
+ * Zero performance overhead when logging is not needed.
753
+ *
754
+ * @internal
755
+ */
756
+ declare class NoOpLogger implements ILogger {
757
+ debug(): void;
758
+ info(): void;
759
+ warn(): void;
760
+ error(): void;
761
+ }
762
+ /**
763
+ * Simple console logger for development.
764
+ * Can be used as a starting point or for debugging.
765
+ *
766
+ * @example
767
+ * ```typescript
768
+ * import { ConsoleLogger } from '@limitless-exchange/sdk';
769
+ *
770
+ * const logger = new ConsoleLogger('debug');
771
+ * const authenticator = new Authenticator(httpClient, signer, logger);
772
+ * ```
773
+ *
774
+ * @public
775
+ */
776
+ declare class ConsoleLogger implements ILogger {
777
+ private level;
778
+ constructor(level?: 'debug' | 'info' | 'warn' | 'error');
779
+ private shouldLog;
780
+ debug(message: string, meta?: Record<string, any>): void;
781
+ info(message: string, meta?: Record<string, any>): void;
782
+ warn(message: string, meta?: Record<string, any>): void;
783
+ error(message: string, error?: Error, meta?: Record<string, any>): void;
784
+ }
785
+
618
786
  /**
619
787
  * Portfolio and position types for Limitless Exchange.
620
788
  * @module types/portfolio
@@ -1096,11 +1264,15 @@ interface MarketSettings {
1096
1264
  /**
1097
1265
  * Rewards epoch duration
1098
1266
  */
1099
- rewardsEpoch: string;
1267
+ rewardsEpoch: string | number;
1100
1268
  /**
1101
1269
  * Constant parameter
1102
1270
  */
1103
- c: string;
1271
+ c: string | number;
1272
+ /**
1273
+ * Market maker rebate rate.
1274
+ */
1275
+ rebateRate?: number;
1104
1276
  }
1105
1277
  /**
1106
1278
  * Trade prices for different order types.
@@ -1257,7 +1429,7 @@ interface Venue {
1257
1429
  * Required for NegRisk/Grouped markets only.
1258
1430
  * SELL orders on NegRisk markets require CT approval to both exchange AND adapter.
1259
1431
  */
1260
- adapter: string;
1432
+ adapter: string | null;
1261
1433
  }
1262
1434
  /**
1263
1435
  * Market token IDs for CLOB markets.
@@ -1358,6 +1530,38 @@ interface Market$1 {
1358
1530
  * Formatted trading volume
1359
1531
  */
1360
1532
  volumeFormatted?: string;
1533
+ /**
1534
+ * Market automation type.
1535
+ */
1536
+ automationType?: 'manual' | 'lumy' | 'sports';
1537
+ /**
1538
+ * Primary market image URL.
1539
+ */
1540
+ imageUrl?: string | null;
1541
+ /**
1542
+ * Price trend data.
1543
+ */
1544
+ trends?: Record<string, unknown>;
1545
+ /**
1546
+ * Open interest (AMM markets).
1547
+ */
1548
+ openInterest?: string;
1549
+ /**
1550
+ * Formatted open interest (AMM markets).
1551
+ */
1552
+ openInterestFormatted?: string;
1553
+ /**
1554
+ * Liquidity (AMM markets).
1555
+ */
1556
+ liquidity?: string;
1557
+ /**
1558
+ * Formatted liquidity (AMM markets).
1559
+ */
1560
+ liquidityFormatted?: string;
1561
+ /**
1562
+ * Position IDs (AMM markets).
1563
+ */
1564
+ positionIds?: string[];
1361
1565
  /**
1362
1566
  * Condition ID (CLOB only)
1363
1567
  */
@@ -1546,6 +1750,13 @@ interface WebSocketConfig {
1546
1750
  * and the LIMITLESS_API_KEY environment variable.
1547
1751
  */
1548
1752
  apiKey?: string;
1753
+ /**
1754
+ * HMAC credentials for authenticated subscriptions.
1755
+ *
1756
+ * @remarks
1757
+ * When configured alongside `apiKey`, this client uses HMAC headers for authenticated subscriptions.
1758
+ */
1759
+ hmacCredentials?: HMACCredentials;
1549
1760
  /**
1550
1761
  * Auto-reconnect on connection loss (default: true)
1551
1762
  */
@@ -1733,6 +1944,42 @@ interface TransactionEvent {
1733
1944
  /** Trade side (optional) */
1734
1945
  side?: 'BUY' | 'SELL';
1735
1946
  }
1947
+ /**
1948
+ * Market-created websocket event payload.
1949
+ *
1950
+ * @public
1951
+ */
1952
+ interface MarketCreatedEvent {
1953
+ /** Market slug identifier */
1954
+ slug: string;
1955
+ /** Human-readable market title */
1956
+ title: string;
1957
+ /** Market venue type */
1958
+ type: 'AMM' | 'CLOB';
1959
+ /** Group market slug when this market belongs to a group */
1960
+ groupSlug?: string;
1961
+ /** Category identifiers when provided by the backend */
1962
+ categoryIds?: number[];
1963
+ /** Market creation timestamp */
1964
+ createdAt: Date | number | string;
1965
+ }
1966
+ /**
1967
+ * Market-resolved websocket event payload.
1968
+ *
1969
+ * @public
1970
+ */
1971
+ interface MarketResolvedEvent {
1972
+ /** Market slug identifier */
1973
+ slug: string;
1974
+ /** Market venue type */
1975
+ type: 'AMM' | 'CLOB';
1976
+ /** Winning outcome label */
1977
+ winningOutcome: 'YES' | 'NO';
1978
+ /** Winning outcome index */
1979
+ winningIndex: 0 | 1;
1980
+ /** Resolution timestamp */
1981
+ resolutionDate: Date | number | string;
1982
+ }
1736
1983
  /**
1737
1984
  * WebSocket event types.
1738
1985
  * @public
@@ -1778,6 +2025,14 @@ interface WebSocketEvents {
1778
2025
  * Market updates
1779
2026
  */
1780
2027
  market: (data: MarketUpdate) => void;
2028
+ /**
2029
+ * Market-created lifecycle events.
2030
+ */
2031
+ marketCreated: (data: MarketCreatedEvent) => void;
2032
+ /**
2033
+ * Market-resolved lifecycle events.
2034
+ */
2035
+ marketResolved: (data: MarketResolvedEvent) => void;
1781
2036
  /**
1782
2037
  * Position updates
1783
2038
  */
@@ -1843,6 +2098,13 @@ interface HttpClientConfig {
1843
2098
  * Required for authenticated endpoints (portfolio, orders, etc.)
1844
2099
  */
1845
2100
  apiKey?: string;
2101
+ /**
2102
+ * HMAC credentials for scoped API-token authentication.
2103
+ *
2104
+ * @remarks
2105
+ * When configured alongside `apiKey`, this client uses HMAC headers for authenticated requests.
2106
+ */
2107
+ hmacCredentials?: HMACCredentials;
1846
2108
  /**
1847
2109
  * Optional logger for debugging
1848
2110
  * @defaultValue NoOpLogger (no logging)
@@ -1897,6 +2159,28 @@ interface HttpClientConfig {
1897
2159
  */
1898
2160
  additionalHeaders?: Record<string, string>;
1899
2161
  }
2162
+ /**
2163
+ * Raw HTTP response with status and headers.
2164
+ *
2165
+ * @remarks
2166
+ * Useful for endpoints where response metadata matters (for example redirect handling).
2167
+ *
2168
+ * @public
2169
+ */
2170
+ interface HttpRawResponse<T = any> {
2171
+ /**
2172
+ * HTTP status code.
2173
+ */
2174
+ status: number;
2175
+ /**
2176
+ * Response headers.
2177
+ */
2178
+ headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
2179
+ /**
2180
+ * Response body.
2181
+ */
2182
+ data: T;
2183
+ }
1900
2184
  /**
1901
2185
  * HTTP client wrapper for Limitless Exchange API.
1902
2186
  *
@@ -1909,6 +2193,7 @@ interface HttpClientConfig {
1909
2193
  declare class HttpClient {
1910
2194
  private client;
1911
2195
  private apiKey?;
2196
+ private hmacCredentials?;
1912
2197
  private logger;
1913
2198
  /**
1914
2199
  * Creates a new HTTP client instance.
@@ -1921,16 +2206,55 @@ declare class HttpClient {
1921
2206
  * @internal
1922
2207
  */
1923
2208
  private setupInterceptors;
2209
+ /**
2210
+ * Extracts a human-readable error message from API response payload.
2211
+ * @internal
2212
+ */
2213
+ private extractErrorMessage;
2214
+ /**
2215
+ * Creates a typed API error class from status code.
2216
+ * @internal
2217
+ */
2218
+ private createTypedApiError;
1924
2219
  /**
1925
2220
  * Sets the API key for authenticated requests.
1926
2221
  *
1927
2222
  * @param apiKey - API key value
1928
2223
  */
1929
2224
  setApiKey(apiKey: string): void;
2225
+ /**
2226
+ * Returns the configured API key, if any.
2227
+ */
2228
+ getApiKey(): string | undefined;
1930
2229
  /**
1931
2230
  * Clears the API key.
1932
2231
  */
1933
2232
  clearApiKey(): void;
2233
+ /**
2234
+ * Sets HMAC credentials for scoped API-token authentication.
2235
+ */
2236
+ setHMACCredentials(credentials: HMACCredentials): void;
2237
+ /**
2238
+ * Clears HMAC credentials.
2239
+ */
2240
+ clearHMACCredentials(): void;
2241
+ /**
2242
+ * Returns a copy of the configured HMAC credentials, if any.
2243
+ */
2244
+ getHMACCredentials(): HMACCredentials | undefined;
2245
+ /**
2246
+ * Returns the logger attached to this HTTP client.
2247
+ */
2248
+ getLogger(): ILogger;
2249
+ /**
2250
+ * Returns true when cookie/header-based auth is configured on the underlying client.
2251
+ * This is primarily used for custom authenticated flows that don't use API keys or HMAC.
2252
+ */
2253
+ private hasConfiguredHeaderAuth;
2254
+ /**
2255
+ * Ensures the client has some authenticated transport configured.
2256
+ */
2257
+ requireAuth(operation: string): void;
1934
2258
  /**
1935
2259
  * Performs a GET request.
1936
2260
  *
@@ -1939,6 +2263,21 @@ declare class HttpClient {
1939
2263
  * @returns Promise resolving to the response data
1940
2264
  */
1941
2265
  get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
2266
+ /**
2267
+ * Performs a GET request with identity-token authentication.
2268
+ */
2269
+ getWithIdentity<T = any>(url: string, identityToken: string, config?: AxiosRequestConfig): Promise<T>;
2270
+ /**
2271
+ * Performs a GET request and returns raw response metadata.
2272
+ *
2273
+ * @remarks
2274
+ * Use this when callers need access to status code or headers (e.g. redirect `Location`).
2275
+ *
2276
+ * @param url - Request URL
2277
+ * @param config - Additional request configuration
2278
+ * @returns Promise resolving to status, headers, and response data
2279
+ */
2280
+ getRaw<T = any>(url: string, config?: AxiosRequestConfig): Promise<HttpRawResponse<T>>;
1942
2281
  /**
1943
2282
  * Performs a POST request.
1944
2283
  *
@@ -1948,6 +2287,18 @@ declare class HttpClient {
1948
2287
  * @returns Promise resolving to the response data
1949
2288
  */
1950
2289
  post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
2290
+ /**
2291
+ * Performs a POST request with identity-token authentication.
2292
+ */
2293
+ postWithIdentity<T = any>(url: string, identityToken: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
2294
+ /**
2295
+ * Performs a POST request with additional per-request headers.
2296
+ */
2297
+ postWithHeaders<T = any>(url: string, data?: any, headers?: Record<string, string>, config?: AxiosRequestConfig): Promise<T>;
2298
+ /**
2299
+ * Performs a PATCH request.
2300
+ */
2301
+ patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
1951
2302
  /**
1952
2303
  * Performs a DELETE request.
1953
2304
  *
@@ -1960,6 +2311,9 @@ declare class HttpClient {
1960
2311
  * @returns Promise resolving to the response data
1961
2312
  */
1962
2313
  delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
2314
+ private getRequestPath;
2315
+ private getRequestBodyForSignature;
2316
+ private maskSensitiveHeaders;
1963
2317
  }
1964
2318
 
1965
2319
  /**
@@ -1998,6 +2352,14 @@ declare class Market {
1998
2352
  metadata: MarketMetadata;
1999
2353
  volume?: string;
2000
2354
  volumeFormatted?: string;
2355
+ automationType?: 'manual' | 'lumy' | 'sports';
2356
+ imageUrl?: string | null;
2357
+ trends?: Record<string, unknown>;
2358
+ openInterest?: string;
2359
+ openInterestFormatted?: string;
2360
+ liquidity?: string;
2361
+ liquidityFormatted?: string;
2362
+ positionIds?: string[];
2001
2363
  conditionId?: string;
2002
2364
  negRiskRequestId?: string | null;
2003
2365
  tokens?: MarketTokens;
@@ -2048,6 +2410,159 @@ declare class Market {
2048
2410
  getUserOrders(): Promise<any[]>;
2049
2411
  }
2050
2412
 
2413
+ /**
2414
+ * Navigation node returned by /navigation endpoint.
2415
+ * @public
2416
+ */
2417
+ interface NavigationNode {
2418
+ id: string;
2419
+ name: string;
2420
+ slug: string;
2421
+ path: string;
2422
+ icon?: string;
2423
+ children: NavigationNode[];
2424
+ }
2425
+ /**
2426
+ * Filter group option for market pages.
2427
+ * @public
2428
+ */
2429
+ interface FilterGroupOption {
2430
+ label: string;
2431
+ value: string;
2432
+ metadata?: Record<string, unknown>;
2433
+ }
2434
+ /**
2435
+ * Filter group for market pages.
2436
+ * @public
2437
+ */
2438
+ interface FilterGroup {
2439
+ name?: string;
2440
+ slug?: string;
2441
+ allowMultiple?: boolean;
2442
+ presentation?: string;
2443
+ options?: FilterGroupOption[];
2444
+ source?: Record<string, unknown>;
2445
+ }
2446
+ /**
2447
+ * Breadcrumb item returned by /market-pages/by-path endpoint.
2448
+ * @public
2449
+ */
2450
+ interface BreadcrumbItem {
2451
+ name: string;
2452
+ slug: string;
2453
+ path: string;
2454
+ }
2455
+ /**
2456
+ * Market page data resolved by path.
2457
+ * @public
2458
+ */
2459
+ interface MarketPage {
2460
+ id: string;
2461
+ name: string;
2462
+ slug: string;
2463
+ fullPath: string;
2464
+ description: string | null;
2465
+ baseFilter: Record<string, unknown>;
2466
+ filterGroups: FilterGroup[];
2467
+ metadata: Record<string, unknown>;
2468
+ breadcrumb: BreadcrumbItem[];
2469
+ }
2470
+ /**
2471
+ * Property option returned by property-keys endpoints.
2472
+ * @public
2473
+ */
2474
+ interface PropertyOption {
2475
+ id: string;
2476
+ propertyKeyId: string;
2477
+ value: string;
2478
+ label: string;
2479
+ sortOrder: number;
2480
+ parentOptionId: string | null;
2481
+ metadata: Record<string, unknown>;
2482
+ createdAt: string;
2483
+ updatedAt: string;
2484
+ }
2485
+ /**
2486
+ * Property key returned by property-keys endpoints.
2487
+ * @public
2488
+ */
2489
+ interface PropertyKey {
2490
+ id: string;
2491
+ name: string;
2492
+ slug: string;
2493
+ type: 'select' | 'multi-select';
2494
+ metadata: Record<string, unknown>;
2495
+ isSystem: boolean;
2496
+ options?: PropertyOption[];
2497
+ createdAt: string;
2498
+ updatedAt: string;
2499
+ }
2500
+ /**
2501
+ * Offset pagination metadata.
2502
+ * @public
2503
+ */
2504
+ interface OffsetPagination {
2505
+ page: number;
2506
+ limit: number;
2507
+ total: number;
2508
+ totalPages: number;
2509
+ }
2510
+ /**
2511
+ * Cursor pagination metadata.
2512
+ * @public
2513
+ */
2514
+ interface CursorPagination {
2515
+ nextCursor: string | null;
2516
+ }
2517
+ /**
2518
+ * Sort field for market-pages market listing.
2519
+ * @public
2520
+ */
2521
+ type MarketPageSortField = 'createdAt' | 'updatedAt' | 'deadline' | 'id';
2522
+ /**
2523
+ * Sort value for market-pages market listing.
2524
+ * @public
2525
+ */
2526
+ type MarketPageSort = MarketPageSortField | `-${MarketPageSortField}`;
2527
+ /**
2528
+ * Query params for /market-pages/:id/markets endpoint.
2529
+ * @public
2530
+ */
2531
+ type MarketPageFilterPrimitive = string | number | boolean;
2532
+ type MarketPageFilterValue = MarketPageFilterPrimitive | MarketPageFilterPrimitive[];
2533
+ /**
2534
+ * Query params for /market-pages/:id/markets endpoint.
2535
+ * @public
2536
+ */
2537
+ interface MarketPageMarketsParams {
2538
+ page?: number;
2539
+ limit?: number;
2540
+ sort?: MarketPageSort;
2541
+ cursor?: string;
2542
+ filters?: Record<string, MarketPageFilterValue>;
2543
+ }
2544
+ /**
2545
+ * Offset response for /market-pages/:id/markets endpoint.
2546
+ * @public
2547
+ */
2548
+ interface MarketPageMarketsOffsetResponse {
2549
+ data: Market[];
2550
+ pagination: OffsetPagination;
2551
+ }
2552
+ /**
2553
+ * Cursor response for /market-pages/:id/markets endpoint.
2554
+ * @public
2555
+ */
2556
+ interface MarketPageMarketsCursorResponse {
2557
+ data: Market[];
2558
+ cursor: CursorPagination;
2559
+ }
2560
+ /**
2561
+ * Union response for /market-pages/:id/markets endpoint.
2562
+ * @public
2563
+ */
2564
+ type MarketPageMarketsResponse = MarketPageMarketsOffsetResponse | MarketPageMarketsCursorResponse;
2565
+
2051
2566
  /**
2052
2567
  * API error types for Limitless Exchange SDK.
2053
2568
  * @module api/errors
@@ -2406,6 +2921,58 @@ declare class RetryableClient {
2406
2921
  [key: string]: any;
2407
2922
  }
2408
2923
 
2924
+ /**
2925
+ * Builds the canonical HMAC message used by the API-token auth flow.
2926
+ * @public
2927
+ */
2928
+ declare function buildHMACMessage(timestamp: string, method: string, path: string, body: string): string;
2929
+ /**
2930
+ * Computes a base64 HMAC-SHA256 request signature from a base64 secret.
2931
+ * @public
2932
+ */
2933
+ declare function computeHMACSignature(secret: string, timestamp: string, method: string, path: string, body: string): string;
2934
+
2935
+ /**
2936
+ * Partner self-service API-token operations.
2937
+ * @public
2938
+ */
2939
+ declare class ApiTokenService {
2940
+ private readonly httpClient;
2941
+ private readonly logger;
2942
+ constructor(httpClient: HttpClient, logger?: ILogger);
2943
+ deriveToken(identityToken: string, input: DeriveApiTokenInput): Promise<DeriveApiTokenResponse>;
2944
+ listTokens(): Promise<ApiToken[]>;
2945
+ getCapabilities(identityToken: string): Promise<PartnerCapabilities>;
2946
+ revokeToken(tokenId: string): Promise<string>;
2947
+ }
2948
+
2949
+ /**
2950
+ * Partner-owned profile creation API.
2951
+ * @public
2952
+ */
2953
+ declare class PartnerAccountService {
2954
+ private static readonly DISPLAY_NAME_MAX_LENGTH;
2955
+ private readonly httpClient;
2956
+ private readonly logger;
2957
+ constructor(httpClient: HttpClient, logger?: ILogger);
2958
+ createAccount(input: CreatePartnerAccountInput, eoaHeaders?: CreatePartnerAccountEOAHeaders): Promise<PartnerAccountResponse>;
2959
+ }
2960
+
2961
+ /**
2962
+ * Delegated partner-order operations.
2963
+ * @public
2964
+ */
2965
+ declare class DelegatedOrderService {
2966
+ private readonly httpClient;
2967
+ private readonly logger;
2968
+ constructor(httpClient: HttpClient, logger?: ILogger);
2969
+ createOrder(params: CreateDelegatedOrderParams): Promise<DelegatedOrderResponse>;
2970
+ cancel(orderId: string): Promise<string>;
2971
+ cancelOnBehalfOf(orderId: string, onBehalfOf: number): Promise<string>;
2972
+ cancelAll(marketSlug: string): Promise<string>;
2973
+ cancelAllOnBehalfOf(marketSlug: string, onBehalfOf: number): Promise<string>;
2974
+ }
2975
+
2409
2976
  /**
2410
2977
  * Default API endpoints and configuration constants.
2411
2978
  * @public
@@ -2479,6 +3046,20 @@ declare const CONTRACT_ADDRESSES: {
2479
3046
  */
2480
3047
  declare function getContractAddress(contractType: 'USDC' | 'CTF', chainId?: number): string;
2481
3048
 
3049
+ /**
3050
+ * Numeric parsing helpers for API payloads that may return numbers as strings.
3051
+ */
3052
+ /**
3053
+ * Converts number-like values to finite numbers.
3054
+ * Returns undefined when value is not numeric.
3055
+ */
3056
+ declare function toFiniteNumber(value: unknown): number | undefined;
3057
+ /**
3058
+ * Converts number-like values to finite integers.
3059
+ * Returns undefined when value is not a safe integer.
3060
+ */
3061
+ declare function toFiniteInteger(value: unknown): number | undefined;
3062
+
2482
3063
  /**
2483
3064
  * Order builder for constructing unsigned order payloads.
2484
3065
  * @module orders/builder
@@ -3187,6 +3768,57 @@ declare class OrderClient {
3187
3768
  get ownerId(): number | undefined;
3188
3769
  }
3189
3770
 
3771
+ /**
3772
+ * Fetcher for market-pages and property-keys APIs.
3773
+ *
3774
+ * @remarks
3775
+ * This class provides access to the new navigation-driven market discovery API.
3776
+ *
3777
+ * @public
3778
+ */
3779
+ declare class MarketPageFetcher {
3780
+ private httpClient;
3781
+ private logger;
3782
+ /**
3783
+ * Creates a new market-pages fetcher.
3784
+ *
3785
+ * @param httpClient - HTTP client for API calls
3786
+ * @param logger - Optional logger
3787
+ */
3788
+ constructor(httpClient: HttpClient, logger?: ILogger);
3789
+ /**
3790
+ * Gets the navigation tree.
3791
+ */
3792
+ getNavigation(): Promise<NavigationNode[]>;
3793
+ /**
3794
+ * Resolves a market page by path.
3795
+ *
3796
+ * @remarks
3797
+ * Handles 301 redirects manually by re-requesting `/market-pages/by-path` with the
3798
+ * redirected path value from `Location` header.
3799
+ */
3800
+ getMarketPageByPath(path: string): Promise<MarketPage>;
3801
+ private getMarketPageByPathInternal;
3802
+ private extractRedirectPath;
3803
+ /**
3804
+ * Gets markets for a market page with optional filtering and pagination.
3805
+ */
3806
+ getMarkets(pageId: string, params?: MarketPageMarketsParams): Promise<MarketPageMarketsResponse>;
3807
+ /**
3808
+ * Lists all property keys with options.
3809
+ */
3810
+ getPropertyKeys(): Promise<PropertyKey[]>;
3811
+ /**
3812
+ * Gets a single property key by ID.
3813
+ */
3814
+ getPropertyKey(id: string): Promise<PropertyKey>;
3815
+ /**
3816
+ * Lists options for a property key, optionally filtered by parent option ID.
3817
+ */
3818
+ getPropertyOptions(keyId: string, parentId?: string): Promise<PropertyOption[]>;
3819
+ private stringifyFilterValue;
3820
+ }
3821
+
3190
3822
  /**
3191
3823
  * Portfolio data fetcher for Limitless Exchange.
3192
3824
  * @module portfolio/fetcher
@@ -3398,6 +4030,17 @@ declare class WebSocketClient {
3398
4030
  * If already connected, this will trigger a reconnection with the new API key.
3399
4031
  */
3400
4032
  setApiKey(apiKey: string): void;
4033
+ /**
4034
+ * Sets HMAC credentials for authenticated subscriptions.
4035
+ *
4036
+ * @remarks
4037
+ * When configured alongside `apiKey`, this client uses HMAC headers for authenticated subscriptions.
4038
+ */
4039
+ setHMACCredentials(hmacCredentials: NonNullable<WebSocketConfig['hmacCredentials']>): void;
4040
+ /**
4041
+ * Clears HMAC credentials.
4042
+ */
4043
+ clearHMACCredentials(): void;
3401
4044
  /**
3402
4045
  * Reconnects with new authentication credentials.
3403
4046
  * @internal
@@ -3530,4 +4173,35 @@ declare class WebSocketClient {
3530
4173
  private getChannelFromKey;
3531
4174
  }
3532
4175
 
3533
- export { type AMMPosition, APIError, type ActiveMarketsParams, type ActiveMarketsResponse, type ActiveMarketsSortBy, type AmmPriceEntry, AuthenticationError, BASE_SEPOLIA_CHAIN_ID, type BaseOrderArgs, type CLOBPosition, CONTRACT_ADDRESSES, type CollateralToken, ConsoleLogger, type CreatedOrder, DEFAULT_API_URL, DEFAULT_CHAIN_ID, DEFAULT_WS_URL, type FOKOrderArgs, type FillEvent, type GTCOrderArgs, type HistoryEntry, type HistoryResponse, HttpClient, type HttpClientConfig, type ILogger, type LatestTrade, Market, type MarketCreator, MarketFetcher, type Market$1 as MarketInterface, type MarketMetadata, type MarketOutcome, type MarketSettings, type MarketTokens, type MarketUpdate, type MarketsResponse, type ModeInfo, type NewOrderPayload, type NewPriceData, NoOpLogger, 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, PortfolioFetcher, type PortfolioPositionsResponse, type PortfolioSummary, type Position, type PositionMarket, type PositionSide, type PriceOracleMetadata, type PriceUpdate, RateLimitError, type ReferralData, RetryConfig, type RetryConfigOptions, RetryableClient, SIGNING_MESSAGE_TEMPLATE, Side, SignatureType, type SignedOrder, type SubscriptionChannel, type SubscriptionOptions, type TokenBalance, type TradeEvent, type TradePrices, type TradingMode, type TransactionEvent, type UnsignedOrder, type UserData, type UserProfile, type UserRank, ValidationError, type Venue, WebSocketClient, type WebSocketConfig, type WebSocketEvents, WebSocketState, ZERO_ADDRESS, getContractAddress, retryOnErrors, validateOrderArgs, validateSignedOrder, validateUnsignedOrder, withRetry };
4176
+ /**
4177
+ * Root OOP entrypoint for the SDK.
4178
+ *
4179
+ * @remarks
4180
+ * This mirrors the Go SDK shape: one shared transport plus composed domain services.
4181
+ *
4182
+ * @public
4183
+ */
4184
+ declare class Client {
4185
+ http: HttpClient;
4186
+ markets: MarketFetcher;
4187
+ portfolio: PortfolioFetcher;
4188
+ pages: MarketPageFetcher;
4189
+ apiTokens: ApiTokenService;
4190
+ partnerAccounts: PartnerAccountService;
4191
+ delegatedOrders: DelegatedOrderService;
4192
+ constructor(config?: HttpClientConfig);
4193
+ /**
4194
+ * Creates a root client around an existing shared HTTP client.
4195
+ */
4196
+ static fromHttpClient(httpClient: HttpClient): Client;
4197
+ /**
4198
+ * Creates a regular EIP-712 order client reusing the shared transport and market cache.
4199
+ */
4200
+ newOrderClient(walletOrPrivateKey: ethers.Wallet | string, config?: Omit<OrderClientConfig, 'httpClient' | 'wallet'>): OrderClient;
4201
+ /**
4202
+ * Creates a WebSocket client reusing shared auth where possible.
4203
+ */
4204
+ newWebSocketClient(config?: WebSocketConfig): WebSocketClient;
4205
+ }
4206
+
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 };