parsec-api 0.8.1 → 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.
- package/CHANGELOG.md +57 -0
- package/README.md +0 -117
- package/client.d.mts +21 -28
- package/client.d.mts.map +1 -1
- package/client.d.ts +21 -28
- package/client.d.ts.map +1 -1
- package/client.js +21 -41
- package/client.js.map +1 -1
- package/client.mjs +21 -41
- package/client.mjs.map +1 -1
- package/core/error.d.mts +0 -12
- package/core/error.d.mts.map +1 -1
- package/core/error.d.ts +0 -12
- package/core/error.d.ts.map +1 -1
- package/core/error.js +0 -24
- package/core/error.js.map +1 -1
- package/core/error.mjs +0 -24
- package/core/error.mjs.map +1 -1
- package/index.d.mts +0 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +0 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -3
- package/index.js.map +1 -1
- package/index.mjs +0 -1
- package/index.mjs.map +1 -1
- package/internal/tslib.js +21 -21
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +2 -3
- package/resources/account.d.mts +72 -27
- package/resources/account.d.mts.map +1 -1
- package/resources/account.d.ts +72 -27
- package/resources/account.d.ts.map +1 -1
- package/resources/account.js +17 -15
- package/resources/account.js.map +1 -1
- package/resources/account.mjs +17 -15
- package/resources/account.mjs.map +1 -1
- package/resources/builder/builder.d.mts +40 -0
- package/resources/builder/builder.d.mts.map +1 -0
- package/resources/builder/builder.d.ts +40 -0
- package/resources/builder/builder.d.ts.map +1 -0
- package/resources/builder/builder.js +32 -0
- package/resources/builder/builder.js.map +1 -0
- package/resources/builder/builder.mjs +27 -0
- package/resources/builder/builder.mjs.map +1 -0
- package/resources/builder/escrow.d.mts +49 -0
- package/resources/builder/escrow.d.mts.map +1 -0
- package/resources/builder/escrow.d.ts +49 -0
- package/resources/builder/escrow.d.ts.map +1 -0
- package/resources/builder/escrow.js +17 -0
- package/resources/builder/escrow.js.map +1 -0
- package/resources/builder/escrow.mjs +13 -0
- package/resources/builder/escrow.mjs.map +1 -0
- package/resources/builder/index.d.mts +5 -0
- package/resources/builder/index.d.mts.map +1 -0
- package/resources/builder/index.d.ts +5 -0
- package/resources/builder/index.d.ts.map +1 -0
- package/resources/builder/index.js +13 -0
- package/resources/builder/index.js.map +1 -0
- package/resources/builder/index.mjs +6 -0
- package/resources/builder/index.mjs.map +1 -0
- package/resources/builder/onboard.d.mts +163 -0
- package/resources/builder/onboard.d.mts.map +1 -0
- package/resources/builder/onboard.d.ts +163 -0
- package/resources/builder/onboard.d.ts.map +1 -0
- package/resources/builder/onboard.js +16 -0
- package/resources/builder/onboard.js.map +1 -0
- package/resources/builder/onboard.mjs +12 -0
- package/resources/builder/onboard.mjs.map +1 -0
- package/resources/builder/users.d.mts +469 -0
- package/resources/builder/users.d.mts.map +1 -0
- package/resources/builder/users.d.ts +469 -0
- package/resources/builder/users.d.ts.map +1 -0
- package/resources/builder/users.js +46 -0
- package/resources/builder/users.js.map +1 -0
- package/resources/builder/users.mjs +42 -0
- package/resources/builder/users.mjs.map +1 -0
- package/resources/builder.d.mts +2 -0
- package/resources/builder.d.mts.map +1 -0
- package/resources/builder.d.ts +2 -0
- package/resources/builder.d.ts.map +1 -0
- package/resources/builder.js +6 -0
- package/resources/builder.js.map +1 -0
- package/resources/builder.mjs +3 -0
- package/resources/builder.mjs.map +1 -0
- package/resources/ctf.d.mts +97 -0
- package/resources/ctf.d.mts.map +1 -0
- package/resources/ctf.d.ts +97 -0
- package/resources/ctf.d.ts.map +1 -0
- package/resources/ctf.js +59 -0
- package/resources/ctf.js.map +1 -0
- package/resources/ctf.mjs +55 -0
- package/resources/ctf.mjs.map +1 -0
- package/resources/events.d.mts +84 -12
- package/resources/events.d.mts.map +1 -1
- package/resources/events.d.ts +84 -12
- package/resources/events.d.ts.map +1 -1
- package/resources/events.js +4 -15
- package/resources/events.js.map +1 -1
- package/resources/events.mjs +4 -15
- package/resources/events.mjs.map +1 -1
- package/resources/exchanges.d.mts +2 -1
- package/resources/exchanges.d.mts.map +1 -1
- package/resources/exchanges.d.ts +2 -1
- package/resources/exchanges.d.ts.map +1 -1
- package/resources/fills.d.mts +76 -0
- package/resources/fills.d.mts.map +1 -0
- package/resources/fills.d.ts +76 -0
- package/resources/fills.d.ts.map +1 -0
- package/resources/fills.js +27 -0
- package/resources/fills.js.map +1 -0
- package/resources/fills.mjs +23 -0
- package/resources/fills.mjs.map +1 -0
- package/resources/index.d.mts +8 -4
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +8 -4
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +13 -5
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +7 -3
- package/resources/index.mjs.map +1 -1
- package/resources/markets.d.mts +92 -19
- package/resources/markets.d.mts.map +1 -1
- package/resources/markets.d.ts +92 -19
- package/resources/markets.d.ts.map +1 -1
- package/resources/markets.js +1 -30
- package/resources/markets.js.map +1 -1
- package/resources/markets.mjs +1 -29
- package/resources/markets.mjs.map +1 -1
- package/resources/onboard.d.mts +91 -0
- package/resources/onboard.d.mts.map +1 -0
- package/resources/onboard.d.ts +91 -0
- package/resources/onboard.d.ts.map +1 -0
- package/resources/onboard.js +17 -0
- package/resources/onboard.js.map +1 -0
- package/resources/onboard.mjs +13 -0
- package/resources/onboard.mjs.map +1 -0
- package/resources/orderbook.d.mts +21 -11
- package/resources/orderbook.d.mts.map +1 -1
- package/resources/orderbook.d.ts +21 -11
- package/resources/orderbook.d.ts.map +1 -1
- package/resources/orderbook.js +5 -1
- package/resources/orderbook.js.map +1 -1
- package/resources/orderbook.mjs +5 -1
- package/resources/orderbook.mjs.map +1 -1
- package/resources/orders.d.mts +65 -6
- package/resources/orders.d.mts.map +1 -1
- package/resources/orders.d.ts +65 -6
- package/resources/orders.d.ts.map +1 -1
- package/resources/orders.js +48 -8
- package/resources/orders.js.map +1 -1
- package/resources/orders.mjs +48 -8
- package/resources/orders.mjs.map +1 -1
- package/resources/positions.d.mts +9 -3
- package/resources/positions.d.mts.map +1 -1
- package/resources/positions.d.ts +9 -3
- package/resources/positions.d.ts.map +1 -1
- package/resources/positions.js +13 -2
- package/resources/positions.js.map +1 -1
- package/resources/positions.mjs +13 -2
- package/resources/positions.mjs.map +1 -1
- package/resources/{price-history.d.mts → price.d.mts} +19 -13
- package/resources/price.d.mts.map +1 -0
- package/resources/{price-history.d.ts → price.d.ts} +19 -13
- package/resources/price.d.ts.map +1 -0
- package/resources/{price-history.js → price.js} +6 -5
- package/resources/price.js.map +1 -0
- package/resources/{price-history.mjs → price.mjs} +4 -3
- package/resources/price.mjs.map +1 -0
- package/resources/trades.d.mts +44 -2
- package/resources/trades.d.mts.map +1 -1
- package/resources/trades.d.ts +44 -2
- package/resources/trades.d.ts.map +1 -1
- package/resources/trades.js +2 -1
- package/resources/trades.js.map +1 -1
- package/resources/trades.mjs +2 -1
- package/resources/trades.mjs.map +1 -1
- package/resources/wallet.d.mts +177 -0
- package/resources/wallet.d.mts.map +1 -0
- package/resources/wallet.d.ts +177 -0
- package/resources/wallet.d.ts.map +1 -0
- package/resources/wallet.js +26 -0
- package/resources/wallet.js.map +1 -0
- package/resources/wallet.mjs +22 -0
- package/resources/wallet.mjs.map +1 -0
- package/src/client.ts +55 -73
- package/src/core/error.ts +0 -29
- package/src/index.ts +0 -14
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/account.ts +99 -44
- package/src/resources/builder/builder.ts +78 -0
- package/src/resources/builder/escrow.ts +62 -0
- package/src/resources/builder/index.ts +15 -0
- package/src/resources/builder/onboard.ts +206 -0
- package/src/resources/builder/users.ts +606 -0
- package/src/resources/builder.ts +3 -0
- package/src/resources/ctf.ts +122 -0
- package/src/resources/events.ts +104 -26
- package/src/resources/exchanges.ts +4 -2
- package/src/resources/fills.ts +107 -0
- package/src/resources/index.ts +13 -20
- package/src/resources/markets.ts +114 -49
- package/src/resources/onboard.ts +116 -0
- package/src/resources/orderbook.ts +23 -12
- package/src/resources/orders.ts +121 -12
- package/src/resources/positions.ts +22 -4
- package/src/resources/{price-history.ts → price.ts} +21 -17
- package/src/resources/trades.ts +54 -3
- package/src/resources/wallet.ts +224 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/approvals.d.mts +0 -74
- package/resources/approvals.d.mts.map +0 -1
- package/resources/approvals.d.ts +0 -74
- package/resources/approvals.d.ts.map +0 -1
- package/resources/approvals.js +0 -22
- package/resources/approvals.js.map +0 -1
- package/resources/approvals.mjs +0 -18
- package/resources/approvals.mjs.map +0 -1
- package/resources/price-history.d.mts.map +0 -1
- package/resources/price-history.d.ts.map +0 -1
- package/resources/price-history.js.map +0 -1
- package/resources/price-history.mjs.map +0 -1
- package/src/resources/approvals.ts +0 -107
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.0 (2026-03-04)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.10.0...v0.11.0](https://github.com/parsecular/sdk-typescript/compare/v0.10.0...v0.11.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* add fills + usage endpoints, remove polymarket auth ([82dde80](https://github.com/parsecular/sdk-typescript/commit/82dde8089514a9636c50b6444186eeff24831b16))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Chores
|
|
13
|
+
|
|
14
|
+
* **internal:** version bump ([f911d4b](https://github.com/parsecular/sdk-typescript/commit/f911d4b3424a061e93950287bd3265162132a105))
|
|
15
|
+
|
|
16
|
+
## 0.10.0 (2026-03-03)
|
|
17
|
+
|
|
18
|
+
Full Changelog: [v0.9.0...v0.10.0](https://github.com/parsecular/sdk-typescript/compare/v0.9.0...v0.10.0)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **api:** api update ([b5540b3](https://github.com/parsecular/sdk-typescript/commit/b5540b384014caccb9ebea655ca4de7b766e4662))
|
|
23
|
+
* **api:** api update ([94b98c5](https://github.com/parsecular/sdk-typescript/commit/94b98c5cd39d1e7d5d618890c55876bab0d02d84))
|
|
24
|
+
* **api:** api update ([1fc689e](https://github.com/parsecular/sdk-typescript/commit/1fc689ebb5e6a51f165d69feadceb85e8f31f94e))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* **docs/contributing:** correct pnpm link command ([a814ec4](https://github.com/parsecular/sdk-typescript/commit/a814ec4113e6bf9ca02c5aa8185550863ddbd2e3))
|
|
30
|
+
* **docs/contributing:** correct pnpm link command ([fb980a3](https://github.com/parsecular/sdk-typescript/commit/fb980a3767647d9ce5964d73b5226525a20be308))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Chores
|
|
34
|
+
|
|
35
|
+
* **internal:** move stringifyQuery implementation to internal function ([fb07597](https://github.com/parsecular/sdk-typescript/commit/fb075976e3ee90b21bff7d07d60f47864c8e20ba))
|
|
36
|
+
* **internal:** move stringifyQuery implementation to internal function ([75f70ce](https://github.com/parsecular/sdk-typescript/commit/75f70ce80161f73a73aaf2fdc22171567388ebf1))
|
|
37
|
+
* **internal:** upgrade pnpm version ([a624ef4](https://github.com/parsecular/sdk-typescript/commit/a624ef477a84c9d4f4a8dc53fa25fe4144a0986d))
|
|
38
|
+
* **internal:** upgrade pnpm version ([9405eed](https://github.com/parsecular/sdk-typescript/commit/9405eedcbec4fe569e9de26d8c4c60570c268fd6))
|
|
39
|
+
* **internal:** version bump ([1a26f9c](https://github.com/parsecular/sdk-typescript/commit/1a26f9c67d91e5fe81bae6c262b265649e83a66f))
|
|
40
|
+
|
|
41
|
+
## 0.9.0 (2026-02-23)
|
|
42
|
+
|
|
43
|
+
Full Changelog: [v0.8.1...v0.9.0](https://github.com/parsecular/sdk-typescript/compare/v0.8.1...v0.9.0)
|
|
44
|
+
|
|
45
|
+
### Features
|
|
46
|
+
|
|
47
|
+
* **api:** api update ([7bac8d0](https://github.com/parsecular/sdk-typescript/commit/7bac8d00838132740b956c303bd88ad899a3b354))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
|
|
52
|
+
* update example + contract test for price-history → price rename and credentials field names ([3497ad1](https://github.com/parsecular/sdk-typescript/commit/3497ad105cb19ee2de2b93ccde93684505900b42))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Chores
|
|
56
|
+
|
|
57
|
+
* **internal:** remove mock server code ([be46c73](https://github.com/parsecular/sdk-typescript/commit/be46c73d3f395e396cbf288da29b33b031251352))
|
|
58
|
+
* update mock server docs ([f1ed58c](https://github.com/parsecular/sdk-typescript/commit/f1ed58c8a3e56092a019113c201db46828e87497))
|
|
59
|
+
|
|
3
60
|
## 0.8.1 (2026-02-19)
|
|
4
61
|
|
|
5
62
|
Full Changelog: [v0.8.0...v0.8.1](https://github.com/parsecular/sdk-typescript/compare/v0.8.0...v0.8.1)
|
package/README.md
CHANGED
|
@@ -46,125 +46,10 @@ const client = new ParsecAPI({
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
const exchanges: ParsecAPI.ExchangeListResponse = await client.exchanges.list();
|
|
49
|
-
const estimate = await client.executionPrice.retrieve({
|
|
50
|
-
parsec_id: 'kalshi:KXBTC-25',
|
|
51
|
-
side: 'buy',
|
|
52
|
-
amount: 10,
|
|
53
|
-
});
|
|
54
49
|
```
|
|
55
50
|
|
|
56
51
|
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
57
52
|
|
|
58
|
-
## Examples
|
|
59
|
-
|
|
60
|
-
The SDK ships with runnable examples in the [`examples/`](examples/) directory:
|
|
61
|
-
|
|
62
|
-
| Example | Description |
|
|
63
|
-
|---------|-------------|
|
|
64
|
-
| [`getting-started.ts`](examples/getting-started.ts) | Fetch markets, read orderbooks, check execution price |
|
|
65
|
-
| [`order-lifecycle.ts`](examples/order-lifecycle.ts) | Place, monitor, and cancel an order end-to-end |
|
|
66
|
-
| [`websocket-streaming.ts`](examples/websocket-streaming.ts) | Stream real-time orderbook and trade data via WebSocket |
|
|
67
|
-
|
|
68
|
-
Run any example with `npx tsx examples/getting-started.ts` (requires `PARSEC_API_KEY`).
|
|
69
|
-
|
|
70
|
-
## Real-time Streaming
|
|
71
|
-
|
|
72
|
-
The SDK includes a WebSocket client for streaming orderbook snapshots, deltas, and trade activity in real time. The client maintains a local materialized orderbook, handles authentication, automatic reconnection with exponential backoff, and sequence gap detection.
|
|
73
|
-
|
|
74
|
-
### Quick start
|
|
75
|
-
|
|
76
|
-
<!-- prettier-ignore -->
|
|
77
|
-
```ts
|
|
78
|
-
import ParsecAPI from 'parsec-api';
|
|
79
|
-
|
|
80
|
-
const client = new ParsecAPI({ apiKey: 'pk_...' });
|
|
81
|
-
const ws = client.ws();
|
|
82
|
-
|
|
83
|
-
ws.on('orderbook', (book) => {
|
|
84
|
-
console.log(`${book.parsecId} mid=${book.midPrice}`);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
ws.subscribe({ parsecId: 'polymarket:1234', outcome: 'yes' });
|
|
88
|
-
await ws.connect();
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Event handlers
|
|
92
|
-
|
|
93
|
-
Register handlers with `ws.on(event, callback)` and remove them with `ws.off(event, callback)`.
|
|
94
|
-
|
|
95
|
-
<!-- prettier-ignore -->
|
|
96
|
-
```ts
|
|
97
|
-
ws.on('orderbook', (book: OrderbookSnapshot) => {
|
|
98
|
-
console.log(book.bids, book.asks, book.midPrice, book.spread);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
ws.on('activity', (activity: Activity) => {
|
|
102
|
-
console.log(`${activity.kind}: ${activity.price} x ${activity.size}`);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
ws.on('error', (err: WsError) => {
|
|
106
|
-
console.error(`WS error: ${err.message}`);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
ws.on('disconnected', (reason: string) => {
|
|
110
|
-
console.log(`Disconnected: ${reason}`);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
ws.on('reconnecting', (attempt: number, delayMs: number) => {
|
|
114
|
-
console.log(`Reconnecting (attempt ${attempt}) in ${delayMs}ms`);
|
|
115
|
-
});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Available events: `orderbook`, `activity`, `error`, `connected`, `disconnected`, `reconnecting`, `heartbeat`, `slow_reader`.
|
|
119
|
-
|
|
120
|
-
### Multiple market subscriptions
|
|
121
|
-
|
|
122
|
-
You can subscribe to multiple markets at once by passing an array:
|
|
123
|
-
|
|
124
|
-
<!-- prettier-ignore -->
|
|
125
|
-
```ts
|
|
126
|
-
ws.subscribe([
|
|
127
|
-
{ parsecId: 'polymarket:1234', outcome: 'yes' },
|
|
128
|
-
{ parsecId: 'kalshi:KXBTC-25', outcome: 'yes', depth: 10 },
|
|
129
|
-
]);
|
|
130
|
-
|
|
131
|
-
// Unsubscribe from a single market
|
|
132
|
-
ws.unsubscribe({ parsecId: 'polymarket:1234', outcome: 'yes' });
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Connection lifecycle
|
|
136
|
-
|
|
137
|
-
The client reconnects automatically on disconnect with exponential backoff (up to 30 seconds). Authentication errors are treated as fatal and will not trigger reconnection.
|
|
138
|
-
|
|
139
|
-
<!-- prettier-ignore -->
|
|
140
|
-
```ts
|
|
141
|
-
await ws.connect(); // Resolves after successful auth
|
|
142
|
-
ws.close(); // Disconnect, cancel reconnect, clear subscriptions
|
|
143
|
-
await ws.waitForClose(); // Resolves when permanently closed
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### Accessing the local orderbook
|
|
147
|
-
|
|
148
|
-
The client maintains a materialized orderbook for each subscription. You can read the current state at any time with `getBook()`:
|
|
149
|
-
|
|
150
|
-
<!-- prettier-ignore -->
|
|
151
|
-
```ts
|
|
152
|
-
const book = ws.getBook('polymarket:1234', 'yes');
|
|
153
|
-
if (book) {
|
|
154
|
-
console.log(`Best bid: ${book.bids[0]?.price}, Best ask: ${book.asks[0]?.price}`);
|
|
155
|
-
}
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### Types
|
|
159
|
-
|
|
160
|
-
Key types are exported from `parsec-api/streaming`:
|
|
161
|
-
|
|
162
|
-
- `OrderbookSnapshot` — Full orderbook state emitted on every `orderbook` event
|
|
163
|
-
- `Activity` — Trade or fill event
|
|
164
|
-
- `WsError` — Error payload with optional `code` and `parsecId`
|
|
165
|
-
- `MarketSubscription` — Subscription descriptor (`parsecId`, `outcome`, `depth`)
|
|
166
|
-
- `StreamingOrderbookLevel` — A single `{ price, size }` level
|
|
167
|
-
|
|
168
53
|
## Handling errors
|
|
169
54
|
|
|
170
55
|
When the library is unable to connect to the API,
|
|
@@ -178,8 +63,6 @@ const exchanges = await client.exchanges.list().catch(async (err) => {
|
|
|
178
63
|
console.log(err.status); // 400
|
|
179
64
|
console.log(err.name); // BadRequestError
|
|
180
65
|
console.log(err.headers); // {server: 'nginx', ...}
|
|
181
|
-
console.log(err.code); // "insufficient_funds" (when provided)
|
|
182
|
-
console.log(err.retryable); // true/false (when provided)
|
|
183
66
|
} else {
|
|
184
67
|
throw err;
|
|
185
68
|
}
|
package/client.d.mts
CHANGED
|
@@ -5,20 +5,23 @@ import * as Opts from "./internal/request-options.mjs";
|
|
|
5
5
|
import * as Errors from "./core/error.mjs";
|
|
6
6
|
import * as Uploads from "./core/uploads.mjs";
|
|
7
7
|
import * as API from "./resources/index.mjs";
|
|
8
|
-
import { ParsecWebSocket, type ParsecWebSocketOptions } from "./streaming.mjs";
|
|
9
8
|
import { APIPromise } from "./core/api-promise.mjs";
|
|
10
|
-
import { Account, AccountBalanceParams, AccountBalanceResponse,
|
|
11
|
-
import {
|
|
9
|
+
import { Account, AccountBalanceParams, AccountBalanceResponse, AccountPingParams, AccountPingResponse, AccountUsageResponse, AccountUserActivityParams, AccountUserActivityResponse } from "./resources/account.mjs";
|
|
10
|
+
import { Ctf, CtfMergeParams, CtfRedeemParams, CtfResponse, CtfSplitParams } from "./resources/ctf.mjs";
|
|
12
11
|
import { EventListParams, EventListResponse, Events } from "./resources/events.mjs";
|
|
13
12
|
import { ExchangeListResponse, Exchanges } from "./resources/exchanges.mjs";
|
|
14
13
|
import { ExecutionPrice, ExecutionPriceRetrieveParams, ExecutionPriceRetrieveResponse } from "./resources/execution-price.mjs";
|
|
14
|
+
import { FillListParams, FillListResponse, Fills } from "./resources/fills.mjs";
|
|
15
15
|
import { MarketListParams, MarketListResponse, Markets } from "./resources/markets.mjs";
|
|
16
|
+
import { Onboard, OnboardCreateParams, OnboardCreateResponse } from "./resources/onboard.mjs";
|
|
16
17
|
import { Orderbook, OrderbookRetrieveParams, OrderbookRetrieveResponse } from "./resources/orderbook.mjs";
|
|
17
18
|
import { Order, OrderCancelParams, OrderCreateParams, OrderListParams, OrderListResponse, OrderRetrieveParams, Orders } from "./resources/orders.mjs";
|
|
18
19
|
import { PositionListParams, PositionListResponse, Positions } from "./resources/positions.mjs";
|
|
19
|
-
import {
|
|
20
|
+
import { Price, PriceRetrieveParams, PriceRetrieveResponse } from "./resources/price.mjs";
|
|
20
21
|
import { TradeListParams, TradeListResponse, Trades } from "./resources/trades.mjs";
|
|
22
|
+
import { Wallet, WalletExportKeyParams, WalletExportKeyResponse, WalletRetrieveResponse } from "./resources/wallet.mjs";
|
|
21
23
|
import { CustomerUsage, Websocket, WebsocketUsageParams, WebsocketUsageResponse } from "./resources/websocket.mjs";
|
|
24
|
+
import { Builder, BuilderPoolResponse } from "./resources/builder/builder.mjs";
|
|
22
25
|
import { type Fetch } from "./internal/builtin-types.mjs";
|
|
23
26
|
import { HeadersLike, NullableHeaders } from "./internal/headers.mjs";
|
|
24
27
|
import { FinalRequestOptions, RequestOptions } from "./internal/request-options.mjs";
|
|
@@ -138,7 +141,7 @@ export declare class ParsecAPI {
|
|
|
138
141
|
protected defaultQuery(): Record<string, string | undefined> | undefined;
|
|
139
142
|
protected validateHeaders({ values, nulls }: NullableHeaders): void;
|
|
140
143
|
protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
|
|
141
|
-
protected stringifyQuery(query: Record<string, unknown>): string;
|
|
144
|
+
protected stringifyQuery(query: object | Record<string, unknown>): string;
|
|
142
145
|
private getUserAgent;
|
|
143
146
|
protected defaultIdempotencyKey(): string;
|
|
144
147
|
protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
|
|
@@ -199,32 +202,18 @@ export declare class ParsecAPI {
|
|
|
199
202
|
markets: API.Markets;
|
|
200
203
|
executionPrice: API.ExecutionPrice;
|
|
201
204
|
orderbook: API.Orderbook;
|
|
202
|
-
|
|
205
|
+
price: API.Price;
|
|
203
206
|
trades: API.Trades;
|
|
204
207
|
events: API.Events;
|
|
205
208
|
websocket: API.Websocket;
|
|
206
209
|
orders: API.Orders;
|
|
207
210
|
positions: API.Positions;
|
|
211
|
+
fills: API.Fills;
|
|
208
212
|
account: API.Account;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
*
|
|
214
|
-
* @param opts.url - Override the WebSocket URL (derived from baseURL by default).
|
|
215
|
-
* @returns A new `ParsecWebSocket` instance.
|
|
216
|
-
*
|
|
217
|
-
* @example
|
|
218
|
-
* ```ts
|
|
219
|
-
* const client = new ParsecAPI({ apiKey: 'pk_...' });
|
|
220
|
-
* const ws = client.ws();
|
|
221
|
-
*
|
|
222
|
-
* ws.on('orderbook', (book) => console.log(book.bids[0]));
|
|
223
|
-
* await ws.connect();
|
|
224
|
-
* ws.subscribe({ parsecId: 'polymarket:0x123', outcome: 'Yes' });
|
|
225
|
-
* ```
|
|
226
|
-
*/
|
|
227
|
-
ws(opts?: ParsecWebSocketOptions): ParsecWebSocket;
|
|
213
|
+
onboard: API.Onboard;
|
|
214
|
+
wallet: API.Wallet;
|
|
215
|
+
ctf: API.Ctf;
|
|
216
|
+
builder: API.Builder;
|
|
228
217
|
}
|
|
229
218
|
export declare namespace ParsecAPI {
|
|
230
219
|
export type RequestOptions = Opts.RequestOptions;
|
|
@@ -232,13 +221,17 @@ export declare namespace ParsecAPI {
|
|
|
232
221
|
export { Markets as Markets, type MarketListResponse as MarketListResponse, type MarketListParams as MarketListParams, };
|
|
233
222
|
export { ExecutionPrice as ExecutionPrice, type ExecutionPriceRetrieveResponse as ExecutionPriceRetrieveResponse, type ExecutionPriceRetrieveParams as ExecutionPriceRetrieveParams, };
|
|
234
223
|
export { Orderbook as Orderbook, type OrderbookRetrieveResponse as OrderbookRetrieveResponse, type OrderbookRetrieveParams as OrderbookRetrieveParams, };
|
|
235
|
-
export {
|
|
224
|
+
export { Price as Price, type PriceRetrieveResponse as PriceRetrieveResponse, type PriceRetrieveParams as PriceRetrieveParams, };
|
|
236
225
|
export { Trades as Trades, type TradeListResponse as TradeListResponse, type TradeListParams as TradeListParams, };
|
|
237
226
|
export { Events as Events, type EventListResponse as EventListResponse, type EventListParams as EventListParams, };
|
|
238
227
|
export { Websocket as Websocket, type CustomerUsage as CustomerUsage, type WebsocketUsageResponse as WebsocketUsageResponse, type WebsocketUsageParams as WebsocketUsageParams, };
|
|
239
228
|
export { Orders as Orders, type Order as Order, type OrderListResponse as OrderListResponse, type OrderCreateParams as OrderCreateParams, type OrderRetrieveParams as OrderRetrieveParams, type OrderListParams as OrderListParams, type OrderCancelParams as OrderCancelParams, };
|
|
240
229
|
export { Positions as Positions, type PositionListResponse as PositionListResponse, type PositionListParams as PositionListParams, };
|
|
241
|
-
export {
|
|
242
|
-
export {
|
|
230
|
+
export { Fills as Fills, type FillListResponse as FillListResponse, type FillListParams as FillListParams };
|
|
231
|
+
export { Account as Account, type AccountBalanceResponse as AccountBalanceResponse, type AccountPingResponse as AccountPingResponse, type AccountUsageResponse as AccountUsageResponse, type AccountUserActivityResponse as AccountUserActivityResponse, type AccountBalanceParams as AccountBalanceParams, type AccountPingParams as AccountPingParams, type AccountUserActivityParams as AccountUserActivityParams, };
|
|
232
|
+
export { Onboard as Onboard, type OnboardCreateResponse as OnboardCreateResponse, type OnboardCreateParams as OnboardCreateParams, };
|
|
233
|
+
export { Wallet as Wallet, type WalletRetrieveResponse as WalletRetrieveResponse, type WalletExportKeyResponse as WalletExportKeyResponse, type WalletExportKeyParams as WalletExportKeyParams, };
|
|
234
|
+
export { Ctf as Ctf, type CtfResponse as CtfResponse, type CtfMergeParams as CtfMergeParams, type CtfRedeemParams as CtfRedeemParams, type CtfSplitParams as CtfSplitParams, };
|
|
235
|
+
export { Builder as Builder, type BuilderPoolResponse as BuilderPoolResponse };
|
|
243
236
|
}
|
|
244
237
|
//# sourceMappingURL=client.d.mts.map
|
package/client.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.mts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY;OAC3C,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE;YAIvE,EAAE,MAAM,EAAE,QAAQ,EAAE;OAKzB,KAAK,IAAI;OAGT,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAAE,
|
|
1
|
+
{"version":3,"file":"client.d.mts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,WAAW,EAAE,W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AO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAChF"}
|
package/client.d.ts
CHANGED
|
@@ -5,20 +5,23 @@ import * as Opts from "./internal/request-options.js";
|
|
|
5
5
|
import * as Errors from "./core/error.js";
|
|
6
6
|
import * as Uploads from "./core/uploads.js";
|
|
7
7
|
import * as API from "./resources/index.js";
|
|
8
|
-
import { ParsecWebSocket, type ParsecWebSocketOptions } from "./streaming.js";
|
|
9
8
|
import { APIPromise } from "./core/api-promise.js";
|
|
10
|
-
import { Account, AccountBalanceParams, AccountBalanceResponse,
|
|
11
|
-
import {
|
|
9
|
+
import { Account, AccountBalanceParams, AccountBalanceResponse, AccountPingParams, AccountPingResponse, AccountUsageResponse, AccountUserActivityParams, AccountUserActivityResponse } from "./resources/account.js";
|
|
10
|
+
import { Ctf, CtfMergeParams, CtfRedeemParams, CtfResponse, CtfSplitParams } from "./resources/ctf.js";
|
|
12
11
|
import { EventListParams, EventListResponse, Events } from "./resources/events.js";
|
|
13
12
|
import { ExchangeListResponse, Exchanges } from "./resources/exchanges.js";
|
|
14
13
|
import { ExecutionPrice, ExecutionPriceRetrieveParams, ExecutionPriceRetrieveResponse } from "./resources/execution-price.js";
|
|
14
|
+
import { FillListParams, FillListResponse, Fills } from "./resources/fills.js";
|
|
15
15
|
import { MarketListParams, MarketListResponse, Markets } from "./resources/markets.js";
|
|
16
|
+
import { Onboard, OnboardCreateParams, OnboardCreateResponse } from "./resources/onboard.js";
|
|
16
17
|
import { Orderbook, OrderbookRetrieveParams, OrderbookRetrieveResponse } from "./resources/orderbook.js";
|
|
17
18
|
import { Order, OrderCancelParams, OrderCreateParams, OrderListParams, OrderListResponse, OrderRetrieveParams, Orders } from "./resources/orders.js";
|
|
18
19
|
import { PositionListParams, PositionListResponse, Positions } from "./resources/positions.js";
|
|
19
|
-
import {
|
|
20
|
+
import { Price, PriceRetrieveParams, PriceRetrieveResponse } from "./resources/price.js";
|
|
20
21
|
import { TradeListParams, TradeListResponse, Trades } from "./resources/trades.js";
|
|
22
|
+
import { Wallet, WalletExportKeyParams, WalletExportKeyResponse, WalletRetrieveResponse } from "./resources/wallet.js";
|
|
21
23
|
import { CustomerUsage, Websocket, WebsocketUsageParams, WebsocketUsageResponse } from "./resources/websocket.js";
|
|
24
|
+
import { Builder, BuilderPoolResponse } from "./resources/builder/builder.js";
|
|
22
25
|
import { type Fetch } from "./internal/builtin-types.js";
|
|
23
26
|
import { HeadersLike, NullableHeaders } from "./internal/headers.js";
|
|
24
27
|
import { FinalRequestOptions, RequestOptions } from "./internal/request-options.js";
|
|
@@ -138,7 +141,7 @@ export declare class ParsecAPI {
|
|
|
138
141
|
protected defaultQuery(): Record<string, string | undefined> | undefined;
|
|
139
142
|
protected validateHeaders({ values, nulls }: NullableHeaders): void;
|
|
140
143
|
protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
|
|
141
|
-
protected stringifyQuery(query: Record<string, unknown>): string;
|
|
144
|
+
protected stringifyQuery(query: object | Record<string, unknown>): string;
|
|
142
145
|
private getUserAgent;
|
|
143
146
|
protected defaultIdempotencyKey(): string;
|
|
144
147
|
protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
|
|
@@ -199,32 +202,18 @@ export declare class ParsecAPI {
|
|
|
199
202
|
markets: API.Markets;
|
|
200
203
|
executionPrice: API.ExecutionPrice;
|
|
201
204
|
orderbook: API.Orderbook;
|
|
202
|
-
|
|
205
|
+
price: API.Price;
|
|
203
206
|
trades: API.Trades;
|
|
204
207
|
events: API.Events;
|
|
205
208
|
websocket: API.Websocket;
|
|
206
209
|
orders: API.Orders;
|
|
207
210
|
positions: API.Positions;
|
|
211
|
+
fills: API.Fills;
|
|
208
212
|
account: API.Account;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
*
|
|
214
|
-
* @param opts.url - Override the WebSocket URL (derived from baseURL by default).
|
|
215
|
-
* @returns A new `ParsecWebSocket` instance.
|
|
216
|
-
*
|
|
217
|
-
* @example
|
|
218
|
-
* ```ts
|
|
219
|
-
* const client = new ParsecAPI({ apiKey: 'pk_...' });
|
|
220
|
-
* const ws = client.ws();
|
|
221
|
-
*
|
|
222
|
-
* ws.on('orderbook', (book) => console.log(book.bids[0]));
|
|
223
|
-
* await ws.connect();
|
|
224
|
-
* ws.subscribe({ parsecId: 'polymarket:0x123', outcome: 'Yes' });
|
|
225
|
-
* ```
|
|
226
|
-
*/
|
|
227
|
-
ws(opts?: ParsecWebSocketOptions): ParsecWebSocket;
|
|
213
|
+
onboard: API.Onboard;
|
|
214
|
+
wallet: API.Wallet;
|
|
215
|
+
ctf: API.Ctf;
|
|
216
|
+
builder: API.Builder;
|
|
228
217
|
}
|
|
229
218
|
export declare namespace ParsecAPI {
|
|
230
219
|
export type RequestOptions = Opts.RequestOptions;
|
|
@@ -232,13 +221,17 @@ export declare namespace ParsecAPI {
|
|
|
232
221
|
export { Markets as Markets, type MarketListResponse as MarketListResponse, type MarketListParams as MarketListParams, };
|
|
233
222
|
export { ExecutionPrice as ExecutionPrice, type ExecutionPriceRetrieveResponse as ExecutionPriceRetrieveResponse, type ExecutionPriceRetrieveParams as ExecutionPriceRetrieveParams, };
|
|
234
223
|
export { Orderbook as Orderbook, type OrderbookRetrieveResponse as OrderbookRetrieveResponse, type OrderbookRetrieveParams as OrderbookRetrieveParams, };
|
|
235
|
-
export {
|
|
224
|
+
export { Price as Price, type PriceRetrieveResponse as PriceRetrieveResponse, type PriceRetrieveParams as PriceRetrieveParams, };
|
|
236
225
|
export { Trades as Trades, type TradeListResponse as TradeListResponse, type TradeListParams as TradeListParams, };
|
|
237
226
|
export { Events as Events, type EventListResponse as EventListResponse, type EventListParams as EventListParams, };
|
|
238
227
|
export { Websocket as Websocket, type CustomerUsage as CustomerUsage, type WebsocketUsageResponse as WebsocketUsageResponse, type WebsocketUsageParams as WebsocketUsageParams, };
|
|
239
228
|
export { Orders as Orders, type Order as Order, type OrderListResponse as OrderListResponse, type OrderCreateParams as OrderCreateParams, type OrderRetrieveParams as OrderRetrieveParams, type OrderListParams as OrderListParams, type OrderCancelParams as OrderCancelParams, };
|
|
240
229
|
export { Positions as Positions, type PositionListResponse as PositionListResponse, type PositionListParams as PositionListParams, };
|
|
241
|
-
export {
|
|
242
|
-
export {
|
|
230
|
+
export { Fills as Fills, type FillListResponse as FillListResponse, type FillListParams as FillListParams };
|
|
231
|
+
export { Account as Account, type AccountBalanceResponse as AccountBalanceResponse, type AccountPingResponse as AccountPingResponse, type AccountUsageResponse as AccountUsageResponse, type AccountUserActivityResponse as AccountUserActivityResponse, type AccountBalanceParams as AccountBalanceParams, type AccountPingParams as AccountPingParams, type AccountUserActivityParams as AccountUserActivityParams, };
|
|
232
|
+
export { Onboard as Onboard, type OnboardCreateResponse as OnboardCreateResponse, type OnboardCreateParams as OnboardCreateParams, };
|
|
233
|
+
export { Wallet as Wallet, type WalletRetrieveResponse as WalletRetrieveResponse, type WalletExportKeyResponse as WalletExportKeyResponse, type WalletExportKeyParams as WalletExportKeyParams, };
|
|
234
|
+
export { Ctf as Ctf, type CtfResponse as CtfResponse, type CtfMergeParams as CtfMergeParams, type CtfRedeemParams as CtfRedeemParams, type CtfSplitParams as CtfSplitParams, };
|
|
235
|
+
export { Builder as Builder, type BuilderPoolResponse as BuilderPoolResponse };
|
|
243
236
|
}
|
|
244
237
|
//# sourceMappingURL=client.d.ts.map
|
package/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY;OAC3C,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE;YAIvE,EAAE,MAAM,EAAE,QAAQ,EAAE;OAKzB,KAAK,IAAI;OAGT,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR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AC/B,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;IAEF,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAChF"}
|
package/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
var _ParsecAPI_instances, _a, _ParsecAPI_encoder, _ParsecAPI_baseURLOverridden
|
|
3
|
+
var _ParsecAPI_instances, _a, _ParsecAPI_encoder, _ParsecAPI_baseURLOverridden;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.ParsecAPI = void 0;
|
|
6
6
|
const tslib_1 = require("./internal/tslib.js");
|
|
@@ -11,25 +11,28 @@ const errors_1 = require("./internal/errors.js");
|
|
|
11
11
|
const detect_platform_1 = require("./internal/detect-platform.js");
|
|
12
12
|
const Shims = tslib_1.__importStar(require("./internal/shims.js"));
|
|
13
13
|
const Opts = tslib_1.__importStar(require("./internal/request-options.js"));
|
|
14
|
-
const
|
|
14
|
+
const query_1 = require("./internal/utils/query.js");
|
|
15
15
|
const version_1 = require("./version.js");
|
|
16
16
|
const Errors = tslib_1.__importStar(require("./core/error.js"));
|
|
17
17
|
const Uploads = tslib_1.__importStar(require("./core/uploads.js"));
|
|
18
18
|
const API = tslib_1.__importStar(require("./resources/index.js"));
|
|
19
|
-
const streaming_1 = require("./streaming.js");
|
|
20
19
|
const api_promise_1 = require("./core/api-promise.js");
|
|
21
20
|
const account_1 = require("./resources/account.js");
|
|
22
|
-
const
|
|
21
|
+
const ctf_1 = require("./resources/ctf.js");
|
|
23
22
|
const events_1 = require("./resources/events.js");
|
|
24
23
|
const exchanges_1 = require("./resources/exchanges.js");
|
|
25
24
|
const execution_price_1 = require("./resources/execution-price.js");
|
|
25
|
+
const fills_1 = require("./resources/fills.js");
|
|
26
26
|
const markets_1 = require("./resources/markets.js");
|
|
27
|
+
const onboard_1 = require("./resources/onboard.js");
|
|
27
28
|
const orderbook_1 = require("./resources/orderbook.js");
|
|
28
29
|
const orders_1 = require("./resources/orders.js");
|
|
29
30
|
const positions_1 = require("./resources/positions.js");
|
|
30
|
-
const
|
|
31
|
+
const price_1 = require("./resources/price.js");
|
|
31
32
|
const trades_1 = require("./resources/trades.js");
|
|
33
|
+
const wallet_1 = require("./resources/wallet.js");
|
|
32
34
|
const websocket_1 = require("./resources/websocket.js");
|
|
35
|
+
const builder_1 = require("./resources/builder/builder.js");
|
|
33
36
|
const headers_1 = require("./internal/headers.js");
|
|
34
37
|
const env_1 = require("./internal/utils/env.js");
|
|
35
38
|
const log_1 = require("./internal/utils/log.js");
|
|
@@ -62,14 +65,18 @@ class ParsecAPI {
|
|
|
62
65
|
this.markets = new API.Markets(this);
|
|
63
66
|
this.executionPrice = new API.ExecutionPrice(this);
|
|
64
67
|
this.orderbook = new API.Orderbook(this);
|
|
65
|
-
this.
|
|
68
|
+
this.price = new API.Price(this);
|
|
66
69
|
this.trades = new API.Trades(this);
|
|
67
70
|
this.events = new API.Events(this);
|
|
68
71
|
this.websocket = new API.Websocket(this);
|
|
69
72
|
this.orders = new API.Orders(this);
|
|
70
73
|
this.positions = new API.Positions(this);
|
|
74
|
+
this.fills = new API.Fills(this);
|
|
71
75
|
this.account = new API.Account(this);
|
|
72
|
-
this.
|
|
76
|
+
this.onboard = new API.Onboard(this);
|
|
77
|
+
this.wallet = new API.Wallet(this);
|
|
78
|
+
this.ctf = new API.Ctf(this);
|
|
79
|
+
this.builder = new API.Builder(this);
|
|
73
80
|
if (apiKey === undefined) {
|
|
74
81
|
throw new Errors.ParsecAPIError("The PARSEC_API_KEY environment variable is missing or empty; either provide it, or instantiate the ParsecAPI client with an apiKey option, like new ParsecAPI({ apiKey: 'My API Key' }).");
|
|
75
82
|
}
|
|
@@ -128,7 +135,7 @@ class ParsecAPI {
|
|
|
128
135
|
return (0, headers_1.buildHeaders)([{ 'X-API-Key': this.apiKey }]);
|
|
129
136
|
}
|
|
130
137
|
stringifyQuery(query) {
|
|
131
|
-
return
|
|
138
|
+
return (0, query_1.stringifyQuery)(query);
|
|
132
139
|
}
|
|
133
140
|
getUserAgent() {
|
|
134
141
|
return `${this.constructor.name}/JS ${version_1.VERSION}`;
|
|
@@ -469,41 +476,10 @@ class ParsecAPI {
|
|
|
469
476
|
return tslib_1.__classPrivateFieldGet(this, _ParsecAPI_encoder, "f").call(this, { body, headers });
|
|
470
477
|
}
|
|
471
478
|
}
|
|
472
|
-
/**
|
|
473
|
-
* Create a WebSocket client for real-time orderbook and trade streaming.
|
|
474
|
-
* Inherits `apiKey` from this client and derives the WebSocket URL from `baseURL`.
|
|
475
|
-
*
|
|
476
|
-
* @param opts.url - Override the WebSocket URL (derived from baseURL by default).
|
|
477
|
-
* @returns A new `ParsecWebSocket` instance.
|
|
478
|
-
*
|
|
479
|
-
* @example
|
|
480
|
-
* ```ts
|
|
481
|
-
* const client = new ParsecAPI({ apiKey: 'pk_...' });
|
|
482
|
-
* const ws = client.ws();
|
|
483
|
-
*
|
|
484
|
-
* ws.on('orderbook', (book) => console.log(book.bids[0]));
|
|
485
|
-
* await ws.connect();
|
|
486
|
-
* ws.subscribe({ parsecId: 'polymarket:0x123', outcome: 'Yes' });
|
|
487
|
-
* ```
|
|
488
|
-
*/
|
|
489
|
-
ws(opts) {
|
|
490
|
-
const wsUrl = opts?.url ?? tslib_1.__classPrivateFieldGet(this, _ParsecAPI_instances, "m", _ParsecAPI_deriveWsUrl).call(this);
|
|
491
|
-
return new streaming_1.ParsecWebSocket(this.apiKey, wsUrl);
|
|
492
|
-
}
|
|
493
479
|
}
|
|
494
480
|
exports.ParsecAPI = ParsecAPI;
|
|
495
481
|
_a = ParsecAPI, _ParsecAPI_encoder = new WeakMap(), _ParsecAPI_instances = new WeakSet(), _ParsecAPI_baseURLOverridden = function _ParsecAPI_baseURLOverridden() {
|
|
496
482
|
return this.baseURL !== environments[this._options.environment || 'production'];
|
|
497
|
-
}, _ParsecAPI_deriveWsUrl = function _ParsecAPI_deriveWsUrl() {
|
|
498
|
-
const base = this.baseURL.replace(/\/$/, '');
|
|
499
|
-
if (base.startsWith('https://')) {
|
|
500
|
-
return base.replace(/^https:\/\//, 'wss://') + '/ws';
|
|
501
|
-
}
|
|
502
|
-
if (base.startsWith('http://')) {
|
|
503
|
-
return base.replace(/^http:\/\//, 'ws://') + '/ws';
|
|
504
|
-
}
|
|
505
|
-
// Fallback: assume wss
|
|
506
|
-
return 'wss://' + base + '/ws';
|
|
507
483
|
};
|
|
508
484
|
ParsecAPI.ParsecAPI = _a;
|
|
509
485
|
ParsecAPI.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
@@ -525,12 +501,16 @@ ParsecAPI.Exchanges = exchanges_1.Exchanges;
|
|
|
525
501
|
ParsecAPI.Markets = markets_1.Markets;
|
|
526
502
|
ParsecAPI.ExecutionPrice = execution_price_1.ExecutionPrice;
|
|
527
503
|
ParsecAPI.Orderbook = orderbook_1.Orderbook;
|
|
528
|
-
ParsecAPI.
|
|
504
|
+
ParsecAPI.Price = price_1.Price;
|
|
529
505
|
ParsecAPI.Trades = trades_1.Trades;
|
|
530
506
|
ParsecAPI.Events = events_1.Events;
|
|
531
507
|
ParsecAPI.Websocket = websocket_1.Websocket;
|
|
532
508
|
ParsecAPI.Orders = orders_1.Orders;
|
|
533
509
|
ParsecAPI.Positions = positions_1.Positions;
|
|
510
|
+
ParsecAPI.Fills = fills_1.Fills;
|
|
534
511
|
ParsecAPI.Account = account_1.Account;
|
|
535
|
-
ParsecAPI.
|
|
512
|
+
ParsecAPI.Onboard = onboard_1.Onboard;
|
|
513
|
+
ParsecAPI.Wallet = wallet_1.Wallet;
|
|
514
|
+
ParsecAPI.Ctf = ctf_1.Ctf;
|
|
515
|
+
ParsecAPI.Builder = builder_1.Builder;
|
|
536
516
|
//# sourceMappingURL=client.js.map
|