@totalis/hip4-client 0.74.0 → 0.75.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,56 @@
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.75.0
7
+
8
+ Maker capital on the stream (TT-2584), a stream that cannot hang in
9
+ `connecting` (TT-2585), maker keys reading their own positions and
10
+ performance (TT-2583) and external wallets for embedded-wallet binding
11
+ (TT-2549). Generated from contract `204.0.0-maker-capital-stream`. Additive:
12
+ 0.74 code runs unchanged; a maker stream now sets `publication_freshness`
13
+ unless told not to.
14
+
15
+ ### Added
16
+
17
+ - A maker subscription can set `capital: true` (TT-2584). The stream then
18
+ emits `capital` with the maker's capital, the same body as
19
+ `GET /v1/makers/{maker_id}/capital`: once on subscribe, whenever it changes
20
+ (a fill, a hold or a vault change), and at least every 5 s. A bot keeps the
21
+ latest one instead of reading capital before it quotes; without one for
22
+ 15 s, read capital over HTTP. It needs `vault:read`. Contract
23
+ `204.0.0-maker-capital-stream`.
24
+ - `grantVaultAgent` (`POST /v1/me/vault-agents`): relay the account's signed
25
+ `AgentGrant` to a key one of its devices holds, or its revoke
26
+ (`valid_until: "0"`), so Combo accepts, cash-outs and Exits to the account's
27
+ own wallet or Core need no wallet prompt (TT-2550). Answers `202` with the
28
+ `setAgent` operation. Contract `205.0.0-device-vault-agents`.
29
+ - `getVaultAgents` (`GET /v1/me/vault-agents`): the account's live vault
30
+ agents, each with `valid_until`, `nonce` and `copy_agent`, paged with
31
+ `cursor` and `limit`.
32
+
33
+ ### Changed
34
+
35
+ - A maker key with `vault:read` can now read its own maker's positions
36
+ (`/v1/makers/{maker_id}/positions` and a single position), exposure and
37
+ `getMakerPerformance` (TT-2583); before, only a dashboard session could.
38
+ Another maker's ID answers 404.
39
+
40
+ - `TotalisStream` no longer hangs in `connecting` (TT-2585). A connect that
41
+ has not subscribed within `connectTimeoutMs` (new, default 10000), including
42
+ while `accessToken` resolves, emits `error` and reconnects. A maker
43
+ subscription now defaults to `publication_freshness: true`, as an account
44
+ does, so its 1 s heartbeats keep the 5 s silence timeout armed; pass
45
+ `publication_freshness: false` for the old 15 s profile, which has no
46
+ watchdog once subscribed. A silent socket now also emits `error` before it
47
+ reconnects.
48
+
49
+ - `bindEmbeddedWallet` can make the Ethereum wallet a Privy user signed in
50
+ with the account's wallet (`wallet_kind: "EXTERNAL"`) when they have no
51
+ embedded wallet (TT-2549). An existing account keeps its wallet.
52
+ `operationErrors` adds `WALLET_CONTRACT_UNSUPPORTED` (422) for a smart
53
+ contract wallet. `SIGN_IN_REQUIRED` now refuses only a Privy user with no
54
+ Google, email, X or Ethereum wallet login, such as a Solana-only one.
55
+
6
56
  ## 0.74.0
7
57
 
8
58
  Execution admission (TT-1355) and a follower's copied Combos (TT-2486,
@@ -227,7 +227,7 @@ export type paths = {
227
227
  readonly path?: never;
228
228
  readonly cookie?: never;
229
229
  };
230
- /** @description Performance of this maker per period. Complete periods aggregate the positions that closed economically in them; incomplete periods return unavailable metrics. Gas stays unavailable until the payer of every transaction receipt is attributed. The credential selects the deployment, and access is checked against its current permissions on every request. The maker is always the one named in the path, never inferred from the caller's account. */
230
+ /** @description Get your maker's trading P&L per period between `from` and `through`. */
231
231
  readonly get: operations["getMakerPerformance"];
232
232
  readonly put?: never;
233
233
  readonly post?: never;
@@ -261,7 +261,7 @@ export type paths = {
261
261
  readonly path?: never;
262
262
  readonly cookie?: never;
263
263
  };
264
- /** @description This maker's open book by outcome at the vault projection checkpoint: per outcome its YES and NO exposure, gross and net, worst case and what offsetting saves, and what awaits settlement; book totals count each ticket once. Legs resolve as a position's do. Dashboard sessions only, like positions. */
264
+ /** @description This maker's open book by outcome at the vault projection checkpoint: per outcome its YES and NO exposure, gross and net, worst case and what offsetting saves, and what awaits settlement; book totals count each ticket once. Legs resolve as a position's do. A maker key reads only its own maker. */
265
265
  readonly get: operations["getMakerExposure"];
266
266
  readonly put?: never;
267
267
  readonly post?: never;
@@ -1848,7 +1848,7 @@ export interface operations {
1848
1848
  };
1849
1849
  readonly requestBody?: never;
