@proof-labs/trading-sdk 4.0.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 (59) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +391 -0
  3. package/dist/client.d.ts +640 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +1730 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/codec-adapter.d.ts +33 -0
  8. package/dist/codec-adapter.d.ts.map +1 -0
  9. package/dist/codec-adapter.js +419 -0
  10. package/dist/codec-adapter.js.map +1 -0
  11. package/dist/codec.d.ts +137 -0
  12. package/dist/codec.d.ts.map +1 -0
  13. package/dist/codec.js +229 -0
  14. package/dist/codec.js.map +1 -0
  15. package/dist/crypto.d.ts +78 -0
  16. package/dist/crypto.d.ts.map +1 -0
  17. package/dist/crypto.js +145 -0
  18. package/dist/crypto.js.map +1 -0
  19. package/dist/errors.d.ts +122 -0
  20. package/dist/errors.d.ts.map +1 -0
  21. package/dist/errors.js +397 -0
  22. package/dist/errors.js.map +1 -0
  23. package/dist/governance-query.d.ts +47 -0
  24. package/dist/governance-query.d.ts.map +1 -0
  25. package/dist/governance-query.js +525 -0
  26. package/dist/governance-query.js.map +1 -0
  27. package/dist/index.d.ts +11 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +22 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/testing.d.ts +25 -0
  32. package/dist/testing.d.ts.map +1 -0
  33. package/dist/testing.js +22 -0
  34. package/dist/testing.js.map +1 -0
  35. package/dist/trigger-history.d.ts +9 -0
  36. package/dist/trigger-history.d.ts.map +1 -0
  37. package/dist/trigger-history.js +442 -0
  38. package/dist/trigger-history.js.map +1 -0
  39. package/dist/triggers.d.ts +15 -0
  40. package/dist/triggers.d.ts.map +1 -0
  41. package/dist/triggers.js +399 -0
  42. package/dist/triggers.js.map +1 -0
  43. package/dist/tx-result.d.ts +53 -0
  44. package/dist/tx-result.d.ts.map +1 -0
  45. package/dist/tx-result.js +58 -0
  46. package/dist/tx-result.js.map +1 -0
  47. package/dist/types.d.ts +2085 -0
  48. package/dist/types.d.ts.map +1 -0
  49. package/dist/types.js +121 -0
  50. package/dist/types.js.map +1 -0
  51. package/dist/wasm/proof_trading_sdk_wasm.d.ts +98 -0
  52. package/dist/wasm/proof_trading_sdk_wasm.js +698 -0
  53. package/dist/wasm/proof_trading_sdk_wasm_bg.wasm +0 -0
  54. package/dist/wasm/proof_trading_sdk_wasm_bg.wasm.d.ts +19 -0
  55. package/dist/wasm-loader.d.ts +42 -0
  56. package/dist/wasm-loader.d.ts.map +1 -0
  57. package/dist/wasm-loader.js +95 -0
  58. package/dist/wasm-loader.js.map +1 -0
  59. package/package.json +72 -0
