@totalis/hip4-client 0.124.0 → 0.126.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +389 -0
  2. package/README.md +9 -5
  3. package/dist/api-keys.d.ts +21 -2
  4. package/dist/api-keys.js +12 -10
  5. package/dist/audience-contract.d.ts +1 -2
  6. package/dist/client.d.ts +1 -1
  7. package/dist/client.js +1 -1
  8. package/dist/flow-errors.d.ts +1 -1
  9. package/dist/flow-errors.js +1 -1
  10. package/dist/generated/account-read.d.ts +150 -126
  11. package/dist/generated/api-keys.d.ts +19 -10
  12. package/dist/generated/browse.d.ts +12 -12
  13. package/dist/generated/client.d.ts +5 -2
  14. package/dist/generated/errors.d.ts +15 -8
  15. package/dist/generated/errors.js +47 -35
  16. package/dist/generated/maker.d.ts +3 -4
  17. package/dist/generated/openapi.d.ts +833 -893
  18. package/dist/generated/realtime.d.ts +66 -93
  19. package/dist/generated/vault-abi.d.ts +57 -0
  20. package/dist/generated/vault-abi.js +77 -0
  21. package/dist/generated/version.d.ts +16 -16
  22. package/dist/generated/version.js +20 -18
  23. package/dist/maker.d.ts +134 -54
  24. package/dist/maker.js +257 -147
  25. package/dist/money.d.ts +8 -6
  26. package/dist/money.js +7 -7
  27. package/dist/partner.d.ts +2 -0
  28. package/dist/partner.js +2 -1
  29. package/dist/request.d.ts +11 -2
  30. package/dist/request.js +7 -2
  31. package/dist/totalis.d.ts +147 -232
  32. package/dist/totalis.js +290 -269
  33. package/dist/typed-data.d.ts +6 -0
  34. package/dist/typed-data.js +8 -0
  35. package/dist/ui.d.ts +6 -10
  36. package/dist/ui.js +15 -13
  37. package/dist/vault-reads.d.ts +46 -0
  38. package/dist/vault-reads.js +72 -0
  39. package/examples/browser-wallet.mjs +1 -1
  40. package/examples/node-bot.mjs +15 -12
  41. package/package.json +1 -1
package/dist/totalis.d.ts CHANGED
@@ -19,9 +19,12 @@ type Ok<P extends keyof paths, M extends keyof paths[P], S extends number = 200>
19
19
  export type RequestOf<Paths, P extends keyof Paths, M extends keyof Paths[P]> = Paths[P][M] extends {
20
20
  readonly requestBody?: infer B;
21
21
  } ? Json<NonNullable<B>> : never;
22
+ /** `GET /v1/markets` filters for `listMarkets`: `combo`, `eligibility`, `category` and `subcategory`. */
23
+ export type MarketFilters = Omit<NonNullable<paths["/v1/markets"]["get"]["parameters"]["query"]>, "cursor" | "limit">;
24
+ /** One market row of `GET /v1/markets`. */
25
+ export type MarketRow = Ok<"/v1/markets", "get">["items"][number];
22
26
  type CommandOf<P extends keyof paths, M extends keyof paths[P] = "post" & keyof paths[P]> = RequestOf<paths, P, M>;
23
27
  type AcceptCommand = CommandOf<"/v1/quotes/{quote_id}/accept">;
