@totalis/hip4-client 0.85.0 → 0.87.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,36 @@
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.87.0
7
+
8
+ ### Added
9
+
10
+ - Every comment gains `singles`: the HyperCore outcome sides of its market
11
+ the author holds now, each with `shares` and `average_price` (TT-2682),
12
+ for authors whose public trader profile is on; null otherwise and while
13
+ not known. Contract `214.0.0-comment-singles`. Additive.
14
+
15
+ ### Changed
16
+
17
+ - The golden Combo stake Totalis pays is 2 USDC, up from 1 USDC
18
+ (#1626): `getGoldenSuggestions` prices its suggestions at 2 USDC and
19
+ `createGoldenRfq` opens the RFQ at 2 USDC. No shape change.
20
+
21
+ ### Fixed
22
+
23
+ - A public API host passed as `baseUrl` (`https://hip4-api.totalis.trade`
24
+ or its staging host) now streams from that environment's stream host.
25
+ Production's API host no longer serves `/v1/stream` or
26
+ `/v1/market-stream` (TT-2697).
27
+
28
+ ## 0.86.0
29
+
30
+ ### Added
31
+
32
+ - New subcategory filters: Serie A (`serie_a`) and Nations League
33
+ (`nations_league`) under Sports, CS2 (`counter_strike`) under
34
+ Esports. Contract `213.0.0-league-shelves`. Additive.
35
+
6
36
  ## 0.85.0
7
37
 
8
38
  ### Added
package/dist/base.d.ts CHANGED
@@ -7,8 +7,7 @@ export declare const publicServers: {
7
7
  };
8
8
  /**
9
9
  * Where each environment serves its WebSockets (`/v1/stream` and
10
- * `/v1/market-stream`). Production and staging have a dedicated stream host;
11
- * the API host still serves both paths during the migration.
10
+ * `/v1/market-stream`). Production's API host no longer serves them.
12
11
  */
13
12
  export declare const publicStreamServers: {
14
13
  readonly production: "wss://hip4-ws.totalis.trade";
@@ -36,6 +35,9 @@ export declare function partnerHeader(partnerKey: string | undefined): Record<st
36
35
  /** Request headers as a plain record, for the stream handshake outside a browser. */
37
36
  export declare function headerRecord(headers: ClientOptions["headers"]): Record<string, string>;
38
37
  export declare function serverUrl(environment: PublicEnvironment, baseUrl?: string): string;
39
- /** A custom `baseUrl` serves the stream paths too, so it stays the stream origin unless `streamBaseUrl` is set. */
38
+ /**
39
+ * A custom `baseUrl` serves the stream paths too, so it stays the stream origin unless `streamBaseUrl` is set.
40
+ * A public API host as `baseUrl` streams from its environment's stream host.
41
+ */
40
42
  export declare function streamServerUrl(environment: PublicEnvironment, baseUrl?: string, streamBaseUrl?: string): string;
41
43
  export declare function audienceClient<Paths extends Record<string, unknown>>(environment: PublicEnvironment, options?: ApiClientOptions): import("openapi-fetch").Client<Paths, `${string}/${string}`>;
package/dist/base.js CHANGED
@@ -7,8 +7,7 @@ export const publicServers = {
7
7
  };
8
8
  /**
9
9
  * Where each environment serves its WebSockets (`/v1/stream` and
10
- * `/v1/market-stream`). Production and staging have a dedicated stream host;
11
- * the API host still serves both paths during the migration.
10
+ * `/v1/market-stream`). Production's API host no longer serves them.
12
11
  */
13
12
  export const publicStreamServers = {
14
13
  production: "wss://hip4-ws.totalis.trade",
@@ -35,9 +34,21 @@ export function headerRecord(headers) {
35
34
  export function serverUrl(environment, baseUrl) {
36
35
  return baseUrl ?? publicServers[environment];
37
36
  }
38
- /** A custom `baseUrl` serves the stream paths too, so it stays the stream origin unless `streamBaseUrl` is set. */
37
+ function urlOrigin(value) {
38
+ try {
39
+ return value === undefined ? undefined : new URL(value).origin;
40
+ }
41
+ catch {
42
+ return undefined;
43
+ }
44
+ }
45
+ /**
46
+ * A custom `baseUrl` serves the stream paths too, so it stays the stream origin unless `streamBaseUrl` is set.
47
+ * A public API host as `baseUrl` streams from its environment's stream host.
48
+ */
39
49
  export function streamServerUrl(environment, baseUrl, streamBaseUrl) {
40
- return (streamBaseUrl ?? baseUrl ?? publicStreamServers[environment]).replace(/^http/, "ws");
50
+ const publicApi = Object.keys(publicServers).find((name) => name !== "local" && publicServers[name] === urlOrigin(baseUrl));
51
+ return (streamBaseUrl ?? (publicApi ? publicStreamServers[publicApi] : baseUrl) ?? publicStreamServers[environment]).replace(/^http/, "ws");
41
52
  }
42
53
  export function audienceClient(environment, options = {}) {
43
54
  const { accessToken, headers, baseUrl, retry, partnerKey, fetch: fetchImpl, ...rest } = options;
@@ -224,7 +224,7 @@ export type components = {
224
224
  readonly CategorySlug: "crypto" | "economics" | "entertainment" | "esports" | "finance" | "politics" | "sports" | "tech" | "weather";
225
225
  readonly Subcategory: string | null;
226
226
  /** @enum {string} */
227
- readonly schema: "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "ufc" | "lol" | "epl" | "ucl" | "uel" | "efl" | "la_liga" | "world_cup" | "bundesliga" | "liga_portugal" | "ligue_1" | "f1" | "ipl" | "cricket" | "transfers" | "btc" | "eth" | "sol" | "hype" | "up_down" | "stocks" | "indices" | "etfs" | "earnings" | "rates" | "inflation" | "commodities" | "fx" | "usa" | "global" | "other";
227
+ readonly schema: "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "ufc" | "lol" | "counter_strike" | "epl" | "ucl" | "uel" | "efl" | "la_liga" | "serie_a" | "bundesliga" | "ligue_1" | "liga_portugal" | "nations_league" | "world_cup" | "f1" | "ipl" | "cricket" | "transfers" | "btc" | "eth" | "sol" | "hype" | "up_down" | "stocks" | "indices" | "etfs" | "earnings" | "rates" | "inflation" | "commodities" | "fx" | "usa" | "global" | "other";
228
228
  readonly Slug: components["schemas"]["Subcategory"] & string & components["schemas"]["schema"];
229
229
  /** @enum {string} */
230
230
  readonly Frequency: "5m" | "15m" | "hourly" | "daily" | "weekly" | "monthly";
@@ -724,7 +724,7 @@ export type paths = {
724
724
  };
725
725
  /**
726
726
  * List golden suggestions
727
- * @description Up to three ready-made golden Combos from different games, for an account whose golden ticket is available: 5 legs from golden markets at the 1 USDC golden stake, one per fair-multiplier band, biggest first. Each shows the best house-maker offer the promo account holds on it right now, live while any ticket holder reads golden Combos; a five with no such offer, or one paying under the golden value floor, is left out. Picking one only fills the slip; place it through POST /v1/me/golden/rfqs, which asks afresh, so the slip's own offer is what places.
727
+ * @description Up to three ready-made golden Combos from different games, for an account whose golden ticket is available: 5 legs from golden markets at the 2 USDC golden stake, one per fair-multiplier band, biggest first. Each shows the best house-maker offer the promo account holds on it right now, live while any ticket holder reads golden Combos; a five with no such offer, or one paying under the golden value floor, is left out. Picking one only fills the slip; place it through POST /v1/me/golden/rfqs, which asks afresh, so the slip's own offer is what places.
728
728
  */
729
729
  readonly get: operations["getGoldenSuggestions"];
730
730
  readonly put?: never;
@@ -746,7 +746,7 @@ export type paths = {
746
746
  readonly put?: never;
747
747
  /**
748
748
  * Open a golden RFQ
749
- * @description Opens the Totalis promo account's RFQ for this account's golden Combo: exactly 5 legs, each a golden market, at a 1 USDC stake Totalis pays. Makers quote it like any RFQ; read the best Totalis maker quote with GET /v1/me/golden/rfqs/{rfq_id}/offer.
749
+ * @description Opens the Totalis promo account's RFQ for this account's golden Combo: exactly 5 legs, each a golden market, at a 2 USDC stake Totalis pays. Makers quote it like any RFQ; read the best Totalis maker quote with GET /v1/me/golden/rfqs/{rfq_id}/offer.
750
750
  */
751
751
  readonly post: operations["createGoldenRfq"];
752
752
  readonly delete?: never;
@@ -1352,7 +1352,7 @@ export type paths = {
1352
1352
  };
1353
1353
  /**
1354
1354
  * List comments
1355
- * @description A page of a market's top-level comments. Name the market with exactly one of question_id, for a market with a question, or outcome_id, for a standalone outcome; anything else is 400 INVALID_QUERY. A market with no comments, or an ID no market has, is an empty page. sort=top (the default) orders by like_count, then newest; sort=newest orders newest first. Pages follow next_cursor; a cursor from the other sort is 400 INVALID_CURSOR. filter=holders lists only comments by participants who hold an open Combo with a leg on the market now (any of a question's outcomes), pinned included, so holder is true on each; a question the catalog no longer lists, such as a settled one, has no holders, so its page is empty. While who holds is not known it is 503 SOURCE_UNAVAILABLE, or 503 MARKET_DATA_UNAVAILABLE before the market catalog has loaded. Like counts change between pages, so a comment can show on two pages of sort=top or on none. A deleted comment is listed, with author and body null, only while it has replies; removed marks one a moderator deleted. The first page carries pinned, the comment a moderator pinned to lead the thread in either sort, or null; it is listed among comments where it falls too, so a client that shows it first skips it there. Anyone may read: a signed-in participant session also gets liked and own for its own likes and comments; signed out, both are false. Replies come from GET /v1/comments/{comment_id}/replies.
1355
+ * @description A page of a market's top-level comments. Name the market with exactly one of question_id, for a market with a question, or outcome_id, for a standalone outcome; anything else is 400 INVALID_QUERY. A market with no comments, or an ID no market has, is an empty page. sort=top (the default) orders by like_count, then newest; sort=newest orders newest first. Pages follow next_cursor; a cursor from the other sort is 400 INVALID_CURSOR. Each comment's singles lists the HyperCore outcome sides of the market its author's account wallet holds now, for an author whose public trader profile is on; null for any other author and while it is not known. filter=holders lists only comments by participants who hold an open Combo with a leg on the market now (any of a question's outcomes), pinned included, so holder is true on each; HyperCore singles do not make a holder here; a question the catalog no longer lists, such as a settled one, has no holders, so its page is empty. While who holds is not known it is 503 SOURCE_UNAVAILABLE, or 503 MARKET_DATA_UNAVAILABLE before the market catalog has loaded. Like counts change between pages, so a comment can show on two pages of sort=top or on none. A deleted comment is listed, with author and body null, only while it has replies; removed marks one a moderator deleted. The first page carries pinned, the comment a moderator pinned to lead the thread in either sort, or null; it is listed among comments where it falls too, so a client that shows it first skips it there. Anyone may read: a signed-in participant session also gets liked and own for its own likes and comments; signed out, both are false. Replies come from GET /v1/comments/{comment_id}/replies.
1356
1356
  */
1357
1357
  readonly get: operations["listComments"];
1358
1358
  readonly put?: never;
@@ -4826,6 +4826,17 @@ export type components = {
4826
4826
  readonly OperationState: "QUEUED" | "IN_FLIGHT" | "RETRYABLE" | "UNKNOWN" | "COMMITTED" | "REVERTED" | "EXPIRED_UNEXECUTED";
4827
4827
  /** @description 1 to 1000 characters after surrounding whitespace is trimmed. Newlines are kept; other control characters are refused. */
4828
4828
  readonly CommentBody: string;
4829
+ /** @description A HIP-4 outcome side of the comment's market the author's account wallet holds on HyperCore now, as GET /v1/traders/{username} lists it without opened_at. */
4830
+ readonly CommentSingle: {
4831
+ /** @description HIP-4 outcome ID held, as a decimal string. */
4832
+ readonly outcome_id: components["schemas"]["UInt32String"];
4833
+ /** @description Outcome side held. */
4834
+ readonly side: components["schemas"]["Side"];
4835
+ /** @description Shares held, an exact decimal string with no trailing zeros. */
4836
+ readonly shares: string;
4837
+ /** @description What each held share cost on average in USDC, fees included: buys add their cost and a sale removes its shares' share of it. Rounded half away from zero to 6 decimals, no trailing zeros. Absent when the holding's fills brought cash in rather than paid it out. */
4838
+ readonly average_price?: string;
4839
+ };
4829
4840
  /**
4830
4841
  * @description A reaction a comment can get: fire 🔥, laugh 😂, mind_blown 🤯, cry 😭, rocket 🚀, skull 💀.
4831
4842
  * @enum {string}
@@ -4857,6 +4868,8 @@ export type components = {
4857
4868
  readonly removed: boolean;
4858
4869
  /** @description True when its author holds a position on its market now: an open Combo with a leg on the outcome, or on any of the question's outcomes. HyperCore outcome tokens do not count. Null once it is deleted, and while it is not known: holdings could not be read, or the market catalog does not name the question's outcomes yet. */
4859
4870
  readonly holder: boolean | null;
4871
+ /** @description The HyperCore outcome sides of its market (the outcome, or any of the question's outcomes) its author's account wallet holds now, newest opened first; empty when it holds none. Null once it is deleted; when the author's public trader profile is off or their account is not ACTIVE, since exact positions would show which wallet is theirs, as GET /v1/traders/{username} refuses to; and while it is not known: off Mainnet, while the account index is behind or does not hold history since launch, when the author has no single account wallet, when an outcome token of the market moved to or from it by transfer, or before the market catalog names the question's outcomes. Servers before contract 214 omit it. */
4872
+ readonly singles: readonly components["schemas"]["CommentSingle"][] | null;
4860
4873
  readonly like_count: number;
4861
4874
  /** @description Live replies; always 0 on a reply. */
4862
4875
  readonly reply_count: number;
@@ -6362,7 +6375,7 @@ export type components = {
6362
6375
  * @description Platform taxonomy subcategory slug. The cursor is bound to this filter.
6363
6376
  * @example epl
6364
6377
  */
6365
- readonly Subcategory: "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "ufc" | "lol" | "epl" | "ucl" | "uel" | "efl" | "la_liga" | "world_cup" | "bundesliga" | "liga_portugal" | "ligue_1" | "f1" | "ipl" | "cricket" | "transfers" | "btc" | "eth" | "sol" | "hype" | "up_down" | "stocks" | "indices" | "etfs" | "earnings" | "rates" | "inflation" | "commodities" | "fx" | "usa" | "global" | "other";
6378
+ readonly Subcategory: "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "ufc" | "lol" | "counter_strike" | "epl" | "ucl" | "uel" | "efl" | "la_liga" | "serie_a" | "bundesliga" | "ligue_1" | "liga_portugal" | "nations_league" | "world_cup" | "f1" | "ipl" | "cricket" | "transfers" | "btc" | "eth" | "sol" | "hype" | "up_down" | "stocks" | "indices" | "etfs" | "earnings" | "rates" | "inflation" | "commodities" | "fx" | "usa" | "global" | "other";
6366
6379
  /**
6367
6380
  * @description Outcome side whose price history is returned.
6368
6381
  * @example YES
@@ -1,9 +1,9 @@
1
- export declare const sdkVersion = "212.0.0-suggested-categories";
2
- export declare const openapiSha256 = "7dfe6c962d2acc85b455fa7cbd1b4d8a6cec4b2dabf96550219fb483d3d71224";
1
+ export declare const sdkVersion = "214.0.0-comment-singles";
2
+ export declare const openapiSha256 = "91a780a0d0f17806095ce8ffc89d9e823807105a3a409ab72035ac6c7167c8f7";
3
3
  export declare const realtimeSha256 = "f4f1078418b5302417babe1380b85b0c4f89cb0fdfaff3a46154dd2018625c07";
4
4
  export declare const jsonSchemaSha256: {
5
5
  readonly "account.schema.json": "96c6f76d10567b00bff122e31eca177b3879eec78628113832d00bc9ea6db891";
6
- readonly "comments.schema.json": "18f4addcfa4e31c2c833fce8b8beca61d2e2ee5b6318c2ed0b479698ff56b65e";
6
+ readonly "comments.schema.json": "7cb61352e5a0280fa34951fdcc2d934062bf628da4743f0dc8c763d0b79b7611";
7
7
  readonly "common.schema.json": "04f51deb3cbea448e59195e26ede3212598d58a7940fe67eb2123fd9161c5edb";
8
8
  readonly "core-exit.schema.json": "c7f617e815225cdcac95c236f8b73fbe288ee5713ff444c3be90eb915fc3a401";
9
9
  readonly "error.schema.json": "d15dad1b8369b45746271e0fddd2106535c22493668b703544c9ddfa80761012";
@@ -1,10 +1,10 @@
1
1
  // Generated by scripts/generate.mjs; do not edit.
2
- export const sdkVersion = "212.0.0-suggested-categories";
3
- export const openapiSha256 = "7dfe6c962d2acc85b455fa7cbd1b4d8a6cec4b2dabf96550219fb483d3d71224";
2
+ export const sdkVersion = "214.0.0-comment-singles";
3
+ export const openapiSha256 = "91a780a0d0f17806095ce8ffc89d9e823807105a3a409ab72035ac6c7167c8f7";
4
4
  export const realtimeSha256 = "f4f1078418b5302417babe1380b85b0c4f89cb0fdfaff3a46154dd2018625c07";
5
5
  export const jsonSchemaSha256 = {
6
6
  "account.schema.json": "96c6f76d10567b00bff122e31eca177b3879eec78628113832d00bc9ea6db891",
7
- "comments.schema.json": "18f4addcfa4e31c2c833fce8b8beca61d2e2ee5b6318c2ed0b479698ff56b65e",
7
+ "comments.schema.json": "7cb61352e5a0280fa34951fdcc2d934062bf628da4743f0dc8c763d0b79b7611",
8
8
  "common.schema.json": "04f51deb3cbea448e59195e26ede3212598d58a7940fe67eb2123fd9161c5edb",
9
9
  "core-exit.schema.json": "c7f617e815225cdcac95c236f8b73fbe288ee5713ff444c3be90eb915fc3a401",
10
10
  "error.schema.json": "d15dad1b8369b45746271e0fddd2106535c22493668b703544c9ddfa80761012",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totalis/hip4-client",
3
- "version": "0.85.0",
3
+ "version": "0.87.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": [