@proof-labs/trading-sdk 7.0.0 → 7.1.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/README.md CHANGED
@@ -231,6 +231,39 @@ new policy is inactive. `Satisfied` covers only this oracle dependency, not all
231
231
  portfolio dependencies or other trading checks. It never reads provider/observer
232
232
  health; feeder freshness is a separate operational read, described below.
233
233
 
234
+ Nodes running the primary-with-fallback policy (exchange#831) serve a
235
+ fourteen-field verdict: `format: 3`, the `selected` slot (`"Primary"` or
236
+ `"Fallback"`) and a `diagnostics` bitset (`diagnosticFlags`: `OnFallback`,
237
+ `PrimaryRefusedDivergence`, `DivergenceUnchecked`, `FallbackUnusable`), which
238
+ are monitoring signals rather than faults. Older nodes serve the twelve-field
239
+ `format: 2` verdict, with `selected` null. Both formats share one `faults` bit
240
+ layout (`ORACLE_FAULT_BITS`, named in `faultReasons`); `Disagreement` and
241
+ `PairTimeMismatch` keep their bits but are no longer produced.
242
+
243
+ ### Trading No on an event's binary book
244
+
245
+ Each event has one binary book, priced in Yes (`EventInfo.ebyMarket`). Buying
246
+ No at `q` is selling Yes at `$1 − q`, so the SDK places No orders as their Yes
247
+ mirror:
248
+
249
+ ```typescript
250
+ await client.buyNo({ market: event.ebyMarket, price: 400_000n, quantity: 10n }); // Yes sell at 0.60
251
+ await client.sellNo({
252
+ market: event.ebyMarket,
253
+ price: 300_000n,
254
+ quantity: 10n,
255
+ reduceOnly: true,
256
+ }); // reduce-only Yes buy at 0.70
257
+ ```
258
+
259
+ `stopLoss`/`takeProfit` take No trigger prices and keep their role on the
260
+ mirrored Yes position (a stop at No 0.30 becomes a stop at Yes 0.70); their
261
+ `maxSlippageBps` applies to the Yes price. A No price of 0 or `$1` has no Yes
262
+ mirror and throws `BinaryPriceError` before anything is sent. `yesOrder`,
263
+ `yesLimb` and `binaryPositionView` expose the same translation, and the view
264
+ reads a short Yes position as No at `$1 − entry`. All of it is pinned against
265
+ the Rust core by `conformance/binary.ndjson`.
266
+
234
267
  ### Oracle freshness for trading UIs
235
268
 
236
269
  ```typescript
@@ -317,14 +350,17 @@ without changing the original method's behaviour. It returns
317
350
  the locally calculated hash, and only `RejectedBeforeAdmission` carries the
318
351
  typed `refusal`, so a refusal cannot disagree with its outcome. The original
319
352
  method returns `Submission`, whose `RejectedBeforeAdmission` carries
320
- `refusal: ()`. Only exact source-qualified body/status pairs qualify: authorization,
321
- rate limiting, maintenance, admission overload/verifier disconnection, and
322
- specific parse/signature refusals. Generic HTTP errors, unrecognized bodies,
323
- unknown fields or a hash-bearing 503 remain unresolved. Maintenance requires
324
- the exact error and `paused` or `cancel-only` mode; substring matching is not
325
- used. These contracts are checked against
326
- [`api-gateway@3c711c2`](https://github.com/Proof-labs/api-gateway/tree/3c711c2a3c29ca8f37d2d986fe817d21a9eeebc3)
327
- (`src/server.rs`, `src/exchange.rs`, `src/types/exchange_response.rs`). Qualify
353
+ `refusal: ()`. The gateway's `status` states where the submission ended
354
+ (`ok`, `error`, `refused`, `pending`) and the SDK reads only that: a
355
+ `refused` answer is a refusal, named by its `errorCode` (authorization, rate
356
+ limiting, maintenance, admission overload/verifier disconnection, unreadable
357
+ request). `error` text is never read, and nothing is inferred from which
358
+ fields are present. A body that states none of the four, a `refused` answer
359
+ with an `errorCode` this SDK does not know, or one that contradicts itself
360
+ (a `txHash` or `code` on a refusal) remains unresolved. Maintenance requires
361
+ the `paused` or `cancel-only` mode. These contracts are checked against
362
+ api-gateway 7.0.0 ([api-gateway#220](https://github.com/Proof-labs/api-gateway/pull/220);
363
+ `src/server.rs`, `src/exchange.rs`, `src/types/exchange_response.rs`). Qualify
328
364
  the actual deployed gateway image against that contract before using the
329
365
  evidence operationally; a loopback fixture is not deployment qualification.
330
366
 
@@ -463,13 +499,13 @@ loop at 9 s+ under load.
463
499
 
464
500
  The SDK reads that shape and stops working for it:
465
501
 
466
- | Gateway answers | `TxResult` | Does the SDK poll? |
467
- | --------------------------------------------------------------------------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
468
- | `code` + `height` | `ok` / `engine`, with `height` + `events` | **No** — the tx executed; there is nothing to wait for |
469
- | `code`, no `height` | `engine` | **No** — a CheckTx reject never enters a block, so no DeliverTx will run |
470
- | `txHash`, no `code` | `timeout` | **Yes** — the gateway broadcast it but couldn't report the outcome in time (park deadline, duplicate in flight, unreadable result). The tx may still commit, so it is reconciled by hash — **not** reported as a rejection |
471
- | Structured HTTP 200/503 refusal, a recognized reason, no admission/verdict fields | `transport` (code 1 / 503), original error reason | **No** — the gateway refused admission; an unrecognized message, unknown 5xx, or contradictory fields still reconcile by hash |
472
- | `{status:"ok"}` only | `ok`, no `height` | **Yes** — a pre-#90 gateway acks CheckTx only, so inclusion is still unknown |
502
+ | Gateway answers | `TxResult` | Does the SDK poll? |
503
+ | -------------------------------------------- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
504
+ | `status: ok` or `error`, with `height` | `ok` / `engine`, with `height` + `events` | **No** — the tx executed; there is nothing to wait for |
505
+ | `status: error`, no `height` | `engine` | **No** — a CheckTx reject, or a tx the gateway refused before broadcast with the engine's code (`17` bad signature, `1` undecodable), never enters a block, so no DeliverTx will run |
506
+ | `status: pending` | `timeout` | **Yes** — the gateway broadcast it but couldn't report the outcome in time (park deadline, duplicate in flight, unreadable result). The tx may still commit, so it is reconciled by hash — **not** reported as a rejection |
507
+ | `status: refused` | `transport` (code 1, or the HTTP status), original error reason | **No** — the gateway did not admit it and nothing was broadcast |
508
+ | Any other body: a pre-7.0.0 gateway, a proxy | as before 7.0.0: read from `code` / `height` / `txHash`; `{status:"ok"}` alone is `ok`, no `height` | **Yes** — a pre-#90 gateway acks CheckTx only, so inclusion is still unknown |
473
509
 
474
510
  That last row is why upgrading the SDK is safe against a gateway that has not been
475
511
  upgraded yet: absence of `code`/`height` still means "execution unknown", and the old
@@ -0,0 +1,46 @@
1
+ import { Side, type PlaceOrder, type TriggerLimb } from "./types.js";
2
+ /** `$1` in micro-USDC: a binary pays this on its winning outcome. */
3
+ export declare const BINARY_PRICE_MAX = 1000000n;
4
+ /** Which price could not be mirrored. Matches the Rust core's refusal names. */
5
+ export type BinaryErrorName = "OrderPriceOutOfRange" | "TriggerPriceOutOfRange" | "EntryAboveOneDollar";
6
+ /** A No price, trigger or entry with no mirror inside the book. */
7
+ export declare class BinaryPriceError extends Error {
8
+ readonly reason: BinaryErrorName;
9
+ readonly price: bigint;
10
+ constructor(reason: BinaryErrorName, price: bigint);
11
+ }
12
+ /** The Yes order side that trades `noSide` of No. */
13
+ export declare function yesSide(noSide: Side): Side;
14
+ /**
15
+ * The Yes limb equivalent to a No limb: same role and collar, mirrored
16
+ * trigger price. A stop on a long No fires as No falls to `x`, which is when
17
+ * Yes rises to `$1 − x` — the condition a stop on the mirrored short Yes
18
+ * uses. `maxSlippageBps` is carried unchanged and applies to the Yes price.
19
+ */
20
+ export declare function yesLimb(noLimb: TriggerLimb): TriggerLimb;
21
+ /**
22
+ * A limit order on an event's binary book, stated in No terms: `side` buys or
23
+ * sells No, `price` and limb trigger prices are No prices. `market` is the
24
+ * event's binary book (`EventInfo.ebyMarket`).
25
+ */
26
+ export type NoOrder = Omit<PlaceOrder, "owner">;
27
+ /** The Yes order the engine executes for a No order. */
28
+ export declare function yesOrder(no: NoOrder): Omit<PlaceOrder, "owner">;
29
+ /** A binary position read the way a trader holds it. */
30
+ export interface BinaryPositionView {
31
+ outcome: "Yes" | "No";
32
+ /** Entry price in the outcome's own terms, in micro-USDC. */
33
+ entryPrice: bigint;
34
+ size: bigint;
35
+ }
36
+ /**
37
+ * Read a position on an event's binary book: a long Yes as Yes, a short Yes
38
+ * as No at `$1 − entry`. An entry of exactly `$1` (a No-branch conditional
39
+ * close is issued there) reads as No at 0.
40
+ */
41
+ export declare function binaryPositionView(position: {
42
+ side: Side | "Buy" | "Sell";
43
+ entryPrice: bigint;
44
+ size: bigint;
45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d,GAAG,kBAAkB,CASrB"}
package/dist/binary.js ADDED
@@ -0,0 +1,84 @@
1
+ // An event's one binary book, traded and read in No terms.
2
+ //
3
+ // Each event has a single binary book priced in Yes. A long No at price `q`
4
+ // is the same position as a short Yes at `$1 − q`, so buying No at `q` is
5
+ // selling Yes at `$1 − q`, selling No at `q` is buying Yes at `$1 − q`, and a
6
+ // No stop or take-profit at `x` is the same limb on the Yes position at
7
+ // `$1 − x`. The engine has no No book; these helpers translate on the client.
8
+ // The Rust core (`binary.rs`) is the reference, pinned for every binding by
9
+ // `conformance/binary.ndjson`.
10
+ import { Side } from "./types.js";
11
+ /** `$1` in micro-USDC: a binary pays this on its winning outcome. */
12
+ export const BINARY_PRICE_MAX = 1000000n;
13
+ /** A No price, trigger or entry with no mirror inside the book. */
14
+ export class BinaryPriceError extends Error {
15
+ reason;
16
+ price;
17
+ constructor(reason, price) {
18
+ super(reason === "EntryAboveOneDollar"
19
+ ? `binary entry price ${price} is above ${BINARY_PRICE_MAX}`
20
+ : reason === "OrderPriceOutOfRange"
21
+ ? `No order price ${price} must be above 0 and below ${BINARY_PRICE_MAX} (a No price of $1 is a Yes price of 0)`
22
+ : `No trigger price ${price} must be above 0 and below ${BINARY_PRICE_MAX}`);
23
+ this.reason = reason;
24
+ this.price = price;
25
+ this.name = "BinaryPriceError";
26
+ }
27
+ }
28
+ function mirror(price, reason) {
29
+ if (price <= 0n || price >= BINARY_PRICE_MAX) {
30
+ throw new BinaryPriceError(reason, price);
31
+ }
32
+ return BINARY_PRICE_MAX - price;
33
+ }
34
+ /** `side` checked at runtime, so a JavaScript caller's mistyped side is
35
+ * refused instead of becoming the opposite trade. */
36
+ function checkedSide(side) {
37
+ if (side === Side.Buy || side === "Buy")
38
+ return Side.Buy;
39
+ if (side === Side.Sell || side === "Sell")
40
+ return Side.Sell;
41
+ throw new TypeError(`side must be Side.Buy or Side.Sell, got ${String(side)}`);
42
+ }
43
+ /** The Yes order side that trades `noSide` of No. */
44
+ export function yesSide(noSide) {
45
+ return checkedSide(noSide) === Side.Buy ? Side.Sell : Side.Buy;
46
+ }
47
+ /**
48
+ * The Yes limb equivalent to a No limb: same role and collar, mirrored
49
+ * trigger price. A stop on a long No fires as No falls to `x`, which is when
50
+ * Yes rises to `$1 − x` — the condition a stop on the mirrored short Yes
51
+ * uses. `maxSlippageBps` is carried unchanged and applies to the Yes price.
52
+ */
53
+ export function yesLimb(noLimb) {
54
+ return {
55
+ ...noLimb,
56
+ triggerPrice: mirror(noLimb.triggerPrice, "TriggerPriceOutOfRange"),
57
+ };
58
+ }
59
+ /** The Yes order the engine executes for a No order. */
60
+ export function yesOrder(no) {
61
+ return {
62
+ ...no,
63
+ side: yesSide(no.side),
64
+ price: mirror(no.price, "OrderPriceOutOfRange"),
65
+ stopLoss: no.stopLoss ? yesLimb(no.stopLoss) : no.stopLoss,
66
+ takeProfit: no.takeProfit ? yesLimb(no.takeProfit) : no.takeProfit,
67
+ };
68
+ }
69
+ /**
70
+ * Read a position on an event's binary book: a long Yes as Yes, a short Yes
71
+ * as No at `$1 − entry`. An entry of exactly `$1` (a No-branch conditional
72
+ * close is issued there) reads as No at 0.
73
+ */
74
+ export function binaryPositionView(position) {
75
+ const { side, entryPrice, size } = position;
76
+ if (entryPrice > BINARY_PRICE_MAX) {
77
+ throw new BinaryPriceError("EntryAboveOneDollar", entryPrice);
78
+ }
79
+ const long = checkedSide(side) === Side.Buy;
80
+ return long
81
+ ? { outcome: "Yes", entryPrice, size }
82
+ : { outcome: "No", entryPrice: BINARY_PRICE_MAX - entryPrice, size };
83
+ }
84
+ //# sourceMappingURL=binary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.js","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,8EAA8E;AAC9E,wEAAwE;AACxE,8EAA8E;AAC9E,4EAA4E;AAC5E,+BAA+B;AAE/B,OAAO,EAAE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,IAAI,EAAE,UAAU,EAAE,gBAAgB,GAAG,UAAU,EAAE,IAAI,EAAE,CAAC;AACzE,CAAC"}
package/dist/client.d.ts CHANGED
@@ -5,7 +5,8 @@ import { type OraclePriceHistoryOptions, type OraclePriceHistoryPage } from "./o
5
5
  import { GatewayReads, type GatewayFetch } from "./gateway-reads.js";
6
6
  import { type AccountState } from "./account-state.js";
7
7
  import { type FinancialState, type FinancialStateSelection } from "./financial-state.js";
8
- import type { Action, TxResult, PlaceOrder, MarketOrder, AccountInfo, HistoryCashFlow, HistoryFillsPage, HistoryPositionSnapshot, HistoryPositionsPage, HistoryResolution, MarketConfig, OpenOrder, AdlQueueEntry, Orderbook, Ticker, WithdrawalRecord, AdminSignerRegistry, AuthoritiesSnapshot, ProposalPage, EventInfo, SetPositionTriggers, PositionTriggerInfo, TriggerStatus, PositionTriggerHistoryFilters, PositionTriggerHistoryPage, TriggerMarketHistoryFilters, TriggerMarketHistoryPage, TriggerMarketConfigInfo, AuthorizeWithdrawal, ConfirmWithdrawalReceipt, FailWithdrawalReceipt } from "./types.js";
8
+ import type { Action, TxResult, PlaceOrder, MarketOrder, AccountInfo, HistoryCashFlow, HistoryFillsPage, HistoryPositionSnapshot, HistoryPositionsPage, HistoryResolution, MarketConfig, OpenOrder, AdlQueueEntry, Orderbook, Ticker, WithdrawalRecord, AdminSignerRegistry, AuthoritiesSnapshot, ProposalPage, EventInfo, SetPositionTriggers, PositionTriggerInfo, TriggerStatus, PositionTriggerHistoryFilters, PositionTriggerHistoryPage, TriggerMarketHistoryFilters, TriggerMarketHistoryPage, TriggerMarketConfigInfo, NodeVersion, UpgradesInfo, AuthorizeWithdrawal, ConfirmWithdrawalReceipt, FailWithdrawalReceipt } from "./types.js";
9
+ import { type NoOrder } from "./binary.js";
9
10
  import type { MarketsSnapshot } from "./types.js";
10
11
  import { type OraclePermissions } from "./oracle-permissions.js";
11
12
  /**
@@ -455,6 +456,21 @@ export declare class ExchangeClient {
455
456
  * {@link ExchangeClient.placeOrder}.
456
457
  */
457
458
  marketOrder(params: Omit<MarketOrder, "owner">): Promise<TxResult>;
459
+ /**
460
+ * Buy No on an event's binary book: places the Yes sell at `$1 − price`.
461
+ * `market` is the event's book (`EventInfo.ebyMarket`); `price` and any
462
+ * `stopLoss`/`takeProfit` trigger prices are No prices. Reduce-only,
463
+ * post-only, client order id and time in force carry over unchanged.
464
+ * Throws {@link BinaryPriceError} for a No price with no Yes mirror (0 or
465
+ * `$1`).
466
+ */
467
+ buyNo(params: Omit<NoOrder, "side">): Promise<TxResult>;
468
+ /**
469
+ * Sell No on an event's binary book: places the Yes buy at `$1 − price`.
470
+ * Selling No that an account holds is a reduce-only Yes buy: pass
471
+ * `reduceOnly: true` to close without flipping. See {@link ExchangeClient.buyNo}.
472
+ */
473
+ sellNo(params: Omit<NoOrder, "side">): Promise<TxResult>;
458
474
  /** Cancel a resting order by its engine-assigned order ID. */
459
475
  cancelOrder(orderId: bigint): Promise<TxResult>;
460
476
  /** Cancel a resting order by the owner-scoped client order ID. */
@@ -522,8 +538,9 @@ export declare class ExchangeClient {
522
538
  queryMarketsSnapshot(): Promise<MarketsSnapshot>;
523
539
  /** List all registered market configs. */
524
540
  queryMarkets(): Promise<MarketConfig[]>;
525
- /** All events: each is two prediction-binary books (EBY/EBN) under one
526
- * `EventInfo`, plus every conditional attached to it. Fail-closed like the
541
+ /** All events: each is its binary book (plus a No book on an engine that
542
+ * still has one) under one `EventInfo`, plus every conditional attached
543
+ * to it. Fail-closed like the
527
544
  * governance reads: a missing envelope or malformed row is a refusal.
528
545
  * Decoder pinned to the engine golden vector in governance-query.test.ts. */
529
546
  queryEvents(): Promise<EventInfo[]>;
@@ -575,6 +592,17 @@ export declare class ExchangeClient {
575
592
  * empty set.
576
593
  */
577
594
  queryAuthorities(): Promise<AuthoritiesSnapshot>;
595
+ /**
596
+ * Read the pending protocol-upgrade plan and the executed activation
597
+ * ledger via the gateway proxy (`GET /v1/upgrades`).
598
+ */
599
+ queryUpgrades(): Promise<UpgradesInfo>;
600
+ /**
601
+ * The answering node's binary and loaded engine release
602
+ * (`GET /v1/version`). Node-local: behind a load balancer it describes
603
+ * whichever node served the request.
604
+ */
605
+ queryNodeVersion(): Promise<NodeVersion>;
578
606
  /**
579
607
  * List admin governance proposals via the gateway proxy
580
608
  * (`GET /v1/proposals`). Optional `status` / `cursor` /
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAerE,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAC;AAqB9B,OAAO,KAAK,EACV,MAAM,EAEN,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,EAGX,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EAGZ,SAAS,EACT,aAAa,EACb,SAAS,EAET,MAAM,EAEN,gBAAgB,EAEhB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,6BAA6B,EAC7B,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,mBAA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M,IAAI;IAiCb;;;;;OAKG;IACH,wBAAwB,CACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EACjD,IAAI,GAAE,eAAoB,GACzB,MAAM,IAAI;IAQb;;;;OAIG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAoBnE;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;IAkElB;;OAEG;IACH,IAAI,CAAC,IAAI,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAAG,WAAW;IAgBzD,0EAA0E;IAC1E,gBAAgB,CACd,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,EACtC,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,KAAK,CAAA;KAAO,GAC1C,MAAM,IAAI;IAUb,kBAAkB,CAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GACvC,MAAM,IAAI;IAIb,eAAe,CACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GACnC,MAAM,IAAI;IAIb,wEAAwE;IACxE,UAAU;CAIX;AAED,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B;4DACwD;IACxD,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC;gEAC4D;IAC5D,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC"}
package/dist/client.js CHANGED
@@ -11,9 +11,11 @@ import { fetchFinancialState, } from "./financial-state.js";
11
11
  import { ready as initWasm } from "./wasm-loader.js";
12
12
  import { txEngineError, txFromEngineCode, txFromQueryResponse, txOk, txTimeout, txTransportError, } from "./tx-result.js";
13
13
  import { getPublicKey, pubkeyToOwner, ownerToHex, bytesToHex, sign, verify, signingMessage, UNBOUND_CHAIN_ID, chainIdFromString, } from "./crypto.js";
14
- import { decodeAdminSignerRegistryInfo, decodeAuthoritiesSnapshot, decodeEventInfo, decodeProposalPage, } from "./governance-query.js";
14
+ import { decodeAdminSignerRegistryInfo, decodeAuthoritiesSnapshot, decodeNodeVersion, decodeUpgradesInfo, decodeEventInfo, decodeProposalPage, } from "./governance-query.js";
15
15
  import { Decoder } from "@msgpack/msgpack";
16
16
  import { readMarketsSnapshot } from "./market-snapshot.js";
17
+ import { yesOrder } from "./binary.js";
18
+ import { Side } from "./types.js";
17
19
  import { sha256 } from "@noble/hashes/sha2.js";
18
20
  import { decodePositionTriggerInfos, decodeTriggerMarketConfigInfos, decodeTriggerStatusJson, validateCancelPositionTriggers, validateOrderTriggers, validateSetPositionTriggers, } from "./triggers.js";
19
21
  import { decodePositionTriggerHistoryPage, decodeTriggerMarketHistoryPage, positionTriggerHistorySearchParams, triggerMarketHistorySearchParams, validateTriggerHistoryMarket, } from "./trigger-history.js";
@@ -500,6 +502,43 @@ export class ExchangeClient {
500
502
  // A dropped response does not prove the signed transaction was rejected.
501
503
  return txTimeout(txHash, "gateway transport interrupted; reconcile by hash");
502
504
  }
505
+ // The gateway's `status` states where the submission ended (api-gateway
506
+ // 7.0.0); nothing is inferred from which fields are present. Any other
507
+ // body falls through to the HTTP-status handling below.
508
+ const stated = gatewayBody.json;
509
+ // An answer naming another tx's hash says nothing about this one.
510
+ const foreignHash = stated?.txHash !== undefined &&
511
+ String(stated.txHash).toUpperCase() !== txHash;
512
+ switch (stated?.status) {
513
+ case "ok":
514
+ case "error":
515
+ // An engine verdict always carries its code and arrives as a 200.
516
+ if (res.status !== 200 || typeof stated.code !== "number")
517
+ break;
518
+ // `ok` with a non-zero code, or `error` with code 0, contradicts itself.
519
+ if ((stated.status === "ok") !== (stated.code === 0) || foreignHash)
520
+ return txTimeout(txHash, "gateway verdict contradicts itself; reconcile by hash");
521
+ return txFromEngineCode(stated.code, {
522
+ hash: txHash,
523
+ height: stated.height,
524
+ log: stated.log ?? stated.error,
525
+ info: stated.info,
526
+ events: stated.events,
527
+ });
528
+ case "refused":
529
+ // A refusal naming a hash, code or height contradicts itself, so it
530
+ // proves nothing about whether the tx was broadcast.
531
+ if (stated.txHash !== undefined ||
532
+ stated.code !== undefined ||
533
+ stated.height !== undefined)
534
+ return txTimeout(txHash, "gateway refusal contradicts itself; reconcile by hash");
535
+ // Nothing was broadcast, so there is nothing to reconcile.
536
+ return txTransportError(res.status === 200 ? 1 : res.status, stated.error ?? stated.errorCode ?? "refused by gateway");
537
+ case "pending":
538
+ // Reconcile the hash of the bytes sent, never one the answer names.
539
+ return txTimeout(txHash, stated.error ??
540
+ "gateway returned no on-chain result; reconcile by hash");
541
+ }
503
542
  // Auth/rate-limit transport failures don't have a JSON body the
504
543
  // engine produced — synthesize an HTTP-status code and tag the result
505
544
  // `outcome: "transport"` so callers don't read it as an ExecError.
@@ -514,12 +553,6 @@ export class ExchangeClient {
514
553
  gatewayBody.raw ??
515
554
  "request body exceeds max size (default 8192 bytes)");
516
555
  }
517
- const refusal = preAdmissionRefusal(res.status, gatewayBody.json);
518
- // Gateway ExchangeResponse::err is hashless: a structured 503 proves
519
- // the transaction never entered the broadcaster queue.
520
- if (res.status === 503 && refusal !== undefined) {
521
- return txTransportError(503, refusal);
522
- }
523
556
  if (res.status >= 500) {
524
557
  return txTimeout(txHash, `gateway HTTP ${res.status}; reconcile by hash${gatewayBody.error || gatewayBody.raw ? `: ${gatewayBody.error ?? gatewayBody.raw}` : ""}`);
525
558
  }
@@ -575,14 +608,10 @@ export class ExchangeClient {
575
608
  // Fallback: the code embedded in the string as "<engine_code>: <message>".
576
609
  // The gateway still emits this format for compatibility, so this path also
577
610
  // covers a pre-#90 gateway that sends ONLY the string. Parse the leading code;
578
- // Hashless gateway refusals are terminal; unrecognized bodies remain unknown.
579
611
  const errMsg = json?.error ?? gatewayBody.raw ?? "unknown gateway error";
580
612
  const code = parseLeadingErrorCode(errMsg);
581
613
  if (code !== null)
582
614
  return txEngineError(code, { log: errMsg });
583
- if (res.status === 200 && refusal !== undefined) {
584
- return txTransportError(1, refusal);
585
- }
586
615
  return txTimeout(txHash, "gateway returned no verdict; reconcile by hash");
587
616
  }
588
617
  /**
@@ -807,6 +836,25 @@ export class ExchangeClient {
807
836
  data: { ...params, owner: this.requireOwner() },
808
837
  });
809
838
  }
839
+ /**
840
+ * Buy No on an event's binary book: places the Yes sell at `$1 − price`.
841
+ * `market` is the event's book (`EventInfo.ebyMarket`); `price` and any
842
+ * `stopLoss`/`takeProfit` trigger prices are No prices. Reduce-only,
843
+ * post-only, client order id and time in force carry over unchanged.
844
+ * Throws {@link BinaryPriceError} for a No price with no Yes mirror (0 or
845
+ * `$1`).
846
+ */
847
+ async buyNo(params) {
848
+ return this.placeOrder(yesOrder({ ...params, side: Side.Buy }));
849
+ }
850
+ /**
851
+ * Sell No on an event's binary book: places the Yes buy at `$1 − price`.
852
+ * Selling No that an account holds is a reduce-only Yes buy: pass
853
+ * `reduceOnly: true` to close without flipping. See {@link ExchangeClient.buyNo}.
854
+ */
855
+ async sellNo(params) {
856
+ return this.placeOrder(yesOrder({ ...params, side: Side.Sell }));
857
+ }
810
858
  /** Cancel a resting order by its engine-assigned order ID. */
811
859
  async cancelOrder(orderId) {
812
860
  return this.submitTx({
@@ -951,8 +999,9 @@ export class ExchangeClient {
951
999
  const raw = (await this.strictDecode(bytes));
952
1000
  return raw.map((m) => decodeMarketConfig(m));
953
1001
  }
954
- /** All events: each is two prediction-binary books (EBY/EBN) under one
955
- * `EventInfo`, plus every conditional attached to it. Fail-closed like the
1002
+ /** All events: each is its binary book (plus a No book on an engine that
1003
+ * still has one) under one `EventInfo`, plus every conditional attached
1004
+ * to it. Fail-closed like the
956
1005
  * governance reads: a missing envelope or malformed row is a refusal.
957
1006
  * Decoder pinned to the engine golden vector in governance-query.test.ts. */
958
1007
  async queryEvents() {
@@ -1095,6 +1144,24 @@ export class ExchangeClient {
1095
1144
  const bytes = fromBase64(requireEncodedData(json, "/v1/admin/authorities"));
1096
1145
  return decodeAuthoritiesSnapshot(await this.strictDecode(bytes));
1097
1146
  }
1147
+ /**
1148
+ * Read the pending protocol-upgrade plan and the executed activation
1149
+ * ledger via the gateway proxy (`GET /v1/upgrades`).
1150
+ */
1151
+ async queryUpgrades() {
1152
+ const json = await fetchApiJson(`${this.readBaseUrl}/v1/upgrades`);
1153
+ const bytes = fromBase64(requireEncodedData(json, "/v1/upgrades"));
1154
+ return decodeUpgradesInfo(await this.strictDecode(bytes));
1155
+ }
1156
+ /**
1157
+ * The answering node's binary and loaded engine release
1158
+ * (`GET /v1/version`). Node-local: behind a load balancer it describes
1159
+ * whichever node served the request.
1160
+ */
1161
+ async queryNodeVersion() {
1162
+ const json = await fetchApiJson(`${this.readBaseUrl}/v1/version`);
1163
+ return decodeNodeVersion(json);
1164
+ }
1098
1165
  /**
1099
1166
  * List admin governance proposals via the gateway proxy
1100
1167
  * (`GET /v1/proposals`). Optional `status` / `cursor` /
@@ -1890,57 +1957,6 @@ function deriveNodeUrl(gatewayUrl, fallbackPort) {
1890
1957
  function computeCometTxHash(txBytes) {
1891
1958
  return bytesToHex(sha256(txBytes)).toUpperCase();
1892
1959
  }
1893
- /** Only a fixed, known set of (HTTP status, message) pairs is hashless proof
1894
- * of a pre-admission refusal — mirrors
1895
- * `crates/proof-trading-sdk/src/gateway/mod.rs::pre_admission_refusal`
1896
- * exactly for the statuses reached here (200, 503). ExchangeResponse::err
1897
- * omits admission/verdict and rate-limit fields, but the shape alone is not
1898
- * enough: an unrecognized message in that same shape can come from a generic
1899
- * failure (an intermediary, a proxy) rather than the gateway's own refusal
1900
- * path, and contradictory or unknown evidence must not become a terminal
1901
- * refusal for a transaction that may have executed. */
1902
- const PRE_ADMISSION_REFUSAL_FIELDS = new Set([
1903
- "status",
1904
- "error",
1905
- "mode",
1906
- "retryAfterMs",
1907
- ]);
1908
- function preAdmissionRefusal(status, value) {
1909
- if (!value || typeof value !== "object" || Array.isArray(value))
1910
- return;
1911
- const body = value;
1912
- // Mirrors `RefusalRead`'s `#[serde(deny_unknown_fields)]`: any field
1913
- // outside this exact set — including ones this SDK doesn't know about
1914
- // yet — makes the body unrecognized, not refusal evidence.
1915
- if (body.status !== "error" ||
1916
- typeof body.error !== "string" ||
1917
- Object.keys(body).some((key) => !PRE_ADMISSION_REFUSAL_FIELDS.has(key)))
1918
- return undefined;
1919
- if (status === 503 &&
1920
- body.error === "maintenance: signed writes are not open") {
1921
- if (body.retryAfterMs !== undefined)
1922
- return undefined;
1923
- return body.mode === "paused" || body.mode === "cancel-only"
1924
- ? body.error
1925
- : undefined;
1926
- }
1927
- if (body.mode !== undefined || body.retryAfterMs !== undefined)
1928
- return undefined;
1929
- if (status === 503 &&
1930
- (body.error === "service overloaded" ||
1931
- body.error === "service unavailable"))
1932
- return body.error;
1933
- if (status === 200 &&
1934
- (body.error === "invalid request body" ||
1935
- body.error === "invalid action parameters" ||
1936
- body.error === "invalid base64 in action field" ||
1937
- body.error === "invalid signature" ||
1938
- body.error === "internal encoding error" ||
1939
- body.error ===
1940
- "action type 0x1d is proposer-only and cannot enter through the gateway"))
1941
- return body.error;
1942
- return undefined;
1943
- }
1944
1960
  async function readGatewayBody(res) {
1945
1961
  const raw = await res.text();
1946
1962
  if (!raw)