1850
1850
  readonly responses: {
1851
- /** @description Scoped read with one freshness status; amounts are atomic USDC strings or null. No shared caching. */
1851
+ /** @description Complete periods aggregate the positions that closed economically in them; incomplete periods return unavailable metrics. Gas stays unavailable until the payer of every transaction receipt is attributed. Scoped read with one freshness status; amounts are atomic USDC strings or null. No shared caching. */
1852
1852
  readonly 200: {
1853
1853
  headers: {
1854
1854
  readonly "Cache-Control": components["headers"]["CacheControl"];
@@ -49,6 +49,7 @@ export type paths = {
49
49
  readonly "/v1/me/copy-agents": Pick<SharedPaths["/v1/me/copy-agents"], "parameters" | "get">;
50
50
  readonly "/v1/me/copy-agents/core": Pick<SharedPaths["/v1/me/copy-agents/core"], "parameters" | "post" | "delete">;
51
51
  readonly "/v1/me/copy-agents/combo": Pick<SharedPaths["/v1/me/copy-agents/combo"], "parameters" | "post" | "delete">;
52
+ readonly "/v1/me/vault-agents": Pick<SharedPaths["/v1/me/vault-agents"], "parameters" | "get" | "post">;
52
53
  readonly "/v1/me/copy-budget": Pick<SharedPaths["/v1/me/copy-budget"], "parameters" | "get" | "put">;
53
54
  readonly "/v1/me/copy-agents/combo/confirm": Pick<SharedPaths["/v1/me/copy-agents/combo/confirm"], "parameters" | "post">;
54
55
  readonly "/v1/me/copy-agents/combo/grant": Pick<SharedPaths["/v1/me/copy-agents/combo/grant"], "parameters" | "post">;
@@ -102,4 +103,4 @@ export type paths = {
102
103
  readonly "/v1/makers/{maker_id}/exposure": Pick<SharedPaths["/v1/makers/{maker_id}/exposure"], "parameters" | "get">;
103
104
  readonly "/v1/makers/{maker_id}/performance": Pick<SharedPaths["/v1/makers/{maker_id}/performance"], "parameters" | "get">;
104
105
  };
105
- export type operations = Pick<SharedOperations, "abandonCoreExit" | "acceptQuote" | "activeCoreExits" | "admitOwnMaker" | "admitPartnerWallet" | "bindEmbeddedWallet" | "cancelRfq" | "confirmComboCopyAgent" | "confirmCoreCopyAgent" | "createCashout" | "createComment" | "createCoreExit" | "createDeposit" | "createRfq" | "createRunOffClaim" | "createWalletChallenge" | "createWalletSession" | "createWithdrawal" | "deleteComment" | "editComment" | "endWalletSession" | "followTrader" | "getAcceptance" | "getAccountActivity" | "getAccountPnl" | "getAccountPosition" | "getBalances" | "getCopyAgents" | "getCopyBudget" | "getCopySettings" | "getCopySummary" | "getCoreExit" | "getDeployment" | "getHypercoreBalance" | "getHypercorePortfolio" | "getHypercoreSettlementCredits" | "getIdentity" | "getMakerActivity" | "getMakerCapital" | "getMakerExposure" | "getMakerPerformance" | "getMakerPosition" | "getMakerQuotes" | "getMakerTelemetry" | "getMakerVaultFundingTransaction" | "getMakerWithdrawal" | "getMarket" | "getMarketDataConfig" | "getMarketDefinitions" | "getMarketHistory" | "getMarketRecurringRound" | "getMarketReferenceCloses" | "getMarketScoreTimeline" | "getMarketStats" | "getOperation" | "getOwnMaker" | "getPartnerReport" | "getPerpMarks" | "getProfitLeaderboard" | "getQuestion" | "getQuestionRecurringRound" | "getQuestionScoreTimeline" | "getRfq" | "getSeries" | "getSuggestedCombo" | "getTaxonomy" | "getTrader" | "getTraderPnl" | "getUsernameAvailability" | "getVolumeLeaderboard" | "getWithdrawal" | "grantComboCopyAgent" | "likeComment" | "listAccountActivity" | "listAccountPositions" | "listComboCopies" | "listCommentReplies" | "listComments" | "listControlledMakers" | "listCopiedFills" | "listCopyTrades" | "listDiscovery" | "listFollows" | "listMakerActivity" | "listMakerPositions" | "listMakerQuoteHistory" | "listMarkets" | "listOperations" | "listQuotes" | "listTraderPositions" | "listTraderTrades" | "reactComment" | "recordAcquisition" | "refreshPicture" | "requestComboCopyAgent" | "requestCoreCopyAgent" | "revokeComboCopyAgent" | "searchCatalog" | "setAvatar" | "setCopyAllocation" | "setCopySettings" | "setPublicProfile" | "setUsername" | "stream" | "streamMarkets" | "switchOffComboCopyAgent" | "switchOffCoreCopyAgent" | "unfollowTrader" | "unlikeComment" | "unreactComment">;
106
+ export type operations = Pick<SharedOperations, "abandonCoreExit" | "acceptQuote" | "activeCoreExits" | "admitOwnMaker" | "admitPartnerWallet" | "bindEmbeddedWallet" | "cancelRfq" | "confirmComboCopyAgent" | "confirmCoreCopyAgent" | "createCashout" | "createComment" | "createCoreExit" | "createDeposit" | "createRfq" | "createRunOffClaim" | "createWalletChallenge" | "createWalletSession" | "createWithdrawal" | "deleteComment" | "editComment" | "endWalletSession" | "followTrader" | "getAcceptance" | "getAccountActivity" | "getAccountPnl" | "getAccountPosition" | "getBalances" | "getCopyAgents" | "getCopyBudget" | "getCopySettings" | "getCopySummary" | "getCoreExit" | "getDeployment" | "getHypercoreBalance" | "getHypercorePortfolio" | "getHypercoreSettlementCredits" | "getIdentity" | "getMakerActivity" | "getMakerCapital" | "getMakerExposure" | "getMakerPerformance" | "getMakerPosition" | "getMakerQuotes" | "getMakerTelemetry" | "getMakerVaultFundingTransaction" | "getMakerWithdrawal" | "getMarket" | "getMarketDataConfig" | "getMarketDefinitions" | "getMarketHistory" | "getMarketRecurringRound" | "getMarketReferenceCloses" | "getMarketScoreTimeline" | "getMarketStats" | "getOperation" | "getOwnMaker" | "getPartnerReport" | "getPerpMarks" | "getProfitLeaderboard" | "getQuestion" | "getQuestionRecurringRound" | "getQuestionScoreTimeline" | "getRfq" | "getSeries" | "getSuggestedCombo" | "getTaxonomy" | "getTrader" | "getTraderPnl" | "getUsernameAvailability" | "getVaultAgents" | "getVolumeLeaderboard" | "getWithdrawal" | "grantComboCopyAgent" | "grantVaultAgent" | "likeComment" | "listAccountActivity" | "listAccountPositions" | "listComboCopies" | "listCommentReplies" | "listComments" | "listControlledMakers" | "listCopiedFills" | "listCopyTrades" | "listDiscovery" | "listFollows" | "listMakerActivity" | "listMakerPositions" | "listMakerQuoteHistory" | "listMarkets" | "listOperations" | "listQuotes" | "listTraderPositions" | "listTraderTrades" | "reactComment" | "recordAcquisition" | "refreshPicture" | "requestComboCopyAgent" | "requestCoreCopyAgent" | "revokeComboCopyAgent" | "searchCatalog" | "setAvatar" | "setCopyAllocation" | "setCopySettings" | "setPublicProfile" | "setUsername" | "stream" | "streamMarkets" | "switchOffComboCopyAgent" | "switchOffCoreCopyAgent" | "unfollowTrader" | "unlikeComment" | "unreactComment">;
@@ -333,7 +333,7 @@ export declare const operationErrors: {
333
333
  readonly activeCoreExits: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED"];
334
334
  readonly admitOwnMaker: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "ORIGIN_REQUIRED", "INVALID_REQUEST", "NOT_FOUND", "STATE_CONFLICT"];
335
335
  readonly admitPartnerWallet: readonly ["INVALID_REQUEST", "INVALID_IDEMPOTENCY_KEY", "UNAUTHENTICATED", "FORBIDDEN", "STATE_CONFLICT", "INVALID_SIGNATURE", "RATE_LIMITED", "AUTHORIZATION_UNAVAILABLE"];
336
- readonly bindEmbeddedWallet: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "INVALID_REQUEST", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSED", "EMBEDDED_WALLET_CONFLICT", "ACCESS_REQUIRED", "SIGN_IN_REQUIRED", "ORIGIN_REQUIRED"];
336
+ readonly bindEmbeddedWallet: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "INVALID_REQUEST", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSED", "EMBEDDED_WALLET_CONFLICT", "ACCESS_REQUIRED", "SIGN_IN_REQUIRED", "WALLET_CONTRACT_UNSUPPORTED", "ORIGIN_REQUIRED"];
337
337
  readonly cancelQuote: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "INVALID_REQUEST", "NOT_FOUND", "STATE_CONFLICT"];
338
338
  readonly cancelRfq: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "INVALID_REQUEST", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSED", "NOT_FOUND", "RFQ_NOT_CANCELLABLE", "STATE_CONFLICT", "ORIGIN_REQUIRED"];
339
339
  readonly confirmComboCopyAgent: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "RATE_LIMITED", "ORIGIN_REQUIRED", "IDENTITY_NOT_FOUND", "CONTRACT_UNAVAILABLE", "NOT_FOUND", "STATE_CONFLICT", "DEPENDENCY_STALE", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSED"];
@@ -410,9 +410,11 @@ export declare const operationErrors: {
410
410
  readonly getTrader: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "RATE_LIMITED", "INVALID_QUERY", "ORIGIN_REQUIRED", "NOT_FOUND", "SOURCE_UNAVAILABLE", "CONTRACT_UNAVAILABLE"];
411
411
  readonly getTraderPnl: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "RATE_LIMITED", "INVALID_QUERY", "ORIGIN_REQUIRED", "NOT_FOUND", "SOURCE_UNAVAILABLE", "CONTRACT_UNAVAILABLE"];
412
412
  readonly getUsernameAvailability: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "INVALID_QUERY", "IDENTITY_NOT_FOUND", "ORIGIN_REQUIRED"];
413
+ readonly getVaultAgents: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "RATE_LIMITED", "ORIGIN_REQUIRED", "IDENTITY_NOT_FOUND", "INVALID_QUERY", "DEPENDENCY_STALE"];
413
414
  readonly getVolumeLeaderboard: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "INVALID_QUERY", "CONTRACT_UNAVAILABLE"];
414
415
  readonly getWithdrawal: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "INVALID_REQUEST", "NOT_FOUND"];
415
416
  readonly grantComboCopyAgent: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "RATE_LIMITED", "ORIGIN_REQUIRED", "IDENTITY_NOT_FOUND", "CONTRACT_UNAVAILABLE", "NOT_FOUND", "INVALID_REQUEST", "FINANCIAL_ACTIONS_DISABLED", "DEPENDENCY_STALE", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSED"];
