@stryke-xyz/premarket-sdk 1.0.6 → 1.0.7

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
@@ -4,22 +4,250 @@ TypeScript SDK for Stryke premarket integrations across:
4
4
 
5
5
  - `option-markets` contracts (`Exchange`, `MarketsRegistry`, `OptionMarketVault`)
6
6
  - `smart-account` contracts (`SimpleAccountFactory`, `EntryPoint`)
7
- - `premarkets-api` HTTP/WebSocket services
7
+ - `premarkets-api` HTTP and WebSocket services
8
8
  - `premarkets-interface` frontend runtime
9
9
 
10
+ This package is the shared integration layer between onchain contracts and the
11
+ application stack. It gives product teams one place to build orders, hash and
12
+ sign typed data, encode contract calls, read market and user data, subscribe to
13
+ live updates, and consume deployment constants.
14
+
10
15
  ## What This Package Provides
11
16
 
12
- - native `Exchange` order builders, hashing, typed-data signing helpers
13
- - contract transaction builders for exchange, vault, and registry flows
14
- - orderbook/premarket API client (`OrderbookApi`)
15
- - realtime sync clients for depth/activity streams
16
- - chain/address constants used by backend and frontend repos
17
+ - native `Exchange` order builders, hashing, typed-data signing helpers, and
18
+ calldata builders
19
+ - `OptionMarketVault` token-id helpers, collateral math, and transaction
20
+ builders
21
+ - `MarketsRegistry` market serialization and contract calldata builders
22
+ - `OrderHelper` and `OrderbookApi` for backend and frontend integrations
23
+ - realtime sync clients for market depth and activity streams
24
+ - chain definitions, token metadata, and deployed contract addresses
25
+ - smart-account address derivation and deployment checks
26
+ - shared DTOs used by HTTP clients and frontend consumers
27
+
28
+ ## Documentation Map
29
+
30
+ The new documentation set lives alongside the legacy docs during migration.
31
+ Start here, then drill into the module guide that matches the surface you are
32
+ integrating.
33
+
34
+ ### Module guides
35
+
36
+ - [Exchange guide](./src/exchange/README.md)
37
+ - [Vault guide](./src/vault/README.md)
38
+ - [Registry guide](./src/registry/README.md)
39
+ - [API guide](./src/api/README.md)
40
+ - [Sync guide](./src/sync/README.md)
41
+ - [Config guide](./src/config/README.md)
42
+ - [Shared types guide](./src/shared/README.md)
43
+ - [Utilities guide](./src/utils/README.md)
44
+
45
+ ### Root-level exports
46
+
47
+ The package root also exports a handful of single-file helpers that do not live
48
+ under one directory package:
49
+
50
+ - `smart-account`
51
+ - Source: [`src/smart-account.ts`](./src/smart-account.ts)
52
+ - Public surfaces: `SmartAccountHelper`, `getCurrentSalt`,
53
+ `getSmartAccountAddress`, `getAccountCount`,
54
+ `isSmartAccountDeployed`, `getCurrentSmartAccount`,
55
+ `SmartAccountConfig`, `SmartAccountResult`
56
+ - `address`
57
+ - Source: [`src/address.ts`](./src/address.ts)
58
+ - Public surface: `Address`
59
+ - `bps`
60
+ - Source: [`src/bps.ts`](./src/bps.ts)
61
+ - Public surface: `Bps`
62
+ - compatibility and address helpers
63
+ - Source: [`src/constants.ts`](./src/constants.ts)
64
+ - Public surfaces: `ZX`, `getExchangeContract`,
65
+ `getLimitOrderContract`, `getMarketsRegistryContract`,
66
+ `getNativeOrderFactoryContract`, `getNativeOrderImplContract`
67
+ - generic utilities
68
+ - Source: [`src/utils/mul-div.ts`](./src/utils/mul-div.ts),
69
+ [`src/utils/rand-bigint.ts`](./src/utils/rand-bigint.ts),
70
+ [`src/utils/orderUtils.ts`](./src/utils/orderUtils.ts)
71
+ - Public surfaces: `mulDiv`, `Rounding`, `randBigInt`,
72
+ `optionPrmToPrmTokenId`, `prmToOptionPrmTokenId`,
73
+ `isComplementaryOptionTokenPair`, `verifyOrderSignature`
74
+
75
+ ## Quick Start
76
+
77
+ The SDK is designed so an integrator can stay inside the package root for most
78
+ common workflows.
79
+
80
+ ```ts
81
+ import {
82
+ EXCHANGE,
83
+ OrderHelper,
84
+ OrderbookApi,
85
+ SignatureType,
86
+ TradeType,
87
+ } from "@stryke-xyz/premarket-sdk";
88
+
89
+ const chainId = 4326;
90
+
91
+ const helper = new OrderHelper({
92
+ chainId,
93
+ exchangeAddress: EXCHANGE[chainId],
94
+ });
95
+
96
+ const order = helper.buildOrder({
97
+ maker: "0x1111111111111111111111111111111111111111",
98
+ receiver: "0x1111111111111111111111111111111111111111",
99
+ nonce: 0n,
100
+ marketId: 1n,
101
+ makingAmount: 1_000_000n,
102
+ takingAmount: 500_000n,
103
+ deadline: 1_900_000_000n,
104
+ tradeType: TradeType.SELL,
105
+ signatureType: SignatureType.EIP712,
106
+ tokenId: 42n,
107
+ });
108
+
109
+ const payload = helper.serializeOrder(order);
17
110
 
18
- ## Docs
111
+ const api = new OrderbookApi({ baseUrl: "https://example.stryke.xyz" });
112
+ await api.queryOrders({ marketId: payload.marketId });
113
+ ```
114
+
115
+ For the exact order model, fill semantics, fee math, and typed-data schema, use
116
+ the [Exchange guide](./src/exchange/README.md). For API payloads and response
117
+ DTOs, use the [API guide](./src/api/README.md) and
118
+ [Shared types guide](./src/shared/README.md).
119
+
120
+ ## Smart-Account Helpers
121
+
122
+ The package root exports the smart-account helpers from
123
+ [`src/smart-account.ts`](./src/smart-account.ts). These helpers are for
124
+ deterministic account derivation and deployment checks that match the
125
+ `SimpleAccountFactory`-style contract surface used by the wider Stryke stack.
126
+
127
+ Public types:
128
+
129
+ - `SmartAccountConfig`
130
+ - `SmartAccountResult`
131
+
132
+ Public functions:
133
+
134
+ - `getCurrentSalt(accountCount)`
135
+ - `getSmartAccountAddress(client, factoryAddress, owner, depositor, salt)`
136
+ - `getAccountCount(client, factoryAddress, owner)`
137
+ - `isSmartAccountDeployed(client, address)`
138
+ - `getCurrentSmartAccount(client, factoryAddress, owner, depositor)`
139
+
140
+ Public class:
141
+
142
+ - `SmartAccountHelper`
143
+ - `factoryAddress`
144
+ - `getAddress(client, owner, depositor, salt)`
145
+ - `getAccountCount(client, owner)`
146
+ - `getCurrent(client, owner, depositor)`
147
+ - `isDeployed(client, address)`
148
+
149
+ ```ts
150
+ import {
151
+ SIMPLE_ACCOUNT_FACTORY,
152
+ SmartAccountHelper,
153
+ } from "@stryke-xyz/premarket-sdk";
154
+
155
+ const helper = new SmartAccountHelper({
156
+ factoryAddress: SIMPLE_ACCOUNT_FACTORY[4326],
157
+ });
158
+
159
+ const account = await helper.getCurrent(client, owner, depositor);
160
+ ```
19
161
 
