parsec-api 0.9.0 → 0.11.0

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.
Files changed (222) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +0 -117
  3. package/client.d.mts +18 -25
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +18 -25
  6. package/client.d.ts.map +1 -1
  7. package/client.js +18 -38
  8. package/client.js.map +1 -1
  9. package/client.mjs +18 -38
  10. package/client.mjs.map +1 -1
  11. package/core/error.d.mts +0 -12
  12. package/core/error.d.mts.map +1 -1
  13. package/core/error.d.ts +0 -12
  14. package/core/error.d.ts.map +1 -1
  15. package/core/error.js +0 -24
  16. package/core/error.js.map +1 -1
  17. package/core/error.mjs +0 -24
  18. package/core/error.mjs.map +1 -1
  19. package/index.d.mts +0 -1
  20. package/index.d.mts.map +1 -1
  21. package/index.d.ts +0 -1
  22. package/index.d.ts.map +1 -1
  23. package/index.js +1 -3
  24. package/index.js.map +1 -1
  25. package/index.mjs +0 -1
  26. package/index.mjs.map +1 -1
  27. package/internal/tslib.js +21 -21
  28. package/internal/utils/query.d.mts +2 -0
  29. package/internal/utils/query.d.mts.map +1 -0
  30. package/internal/utils/query.d.ts +2 -0
  31. package/internal/utils/query.d.ts.map +1 -0
  32. package/internal/utils/query.js +10 -0
  33. package/internal/utils/query.js.map +1 -0
  34. package/internal/utils/query.mjs +6 -0
  35. package/internal/utils/query.mjs.map +1 -0
  36. package/internal/utils.d.mts +1 -0
  37. package/internal/utils.d.ts +1 -0
  38. package/internal/utils.js +1 -0
  39. package/internal/utils.js.map +1 -1
  40. package/internal/utils.mjs +1 -0
  41. package/package.json +2 -3
  42. package/resources/account.d.mts +63 -39
  43. package/resources/account.d.mts.map +1 -1
  44. package/resources/account.d.ts +63 -39
  45. package/resources/account.d.ts.map +1 -1
  46. package/resources/account.js +5 -13
  47. package/resources/account.js.map +1 -1
  48. package/resources/account.mjs +5 -13
  49. package/resources/account.mjs.map +1 -1
  50. package/resources/builder/builder.d.mts +40 -0
  51. package/resources/builder/builder.d.mts.map +1 -0
  52. package/resources/builder/builder.d.ts +40 -0
  53. package/resources/builder/builder.d.ts.map +1 -0
  54. package/resources/builder/builder.js +32 -0
  55. package/resources/builder/builder.js.map +1 -0
  56. package/resources/builder/builder.mjs +27 -0
  57. package/resources/builder/builder.mjs.map +1 -0
  58. package/resources/builder/escrow.d.mts +49 -0
  59. package/resources/builder/escrow.d.mts.map +1 -0
  60. package/resources/builder/escrow.d.ts +49 -0
  61. package/resources/builder/escrow.d.ts.map +1 -0
  62. package/resources/builder/escrow.js +17 -0
  63. package/resources/builder/escrow.js.map +1 -0
  64. package/resources/builder/escrow.mjs +13 -0
  65. package/resources/builder/escrow.mjs.map +1 -0
  66. package/resources/builder/index.d.mts +5 -0
  67. package/resources/builder/index.d.mts.map +1 -0
  68. package/resources/builder/index.d.ts +5 -0
  69. package/resources/builder/index.d.ts.map +1 -0
  70. package/resources/builder/index.js +13 -0
  71. package/resources/builder/index.js.map +1 -0
  72. package/resources/builder/index.mjs +6 -0
  73. package/resources/builder/index.mjs.map +1 -0
  74. package/resources/builder/onboard.d.mts +163 -0
  75. package/resources/builder/onboard.d.mts.map +1 -0
  76. package/resources/builder/onboard.d.ts +163 -0
  77. package/resources/builder/onboard.d.ts.map +1 -0
  78. package/resources/builder/onboard.js +16 -0
  79. package/resources/builder/onboard.js.map +1 -0
  80. package/resources/builder/onboard.mjs +12 -0
  81. package/resources/builder/onboard.mjs.map +1 -0
  82. package/resources/builder/users.d.mts +469 -0
  83. package/resources/builder/users.d.mts.map +1 -0
  84. package/resources/builder/users.d.ts +469 -0
  85. package/resources/builder/users.d.ts.map +1 -0
  86. package/resources/builder/users.js +46 -0
  87. package/resources/builder/users.js.map +1 -0
  88. package/resources/builder/users.mjs +42 -0
  89. package/resources/builder/users.mjs.map +1 -0
  90. package/resources/builder.d.mts +2 -0
  91. package/resources/builder.d.mts.map +1 -0
  92. package/resources/builder.d.ts +2 -0
  93. package/resources/builder.d.ts.map +1 -0
  94. package/resources/builder.js +6 -0
  95. package/resources/builder.js.map +1 -0
  96. package/resources/builder.mjs +3 -0
  97. package/resources/builder.mjs.map +1 -0
  98. package/resources/ctf.d.mts +97 -0
  99. package/resources/ctf.d.mts.map +1 -0
  100. package/resources/ctf.d.ts +97 -0
  101. package/resources/ctf.d.ts.map +1 -0
  102. package/resources/ctf.js +59 -0
  103. package/resources/ctf.js.map +1 -0
  104. package/resources/ctf.mjs +55 -0
  105. package/resources/ctf.mjs.map +1 -0
  106. package/resources/events.d.mts +84 -12
  107. package/resources/events.d.mts.map +1 -1
  108. package/resources/events.d.ts +84 -12
  109. package/resources/events.d.ts.map +1 -1
  110. package/resources/events.js +4 -15
  111. package/resources/events.js.map +1 -1
  112. package/resources/events.mjs +4 -15
  113. package/resources/events.mjs.map +1 -1
  114. package/resources/exchanges.d.mts +1 -1
  115. package/resources/exchanges.d.mts.map +1 -1
  116. package/resources/exchanges.d.ts +1 -1
  117. package/resources/exchanges.d.ts.map +1 -1
  118. package/resources/fills.d.mts +76 -0
  119. package/resources/fills.d.mts.map +1 -0
  120. package/resources/fills.d.ts +76 -0
  121. package/resources/fills.d.ts.map +1 -0
  122. package/resources/fills.js +27 -0
  123. package/resources/fills.js.map +1 -0
  124. package/resources/fills.mjs +23 -0
  125. package/resources/fills.mjs.map +1 -0
  126. package/resources/index.d.mts +7 -3
  127. package/resources/index.d.mts.map +1 -1
  128. package/resources/index.d.ts +7 -3
  129. package/resources/index.d.ts.map +1 -1
  130. package/resources/index.js +11 -3
  131. package/resources/index.js.map +1 -1
  132. package/resources/index.mjs +6 -2
  133. package/resources/index.mjs.map +1 -1
  134. package/resources/markets.d.mts +92 -19
  135. package/resources/markets.d.mts.map +1 -1
  136. package/resources/markets.d.ts +92 -19
  137. package/resources/markets.d.ts.map +1 -1
  138. package/resources/markets.js +1 -30
  139. package/resources/markets.js.map +1 -1
  140. package/resources/markets.mjs +1 -29
  141. package/resources/markets.mjs.map +1 -1
  142. package/resources/onboard.d.mts +91 -0
  143. package/resources/onboard.d.mts.map +1 -0
  144. package/resources/onboard.d.ts +91 -0
  145. package/resources/onboard.d.ts.map +1 -0
  146. package/resources/onboard.js +17 -0
  147. package/resources/onboard.js.map +1 -0
  148. package/resources/onboard.mjs +13 -0
  149. package/resources/onboard.mjs.map +1 -0
  150. package/resources/orderbook.d.mts +5 -11
  151. package/resources/orderbook.d.mts.map +1 -1
  152. package/resources/orderbook.d.ts +5 -11
  153. package/resources/orderbook.d.ts.map +1 -1
  154. package/resources/orderbook.js +2 -1
  155. package/resources/orderbook.js.map +1 -1
  156. package/resources/orderbook.mjs +2 -1
  157. package/resources/orderbook.mjs.map +1 -1
  158. package/resources/price.d.mts +1 -0
  159. package/resources/price.d.mts.map +1 -1
  160. package/resources/price.d.ts +1 -0
  161. package/resources/price.d.ts.map +1 -1
  162. package/resources/price.js +1 -0
  163. package/resources/price.js.map +1 -1
  164. package/resources/price.mjs +1 -0
  165. package/resources/price.mjs.map +1 -1
  166. package/resources/trades.d.mts +12 -2
  167. package/resources/trades.d.mts.map +1 -1
  168. package/resources/trades.d.ts +12 -2
  169. package/resources/trades.d.ts.map +1 -1
  170. package/resources/trades.js +2 -1
  171. package/resources/trades.js.map +1 -1
  172. package/resources/trades.mjs +2 -1
  173. package/resources/trades.mjs.map +1 -1
  174. package/resources/wallet.d.mts +177 -0
  175. package/resources/wallet.d.mts.map +1 -0
  176. package/resources/wallet.d.ts +177 -0
  177. package/resources/wallet.d.ts.map +1 -0
  178. package/resources/wallet.js +26 -0
  179. package/resources/wallet.js.map +1 -0
  180. package/resources/wallet.mjs +22 -0
  181. package/resources/wallet.mjs.map +1 -0
  182. package/src/client.ts +49 -63
  183. package/src/core/error.ts +0 -29
  184. package/src/index.ts +0 -14
  185. package/src/internal/utils/query.ts +7 -0
  186. package/src/internal/utils.ts +1 -0
  187. package/src/resources/account.ts +78 -55
  188. package/src/resources/builder/builder.ts +78 -0
  189. package/src/resources/builder/escrow.ts +62 -0
  190. package/src/resources/builder/index.ts +15 -0
  191. package/src/resources/builder/onboard.ts +206 -0
  192. package/src/resources/builder/users.ts +606 -0
  193. package/src/resources/builder.ts +3 -0
  194. package/src/resources/ctf.ts +122 -0
  195. package/src/resources/events.ts +104 -26
  196. package/src/resources/exchanges.ts +2 -2
  197. package/src/resources/fills.ts +107 -0
  198. package/src/resources/index.ts +12 -15
  199. package/src/resources/markets.ts +114 -49
  200. package/src/resources/onboard.ts +116 -0
  201. package/src/resources/orderbook.ts +4 -12
  202. package/src/resources/price.ts +1 -0
  203. package/src/resources/trades.ts +14 -3
  204. package/src/resources/wallet.ts +224 -0
  205. package/src/version.ts +1 -1
  206. package/version.d.mts +1 -1
  207. package/version.d.mts.map +1 -1
  208. package/version.d.ts +1 -1
  209. package/version.d.ts.map +1 -1
  210. package/version.js +1 -1
  211. package/version.js.map +1 -1
  212. package/version.mjs +1 -1
  213. package/version.mjs.map +1 -1
  214. package/resources/approvals.d.mts +0 -74
  215. package/resources/approvals.d.mts.map +0 -1
  216. package/resources/approvals.d.ts +0 -74
  217. package/resources/approvals.d.ts.map +0 -1
  218. package/resources/approvals.js +0 -22
  219. package/resources/approvals.js.map +0 -1
  220. package/resources/approvals.mjs +0 -18
  221. package/resources/approvals.mjs.map +0 -1
  222. package/src/resources/approvals.ts +0 -107