417
+ readonly grantVaultAgent: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "RATE_LIMITED", "ORIGIN_REQUIRED", "IDENTITY_NOT_FOUND", "INVALID_REQUEST", "FINANCIAL_ACTIONS_DISABLED", "DEPENDENCY_STALE", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSED"];
416
418
  readonly likeComment: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "ORIGIN_REQUIRED", "IDENTITY_NOT_FOUND", "NOT_FOUND", "INVALID_IDEMPOTENCY_KEY"];
417
419
  readonly listAccountActivity: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "INVALID_QUERY", "ORIGIN_REQUIRED", "NOT_FOUND", "SOURCE_UNAVAILABLE", "CONTRACT_UNAVAILABLE", "CURSOR_EXPIRED"];
418
420
  readonly listAccountPositions: readonly ["UNAUTHENTICATED", "FORBIDDEN", "AUTHORIZATION_UNAVAILABLE", "DEPENDENCY_STALE", "RATE_LIMITED", "INVALID_QUERY", "ORIGIN_REQUIRED", "NOT_FOUND", "SOURCE_UNAVAILABLE", "CONTRACT_UNAVAILABLE", "CURSOR_EXPIRED"];
@@ -405,6 +405,7 @@ export const operationErrors = {
405
405
  "EMBEDDED_WALLET_CONFLICT",
406
406
  "ACCESS_REQUIRED",
407
407
  "SIGN_IN_REQUIRED",
408
+ "WALLET_CONTRACT_UNSUPPORTED",
408
409
  "ORIGIN_REQUIRED"
409
410
  ],