20
- - Cross-repo guide: `docs/CROSS_REPO_INTEGRATION.md`
21
- - Orderbook integration quick reference: `docs/orderbook-integration.md`
22
- - SDK API reference: `docs/API_REFERENCE.md`
162
+ These helpers are intentionally small. They do not execute user operations or
163
+ act as a full account-abstraction SDK. Their job is to keep address derivation
164
+ and deployment checks aligned with the factory contract.
165
+
166
+ ## Address And Bps Helpers
167
+
168
+ Two utility classes are exported from the package root for common app-side
169
+ operations.
170
+
171
+ ### `Address`
172
+
173
+ Source: [`src/address.ts`](./src/address.ts)
174
+
175
+ Public surfaces:
176
+
177
+ - `Address.NATIVE_CURRENCY`
178
+ - `Address.zeroAddress`
179
+ - `Address.fromBigInt(val)`
180
+ - `Address.fromFirstBytes(bytes)`
181
+ - `toString()`
182
+ - `equal(other)`
183
+ - `isNative()`
184
+ - `isZero()`
185
+ - `lastHalf()`
186
+
187
+ This helper wraps address normalization and a few convenience checks that are
188
+ useful in UI and backend code.
189
+
190
+ ### `Bps`
191
+
192
+ Source: [`src/bps.ts`](./src/bps.ts)
193
+
194
+ Public surfaces:
195
+
196
+ - `Bps.ZERO`
197
+ - `Bps.fromPercent(val, base?)`
198
+ - `Bps.fromFraction(val, base?)`
199
+ - `equal(other)`
200
+ - `isZero()`
201
+ - `toPercent(base?)`
202
+ - `toFraction(base?)`
203
+ - `toString()`
204
+
205
+ `Bps` is a small helper around basis-point values in the inclusive range
206
+ `[0, 10000]`.
207
+
208
+ ## Compatibility Constants And Utilities
209
+
210
+ ### Constants helpers
211
+
212
+ Source: [`src/constants.ts`](./src/constants.ts)
213
+
214
+ Public surfaces:
215
+
216
+ - `ZX`
217
+ - `getExchangeContract(chainId)`
218
+ - `getLimitOrderContract(chainId)`
219
+ - `getMarketsRegistryContract(chainId)`
220
+ - `getNativeOrderFactoryContract(chainId)`
221
+ - `getNativeOrderImplContract(chainId)`
222
+
223
+ The exchange and registry accessors are still useful. The native order factory
224
+ and impl helpers are compatibility-oriented and should be treated as legacy
225
+ bridge helpers rather than the center of new integrations.
226
+
227
+ ### Utility functions
228
+
229
+ For the detailed utility reference, use the
230
+ [Utilities guide](./src/utils/README.md). The public root-level utility exports
231
+ are:
232
+
233
+ - `mulDiv`
234
+ - `Rounding`
235
+ - `randBigInt`
236
+ - `optionPrmToPrmTokenId`
237
+ - `prmToOptionPrmTokenId`
238
+ - `isComplementaryOptionTokenPair`
239
+ - `verifyOrderSignature`
240
+
241
+ ## Documentation Principles
242
+
243
+ The new docs aim to serve both technical readers and product-adjacent readers:
244
+
245
+ - each module guide starts with purpose and system role
246
+ - every guide links directly to source files that implement the behavior
247
+ - public exports are documented in terms of both intent and exact runtime shape
248
+ - examples stay realistic and contract-aligned
249
+ - restricted or sensitive surfaces are acknowledged, but the docs avoid becoming
250
+ an admin or auth operations manual
23
251
 