@@ -0,0 +1,640 @@
1
+ import type { Action, TxResult, PlaceOrder, MarketOrder, AccountInfo, HistoryCashFlow, HistoryFillsPage, HistoryPositionSnapshot, HistoryResolution, MarketConfig, OpenOrder, AdlQueueEntry, Orderbook, Ticker, WithdrawalRecord, AdminSignerRegistry, ProposalPage, ImpactMarketInfo, SetPositionTriggers, PositionTriggerInfo, TriggerStatus, PositionTriggerHistoryFilters, PositionTriggerHistoryPage, TriggerMarketHistoryFilters, TriggerMarketHistoryPage, TriggerMarketConfigInfo } from "./types.js";
2
+ /**
3
+ * Fetch the 32-byte chain_id binding from a CometBFT RPC's `/status`
4
+ * endpoint. Hashes `result.node_info.network` via `chainIdFromString`.
5
+ *
6
+ * `ExchangeClient` resolves this lazily on first submit and caches it
7
+ * — most callers don't need this directly. Use it from offline tooling
8
+ * (raw `signAndEncode` callers, gateway-side helpers) that build wire
9
+ * bytes without going through a client instance.
10
+ */
11
+ export declare function fetchChainId(rpcUrl: string): Promise<Uint8Array>;
12
+ export interface ExchangeClientOptions {
13
+ /**
14
+ * Override for the CometBFT RPC endpoint on the **internal**
15
+ * direct-node path (`useGateway: false`). Optional — when omitted it is
16
+ * derived from `gatewayUrl` (remapping local gateway port 9080 → 26657).
17
+ * When `useGateway` is true (the default, and the only supported mode for
18
+ * external clients) chain reads, tx-result polling, and chain-id resolution
19
+ * go through `gatewayUrl` (`/v1/*`) and this value is ignored.
20
+ */
21
+ rpcUrl?: string;
22
+ /**
23
+ * Override for the Go API server endpoint on the **internal**
24
+ * direct-node read path (`useGateway: false`). Optional — when omitted
25
+ * it is derived from `gatewayUrl` (remapping local gateway port
26
+ * 9080 → 8080). When `useGateway` is true (the default) every read/query
27
+ * goes through `gatewayUrl` and this value is ignored. External clients
28
+ * must not rely on direct API-server reachability.
29
+ */
30
+ apiUrl?: string;
31
+ /**
32
+ * WebSocket base URL for the gateway streams (`/account-events`,
33
+ * `/orderbook-deltas`). Defaults to `gatewayUrl` (or `rpcUrl` on the
34
+ * direct-node path) with the scheme swapped to `ws`/`wss`. The gateway
35
+ * serves its feed on a dedicated listener; for a local stack whose WS
36
+ * port differs from the HTTP port, set this explicitly
37
+ * (e.g. `ws://localhost:9091`).
38
+ */
39
+ wsUrl?: string;
40
+ /**
41
+ * CometBFT `chain_id` string — e.g. "proof-testnet-1". Signatures
42
+ * are bound to this value via the v3 envelope
43
+ * (`crypto::signing_message`), closing the cross-chain replay
44
+ * vector audit B4 identified.
45
+ *
46
+ * If omitted, the client auto-resolves it on first submit from the
47
+ * gateway's `/v1/status` (`result.node_info.network`), or from
48
+ * `${rpcUrl}/status` on the direct-node path, and caches it. Pre-warm with
49
+ * `await client.ready()` to surface resolution errors at init time. Pinning
50
+ * `chainId` explicitly is still recommended for production — it keeps
51
+ * signatures deterministic across SDK rebuilds.
52
+ *
53
+ * If `/status` is unreachable AND `allowUnbound: true` is set, the client
54
+ * falls back to `UNBOUND_CHAIN_ID`; otherwise it throws.
55
+ */
56
+ chainId?: string;
57
+ /**
58
+ * When true, allow falling back to `UNBOUND_CHAIN_ID` if `chainId`
59
+ * is omitted AND the chain's `/status` is unreachable (the gateway's
60
+ * `/v1/status`, or `${rpcUrl}/status` on the direct path). Default false.
61
+ *
62
+ * The fallback exists for local fixtures where the chain isn't up
63
+ * yet (e.g. constructing a client that will never submit, just to
64
+ * sign offline). Any production or CI path that submits MUST leave
65
+ * this false: an UNBOUND signature against a real chain is
66
+ * replayable across deployments and will be rejected by any engine
67
+ * with a real chain_id binding.
68
+ */
69
+ allowUnbound?: boolean;
70
+ /**
71
+ * Public API gateway endpoint — the single source of truth for where
72
+ * the SDK points. Under the default `useGateway: true` every request
73
+ * (submission, reads, chain queries, WebSocket) goes here, and the
74
+ * direct-node URLs (`rpcUrl` / `apiUrl`) are derived from it. Defaults
75
+ * to `https://api.dev.proof.trade`.
76
+ */
77
+ gatewayUrl?: string;
78
+ /**
79
+ * Master traffic selector. Controls **all** network paths, not just
80
+ * submission, so the SDK honours the gateway-only network policy (see
81
+ * CLAUDE.md → "Network policy — gateway only").
82
+ *
83
+ * - `true` (default, the only supported mode for external clients):
84
+ * every request — submission, reads/queries, chain status/blocks
85
+ * (`/v1/status`, `/v1/block`, …), tx-result polling, chain-id resolution,
86
+ * and the WebSocket feed — goes through `gatewayUrl`. Submission POSTs the
87
+ * signed wire bytes to `gatewayUrl/exchange`; the gateway verifies the
88
+ * signature, applies rate limiting, and forwards to CometBFT. This is the
89
+ * production-facing path.
90
+ *
91
+ * - `false`: the legacy direct-node path — submission goes to CometBFT
92
+ * `broadcast_tx_sync` over `rpcUrl`, reads to `apiUrl`, and chain
93
+ * queries to `rpcUrl`. Kept only for in-cluster tools (MMs, HLP,
94
+ * oracle feeder, retail-flow taker) and the scenario harness that
95
+ * reach the node directly and don't need the gateway. Never expose
96
+ * this to external callers.
97
+ *
98
+ * The submission paths are wire-compatible: both submit the same V3
99
+ * signed envelope. Switching only changes which surface validates and
100
+ * forwards the bytes. The nonce in that envelope is a client-chosen
101
+ * millisecond Unix timestamp; code=21 means pick a fresh timestamp.
102
+ */
103
+ useGateway?: boolean;
104
+ /**
105
+ * X-Api-Key header value sent with every gateway-path submission.
106
+ * Required when the gateway is started with `--api-key <key>`. Read
107
+ * endpoints (`POST /info`, `GET /health`) ignore this header.
108
+ * Ignored when `useGateway` is false.
109
+ */
110
+ apiKey?: string;
111
+ /**
112
+ * Deprecated compatibility option. Timestamp nonces are inherently
113
+ * concurrency-safe, so the SDK ignores this flag.
114
+ */
115
+ concurrentNonces?: boolean;
116
+ }
117
+ export declare class ExchangeClient {
118
+ private rpcUrl;
119
+ private apiUrl;
120
+ private gatewayUrl;
121
+ private useGateway;
122
+ private apiKey;
123
+ private wsUrl;
124
+ /**
125
+ * 32-byte chain_id binding for v3 signatures (audit B4). `null` until
126
+ * either an explicit `opts.chainId` is hashed in the constructor or
127
+ * `resolveChainId()` fetches `${chainBase}/status` (the gateway's
128
+ * `/v1/status`, or `${rpcUrl}/status` on the direct path) on first submit.
129
+ */
130
+ private chainId;
131
+ private allowUnbound;
132
+ /** Single-flight guard so concurrent submits share one /status fetch. */
133
+ private chainIdPromise;
134
+ private privateKey;
135
+ private publicKey;
136
+ private address;
137
+ private addressHex;
138
+ private lastTimestampNonce;
139
+ /** Unsubscribe handles for every open WebSocket stream, so `disconnect()`
140
+ * can tear them all down at once. */
141
+ private activeStreams;
142
+ /**
143
+ * In-flight DeliverTx verification promises spawned by submitTx. Awaiting
144
+ * this set lets callers serialize against block inclusion when they need to;
145
+ * timestamp nonces do not require drift reconciliation.
146
+ */
147
+ private pendingVerifies;
148
+ /**
149
+ * Completed DeliverTx results collected by background verifiers. Cleared on
150
+ * each `awaitPendingVerifies()` call. Non-zero code entries indicate a tx
151
+ * passed CheckTx but failed at inclusion time — the caller should handle
152
+ * these (e.g. retry or log).
153
+ */
154
+ private deliveryResults;
155
+ /**
156
+ * When true, submitTx is the safe-by-default fire-and-spawn-verifier mode.
157
+ * Callers that need maximum throughput and don't need inclusion polling can
158
+ * flip this off via setUnsafeFastSubmit(true).
159
+ */
160
+ private autoVerifyDelivery;
161
+ constructor(opts?: ExchangeClientOptions);
162
+ /**
163
+ * Base URL for read/query endpoints (`/v1/*`). Routes through the
164
+ * gateway under the default `useGateway: true`; only the internal
165
+ * direct-node path (`useGateway: false`) targets the bare `apiUrl`.
166
+ */
167
+ private get readBaseUrl();
168
+ /**
169
+ * URL for the transaction-status lookup by hash. On the gateway path
170
+ * (default) this is the gateway's native `/v1/tx/{hash}` route, which
171
+ * proxies CometBFT's `/tx?hash=` and returns the body verbatim. On the
172
+ * internal direct-node path (`useGateway: false`) it is CometBFT's native
173
+ * `/tx?hash=0x{hash}`. Both yield the same `{ result: { tx_result, height } }`
174
+ * shape, so callers parse the response identically.
175
+ */
176
+ private txStatusUrl;
177
+ /**
178
+ * Base URL for CometBFT-style chain reads (`/status`, `/block`,
179
+ * `/block_results`) and the chain-id bootstrap. On the gateway path
180
+ * (default) this is the gateway's `/v1` proxy prefix — the gateway fronts
181
+ * these as `/v1/status`, `/v1/block`, `/v1/block_results` (api-gateway #69)
182
+ * and returns the CometBFT body verbatim. On the internal direct-node path
183
+ * (`useGateway: false`) it is the bare `rpcUrl`. Append the endpoint
184
+ * (`/status`, …); both paths yield the same response shape.
185
+ */
186
+ private get chainBase();
187
+ /**
188
+ * Resolve and cache the 32-byte chain_id binding. Idempotent and
189
+ * single-flight: concurrent callers share one in-flight promise.
190
+ *
191
+ * Resolution order:
192
+ * 1. Explicit `opts.chainId` from the constructor (already hashed) — return it.
193
+ * 2. Fetch `${chainBase}/status` (the gateway's `/v1/status`, or
194
+ * `${rpcUrl}/status` on the direct path), hash `result.node_info.network`.
195
+ * 3. On fetch failure: if `allowUnbound`, warn and use `UNBOUND_CHAIN_ID`;
196
+ * otherwise throw.
197
+ *
198
+ * Public via `ready()`. `broadcastSigned` calls this internally before every
199
+ * submit; the cache means only the first submit pays the round-trip.
200
+ */
201
+ private resolveChainId;
202
+ /**
203
+ * Pre-resolve the chain_id binding before any `submitTx` call. Surfaces
204
+ * `/status`-fetch errors at init time rather than mid-flow. Optional —
205
+ * `submitTx` resolves lazily on its own.
206
+ */
207
+ ready(): Promise<void>;
208
+ /**
209
+ * Return the cached chain_id binding. `null` if `ready()` hasn't run
210
+ * and no explicit `opts.chainId` was passed. Callers that bypass
211
+ * `submitTx` (e.g. signing wire bytes for an out-of-band submit
212
+ * path) should `await client.ready()` first, then use this to feed
213
+ * `signAndEncode`.
214
+ */
215
+ getChainId(): Uint8Array | null;
216
+ /** Set the private key for signing transactions. */
217
+ setPrivateKey(key: Uint8Array): void;
218
+ getAddress(): Uint8Array | null;
219
+ getAddressHex(): string | null;
220
+ getPublicKey(): Uint8Array | null;
221
+ /**
222
+ * Return the private key the client is signing with. Exposed so
223
+ * adjacent ops tools can build a signed envelope without re-loading
224
+ * the key from disk. Callers that don't need to bypass the normal
225
+ * `submitTx` path should not use this.
226
+ */
227
+ getPrivateKey(): Uint8Array | null;
228
+ /** Fetch the retained timestamp nonce set from the node, for diagnostics. */
229
+ getRecentNonces(addressHex?: string): Promise<bigint[]>;
230
+ /**
231
+ * Allocate the next timestamp nonce.
232
+ *
233
+ * Algorithm: `max(now_ms, last_nonce + 1)` capped at `now_ms + 60s` to
234
+ * bound the growth if the clock stops ticking.
235
+ *
236
+ * Engine window: `[block_time - 2 days, block_time + 1 day]`. All four
237
+ * rejection modes (too old, too far future, replay, below oldest) map to
238
+ * code 21 `InvalidNonce`. Nonces are burned on success — no rewinding.
239
+ *
240
+ * Thread-safe only through external serialization (caller's responsibility).
241
+ */
242
+ private nextTimestampNonce;
243
+ /**
244
+ * Sign and submit a transaction via broadcast_tx_sync.
245
+ *
246
+ * The SDK signs each transaction with a fresh millisecond timestamp nonce
247
+ * before submitting. Whenever the response has a tx hash but no final chain
248
+ * verdict, a fire-and-forget verifier polls `/tx?hash=...` for the actual
249
+ * `DeliverTx` result. It never rewinds or resyncs nonce state: included failed
250
+ * transactions still burn their timestamp nonce by design.
251
+ *
252
+ * Callers that need to know definitively whether a tx landed should use
253
+ * `submitTxCommit`, which awaits the same verification synchronously.
254
+ *
255
+ * Callers needing to serialize against in-flight verifications (e.g. before
256
+ * issuing a tx that depends on the previous tx's effect) can call
257
+ * `awaitPendingVerifies()` first.
258
+ *
259
+ * No nonce sync call is required before the first transaction.
260
+ */
261
+ submitTx(action: Action): Promise<TxResult>;
262
+ /**
263
+ * Submit **externally signed** wire bytes — the public counterpart of
264
+ * `submitTx` for callers that never load a private key into the client
265
+ * (hardware or CLI signers, multisig proposers/approvers). Build the bytes
266
+ * with `signingMessage()` → sign anywhere → `encodeSignedTx()`; this method
267
+ * is pure transport for the result.
268
+ *
269
+ * The caller owns everything the loaded-key path normally does: the
270
+ * chain id, a fresh millisecond-timestamp `seq` (one per signature), and
271
+ * the signature itself. The bytes are deliberately treated as opaque —
272
+ * never decoded or validated here — so wire-valid action types this SDK
273
+ * build does not know yet still submit; the gateway and engine are the
274
+ * authorities that reject malformed bytes.
275
+ *
276
+ * Routes exactly like `submitTx` (gateway by default, CometBFT
277
+ * `broadcast_tx_sync` on the internal `useGateway: false` opt-out) with the
278
+ * same delivery-verification semantics: a synchronous gateway verdict is
279
+ * final and returns as-is; a hash-only ambiguous response spawns the same
280
+ * fire-and-forget `/tx?hash=` reconciliation, awaitable via
281
+ * `awaitPendingVerifies()`.
282
+ */
283
+ submitSignedTx(txBytes: Uint8Array): Promise<TxResult>;
284
+ /**
285
+ * Internal: route pre-signed wire bytes to the configured transport —
286
+ * gateway (`POST /exchange`, default) or CometBFT `broadcast_tx_sync` on
287
+ * the internal `useGateway: false` opt-out. Both submit identical bytes.
288
+ * Shared by `submitSignedTx` and `submitSignedTxCommit`.
289
+ */
290
+ private broadcastSignedBytes;
291
+ /**
292
+ * Internal: sign + submit with a fresh timestamp nonce. Does NOT spawn a
293
+ * background verifier — the public `submitTx` adds that.
294
+ * `submitTxCommit` uses this directly so it can run its own
295
+ * synchronous verification without two pollers racing for the same
296
+ * tx hash.
297
+ *
298
+ * Routes via the gateway (`POST gatewayUrl/exchange`) when
299
+ * `useGateway` is true (default), or via CometBFT
300
+ * `broadcast_tx_sync` when false (internal-tools opt-out path).
301
+ * Both paths submit identical signed wire bytes.
302
+ */
303
+ private broadcastSigned;
304
+ /**
305
+ * Submit signed wire bytes via the public API gateway
306
+ * (`POST gatewayUrl/exchange`). Sends the **pre-signed** JSON shape
307
+ * the gateway accepts (`{"action": "<base64-wire-bytes>"}`) since
308
+ * the SDK already has the wire bytes — saves the gateway from
309
+ * re-encoding from structured JSON.
310
+ *
311
+ * The gateway re-verifies the signature, applies rate limiting and,
312
+ * when configured with `--api-key`, checks the `X-Api-Key` header.
313
+ * On success it forwards the wire bytes to CometBFT's
314
+ * `broadcast_tx_sync`.
315
+ *
316
+ * The gateway response is an `ExchangeResponse`: a structured chain verdict
317
+ * carries `code` and optionally `height`/`events`; an admitted-but-ambiguous
318
+ * submission carries `txHash` without `code` and must be reconciled. We map
319
+ * every shape to `TxResult`. Engine rejections retain the compatibility error
320
+ * string `"<code>: <message>"`, while the structured `code` is authoritative.
321
+ * For transport-level failures (rate limit, auth, etc.) we synthesize a code
322
+ * from the HTTP status.
323
+ */
324
+ private submitViaGateway;
325
+ /**
326
+ * Whether a `TxResult` is already final — i.e. nothing is gained by polling
327
+ * for it.
328
+ *
329
+ * A `height` means the tx executed in a block (the synchronous gateway
330
+ * response carries it). An `engine` outcome without a height is a CheckTx
331
+ * reject: it never entered a block and never will, so DeliverTx will not run.
332
+ * A `transport` failure never reached the chain at all.
333
+ */
334
+ private isFinalResult;
335
+ /**
336
+ * Submit signed wire bytes via CometBFT `broadcast_tx_sync`. Used
337
+ * when `useGateway` is false (internal-tools opt-out). Bypasses
338
+ * gateway auth/rate-limit and goes directly to CometBFT.
339
+ */
340
+ private submitViaCometBFT;
341
+ /**
342
+ * Internal: spawn a fire-and-forget verifier that polls /tx?hash for the
343
+ * DeliverTx result. Timestamp nonces are intentionally not reconciled on
344
+ * DeliverTx failure or timeout.
345
+ * The promise is added to `pendingVerifies` so callers can await it via
346
+ * `awaitPendingVerifies()` when they need synchronization.
347
+ *
348
+ * The cleanup (Set deletion) is performed INSIDE the verifier's finally
349
+ * block rather than via a chained .finally() so there's no microtask race
350
+ * between p settling and the awaitPendingVerifies() loop seeing size==0.
351
+ */
352
+ private spawnDeliveryVerifier;
353
+ /**
354
+ * Wait for every in-flight DeliverTx verifier spawned by submitTx to settle,
355
+ * then return the collected delivery results. Each entry is the DeliverTx
356
+ * result observed by the background poller — `code === 0` means the tx was
357
+ * included successfully, non-zero means it passed CheckTx but failed at
358
+ * inclusion. Call this before a tx that depends on a previous tx's state
359
+ * having actually landed.
360
+ *
361
+ * Results are drained from the internal buffer: subsequent calls return
362
+ * only verifications that completed *after* the previous drain.
363
+ */
364
+ awaitPendingVerifies(): Promise<TxResult[]>;
365
+ /**
366
+ * Opt out of background DeliverTx verification. Only use this for
367
+ * high-throughput stress workloads that do not need inclusion polling.
368
+ */
369
+ setUnsafeFastSubmit(unsafe: boolean): void;
370
+ /**
371
+ * Submit and wait for block inclusion (slower, but confirms execution).
372
+ *
373
+ * A synchronous gateway verdict returns immediately. If the gateway only
374
+ * acknowledges CheckTx (legacy) or returns a hash-only ambiguous response,
375
+ * this falls back to polling `/tx?hash=...`. The direct-node path likewise
376
+ * uses `broadcast_tx_sync` plus polling instead of CometBFT's less reliable
377
+ * `broadcast_tx_commit` subscription.
378
+ */
379
+ submitTxCommit(action: Action): Promise<TxResult>;
380
+ /**
381
+ * Submit **externally signed** wire bytes and wait for block inclusion —
382
+ * the commit counterpart of `submitSignedTx`, for the same callers
383
+ * (hardware/CLI signers, multisig propose/approve) that never load a
384
+ * private key into the client. Shares `submitTxCommit`'s exact finality
385
+ * logic: a synchronous gateway verdict returns immediately; a hash-only
386
+ * ambiguous response or a legacy CheckTx-only ack falls back to polling
387
+ * `/tx?hash=...` (~9 s), scoped to THIS call — no background verifier, no
388
+ * draining the client-global `awaitPendingVerifies()` buffer. Use this
389
+ * when the caller must know definitively whether the tx landed (an
390
+ * operator action, a multisig proposal) rather than fire-and-forget.
391
+ */
392
+ submitSignedTxCommit(txBytes: Uint8Array): Promise<TxResult>;
393
+ /**
394
+ * Internal: shared commit-semantics tail of `submitTxCommit` and
395
+ * `submitSignedTxCommit` — take a broadcast's sync result and return the
396
+ * final chain verdict, polling `/tx?hash=` only when the outcome is still
397
+ * unknown.
398
+ */
399
+ private awaitCommit;
400
+ /**
401
+ * The loaded signer's 20-byte owner address, or throw if no key is set.
402
+ * Every convenience builder needs it, so the guard lives here.
403
+ */
404
+ private requireOwner;
405
+ /**
406
+ * Place a limit order for the loaded signer. `owner` is supplied
407
+ * automatically. Equivalent to
408
+ * `submitTx({ type: "PlaceOrder", data: { ...params, owner } })`.
409
+ */
410
+ placeOrder(params: Omit<PlaceOrder, "owner">): Promise<TxResult>;
411
+ /** Place a market order (crosses immediately) for the loaded signer. */
412
+ marketOrder(params: Omit<MarketOrder, "owner">): Promise<TxResult>;
413
+ /** Cancel a resting order by its engine-assigned order ID. */
414
+ cancelOrder(orderId: bigint): Promise<TxResult>;
415
+ /** Cancel a resting order by the owner-scoped client order ID. */
416
+ cancelClientOrder(clientOrderId: bigint): Promise<TxResult>;
417
+ /**
418
+ * Cancel all resting orders for the loaded signer. Pass a `market` to
419
+ * scope the cancel to one market; omit it to cancel across all markets.
420
+ */
421
+ cancelAllOrders(market?: number | null): Promise<TxResult>;
422
+ /**
423
+ * Close the loaded signer's entire position on `market` via an
424
+ * opposite-side IOC order at oracle±spread. Idempotent on an already-flat
425
+ * position.
426
+ */
427
+ closePosition(market: number): Promise<TxResult>;
428
+ /** Atomically replace a complete SL/TP bracket. When `owner` is omitted,
429
+ * use the loaded signer; a version-active trading agent may pass the
430
+ * delegated owner explicitly. The engine remains the authorization source. */
431
+ setPositionTriggers(params: Omit<SetPositionTriggers, "owner"> & {
432
+ owner?: Uint8Array;
433
+ }): Promise<TxResult>;
434
+ /** Cancel the loaded signer's bracket for one exact position generation. */
435
+ cancelPositionTriggers(market: number, expectedPositionEpoch: bigint, owner?: Uint8Array): Promise<TxResult>;
436
+ /**
437
+ * Owner-scoped reads (account, open orders, withdrawal) are deliberately
438
+ * NOT exposed as GETs on the gateway — it 404s them and requires
439
+ * `POST /info` instead (see `api-gateway/src/server.rs`
440
+ * `is_public_node_path`). On the gateway path we POST the matching
441
+ * `/info` request; on the internal `useGateway: false` path we hit the
442
+ * Go API GET directly. The gateway proxies the node body verbatim, so
443
+ * both return the same `{ data: <base64-msgpack> }` shape and callers
444
+ * decode identically.
445
+ */
446
+ private queryOwnerScoped;
447
+ queryOrderbook(market: number): Promise<Orderbook>;
448
+ /** List all registered market configs. */
449
+ queryMarkets(): Promise<MarketConfig[]>;
450
+ /** List all impact-market families (the 5-book event structures: an
451
+ * underlying perp plus CPY/CPN/EBY/EBN children). Fail-closed like the
452
+ * governance reads: a missing envelope or a malformed row is a refusal,
453
+ * never a partially-rendered list (decoder pinned to engine golden bytes
454
+ * in governance-query.test.ts). */
455
+ queryImpactMarkets(): Promise<ImpactMarketInfo[]>;
456
+ /** Current whole-position trigger brackets for one owner. Immutable
457
+ * lifecycle history is a separate gateway/indexer query below. */
458
+ queryPositionTriggers(addressHex?: string): Promise<PositionTriggerInfo[]>;
459
+ /** Read the complete governed trigger-market policy registry. Missing
460
+ * markets are disabled; callers must never synthesize a default policy. */
461
+ queryTriggerMarketConfigs(): Promise<TriggerMarketConfigInfo[]>;
462
+ /** Read the fail-closed next-height trigger admission predicate. Heights
463
+ * are parsed from raw JSON into bigint without a lossy Number round-trip. */
464
+ queryTriggerStatus(): Promise<TriggerStatus>;
465
+ /** Immutable owner-bearing trigger lifecycle history. This always uses the
466
+ * public gateway, including when the client is configured for direct-node
467
+ * current-state reads; the node does not own indexer history. */
468
+ queryPositionTriggerHistory(addressHex?: string, filters?: PositionTriggerHistoryFilters): Promise<PositionTriggerHistoryPage>;
469
+ /** Shared market-level deferred/resumed trigger transitions. These are not
470
+ * duplicated into every owner's history and always route through gateway. */
471
+ queryTriggerMarketHistory(market: number, filters?: TriggerMarketHistoryFilters): Promise<TriggerMarketHistoryPage>;
472
+ /**
473
+ * Read the current on-chain admin signer registry via the gateway proxy
474
+ * (`GET /v1/admin/signer-registry`). The engine wraps the
475
+ * registry in an `Option`, so the proxy returns MessagePack `[registry|nil]`.
476
+ *
477
+ * Returns `null` when no registry is seeded — which means admin multisig is
478
+ * **inactive** (fail-closed), NOT an empty roster; callers must treat the two
479
+ * differently.
480
+ */
481
+ queryAdminSignerRegistry(): Promise<AdminSignerRegistry | null>;
482
+ /**
483
+ * List admin governance proposals via the gateway proxy
484
+ * (`GET /v1/proposals`). Optional `status` / `cursor` /
485
+ * `limit` are forwarded as query params (the node clamps oversized limits).
486
+ * The proxy returns MessagePack `[proposals, nextCursor|nil]`.
487
+ *
488
+ * Each proposal is decoded into a `ProposalDisplayInfo` — including the
489
+ * canonical action bytes and content hash an approving signer needs to
490
+ * rebuild their approval locally. Decoding fails closed: a proposal
491
+ * carrying an operation or status this SDK build does not know throws
492
+ * rather than being returned partially rendered.
493
+ */
494
+ queryProposals(opts?: {
495
+ status?: string;
496
+ cursor?: bigint;
497
+ limit?: number;
498
+ }): Promise<ProposalPage>;
499
+ /** Fetch open orders for an address. Returns an empty array if the
500
+ * account has no open orders.
501
+ * Each order is a 6-tuple `[id, market, owner, side, price, quantity]`
502
+ * decoded from MessagePack. */
503
+ queryOpenOrders(addressHex?: string): Promise<OpenOrder[]>;
504
+ /** Fetch a withdrawal record by id. Returns `null` for unknown ids
505
+ * (the engine encodes "not found" as msgpack `nil`, not HTTP 404). */
506
+ queryWithdrawal(id: bigint): Promise<WithdrawalRecord | null>;
507
+ queryAccount(addressHex?: string): Promise<AccountInfo | null>;
508
+ /** Convenience: fetch just the USDC balance (microUSDC) for an address. */
509
+ queryBalance(addressHex?: string): Promise<bigint | null>;
510
+ /** Convenience: fetch just the equity (microUSDC) for an address. */
511
+ queryEquity(addressHex?: string): Promise<bigint | null>;
512
+ queryHealth(): Promise<{
513
+ status: string;
514
+ height: number;
515
+ }>;
516
+ /** Fetch the auto-deleveraging queue for a market — profitable positions
517
+ * ranked by `adlScore` desc (highest first). Empty array if the market has
518
+ * no profitable positions. Routes through the gateway's `/v1/adl/queue`. */
519
+ queryAdlQueue(market: number): Promise<AdlQueueEntry[]>;
520
+ /** One-round-trip market summary (last / 24h volume / 24h change + funding
521
+ * and top-of-book blobs). Returns `null` if the market is unknown. Routes
522
+ * through the gateway's `/v1/ticker`. */
523
+ queryTicker(market: number): Promise<Ticker | null>;
524
+ /** Per-user deposit log — every `deposit_confirmed` event for this
525
+ * owner, newest first. Feeds Portfolio EquityChart equity-over-time
526
+ * reconstruction (P2 #6). */
527
+ queryHistoryDeposits(addressHex?: string, opts?: {
528
+ fromMs?: number;
529
+ toMs?: number;
530
+ limit?: number;
531
+ }): Promise<HistoryCashFlow[]>;
532
+ /** Per-user withdrawal lifecycle log — withdraw_requested /
533
+ * withdrawal_confirmed / withdrawal_failed, newest first. Filter by
534
+ * `kind` client-side if you want only pending requests. P2 #6. */
535
+ queryHistoryWithdrawals(addressHex?: string, opts?: {
536
+ fromMs?: number;
537
+ toMs?: number;
538
+ limit?: number;
539
+ }): Promise<HistoryCashFlow[]>;
540
+ /** Internal: shared decoder for the two cash-flow endpoints. They
541
+ * return identical row shapes (HistoryCashFlow); the difference is
542
+ * which kinds the server includes. */
543
+ private queryHistoryCashFlow;
544
+ /** Per-user position-at-resolution log — each row is one settlement or
545
+ * voided-conditional snapshot. Feeds the Portfolio "Resolved" tab
546
+ * (P2 #7). Optional `impactMarketId` filter scopes to one event family.
547
+ *
548
+ * `fromMs` / `toMs` are unix-ms timestamps; omit for unbounded.
549
+ * `limit` caps at 1000 server-side. Results are newest-first. */
550
+ queryHistoryResolutions(addressHex?: string, opts?: {
551
+ impactMarketId?: number;
552
+ fromMs?: number;
553
+ toMs?: number;
554
+ limit?: number;
555
+ }): Promise<HistoryResolution[]>;
556
+ /** Per-user position-history snapshot log. Each row is one
557
+ * point-in-time snapshot persisted after a fill that changes the
558
+ * position. A `size === "0"` row is a CLOSE event; the immediately
559
+ * preceding non-zero snapshot for the same `(owner, market, side)`
560
+ * carries the entry price. Feeds the trading-UI Position History tab
561
+ * (FE-23). Optional `market` filter scopes to one book; `fromMs` /
562
+ * `toMs` window the timestamps; `limit` caps server-side at 5000. */
563
+ queryHistoryPositions(addressHex?: string, opts?: {
564
+ market?: number;
565
+ fromMs?: number;
566
+ toMs?: number;
567
+ limit?: number;
568
+ }): Promise<HistoryPositionSnapshot[]>;
569
+ /**
570
+ * Executed fills for an owner, newest first, keyset-paged. The endpoint
571
+ * returns an envelope rather than a bare array: pass `opts.cursor` from a
572
+ * previous page's `nextCursor` to continue; an empty `nextCursor` is the
573
+ * last page. `fromMs` is inclusive, `toMs` exclusive (the API's uniform
574
+ * half-open window), both epoch milliseconds. Omitting `addressHex` with
575
+ * no bound key yields an empty page, matching the other history queries.
576
+ */
577
+ queryHistoryFills(addressHex?: string, opts?: {
578
+ market?: number;
579
+ fromMs?: number;
580
+ toMs?: number;
581
+ limit?: number;
582
+ cursor?: string;
583
+ }): Promise<HistoryFillsPage>;
584
+ status(): Promise<{
585
+ latestHeight: number;
586
+ latestAppHash: string;
587
+ }>;
588
+ getBlock(height?: number): Promise<Record<string, unknown>>;
589
+ getBlockResults(height: number): Promise<Record<string, unknown>>;
590
+ /**
591
+ * Subscribe to the account-events stream (`/account-events`). Mirrors the
592
+ * Python SDK's `AccountEventStream`: the gateway sends an initial snapshot
593
+ * frame followed by incremental event frames. The SDK tracks the highest
594
+ * `event_id` seen and replays from it via `after_id` on reconnect, so no
595
+ * events are dropped across a disconnect.
596
+ *
597
+ * Auth: account streams require auth only when the gateway runs with
598
+ * `--api-key`. A browser `WebSocket` cannot send the `X-Api-Key` header, so
599
+ * the SDK uses the gateway's signed-query auth instead — when a private key
600
+ * is loaded (`setPrivateKey`) it signs the `ProofExchange-account-events-v1`
601
+ * message and appends `public_key` / `signature` / `timestamp_ms`. Against
602
+ * an unauthenticated gateway (e.g. devnet) the owner alone is enough.
603
+ *
604
+ * Returns an unsubscribe function; `disconnect()` closes all streams.
605
+ */
606
+ subscribeAccountEvents(owner: Uint8Array | string, onEvent: (event: Record<string, unknown>) => void, opts?: WsStreamOptions): () => void;
607
+ /**
608
+ * Subscribe to the L2 orderbook delta stream for a market
609
+ * (`/orderbook-deltas`). Mirrors the Python SDK's `OrderbookDeltaStream`:
610
+ * the first frame is a full `l2Book` snapshot, then incremental deltas.
611
+ * Returns an unsubscribe function.
612
+ */
613
+ subscribeOrderbookDeltas(market: number, onMessage: (msg: Record<string, unknown>) => void, opts?: WsStreamOptions): () => void;
614
+ /**
615
+ * One-shot L2 orderbook snapshot via a temporary delta-stream connection:
616
+ * opens the stream, resolves the first `l2Book` snapshot frame, and closes.
617
+ * Mirrors the Python SDK's `orderbook_snapshot`.
618
+ */
619
+ orderbookSnapshot(market: number): Promise<Record<string, unknown>>;
620
+ /**
621
+ * Internal: open one self-reconnecting WebSocket. `buildUrl` is re-invoked
622
+ * on every (re)connect so per-connect state (fresh auth timestamp, current
623
+ * `after_id`) is rebuilt each time. Reconnects with exponential backoff and
624
+ * jitter. Returns an unsubscribe that stops reconnecting and closes the
625
+ * socket.
626
+ */
627
+ private openStream;
628
+ /** Close every open WebSocket stream and stop their reconnect loops. */
629
+ disconnect(): void;
630
+ }
631
+ /** Options common to the WebSocket stream subscriptions. */
632
+ export interface WsStreamOptions {
633
+ /** Called on connect/parse errors. The stream keeps reconnecting; use
634
+ * this for logging or to surface terminal failures. */
635
+ onError?: (err: unknown) => void;
636
+ /** Max reconnect backoff in milliseconds (default 30000). Backoff starts
637
+ * at 500ms and doubles with ±25% jitter up to this cap. */
638
+ reconnectBackoffMaxMs?: number;
639
+ }
640
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,MAAM,EAEN,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,EAGX,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EAGZ,SAAS,EACT,aAAa,EAC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