410
411
  "cancelQuote": [
@@ -1196,6 +1197,16 @@ export const operationErrors = {
1196
1197
  "IDENTITY_NOT_FOUND",
1197
1198
  "ORIGIN_REQUIRED"
1198
1199
  ],
1200
+ "getVaultAgents": [
1201
+ "UNAUTHENTICATED",
1202
+ "FORBIDDEN",
1203
+ "AUTHORIZATION_UNAVAILABLE",
1204
+ "RATE_LIMITED",
1205
+ "ORIGIN_REQUIRED",
1206
+ "IDENTITY_NOT_FOUND",
1207
+ "INVALID_QUERY",
1208
+ "DEPENDENCY_STALE"
1209
+ ],
1199
1210
  "getVolumeLeaderboard": [
1200
1211
  "UNAUTHENTICATED",
1201
1212
  "FORBIDDEN",
@@ -1229,6 +1240,19 @@ export const operationErrors = {
1229
1240
  "INVALID_IDEMPOTENCY_KEY",
1230
1241
  "IDEMPOTENCY_KEY_REUSED"
1231
1242
  ],
1243
+ "grantVaultAgent": [
1244
+ "UNAUTHENTICATED",
1245
+ "FORBIDDEN",
1246
+ "AUTHORIZATION_UNAVAILABLE",
1247
+ "RATE_LIMITED",
1248
+ "ORIGIN_REQUIRED",
1249
+ "IDENTITY_NOT_FOUND",
1250
+ "INVALID_REQUEST",
1251
+ "FINANCIAL_ACTIONS_DISABLED",
1252
+ "DEPENDENCY_STALE",
1253
+ "INVALID_IDEMPOTENCY_KEY",
1254
+ "IDEMPOTENCY_KEY_REUSED"
1255
+ ],
1232
1256
  "likeComment": [
1233
1257
  "UNAUTHENTICATED",
1234
1258
  "FORBIDDEN",
@@ -426,7 +426,7 @@ export type paths = {
426
426
  readonly put?: never;
427
427
  /**
428
428
  * Bind embedded wallet
429
- * @description Idempotently binds the one Ethereum wallet attested by the authenticated user's signed Privy identity token. BYOW and multiple wallets are rejected. Creating a new account needs a Google, email or X login linked in the identity token, or this answers SIGN_IN_REQUIRED (a Privy user with only an external wallet, such as one from another app on the same Privy app, is refused), and, while the closed launch is on, an invite code redeemed with the access service first, or this answers ACCESS_REQUIRED. Existing accounts are unaffected.
429
+ * @description Idempotently makes a wallet attested by the authenticated user's signed Privy identity token the account's: the account's current wallet if it has one, else the Privy embedded wallet, else the one Ethereum wallet the user signed in with. The account's wallet never changes once bound; several external wallets on a new account, or a wallet another account holds, answer EMBEDDED_WALLET_CONFLICT, and a smart contract wallet answers WALLET_CONTRACT_UNSUPPORTED. Creating a new account needs a Google, email, X or Ethereum wallet login linked in the identity token, or this answers SIGN_IN_REQUIRED (a Privy user with only a Solana wallet, such as one from the Solana app on the same Privy app, is refused), and, while the closed launch is on, an invite code redeemed with the access service first, or this answers ACCESS_REQUIRED. Existing accounts are unaffected.
430
430
  */
431
431
  readonly post: operations["bindEmbeddedWallet"];
432
432
  readonly delete?: never;
@@ -1031,6 +1031,30 @@ export type paths = {
1031
1031
  readonly patch?: never;
1032
1032
  readonly trace?: never;
1033
1033
  };
1034
+ readonly "/v1/me/vault-agents": {
1035
+ readonly parameters: {
1036
+ readonly query?: never;
1037
+ readonly header?: never;
1038
+ readonly path?: never;
1039
+ readonly cookie?: never;
1040
+ };
1041
+ /**
1042
+ * Get my vault agents
1043
+ * @description The authenticated account's vault agents whose latest AgentGrant on chain is still live, by agent address, a page at a time: each agent may sign the account's named TakerAccept, owner-side SellBack, seller-side CashoutTransfer and Exit to the account's own wallet or Core spot until valid_until. copy_agent marks a server-held copy agent (managed under /v1/me/copy-agents) rather than a key one of the account's devices holds. A grant appears once the chain-agent projects it, after its operation completes. nonce is the agent's last grant, which a new grant or revoke must exceed.
1044
+ */
1045
+ readonly get: operations["getVaultAgents"];
1046
+ readonly put?: never;
1047
+ /**
1048
+ * Relay the account's grant or revoke of a device's vault agent
1049
+ * @description Relays the account's EIP-712 signature over AgentGrant(account, agent, valid_until, nonce) to setAgent; Totalis pays the gas. agent is a key one of the account's devices holds, so it can sign the account's named Combo accepts, cash-outs and Exits to its own wallet or Core spot without a wallet prompt. valid_until is unix seconds, in the future and at most 180 days away (the vault's limit); 0 revokes at once. nonce must exceed the agent's last grant (GET /v1/me/vault-agents), so a client uses the current unix time. Only the account's own signature (or its ERC-1271 verdict) grants. 403 FORBIDDEN for a copy agent, whose grants go through /v1/me/copy-agents. While financial actions run off only a revoke is relayed. A retry with the same Idempotency-Key returns the same operation.
1050
+ */
1051
+ readonly post: operations["grantVaultAgent"];
1052
+ readonly delete?: never;
1053
+ readonly options?: never;
1054
+ readonly head?: never;
1055
+ readonly patch?: never;
1056
+ readonly trace?: never;
1057
+ };
1034
1058
  readonly "/v1/me/copy-budget": {
1035
1059
  readonly parameters: {
1036
1060
  readonly query?: never;
@@ -2429,7 +2453,7 @@ export type paths = {
2429
2453
  };
2430
2454
  /**
2431
2455
  * Get maker exposure
2432
- * @description This maker's open book by outcome at the vault projection checkpoint: per outcome its YES and NO exposure, gross and net, worst case and what offsetting saves, and what awaits settlement; book totals count each ticket once. Legs resolve as a position's do. Dashboard sessions only, like positions.
2456
+ * @description This maker's open book by outcome at the vault projection checkpoint: per outcome its YES and NO exposure, gross and net, worst case and what offsetting saves, and what awaits settlement; book totals count each ticket once. Legs resolve as a position's do. A maker key reads only its own maker.
2433
2457
  */
2434
2458
  readonly get: operations["getMakerExposure"];
2435
2459
  readonly put?: never;
@@ -2449,7 +2473,7 @@ export type paths = {
2449
2473
  };
2450
2474
  /**
2451
2475
  * Get maker performance
2452
- * @description Performance of this maker per period. Complete periods aggregate the positions that closed economically in them; incomplete periods return unavailable metrics. Gas stays unavailable until the payer of every transaction receipt is attributed. The credential selects the deployment, and access is checked against its current permissions on every request. The maker is always the one named in the path, never inferred from the caller's account.
2476
+ * @description Get your maker's trading P&L per period between `from` and `through`.
2453
2477
  */
2454
2478
  readonly get: operations["getMakerPerformance"];
2455
2479
  readonly put?: never;
@@ -2560,6 +2584,38 @@ export type components = {
2560
2584
  /** @description The account's EIP-712 signature over AgentGrant(account, agent, 0, nonce). */
2561
2585
  readonly signature: components["schemas"]["Signature65"];
2562
2586
  };
2587
+ /** VaultAgentGrant */
2588
+ readonly VaultAgentGrant: {
2589
+ /** @description The key a device of the account holds; not the account, not a copy agent. */
2590
+ readonly agent: components["schemas"]["LowercaseNonZeroAddress"];
2591
+ /** @description Unix seconds the grant lasts until, at most 180 days away; 0 revokes. */
2592
+ readonly valid_until: components["schemas"]["UInt64String"];
2593
+ /** @description Above the agent's last grant; the current unix time works. */
2594
+ readonly nonce: components["schemas"]["UInt64String"];
2595
+ /** @description The account's EIP-712 signature over AgentGrant(account, agent, valid_until, nonce) in the vault's domain. */
2596
+ readonly signature: components["schemas"]["Signature65"];
2597
+ };
2598
+ /** VaultAgents */
2599
+ readonly VaultAgents: {
2600
+ /** @description The account wallet the agents sign for. */
2601
+ readonly account: components["schemas"]["Address"];
2602
+ /** @description Live grants, by agent address. */
2603
+ readonly agents: readonly components["schemas"]["VaultAgent"][];
2604
+ readonly next_cursor: components["schemas"]["NextCursor"];
2605
+ /** @description Whether more agents follow next_cursor. */
2606
+ readonly has_more: boolean;
2607
+ };
2608
+ /** VaultAgent */
2609
+ readonly VaultAgent: {
2610
+ /** @description The agent key. */
2611
+ readonly agent: components["schemas"]["Address"];
2612
+ /** @description Unix seconds the grant lasts until. */
2613
+ readonly valid_until: components["schemas"]["UInt64String"];
2614
+ /** @description The grant's nonce; a new grant or revoke must exceed it. */
2615
+ readonly nonce: components["schemas"]["UInt64String"];
2616
+ /** @description A server-held copy agent rather than a device's key. */
2617
+ readonly copy_agent: boolean;
2618
+ };
2563
2619
  /** AgentGrantRelayed */
2564
2620
  readonly AgentGrantRelayed: {
2565
2621
  /** @description The relayed setAgent operation. */
@@ -7112,7 +7168,7 @@ export interface operations {
7112
7168
  };
7113
7169
  readonly requestBody?: never;
7114
7170
  readonly responses: {
7115
- /** @description Embedded wallet is bound */
7171
+ /** @description Account wallet is bound */
7116
7172
  readonly 204: {
7117
7173
  headers: {
7118
7174
  readonly [name: string]: unknown;
@@ -7123,6 +7179,7 @@ export interface operations {
7123
7179
  readonly 401: components["responses"]["Error"];
7124
7180
  readonly 403: components["responses"]["Error"];
7125
7181
  readonly 409: components["responses"]["Error"];
7182
+ readonly 422: components["responses"]["Error"];
7126
7183
  readonly 429: components["responses"]["RateLimited"];
7127
7184
  readonly 503: components["responses"]["Unavailable"];
7128
7185
  };
@@ -8507,6 +8564,81 @@ export interface operations {
8507
8564
  readonly 503: components["responses"]["Unavailable"];
8508
8565
  };
8509
8566
  };
8567
+ readonly getVaultAgents: {
8568
+ readonly parameters: {
8569
+ readonly query?: {
8570
+ /**
8571
+ * @description Omit for the first page; then send the previous response's next_cursor unchanged.
8572
+ * @example eyJ2IjoxLCJzIjoiMTIzNDUifQ
8573
+ */
8574
+ readonly cursor?: components["parameters"]["Cursor"];
8575
+ /**
8576
+ * @description Maximum items per page, 1 to 200, default 50. A page may hold fewer, even none, while has_more is true.
8577
+ * @example 50
8578
+ */
8579
+ readonly limit?: components["parameters"]["Limit"];
8580
+ };
8581
+ readonly header?: never;
8582
+ readonly path?: never;
8583
+ readonly cookie?: never;
8584
+ };
8585
+ readonly requestBody?: never;
8586
+ readonly responses: {
8587
+ /** @description The account's live vault agents */
8588
+ readonly 200: {
8589
+ headers: {
8590
+ readonly "Cache-Control"?: "no-store";
8591
+ readonly [name: string]: unknown;
8592
+ };
8593
+ content: {
8594
+ readonly "application/json": components["schemas"]["VaultAgents"];
8595
+ };
8596
+ };
8597
+ readonly 400: components["responses"]["Error"];
8598
+ readonly 401: components["responses"]["Error"];
8599
+ readonly 403: components["responses"]["Error"];
8600
+ readonly 404: components["responses"]["Error"];
8601
+ readonly 429: components["responses"]["RateLimited"];
8602
+ readonly 503: components["responses"]["Unavailable"];
8603
+ };
8604
+ };
8605
+ readonly grantVaultAgent: {
8606
+ readonly parameters: {
8607
+ readonly query?: never;
8608
+ readonly header: {
8609
+ /**
8610
+ * @description Lowercase UUIDv7 naming this command, unique per caller and route. A retry with the same key and body returns the original result; the same key with a different body returns `409 IDEMPOTENCY_KEY_REUSED`.
8611
+ * @example 0198a6f6-82a5-7abc-9f2a-4f0fb437493e
8612
+ */
8613
+ readonly "Idempotency-Key": components["parameters"]["IdempotencyKey"];
8614
+ };
8615
+ readonly path?: never;
8616
+ readonly cookie?: never;
8617
+ };
8618
+ readonly requestBody: {
8619
+ readonly content: {
8620
+ readonly "application/json": components["schemas"]["VaultAgentGrant"];
8621
+ };
8622
+ };
8623
+ readonly responses: {
8624
+ /** @description Relayed, not yet on chain. Follow the operation with `GET /v1/me/operations/{operation_id}`. */
8625
+ readonly 202: {
8626
+ headers: {
8627
+ readonly [name: string]: unknown;
8628
+ };
8629
+ content: {
8630
+ readonly "application/json": components["schemas"]["AgentGrantRelayed"];
8631
+ };
8632
+ };
8633
+ readonly 400: components["responses"]["Error"];
8634
+ readonly 401: components["responses"]["Error"];
8635
+ readonly 403: components["responses"]["Error"];
8636
+ readonly 404: components["responses"]["Error"];
8637
+ readonly 409: components["responses"]["Error"];
8638
+ readonly 429: components["responses"]["RateLimited"];
8639
+ readonly 503: components["responses"]["Unavailable"];
8640
+ };
8641
+ };
8510
8642
  readonly getCopyBudget: {
8511
8643
  readonly parameters: {
8512
8644
  readonly query?: never;
@@ -10955,7 +11087,7 @@ export interface operations {
10955
11087
  };
10956
11088
  readonly requestBody?: never;
10957
11089
  readonly responses: {
10958
- /** @description Scoped read with one freshness status; amounts are atomic USDC strings or null. No shared caching. */
11090
+ /** @description Complete periods aggregate the positions that closed economically in them; incomplete periods return unavailable metrics. Gas stays unavailable until the payer of every transaction receipt is attributed. Scoped read with one freshness status; amounts are atomic USDC strings or null. No shared caching. */
10959
11091
  readonly 200: {
10960
11092
  headers: {
10961
11093
  readonly "Cache-Control": components["headers"]["CacheControl"];
@@ -371,6 +371,15 @@ export type components = {
371
371
  /** @description Publication coverage, sent each heartbeat to subscriptions that set publication_freshness. Null when no checkpoint is available; treat freshness as unproven. */
372
372
  readonly data: components["schemas"]["PublicationCheckpoint"] | null;
373
373
  };
374
+ readonly CapitalFrame: {
375
+ /**
376
+ * @description Frame discriminator, always capital. Sent to maker subscriptions that set capital: once on subscribe, again whenever the capital changes, and at least every 5000 ms.
377
+ * @constant
378
+ */
379
+ readonly channel: "capital";
380
+ /** @description The same body as GET /v1/makers/{maker_id}/capital, read when the frame was published; its context says how fresh it is. Without a frame for 15 s, read capital over HTTP. */
381
+ readonly data: components["schemas"]["MakerCapital"];
382
+ };
374
383
  readonly Snapshot: {
375
384
  /** @description Stream cursor the snapshot is consistent with. Events after it follow on the stream; reconnect with it to replay them. */
376
385
  readonly cursor: components["schemas"]["Cursor"];
@@ -413,6 +422,8 @@ export type components = {
413
422
  readonly account_reads?: boolean;
414
423
  /** @description Opt in to publication checkpoints and a 1000 ms authenticated heartbeat. */
415
424
  readonly publication_freshness?: boolean;
425
+ /** @description Opt in to capital frames: the maker's capital read, pushed when it changes and at least every 5 s. Needs vault:read; without it the server closes with SUBSCRIPTION_DENIED. */
426
+ readonly capital?: boolean;
416
427
  };
417
428
  readonly Subscribe: {
418
429
  /**
@@ -461,6 +472,8 @@ export type components = {
461
472
  readonly account_reads?: boolean;
462
473
  /** @description Opt in to publication checkpoints and a 1000 ms authenticated heartbeat. */
463
474
  readonly publication_freshness?: boolean;
475
+ /** @description Opt in to capital frames: the maker's capital read, pushed when it changes and at least every 5 s. Needs vault:read; without it the server closes with SUBSCRIPTION_DENIED. */
476
+ readonly capital?: boolean;
464
477
  };
465
478
  /**
466
479
  * Format: uuid
@@ -990,6 +1003,88 @@ export type components = {
990
1003
  /** @description When the withdrawal last changed, RFC3339 UTC. */
991
1004
  readonly updated_at: components["schemas"]["Timestamp"];
992
1005
  };
1006
+ /** Format: date-time */
1007
+ readonly "$defs-Timestamp": string;
1008
+ /** @description Freshness of the read. Pages of one list share the snapshot bound into their cursor. */
1009
+ readonly ReadContext: {
1010
+ /** @description RFC3339 observation time of the oldest source this read used. */
1011
+ readonly as_of: components["schemas"]["$defs-Timestamp"];
1012
+ /**
1013
+ * @description Freshness of the whole read. CURRENT: every source is fresh and reconciled. STALE: a source lags or has not reconciled, such as a catching-up projection, a pending reorg rescan or a period not fully covered; amounts may be displayed with their age but never authorize an action. UNAVAILABLE: a required source could not be read, so the amounts it backs are null.
1014
+ * @enum {string}
1015
+ */
1016
+ readonly status: "CURRENT" | "STALE" | "UNAVAILABLE";
1017
+ };
1018
+ readonly "$defs-Amount": string;
1019
+ /** @description Non-negative amount in atomic USDC (6 decimals, "1000000" = 1 USDC); null when it could not be established, never zero in its place. */
1020
+ readonly UnsignedMetric: components["schemas"]["$defs-Amount"] | null;
1021
+ readonly SignedAmount: string;
1022
+ /** @description Signed amount in atomic USDC (6 decimals, "1000000" = 1 USDC); null when it could not be established, never zero in its place. */
1023
+ readonly Metric: components["schemas"]["SignedAmount"] | null;
1024
+ readonly ActionAvailability: {
1025
+ /**
1026
+ * @description Action this decision covers: MAKER_WITHDRAW or MAKER_QUOTE.
1027
+ * @enum {string}
1028
+ */
1029
+ readonly action: "MAKER_WITHDRAW" | "MAKER_QUOTE";
1030
+ /** @description Funding route the decision covers, e.g. MAKER_VAULT. */
1031
+ readonly route: string;
1032
+ /** @description Amount available for this action and route in atomic USDC (6 decimals, "1000000" = 1 USDC); null with blockers when unavailable. */
1033
+ readonly available: components["schemas"]["UnsignedMetric"];
1034
+ /** @description Machine-readable codes blocking the action, e.g. MAKER_WITHDRAW_PENDING or RECONCILIATION_MISMATCH; at least one when available is null. */
1035
+ readonly blockers: readonly string[];
1036
+ };
1037
+ /** @description A venue admission reservation on the maker vault. */
1038
+ readonly Reservation: {
1039
+ /** @description Stable reservation identifier. */
1040
+ readonly reservation_id: string;
1041
+ /** @description Operations holding this reservation. */
1042
+ readonly operation_ids: readonly string[];
1043
+ /** @description Reserved amount in atomic USDC (6 decimals, "1000000" = 1 USDC). */
1044
+ readonly value: components["schemas"]["$defs-Amount"];
1045
+ /**
1046
+ * @description ACTIVE: held and not yet reflected on-chain; UNKNOWN: outcome unknown, still counted as held.
1047
+ * @enum {string}
1048
+ */
1049
+ readonly status: "ACTIVE" | "UNKNOWN";
1050
+ };
1051
+ /** @description Maker capital lanes and derived collateral, in atomic USDC (6 decimals, "1000000" = 1 USDC). Amounts are null when unavailable; context.status is their freshness. */
1052
+ readonly MakerCapital: {
1053
+ /** @description Freshness of this read: the oldest source observation and one status for every amount in the response. */
1054
+ readonly context: components["schemas"]["ReadContext"];
1055
+ /** @description Maker owner (its controller) from the same indexed vault row as the lanes. */
1056
+ readonly owner: components["schemas"]["LowercaseNonZeroAddress"];
1057
+ /** @description Maker signer (its quote signer) from the same indexed vault row as the lanes. The zero address means the maker was opened without one and cannot quote. */
1058
+ readonly signer: string;
1059
+ /** @description Maker vault lane V from the vault contract, including escrow and payables. */
1060
+ readonly vault_gross: components["schemas"]["UnsignedMetric"];
1061
+ /** @description Bettor net stakes escrowed in this maker's open tickets (E). */
1062
+ readonly stake_escrow: components["schemas"]["UnsignedMetric"];
1063
+ /** @description Settled winnings owed to ticket holders and not yet claimed (P). */
1064
+ readonly payable_owed: components["schemas"]["UnsignedMetric"];
1065
+ /** @description Original open maker exposure G: payout minus net stake summed over open tickets. */
1066
+ readonly gross_open: components["schemas"]["UnsignedMetric"];
1067
+ /** @description Maker discount lane D from the vault contract, which offsets gross_open in the requirement. */
1068
+ readonly discount: components["schemas"]["UnsignedMetric"];
1069
+ /** @description Collateral requirement R = max(G - min(D, G), ceil(G * floor_bps / 10000)) under the pinned release; null when floor_bps is null or an input is null. */
1070
+ readonly requirement: components["schemas"]["UnsignedMetric"];
1071
+ /** @description Collateral headroom F = max(V - E - P - R, 0). Not a guarantee of quote acceptance. */
1072
+ readonly free_collateral: components["schemas"]["UnsignedMetric"];
1073
+ /** @description Signed C = V - E - P. Excludes open-ticket valuation; not equity or NAV. */
1074
+ readonly capital_net_of_senior_liabilities: components["schemas"]["Metric"];
1075
+ /** @description Admission reservations H the venue holds for this maker that are not yet reflected on-chain; the sum of reservations. */
1076
+ readonly pending_commitments: components["schemas"]["UnsignedMetric"];
1077
+ /** @description max(F - H, 0): free collateral after unreflected commitments. Not private bot capacity. */
1078
+ readonly free_after_pending: components["schemas"]["UnsignedMetric"];
1079
+ /** @description Requirement floor K in basis points from the pinned release; null when the on-chain comparison mismatches, which makes requirement UNAVAILABLE. */
1080
+ readonly floor_bps: number | null;
1081
+ /** @description SHA-256 of the exact pinned artifact that names this deployment's chain and vault: the release artifact on chain 999, the environment's deployment manifest on 998. A client compares it with its own pinned artifact to bind the read to its deployment. */
1082
+ readonly deployment_digest: string;
1083
+ /** @description Decisions for MAKER_WITHDRAW and MAKER_QUOTE on the MAKER_VAULT route. MAKER_WITHDRAW is the amount a new withdrawal request may ask for: free_after_pending, so it never takes collateral from fills already admitted. The vault re-checks free collateral when the request executes after its delay; it is null with MAKER_WITHDRAW_PENDING while a request is live, or with a reconciliation blocker. MAKER_QUOTE is always null with one blocker, because quoting capacity depends on state only the maker's bot holds, such as its other live quotes. PRIVATE_QUOTE_CAPACITY_UNAVAILABLE means only that Totalis cannot compute that amount; it does not mean quoting is off, and the maker can keep quoting. A reconciliation blocker replaces it while the vault read and venue records disagree. */
1084
+ readonly actions: readonly components["schemas"]["ActionAvailability"][];
1085
+ /** @description Venue reservations on MAKER_VAULT that make up pending_commitments. */
1086
+ readonly reservations: readonly components["schemas"]["Reservation"][];
1087
+ } & unknown;
993
1088
  readonly ReadSubscription: {
994
1089
  /**
995
1090
  * @description Account-read contract version of the subscription; always "1".
@@ -1,12 +1,12 @@
1
- export declare const sdkVersion = "203.0.0-execution-admission";
2
- export declare const openapiSha256 = "2304ae546fe97a86cbb1147dccdebe50f5bb44080c26b88503356ac9dd1aa096";
3
- export declare const realtimeSha256 = "6491fe1d9b5fdcfefcbee71716401effa181e7bcdf1fa4623fbb83dc5b2975cd";
1
+ export declare const sdkVersion = "205.0.0-device-vault-agents";
2
+ export declare const openapiSha256 = "e742feade28ca115077a4275e4a6260646278e9adcf0839987b8566a2221c8f5";
3
+ export declare const realtimeSha256 = "1cac740e108e84ad1979f6ccc71089efd840404cb72d1612a86edc02769637e3";
4
4
  export declare const jsonSchemaSha256: {
5
5
  readonly "account.schema.json": "5106e2d53abef190990eff113f6692dd27df5848439cf5a80a42c11e89f2bef6";
6
6
  readonly "comments.schema.json": "18f4addcfa4e31c2c833fce8b8beca61d2e2ee5b6318c2ed0b479698ff56b65e";
7
7
  readonly "common.schema.json": "04f51deb3cbea448e59195e26ede3212598d58a7940fe67eb2123fd9161c5edb";
8
8
  readonly "core-exit.schema.json": "c7f617e815225cdcac95c236f8b73fbe288ee5713ff444c3be90eb915fc3a401";
9
- readonly "error.schema.json": "85b2e13d449f137322779086c96d1355d0e70708647eb67b62c9b4070ed6530e";
9
+ readonly "error.schema.json": "56b1e1c4ea26078cb8ce7ab3c554c0415c8c82eec45821180fc0d5e891046c1e";
10
10
  readonly "hypercore.schema.json": "5b89b2bbff7ec8cc1b8717375d12ce9cd5ab6aa5af03c4fdc6cc753ef9583a2c";
11
11
  readonly "identity.schema.json": "94534b768030736f4fd1fad285f1312454ca5fbff0b1eb5fab70416a78923bd0";
12
12
  readonly "maker-access.schema.json": "49698ee0235e42064aae0397db1e0f646bdc10d9dfa10121714ba06dd69fee3b";
@@ -15,10 +15,10 @@ export declare const jsonSchemaSha256: {
15
15
  readonly "market-data.schema.json": "85db33fac6a29b0fa87a500bfda947d0ab3913b13f1c26663d4a7c0484c35786";
16
16
  readonly "product-metadata.schema.json": "7c8ffbde878a0aedaed16814fcfd2e80038054b140886cc8736bb7b508042631";
17
17
  readonly "quote.schema.json": "5616260d399d022bde2d0130cc9f8a09f71a3dc877276adf796c7a174d21b59a";
18
- readonly "realtime.schema.json": "6491fe1d9b5fdcfefcbee71716401effa181e7bcdf1fa4623fbb83dc5b2975cd";
18
+ readonly "realtime.schema.json": "1cac740e108e84ad1979f6ccc71089efd840404cb72d1612a86edc02769637e3";
19
19
  };
20
20
  export declare const operations: {
21
- readonly client: readonly ["abandonCoreExit", "acceptQuote", "activeCoreExits", "admitOwnMaker", "admitPartnerWallet", "bindEmbeddedWallet", "cancelRfq", "confirmComboCopyAgent", "confirmCoreCopyAgent", "createCashout", "createComment", "createCoreExit", "createDeposit", "createRfq", "createRunOffClaim", "createWalletChallenge", "createWalletSession", "createWithdrawal", "deleteComment", "editComment", "endWalletSession", "followTrader", "getAcceptance", "getAccountActivity", "getAccountPnl", "getAccountPosition", "getBalances", "getCopyAgents", "getCopyBudget", "getCopySettings", "getCopySummary", "getCoreExit", "getDeployment", "getHypercoreBalance", "getHypercorePortfolio", "getHypercoreSettlementCredits", "getIdentity", "getMakerActivity", "getMakerCapital", "getMakerExposure", "getMakerPerformance", "getMakerPosition", "getMakerQuotes", "getMakerTelemetry", "getMakerVaultFundingTransaction", "getMakerWithdrawal", "getMarket", "getMarketDataConfig", "getMarketDefinitions", "getMarketHistory", "getMarketRecurringRound", "getMarketReferenceCloses", "getMarketScoreTimeline", "getMarketStats", "getOperation", "getOwnMaker", "getPartnerReport", "getPerpMarks", "getProfitLeaderboard", "getQuestion", "getQuestionRecurringRound", "getQuestionScoreTimeline", "getRfq", "getSeries", "getSuggestedCombo", "getTaxonomy", "getTrader", "getTraderPnl", "getUsernameAvailability", "getVolumeLeaderboard", "getWithdrawal", "grantComboCopyAgent", "likeComment", "listAccountActivity", "listAccountPositions", "listComboCopies", "listCommentReplies", "listComments", "listControlledMakers", "listCopiedFills", "listCopyTrades", "listDiscovery", "listFollows", "listMakerActivity", "listMakerPositions", "listMakerQuoteHistory", "listMarkets", "listOperations", "listQuotes", "listTraderPositions", "listTraderTrades", "reactComment", "recordAcquisition", "refreshPicture", "requestComboCopyAgent", "requestCoreCopyAgent", "revokeComboCopyAgent", "searchCatalog", "setAvatar", "setCopyAllocation", "setCopySettings", "setPublicProfile", "setUsername", "stream", "streamMarkets", "switchOffComboCopyAgent", "switchOffCoreCopyAgent", "unfollowTrader", "unlikeComment", "unreactComment"];
21
+ readonly client: readonly ["abandonCoreExit", "acceptQuote", "activeCoreExits", "admitOwnMaker", "admitPartnerWallet", "bindEmbeddedWallet", "cancelRfq", "confirmComboCopyAgent", "confirmCoreCopyAgent", "createCashout", "createComment", "createCoreExit", "createDeposit", "createRfq", "createRunOffClaim", "createWalletChallenge", "createWalletSession", "createWithdrawal", "deleteComment", "editComment", "endWalletSession", "followTrader", "getAcceptance", "getAccountActivity", "getAccountPnl", "getAccountPosition", "getBalances", "getCopyAgents", "getCopyBudget", "getCopySettings", "getCopySummary", "getCoreExit", "getDeployment", "getHypercoreBalance", "getHypercorePortfolio", "getHypercoreSettlementCredits", "getIdentity", "getMakerActivity", "getMakerCapital", "getMakerExposure", "getMakerPerformance", "getMakerPosition", "getMakerQuotes", "getMakerTelemetry", "getMakerVaultFundingTransaction", "getMakerWithdrawal", "getMarket", "getMarketDataConfig", "getMarketDefinitions", "getMarketHistory", "getMarketRecurringRound", "getMarketReferenceCloses", "getMarketScoreTimeline", "getMarketStats", "getOperation", "getOwnMaker", "getPartnerReport", "getPerpMarks", "getProfitLeaderboard", "getQuestion", "getQuestionRecurringRound", "getQuestionScoreTimeline", "getRfq", "getSeries", "getSuggestedCombo", "getTaxonomy", "getTrader", "getTraderPnl", "getUsernameAvailability", "getVaultAgents", "getVolumeLeaderboard", "getWithdrawal", "grantComboCopyAgent", "grantVaultAgent", "likeComment", "listAccountActivity", "listAccountPositions", "listComboCopies", "listCommentReplies", "listComments", "listControlledMakers", "listCopiedFills", "listCopyTrades", "listDiscovery", "listFollows", "listMakerActivity", "listMakerPositions", "listMakerQuoteHistory", "listMarkets", "listOperations", "listQuotes", "listTraderPositions", "listTraderTrades", "reactComment", "recordAcquisition", "refreshPicture", "requestComboCopyAgent", "requestCoreCopyAgent", "revokeComboCopyAgent", "searchCatalog", "setAvatar", "setCopyAllocation", "setCopySettings", "setPublicProfile", "setUsername", "stream", "streamMarkets", "switchOffComboCopyAgent", "switchOffCoreCopyAgent", "unfollowTrader", "unlikeComment", "unreactComment"];
22
22
  readonly maker: readonly ["cancelQuote", "confirmQuote", "createCollateralReduction", "createQuote", "getAccountActivity", "getAccountPosition", "getCollateralReduction", "getDeployment", "getMakerActivity", "getMakerCapital", "getMakerExposure", "getMakerPerformance", "getMakerPosition", "getMakerQuotes", "getMakerTelemetry", "getMakerTelemetryPublication", "getMakerVaultFundingTransaction", "getMakerWithdrawal", "getMarket", "getMarketHistory", "getMarketRecurringRound", "getMarketReferenceCloses", "getOperation", "getQuestion", "getQuestionRecurringRound", "getRfq", "getSeries", "getTaxonomy", "listAccountActivity", "listAccountPositions", "listDiscovery", "listMakerAcceptances", "listMakerActivity", "listMakerPositions", "listMakerQuoteHistory", "listMarkets", "listOperations", "listRfqs", "publishMakerTelemetry", "releaseQuoteLease", "renewQuoteLease", "searchCatalog", "stream", "submitMakerSelfFundedTransaction"];
23
23
  readonly operator: readonly ["live", "ready"];
24
24
  };
@@ -1,13 +1,13 @@
1
1
  // Generated by scripts/generate.mjs; do not edit.
2
- export const sdkVersion = "203.0.0-execution-admission";
3
- export const openapiSha256 = "2304ae546fe97a86cbb1147dccdebe50f5bb44080c26b88503356ac9dd1aa096";
4
- export const realtimeSha256 = "6491fe1d9b5fdcfefcbee71716401effa181e7bcdf1fa4623fbb83dc5b2975cd";
2
+ export const sdkVersion = "205.0.0-device-vault-agents";
3
+ export const openapiSha256 = "e742feade28ca115077a4275e4a6260646278e9adcf0839987b8566a2221c8f5";
4
+ export const realtimeSha256 = "1cac740e108e84ad1979f6ccc71089efd840404cb72d1612a86edc02769637e3";
5
5
  export const jsonSchemaSha256 = {
6
6
  "account.schema.json": "5106e2d53abef190990eff113f6692dd27df5848439cf5a80a42c11e89f2bef6",
7
7
  "comments.schema.json": "18f4addcfa4e31c2c833fce8b8beca61d2e2ee5b6318c2ed0b479698ff56b65e",
8
8
  "common.schema.json": "04f51deb3cbea448e59195e26ede3212598d58a7940fe67eb2123fd9161c5edb",
9
9
  "core-exit.schema.json": "c7f617e815225cdcac95c236f8b73fbe288ee5713ff444c3be90eb915fc3a401",
10
- "error.schema.json": "85b2e13d449f137322779086c96d1355d0e70708647eb67b62c9b4070ed6530e",
10
+ "error.schema.json": "56b1e1c4ea26078cb8ce7ab3c554c0415c8c82eec45821180fc0d5e891046c1e",
11
11
  "hypercore.schema.json": "5b89b2bbff7ec8cc1b8717375d12ce9cd5ab6aa5af03c4fdc6cc753ef9583a2c",
12
12
  "identity.schema.json": "94534b768030736f4fd1fad285f1312454ca5fbff0b1eb5fab70416a78923bd0",
13
13
  "maker-access.schema.json": "49698ee0235e42064aae0397db1e0f646bdc10d9dfa10121714ba06dd69fee3b",
@@ -16,7 +16,7 @@ export const jsonSchemaSha256 = {
16
16
  "market-data.schema.json": "85db33fac6a29b0fa87a500bfda947d0ab3913b13f1c26663d4a7c0484c35786",
17
17
  "product-metadata.schema.json": "7c8ffbde878a0aedaed16814fcfd2e80038054b140886cc8736bb7b508042631",
18
18
  "quote.schema.json": "5616260d399d022bde2d0130cc9f8a09f71a3dc877276adf796c7a174d21b59a",
19
- "realtime.schema.json": "6491fe1d9b5fdcfefcbee71716401effa181e7bcdf1fa4623fbb83dc5b2975cd"
19
+ "realtime.schema.json": "1cac740e108e84ad1979f6ccc71089efd840404cb72d1612a86edc02769637e3"
20
20
  };
21
21
  export const operations = {
22
22
  "client": [
@@ -89,9 +89,11 @@ export const operations = {
89
89
  "getTrader",
90
90
  "getTraderPnl",
91
91
  "getUsernameAvailability",
92
+ "getVaultAgents",
92
93
  "getVolumeLeaderboard",
93
94
  "getWithdrawal",
94
95
  "grantComboCopyAgent",
96
+ "grantVaultAgent",
95
97
  "likeComment",
96
98
  "listAccountActivity",
97
99
  "listAccountPositions",
package/dist/stream.d.ts CHANGED
@@ -9,6 +9,8 @@ export type StreamEventOf<T extends StreamEventType> = StreamEvent extends infer
9
9
  } ? T extends K ? E : never : never : never;
10
10
  export type StreamSnapshot = Schemas["Snapshot"];
11
11
  export type StreamEventFrame = Schemas["EventFrame"];
12
+ /** A maker's capital, the same body as `GET /v1/makers/{maker_id}/capital`. */
13
+ export type StreamCapital = Schemas["CapitalFrame"]["data"];
12
14
  /** What a stream follows: the account (optionally with every open RFQ), or one maker. The client manages the cursor. */
13
15
  export type StreamSubscription = Omit<Schemas["AccountSubscription"], "cursor"> | Omit<Schemas["MakerSubscription"], "cursor">;
14
16
  /** A server frame: `channel` names what `data` carries. */
@@ -36,7 +38,11 @@ export type StreamOptions = {
36
38
  /** The WebSocket origin, such as `wss://hip4-ws.totalis.trade`. Defaults to `baseUrl`, else the environment's stream host. */
37
39
  readonly streamBaseUrl?: string;
38
40
  readonly accessToken: AccessToken;
39
- /** `publication_freshness` (1 s heartbeats and publication checkpoints) defaults on for an account, off for a maker. */
41
+ /**
42
+ * `publication_freshness` (1 s heartbeats and publication checkpoints) defaults on. Its
43
+ * heartbeats are what the silence timeout watches: a stream without it has no watchdog
44
+ * once subscribed, because WebSocket pings are invisible to clients.
45
+ */
40
46
  readonly subscription: StreamSubscription;
41
47
  /**
42
48
  * Resume after this cursor, for example one a bot persisted from `event.cursor`:
@@ -52,16 +58,25 @@ export type StreamOptions = {
52
58
  };
53
59
  /** Reconnect after this long without a frame. Default 5000 ms with publication freshness, otherwise off. */
54
60
  readonly silenceTimeoutMs?: number;
61
+ /** Reconnect when a connect has not subscribed after this long, including while `accessToken` resolves. Default 10000 ms. */
62
+ readonly connectTimeoutMs?: number;
55
63
  };
56
64
  type Listeners = {
57
65
  /** A new event, in order and deduplicated, with the frame that carried it. */
58
66
  event: (event: StreamEvent, frame: StreamEventFrame) => void;
59
67
  snapshot: (snapshot: StreamSnapshot) => void;
68
+ /**
69
+ * A maker subscription that set `capital`: its capital on subscribe, on every change and at
70
+ * least every 5 s, so a bot need not read capital before it quotes. Without one for 15 s,
71
+ * read capital over HTTP.
72
+ */
73
+ capital: (capital: StreamCapital) => void;
60
74
  /** Local state built from earlier events is void; replace it from the snapshot that follows. */
61
75
  reset: () => void;
62
76
  status: (status: StreamStatus) => void;
63
77
  /** Every parsed frame, including publication checkpoints, market refreshes and read invalidations. */
64
78
  frame: (frame: StreamFrame) => void;
79
+ /** A failure. The stream reconnects unless it is a StreamClosedError, so a run of these means it cannot get back. */
65
80
  error: (error: unknown) => void;
66
81
  };
67
82
  /**
@@ -107,6 +122,9 @@ export declare class TotalisStream {
107
122
  private nextDelayMs;
108
123
  private timer;
109
124
  private silence;
125
+ private connecting;
126
+ /** Counts connects, so one abandoned while its token resolved never opens a socket. */
127
+ private generation;
110
128
  private reauthorized;
111
129
  /** A REPLAY resume with publication freshness: live waits for the first publication frame, which follows the replayed events. */
112
130
  private replaying;
@@ -138,5 +156,7 @@ export declare class TotalisStream {
138
156
  private onClose;
139
157
  private disconnected;
140
158
  private watchSilence;
159
+ /** Gives up on the current connect or socket, reports why and reconnects. */
160
+ private abandon;
141
161
  }
142
162
  export {};
package/dist/stream.js CHANGED
@@ -63,12 +63,15 @@ export class TotalisStream {
63
63
  nextDelayMs;
64
64
  timer;
65
65
  silence;
66
+ connecting;
67
+ /** Counts connects, so one abandoned while its token resolved never opens a socket. */
68
+ generation = 0;
66
69
  reauthorized = false;
67
70
  /** A REPLAY resume with publication freshness: live waits for the first publication frame, which follows the replayed events. */
68
71
  replaying = false;
69
72
  seen = [];
70
73
  listeners = {
71
- event: new Set(), snapshot: new Set(), reset: new Set(), status: new Set(), frame: new Set(), error: new Set(),
74
+ event: new Set(), snapshot: new Set(), capital: new Set(), reset: new Set(), status: new Set(), frame: new Set(), error: new Set(),
72
75
  };
73
76
  constructor(options) {
74
77
  this.options = options;
@@ -87,6 +90,7 @@ export class TotalisStream {
87
90
  this.setStatus("closed");
88
91
  clearTimeout(this.timer);
89
92
  clearTimeout(this.silence);
93
+ clearTimeout(this.connecting);
90
94
  const socket = this.socket;
91
95
  this.socket = undefined;
92
96
  socket?.close(1000);
@@ -172,17 +176,20 @@ export class TotalisStream {
172
176
  this.emit("event", event, frame);
173
177
  }
174
178
  freshness() {
175
- const { type, publication_freshness = type === "account" } = this.options.subscription;
179
+ const { publication_freshness = true } = this.options.subscription;
176
180
  return publication_freshness;
177
181
  }
178
182
  async connect() {
179
183
  this.replaying = false;
180
184
  this.setStatus("connecting");
181
- const { accessToken, environment = "production", baseUrl, streamBaseUrl } = this.options;
185
+ const generation = ++this.generation;
186
+ const { accessToken, environment = "production", baseUrl, streamBaseUrl, connectTimeoutMs = 10_000 } = this.options;
187
+ clearTimeout(this.connecting);
188
+ this.connecting = setTimeout(() => this.abandon("unsubscribed", `stream not subscribed after ${connectTimeoutMs} ms`), connectTimeoutMs);
182
189
  let socket;
183
190
  try {
184
191
  const token = typeof accessToken === "function" ? await accessToken() : accessToken;
185
- if (this.status === "closed")
192
+ if (this.status === "closed" || generation !== this.generation)
186
193
  return;
187
194
  const open = this.options.webSocket ?? openWebSocket;
188
195
  const url = realtimeUrl(environment, baseUrl, streamBaseUrl);
@@ -191,6 +198,9 @@ export class TotalisStream {
191
198
  : open(url, [realtimeProtocol], { ...this.options.headers, Authorization: `Bearer ${token}` });
192
199
  }
193
200
  catch (error) {
201
+ if (generation !== this.generation)
202
+ return;
203
+ clearTimeout(this.connecting);
194
204
  this.emit("error", error);
195
205
  this.disconnected();
196
206
  return;
@@ -221,7 +231,7 @@ export class TotalisStream {
221
231
  this.watchSilence();
222
232
  }
223
233
  subscribe() {
224
- const { publication_freshness = this.options.subscription.type === "account", ...subscription } = this.options.subscription;
234
+ const { publication_freshness = true, ...subscription } = this.options.subscription;
225
235
  return {
226
236
  method: "subscribe",
227
237
  subscription: { ...subscription, ...(publication_freshness ? { publication_freshness } : {}), ...(this.cursor === undefined ? {} : { cursor: this.cursor }) },
@@ -242,6 +252,7 @@ export class TotalisStream {
242
252
  }
243
253
  break;
244
254
  case "subscriptionResponse": {
255
+ clearTimeout(this.connecting);
245
256
  const ready = frame.data;
246
257
  this.clockOffsetMs = Date.parse(ready.server_time) - Date.now();
247
258
  if (ready.resume === "REPLAY") {
@@ -271,6 +282,9 @@ export class TotalisStream {
271
282
  case "event":
272
283
  this.apply(frame.data, frame);
273
284
  break;
285
+ case "capital":
286
+ this.emit("capital", frame.data);
287
+ break;
274
288
  case "reset":
275
289
  this.reset();
276
290
  break;
@@ -287,6 +301,7 @@ export class TotalisStream {
287
301
  onClose(code, reason) {
288
302
  this.socket = undefined;
289
303
  clearTimeout(this.silence);
304
+ clearTimeout(this.connecting);
290
305
  if (this.status === "closed")
291
306
  return;
292
307
  const retry = errorRegistry[reason]?.retry ?? "BACKOFF";
@@ -321,11 +336,17 @@ export class TotalisStream {
321
336
  clearTimeout(this.silence);
322
337
  if (silenceTimeoutMs === undefined)
323
338
  return;
324
- this.silence = setTimeout(() => {
325
- const socket = this.socket;
326
- this.socket = undefined;
327
- socket?.close(4000, "silent");
328
- this.disconnected();
329
- }, silenceTimeoutMs);
339
+ this.silence = setTimeout(() => this.abandon("silent", `stream silent for ${silenceTimeoutMs} ms`), silenceTimeoutMs);
340
+ }
341
+ /** Gives up on the current connect or socket, reports why and reconnects. */
342
+ abandon(reason, message) {
343
+ this.generation++;
344
+ clearTimeout(this.silence);
345
+ clearTimeout(this.connecting);
346
+ const socket = this.socket;
347
+ this.socket = undefined;
348
+ socket?.close(4000, reason);
349
+ this.emit("error", new Error(message));
350
+ this.disconnected();
330
351
  }
331
352
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totalis/hip4-client",
3
- "version": "0.74.0",
3
+ "version": "0.75.0",
4
4
  "description": "Totalis HIP-4 SDK: typed HTTP clients, signer-agnostic typed data, a retrying request layer, pagination, a realtime stream and taker/maker flows",
5
5
  "type": "module",
6
6
  "files": [