24
252
  ## Install
25
253
 
@@ -37,9 +265,25 @@ bun test src
37
265
 
38
266
  ## Source Layout
39
267
 
40
- - `src/exchange`: native order model, typed-data, exchange tx helpers
41
- - `src/vault`: token-id helpers, collateral math, vault tx helpers
42
- - `src/registry`: markets registry contract wrapper/types
43
- - `src/api`: `OrderbookApi` and order helper
44
- - `src/sync`: websocket sync clients
45
- - `src/config`: chains, addresses, token constants
268
+ - [`src/exchange`](./src/exchange): native order model, typed-data, math, and
269
+ exchange calldata builders
270
+ - [`src/vault`](./src/vault): token-id helpers, collateral math, and vault
271
+ transaction builders
272
+ - [`src/registry`](./src/registry): market serialization and registry calldata
273
+ builders
274
+ - [`src/api`](./src/api): `OrderHelper`, `OrderbookApi`, and deserializers
275
+ - [`src/sync`](./src/sync): realtime market depth and activity clients
276
+ - [`src/config`](./src/config): chains, addresses, and token constants
277
+ - [`src/shared`](./src/shared): transport DTOs used across SDK, API, and UI
278
+
279
+ ## Legacy Docs
280
+
281
+ The current docs remain available during the transition:
282
+
283
+ - [Cross-repo guide](./docs/CROSS_REPO_INTEGRATION.md)
284
+ - [Orderbook integration quick reference](./docs/orderbook-integration.md)
285
+ - [SDK API reference](./docs/API_REFERENCE.md)
286
+ - [Refactor notes and protocol specs](./docs/refactor-docs)
287
+
288
+ Once the new documentation set is fully adopted, these older guides can be
289
+ trimmed or removed with less migration risk.
@@ -98,6 +98,16 @@
98
98
  "name": "nonRollable",
99
99
  "type": "bool",
100
100
  "internalType": "bool"
