@totalis/hip4-client 0.65.2 → 0.74.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 CHANGED
@@ -3,6 +3,394 @@
3
3
  `@totalis/hip4-client` follows [semantic versioning](https://semver.org).
4
4
  The contract version the generated types come from is `sdkVersion` in `./version`.
5
5
 
6
+ ## 0.74.0
7
+
8
+ Execution admission (TT-1355) and a follower's copied Combos (TT-2486,
9
+ TT-2488). Generated from contract `203.0.0-execution-admission`. Additive:
10
+ 0.73 code runs unchanged.
11
+
12
+ ### Added
13
+
14
+ - `ErrorCode` adds `EXECUTION_BACKLOG_FULL` (503, `BACKOFF`): `acceptQuote`
15
+ is refused when the venue's on-chain queue could not send the trade before
16
+ the quote expires. Nothing was created and the maker was not asked. Retry
17
+ after `Retry-After` with a fresh quote.
18
+ - `listComboCopies` (`GET /v1/me/combo-copies`): your Combo copy journal,
19
+ newest first, optionally for one `leader`. Each row is a followed trader's
20
+ Combo opening (`ENTRY`) or cash-out (`EXIT`), its legs, and what became of
21
+ your copy: `PENDING`, `COPIED` with your copied ticket's `position_id`,
22
+ `SKIPPED` with a `reason`, or `FAILED`.
23
+
24
+ ### Changed
25
+
26
+ - `operationErrors` lists `CONTRACT_UNAVAILABLE` (503) for the trader
27
+ profile, follow, copy settings, copy journal and copy allocation
28
+ operations: a deployment with copy trading switched off answers them with
29
+ it. Reading, switching off and revoking copy agents, and reading the copy
30
+ budget, stay open.
31
+
32
+ ## 0.73.0
33
+
34
+ A follower's copied trades, what copying each trader came to, and which of
35
+ their fills copies made (TT-2486); the chain-agent registry's `SET_AGENT`
36
+ Combo copy agents and the Combo copy budget (TT-2487).
37
+ Generated from contract `201.0.0-copy-budget`. Additive.
38
+
39
+ ### Added
40
+
41
+ - `listCopyTrades` (`GET /v1/me/copy-trades`): your copy journal, newest
42
+ first, optionally for one `leader`. Each row is a followed trader's trade
43
+ and what became of your copy: `PENDING`, `COPIED`, `PARTIAL`, `SKIPPED`
44
+ with a `reason`, or `FAILED`.
45
+ - `getCopySummary` (`GET /v1/me/copy-summary`): per trader, copies filled,
46
+ skipped and failed, USDC `bought` and `sold`, copied shares still `held`,
47
+ and whether those give the P&L (`complete`).
48
+ - `listCopiedFills` (`GET /v1/me/copy-fills?tids=&from=&through=`): which
49
+ of up to 100 of your fills, by Hyperliquid trade ID, in a span of at most
50
+ 31 days, copies made, with the copied trade and its `leader`.
51
+ - `HyperevmKeeperOperationKind` (internal registry): `SET_AGENT`, a relayed
52
+ vault agent grant or revoke.
53
+ - Combo copy agents: `requestComboCopyAgent`, `grantComboCopyAgent`,
54
+ `confirmComboCopyAgent`, `revokeComboCopyAgent` and
55
+ `switchOffComboCopyAgent` (`/v1/me/copy-agents/combo*`). The key Combo
56
+ auto-copy signs with, the account's vault `AgentGrant` for it relayed to
57
+ `setAgent`, its confirmation once on chain, an on-chain revoke, and
58
+ switching it off. `getCopyAgents` adds `combo`.
59
+ - `getCopyBudget` and `setCopyAllocation` (`/v1/me/copy-budget`): the Combo
60
+ copy allocation and the budget the sweeper leaves in the vault for Combo
61
+ copying.
62
+
63
+ ## 0.72.0
64
+
65
+ Emoji reactions on market comments (TT-2399), and a named refusal for a
66
+ core copy key on another account (TT-2485).
67
+ Generated from contract `196.0.0-copy-engine`. Additive.
68
+
69
+ ### Added
70
+
71
+ - Comment reactions: `reactComment` and `unreactComment`
72
+ (`PUT` and `DELETE /v1/comments/{comment_id}/reactions/{reaction}`) give and
73
+ take back one of `fire`, `laugh`, `mind_blown`, `cry`, `rocket` and `skull`.
74
+ Every comment gains `reactions`: each reaction it has, with its `count` and
75
+ whether you gave it (`reacted`).
76
+
77
+ ### Changed
78
+
79
+ - `requestCoreCopyAgent` (`POST /v1/me/copy-agents/core`) can answer
80
+ 409 `STATE_CONFLICT` while a key is active on another account: switch it
81
+ off first, or renew for the active key's account.
82
+
83
+ ## 0.71.0
84
+
85
+ Server-held copy agents for core auto-copy (TT-2484), users, cash-outs and
86
+ open positions in partner reports (TT-2541), and public trader profiles that
87
+ start on (TT-2539).
88
+ Generated from contract `194.0.0-partner-users`. Additive, except that public
89
+ profiles now start on.
90
+
91
+ ### Added
92
+
93
+ - Partner reports (TT-2541): `report()` (`GET /v1/partner/report`) adds
94
+ `users` (wallets you admitted and the accounts they created, all time),
95
+ `open_tickets` (your users' open positions and their stake), and per day
96
+ and in total `cashouts`, `cashout_volume`, `active_traders` and
97
+ `new_accounts`. In `totals`, `active_traders` counts each account once over
98
+ the range.
99
+
100
+ - Copy agents (TT-2484): `requestCoreCopyAgent`
101
+ (`POST /v1/me/copy-agents/core`) makes the key core auto-copy signs with,
102
+ which the account approves with `approveAgent` in the named slot
103
+ `TotalisCopy`; `confirmCoreCopyAgent` (`POST .../core/confirm`) activates it
104
+ once Hyperliquid lists it; `getCopyAgents` (`GET /v1/me/copy-agents`) reads
105
+ the active key and any replacement waiting for approval; and
106
+ `switchOffCoreCopyAgent` (`DELETE /v1/me/copy-agents/core`) stops copying at
107
+ once. New schemas `CopyAgent` and `CopyAgents`.
108
+
109
+ ### Changed
110
+
111
+ - Public trader profiles start on (TT-2539). A new account's profile is public
112
+ as soon as it exists, and every existing profile that never used the switch
113
+ was turned on, so `getIdentity` (`GET /v1/me`) reports `public_profile: true` for them, including
114
+ accounts without a username. `setPublicProfile` (`PUT /v1/me/public-profile`)
115
+ still turns it off, now also before the account has a username, and turning
116
+ it on still needs one. While on, a profile links the account wallet to its
117
+ username in `GET /v1/traders/{username}` and the leaderboards.
118
+
119
+ ## 0.70.0
120
+
121
+ A named refusal for a sign-in without Google, email or X (TT-2519, TT-2537).
122
+ Generated from contract `192.0.0-sign-in-required`. Additive.
123
+
124
+ ### Added
125
+
126
+ - `bindEmbeddedWallet` refuses a new account whose Privy user has no Google,
127
+ email or X login linked, such as one signed in only with an external
128
+ wallet, with the new error code
129
+ `SIGN_IN_REQUIRED` (403) instead of `ACCESS_REQUIRED` (TT-2519). An X
130
+ login now opens an account like Google or email (TT-2537).
131
+ On `bindEmbeddedWallet`, `ACCESS_REQUIRED` now means only that no invite has
132
+ been redeemed; wallet sign-in keeps its meaning.
133
+
134
+ ## 0.69.0
135
+
136
+ Vault run-off (TT-2260), X pictures on the leaderboard (TT-2318), a gas
137
+ ceiling on sponsored work (TT-2338), no generated usernames (TT-2299),
138
+ perp marks for price charts (TT-2335), live
139
+ games on sports cards and detail (TT-2306), Combos of at most 5 legs, and
140
+ games in play on browse, live scores over the market stream and score
141
+ timelines (TT-2371), market comments (TT-2297), their moderation (TT-2410),
142
+ holder badges and the holders filter (TT-2411), up to three suggested Combos,
143
+ held chances (TT-2366), partner reports (TT-2420), market list cursors
144
+ that continue across catalog generations (TT-2425), a named refusal for an
145
+ accept beside another in flight (TT-2259), the account's X picture from the
146
+ server (TT-2443), sponsored deposits from 0.10 USDC (TT-2444), the
147
+ funded-accept wording that gives a transfer sent before `fund_by` two more
148
+ seconds to land (TT-2259), the net stake on entry RFQs (TT-2419) and the
149
+ discovery cards of suggested Combo legs (TT-2475), opt-in public
150
+ trader profiles (TT-2481) and follows with copy settings (TT-2482).
151
+ Generated from contract `191.0.0-follows`.
152
+ Breaking only for callers of the removed operation and RFQs of more than 5
153
+ legs.
154
+
155
+ ### Added
156
+
157
+ - Follows and copy settings (TT-2482): `followTrader` and `unfollowTrader`
158
+ (`PUT` and `DELETE /v1/me/follows/{username}`) follow a public trader and
159
+ set the follow's core and Combo copy settings, `listFollows`
160
+ (`GET /v1/me/follows`) lists them, and `getCopySettings` and
161
+ `setCopySettings` (`/v1/me/copy-settings`) read and set the pause and daily
162
+ caps across every follow. `getTrader` gains `followers` and `following`, and
163
+ the new error codes `FOLLOW_SELF` and `FOLLOW_LIMIT_REACHED` refuse following
164
+ oneself or more than 100 traders.
165
+ - Public trader profiles (TT-2481): `setPublicProfile`
166
+ (`PUT /v1/me/public-profile`) turns the account's profile on or off, and
167
+ `getTrader`, `listTraderTrades`, `listTraderPositions` and `getTraderPnl`
168
+ (`GET /v1/traders/{username}` and its `trades`, `positions` and `pnl`) read
169
+ an opted-in trader. `VenueIdentity` and both leaderboards' traders gain
170
+ `public_profile`, and the new error code `USERNAME_REQUIRED` refuses turning
171
+ a profile on without a username.
172
+ - `SuggestedCombo` (`GET /v1/suggested-combo`) requires `cards`: the browse
173
+ contract 4 discovery card each leg was picked from, in leg order, as read
174
+ when it was quoted, so a client can draw a leg that is not on its own page
175
+ (TT-2475).
176
+ - `EntryRfq` (`GET /v1/rfqs`, `GET /v1/rfqs/{rfq_id}`, snapshot `open_rfqs`)
177
+ and the entry `RFQ_CREATED` payload carry `net_stake`, what the vault backs
178
+ if a quote is accepted: `stake - floor(stake * taker_fee_bps / 10000)` with
179
+ the vault's current taker fee, the one every quote must carry. `stake` stays
180
+ gross and quotes still sign it. Absent while the server does not know the
181
+ taker fee (TT-2419).
182
+ - `DashboardQuotes` (`GET /v1/makers/{maker_id}/quotes`) requires `net_stake`
183
+ on each quote: its stake less its own taker fee (TT-2419).
184
+ - `VenueIdentity` (`GET /v1/me`) and comment authors carry `picture_url`, the
185
+ profile picture of the X account linked to the account's Privy login, the
186
+ same one the leaderboards show; absent when the server has none.
187
+ `POST /v1/me/picture` (`refreshPicture`) reads it from Privy now; call it
188
+ right after the user links or unlinks X.
189
+ - `ErrorCode` adds `ACCEPTANCE_IN_FLIGHT` (409, `REFRESH`), and Accept quote
190
+ lists it: an account has one entry acceptance in flight at a time, so
191
+ accepting an entry quote while another awaits its maker or its trade is
192
+ refused with it instead of `STATE_CONFLICT`. Nothing was created; accept a
193
+ fresh quote once that acceptance's operation ends.
194
+ - Wallet challenges accept the exact bundled iOS origin `capacitor://localhost`
195
+ when it is registered in the service allowlist. Existing HTTPS origins and
196
+ wallet-signature requirements are unchanged.
197
+ - Partner reports (TT-2420): `createPartnerServer(...).report({ from, to })`
198
+ (`GET /v1/partner/report`) returns your partner's fees per UTC day, your
199
+ terms and, all time, what you earned, were paid and are owed, with every
200
+ payout and its transfers. It takes your server key; omit the range for the
201
+ 30 days through today.
202
+ - `signInWithWallet({ serverKey })`: a partner signing its users in from its
203
+ own servers passes its `tpk_v1_` server key, and the sign-in is rate limited per
204
+ partner instead of per source address (TT-2424). The origin must be one the
205
+ partner owns; the wallet still signs. Server-side only.
206
+ - Vault v1.1 maker withdrawals: `controllerTransactions(...).withdraw(amount,
207
+ to)` builds `withdrawMaker`, which pays at once. `requestWithdraw`,
208
+ `executeWithdraw` and `cancelWithdraw` stay for a vault v1 maker.
209
+ - Market comments (TT-2297): `GET /v1/comments` lists a question's or
210
+ standalone outcome's top-level comments, most liked or newest first;
211
+ `GET /v1/comments/{comment_id}/replies` lists a comment's replies. A
212
+ signed-in session posts, edits, deletes, likes and unlikes with
213
+ `POST /v1/comments`, `PUT` and `DELETE /v1/comments/{comment_id}` and
214
+ `PUT` and `DELETE /v1/comments/{comment_id}/like`.
215
+ - Comment moderation (TT-2410): a comment carries `removed` when a moderator
216
+ deleted it, and a comment page carries `pinned`, the comment a moderator
217
+ pinned to lead the thread, on a thread's first page only. A muted account's
218
+ posts and edits are 403 `FORBIDDEN`.
219
+ - Comment holders (TT-2411): a comment carries `holder` when its author holds
220
+ an open Combo on its market now, null when that is not known.
221
+ `GET /v1/comments?filter=holders` lists only holders' comments.
222
+ - `GET /v1/suggested-combo` carries `combos`, up to three suggested Combos
223
+ that share no outcome. `combo`, the first of `combos` or null, is
224
+ deprecated and goes in the next release.
225
+ - `signRunOffClaim({ vaultAddress })` signs an Exit of the account's free cash
226
+ in a vault running off to the account's own wallet; send it with
227
+ `sendRunOffClaim` (`POST /v1/me/run-off-claims`) and follow its operation
228
+ with `waitForOperation`.
229
+ - Balances carry `run_off`: cash per vault running off, never part of
230
+ `amount`, with any claim still in flight as `claim`. A position carries
231
+ `vault_address` and `cashout_available`; a core exit carries
232
+ `vault_address`.
233
+ - A cash-out of a position on a vault running off returns `STATE_CONFLICT`.
234
+ - Both leaderboards' traders carry `picture_url`, the profile picture of the X
235
+ account linked to the trader's Privy login, which clients show in place of
236
+ the generated avatar.
237
+ - `ErrorCode` adds `GAS_PRICE_ABOVE_CEILING` (503, `BACKOFF`): creating a
238
+ Combo RFQ or a cash-out is refused while HyperEVM gas is above the venue's
239
+ sponsorship ceiling. Retry after `Retry-After`.
240
+ - An RFQ's `status` adds `DECLINED` and the stream adds `RFQ_DECLINED`, for
241
+ RFQs makers declined before declines were removed (TT-2431); no RFQ ends
242
+ `DECLINED` now. `watchQuotes` empties and `onRfq` drops the RFQ on it, as on
243
+ `RFQ_CANCELLED`.
244
+ - Types for `GET /v1/perp-marks`, a perp's mark price on a fixed step recorded
245
+ from Totalis's own Hyperliquid node, and for the market stream's opt-in
246
+ `publication` frame (`publication_freshness`), which proves how far a
247
+ socket is current.
248
+ - Browse and search cards carry `estimated_live_until` (TT-2306): for a
249
+ scheduled single sports contest, its start plus its league's reviewed usual
250
+ game length, so `[date_at, estimated_live_until)` is when it is in play. A
251
+ live game feed holds it open while the game runs long and closes it when
252
+ the game ends. Null otherwise; never a trading cutoff. Every default browse
253
+ page, All included, lists cards inside that window first.
254
+ - `Question` carries the same `estimated_live_until` for its markets, and
255
+ `MarketDetail` read with `contract=4` carries its matchup's: its question's,
256
+ else its game's, else its own.
257
+ - Both also carry `scoreboard`: the matchup's game as the live game feed last
258
+ read it (`status`, `period`, `clock`, `outs`, both `competitors` with
259
+ `score` in the matchup's own order, `last_play`, `refreshed_at`), or null
260
+ when the feed does not cover the game or its reading is stale. Display only,
261
+ never a result.
262
+ - Browse queries take `live: true` (TT-2371): only the cards in play at
263
+ publication, for All or one `category`, in either browse sort; a
264
+ subcategory, frequency or date window beside it returns `INVALID_QUERY`.
265
+ Results echo it as `filters.live`. Every browse and search result carries
266
+ `live`: the publication's count of cards in play, `total` and per
267
+ configured category (`categories`, `{ value, count }`), each equal to that
268
+ live page's total, or `UNAVAILABLE` when the result's other counts are.
269
+ - The market stream's opt-in `scoreboards` frame (TT-2371): a subscription
270
+ that sets `scoreboards` gets every selected game's `scoreboard`, complete
271
+ after each snapshot and then on every change.
272
+ - Types for `GET /v1/markets/{outcome_id}/score-timeline` and
273
+ `GET /v1/questions/{question_id}/score-timeline` (TT-2371): the matchup's
274
+ score after each scoring play at the feed's wall-clock time, for a game
275
+ chart, or a null `timeline`.
276
+
277
+ ### Changed
278
+
279
+ - `openPosition` (`POST /v1/rfqs`) takes 1 to 5 legs, down from 50; more
280
+ return `400 INVALID_REQUEST`.
281
+ - A reference's `chance` holds the newest evidence, an execution or a book
282
+ midpoint at most 0.10 wide, kept inside the live book (TT-2366): on a book
283
+ at most 0.50 wide at any age, and on a wider, one-sided or empty book for
284
+ 20 minutes. `chance_basis` adds `HELD` for a chance that is neither the
285
+ current midpoint nor the unclamped last trade. A one-sided or empty book is
286
+ published `AVAILABLE` while it has a `mark` (a chance, else the best bid,
287
+ else 0 with asks only), with the missing side null and `value` equal to
288
+ `mark`. Reference closes record the shown chance of
289
+ any basis, not only midpoints.
290
+ - `GET /v1/markets` no longer returns `409 STALE_CURSOR`: its cursor continues
291
+ by native ID when a new catalog generation is published, so pages can name
292
+ different `catalog_generation` values (TT-2425).
293
+ - `createDeposit` (`POST /v1/me/deposits`) admits deposits from 0.10 USDC
294
+ (`100000`) from a Totalis embedded wallet, down from 1 USDC (TT-2444). Any
295
+ other wallet still moves at least 1 USDC, its floor for every sponsored way
296
+ out.
297
+
298
+ ### Removed
299
+
300
+ - `generateUsername` (`POST /v1/me/username`) and its `GeneratedUsername`
301
+ schema. An app picks the username and sets it with `setUsername`
302
+ (`PUT /v1/me/username`).
303
+
304
+ ### Fixed
305
+
306
+ - `sendAcceptance` no longer discards a bridge because a resent accept was
307
+ refused (TT-2259). When the first send's answer was lost and the SDK's resend
308
+ under the same `Idempotency-Key` met a 401 (the session lapsed), the bridge
309
+ was recorded `DISCARDED` and never sent, even though the venue held the first
310
+ send's acceptance. A resend's refusal now ends the attempt only if the venue
311
+ checks it after replaying a stored acceptance (a gone price, a bad
312
+ signature). A resend's 401, 403 or 429, which the venue checks before the
313
+ replay, and a 5xx or an answer cut off mid-body, no longer discard the
314
+ bridge: the SDK reads the acceptance and moves the bridge from what it finds. If that read fails too, the bridge stays unsent
315
+ and the error reports `mayStillRun: true`, with `resend()`, so recovery
316
+ decides after re-authenticating.
317
+ - `recoverAcceptance` works without a signer: it checks the record's account
318
+ against the session's wallet (`GET /v1/me`), since recovery signs nothing.
319
+
320
+ ## 0.68.0
321
+
322
+ Every expired operation names why (TT-2315). Generated from contract
323
+ `165.0.0-expiry-reasons`; an older venue simply sends fewer reasons.
324
+
325
+ ### Changed
326
+
327
+ - `OperationFailureReason` adds `DEADLINE_BEFORE_CLAIM`,
328
+ `AUTHORIZATION_TOO_CLOSE`, `SIGNER_QUOTE_LIFE`, `SIMULATION_REVERTED`,
329
+ `QUARANTINE_EXPIRED` and `ATTESTATION_EXPIRED`. An operation's
330
+ `failure_reason`, and `OPERATION_UPDATED`'s, can carry any of them on
331
+ `EXPIRED_UNEXECUTED`.
332
+ - `entryFailure` returns the operation's own reason for every reason but
333
+ `INSUFFICIENT_CASH`, which it still words as `INSUFFICIENT_CASH` or
334
+ `CORE_MOVE_MISSED`. `EntryFailure` widens to match: code that handles it
335
+ exhaustively needs a case for each new reason.
336
+
337
+ ## 0.67.0
338
+
339
+ Taker flow fixes (TT-2268). Additive: 0.66 code runs unchanged.
340
+
341
+ ### Added
342
+
343
+ - `bestBid(minLifeSeconds, minPrice)`: an optional price floor in USDC base
344
+ units; no bid below it is chosen.
345
+ - `RetryPolicy.maxRetryAfterMs` (default 30 s). A BACKOFF answer whose
346
+ Retry-After is longer is no longer waited out: the call throws at once, for
347
+ example `RATE_LIMITED`, with `retryAfterMs` set.
348
+ - `StreamClosedError.commandSent` and `TotalisStream.closeError()`.
349
+
350
+ ### Changed
351
+
352
+ - A follow cut off by a stream closed for good rejects with the server's
353
+ close reason (for example `STREAM_REPLACED`), not a generic `closed`. When
354
+ it follows a command already sent (`waitForOperation`, `waitForCoreExit`,
355
+ `sendWithdrawal`, `waitForWithdrawal`), the error has `commandSent` and
356
+ `normalizeError` reports `mayStillRun: true`.
357
+ - An `AcceptanceResult`'s `bridged` reads the bridge as it stands now, so it
358
+ turns `landed: "yes"` once Hyperliquid answers `ok`, and reads undefined
359
+ once a bridge is refused or discarded unsent.
360
+ - `openPosition` takes and signs a fresh quote once when the accept is
361
+ refused with `QUOTE_EXPIRED` or `QUOTE_REPLACED`; `onSigned` gets the new
362
+ record. A second refusal, or no fresh quote within `quoteTimeoutMs`, throws
363
+ the refusal.
364
+ - Deposit, withdrawal and exit signing windows are set on the venue clock the
365
+ stream tracks once it has synced. Signing never waits for the stream, so a
366
+ window signed on a fresh instance before its first sync uses the device
367
+ clock; start the stream first on devices whose clock may be off.
368
+ - Documented that an acceptance read after the trade settled, for example by
369
+ `recoverAcceptance`, can be `FILLED` or `FAILED`, both with `operationId`.
370
+
371
+ ## 0.66.1
372
+
373
+ Combos close at a market's admission cutoff (TT-2271). No type changes.
374
+
375
+ ### Changed
376
+
377
+ - `combo` is `CLOSED` with `OUTSIDE_WINDOW` and a null `opens_at` once a
378
+ market's result can be known: a price market from its observation time, a
379
+ policy rate from its scheduled decision. A sports game stays open in play
380
+ until its resolution backstop. RFQs refuse such legs as before.
381
+
382
+ ## 0.66.0
383
+
384
+ A lighter HyperCore read for Cash (TT-2277). Additive: 0.65 code runs unchanged.
385
+
386
+ ### Added
387
+
388
+ - `GET /v1/hypercore/balance` returns the session account's HyperCore spot
389
+ USDC, perps cash, account mode and HIP-4 positions in one read, on mainnet
390
+ and testnet. It reads no orders or fill history, so it answers even when
391
+ the portfolio's fill history is unavailable.
392
+ - HyperCore funding (`/v1/hypercore/portfolio` and the new route) carries
393
+ `spot_usdc_total` and `spot_usdc_hold`; `spot_usdc` stays total minus hold.
6
394
  ## 0.65.2
7
395
 
8
396
  The package is now `@totalis/hip4-client`, published to public npm. Install
@@ -39,10 +39,13 @@ export declare function controllerTransactions(deployment: TotalisDeployment & U
39
39
  approveUsdc: (amount: Value) => TransactionCall;
40
40
  /** `depositMaker`: pull approved USDC from the sending wallet into this maker's vault. */
41
41
  deposit: (amount: Value) => TransactionCall;
42
- /** `requestMakerWithdraw`: start the withdrawal delay for `amount` to `to`. */
42
+ /** `withdrawMaker`: pay `amount` of free collateral to `to` at once (vault v1.1). */
43
+ withdraw: (amount: Value, to: string) => TransactionCall;
44
+ /** `requestMakerWithdraw` (vault v1 only): start the withdrawal delay for `amount` to `to`. */
43
45
  requestWithdraw: (amount: Value, to: string) => TransactionCall;
44
- /** `executeMakerWithdraw`: pay out the pending request once its delay has passed. */
46
+ /** `executeMakerWithdraw` (vault v1 only): pay out the pending request once its delay has passed. */
45
47
  executeWithdraw: () => TransactionCall;
48
+ /** `cancelMakerWithdraw` (vault v1 only). */
46
49
  cancelWithdraw: () => TransactionCall;
47
50
  resetDiscount: () => TransactionCall;
48
51
  };
@@ -50,10 +50,13 @@ export function controllerTransactions(deployment, makerId, controller) {
50
50
  approveUsdc: (amount) => call(deployment, deployment.usdc.address, encodeCall("approve", [{ name: "spender", type: "address" }, { name: "amount", type: "uint256" }], [deployment.vault_address, amount])),
51
51
  /** `depositMaker`: pull approved USDC from the sending wallet into this maker's vault. */
52
52
  deposit: (amount) => vaultCall(deployment, "depositMaker", [makerId, controller, amount]),
53
- /** `requestMakerWithdraw`: start the withdrawal delay for `amount` to `to`. */
53
+ /** `withdrawMaker`: pay `amount` of free collateral to `to` at once (vault v1.1). */
54
+ withdraw: (amount, to) => vaultCall(deployment, "withdrawMaker", [makerId, amount, to]),
55
+ /** `requestMakerWithdraw` (vault v1 only): start the withdrawal delay for `amount` to `to`. */
54
56
  requestWithdraw: (amount, to) => vaultCall(deployment, "requestMakerWithdraw", [makerId, amount, to]),
55
- /** `executeMakerWithdraw`: pay out the pending request once its delay has passed. */
57
+ /** `executeMakerWithdraw` (vault v1 only): pay out the pending request once its delay has passed. */
56
58
  executeWithdraw: () => vaultCall(deployment, "executeMakerWithdraw", [makerId]),
59
+ /** `cancelMakerWithdraw` (vault v1 only). */
57
60
  cancelWithdraw: () => vaultCall(deployment, "cancelMakerWithdraw", [makerId]),
58
61
  resetDiscount: () => vaultCall(deployment, "resetDiscount", [makerId]),
59
62
  };
@@ -49,9 +49,10 @@ export type NormalizedError = {
49
49
  /**
50
50
  * The command may have reached the venue and may still execute: its
51
51
  * response was lost, it was aborted or timed out in flight, it was still
52
- * BACKOFF after the resends (an earlier send may have been lost), or a
53
- * proxy answered 5xx without the venue's error envelope. Never sign a new
54
- * command; `resend` it or read its state.
52
+ * BACKOFF after the resends (an earlier send may have been lost), a
53
+ * proxy answered 5xx without the venue's error envelope, or the stream
54
+ * closed for good while following it (`StreamClosedError` `commandSent`).
55
+ * Never sign a new command; `resend` it or read its state.
55
56
  */
56
57
  readonly mayStillRun: boolean;
57
58
  /** Sends the identical request again, when the flow attached it. */
@@ -60,7 +60,7 @@ export function normalizeError(error) {
60
60
  if (error instanceof ExitUnavailableError)
61
61
  return { ...base, code: error.code, message, retryable: false };
62
62
  if (error instanceof StreamClosedError)
63
- return { ...base, code: "STREAM_CLOSED", message: error.reason, retryable: false };
63
+ return { ...base, code: "STREAM_CLOSED", message: error.reason, retryable: false, mayStillRun: error.commandSent };
64
64
  // An aborted or timed-out request may still have reached the venue.
65
65
  if (error instanceof Error && error.name === "TimeoutError")
66
66
  return { ...base, code: "TIMEOUT", message, retryable: true, mayStillRun: true };
@@ -359,7 +359,7 @@ export type components = {
359
359
  readonly activity_id: string;
360
360
  /** @description Revision of this activity view, as a decimal string; increases when the activity is revised. */
361
361
  readonly revision: string;
362
- /** @description Commit-visible publication sequence, as a decimal string. Lists order by sequence, then activity_id, descending. */
362
+ /** @description Commit-visible publication sequence of the activity's vault, as a decimal string. Lists order each vault's activity by sequence, then activity_id, descending; an account that has activity in more than one vault (after a vault redeploy) gets them merged, most recently recorded first. */
363
363
  readonly sequence: string;
364
364
  /** @description Business type of the activity, e.g. DEPOSIT, ACCEPT, SETTLEMENT, CLAIM, or CORRECTION for a reorg reversal. */
365
365
  readonly kind: components["schemas"]["ActivityKind"];
@@ -395,7 +395,7 @@ export type components = {
395
395
  readonly ActivityList: {
396
396
  /** @description Freshness of this read: the oldest source observation and one status for every amount in the response. */
397
397
  readonly context: components["schemas"]["ReadContext"];
398
- /** @description Activities on this page, ordered by sequence, then activity_id, descending. */
398
+ /** @description Activities on this page, ordered by sequence, then activity_id, descending, within each vault; several vaults' activities are merged, most recently recorded first. */
399
399
  readonly items: readonly components["schemas"]["Activity"][];
400
400
  /** @description Opaque cursor for the next page, bound to this response's snapshot; null on the last page. Send it back unchanged as cursor. */
401
401
  readonly next_cursor: components["schemas"]["NextCursor"];
@@ -525,8 +525,12 @@ export type components = {
525
525
  readonly result_denominator: null;
526
526
  };
527
527
  readonly Position: {
528
- /** @description Position ID: the contract's ticketId (bytes32 hex). */
528
+ /** @description Position ID: the contract's ticketId (bytes32 hex). A ticketId is the EIP-712 digest of its quote under its vault's domain, so it names one position across every vault. */
529
529
  readonly position_id: string;
530
+ /** @description Lowercase vault contract address the position is on. An account's positions span every vault the deployment has served: the active one, one running off and closed ones. */
531
+ readonly vault_address: components["schemas"]["LowercaseNonZeroAddress"];
532
+ /** @description Whether the position's vault takes a cash-out. Only the active vault does; a position on a vault running off cannot be cashed out (`STATE_CONFLICT`) and pays out automatically when it settles. Whether this position can be cashed out now also depends on its status. */
533
+ readonly cashout_available: boolean;
530
534
  /** @description Maker that wrote the position, as a decimal string. */
531
535
  readonly maker_id: components["schemas"]["NonZeroUInt64String"];
532
536
  /** @description Current position owner wallet (lowercase). */
@@ -735,6 +739,8 @@ export type components = {
735
739
  readonly rfq_id: string;
736
740
  /** @description Bettor stake in atomic USDC (6 decimals), before taker fees. */
737
741
  readonly stake: string;
742
+ /** @description Stake less the quote's taker fee, floor(stake * taker_fee_bps / 10000), in atomic USDC (6 decimals): what the vault escrows if the quote fills. Payout minus net_stake is the maker's risk. */
743
+ readonly net_stake: string;
738
744
  /** @description Signed potential bettor payout in atomic USDC (6 decimals). */
739
745
  readonly payout: string;
740
746
  /** @description Quote expiry as Unix epoch seconds. */
@@ -746,7 +752,7 @@ export type components = {
746
752
  * @description Stable HTTP error code. Each code has one HTTP status and one retry value.
747
753
  * @enum {string}
748
754
  */
749
- readonly ErrorCode: "INVALID_REQUEST" | "INVALID_QUERY" | "INVALID_CURSOR" | "INVALID_IDEMPOTENCY_KEY" | "ORIGIN_REQUIRED" | "SUBPROTOCOL_REQUIRED" | "UNSUPPORTED_BROWSE_CONTRACT" | "UNAUTHENTICATED" | "FORBIDDEN" | "ORIGIN_NOT_ALLOWED" | "ACCESS_REQUIRED" | "NOT_FOUND" | "IDENTITY_NOT_FOUND" | "QUOTE_NOT_FOUND" | "INVITE_CODE_NOT_FOUND" | "IDEMPOTENCY_KEY_REUSED" | "STATE_CONFLICT" | "INVITE_CODE_EXHAUSTED" | "STALE_CURSOR" | "CURSOR_EXPIRED" | "CURSOR_RESET" | "RECURRING_DEFINITION_CONFLICT" | "EMBEDDED_WALLET_CONFLICT" | "SECRET_UNAVAILABLE" | "ROTATION_IN_PROGRESS" | "TELEMETRY_CONFLICT" | "RFQ_NOT_CANCELLABLE" | "RFQ_NOT_OPEN" | "RFQ_GENERATION_STALE" | "RFQ_GENERATION_IN_FLIGHT" | "QUOTE_EXPIRED" | "QUOTE_CANCELLED" | "QUOTE_REPLACED" | "QUOTE_SIGNER_CHANGED" | "QUOTE_CAPACITY_EXCEEDED" | "CORE_ACCOUNT_NOT_READY" | "CORE_ACCOUNT_ACTIVATION_REQUIRED" | "CORE_EXIT_ABANDONED" | "CORE_MOVE_IN_FLIGHT" | "USERNAME_TAKEN" | "USERNAME_ALREADY_SET" | "INVALID_SIGNATURE" | "WALLET_CONTRACT_UNSUPPORTED" | "WRONG_AUTHORITY" | "KEY_LIMIT_REACHED" | "USERNAME_NOT_ALLOWED" | "RATE_LIMITED" | "CONNECTION_LIMIT" | "RFQ_INTENT_LIMIT" | "QUOTE_EXPOSURE_LIMIT" | "DEPENDENCY_STALE" | "AUTHORIZATION_UNAVAILABLE" | "SOURCE_UNAVAILABLE" | "CONTRACT_UNAVAILABLE" | "MARKET_DATA_UNAVAILABLE" | "BROWSE_UNAVAILABLE" | "FINANCIAL_ACTIONS_DISABLED" | "CORE_EXIT_UNAVAILABLE" | "COLLATERAL_REDUCTION_UNAVAILABLE" | "SPONSORSHIP_UNAVAILABLE" | "CONTRACT_SIGNATURE_OVERLOADED" | "QUOTE_EXPOSURE_STALE" | "COMBO_AUTOMATIC_DISABLED" | "EMBEDDED_WALLET_UNAVAILABLE" | "CONNECTION_DRAIN";
755
+ readonly ErrorCode: "INVALID_REQUEST" | "INVALID_QUERY" | "INVALID_CURSOR" | "INVALID_IDEMPOTENCY_KEY" | "ORIGIN_REQUIRED" | "SUBPROTOCOL_REQUIRED" | "UNSUPPORTED_BROWSE_CONTRACT" | "UNAUTHENTICATED" | "FORBIDDEN" | "ORIGIN_NOT_ALLOWED" | "ACCESS_REQUIRED" | "SIGN_IN_REQUIRED" | "NOT_FOUND" | "IDENTITY_NOT_FOUND" | "QUOTE_NOT_FOUND" | "INVITE_CODE_NOT_FOUND" | "IDEMPOTENCY_KEY_REUSED" | "STATE_CONFLICT" | "INVITE_CODE_EXHAUSTED" | "STALE_CURSOR" | "CURSOR_EXPIRED" | "CURSOR_RESET" | "RECURRING_DEFINITION_CONFLICT" | "EMBEDDED_WALLET_CONFLICT" | "SECRET_UNAVAILABLE" | "ROTATION_IN_PROGRESS" | "TELEMETRY_CONFLICT" | "RFQ_NOT_CANCELLABLE" | "RFQ_NOT_OPEN" | "RFQ_GENERATION_STALE" | "RFQ_GENERATION_IN_FLIGHT" | "QUOTE_EXPIRED" | "QUOTE_CANCELLED" | "QUOTE_REPLACED" | "QUOTE_SIGNER_CHANGED" | "QUOTE_CAPACITY_EXCEEDED" | "CORE_ACCOUNT_NOT_READY" | "CORE_ACCOUNT_ACTIVATION_REQUIRED" | "CORE_EXIT_ABANDONED" | "CORE_MOVE_IN_FLIGHT" | "ACCEPTANCE_IN_FLIGHT" | "USERNAME_TAKEN" | "USERNAME_ALREADY_SET" | "USERNAME_REQUIRED" | "INVALID_SIGNATURE" | "WALLET_CONTRACT_UNSUPPORTED" | "WRONG_AUTHORITY" | "KEY_LIMIT_REACHED" | "USERNAME_NOT_ALLOWED" | "FOLLOW_SELF" | "FOLLOW_LIMIT_REACHED" | "RATE_LIMITED" | "CONNECTION_LIMIT" | "RFQ_INTENT_LIMIT" | "QUOTE_EXPOSURE_LIMIT" | "DEPENDENCY_STALE" | "AUTHORIZATION_UNAVAILABLE" | "SOURCE_UNAVAILABLE" | "CONTRACT_UNAVAILABLE" | "MARKET_DATA_UNAVAILABLE" | "BROWSE_UNAVAILABLE" | "FINANCIAL_ACTIONS_DISABLED" | "CORE_EXIT_UNAVAILABLE" | "COLLATERAL_REDUCTION_UNAVAILABLE" | "SPONSORSHIP_UNAVAILABLE" | "CONTRACT_SIGNATURE_OVERLOADED" | "QUOTE_EXPOSURE_STALE" | "COMBO_AUTOMATIC_DISABLED" | "GAS_PRICE_ABOVE_CEILING" | "EXECUTION_BACKLOG_FULL" | "EMBEDDED_WALLET_UNAVAILABLE" | "CONNECTION_DRAIN";
750
756
  readonly FieldViolation: {
751
757
  /**
752
758
  * @description REQUIRED: the input is missing. INVALID: it is present but malformed or out of range. UNEXPECTED: the input is not accepted here.
@@ -994,7 +1000,7 @@ export type components = {
994
1000
  * @description Exclusive RFC3339 end of the period, echoed from the query.
995
1001
  */
996
1002
  readonly through: string;
997
- /** @description The period's fill rate, on a list's first page (no cursor); null on later pages and when the period holds more than 50,000 quotes: ask for a shorter one. */
1003
+ /** @description The period's fill rate, on a list's first page (no cursor); null on later pages. */
998
1004
  readonly fill_rate: components["schemas"]["QuoteFillRate"] | null;
999
1005
  /** @description Quotes on this page, newest submitted_at first. Each status is read when the page is. */
1000
1006
  readonly items: readonly components["schemas"]["QuoteHistoryItem"][];
@@ -375,7 +375,7 @@ export type components = {
375
375
  * @description Stable HTTP error code. Each code has one HTTP status and one retry value.
376
376
  * @enum {string}
377
377
  */
378
- readonly ErrorCode: "INVALID_REQUEST" | "INVALID_QUERY" | "INVALID_CURSOR" | "INVALID_IDEMPOTENCY_KEY" | "ORIGIN_REQUIRED" | "SUBPROTOCOL_REQUIRED" | "UNSUPPORTED_BROWSE_CONTRACT" | "UNAUTHENTICATED" | "FORBIDDEN" | "ORIGIN_NOT_ALLOWED" | "ACCESS_REQUIRED" | "NOT_FOUND" | "IDENTITY_NOT_FOUND" | "QUOTE_NOT_FOUND" | "INVITE_CODE_NOT_FOUND" | "IDEMPOTENCY_KEY_REUSED" | "STATE_CONFLICT" | "INVITE_CODE_EXHAUSTED" | "STALE_CURSOR" | "CURSOR_EXPIRED" | "CURSOR_RESET" | "RECURRING_DEFINITION_CONFLICT" | "EMBEDDED_WALLET_CONFLICT" | "SECRET_UNAVAILABLE" | "ROTATION_IN_PROGRESS" | "TELEMETRY_CONFLICT" | "RFQ_NOT_CANCELLABLE" | "RFQ_NOT_OPEN" | "RFQ_GENERATION_STALE" | "RFQ_GENERATION_IN_FLIGHT" | "QUOTE_EXPIRED" | "QUOTE_CANCELLED" | "QUOTE_REPLACED" | "QUOTE_SIGNER_CHANGED" | "QUOTE_CAPACITY_EXCEEDED" | "CORE_ACCOUNT_NOT_READY" | "CORE_ACCOUNT_ACTIVATION_REQUIRED" | "CORE_EXIT_ABANDONED" | "CORE_MOVE_IN_FLIGHT" | "USERNAME_TAKEN" | "USERNAME_ALREADY_SET" | "INVALID_SIGNATURE" | "WALLET_CONTRACT_UNSUPPORTED" | "WRONG_AUTHORITY" | "KEY_LIMIT_REACHED" | "USERNAME_NOT_ALLOWED" | "RATE_LIMITED" | "CONNECTION_LIMIT" | "RFQ_INTENT_LIMIT" | "QUOTE_EXPOSURE_LIMIT" | "DEPENDENCY_STALE" | "AUTHORIZATION_UNAVAILABLE" | "SOURCE_UNAVAILABLE" | "CONTRACT_UNAVAILABLE" | "MARKET_DATA_UNAVAILABLE" | "BROWSE_UNAVAILABLE" | "FINANCIAL_ACTIONS_DISABLED" | "CORE_EXIT_UNAVAILABLE" | "COLLATERAL_REDUCTION_UNAVAILABLE" | "SPONSORSHIP_UNAVAILABLE" | "CONTRACT_SIGNATURE_OVERLOADED" | "QUOTE_EXPOSURE_STALE" | "COMBO_AUTOMATIC_DISABLED" | "EMBEDDED_WALLET_UNAVAILABLE" | "CONNECTION_DRAIN";
378
+ readonly ErrorCode: "INVALID_REQUEST" | "INVALID_QUERY" | "INVALID_CURSOR" | "INVALID_IDEMPOTENCY_KEY" | "ORIGIN_REQUIRED" | "SUBPROTOCOL_REQUIRED" | "UNSUPPORTED_BROWSE_CONTRACT" | "UNAUTHENTICATED" | "FORBIDDEN" | "ORIGIN_NOT_ALLOWED" | "ACCESS_REQUIRED" | "SIGN_IN_REQUIRED" | "NOT_FOUND" | "IDENTITY_NOT_FOUND" | "QUOTE_NOT_FOUND" | "INVITE_CODE_NOT_FOUND" | "IDEMPOTENCY_KEY_REUSED" | "STATE_CONFLICT" | "INVITE_CODE_EXHAUSTED" | "STALE_CURSOR" | "CURSOR_EXPIRED" | "CURSOR_RESET" | "RECURRING_DEFINITION_CONFLICT" | "EMBEDDED_WALLET_CONFLICT" | "SECRET_UNAVAILABLE" | "ROTATION_IN_PROGRESS" | "TELEMETRY_CONFLICT" | "RFQ_NOT_CANCELLABLE" | "RFQ_NOT_OPEN" | "RFQ_GENERATION_STALE" | "RFQ_GENERATION_IN_FLIGHT" | "QUOTE_EXPIRED" | "QUOTE_CANCELLED" | "QUOTE_REPLACED" | "QUOTE_SIGNER_CHANGED" | "QUOTE_CAPACITY_EXCEEDED" | "CORE_ACCOUNT_NOT_READY" | "CORE_ACCOUNT_ACTIVATION_REQUIRED" | "CORE_EXIT_ABANDONED" | "CORE_MOVE_IN_FLIGHT" | "ACCEPTANCE_IN_FLIGHT" | "USERNAME_TAKEN" | "USERNAME_ALREADY_SET" | "USERNAME_REQUIRED" | "INVALID_SIGNATURE" | "WALLET_CONTRACT_UNSUPPORTED" | "WRONG_AUTHORITY" | "KEY_LIMIT_REACHED" | "USERNAME_NOT_ALLOWED" | "FOLLOW_SELF" | "FOLLOW_LIMIT_REACHED" | "RATE_LIMITED" | "CONNECTION_LIMIT" | "RFQ_INTENT_LIMIT" | "QUOTE_EXPOSURE_LIMIT" | "DEPENDENCY_STALE" | "AUTHORIZATION_UNAVAILABLE" | "SOURCE_UNAVAILABLE" | "CONTRACT_UNAVAILABLE" | "MARKET_DATA_UNAVAILABLE" | "BROWSE_UNAVAILABLE" | "FINANCIAL_ACTIONS_DISABLED" | "CORE_EXIT_UNAVAILABLE" | "COLLATERAL_REDUCTION_UNAVAILABLE" | "SPONSORSHIP_UNAVAILABLE" | "CONTRACT_SIGNATURE_OVERLOADED" | "QUOTE_EXPOSURE_STALE" | "COMBO_AUTOMATIC_DISABLED" | "GAS_PRICE_ABOVE_CEILING" | "EXECUTION_BACKLOG_FULL" | "EMBEDDED_WALLET_UNAVAILABLE" | "CONNECTION_DRAIN";
379
379
  readonly FieldViolation: {
380
380
  /**
381
381
  * @description REQUIRED: the input is missing. INVALID: it is present but malformed or out of range. UNEXPECTED: the input is not accepted here.