24
- type Funding = NonNullable<AcceptCommand["funding"]>;
25
28
  type CoreExitRequest = {
26
29
  readonly amount: Amount;
27
30
  readonly purpose?: "ORDER" | "WITHDRAW";
@@ -29,7 +32,7 @@ type CoreExitRequest = {
29
32
  readonly activationFeeAccepted?: boolean;
30
33
  };
31
34
  export type Deployment = Ok<"/v1/deployment", "get">;
32
- /** One live unsigned quote, told apart by `kind`: `ENTRY` (`entry`) or `SELL_BACK` (`sell_back`). */
35
+ /** One live unsigned quote, told apart by `kind`: `ENTRY` (`payout`) or `SELL_BACK` (`price`), with the terms it signs under `signing`. */
33
36
  export type Quote = Ok<"/v1/rfqs/{rfq_id}/quotes", "get">["quotes"][number];
34
37
  export type EntryQuote = Extract<Quote, {
35
38
  readonly kind: "ENTRY";
@@ -42,6 +45,9 @@ export type SellBackQuote = Extract<Quote, {
42
45
  /** A cash-out quote: a sell-back by the maker that backs the position. */
43
46
  export type CashoutBid = SellBackQuote;
44
47
  export type Acceptance = Ok<"/v1/quotes/{quote_id}/acceptance", "get">;
48
+ /** The accept's own answer: only what the accept did not send (status, acceptance_id, operation_id, reason). */
49
+ export type AcceptAnswer = Ok<"/v1/quotes/{quote_id}/accept", "post">;
50
+ export type AcceptOutcome = Acceptance | AcceptAnswer | NotAdmitted;
45
51
  /** An accept whose response was lost and that the venue never admitted: cancel fenced the RFQ first. Nothing traded. */
46
52
  export type NotAdmitted = {
47
53
  readonly status: "NOT_ADMITTED";
@@ -57,7 +63,7 @@ export type WalletCall = {
57
63
  readonly data: Hex;
58
64
  };
59
65
  /** One leg of a combo: a decimal `outcome_id` and the side, YES or NO. */
60
- export type Leg = EntryQuote["entry"]["legs"][number];
66
+ export type Leg = EntryQuote["signing"]["entry"]["legs"][number];
61
67
  /** Money is integer USDC base units (6 decimals), as a bigint or decimal string. */
62
68
  export type Amount = bigint | string;
63
69
  /** The cash an entry is planned from, as `spendableCash` reads it: free vault cash and available wallet USDC, `null` where unknown. */
@@ -68,7 +74,7 @@ export type EntryCash = {
68
74
  export type DepositAccepted = Ok<"/v1/me/deposits", "post", 202>;
69
75
  /** The account wallet's USDC approval to WalletAccept and its permit nonce, read at one block (`readWalletApproval`); `approved`, `nonce` and `block` are `null` when unread, never 0. */
70
76
  export type WalletApproval = Ok<"/v1/me/wallet-approval", "get">;
71
- /** A permit request as the venue holds it: its operation's status, and `failure_reason` once it changed nothing. */
77
+ /** A permit request as the venue holds it: its operation's status, and `reason` once it changed nothing. */
72
78
  export type WalletApprovalRequest = Ok<"/v1/me/wallet-approval", "post", 202>;
73
79
  /**
74
80
  * A signed USDC permit setting the account wallet's approval to WalletAccept,
@@ -96,12 +102,6 @@ export type LandedWalletApproval = {
96
102
  export type KnownWalletApproval = WalletApproval | LandedWalletApproval;
97
103
  /** Awaited with a signed permit before it is first sent; persist it to recover. */
98
104
  export type ApprovalListener = (record: SignedWalletApproval) => void | Promise<void>;
99
- /**
100
- * Where an entry's shortfall comes from: `"wallet"` (default) signs a USDC
101
- * authorization for it; `"approval"` draws it from the wallet's approval to
102
- * WalletAccept, asking a permit only when the approval left is short.
103
- */
104
- export type EntryFunding = "wallet" | "approval";
105
105
  /** The approval asked when the approval left falls short: 10,000 USDC, or the shortfall when it is larger. */
106
106
  export declare const defaultWalletApproval = 10000000000n;
107
107
  /**
@@ -142,7 +142,7 @@ export type BridgeState = "SENT" | "LANDED" | "PROCESSED" | "REFUSED" | "DISCARD
142
142
  * A signed Combo entry, plain JSON. Persist it before `sendAcceptance`: after
143
143
  * a lost answer or a restart, `recoverAcceptance` finishes it without signing
144
144
  * again. `bridge` is the Core to HyperEVM `sendAsset`, sent only once the
145
- * acceptance is `ACCEPTED` and before its `fund_by`; it lands at most once.
145
+ * acceptance is `ACCEPTED`, within `fundWindowMs` of sending the accept; it lands at most once.
146
146
  * `onRecord` hands back the record with each new `bridgeState`: persist it
147
147
  * over this one.
148
148
  */
@@ -155,25 +155,25 @@ export type SignedEntry = RecordScope & {
155
155
  readonly bridge?: SignedSendAsset;
156
156
  readonly bridgeState?: BridgeState;
157
157
  /**
158
- * Set when the venue refused this accept outright (`QUOTE_REPLACED`,
159
- * `QUOTE_EXPIRED`): nothing was admitted, so `recoverAcceptance` answers
158
+ * Set when the venue refused this accept outright because the quote was
159
+ * gone (`QUOTE_REPLACED`, `QUOTE_EXPIRED`): nothing was admitted, so `recoverAcceptance` answers
160
160
  * `NOT_ADMITTED` without reading or cancelling the RFQ, which a later
161
161
  * attempt may be using.
162
162
  */
163
163
  readonly refused?: string;
164
164
  };
165
165
  /**
166
- * An entry's funding, signed before its quote is chosen
167
- * (`prepareEntryFunding`). Pass it to `signEntry` as `prepared`, so only the
168
- * quote is left to sign once it is chosen. It funds one accept: prepare again
169
- * for another.
166
+ * An entry's funding, made ready before its quote is chosen
167
+ * (`prepareEntryFunding`): an approval that covers the wallet's part, and any
168
+ * signed bridge from HyperCore. Pass it to `signEntry` as `prepared`, so only
169
+ * the quote is left to sign once it is chosen. Its bridge funds one accept:
170
+ * prepare again for another once it was sent.
170
171
  */
171
172
  export type PreparedEntryFunding = {
172
173
  readonly stake: string;
173
174
  readonly account: Hex;
174
175
  readonly chainId: string;
175
176
  readonly vault: Hex;
176
- readonly funding?: Funding;
177
177
  readonly bridge?: SignedSendAsset;
178
178
  };
179
179
  /** An entry record from SDK 0.63 or older, which sent its bridge before the accept: `recoverAcceptance` reads it and sends nothing, and `sendAcceptance` refuses it. */
@@ -190,7 +190,7 @@ export type RecordListener = (record: SignedEntry) => void | Promise<void>;
190
190
  /**
191
191
  * Where an acceptance ended. `ACCEPTED` carries `operationId`; so do
192
192
  * `FILLED` (it committed) and `FAILED` (it reverted or expired unexecuted;
193
- * the operation's `failure_reason` says why when it is known), which a later read, such as
193
+ * the operation's `reason` says why when it is known), which a later read, such as
194
194
  * `recoverAcceptance`'s, can return. `NOT_ADMITTED` means the venue never
195
195
  * took the accept and nothing traded. `bridged` is set
196
196
  * for an entry whose bridge was sent: unless its operation `COMMITTED`, that
@@ -203,14 +203,14 @@ export type AcceptanceResult = {
203
203
  readonly quoteId: string;
204
204
  /** An entry's position is named by its quote. */
205
205
  readonly positionId: string;
206
- readonly status: (Acceptance | NotAdmitted)["status"];
206
+ readonly status: AcceptOutcome["status"];
207
207
  readonly operationId: string | undefined;
208
- readonly outcome: Acceptance | NotAdmitted;
208
+ readonly outcome: AcceptOutcome;
209
209
  /** Read as the bridge stands now: `landed` turns `yes` once Hyperliquid's `ok` is recorded, and a bridge refused or discarded unsent reads undefined. */
210
210
  readonly bridged?: BridgedCash;
211
211
  /**
212
212
  * Hyperliquid's answer to the bridge, once `onRecord` has recorded it;
213
- * `unknown` when none came before `fund_by`. Rejects with `onRecord`'s
213
+ * `unknown` when none came within `fundWindowMs` of the accept. Rejects with `onRecord`'s
214
214
  * error; when that was the record before the first send, nothing was sent.
215
215
  */
216
216
  readonly bridging?: Promise<HypercoreAnswer>;
@@ -222,36 +222,39 @@ export type AcceptanceResult = {
222
222
  * `CORE_MOVE_MISSED`: it fell short with Core cash planned to cover it that
223
223
  * Hyperliquid never confirmed moving in time (never sent, discarded, refused,
224
224
  * or sent without an `ok`); that cash is on HyperCore or, if `bridged`, in
225
- * the wallet. Any other value is the operation's own `failure_reason`, such as
225
+ * the wallet. Any other value is the operation's own `reason`, such as
226
226
  * `DEADLINE_BEFORE_CLAIM` when the venue reached it too late; nothing traded
227
227
  * and its cash stayed where it was.
228
228
  */
229
- export type EntryFailure = "CORE_MOVE_MISSED" | "INSUFFICIENT_APPROVAL" | NonNullable<Operation["failure_reason"]>;
229
+ export type EntryFailure = "CORE_MOVE_MISSED" | "INSUFFICIENT_APPROVAL" | NonNullable<Operation["reason"]>;
230
230
  /**
231
231
  * An entry's `EntryFailure`; undefined unless its operation ended with a
232
- * `failure_reason`. Pass the record as `onRecord` last handed it back (or
233
- * `openPosition`'s `record`): only `LANDED` shows the Core cash moved before
234
- * `fund_by`. `PROCESSED` only says the nonce is spent, which a refused or
235
- * expired send also does, so it does not show the move. For a `"approval"`
236
- * entry pass its acceptance too (`outcome`): `INSUFFICIENT_APPROVAL` when the
237
- * wallet's approval to WalletAccept was below the shortfall.
232
+ * `reason`. Pass the record as `onRecord` last handed it back (or
233
+ * `openPosition`'s `record`): only `LANDED` shows the Core cash moved in
234
+ * time. `PROCESSED` only says the nonce is spent, which a refused or
235
+ * expired send also does, so it does not show the move. For an entry the
236
+ * wallet funds pass its acceptance too (`outcome`): `INSUFFICIENT_APPROVAL`
237
+ * when the wallet's approval to WalletAccept was below the shortfall.
238
238
  */
239
- export declare function entryFailure(record: SignedEntry | LegacySignedEntry, operation: Pick<Operation, "failure_reason">, acceptance?: Acceptance | NotAdmitted): EntryFailure | undefined;
240
- /** When an entry quote stops being acceptable, in ms on the venue clock: its `accept_before`. A quote without a readable one never is. */
241
- export declare function acceptBefore(quote: EntryQuote): number;
239
+ export declare function entryFailure(record: SignedEntry | LegacySignedEntry, operation: Pick<Operation, "reason">, acceptance?: AcceptOutcome): EntryFailure | undefined;
242
240
  /**
243
- * Chooses among current offers; return undefined to wait for the quotes to
244
- * change. `serverNowMs` is the venue clock. It is called on every change and
245
- * may be asked about a later time, so it must depend only on its arguments.
241
+ * How long after sending an accept its bridge from HyperCore may still go.
242
+ * An accept that draws the wallet waits at least six seconds from its arrival
243
+ * for wallet USDC still landing, and it arrives after it was sent, so a bridge
244
+ * sent within four seconds of the send keeps two to land, however long the
245
+ * maker or the answer took. A bridge never goes later: that cash would reach
246
+ * the wallet after the trade gave up on it.
246
247
  */
247
- export type Chooser<Offer> = (offers: readonly Offer[], serverNowMs: number) => Offer | undefined;
248
- /** The highest payout among quotes still before their `accept_before` (ties go to the earliest). */
249
- export declare function bestQuote(): Chooser<EntryQuote>;
248
+ export declare const fundWindowMs = 4000;
250
249
  /**
251
- * The highest price with at least `minLifeSeconds` left (execution needs 20 s
252
- * after confirmation) and, given `minPrice` in USDC base units, no lower than it.
250
+ * Chooses among the offers on the book; return undefined to wait for them to
251
+ * change. It is called on every change, so it must depend only on its argument.
253
252
  */
254
- export declare function bestBid(minLifeSeconds?: number, minPrice?: bigint): Chooser<CashoutBid>;
253
+ export type Chooser<Offer> = (offers: readonly Offer[]) => Offer | undefined;
254
+ /** The highest payout (ties go to the earliest). */
255
+ export declare function bestQuote(): Chooser<EntryQuote>;
256
+ /** The highest price and, given `minPrice` in USDC base units, no lower than it. */
257
+ export declare function bestBid(minPrice?: bigint): Chooser<CashoutBid>;
255
258
  export type TotalisOptions = Omit<ApiClientOptions, "accessToken"> & {
256
259
  readonly environment: PublicEnvironment;
257
260
  /** The WebSocket origin for the stream. Defaults to `baseUrl` if set, else the environment's stream host (`wss://hip4-ws.totalis.trade` in production). */
@@ -272,8 +275,8 @@ export type TotalisOptions = Omit<ApiClientOptions, "accessToken"> & {
272
275
  /** Stream options; `subscription` adds account subscription fields such as `open_rfqs`. */
273
276
  readonly stream?: Omit<StreamOptions, "subscription" | "accessToken" | "environment" | "baseUrl" | "streamBaseUrl"> & {
274
277
  readonly subscription?: Omit<Extract<StreamSubscription, {
275
- readonly type: "account";
276
- }>, "type">;
278
+ readonly kind: "account";
279
+ }>, "kind">;
277
280
  };
278
281
  };
279
282
  /** The operation statuses that never change again; only COMMITTED executed. */
@@ -313,6 +316,7 @@ export declare function createTotalis(options: TotalisOptions): {
313
316
  };
314
317
  };
315
318
  }>;
319
+ listMarkets: (filters?: MarketFilters, limit?: number) => AsyncGenerator<MarketRow, void>;
316
320
  /** Spendable Totalis cash from a fresh balances read (`spendableCash`): `{ vault, wallet, total }`, each `null` while unknown, never 0. */
317
321
  spendableCash: (signal?: AbortSignal) => Promise<{
318
322
  readonly vault: bigint | null;
@@ -322,7 +326,7 @@ export declare function createTotalis(options: TotalisOptions): {
322
326
  /** What the account holds at Totalis, every amount read at one block (`GET /v1/me/account-value`). */
323
327
  accountValue: (signal?: AbortSignal) => Promise<{
324
328
  readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
325
- readonly state: "CURRENT" | "UNKNOWN";
329
+ readonly freshness: "CURRENT" | "UNKNOWN";
326
330
  readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"] | null;
327
331
  readonly block_number: import("./generated/openapi.js").components["schemas"]["UInt64String"] | null;
328
332
  readonly wallet_usdc: import("./generated/openapi.js").components["schemas"]["$defs-Amount"] | null;
@@ -333,7 +337,7 @@ export declare function createTotalis(options: TotalisOptions): {
333
337
  readonly claimable_profit: import("./generated/openapi.js").components["schemas"]["$defs-Amount"] | null;
334
338
  readonly checkpoint: {
335
339
  readonly block_number: import("./generated/openapi.js").components["schemas"]["UInt64String"];
336
- readonly projection_state: "CURRENT" | "STALE";
340
+ readonly freshness: "CURRENT" | "STALE";
337
341
  };
338
342
  }>;
339
343
  readComboCash: (options?: {
@@ -343,22 +347,25 @@ export declare function createTotalis(options: TotalisOptions): {
343
347
  openPosition: (request: {
344
348
  readonly legs: readonly Leg[];
345
349
  readonly stake: Amount;
350
+ /**
351
+ * The partner builder code (create RFQ's `builder_code`): credits the
352
+ * partner whose app sent the RFQ with its revenue share, at no cost to the
353
+ * taker. It counts from an account the partner admitted, or from a
354
+ * browser on the code's registered origin.
355
+ */
356
+ readonly builderCode?: string;
346
357
  readonly choose?: Chooser<EntryQuote>;
347
358
  /** How long quotes may keep arriving after the first one `choose` would take, before it picks; 0 takes it at once. Time spent signing the funding counts. */
348
359
  readonly collectMs?: number;
360
+ /** A `WalletApproval` just read, or a permit request that just landed, used instead of reading the approval again (see `prepareEntryFunding`). */
361
+ readonly approval?: KnownWalletApproval;
349
362
  /**
350
- * `"wallet"` (default) plans the shortfall from the wallet and `core`
351
- * with a USDC authorization; `"approval"` plans it the same way but draws
352
- * the wallet's part from its approval to WalletAccept (`prepareEntryFunding`),
353
- * reusing it, and an unsent bridge's exact bytes, on each refresh;
354
- * `"none"` never funds; or pass a funding command.
363
+ * The approval a permit asks when the approval left is short of the
364
+ * wallet's part, or `null` to never ask one (see `prepareEntryFunding`):
365
+ * approve once, and later entries need no permit.
355
366
  */
356
- readonly funding?: EntryFunding | "none" | Funding;
357
- /** With `"approval"`: a `WalletApproval` just read, or a permit request that just landed, used instead of reading the approval again (see `prepareEntryFunding`). */
358
- readonly approval?: KnownWalletApproval;
359
- /** With `"approval"`: the approval a permit asks when one is needed, or `null` to never ask one (see `prepareEntryFunding`). */
360
367
  readonly approvalValue?: Amount | null;
361
- /** With `"approval"`: awaited with a permit before it is first sent; persist it to `recoverWalletApproval`. */
368
+ /** Awaited with a permit before it is first sent; persist it to `recoverWalletApproval`. */
362
369
  readonly onApproval?: ApprovalListener;
363
370
  /** Core USDC offered for a bridge, in USDC base units; `null` when unread (see `signEntry`). */
364
371
  readonly core?: Amount | null;
@@ -368,16 +375,9 @@ export declare function createTotalis(options: TotalisOptions): {
368
375
  readonly cash?: EntryCash;
369
376
  /** Awaited with the signed record before anything is sent, then with each change to its bridge (`onRecord`) or its refusal: persist it to `recoverAcceptance` after a restart. */
370
377
  readonly onSigned?: RecordListener;
371
- /** Automatic-quote intent identity, as the Totalis app sends it. */
372
- readonly intent?: {
373
- readonly intent_id: string;
374
- readonly intent_generation: string;
375
- };
376
378
  readonly quoteTimeoutMs?: number;
377
379
  /** The least payout a quote may pay, in USDC base units. Left out, it is the first chosen quote's: a refresh never takes less. */
378
380
  readonly minPayout?: Amount;
379
- /** How long after the first quote is chosen a refused, declined or timed-out accept may still be followed by another (default 10 s). */
380
- readonly refreshMs?: number;
381
381
  /** The most accepts sent, the first included (default 4); 1 never refreshes. */
382
382
  readonly maxAttempts?: number;
383
383
  readonly signal?: AbortSignal;
@@ -399,9 +399,9 @@ export declare function createTotalis(options: TotalisOptions): {
399
399
  rfqId: string;
400
400
  quoteId: string;
401
401
  positionId: string;
402
- status: (Acceptance | NotAdmitted)["status"];
402
+ status: AcceptOutcome["status"];
403
403
  operationId: string | undefined;
404
- outcome: Acceptance | NotAdmitted;
404
+ outcome: AcceptOutcome;
405
405
  bridging?: Promise<HypercoreAnswer>;
406
406
  }>;
407
407
  cashOut: (request: {
@@ -411,6 +411,8 @@ export declare function createTotalis(options: TotalisOptions): {
411
411
  readonly collectMs?: number;
412
412
  readonly onSigned?: (signed: SignedCashout) => void | Promise<void>;
413
413
  readonly quoteTimeoutMs?: number;
414
+ /** The most accepts sent, the first included (default 4); 1 never takes another bid. */
415
+ readonly maxAttempts?: number;
414
416
  readonly signal?: AbortSignal;
415
417
  }) => Promise<AcceptanceResult>;
416
418
  prepareEntryFunding: (request: {
@@ -419,8 +421,7 @@ export declare function createTotalis(options: TotalisOptions): {
419
421
  readonly cash?: EntryCash | undefined;
420
422
  readonly sourceDex?: "spot" | "" | undefined;
421
423
  readonly hypercoreNonce?: number | undefined;
422
- readonly funding?: EntryFunding | undefined;
423
- /** With `"approval"`: a `WalletApproval` just read, or a permit this client signed with its landed request, used instead of reading the approval again; it must be this wallet's, on this deployment, for its USDC. */
424
+ /** A `WalletApproval` just read, or a permit this client signed with its landed request, used instead of reading the approval again; it must be this wallet's, on this deployment, for its USDC. */
424
425
  readonly approval?: KnownWalletApproval | undefined;
425
426
  /** The approval a permit asks when one is needed; default the larger of `defaultWalletApproval` and the shortfall; `null` never asks one. */
426
427
  readonly approvalValue?: Amount | null | undefined;
@@ -435,7 +436,6 @@ export declare function createTotalis(options: TotalisOptions): {
435
436
  readonly acceptanceId?: string;
436
437
  readonly hypercoreNonce?: number;
437
438
  readonly prepared?: PreparedEntryFunding;
438
- readonly funding?: EntryFunding;
439
439
  }) => Promise<SignedEntry>;
440
440
  signCashout: (request: {
441
441
  readonly quote: CashoutBid;
@@ -500,19 +500,12 @@ export declare function createTotalis(options: TotalisOptions): {
500
500
  exitId: string;
501
501
  account: `0x${string}`;
502
502
  body: {
503
- readonly schema_version: 1;
504
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
505
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
506
- readonly command: {
507
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
508
- readonly to: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
509
- readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
510
- readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
511
- readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
512
- readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
513
- readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
514
- readonly activation_fee_accepted?: boolean;
515
- };
503
+ readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
504
+ readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
505
+ readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
506
+ readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
507
+ readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
508
+ readonly activation_fee_accepted?: boolean;
516
509
  };
517
510
  }>;
518
511
  signRunOffClaim: (request: {
@@ -522,18 +515,11 @@ export declare function createTotalis(options: TotalisOptions): {
522
515
  claimId: string;
523
516
  account: `0x${string}`;
524
517
  body: {
525
- readonly schema_version: 1;
526
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
527
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
528
- readonly command: {
529
- readonly vault_address: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
530
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
531
- readonly to: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
532
- readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
533
- readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
534
- readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
535
- readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
536
- };
518
+ readonly vault_address: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
519
+ readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
520
+ readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
521
+ readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
522
+ readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
537
523
  };
538
524
  }>;
539
525
  sendRunOffClaim: (signed: Awaited<ReturnType<(request: {
@@ -543,18 +529,11 @@ export declare function createTotalis(options: TotalisOptions): {
543
529
  claimId: string;
544
530
  account: `0x${string}`;
545
531
  body: {
546
- readonly schema_version: 1;
547
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
548
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
549
- readonly command: {
550
- readonly vault_address: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
551
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
552
- readonly to: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
553
- readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
554
- readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
555
- readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
556
- readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
557
- };
532
+ readonly vault_address: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
533
+ readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
534
+ readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
535
+ readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
536
+ readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
558
537
  };
559
538
  }>>>) => Promise<{
560
539
  readonly vault_address: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
@@ -564,7 +543,7 @@ export declare function createTotalis(options: TotalisOptions): {
564
543
  readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"] | null;
565
544
  readonly status: import("./generated/openapi.js").components["schemas"]["OperationState"];
566
545
  readonly transaction_hash: import("./generated/openapi.js").components["schemas"]["Bytes32"] | null;
567
- readonly failure_reason?: import("./generated/openapi.js").components["schemas"]["OperationFailureReason"];
546
+ readonly reason?: import("./generated/openapi.js").components["schemas"]["OperationFailureReason"];
568
547
  readonly created_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
569
548
  readonly updated_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
570
549
  };
@@ -573,41 +552,33 @@ export declare function createTotalis(options: TotalisOptions): {
573
552
  exitId: string;
574
553
  account: `0x${string}`;
575
554
  body: {
576
- readonly schema_version: 1;
577
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
578
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
579
- readonly command: {
580
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
581
- readonly to: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
582
- readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
583
- readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
584
- readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
585
- readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
586
- readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
587
- readonly activation_fee_accepted?: boolean;
588
- };
555
+ readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
556
+ readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
557
+ readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
558
+ readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
559
+ readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
560
+ readonly activation_fee_accepted?: boolean;
589
561
  };
590
562
  }) => Promise<CoreExit>;
591
563
  exitToCore: (request: Parameters<(request: CoreExitRequest) => Promise<{
592
564
  exitId: string;
593
565
  account: `0x${string}`;
594
566
  body: {
595
- readonly schema_version: 1;
596
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
597
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
598
- readonly command: {
599
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
600
- readonly to: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
601
- readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
602
- readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
603
- readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
604
- readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
605
- readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
606
- readonly activation_fee_accepted?: boolean;
607
- };
567
+ readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
568
+ readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
569
+ readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
570
+ readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
571
+ readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
572
+ readonly activation_fee_accepted?: boolean;
608
573
  };
609
574
  }>>[0]) => Promise<CoreExit>;
610
575
  waitForCoreExit: (exitId: string, signal?: AbortSignal) => Promise<CoreExit>;
576
+ deposit: (request: {
577
+ readonly amount: Amount;
578
+ /** Awaited once the venue admits the deposit: persist the ID to `waitForOperation` after a restart. */
579
+ readonly onStarted?: (operationId: string) => void | Promise<void>;
580
+ readonly signal?: AbortSignal;
581
+ }) => Promise<Operation>;
611
582
  signDeposit: (request: {
612
583
  readonly amount: Amount;
613
584
  readonly depositId?: string;
@@ -615,36 +586,22 @@ export declare function createTotalis(options: TotalisOptions): {
615
586
  depositId: string;
616
587
  account: `0x${string}`;
617
588
  body: {
618
- readonly schema_version: 1;
619
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
620
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
621
- readonly command: {
622
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
623
- readonly from: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
624
- readonly value: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
625
- readonly valid_after: import("./generated/openapi.js").components["schemas"]["UInt64String"];
626
- readonly valid_before: import("./generated/openapi.js").components["schemas"]["UInt64String"];
627
- readonly salt: import("./generated/openapi.js").components["schemas"]["Bytes32"];
628
- readonly authorization_signature: import("./generated/openapi.js").components["schemas"]["Signature65"];
629
- };
589
+ authorization_signature: `0x${string}`;
590
+ valid_after: string;
591
+ valid_before: string;
592
+ salt: `0x${string}`;
593
+ amount: string;
630
594
  };
631
595
  }>;
632
596
  sendDeposit: (signed: {
633
597
  depositId: string;
634
598
  account: `0x${string}`;
635
599
  body: {
636
- readonly schema_version: 1;
637
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
638
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
639
- readonly command: {
640
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
641
- readonly from: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
642
- readonly value: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
643
- readonly valid_after: import("./generated/openapi.js").components["schemas"]["UInt64String"];
644
- readonly valid_before: import("./generated/openapi.js").components["schemas"]["UInt64String"];
645
- readonly salt: import("./generated/openapi.js").components["schemas"]["Bytes32"];
646
- readonly authorization_signature: import("./generated/openapi.js").components["schemas"]["Signature65"];
647
- };
600
+ authorization_signature: `0x${string}`;
601
+ valid_after: string;
602
+ valid_before: string;
603
+ salt: `0x${string}`;
604
+ amount: string;
648
605
  };
649
606
  }) => Promise<DepositAccepted>;
650
607
  signReturnToCore: (request?: {
@@ -657,37 +614,23 @@ export declare function createTotalis(options: TotalisOptions): {
657
614
  exitId: string;
658
615
  account: `0x${string}`;
659
616
  body: {
660
- readonly schema_version: 1;
661
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
662
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
663
- readonly command: {
664
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
665
- readonly to: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
666
- readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
667
- readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
668
- readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
669
- readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
670
- readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
671
- readonly activation_fee_accepted?: boolean;
672
- };
617
+ readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
618
+ readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
619
+ readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
620
+ readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
621
+ readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
622
+ readonly activation_fee_accepted?: boolean;
673
623
  };
674
624
  };
675
625
  deposit?: {
676
626
  depositId: string;
677
627
  account: `0x${string}`;
678
628
  body: {
679
- readonly schema_version: 1;
680
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
681
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
682
- readonly command: {
683
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
684
- readonly from: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
685
- readonly value: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
686
- readonly valid_after: import("./generated/openapi.js").components["schemas"]["UInt64String"];
687
- readonly valid_before: import("./generated/openapi.js").components["schemas"]["UInt64String"];
688
- readonly salt: import("./generated/openapi.js").components["schemas"]["Bytes32"];
689
- readonly authorization_signature: import("./generated/openapi.js").components["schemas"]["Signature65"];
690
- };
629
+ authorization_signature: `0x${string}`;
630
+ valid_after: string;
631
+ valid_before: string;
632
+ salt: `0x${string}`;
633
+ amount: string;
691
634
  };
692
635
  };
693
636
  }>;
@@ -696,37 +639,23 @@ export declare function createTotalis(options: TotalisOptions): {
696
639
  exitId: string;
697
640
  account: `0x${string}`;
698
641
  body: {
699
- readonly schema_version: 1;
700
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
701
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
702
- readonly command: {
703
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
704
- readonly to: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
705
- readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
706
- readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
707
- readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
708
- readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
709
- readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
710
- readonly activation_fee_accepted?: boolean;
711
- };
642
+ readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
643
+ readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
644
+ readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
645
+ readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
646
+ readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
647
+ readonly activation_fee_accepted?: boolean;
712
648
  };
713
649
  };
714
650
  deposit?: {
715
651
  depositId: string;
716
652
  account: `0x${string}`;
717
653
  body: {
718
- readonly schema_version: 1;
719
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
720
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
721
- readonly command: {
722
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
723
- readonly from: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
724
- readonly value: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
725
- readonly valid_after: import("./generated/openapi.js").components["schemas"]["UInt64String"];
726
- readonly valid_before: import("./generated/openapi.js").components["schemas"]["UInt64String"];
727
- readonly salt: import("./generated/openapi.js").components["schemas"]["Bytes32"];
728
- readonly authorization_signature: import("./generated/openapi.js").components["schemas"]["Signature65"];
729
- };
654
+ authorization_signature: `0x${string}`;
655
+ valid_after: string;
656
+ valid_before: string;
657
+ salt: `0x${string}`;
658
+ amount: string;
730
659
  };
731
660
  };
732
661
  }, options?: {
@@ -742,37 +671,23 @@ export declare function createTotalis(options: TotalisOptions): {
742
671
  exitId: string;
743
672
  account: `0x${string}`;
744
673
  body: {
745
- readonly schema_version: 1;
746
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
747
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
748
- readonly command: {
749
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
750
- readonly to: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
751
- readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
752
- readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
753
- readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
754
- readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
755
- readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
756
- readonly activation_fee_accepted?: boolean;
757
- };
674
+ readonly amount: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
675
+ readonly expiry: import("./generated/openapi.js").components["schemas"]["UInt64String"];
676
+ readonly salt: import("./generated/openapi.js").components["schemas"]["Uint"];
677
+ readonly signature: import("./generated/openapi.js").components["schemas"]["ContractSignature"];
678
+ readonly purpose: "ORDER" | "WITHDRAW" | "SWEEP";
679
+ readonly activation_fee_accepted?: boolean;
758
680
  };
759
681
  };
760
682
  deposit?: {
761
683
  depositId: string;
762
684
  account: `0x${string}`;
763
685
  body: {
764
- readonly schema_version: 1;
765
- readonly request_id: import("./generated/openapi.js").components["schemas"]["Uuid"];
766
- readonly sent_at: import("./generated/openapi.js").components["schemas"]["$defs-Timestamp"];
767
- readonly command: {
768
- readonly account: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
769
- readonly from: import("./generated/openapi.js").components["schemas"]["LowercaseNonZeroAddress"];
770
- readonly value: import("./generated/openapi.js").components["schemas"]["$defs-Amount"];
771
- readonly valid_after: import("./generated/openapi.js").components["schemas"]["UInt64String"];
772
- readonly valid_before: import("./generated/openapi.js").components["schemas"]["UInt64String"];
773
- readonly salt: import("./generated/openapi.js").components["schemas"]["Bytes32"];
774
- readonly authorization_signature: import("./generated/openapi.js").components["schemas"]["Signature65"];
775
- };
686
+ authorization_signature: `0x${string}`;
687
+ valid_after: string;
688
+ valid_before: string;
689
+ salt: `0x${string}`;
690
+ amount: string;
776
691
  };
777
692
  };
778
693
  }>>[0] & {
@@ -822,7 +737,7 @@ export declare function createTotalis(options: TotalisOptions): {
822
737
  readonly signal?: AbortSignal;
823
738
  }) => Promise<WalletApprovalRequest>;
824
739
  /** Render an RFQ's live quotes (entry or cash-out) from the stream; `[]` while the stream is down. */
825
- watchQuotes: (rfqId: string, listener: (quotes: readonly Quote[], serverNowMs: number) => void) => () => void;
740
+ watchQuotes: (rfqId: string, listener: (quotes: readonly Quote[]) => void) => () => void;
826
741
  /** Issue a personal `ttk_` key; the signer must be the account wallet (embedded, or a wallet-only account's own). */
827
742
  issueApiKey: (request: Parameters<typeof issueApiKey>[2]) => Promise<{
828
743
  readonly key: {