101
+ },
102
+ {
103
+ "name": "isSpread",
104
+ "type": "bool",
105
+ "internalType": "bool"
106
+ },
107
+ {
108
+ "name": "useAbsoluteSpreadCollateral",
109
+ "type": "bool",
110
+ "internalType": "bool"
101
111
  }
102
112
  ]
103
113
  }
@@ -319,6 +329,16 @@
319
329
  "name": "nonRollable",
320
330
  "type": "bool",
321
331
  "internalType": "bool"
332
+ },
333
+ {
334
+ "name": "isSpread",
335
+ "type": "bool",
336
+ "internalType": "bool"
337
+ },
338
+ {
339
+ "name": "useAbsoluteSpreadCollateral",
340
+ "type": "bool",
341
+ "internalType": "bool"
322
342
  }
323
343
  ]
324
344
  }
@@ -772,6 +792,16 @@
772
792
  "name": "nonRollable",
773
793
  "type": "bool",
774
794
  "internalType": "bool"
795
+ },
796
+ {
797
+ "name": "isSpread",
798
+ "type": "bool",
799
+ "internalType": "bool"
800
+ },
801
+ {
802
+ "name": "useAbsoluteSpreadCollateral",
803
+ "type": "bool",
804
+ "internalType": "bool"
775
805
  }
776
806
  ]
777
807
  },
