@totalis/hip4-client 0.65.2 → 0.73.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,368 @@
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.73.0
7
+
8
+ A follower's copied trades, what copying each trader came to, and which of
9
+ their fills copies made (TT-2486); the chain-agent registry's `SET_AGENT`
10
+ Combo copy agents and the Combo copy budget (TT-2487).
11
+ Generated from contract `201.0.0-copy-budget`. Additive.
12
+
13
+ ### Added
14
+
15
+ - `listCopyTrades` (`GET /v1/me/copy-trades`): your copy journal, newest
16
+ first, optionally for one `leader`. Each row is a followed trader's trade
17
+ and what became of your copy: `PENDING`, `COPIED`, `PARTIAL`, `SKIPPED`
18
+ with a `reason`, or `FAILED`.
19
+ - `getCopySummary` (`GET /v1/me/copy-summary`): per trader, copies filled,
20
+ skipped and failed, USDC `bought` and `sold`, copied shares still `held`,
21
+ and whether those give the P&L (`complete`).
22
+ - `listCopiedFills` (`GET /v1/me/copy-fills?tids=&from=&through=`): which
23
+ of up to 100 of your fills, by Hyperliquid trade ID, in a span of at most
24
+ 31 days, copies made, with the copied trade and its `leader`.
25
+ - `HyperevmKeeperOperationKind` (internal registry): `SET_AGENT`, a relayed
26
+ vault agent grant or revoke.
27
+ - Combo copy agents: `requestComboCopyAgent`, `grantComboCopyAgent`,
28
+ `confirmComboCopyAgent`, `revokeComboCopyAgent` and
29
+ `switchOffComboCopyAgent` (`/v1/me/copy-agents/combo*`). The key Combo
30
+ auto-copy signs with, the account's vault `AgentGrant` for it relayed to
31
+ `setAgent`, its confirmation once on chain, an on-chain revoke, and
32
+ switching it off. `getCopyAgents` adds `combo`.
33
+ - `getCopyBudget` and `setCopyAllocation` (`/v1/me/copy-budget`): the Combo
34
+ copy allocation and the budget the sweeper leaves in the vault for Combo
35
+ copying.
36
+
37
+ ## 0.72.0
38
+
39
+ Emoji reactions on market comments (TT-2399), and a named refusal for a
40
+ core copy key on another account (TT-2485).
41
+ Generated from contract `196.0.0-copy-engine`. Additive.
42
+
43
+ ### Added
44
+
45
+ - Comment reactions: `reactComment` and `unreactComment`
46
+ (`PUT` and `DELETE /v1/comments/{comment_id}/reactions/{reaction}`) give and
47
+ take back one of `fire`, `laugh`, `mind_blown`, `cry`, `rocket` and `skull`.
48
+ Every comment gains `reactions`: each reaction it has, with its `count` and
49
+ whether you gave it (`reacted`).
50
+
51
+ ### Changed
52
+
53
+ - `requestCoreCopyAgent` (`POST /v1/me/copy-agents/core`) can answer
54
+ 409 `STATE_CONFLICT` while a key is active on another account: switch it
55
+ off first, or renew for the active key's account.
56
+
57
+ ## 0.71.0
58
+
59
+ Server-held copy agents for core auto-copy (TT-2484), users, cash-outs and
60
+ open positions in partner reports (TT-2541), and public trader profiles that
61
+ start on (TT-2539).
62
+ Generated from contract `194.0.0-partner-users`. Additive, except that public
63
+ profiles now start on.
64
+
65
+ ### Added
66
+
67
+ - Partner reports (TT-2541): `report()` (`GET /v1/partner/report`) adds
68
+ `users` (wallets you admitted and the accounts they created, all time),
69
+ `open_tickets` (your users' open positions and their stake), and per day
70
+ and in total `cashouts`, `cashout_volume`, `active_traders` and
71
+ `new_accounts`. In `totals`, `active_traders` counts each account once over
72
+ the range.
73
+
74
+ - Copy agents (TT-2484): `requestCoreCopyAgent`
75
+ (`POST /v1/me/copy-agents/core`) makes the key core auto-copy signs with,
76
+ which the account approves with `approveAgent` in the named slot
77
+ `TotalisCopy`; `confirmCoreCopyAgent` (`POST .../core/confirm`) activates it
78
+ once Hyperliquid lists it; `getCopyAgents` (`GET /v1/me/copy-agents`) reads
79
+ the active key and any replacement waiting for approval; and
80
+ `switchOffCoreCopyAgent` (`DELETE /v1/me/copy-agents/core`) stops copying at
81
+ once. New schemas `CopyAgent` and `CopyAgents`.
82
+
83
+ ### Changed
84
+
85
+ - Public trader profiles start on (TT-2539). A new account's profile is public
86
+ as soon as it exists, and every existing profile that never used the switch
87
+ was turned on, so `getIdentity` (`GET /v1/me`) reports `public_profile: true` for them, including
88
+ accounts without a username. `setPublicProfile` (`PUT /v1/me/public-profile`)
89
+ still turns it off, now also before the account has a username, and turning
90
+ it on still needs one. While on, a profile links the account wallet to its
91
+ username in `GET /v1/traders/{username}` and the leaderboards.
92
+
93
+ ## 0.70.0
94
+
95
+ A named refusal for a sign-in without Google, email or X (TT-2519, TT-2537).
96
+ Generated from contract `192.0.0-sign-in-required`. Additive.
97
+
98
+ ### Added
99
+
100
+ - `bindEmbeddedWallet` refuses a new account whose Privy user has no Google,
101
+ email or X login linked, such as one signed in only with an external
102
+ wallet, with the new error code
103
+ `SIGN_IN_REQUIRED` (403) instead of `ACCESS_REQUIRED` (TT-2519). An X
104
+ login now opens an account like Google or email (TT-2537).
105
+ On `bindEmbeddedWallet`, `ACCESS_REQUIRED` now means only that no invite has
106
+ been redeemed; wallet sign-in keeps its meaning.
107
+
108
+ ## 0.69.0
109
+
110
+ Vault run-off (TT-2260), X pictures on the leaderboard (TT-2318), a gas
111
+ ceiling on sponsored work (TT-2338), no generated usernames (TT-2299),
112
+ perp marks for price charts (TT-2335), live
113
+ games on sports cards and detail (TT-2306), Combos of at most 5 legs, and
114
+ games in play on browse, live scores over the market stream and score
115
+ timelines (TT-2371), market comments (TT-2297), their moderation (TT-2410),
116
+ holder badges and the holders filter (TT-2411), up to three suggested Combos,
117
+ held chances (TT-2366), partner reports (TT-2420), market list cursors
118
+ that continue across catalog generations (TT-2425), a named refusal for an
119
+ accept beside another in flight (TT-2259), the account's X picture from the
120
+ server (TT-2443), sponsored deposits from 0.10 USDC (TT-2444), the
121
+ funded-accept wording that gives a transfer sent before `fund_by` two more
122
+ seconds to land (TT-2259), the net stake on entry RFQs (TT-2419) and the
123
+ discovery cards of suggested Combo legs (TT-2475), opt-in public
124
+ trader profiles (TT-2481) and follows with copy settings (TT-2482).
125
+ Generated from contract `191.0.0-follows`.
126
+ Breaking only for callers of the removed operation and RFQs of more than 5
127
+ legs.
128
+
129
+ ### Added
130
+
131
+ - Follows and copy settings (TT-2482): `followTrader` and `unfollowTrader`
132
+ (`PUT` and `DELETE /v1/me/follows/{username}`) follow a public trader and
133
+ set the follow's core and Combo copy settings, `listFollows`
134
+ (`GET /v1/me/follows`) lists them, and `getCopySettings` and
135
+ `setCopySettings` (`/v1/me/copy-settings`) read and set the pause and daily
136
+ caps across every follow. `getTrader` gains `followers` and `following`, and
137
+ the new error codes `FOLLOW_SELF` and `FOLLOW_LIMIT_REACHED` refuse following
138
+ oneself or more than 100 traders.
139
+ - Public trader profiles (TT-2481): `setPublicProfile`
140
+ (`PUT /v1/me/public-profile`) turns the account's profile on or off, and
141
+ `getTrader`, `listTraderTrades`, `listTraderPositions` and `getTraderPnl`
142
+ (`GET /v1/traders/{username}` and its `trades`, `positions` and `pnl`) read
143
+ an opted-in trader. `VenueIdentity` and both leaderboards' traders gain
144
+ `public_profile`, and the new error code `USERNAME_REQUIRED` refuses turning
145
+ a profile on without a username.
146
+ - `SuggestedCombo` (`GET /v1/suggested-combo`) requires `cards`: the browse
147
+ contract 4 discovery card each leg was picked from, in leg order, as read
148
+ when it was quoted, so a client can draw a leg that is not on its own page
149
+ (TT-2475).
150
+ - `EntryRfq` (`GET /v1/rfqs`, `GET /v1/rfqs/{rfq_id}`, snapshot `open_rfqs`)
151
+ and the entry `RFQ_CREATED` payload carry `net_stake`, what the vault backs
152
+ if a quote is accepted: `stake - floor(stake * taker_fee_bps / 10000)` with
153
+ the vault's current taker fee, the one every quote must carry. `stake` stays
154
+ gross and quotes still sign it. Absent while the server does not know the
155
+ taker fee (TT-2419).
156
+ - `DashboardQuotes` (`GET /v1/makers/{maker_id}/quotes`) requires `net_stake`
157
+ on each quote: its stake less its own taker fee (TT-2419).
158
+ - `VenueIdentity` (`GET /v1/me`) and comment authors carry `picture_url`, the
159
+ profile picture of the X account linked to the account's Privy login, the
160
+ same one the leaderboards show; absent when the server has none.
161
+ `POST /v1/me/picture` (`refreshPicture`) reads it from Privy now; call it
162
+ right after the user links or unlinks X.
163
+ - `ErrorCode` adds `ACCEPTANCE_IN_FLIGHT` (409, `REFRESH`), and Accept quote
164
+ lists it: an account has one entry acceptance in flight at a time, so
165
+ accepting an entry quote while another awaits its maker or its trade is
166
+ refused with it instead of `STATE_CONFLICT`. Nothing was created; accept a
167
+ fresh quote once that acceptance's operation ends.
168
+ - Wallet challenges accept the exact bundled iOS origin `capacitor://localhost`
169
+ when it is registered in the service allowlist. Existing HTTPS origins and
170
+ wallet-signature requirements are unchanged.
171
+ - Partner reports (TT-2420): `createPartnerServer(...).report({ from, to })`
172
+ (`GET /v1/partner/report`) returns your partner's fees per UTC day, your
173
+ terms and, all time, what you earned, were paid and are owed, with every
174
+ payout and its transfers. It takes your server key; omit the range for the
175
+ 30 days through today.
176
+ - `signInWithWallet({ serverKey })`: a partner signing its users in from its
177
+ own servers passes its `tpk_v1_` server key, and the sign-in is rate limited per
178
+ partner instead of per source address (TT-2424). The origin must be one the
179
+ partner owns; the wallet still signs. Server-side only.
180
+ - Vault v1.1 maker withdrawals: `controllerTransactions(...).withdraw(amount,
181
+ to)` builds `withdrawMaker`, which pays at once. `requestWithdraw`,
182
+ `executeWithdraw` and `cancelWithdraw` stay for a vault v1 maker.
183
+ - Market comments (TT-2297): `GET /v1/comments` lists a question's or
184
+ standalone outcome's top-level comments, most liked or newest first;
185
+ `GET /v1/comments/{comment_id}/replies` lists a comment's replies. A
186
+ signed-in session posts, edits, deletes, likes and unlikes with
187
+ `POST /v1/comments`, `PUT` and `DELETE /v1/comments/{comment_id}` and
188
+ `PUT` and `DELETE /v1/comments/{comment_id}/like`.
189
+ - Comment moderation (TT-2410): a comment carries `removed` when a moderator
190
+ deleted it, and a comment page carries `pinned`, the comment a moderator
191
+ pinned to lead the thread, on a thread's first page only. A muted account's
192
+ posts and edits are 403 `FORBIDDEN`.
193
+ - Comment holders (TT-2411): a comment carries `holder` when its author holds
194
+ an open Combo on its market now, null when that is not known.
195
+ `GET /v1/comments?filter=holders` lists only holders' comments.
196
+ - `GET /v1/suggested-combo` carries `combos`, up to three suggested Combos
197
+ that share no outcome. `combo`, the first of `combos` or null, is
198
+ deprecated and goes in the next release.
199
+ - `signRunOffClaim({ vaultAddress })` signs an Exit of the account's free cash
200
+ in a vault running off to the account's own wallet; send it with
201
+ `sendRunOffClaim` (`POST /v1/me/run-off-claims`) and follow its operation
202
+ with `waitForOperation`.
203
+ - Balances carry `run_off`: cash per vault running off, never part of
204
+ `amount`, with any claim still in flight as `claim`. A position carries
205
+ `vault_address` and `cashout_available`; a core exit carries
206
+ `vault_address`.
207
+ - A cash-out of a position on a vault running off returns `STATE_CONFLICT`.
208
+ - Both leaderboards' traders carry `picture_url`, the profile picture of the X
209
+ account linked to the trader's Privy login, which clients show in place of
210
+ the generated avatar.
211
+ - `ErrorCode` adds `GAS_PRICE_ABOVE_CEILING` (503, `BACKOFF`): creating a
212
+ Combo RFQ or a cash-out is refused while HyperEVM gas is above the venue's
213
+ sponsorship ceiling. Retry after `Retry-After`.
214
+ - An RFQ's `status` adds `DECLINED` and the stream adds `RFQ_DECLINED`, for
215
+ RFQs makers declined before declines were removed (TT-2431); no RFQ ends
216
+ `DECLINED` now. `watchQuotes` empties and `onRfq` drops the RFQ on it, as on
217
+ `RFQ_CANCELLED`.
218
+ - Types for `GET /v1/perp-marks`, a perp's mark price on a fixed step recorded
219
+ from Totalis's own Hyperliquid node, and for the market stream's opt-in
220
+ `publication` frame (`publication_freshness`), which proves how far a
221
+ socket is current.
222
+ - Browse and search cards carry `estimated_live_until` (TT-2306): for a
223
+ scheduled single sports contest, its start plus its league's reviewed usual
224
+ game length, so `[date_at, estimated_live_until)` is when it is in play. A
225
+ live game feed holds it open while the game runs long and closes it when
226
+ the game ends. Null otherwise; never a trading cutoff. Every default browse
227
+ page, All included, lists cards inside that window first.
228
+ - `Question` carries the same `estimated_live_until` for its markets, and
229
+ `MarketDetail` read with `contract=4` carries its matchup's: its question's,
230
+ else its game's, else its own.
231
+ - Both also carry `scoreboard`: the matchup's game as the live game feed last
232
+ read it (`status`, `period`, `clock`, `outs`, both `competitors` with
233
+ `score` in the matchup's own order, `last_play`, `refreshed_at`), or null
234
+ when the feed does not cover the game or its reading is stale. Display only,
235
+ never a result.
236
+ - Browse queries take `live: true` (TT-2371): only the cards in play at
237
+ publication, for All or one `category`, in either browse sort; a
238
+ subcategory, frequency or date window beside it returns `INVALID_QUERY`.
239
+ Results echo it as `filters.live`. Every browse and search result carries
240
+ `live`: the publication's count of cards in play, `total` and per
241
+ configured category (`categories`, `{ value, count }`), each equal to that
242
+ live page's total, or `UNAVAILABLE` when the result's other counts are.
243
+ - The market stream's opt-in `scoreboards` frame (TT-2371): a subscription
244
+ that sets `scoreboards` gets every selected game's `scoreboard`, complete
245
+ after each snapshot and then on every change.
246
+ - Types for `GET /v1/markets/{outcome_id}/score-timeline` and
247
+ `GET /v1/questions/{question_id}/score-timeline` (TT-2371): the matchup's
248
+ score after each scoring play at the feed's wall-clock time, for a game
249
+ chart, or a null `timeline`.
250
+
251
+ ### Changed
252
+
253
+ - `openPosition` (`POST /v1/rfqs`) takes 1 to 5 legs, down from 50; more
254
+ return `400 INVALID_REQUEST`.
255
+ - A reference's `chance` holds the newest evidence, an execution or a book
256
+ midpoint at most 0.10 wide, kept inside the live book (TT-2366): on a book
257
+ at most 0.50 wide at any age, and on a wider, one-sided or empty book for
258
+ 20 minutes. `chance_basis` adds `HELD` for a chance that is neither the
259
+ current midpoint nor the unclamped last trade. A one-sided or empty book is
260
+ published `AVAILABLE` while it has a `mark` (a chance, else the best bid,
261
+ else 0 with asks only), with the missing side null and `value` equal to
262
+ `mark`. Reference closes record the shown chance of
263
+ any basis, not only midpoints.
264
+ - `GET /v1/markets` no longer returns `409 STALE_CURSOR`: its cursor continues
265
+ by native ID when a new catalog generation is published, so pages can name
266
+ different `catalog_generation` values (TT-2425).
267
+ - `createDeposit` (`POST /v1/me/deposits`) admits deposits from 0.10 USDC
268
+ (`100000`) from a Totalis embedded wallet, down from 1 USDC (TT-2444). Any
269
+ other wallet still moves at least 1 USDC, its floor for every sponsored way
270
+ out.
271
+
272
+ ### Removed
273
+
274
+ - `generateUsername` (`POST /v1/me/username`) and its `GeneratedUsername`
275
+ schema. An app picks the username and sets it with `setUsername`
276
+ (`PUT /v1/me/username`).
277
+
278
+ ### Fixed
279
+
280
+ - `sendAcceptance` no longer discards a bridge because a resent accept was
281
+ refused (TT-2259). When the first send's answer was lost and the SDK's resend
282
+ under the same `Idempotency-Key` met a 401 (the session lapsed), the bridge
283
+ was recorded `DISCARDED` and never sent, even though the venue held the first
284
+ send's acceptance. A resend's refusal now ends the attempt only if the venue
285
+ checks it after replaying a stored acceptance (a gone price, a bad
286
+ signature). A resend's 401, 403 or 429, which the venue checks before the
287
+ replay, and a 5xx or an answer cut off mid-body, no longer discard the
288
+ bridge: the SDK reads the acceptance and moves the bridge from what it finds. If that read fails too, the bridge stays unsent
289
+ and the error reports `mayStillRun: true`, with `resend()`, so recovery
290
+ decides after re-authenticating.
291
+ - `recoverAcceptance` works without a signer: it checks the record's account
292
+ against the session's wallet (`GET /v1/me`), since recovery signs nothing.
293
+
294
+ ## 0.68.0
295
+
296
+ Every expired operation names why (TT-2315). Generated from contract
297
+ `165.0.0-expiry-reasons`; an older venue simply sends fewer reasons.
298
+
299
+ ### Changed
300
+
301
+ - `OperationFailureReason` adds `DEADLINE_BEFORE_CLAIM`,
302
+ `AUTHORIZATION_TOO_CLOSE`, `SIGNER_QUOTE_LIFE`, `SIMULATION_REVERTED`,
303
+ `QUARANTINE_EXPIRED` and `ATTESTATION_EXPIRED`. An operation's
304
+ `failure_reason`, and `OPERATION_UPDATED`'s, can carry any of them on
305
+ `EXPIRED_UNEXECUTED`.
306
+ - `entryFailure` returns the operation's own reason for every reason but
307
+ `INSUFFICIENT_CASH`, which it still words as `INSUFFICIENT_CASH` or
308
+ `CORE_MOVE_MISSED`. `EntryFailure` widens to match: code that handles it
309
+ exhaustively needs a case for each new reason.
310
+
311
+ ## 0.67.0
312
+
313
+ Taker flow fixes (TT-2268). Additive: 0.66 code runs unchanged.
314
+
315
+ ### Added
316
+
317
+ - `bestBid(minLifeSeconds, minPrice)`: an optional price floor in USDC base
318
+ units; no bid below it is chosen.
319
+ - `RetryPolicy.maxRetryAfterMs` (default 30 s). A BACKOFF answer whose
320
+ Retry-After is longer is no longer waited out: the call throws at once, for
321
+ example `RATE_LIMITED`, with `retryAfterMs` set.
322
+ - `StreamClosedError.commandSent` and `TotalisStream.closeError()`.
323
+
324
+ ### Changed
325
+
326
+ - A follow cut off by a stream closed for good rejects with the server's
327
+ close reason (for example `STREAM_REPLACED`), not a generic `closed`. When
328
+ it follows a command already sent (`waitForOperation`, `waitForCoreExit`,
329
+ `sendWithdrawal`, `waitForWithdrawal`), the error has `commandSent` and
330
+ `normalizeError` reports `mayStillRun: true`.
331
+ - An `AcceptanceResult`'s `bridged` reads the bridge as it stands now, so it
332
+ turns `landed: "yes"` once Hyperliquid answers `ok`, and reads undefined
333
+ once a bridge is refused or discarded unsent.
334
+ - `openPosition` takes and signs a fresh quote once when the accept is
335
+ refused with `QUOTE_EXPIRED` or `QUOTE_REPLACED`; `onSigned` gets the new
336
+ record. A second refusal, or no fresh quote within `quoteTimeoutMs`, throws
337
+ the refusal.
338
+ - Deposit, withdrawal and exit signing windows are set on the venue clock the
339
+ stream tracks once it has synced. Signing never waits for the stream, so a
340
+ window signed on a fresh instance before its first sync uses the device
341
+ clock; start the stream first on devices whose clock may be off.
342
+ - Documented that an acceptance read after the trade settled, for example by
343
+ `recoverAcceptance`, can be `FILLED` or `FAILED`, both with `operationId`.
344
+
345
+ ## 0.66.1
346
+
347
+ Combos close at a market's admission cutoff (TT-2271). No type changes.
348
+
349
+ ### Changed
350
+
351
+ - `combo` is `CLOSED` with `OUTSIDE_WINDOW` and a null `opens_at` once a
352
+ market's result can be known: a price market from its observation time, a
353
+ policy rate from its scheduled decision. A sports game stays open in play
354
+ until its resolution backstop. RFQs refuse such legs as before.
355
+
356
+ ## 0.66.0
357
+
358
+ A lighter HyperCore read for Cash (TT-2277). Additive: 0.65 code runs unchanged.
359
+
360
+ ### Added
361
+
362
+ - `GET /v1/hypercore/balance` returns the session account's HyperCore spot
363
+ USDC, perps cash, account mode and HIP-4 positions in one read, on mainnet
364
+ and testnet. It reads no orders or fill history, so it answers even when
365
+ the portfolio's fill history is unavailable.
366
+ - HyperCore funding (`/v1/hypercore/portfolio` and the new route) carries
367
+ `spot_usdc_total` and `spot_usdc_hold`; `spot_usdc` stays total minus hold.
6
368
  ## 0.65.2
7
369
 
8
370
  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" | "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" | "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.