@limitless-exchange/sdk 1.0.3 → 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 +42 -24
- package/dist/index.d.mts +433 -50
- package/dist/index.d.ts +433 -50
- package/dist/index.js +544 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +533 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -167,63 +167,113 @@ interface UserData {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* @internal
|
|
182
|
+
* Profile reference embedded in API-token responses.
|
|
183
|
+
* @public
|
|
198
184
|
*/
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
warn(): void;
|
|
203
|
-
error(): void;
|
|
185
|
+
interface ApiTokenProfile {
|
|
186
|
+
id: number;
|
|
187
|
+
account: string;
|
|
204
188
|
}
|
|
205
189
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
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
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
|
@@ -1582,6 +1750,13 @@ interface WebSocketConfig {
|
|
|
1582
1750
|
* and the LIMITLESS_API_KEY environment variable.
|
|
1583
1751
|
*/
|
|
1584
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;
|
|
1585
1760
|
/**
|
|
1586
1761
|
* Auto-reconnect on connection loss (default: true)
|
|
1587
1762
|
*/
|
|
@@ -1769,6 +1944,42 @@ interface TransactionEvent {
|
|
|
1769
1944
|
/** Trade side (optional) */
|
|
1770
1945
|
side?: 'BUY' | 'SELL';
|
|
1771
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
|
+
}
|
|
1772
1983
|
/**
|
|
1773
1984
|
* WebSocket event types.
|
|
1774
1985
|
* @public
|
|
@@ -1814,6 +2025,14 @@ interface WebSocketEvents {
|
|
|
1814
2025
|
* Market updates
|
|
1815
2026
|
*/
|
|
1816
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;
|
|
1817
2036
|
/**
|
|
1818
2037
|
* Position updates
|
|
1819
2038
|
*/
|
|
@@ -1879,6 +2098,13 @@ interface HttpClientConfig {
|
|
|
1879
2098
|
* Required for authenticated endpoints (portfolio, orders, etc.)
|
|
1880
2099
|
*/
|
|
1881
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;
|
|
1882
2108
|
/**
|
|
1883
2109
|
* Optional logger for debugging
|
|
1884
2110
|
* @defaultValue NoOpLogger (no logging)
|
|
@@ -1967,6 +2193,7 @@ interface HttpRawResponse<T = any> {
|
|
|
1967
2193
|
declare class HttpClient {
|
|
1968
2194
|
private client;
|
|
1969
2195
|
private apiKey?;
|
|
2196
|
+
private hmacCredentials?;
|
|
1970
2197
|
private logger;
|
|
1971
2198
|
/**
|
|
1972
2199
|
* Creates a new HTTP client instance.
|
|
@@ -1995,10 +2222,39 @@ declare class HttpClient {
|
|
|
1995
2222
|
* @param apiKey - API key value
|
|
1996
2223
|
*/
|
|
1997
2224
|
setApiKey(apiKey: string): void;
|
|
2225
|
+
/**
|
|
2226
|
+
* Returns the configured API key, if any.
|
|
2227
|
+
*/
|
|
2228
|
+
getApiKey(): string | undefined;
|
|
1998
2229
|
/**
|
|
1999
2230
|
* Clears the API key.
|
|
2000
2231
|
*/
|
|
2001
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;
|
|
2002
2258
|
/**
|
|
2003
2259
|
* Performs a GET request.
|
|
2004
2260
|
*
|
|
@@ -2007,6 +2263,10 @@ declare class HttpClient {
|
|
|
2007
2263
|
* @returns Promise resolving to the response data
|
|
2008
2264
|
*/
|
|
2009
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>;
|
|
2010
2270
|
/**
|
|
2011
2271
|
* Performs a GET request and returns raw response metadata.
|
|
2012
2272
|
*
|
|
@@ -2027,6 +2287,18 @@ declare class HttpClient {
|
|
|
2027
2287
|
* @returns Promise resolving to the response data
|
|
2028
2288
|
*/
|
|
2029
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>;
|
|
2030
2302
|
/**
|
|
2031
2303
|
* Performs a DELETE request.
|
|
2032
2304
|
*
|
|
@@ -2039,6 +2311,9 @@ declare class HttpClient {
|
|
|
2039
2311
|
* @returns Promise resolving to the response data
|
|
2040
2312
|
*/
|
|
2041
2313
|
delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
2314
|
+
private getRequestPath;
|
|
2315
|
+
private getRequestBodyForSignature;
|
|
2316
|
+
private maskSensitiveHeaders;
|
|
2042
2317
|
}
|
|
2043
2318
|
|
|
2044
2319
|
/**
|
|
@@ -2646,6 +2921,58 @@ declare class RetryableClient {
|
|
|
2646
2921
|
[key: string]: any;
|
|
2647
2922
|
}
|
|
2648
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
|
+
|
|
2649
2976
|
/**
|
|
2650
2977
|
* Default API endpoints and configuration constants.
|
|
2651
2978
|
* @public
|
|
@@ -2719,6 +3046,20 @@ declare const CONTRACT_ADDRESSES: {
|
|
|
2719
3046
|
*/
|
|
2720
3047
|
declare function getContractAddress(contractType: 'USDC' | 'CTF', chainId?: number): string;
|
|
2721
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
|
+
|
|
2722
3063
|
/**
|
|
2723
3064
|
* Order builder for constructing unsigned order payloads.
|
|
2724
3065
|
* @module orders/builder
|
|
@@ -3689,6 +4030,17 @@ declare class WebSocketClient {
|
|
|
3689
4030
|
* If already connected, this will trigger a reconnection with the new API key.
|
|
3690
4031
|
*/
|
|
3691
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;
|
|
3692
4044
|
/**
|
|
3693
4045
|
* Reconnects with new authentication credentials.
|
|
3694
4046
|
* @internal
|
|
@@ -3821,4 +4173,35 @@ declare class WebSocketClient {
|
|
|
3821
4173
|
private getChannelFromKey;
|
|
3822
4174
|
}
|
|
3823
4175
|
|
|
3824
|
-
|
|
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 };
|