@@ -0,0 +1,296 @@
1
+ # API Guide
2
+
3
+ The `api` module gives the SDK two high-level integration surfaces:
4
+
5
+ - `OrderHelper`
6
+ - a workflow helper for building, hashing, serializing, signing, and
7
+ recovering orders
8
+ - `OrderbookApi`
9
+ - the HTTP client for orderbook, market, user, history, and analytics reads
10
+
11
+ This is the module most frontend and backend product teams use directly.
12
+
13
+ ## Source map
14
+
15
+ - [`index.ts`](./index.ts) re-exports the public API surface
16
+ - [`order-helper.ts`](./order-helper.ts) wraps exchange helpers into an
17
+ integration-friendly class
18
+ - [`orderbook-api/index.ts`](./orderbook-api/index.ts) implements the HTTP
19
+ client
20
+ - [`orderbook-api/deserializers.ts`](./orderbook-api/deserializers.ts) converts
21
+ string-heavy responses into bigint-friendly client-side objects
22
+ - [`../shared/types.ts`](../shared/types.ts) defines the request and response
23
+ DTOs consumed by `OrderbookApi`
24
+
25
+ ## OrderHelper
26
+
27
+ `OrderHelper` exists so most consumers do not need to manually stitch together
28
+ `buildExchangeOrder`, `getExchangeTypedData`, `hashExchangeOrder`, and the
29
+ serialization helpers.
30
+
31
+ ```ts
32
+ import {
33
+ OrderHelper,
34
+ SignatureType,
35
+ TradeType,
36
+ } from "@stryke-xyz/premarket-sdk";
37
+
38
+ const helper = new OrderHelper({
39
+ chainId: 4326,
40
+ exchangeAddress: "0xCf24f40D2dd88084e9C28FE34Ba9E24AFDACb7C2",
41
+ });
42
+
43
+ const order = helper.buildOrder({
44
+ maker: "0x1111111111111111111111111111111111111111",
45
+ receiver: "0x1111111111111111111111111111111111111111",
46
+ nonce: 0n,
47
+ marketId: 1n,
48
+ makingAmount: 1_000_000n,
49
+ takingAmount: 500_000n,
50
+ deadline: 1_900_000_000n,
51
+ tradeType: TradeType.SELL,
52
+ signatureType: SignatureType.EIP712,
53
+ tokenId: 42n,
54
+ });
55
+ ```
56
+
57
+ ### Constructor config
58
+
59
+ `OrderHelperConfig`:
60
+
61
+ - `chainId`
62
+ - used for hashing and typed-data generation
63
+ - `exchangeAddress`
64
+ - the verifying contract used in EIP-712 signatures
65
+
66
+ ### Public methods
67
+
68
+ - `buildOrder(params)`
69
+ - generic normalized order builder
70
+ - `buildSellOrder(params)`
71
+ - convenience helper that pins `tradeType = SELL`
72
+ - `buildBuyOrder(params)`
73
+ - convenience helper that pins `tradeType = BUY`
74
+ - `serializeOrder(order)`
75
+ - converts `ExchangeOrder` into `SerializedExchangeOrder`
76
+ - `hashOrder(order)`
77
+ - EIP-712 digest for the configured chain and exchange address
78
+ - `getTypedData(order)`
79
+ - typed-data payload suitable for a wallet signer
80
+ - `signEip712Order(order, walletClient)`
81
+ - only valid for `SignatureType.EIP712`
82
+ - `signSimpleAccountOrder(order, ownerWalletClient)`
83
+ - only valid for `SignatureType.ERC1271`
84
+ - intended for `SimpleAccount`-compatible flows where the maker contract
85
+ validates a raw owner signature against the native order hash
86
+ - `signOrder(order, walletClient)`
87
+ - compatibility alias for `signEip712Order`
88
+ - `recoverOrderSigner(order, signature)`
89
+ - recovers the address that signed the order payload
90
+
91
+ ```ts
92
+ const signature = await helper.signEip712Order(order, walletClient);
93
+ const payloadOrder = helper.serializeOrder(order);
94
+ const signer = await helper.recoverOrderSigner(order, signature);
95
+ ```
96
+
97
+ ## OrderbookApi
98
+
99
+ `OrderbookApi` is a fetch-based client that understands the backend's envelope
100
+ format, normalizes URLs, surfaces clearer errors, and exposes typed return
101
+ values for the main public read and write flows.
102
+
103
+ ```ts
104
+ import { OrderbookApi } from "@stryke-xyz/premarket-sdk";
105
+
106
+ const api = new OrderbookApi({
107
+ baseUrl: "https://example.stryke.xyz",
108
+ });
109
+ ```
110
+
111
+ ### Constructor config
112
+
113
+ `OrderbookApiConfig` from [`../shared/types.ts`](../shared/types.ts):
114
+
115
+ - `baseUrl`
116
+ - root URL for the backend
117
+ - `fetchFn?`
118
+ - optional injected `fetch` implementation for tests or custom runtimes
119
+
120
+ ## Order endpoints
121
+
122
+ Public order methods:
123
+
124
+ - `createOrder(params, bearerToken)`
125
+ - creates a new order with bearer auth
126
+ - `getOrder(orderHash)`
127
+ - returns `StoredOrder | null`
128
+ - `queryOrders(params)`
129
+ - list endpoint for orderbook snapshots
130
+ - `getUserOrders(maker, marketId)`
131
+ - market-scoped user order lookup
132
+ - `getDepthSnapshot(marketId, tokenId)`
133
+ - point-in-time depth snapshot for a market and token pair
134
+
135
+ ```ts
136
+ const api = new OrderbookApi({ baseUrl: "https://example.stryke.xyz" });
137
+
138
+ await api.createOrder(
139
+ {
140
+ marketId: payloadOrder.marketId,
141
+ order: payloadOrder,
142
+ signature,
143
+ timeInForce: "GTC",
144
+ postOnly: false,
145
+ },
146
+ bearerToken,
147
+ );
148
+
149
+ const snapshot = await api.queryOrders({ marketId: "1", limit: 50 });
150
+ const mine = await api.getUserOrders(
151
+ "0x1111111111111111111111111111111111111111",
152
+ "1",
153
+ );
154
+ ```
155
+
156
+ Important integration note:
157
+
158
+ - `getUserOrders` enforces `marketId` at runtime
159
+ - `queryOrders` accepts an optional `marketId` in its TypeScript type, but the
160
+ documented backend contract expects callers to provide one for reliable
161
+ integration behavior
162
+
163
+ ## Market endpoints
164
+
165
+ Public market methods:
166
+
167
+ - `getMarkets()`
168
+ - returns `MarketsResponse["data"]`
169
+ - `getMarketRecentTrades(marketId, limit?)`
170
+ - returns `MarketTradeItem[]`
171
+ - `getMarket(marketId)`
172
+ - returns `MarketResponse["data"] | null`
173
+
174
+ ```ts
175
+ const markets = await api.getMarkets();
176
+ const market = await api.getMarket("12");
177
+ const trades = await api.getMarketRecentTrades("12", 25);
178
+ ```
179
+
180
+ ## User positions and PnL
181
+
182
+ Public user analytics methods:
183
+
184
+ - `getUserPositions(userAddress)`
185
+ - `getUserTradingPnL(userAddress)`
186
+ - `getUserPnL(userAddress)`
187
+ - `getTokenPnL(userAddress, tokenId)`
188
+ - `getErc20PnL(userAddress, tokenAddress)`
189
+
190
+ These methods return the shared transport DTOs documented in the
191
+ [Shared types guide](../shared/README.md).
192
+
193
+ ```ts
194
+ const positions = await api.getUserPositions(userAddress);
195
+ const trading = await api.getUserTradingPnL(userAddress);
196
+ const summary = await api.getUserPnL(userAddress);
197
+ ```
198
+
199
+ ## Histories
200
+
201
+ Public history methods:
202
+
203
+ - `getUserHistories(userAddress, limit?)`
204
+ - `getMintHistory(userAddress, limit?)`
205
+ - `getRedeemHistory(userAddress, limit?)`
206
+ - `getUnwindHistory(userAddress, limit?)`
207
+ - `getTransferHistory(userAddress, limit?)`
208
+ - `getFillHistory(userAddress, limit?)`
209
+
210
+ These methods are useful when a frontend needs user-facing activity feeds, or
211
+ when a backend wants typed access to grouped historical data without hand-rolled
212
+ endpoint wrappers.
213
+
214
+ ## Deserializers
215
+
216
+ The API returns string-heavy DTOs because JSON cannot safely transport `bigint`
217
+ values. [`orderbook-api/deserializers.ts`](./orderbook-api/deserializers.ts)
218
+ provides opt-in conversion helpers for clients that prefer `bigint` values.
219
+
220
+ Public helpers:
221
+
222
+ - `marketInstrumentToBigInt`
223
+ - `marketToBigInt`
224
+ - `marketsToBigInt`
225
+ - `positionToBigInt`
226
+ - `tradingPnLToBigInt`
227
+ - `mintHistoryToBigInt`
228
+ - `redeemHistoryToBigInt`
229
+ - `unwindHistoryToBigInt`
230
+ - `transferHistoryToBigInt`
231
+ - `fillHistoryToBigInt`
232
+
233
+ ```ts
234
+ import {
235
+ marketsToBigInt,
236
+ OrderbookApi,
237
+ } from "@stryke-xyz/premarket-sdk";
238
+
239
+ const api = new OrderbookApi({ baseUrl: "https://example.stryke.xyz" });
240
+ const marketData = await api.getMarkets();
241
+ const bigintMarketData = marketsToBigInt(marketData);
242
+ ```
243
+
244
+ ## Public request and response types
245
+
246
+ The API client relies on the DTOs exported from [`../shared/types.ts`](../shared/types.ts).
247
+ The most important public request and response shapes are:
248
+
249
+ - order write and read types
250
+ - `CreateOrderParams`
251
+ - `CreateOrderRequest`
252
+ - `StoredOrder`
253
+ - `OrderQueryParams`
254
+ - `OrdersSnapshot`
255
+ - `QueryOrdersResponse`
256
+ - `DepthSnapshot`
257
+ - market types
258
+ - `Market`
259
+ - `MarketInstrument`
260
+ - `MarketResponse`
261
+ - `MarketsResponse`
262
+ - `MarketTradeItem`
263
+ - user and analytics types
264
+ - `UserPosition`
265
+ - `TradingPnL`
266
+ - `UserPnL`
267
+ - `TokenPnL`
268
+ - `Erc20PnL`
269
+ - `UserHistories`
270
+ - `MintHistoryItem`
271
+ - `RedeemHistoryItem`
272
+ - `UnwindHistoryItem`
273
+ - `TransferHistoryItem`
274
+ - `OrderFillHistoryItem`
275
+
276
+ Those interfaces are broken down field-by-field in the
277
+ [Shared types guide](../shared/README.md).
278
+
279
+ ## Restricted and sensitive surfaces
280
+
281
+ `OrderbookApi` also exposes auth helpers:
282
+
283
+ - `getChallenge({ address, chainId })`
284
+ - `verifyAuth({ account, nonce, signature, chainId, expiresAt })`
285
+
286
+ These methods are part of the public SDK surface, but this document does not
287
+ provide a field-by-field auth payload reference. The goal of the new docs is to
288
+ cover the general integration contract well without turning the repository docs
289
+ into an auth operations manual.
290
+
291
+ ## How to choose between exchange and api modules
292
+
293
+ - use the [Exchange guide](../exchange/README.md) when you need low-level order
294
+ math, typed-data primitives, or calldata builders
295
+ - use this module when you want the ergonomics most applications need:
296
+ `OrderHelper`, `OrderbookApi`, and optional bigint deserializers