package/src/client.ts CHANGED
@@ -11,31 +11,23 @@ import type { APIResponseProps } from './internal/parse';
11
11
  import { getPlatformHeaders } from './internal/detect-platform';
12
12
  import * as Shims from './internal/shims';
13
13
  import * as Opts from './internal/request-options';
14
- import * as qs from './internal/qs';
14
+ import { stringifyQuery } from './internal/utils/query';
15
15
  import { VERSION } from './version';
16
16
  import * as Errors from './core/error';
17
17
  import * as Uploads from './core/uploads';
18
18
  import * as API from './resources/index';
19
- import { ParsecWebSocket, type ParsecWebSocketOptions } from './streaming';
20
19
  import { APIPromise } from './core/api-promise';
21
20
  import {
22
21
  Account,
23
22
  AccountBalanceParams,
24
23
  AccountBalanceResponse,
25
- AccountCapabilitiesResponse,
26
24
  AccountPingParams,
27
25
  AccountPingResponse,
28
- AccountUpdateCredentialsParams,
26
+ AccountUsageResponse,
29
27
  AccountUserActivityParams,
30
28
  AccountUserActivityResponse,
31
29
  } from './resources/account';
32
- import {
33
- ApprovalListParams,
34
- ApprovalListResponse,
35
- ApprovalSetParams,
36
- ApprovalSetResponse,
37
- Approvals,
38
- } from './resources/approvals';
30
+ import { Ctf, CtfMergeParams, CtfRedeemParams, CtfResponse, CtfSplitParams } from './resources/ctf';
39
31
  import { EventListParams, EventListResponse, Events } from './resources/events';
40
32
  import { ExchangeListResponse, Exchanges } from './resources/exchanges';
41
33
  import {
@@ -43,7 +35,9 @@ import {
43
35
  ExecutionPriceRetrieveParams,
44
36
  ExecutionPriceRetrieveResponse,
45
37
  } from './resources/execution-price';
38
+ import { FillListParams, FillListResponse, Fills } from './resources/fills';
46
39
  import { MarketListParams, MarketListResponse, Markets } from './resources/markets';
40
+ import { Onboard, OnboardCreateParams, OnboardCreateResponse } from './resources/onboard';
47
41
  import { Orderbook, OrderbookRetrieveParams, OrderbookRetrieveResponse } from './resources/orderbook';
48
42
  import {
49
43
  Order,
@@ -57,12 +51,19 @@ import {
57
51
  import { PositionListParams, PositionListResponse, Positions } from './resources/positions';
58
52
  import { Price, PriceRetrieveParams, PriceRetrieveResponse } from './resources/price';
59
53
  import { TradeListParams, TradeListResponse, Trades } from './resources/trades';
54
+ import {
55
+ Wallet,
56
+ WalletExportKeyParams,
57
+ WalletExportKeyResponse,
58
+ WalletRetrieveResponse,
59
+ } from './resources/wallet';
60
60
  import {
61
61
  CustomerUsage,
62
62
  Websocket,
63
63
  WebsocketUsageParams,
64
64
  WebsocketUsageResponse,
65
65
  } from './resources/websocket';
66
+ import { Builder, BuilderPoolResponse } from './resources/builder/builder';
66
67
  import { type Fetch } from './internal/builtin-types';
67
68
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
68
69
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -164,11 +165,6 @@ export interface ClientOptions {
164
165
  * Defaults to globalThis.console.
165
166
  */
166
167
  logger?: Logger | undefined;
167
-
168
- // TODO(verbose-mode): Add per-request debug override that logs raw request/response
169
- // details (method, URL, headers, body, status) independent of global log level.
170
- // pmxt exposes `verbose: true` per request, which is useful during strategy
171
- // integration debugging without enabling global SDK logging noise.
172
168
  }
173
169
 
174
170
  /**
@@ -285,8 +281,8 @@ export class ParsecAPI {
285
281
  return buildHeaders([{ 'X-API-Key': this.apiKey }]);
286
282
  }
287
283
 
288
- protected stringifyQuery(query: Record<string, unknown>): string {
289
- return qs.stringify(query, { arrayFormat: 'comma' });
284
+ protected stringifyQuery(query: object | Record<string, unknown>): string {
285
+ return stringifyQuery(query);
290
286
  }
291
287
 
292
288
  private getUserAgent(): string {
@@ -323,7 +319,7 @@ export class ParsecAPI {
323
319
  }
324
320
 
325
321
  if (typeof query === 'object' && query && !Array.isArray(query)) {
326
- url.search = this.stringifyQuery(query as Record<string, unknown>);
322
+ url.search = this.stringifyQuery(query);
327
323
  }
328
324
 
329
325
  return url.toString();
@@ -762,7 +758,7 @@ export class ParsecAPI {
762
758
  ) {
763
759
  return {
764
760
  bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
765
- body: this.stringifyQuery(body as Record<string, unknown>),
761
+ body: this.stringifyQuery(body),
766
762
  };
767
763
  } else {
768
764
  return this.#encoder({ body, headers });
@@ -798,42 +794,12 @@ export class ParsecAPI {
798
794
  websocket: API.Websocket = new API.Websocket(this);
799
795
  orders: API.Orders = new API.Orders(this);
800
796
  positions: API.Positions = new API.Positions(this);
797
+ fills: API.Fills = new API.Fills(this);
801
798
  account: API.Account = new API.Account(this);
802
- approvals: API.Approvals = new API.Approvals(this);
803
-
804
- /**
805
- * Create a WebSocket client for real-time orderbook and trade streaming.
806
- * Inherits `apiKey` from this client and derives the WebSocket URL from `baseURL`.
807
- *
808
- * @param opts.url - Override the WebSocket URL (derived from baseURL by default).
809
- * @returns A new `ParsecWebSocket` instance.
810
- *
811
- * @example
812
- * ```ts
813
- * const client = new ParsecAPI({ apiKey: 'pk_...' });
814
- * const ws = client.ws();
815
- *
816
- * ws.on('orderbook', (book) => console.log(book.bids[0]));
817
- * await ws.connect();
818
- * ws.subscribe({ parsecId: 'polymarket:0x123', outcome: 'Yes' });
819
- * ```
820
- */
821
- ws(opts?: ParsecWebSocketOptions): ParsecWebSocket {
822
- const wsUrl = opts?.url ?? this.#deriveWsUrl();
823
- return new ParsecWebSocket(this.apiKey, wsUrl);
824
- }
825
-
826
- #deriveWsUrl(): string {
827
- const base = this.baseURL.replace(/\/$/, '');
828
- if (base.startsWith('https://')) {
829
- return base.replace(/^https:\/\//, 'wss://') + '/ws';
830
- }
831
- if (base.startsWith('http://')) {
832
- return base.replace(/^http:\/\//, 'ws://') + '/ws';
833
- }
834
- // Fallback: assume wss
835
- return 'wss://' + base + '/ws';
836
- }
799
+ onboard: API.Onboard = new API.Onboard(this);
800
+ wallet: API.Wallet = new API.Wallet(this);
801
+ ctf: API.Ctf = new API.Ctf(this);
802
+ builder: API.Builder = new API.Builder(this);
837
803
  }
838
804
 
839
805
  ParsecAPI.Exchanges = Exchanges;
@@ -846,8 +812,12 @@ ParsecAPI.Events = Events;
846
812
  ParsecAPI.Websocket = Websocket;
847
813
  ParsecAPI.Orders = Orders;
848
814
  ParsecAPI.Positions = Positions;
815
+ ParsecAPI.Fills = Fills;
849
816
  ParsecAPI.Account = Account;
850
- ParsecAPI.Approvals = Approvals;
817
+ ParsecAPI.Onboard = Onboard;
818
+ ParsecAPI.Wallet = Wallet;
819
+ ParsecAPI.Ctf = Ctf;
820
+ ParsecAPI.Builder = Builder;
851
821
 
852
822
  export declare namespace ParsecAPI {
853
823
  export type RequestOptions = Opts.RequestOptions;
@@ -913,23 +883,39 @@ export declare namespace ParsecAPI {
913
883
  type PositionListParams as PositionListParams,
914
884
  };
915
885
 
886
+ export { Fills as Fills, type FillListResponse as FillListResponse, type FillListParams as FillListParams };
887
+
916
888
  export {
917
889
  Account as Account,
918
890
  type AccountBalanceResponse as AccountBalanceResponse,
919
- type AccountCapabilitiesResponse as AccountCapabilitiesResponse,
920
891
  type AccountPingResponse as AccountPingResponse,
892
+ type AccountUsageResponse as AccountUsageResponse,
921
893
  type AccountUserActivityResponse as AccountUserActivityResponse,
922
894
  type AccountBalanceParams as AccountBalanceParams,
923
895
  type AccountPingParams as AccountPingParams,
924
- type AccountUpdateCredentialsParams as AccountUpdateCredentialsParams,
925
896
  type AccountUserActivityParams as AccountUserActivityParams,
926
897
  };
927
898
 
928
899
  export {
929
- Approvals as Approvals,
930
- type ApprovalListResponse as ApprovalListResponse,
931
- type ApprovalSetResponse as ApprovalSetResponse,
932
- type ApprovalListParams as ApprovalListParams,
933
- type ApprovalSetParams as ApprovalSetParams,
900
+ Onboard as Onboard,
901
+ type OnboardCreateResponse as OnboardCreateResponse,
902
+ type OnboardCreateParams as OnboardCreateParams,
934
903
  };
904
+
905
+ export {
906
+ Wallet as Wallet,
907
+ type WalletRetrieveResponse as WalletRetrieveResponse,
908
+ type WalletExportKeyResponse as WalletExportKeyResponse,
909
+ type WalletExportKeyParams as WalletExportKeyParams,
910
+ };
911
+
912
+ export {
913
+ Ctf as Ctf,
914
+ type CtfResponse as CtfResponse,
915
+ type CtfMergeParams as CtfMergeParams,
916
+ type CtfRedeemParams as CtfRedeemParams,
917
+ type CtfSplitParams as CtfSplitParams,
918
+ };
919
+
920
+ export { Builder as Builder, type BuilderPoolResponse as BuilderPoolResponse };
935
921
  }
package/src/core/error.ts CHANGED
@@ -23,35 +23,6 @@ export class APIError<
23
23
  this.error = error;
24
24
  }
25
25
 
26
- /**
27
- * Machine-readable error code from API response body, when provided.
28
- * Example: `insufficient_funds`, `rate_limit_exceeded`.
29
- */
30
- get code(): string | undefined {
31
- const code = (this.error as any)?.code;
32
- return typeof code === 'string' ? code : undefined;
33
- }
34
-
35
- /**
36
- * Retry hint from API response body, when provided.
37
- */
38
- get retryable(): boolean | undefined {
39
- const retryable = (this.error as any)?.retryable;
40
- return typeof retryable === 'boolean' ? retryable : undefined;
41
- }
42
-
43
- isCode(code: string): boolean {
44
- return this.code === code;
45
- }
46
-
47
- isRetryable(): boolean {
48
- return this.retryable === true;
49
- }
50
-
51
- isInsufficientFunds(): boolean {
52
- return this.code === 'insufficient_funds';
53
- }
54
-
55
26
  private static makeMessage(status: number | undefined, error: any, message: string | undefined) {
56
27
  const msg =
57
28
  error?.message ?
package/src/index.ts CHANGED
@@ -20,17 +20,3 @@ export {
20
20
  PermissionDeniedError,
21
21
  UnprocessableEntityError,
22
22
  } from './core/error';
23
-
24
- export {
25
- ParsecWebSocket,
26
- type ParsecWebSocketOptions,
27
- type ParsecWebSocketEventMap,
28
- type OrderbookSnapshot,
29
- type StreamingOrderbookLevel,
30
- type Activity,
31
- type WsError,
32
- type MarketSubscription,
33
- type FeedState,
34
- type BookState,
35
- type OrderbookKind,
36
- } from './streaming';
@@ -0,0 +1,7 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import * as qs from '../qs/stringify';
4
+
5
+ export function stringifyQuery(query: object | Record<string, unknown>) {
6
+ return qs.stringify(query, { arrayFormat: 'comma' });
7
+ }
@@ -6,3 +6,4 @@ export * from './utils/env';
6
6
  export * from './utils/log';
7
7
  export * from './utils/uuid';
8
8
  export * from './utils/sleep';
9
+ export * from './utils/query';
@@ -23,13 +23,6 @@ export class Account extends APIResource {
23
23
  });
24
24
  }
25
25
 
26
- /**
27
- * Returns the customer's tier and list of linked exchanges.
28
- */
29
- capabilities(options?: RequestOptions): APIPromise<AccountCapabilitiesResponse> {
30
- return this._client.get('/api/v1/session/capabilities', options);
31
- }
32
-
33
26
  /**
34
27
  * Performs a lightweight balance fetch per exchange to verify connectivity/auth
35
28
  * status.
@@ -42,14 +35,12 @@ export class Account extends APIResource {
42
35
  }
43
36
 
44
37
  /**
45
- * Updates stored credentials for this API key. Returns 204 on success.
38
+ * Returns the authenticated customer's tier, billing period, rate limits, and
39
+ * current consumption (monthly requests, WebSocket connections/subscriptions).
40
+ * Values of 0 for limits indicate unlimited.
46
41
  */
47
- updateCredentials(body: AccountUpdateCredentialsParams, options?: RequestOptions): APIPromise<void> {
48
- return this._client.put('/api/v1/credentials', {
49
- body,
50
- ...options,
51
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
52
- });
42
+ usage(options?: RequestOptions): APIPromise<AccountUsageResponse> {
43
+ return this._client.get('/api/v1/usage', options);
53
44
  }
54
45
 
55
46
  /**
@@ -68,18 +59,6 @@ export interface AccountBalanceResponse {
68
59
  raw: { [key: string]: unknown };
69
60
  }
70
61
 
71
- export interface AccountCapabilitiesResponse {
72
- /**
73
- * Exchange IDs the customer has credentials linked for.
74
- */
75
- linked_exchanges: Array<string>;
76
-
77
- /**
78
- * Customer tier (e.g., "free", "pro", "admin").
79
- */
80
- tier: string;
81
- }
82
-
83
62
  export type AccountPingResponse = Array<AccountPingResponse.AccountPingResponseItem>;
84
63
 
85
64
  export namespace AccountPingResponse {
@@ -94,6 +73,78 @@ export namespace AccountPingResponse {
94
73
  }
95
74
  }
96
75
 
76
+ export interface AccountUsageResponse {
77
+ /**
78
+ * Unix seconds — 1st of next month UTC.
79
+ */
80
+ billing_period_end: number;
81
+
82
+ /**
83
+ * Unix seconds — 1st of current month UTC.
84
+ */
85
+ billing_period_start: number;
86
+
87
+ limits: AccountUsageResponse.Limits;
88
+
89
+ /**
90
+ * Current tier (free, pro, scale).
91
+ */
92
+ tier: string;
93
+
94
+ usage: AccountUsageResponse.Usage;
95
+ }
96
+
97
+ export namespace AccountUsageResponse {
98
+ export interface Limits {
99
+ /**
100
+ * Max historical data age in days. 0 = unlimited.
101
+ */
102
+ history_max_age_days: number;
103
+
104
+ /**
105
+ * Monthly REST request cap. 0 = unlimited.
106
+ */
107
+ monthly_requests: number;
108
+
109
+ /**
110
+ * REST queries per second. 0 = unlimited.
111
+ */
112
+ rest_qps: number;
113
+
114
+ /**
115
+ * REST burst QPS allowance. 0 = unlimited.
116
+ */
117
+ rest_qps_burst: number;
118
+
119
+ /**
120
+ * Max orderbook depth per WebSocket subscription.
121
+ */
122
+ ws_max_depth: number;
123
+
124
+ /**
125
+ * Max WebSocket subscriptions across all connections. 0 = unlimited.
126
+ */
127
+ ws_max_subscriptions: number;
128
+ }
129
+
130
+ export interface Usage {
131
+ /**
132
+ * REST requests consumed this billing period.
133
+ */
134
+ monthly_requests: number;
135
+
136
+ /**
137
+ * Currently active WebSocket connections.
138
+ */
139
+ ws_active_connections: number;
140
+
141
+ /**
142
+ * Currently active WebSocket subscriptions.
143
+ */
144
+ ws_active_subscriptions: number;
145
+ }
146
+ }
147
+
97
148
  export interface AccountUserActivityResponse {
98
149
  exchanges: { [key: string]: unknown };
99
150
 
@@ -134,33 +185,6 @@ export interface AccountPingParams {
134
185
  exchange?: string;
135
186
  }
136
187
 
137
- export interface AccountUpdateCredentialsParams {
138
- /**
139
- * Kalshi API key ID.
140
- */
141
- api_key_id?: string | null;
142
-
143
- /**
144
- * Polymarket CLOB API key.
145
- */
146
- clob_api_key?: string | null;
147
-
148
- /**
149
- * Polymarket CLOB API passphrase.
150
- */
151
- clob_api_passphrase?: string | null;
152
-
153
- /**
154
- * Polymarket CLOB API secret.
155
- */
156
- clob_api_secret?: string | null;
157
-
158
- /**
159
- * Kalshi RSA private key (PEM format).
160
- */
161
- private_key?: string | null;
162
- }
163
-
164
188
  export interface AccountUserActivityParams {
165
189
  /**
166
190
  * User address (typically an EVM address).
@@ -182,12 +206,11 @@ export interface AccountUserActivityParams {
182
206
  export declare namespace Account {
183
207
  export {
184
208
  type AccountBalanceResponse as AccountBalanceResponse,
185
- type AccountCapabilitiesResponse as AccountCapabilitiesResponse,
186
209
  type AccountPingResponse as AccountPingResponse,
210
+ type AccountUsageResponse as AccountUsageResponse,
187
211
  type AccountUserActivityResponse as AccountUserActivityResponse,
188
212
  type AccountBalanceParams as AccountBalanceParams,
189
213
  type AccountPingParams as AccountPingParams,
190
- type AccountUpdateCredentialsParams as AccountUpdateCredentialsParams,
191
214
  type AccountUserActivityParams as AccountUserActivityParams,
192
215
  };
193
216
  }
@@ -0,0 +1,78 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as EscrowAPI from './escrow';
5
+ import { Escrow, EscrowConfigResponse } from './escrow';
6
+ import * as OnboardAPI from './onboard';
7
+ import { Onboard, OnboardCreateParams, OnboardCreateResponse } from './onboard';
8
+ import * as UsersAPI from './users';
9
+ import {
10
+ UserCreateParams,
11
+ UserCreateResponse,
12
+ UserListParams,
13
+ UserListResponse,
14
+ UserRetrieveResponse,
15
+ UserUpdateParams,
16
+ UserUpdateResponse,
17
+ Users,
18
+ } from './users';
19
+ import { APIPromise } from '../../core/api-promise';
20
+ import { RequestOptions } from '../../internal/request-options';
21
+
22
+ export class Builder extends APIResource {
23
+ users: UsersAPI.Users = new UsersAPI.Users(this._client);
24
+ onboard: OnboardAPI.Onboard = new OnboardAPI.Onboard(this._client);
25
+ escrow: EscrowAPI.Escrow = new EscrowAPI.Escrow(this._client);
26
+
27
+ /**
28
+ * Returns the builder's QPS pool allocation, end-user count, and total allocated
29
+ * QPS.
30
+ */
31
+ pool(options?: RequestOptions): APIPromise<BuilderPoolResponse> {
32
+ return this._client.get('/api/v1/builder/pool', options);
33
+ }
34
+ }
35
+
36
+ export interface BuilderPoolResponse {
37
+ /**
38
+ * Number of end-users created by this builder.
39
+ */
40
+ end_user_count: number;
41
+
42
+ /**
43
+ * Total QPS available to this builder.
44
+ */
45
+ qps_pool: number;
46
+
47
+ /**
48
+ * Total QPS allocated to end-users.
49
+ */
50
+ total_allocated_qps: number;
51
+ }
52
+
53
+ Builder.Users = Users;
54
+ Builder.Onboard = Onboard;
55
+ Builder.Escrow = Escrow;
56
+
57
+ export declare namespace Builder {
58
+ export { type BuilderPoolResponse as BuilderPoolResponse };
59
+
60
+ export {
61
+ Users as Users,
62
+ type UserCreateResponse as UserCreateResponse,
63
+ type UserRetrieveResponse as UserRetrieveResponse,
64
+ type UserUpdateResponse as UserUpdateResponse,
65
+ type UserListResponse as UserListResponse,
66
+ type UserCreateParams as UserCreateParams,
67
+ type UserUpdateParams as UserUpdateParams,
68
+ type UserListParams as UserListParams,
69
+ };
70
+
71
+ export {
72
+ Onboard as Onboard,
73
+ type OnboardCreateResponse as OnboardCreateResponse,
74
+ type OnboardCreateParams as OnboardCreateParams,
75
+ };
76
+
77
+ export { Escrow as Escrow, type EscrowConfigResponse as EscrowConfigResponse };
78
+ }
@@ -0,0 +1,62 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+
7
+ export class Escrow extends APIResource {
8
+ /**
9
+ * Returns the builder's fee escrow configuration including contract address, fee
10
+ * rates, and treasury address. Read-only — fee escrow is configured by Parsec
11
+ * admins during onboarding.
12
+ */
13
+ config(options?: RequestOptions): APIPromise<EscrowConfigResponse> {
14
+ return this._client.get('/api/v1/builder/escrow/config', options);
15
+ }
16
+ }
17
+
18
+ export interface EscrowConfigResponse {
19
+ /**
20
+ * Affiliate fee rate in basis points.
21
+ */
22
+ affiliate_fee_bps: number;
23
+
24
+ /**
25
+ * Escrow smart contract address.
26
+ */
27
+ escrow_contract_address: string;
28
+
29
+ /**
30
+ * Whether fee escrow is enabled for this builder.
31
+ */
32
+ fee_escrow_enabled: boolean;
33
+
34
+ /**
35
+ * Minimum fee in basis points.
36
+ */
37
+ min_fee_bps: number;
38
+
39
+ /**
40
+ * Minimum fee in USDC (human-readable).
41
+ */
42
+ min_fee_usdc: string;
43
+
44
+ /**
45
+ * Treasury address for fee distribution.
46
+ */
47
+ treasury_address: string;
48
+
49
+ /**
50
+ * Affiliate fee recipient address.
51
+ */
52
+ affiliate_address?: string | null;
53
+
54
+ /**
55
+ * Fee rate in basis points.
56
+ */
57
+ fee_bps?: number | null;
58
+ }
59
+
60
+ export declare namespace Escrow {
61
+ export { type EscrowConfigResponse as EscrowConfigResponse };
62
+ }
@@ -0,0 +1,15 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { Builder, type BuilderPoolResponse } from './builder';
4
+ export { Escrow, type EscrowConfigResponse } from './escrow';
5
+ export { Onboard, type OnboardCreateResponse, type OnboardCreateParams } from './onboard';
6
+ export {
7
+ Users,
8
+ type UserCreateResponse,
9
+ type UserRetrieveResponse,
10
+ type UserUpdateResponse,
11
+ type UserListResponse,
12
+ type UserCreateParams,
13
+ type UserUpdateParams,
14
+ type UserListParams,
15
+ } from './users';