@lightconexyz/lightcone-sdk 0.5.2 → 0.7.1

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 (228) hide show
  1. package/README.md +39 -5
  2. package/dist/auth/client.d.ts.map +1 -1
  3. package/dist/auth/client.js +2 -0
  4. package/dist/auth/client.js.map +1 -1
  5. package/dist/auth/index.d.ts +15 -0
  6. package/dist/auth/index.d.ts.map +1 -1
  7. package/dist/auth/index.js +10 -1
  8. package/dist/auth/index.js.map +1 -1
  9. package/dist/client.d.ts +43 -4
  10. package/dist/client.d.ts.map +1 -1
  11. package/dist/client.js +70 -9
  12. package/dist/client.js.map +1 -1
  13. package/dist/context.d.ts +7 -1
  14. package/dist/context.d.ts.map +1 -1
  15. package/dist/context.js +60 -6
  16. package/dist/context.js.map +1 -1
  17. package/dist/domain/admin/client.d.ts +21 -2
  18. package/dist/domain/admin/client.d.ts.map +1 -1
  19. package/dist/domain/admin/client.js +90 -4
  20. package/dist/domain/admin/client.js.map +1 -1
  21. package/dist/domain/admin/wire.d.ts +292 -7
  22. package/dist/domain/admin/wire.d.ts.map +1 -1
  23. package/dist/domain/admin/wire.js.map +1 -1
  24. package/dist/domain/faucet.d.ts +25 -0
  25. package/dist/domain/faucet.d.ts.map +1 -0
  26. package/dist/domain/faucet.js +3 -0
  27. package/dist/domain/faucet.js.map +1 -0
  28. package/dist/domain/index.d.ts +2 -0
  29. package/dist/domain/index.d.ts.map +1 -1
  30. package/dist/domain/index.js +3 -1
  31. package/dist/domain/index.js.map +1 -1
  32. package/dist/domain/market/client.d.ts +23 -2
  33. package/dist/domain/market/client.d.ts.map +1 -1
  34. package/dist/domain/market/client.js +31 -1
  35. package/dist/domain/market/client.js.map +1 -1
  36. package/dist/domain/market/convert.d.ts +10 -0
  37. package/dist/domain/market/convert.d.ts.map +1 -1
  38. package/dist/domain/market/convert.js +44 -5
  39. package/dist/domain/market/convert.js.map +1 -1
  40. package/dist/domain/market/icon.d.ts +17 -0
  41. package/dist/domain/market/icon.d.ts.map +1 -0
  42. package/dist/domain/market/icon.js +25 -0
  43. package/dist/domain/market/icon.js.map +1 -0
  44. package/dist/domain/market/index.d.ts +21 -5
  45. package/dist/domain/market/index.d.ts.map +1 -1
  46. package/dist/domain/market/index.js +15 -1
  47. package/dist/domain/market/index.js.map +1 -1
  48. package/dist/domain/market/outcome.d.ts +4 -1
  49. package/dist/domain/market/outcome.d.ts.map +1 -1
  50. package/dist/domain/market/outcome.js +8 -7
  51. package/dist/domain/market/outcome.js.map +1 -1
  52. package/dist/domain/market/tokens.d.ts +55 -3
  53. package/dist/domain/market/tokens.d.ts.map +1 -1
  54. package/dist/domain/market/tokens.js +105 -9
  55. package/dist/domain/market/tokens.js.map +1 -1
  56. package/dist/domain/market/wire.d.ts +69 -10
  57. package/dist/domain/market/wire.d.ts.map +1 -1
  58. package/dist/domain/market/wire.js +5 -0
  59. package/dist/domain/market/wire.js.map +1 -1
  60. package/dist/domain/metrics/client.d.ts +66 -0
  61. package/dist/domain/metrics/client.d.ts.map +1 -0
  62. package/dist/domain/metrics/client.js +124 -0
  63. package/dist/domain/metrics/client.js.map +1 -0
  64. package/dist/domain/metrics/index.d.ts +3 -0
  65. package/dist/domain/metrics/index.d.ts.map +1 -0
  66. package/dist/domain/metrics/index.js +19 -0
  67. package/dist/domain/metrics/index.js.map +1 -0
  68. package/dist/domain/metrics/wire.d.ts +346 -0
  69. package/dist/domain/metrics/wire.d.ts.map +1 -0
  70. package/dist/domain/metrics/wire.js +3 -0
  71. package/dist/domain/metrics/wire.js.map +1 -0
  72. package/dist/domain/notification/client.d.ts +6 -0
  73. package/dist/domain/notification/client.d.ts.map +1 -1
  74. package/dist/domain/notification/client.js +10 -0
  75. package/dist/domain/notification/client.js.map +1 -1
  76. package/dist/domain/notification/index.d.ts +6 -2
  77. package/dist/domain/notification/index.d.ts.map +1 -1
  78. package/dist/domain/notification/index.js.map +1 -1
  79. package/dist/domain/order/client.d.ts +34 -6
  80. package/dist/domain/order/client.d.ts.map +1 -1
  81. package/dist/domain/order/client.js +88 -21
  82. package/dist/domain/order/client.js.map +1 -1
  83. package/dist/domain/order/convert.d.ts +5 -5
  84. package/dist/domain/order/convert.d.ts.map +1 -1
  85. package/dist/domain/order/convert.js +3 -3
  86. package/dist/domain/order/convert.js.map +1 -1
  87. package/dist/domain/order/index.d.ts +3 -2
  88. package/dist/domain/order/index.d.ts.map +1 -1
  89. package/dist/domain/order/index.js +11 -3
  90. package/dist/domain/order/index.js.map +1 -1
  91. package/dist/domain/order/state.d.ts +9 -7
  92. package/dist/domain/order/state.d.ts.map +1 -1
  93. package/dist/domain/order/state.js +81 -28
  94. package/dist/domain/order/state.js.map +1 -1
  95. package/dist/domain/orderbook/client.d.ts +6 -2
  96. package/dist/domain/orderbook/client.d.ts.map +1 -1
  97. package/dist/domain/orderbook/client.js +17 -0
  98. package/dist/domain/orderbook/client.js.map +1 -1
  99. package/dist/domain/orderbook/index.d.ts +1 -1
  100. package/dist/domain/orderbook/index.d.ts.map +1 -1
  101. package/dist/domain/orderbook/index.js +3 -8
  102. package/dist/domain/orderbook/index.js.map +1 -1
  103. package/dist/domain/orderbook/state.d.ts +30 -7
  104. package/dist/domain/orderbook/state.d.ts.map +1 -1
  105. package/dist/domain/orderbook/state.js +41 -12
  106. package/dist/domain/orderbook/state.js.map +1 -1
  107. package/dist/domain/position/builders.d.ts +11 -8
  108. package/dist/domain/position/builders.d.ts.map +1 -1
  109. package/dist/domain/position/builders.js +31 -25
  110. package/dist/domain/position/builders.js.map +1 -1
  111. package/dist/domain/position/client.d.ts +66 -5
  112. package/dist/domain/position/client.d.ts.map +1 -1
  113. package/dist/domain/position/client.js +101 -9
  114. package/dist/domain/position/client.js.map +1 -1
  115. package/dist/domain/position/index.d.ts +3 -2
  116. package/dist/domain/position/index.d.ts.map +1 -1
  117. package/dist/domain/position/index.js.map +1 -1
  118. package/dist/domain/price_history/client.d.ts +12 -1
  119. package/dist/domain/price_history/client.d.ts.map +1 -1
  120. package/dist/domain/price_history/client.js +14 -0
  121. package/dist/domain/price_history/client.js.map +1 -1
  122. package/dist/domain/price_history/wire.d.ts +27 -0
  123. package/dist/domain/price_history/wire.d.ts.map +1 -1
  124. package/dist/domain/price_history/wire.js.map +1 -1
  125. package/dist/domain/referral/client.d.ts +6 -0
  126. package/dist/domain/referral/client.d.ts.map +1 -1
  127. package/dist/domain/referral/client.js +22 -9
  128. package/dist/domain/referral/client.js.map +1 -1
  129. package/dist/domain/trade/client.d.ts +1 -0
  130. package/dist/domain/trade/client.d.ts.map +1 -1
  131. package/dist/domain/trade/client.js +14 -0
  132. package/dist/domain/trade/client.js.map +1 -1
  133. package/dist/domain/trade/wire.d.ts +6 -0
  134. package/dist/domain/trade/wire.d.ts.map +1 -1
  135. package/dist/domain/trade/wire.js.map +1 -1
  136. package/dist/env.d.ts +6 -1
  137. package/dist/env.d.ts.map +1 -1
  138. package/dist/env.js +19 -9
  139. package/dist/env.js.map +1 -1
  140. package/dist/http/client.d.ts +9 -0
  141. package/dist/http/client.d.ts.map +1 -1
  142. package/dist/http/client.js +29 -11
  143. package/dist/http/client.js.map +1 -1
  144. package/dist/index.d.ts +2 -2
  145. package/dist/index.d.ts.map +1 -1
  146. package/dist/index.js.map +1 -1
  147. package/dist/prelude.d.ts +16 -7
  148. package/dist/prelude.d.ts.map +1 -1
  149. package/dist/prelude.js +10 -7
  150. package/dist/prelude.js.map +1 -1
  151. package/dist/privy/index.d.ts +1 -1
  152. package/dist/privy/index.js.map +1 -1
  153. package/dist/program/accounts.d.ts +12 -7
  154. package/dist/program/accounts.d.ts.map +1 -1
  155. package/dist/program/accounts.js +38 -16
  156. package/dist/program/accounts.js.map +1 -1
  157. package/dist/program/builder.d.ts +0 -4
  158. package/dist/program/builder.d.ts.map +1 -1
  159. package/dist/program/builder.js +0 -8
  160. package/dist/program/builder.js.map +1 -1
  161. package/dist/program/constants.d.ts +20 -7
  162. package/dist/program/constants.d.ts.map +1 -1
  163. package/dist/program/constants.js +21 -8
  164. package/dist/program/constants.js.map +1 -1
  165. package/dist/program/error.d.ts +25 -1
  166. package/dist/program/error.d.ts.map +1 -1
  167. package/dist/program/error.js +72 -0
  168. package/dist/program/error.js.map +1 -1
  169. package/dist/program/index.d.ts +7 -7
  170. package/dist/program/index.d.ts.map +1 -1
  171. package/dist/program/index.js +36 -9
  172. package/dist/program/index.js.map +1 -1
  173. package/dist/program/instructions.d.ts +184 -71
  174. package/dist/program/instructions.d.ts.map +1 -1
  175. package/dist/program/instructions.js +573 -140
  176. package/dist/program/instructions.js.map +1 -1
  177. package/dist/program/orders.js +2 -2
  178. package/dist/program/orders.js.map +1 -1
  179. package/dist/program/pda.d.ts +21 -3
  180. package/dist/program/pda.d.ts.map +1 -1
  181. package/dist/program/pda.js +43 -6
  182. package/dist/program/pda.js.map +1 -1
  183. package/dist/program/types.d.ts +139 -21
  184. package/dist/program/types.d.ts.map +1 -1
  185. package/dist/program/types.js.map +1 -1
  186. package/dist/program/utils.d.ts +31 -2
  187. package/dist/program/utils.d.ts.map +1 -1
  188. package/dist/program/utils.js +132 -5
  189. package/dist/program/utils.js.map +1 -1
  190. package/dist/rpc.d.ts +6 -1
  191. package/dist/rpc.d.ts.map +1 -1
  192. package/dist/rpc.js +9 -7
  193. package/dist/rpc.js.map +1 -1
  194. package/dist/rpcFailover.d.ts +22 -0
  195. package/dist/rpcFailover.d.ts.map +1 -0
  196. package/dist/rpcFailover.js +71 -0
  197. package/dist/rpcFailover.js.map +1 -0
  198. package/dist/shared/fmt/constants.d.ts +5 -0
  199. package/dist/shared/fmt/constants.d.ts.map +1 -0
  200. package/dist/shared/fmt/constants.js +25 -0
  201. package/dist/shared/fmt/constants.js.map +1 -0
  202. package/dist/shared/fmt/decimal.d.ts +7 -0
  203. package/dist/shared/fmt/decimal.d.ts.map +1 -1
  204. package/dist/shared/fmt/decimal.js +32 -24
  205. package/dist/shared/fmt/decimal.js.map +1 -1
  206. package/dist/shared/fmt/num.d.ts +7 -0
  207. package/dist/shared/fmt/num.d.ts.map +1 -1
  208. package/dist/shared/fmt/num.js +27 -15
  209. package/dist/shared/fmt/num.js.map +1 -1
  210. package/dist/shared/index.d.ts +1 -1
  211. package/dist/shared/index.d.ts.map +1 -1
  212. package/dist/shared/index.js +2 -1
  213. package/dist/shared/index.js.map +1 -1
  214. package/dist/shared/types.d.ts +1 -0
  215. package/dist/shared/types.d.ts.map +1 -1
  216. package/dist/shared/types.js +19 -0
  217. package/dist/shared/types.js.map +1 -1
  218. package/dist/ws/client.node.js +1 -1
  219. package/dist/ws/client.node.js.map +1 -1
  220. package/dist/ws/index.d.ts +12 -1
  221. package/dist/ws/index.d.ts.map +1 -1
  222. package/dist/ws/index.js +20 -0
  223. package/dist/ws/index.js.map +1 -1
  224. package/dist/ws/subscriptions.d.ts +6 -0
  225. package/dist/ws/subscriptions.d.ts.map +1 -1
  226. package/dist/ws/subscriptions.js +4 -0
  227. package/dist/ws/subscriptions.js.map +1 -1
  228. package/package.json +1 -1
@@ -1,6 +1,16 @@
1
+ import type { OrderBookPair } from "../orderbook";
2
+ import { resolveIconUrls } from "./icon";
1
3
  import { type Market } from "./index";
4
+ import { globalDepositAssetFromWire, type DepositAsset, type DepositAssetPair } from "./tokens";
2
5
  import type { MarketResponse } from "./wire";
6
+ export { globalDepositAssetFromWire, resolveIconUrls };
3
7
  export declare function marketFromWire(source: MarketResponse): Market;
8
+ /**
9
+ * Derive unique base/quote deposit-asset pairs across the market's orderbook
10
+ * pairs. Deduplicated by `(basePubkey, quotePubkey)`; orderbook pairs whose
11
+ * base or quote deposit asset is not present in `depositAssets` are skipped.
12
+ */
13
+ export declare function deriveDepositAssetPairs(depositAssets: DepositAsset[], orderbookPairs: OrderBookPair[]): DepositAssetPair[];
4
14
  export declare function tryMarketFromWire(source: MarketResponse): {
5
15
  market?: Market;
6
16
  error?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/domain/market/convert.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,MAAM,EAAiC,MAAM,SAAS,CAAC;AAErF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CA0E7D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAM7F"}
1
+ {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/domain/market/convert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EAAkB,KAAK,MAAM,EAAiC,MAAM,SAAS,CAAC;AACrF,OAAO,EACL,0BAA0B,EAG1B,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,CAAC;AAEvD,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CA2F7D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,YAAY,EAAE,EAC7B,cAAc,EAAE,aAAa,EAAE,GAC9B,gBAAgB,EAAE,CAwBpB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAM7F"}
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveIconUrls = exports.globalDepositAssetFromWire = void 0;
3
4
  exports.marketFromWire = marketFromWire;
5
+ exports.deriveDepositAssetPairs = deriveDepositAssetPairs;
4
6
  exports.tryMarketFromWire = tryMarketFromWire;
5
7
  const shared_1 = require("../../shared");
6
8
  const convert_1 = require("../orderbook/convert");
9
+ const icon_1 = require("./icon");
10
+ Object.defineProperty(exports, "resolveIconUrls", { enumerable: true, get: function () { return icon_1.resolveIconUrls; } });
7
11
  const outcome_1 = require("./outcome");
8
12
  const index_1 = require("./index");
9
13
  const tokens_1 = require("./tokens");
14
+ Object.defineProperty(exports, "globalDepositAssetFromWire", { enumerable: true, get: function () { return tokens_1.globalDepositAssetFromWire; } });
10
15
  function marketFromWire(source) {
11
16
  const errors = [];
12
17
  const outcomes = source.outcomes.flatMap((outcome) => {
@@ -52,10 +57,16 @@ function marketFromWire(source) {
52
57
  errors.push("Missing description");
53
58
  if (!source.definition)
54
59
  errors.push("Missing definition");
55
- if (!source.icon_url)
60
+ const iconUrls = (0, icon_1.resolveIconUrls)(source.icon_url_low, source.icon_url_medium, source.icon_url_high);
61
+ if (!iconUrls)
56
62
  errors.push("Missing icon URL");
57
- if (!source.banner_image_url)
63
+ const bannerUrls = (0, icon_1.resolveIconUrls)(source.banner_image_url_low, source.banner_image_url_medium, source.banner_image_url_high);
64
+ if (!bannerUrls)
58
65
  errors.push("Missing banner image URL");
66
+ const depositAssetPairs = (0, tokens_1.sortByDisplayPriority)(deriveDepositAssetPairs(depositAssets, orderbookPairs));
67
+ if (depositAssetPairs.length === 0) {
68
+ errors.push("Missing deposit asset pairs");
69
+ }
59
70
  if (errors.length > 0) {
60
71
  throw new index_1.MarketValidationError(source.market_pubkey, errors);
61
72
  }
@@ -63,8 +74,12 @@ function marketFromWire(source) {
63
74
  id: source.market_id,
64
75
  pubkey: (0, shared_1.asPubkeyStr)(source.market_pubkey),
65
76
  name: source.market_name ?? "",
66
- bannerImageUrl: source.banner_image_url ?? "",
67
- iconUrl: source.icon_url ?? "",
77
+ bannerImageUrlLow: bannerUrls?.low ?? "",
78
+ bannerImageUrlMedium: bannerUrls?.medium ?? "",
79
+ bannerImageUrlHigh: bannerUrls?.high ?? "",
80
+ iconUrlLow: iconUrls?.low ?? "",
81
+ iconUrlMedium: iconUrls?.medium ?? "",
82
+ iconUrlHigh: iconUrls?.high ?? "",
68
83
  featuredRank: source.featured_rank,
69
84
  volume: "0",
70
85
  slug: source.slug ?? "",
@@ -72,12 +87,13 @@ function marketFromWire(source) {
72
87
  createdAt: new Date(source.created_at),
73
88
  activatedAt: source.activated_at ? new Date(source.activated_at) : undefined,
74
89
  settledAt: source.settled_at ? new Date(source.settled_at) : undefined,
75
- winningOutcome: source.winning_outcome,
90
+ resolution: source.resolution,
76
91
  description: source.description ?? "",
77
92
  definition: source.definition ?? "",
78
93
  category: source.category,
79
94
  tags: source.tags ?? [],
80
95
  depositAssets,
96
+ depositAssetPairs,
81
97
  conditionalTokens,
82
98
  outcomes,
83
99
  orderbookPairs,
@@ -85,6 +101,29 @@ function marketFromWire(source) {
85
101
  tokenMetadata,
86
102
  };
87
103
  }
104
+ /**
105
+ * Derive unique base/quote deposit-asset pairs across the market's orderbook
106
+ * pairs. Deduplicated by `(basePubkey, quotePubkey)`; orderbook pairs whose
107
+ * base or quote deposit asset is not present in `depositAssets` are skipped.
108
+ */
109
+ function deriveDepositAssetPairs(depositAssets, orderbookPairs) {
110
+ const seen = new Map();
111
+ for (const pair of orderbookPairs) {
112
+ const base = depositAssets.find((asset) => asset.depositAsset === pair.base.depositAsset);
113
+ const quote = depositAssets.find((asset) => asset.depositAsset === pair.quote.depositAsset);
114
+ if (!base || !quote)
115
+ continue;
116
+ const key = `${base.depositAsset}|${quote.depositAsset}`;
117
+ if (!seen.has(key)) {
118
+ seen.set(key, {
119
+ id: `${base.depositAsset}-${quote.depositAsset}`,
120
+ base,
121
+ quote,
122
+ });
123
+ }
124
+ }
125
+ return Array.from(seen.values());
126
+ }
88
127
  function tryMarketFromWire(source) {
89
128
  try {
90
129
  return { market: marketFromWire(source) };
@@ -1 +1 @@
1
- {"version":3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C,MAAsB;IACtD,IAAI,CAAC;QACH,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAC3E,CAAC;AACH,CAAC","sourcesContent":["import { asPubkeyStr } from \"../../shared\";\nimport { orderBookPairFromWire } from \"../orderbook/convert\";\nimport { outcomeFromWire } from \"./outcome\";\nimport { statusFromWire, type Market, MarketValidationError, Status } from \"./index\";\nimport { validatedTokensFromWire } from \"./tokens\";\nimport type { MarketResponse } from \"./wire\";\n\nexport function marketFromWire(source: MarketResponse): Market {\n const errors: string[] = [];\n\n const outcomes = source.outcomes.flatMap((outcome) => {\n try {\n return [outcomeFromWire(outcome)];\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n return [];\n }\n });\n\n const depositAssets = [] as Market[\"depositAssets\"];\n const conditionalTokens = [] as Market[\"conditionalTokens\"];\n const tokenMetadata: Market[\"tokenMetadata\"] = {};\n\n for (const depositAsset of source.deposit_assets) {\n try {\n const validated = validatedTokensFromWire(depositAsset);\n depositAssets.push(validated.token);\n conditionalTokens.push(...validated.conditionals);\n Object.assign(tokenMetadata, validated.metadata);\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n }\n }\n\n const orderbookPairs = source.orderbooks.flatMap((orderbook) => {\n try {\n return [orderBookPairFromWire(orderbook, conditionalTokens)];\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n return [];\n }\n });\n\n const status = statusFromWire(source.market_status);\n if (!source.slug) errors.push(\"Missing slug\");\n if (!source.market_name) errors.push(\"Missing market name\");\n if (!status) errors.push(`Invalid status: ${source.market_status}`);\n if (!source.description) errors.push(\"Missing description\");\n if (!source.definition) errors.push(\"Missing definition\");\n if (!source.icon_url) errors.push(\"Missing icon URL\");\n if (!source.banner_image_url) errors.push(\"Missing banner image URL\");\n\n if (errors.length > 0) {\n throw new MarketValidationError(source.market_pubkey, errors);\n }\n\n return {\n id: source.market_id,\n pubkey: asPubkeyStr(source.market_pubkey),\n name: source.market_name ?? \"\",\n bannerImageUrl: source.banner_image_url ?? \"\",\n iconUrl: source.icon_url ?? \"\",\n featuredRank: source.featured_rank,\n volume: \"0\",\n slug: source.slug ?? \"\",\n status: status ?? Status.Pending,\n createdAt: new Date(source.created_at),\n activatedAt: source.activated_at ? new Date(source.activated_at) : undefined,\n settledAt: source.settled_at ? new Date(source.settled_at) : undefined,\n winningOutcome: source.winning_outcome,\n description: source.description ?? \"\",\n definition: source.definition ?? \"\",\n category: source.category,\n tags: source.tags ?? [],\n depositAssets,\n conditionalTokens,\n outcomes,\n orderbookPairs,\n orderbookIds: orderbookPairs.map((pair) => pair.orderbookId),\n tokenMetadata,\n };\n}\n\nexport function tryMarketFromWire(source: MarketResponse): { market?: Market; error?: string } {\n try {\n return { market: marketFromWire(source) };\n } catch (error) {\n return { error: error instanceof Error ? error.message : String(error) };\n }\n}\n"]}
1
+ {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../src/domain/market/convert.ts"],"names":[],"mappings":";;;AAiBA,wCA2FC;AAOD,0DA2BC;AAED,8CAMC;AAtJD,yCAA2C;AAE3C,kDAA6D;AAC7D,iCAAyC;AAYJ,gGAZ5B,sBAAe,OAY4B;AAXpD,uCAA4C;AAC5C,mCAAqF;AACrF,qCAMkB;AAGT,2GARP,mCAA0B,OAQO;AAEnC,SAAgB,cAAc,CAAC,MAAsB;IACnD,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACnD,IAAI,CAAC;YACH,OAAO,CAAC,IAAA,yBAAe,EAAC,OAAO,CAAC,CAAC,CAAC;QACpC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E,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAC3E,CAAC;AACH,CAAC","sourcesContent":["import { asPubkeyStr } from \"../../shared\";\nimport type { OrderBookPair } from \"../orderbook\";\nimport { orderBookPairFromWire } from \"../orderbook/convert\";\nimport { resolveIconUrls } from \"./icon\";\nimport { outcomeFromWire } from \"./outcome\";\nimport { statusFromWire, type Market, MarketValidationError, Status } from \"./index\";\nimport {\n globalDepositAssetFromWire,\n sortByDisplayPriority,\n validatedTokensFromWire,\n type DepositAsset,\n type DepositAssetPair,\n} from \"./tokens\";\nimport type { MarketResponse } from \"./wire\";\n\nexport { globalDepositAssetFromWire, resolveIconUrls };\n\nexport function marketFromWire(source: MarketResponse): Market {\n const errors: string[] = [];\n\n const outcomes = source.outcomes.flatMap((outcome) => {\n try {\n return [outcomeFromWire(outcome)];\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n return [];\n }\n });\n\n const depositAssets = [] as Market[\"depositAssets\"];\n const conditionalTokens = [] as Market[\"conditionalTokens\"];\n const tokenMetadata: Market[\"tokenMetadata\"] = {};\n\n for (const depositAsset of source.deposit_assets) {\n try {\n const validated = validatedTokensFromWire(depositAsset);\n depositAssets.push(validated.token);\n conditionalTokens.push(...validated.conditionals);\n Object.assign(tokenMetadata, validated.metadata);\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n }\n }\n\n const orderbookPairs = source.orderbooks.flatMap((orderbook) => {\n try {\n return [orderBookPairFromWire(orderbook, conditionalTokens)];\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n return [];\n }\n });\n\n const status = statusFromWire(source.market_status);\n if (!source.slug) errors.push(\"Missing slug\");\n if (!source.market_name) errors.push(\"Missing market name\");\n if (!status) errors.push(`Invalid status: ${source.market_status}`);\n if (!source.description) errors.push(\"Missing description\");\n if (!source.definition) errors.push(\"Missing definition\");\n\n const iconUrls = resolveIconUrls(source.icon_url_low, source.icon_url_medium, source.icon_url_high);\n if (!iconUrls) errors.push(\"Missing icon URL\");\n\n const bannerUrls = resolveIconUrls(source.banner_image_url_low, source.banner_image_url_medium, source.banner_image_url_high);\n if (!bannerUrls) errors.push(\"Missing banner image URL\");\n\n const depositAssetPairs = sortByDisplayPriority(\n deriveDepositAssetPairs(depositAssets, orderbookPairs),\n );\n\n if (depositAssetPairs.length === 0) {\n errors.push(\"Missing deposit asset pairs\");\n }\n\n if (errors.length > 0) {\n throw new MarketValidationError(source.market_pubkey, errors);\n }\n\n return {\n id: source.market_id,\n pubkey: asPubkeyStr(source.market_pubkey),\n name: source.market_name ?? \"\",\n bannerImageUrlLow: bannerUrls?.low ?? \"\",\n bannerImageUrlMedium: bannerUrls?.medium ?? \"\",\n bannerImageUrlHigh: bannerUrls?.high ?? \"\",\n iconUrlLow: iconUrls?.low ?? \"\",\n iconUrlMedium: iconUrls?.medium ?? \"\",\n iconUrlHigh: iconUrls?.high ?? \"\",\n featuredRank: source.featured_rank,\n volume: \"0\",\n slug: source.slug ?? \"\",\n status: status ?? Status.Pending,\n createdAt: new Date(source.created_at),\n activatedAt: source.activated_at ? new Date(source.activated_at) : undefined,\n settledAt: source.settled_at ? new Date(source.settled_at) : undefined,\n resolution: source.resolution,\n description: source.description ?? \"\",\n definition: source.definition ?? \"\",\n category: source.category,\n tags: source.tags ?? [],\n depositAssets,\n depositAssetPairs,\n conditionalTokens,\n outcomes,\n orderbookPairs,\n orderbookIds: orderbookPairs.map((pair) => pair.orderbookId),\n tokenMetadata,\n };\n}\n\n/**\n * Derive unique base/quote deposit-asset pairs across the market's orderbook\n * pairs. Deduplicated by `(basePubkey, quotePubkey)`; orderbook pairs whose\n * base or quote deposit asset is not present in `depositAssets` are skipped.\n */\nexport function deriveDepositAssetPairs(\n depositAssets: DepositAsset[],\n orderbookPairs: OrderBookPair[],\n): DepositAssetPair[] {\n const seen = new Map<string, DepositAssetPair>();\n\n for (const pair of orderbookPairs) {\n const base = depositAssets.find(\n (asset) => asset.depositAsset === pair.base.depositAsset,\n );\n const quote = depositAssets.find(\n (asset) => asset.depositAsset === pair.quote.depositAsset,\n );\n\n if (!base || !quote) continue;\n\n const key = `${base.depositAsset}|${quote.depositAsset}`;\n if (!seen.has(key)) {\n seen.set(key, {\n id: `${base.depositAsset}-${quote.depositAsset}`,\n base,\n quote,\n });\n }\n }\n\n return Array.from(seen.values());\n}\n\nexport function tryMarketFromWire(source: MarketResponse): { market?: Market; error?: string } {\n try {\n return { market: marketFromWire(source) };\n } catch (error) {\n return { error: error instanceof Error ? error.message : String(error) };\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Resolve icon URL variants with fallback logic.
3
+ *
4
+ * Returns `null` when **all three** variants are missing (undefined/null/empty),
5
+ * which signals a validation error. When at least one variant is available the
6
+ * missing ones are filled in using a priority chain:
7
+ *
8
+ * - `low` : try medium, then high
9
+ * - `medium`: try low, then high
10
+ * - `high` : try medium, then low
11
+ */
12
+ export declare function resolveIconUrls(low: string | undefined | null, medium: string | undefined | null, high: string | undefined | null): {
13
+ low: string;
14
+ medium: string;
15
+ high: string;
16
+ } | null;
17
+ //# sourceMappingURL=icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/domain/market/icon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACjC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAC9B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQtD"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveIconUrls = resolveIconUrls;
4
+ /**
5
+ * Resolve icon URL variants with fallback logic.
6
+ *
7
+ * Returns `null` when **all three** variants are missing (undefined/null/empty),
8
+ * which signals a validation error. When at least one variant is available the
9
+ * missing ones are filled in using a priority chain:
10
+ *
11
+ * - `low` : try medium, then high
12
+ * - `medium`: try low, then high
13
+ * - `high` : try medium, then low
14
+ */
15
+ function resolveIconUrls(low, medium, high) {
16
+ const any = low || medium || high;
17
+ if (!any)
18
+ return null;
19
+ return {
20
+ low: low || medium || high || any,
21
+ medium: medium || low || high || any,
22
+ high: high || medium || low || any,
23
+ };
24
+ }
25
+ //# sourceMappingURL=icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../src/domain/market/icon.ts"],"names":[],"mappings":";;AAWA,0CAYC;AAvBD;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAC7B,GAA8B,EAC9B,MAAiC,EACjC,IAA+B;IAE/B,MAAM,GAAG,GAAG,GAAG,IAAI,MAAM,IAAI,IAAI,CAAC;IAClC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,OAAO;QACL,GAAG,EAAE,GAAG,IAAI,MAAM,IAAI,IAAI,IAAI,GAAG;QACjC,MAAM,EAAE,MAAM,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG;QACpC,IAAI,EAAE,IAAI,IAAI,MAAM,IAAI,GAAG,IAAI,GAAG;KACnC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Resolve icon URL variants with fallback logic.\n *\n * Returns `null` when **all three** variants are missing (undefined/null/empty),\n * which signals a validation error. When at least one variant is available the\n * missing ones are filled in using a priority chain:\n *\n * - `low` : try medium, then high\n * - `medium`: try low, then high\n * - `high` : try medium, then low\n */\nexport function resolveIconUrls(\n low: string | undefined | null,\n medium: string | undefined | null,\n high: string | undefined | null,\n): { low: string; medium: string; high: string } | null {\n const any = low || medium || high;\n if (!any) return null;\n return {\n low: low || medium || high || any,\n medium: medium || low || high || any,\n high: high || medium || low || any,\n };\n}\n"]}
@@ -1,12 +1,13 @@
1
1
  import type { OrderBookId, PubkeyStr } from "../../shared";
2
2
  import type { OrderBookPair } from "../orderbook";
3
3
  import type { Outcome } from "./outcome";
4
- import type { ConditionalToken, DepositAsset, TokenMetadata } from "./tokens";
4
+ import type { ConditionalToken, DepositAsset, DepositAssetPair, TokenMetadata } from "./tokens";
5
+ import type { MarketResolutionResponse } from "./wire";
5
6
  export * from "./client";
6
7
  export * from "./wire";
7
8
  export * from "./outcome";
8
9
  export * from "./tokens";
9
- export { marketFromWire, tryMarketFromWire } from "./convert";
10
+ export { globalDepositAssetFromWire, marketFromWire, tryMarketFromWire, resolveIconUrls } from "./convert";
10
11
  export declare enum Status {
11
12
  Pending = "Pending",
12
13
  Active = "Active",
@@ -18,8 +19,12 @@ export interface Market {
18
19
  id: number;
19
20
  pubkey: PubkeyStr;
20
21
  name: string;
21
- bannerImageUrl: string;
22
- iconUrl: string;
22
+ bannerImageUrlLow: string;
23
+ bannerImageUrlMedium: string;
24
+ bannerImageUrlHigh: string;
25
+ iconUrlLow: string;
26
+ iconUrlMedium: string;
27
+ iconUrlHigh: string;
23
28
  featuredRank?: number;
24
29
  volume: string;
25
30
  slug: string;
@@ -27,18 +32,29 @@ export interface Market {
27
32
  createdAt: Date;
28
33
  activatedAt?: Date;
29
34
  settledAt?: Date;
30
- winningOutcome?: number;
35
+ resolution?: MarketResolutionResponse;
31
36
  description: string;
32
37
  definition: string;
33
38
  category?: string;
34
39
  tags: string[];
35
40
  depositAssets: DepositAsset[];
41
+ /**
42
+ * Unique base/quote deposit-asset pairs derived from `orderbookPairs`
43
+ * during wire→domain conversion. Deduplicated by `(base, quote)` pubkey.
44
+ */
45
+ depositAssetPairs: DepositAssetPair[];
36
46
  conditionalTokens: ConditionalToken[];
37
47
  outcomes: Outcome[];
38
48
  orderbookPairs: OrderBookPair[];
39
49
  orderbookIds: OrderBookId[];
40
50
  tokenMetadata: Record<string, TokenMetadata>;
41
51
  }
52
+ export interface MarketResolutionContainer {
53
+ resolution?: MarketResolutionResponse | null;
54
+ }
55
+ export declare function isMarketResolved(market: MarketResolutionContainer): boolean;
56
+ export declare function singleWinningOutcome(market: MarketResolutionContainer): number | undefined;
57
+ export declare function hasSingleWinningOutcome(market: MarketResolutionContainer): boolean;
42
58
  export declare class MarketValidationError extends Error {
43
59
  readonly marketPubkey: string;
44
60
  readonly details: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/market/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9E,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9D,oBAAY,MAAM;IAChB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,SAAS,cAAc;CACxB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAahE;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,O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QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,CAAC,EAAE,wBAAwB,GAAG,IAAI,CAAC;CAC9C;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAE3E;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,yBAAyB,GAChC,MAAM,GAAG,SAAS,CAEpB;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAET;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;gBAEf,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;CAMpD"}
@@ -14,15 +14,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.MarketValidationError = exports.Status = exports.tryMarketFromWire = exports.marketFromWire = void 0;
17
+ exports.MarketValidationError = exports.Status = exports.resolveIconUrls = exports.tryMarketFromWire = exports.marketFromWire = exports.globalDepositAssetFromWire = void 0;
18
18
  exports.statusFromWire = statusFromWire;
19
+ exports.isMarketResolved = isMarketResolved;
20
+ exports.singleWinningOutcome = singleWinningOutcome;
21
+ exports.hasSingleWinningOutcome = hasSingleWinningOutcome;
19
22
  __exportStar(require("./client"), exports);
20
23
  __exportStar(require("./wire"), exports);
21
24
  __exportStar(require("./outcome"), exports);
22
25
  __exportStar(require("./tokens"), exports);
23
26
  var convert_1 = require("./convert");
27
+ Object.defineProperty(exports, "globalDepositAssetFromWire", { enumerable: true, get: function () { return convert_1.globalDepositAssetFromWire; } });
24
28
  Object.defineProperty(exports, "marketFromWire", { enumerable: true, get: function () { return convert_1.marketFromWire; } });
25
29
  Object.defineProperty(exports, "tryMarketFromWire", { enumerable: true, get: function () { return convert_1.tryMarketFromWire; } });
30
+ Object.defineProperty(exports, "resolveIconUrls", { enumerable: true, get: function () { return convert_1.resolveIconUrls; } });
26
31
  var Status;
27
32
  (function (Status) {
28
33
  Status["Pending"] = "Pending";
@@ -44,6 +49,15 @@ function statusFromWire(value) {
44
49
  return undefined;
45
50
  }
46
51
  }
52
+ function isMarketResolved(market) {
53
+ return market.resolution !== undefined && market.resolution !== null;
54
+ }
55
+ function singleWinningOutcome(market) {
56
+ return market.resolution?.single_winning_outcome ?? undefined;
57
+ }
58
+ function hasSingleWinningOutcome(market) {
59
+ return singleWinningOutcome(market) !== undefined;
60
+ }
47
61
  class MarketValidationError extends Error {
48
62
  marketPubkey;
49
63
  details;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/market/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkBA,wCAaC;AA1BD,2CAAyB;AACzB,yCAAuB;AACvB,4CAA0B;AAC1B,2CAAyB;AACzB,qCAA8D;AAArD,yGAAA,cAAc,OAAA;AAAE,4GAAA,iBAAiB,OAAA;AAE1C,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,6BAAmB,CAAA;IACnB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;IACrB,iCAAuB,CAAA;AACzB,CAAC,EALW,MAAM,sBAAN,MAAM,QAKjB;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM,CAAC,OAAO;YACjB,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB,KAAK,MAAM,CAAC,MAAM;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC;QACvB,KAAK,MAAM,CAAC,QAAQ;YAClB,OAAO,MAAM,CAAC,QAAQ,CAAC;QACzB,KAAK,MAAM,CAAC,SAAS;YACnB,OAAO,MAAM,CAAC,SAAS,CAAC;QAC1B;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AA4BD,MAAa,qBAAsB,SAAQ,KAAK;IACrC,YAAY,CAAS;IACrB,OAAO,CAAW;IAE3B,YAAY,YAAoB,EAAE,OAAiB;QACjD,KAAK,CAAC,6BAA6B,YAAY,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3E,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAVD,sDAUC","sourcesContent":["import type { OrderBookId, PubkeyStr } from \"../../shared\";\nimport type { OrderBookPair } from \"../orderbook\";\nimport type { Outcome } from \"./outcome\";\nimport type { ConditionalToken, DepositAsset, TokenMetadata } from \"./tokens\";\n\nexport * from \"./client\";\nexport * from \"./wire\";\nexport * from \"./outcome\";\nexport * from \"./tokens\";\nexport { marketFromWire, tryMarketFromWire } from \"./convert\";\n\nexport enum Status {\n Pending = \"Pending\",\n Active = \"Active\",\n Resolved = \"Resolved\",\n Cancelled = \"Cancelled\",\n}\n\nexport function statusFromWire(value: string): Status | undefined {\n switch (value) {\n case Status.Pending:\n return Status.Pending;\n case Status.Active:\n return Status.Active;\n case Status.Resolved:\n return Status.Resolved;\n case Status.Cancelled:\n return Status.Cancelled;\n default:\n return undefined;\n }\n}\n\nexport interface Market {\n id: number;\n pubkey: PubkeyStr;\n name: string;\n bannerImageUrl: string;\n iconUrl: string;\n featuredRank?: number;\n volume: string;\n slug: string;\n status: Status;\n createdAt: Date;\n activatedAt?: Date;\n settledAt?: Date;\n winningOutcome?: number;\n description: string;\n definition: string;\n category?: string;\n tags: string[];\n depositAssets: DepositAsset[];\n conditionalTokens: ConditionalToken[];\n outcomes: Outcome[];\n orderbookPairs: OrderBookPair[];\n orderbookIds: OrderBookId[];\n tokenMetadata: Record<string, TokenMetadata>;\n}\n\nexport class MarketValidationError extends Error {\n readonly marketPubkey: string;\n readonly details: string[];\n\n constructor(marketPubkey: string, details: string[]) {\n super(`Market validation errors (${marketPubkey}): ${details.join(\"; \")}`);\n this.name = \"MarketValidationError\";\n this.marketPubkey = marketPubkey;\n this.details = details;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/market/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAwBA,wCAaC;AAyCD,4CAEC;AAED,oDAIC;AAED,0DAIC;AAjFD,2CAAyB;AACzB,yCAAuB;AACvB,4CAA0B;AAC1B,2CAAyB;AACzB,qCAA2G;AAAlG,qHAAA,0BAA0B,OAAA;AAAE,yGAAA,cAAc,OAAA;AAAE,4GAAA,iBAAiB,OAAA;AAAE,0GAAA,eAAe,OAAA;AAEvF,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,6BAAmB,CAAA;IACnB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;IACrB,iCAAuB,CAAA;AACzB,CAAC,EALW,MAAM,sBAAN,MAAM,QAKjB;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM,CAAC,OAAO;YACjB,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB,KAAK,MAAM,CAAC,MAAM;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC;QACvB,KAAK,MAAM,CAAC,QAAQ;YAClB,OAAO,MAAM,CAAC,QAAQ,CAAC;QACzB,KAAK,MAAM,CAAC,SAAS;YACnB,OAAO,MAAM,CAAC,SAAS,CAAC;QAC1B;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAyCD,SAAgB,gBAAgB,CAAC,MAAiC;IAChE,OAAO,MAAM,CAAC,UAAU,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,KAAK,IAAI,CAAC;AACvE,CAAC;AAED,SAAgB,oBAAoB,CAClC,MAAiC;IAEjC,OAAO,MAAM,CAAC,UAAU,EAAE,sBAAsB,IAAI,SAAS,CAAC;AAChE,CAAC;AAED,SAAgB,uBAAuB,CACrC,MAAiC;IAEjC,OAAO,oBAAoB,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;AACpD,CAAC;AAED,MAAa,qBAAsB,SAAQ,KAAK;IACrC,YAAY,CAAS;IACrB,OAAO,CAAW;IAE3B,YAAY,YAAoB,EAAE,OAAiB;QACjD,KAAK,CAAC,6BAA6B,YAAY,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3E,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAVD,sDAUC","sourcesContent":["import type { OrderBookId, PubkeyStr } from \"../../shared\";\nimport type { OrderBookPair } from \"../orderbook\";\nimport type { Outcome } from \"./outcome\";\nimport type {\n ConditionalToken,\n DepositAsset,\n DepositAssetPair,\n TokenMetadata,\n} from \"./tokens\";\nimport type { MarketResolutionResponse } from \"./wire\";\n\nexport * from \"./client\";\nexport * from \"./wire\";\nexport * from \"./outcome\";\nexport * from \"./tokens\";\nexport { globalDepositAssetFromWire, marketFromWire, tryMarketFromWire, resolveIconUrls } from \"./convert\";\n\nexport enum Status {\n Pending = \"Pending\",\n Active = \"Active\",\n Resolved = \"Resolved\",\n Cancelled = \"Cancelled\",\n}\n\nexport function statusFromWire(value: string): Status | undefined {\n switch (value) {\n case Status.Pending:\n return Status.Pending;\n case Status.Active:\n return Status.Active;\n case Status.Resolved:\n return Status.Resolved;\n case Status.Cancelled:\n return Status.Cancelled;\n default:\n return undefined;\n }\n}\n\nexport interface Market {\n id: number;\n pubkey: PubkeyStr;\n name: string;\n bannerImageUrlLow: string;\n bannerImageUrlMedium: string;\n bannerImageUrlHigh: string;\n iconUrlLow: string;\n iconUrlMedium: string;\n iconUrlHigh: string;\n featuredRank?: number;\n volume: string;\n slug: string;\n status: Status;\n createdAt: Date;\n activatedAt?: Date;\n settledAt?: Date;\n resolution?: MarketResolutionResponse;\n description: string;\n definition: string;\n category?: string;\n tags: string[];\n depositAssets: DepositAsset[];\n /**\n * Unique base/quote deposit-asset pairs derived from `orderbookPairs`\n * during wire→domain conversion. Deduplicated by `(base, quote)` pubkey.\n */\n depositAssetPairs: DepositAssetPair[];\n conditionalTokens: ConditionalToken[];\n outcomes: Outcome[];\n orderbookPairs: OrderBookPair[];\n orderbookIds: OrderBookId[];\n tokenMetadata: Record<string, TokenMetadata>;\n}\n\nexport interface MarketResolutionContainer {\n resolution?: MarketResolutionResponse | null;\n}\n\nexport function isMarketResolved(market: MarketResolutionContainer): boolean {\n return market.resolution !== undefined && market.resolution !== null;\n}\n\nexport function singleWinningOutcome(\n market: MarketResolutionContainer\n): number | undefined {\n return market.resolution?.single_winning_outcome ?? undefined;\n}\n\nexport function hasSingleWinningOutcome(\n market: MarketResolutionContainer\n): boolean {\n return singleWinningOutcome(market) !== undefined;\n}\n\nexport class MarketValidationError extends Error {\n readonly marketPubkey: string;\n readonly details: string[];\n\n constructor(marketPubkey: string, details: string[]) {\n super(`Market validation errors (${marketPubkey}): ${details.join(\"; \")}`);\n this.name = \"MarketValidationError\";\n this.marketPubkey = marketPubkey;\n this.details = details;\n }\n}\n"]}
@@ -1,8 +1,11 @@
1
1
  import type { OutcomeResponse } from "./wire";
2
2
  export interface Outcome {
3
3
  index: number;
4
- iconUrl: string;
4
+ iconUrlLow: string;
5
+ iconUrlMedium: string;
6
+ iconUrlHigh: string;
5
7
  name: string;
8
+ nameLong?: string;
6
9
  }
7
10
  export declare class OutcomeValidationError extends Error {
8
11
  readonly details: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../../../src/domain/market/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;gBAEf,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;CAK5C;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAehE"}
1
+ {"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../../../src/domain/market/outcome.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;gBAEf,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;CAK5C;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAchE"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OutcomeValidationError = void 0;
4
4
  exports.outcomeFromWire = outcomeFromWire;
5
+ const icon_1 = require("./icon");
5
6
  class OutcomeValidationError extends Error {
6
7
  details;
7
8
  constructor(name, details) {
@@ -12,17 +13,17 @@ class OutcomeValidationError extends Error {
12
13
  }
13
14
  exports.OutcomeValidationError = OutcomeValidationError;
14
15
  function outcomeFromWire(source) {
15
- const errors = [];
16
- if (!source.icon_url) {
17
- errors.push("Missing thumbnail URL");
18
- }
19
- if (errors.length > 0) {
20
- throw new OutcomeValidationError(source.name, errors);
16
+ const iconUrls = (0, icon_1.resolveIconUrls)(source.icon_url_low, source.icon_url_medium, source.icon_url_high);
17
+ if (!iconUrls) {
18
+ throw new OutcomeValidationError(source.name, ["Missing icon URL"]);
21
19
  }
22
20
  return {
23
21
  index: source.index,
24
- iconUrl: source.icon_url ?? "",
22
+ iconUrlLow: iconUrls.low,
23
+ iconUrlMedium: iconUrls.medium,
24
+ iconUrlHigh: iconUrls.high,
25
25
  name: source.name,
26
+ nameLong: source.name_long,
26
27
  };
27
28
  }
28
29
  //# sourceMappingURL=outcome.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"outcome.js","sourceRoot":"","sources":["../../../src/domain/market/outcome.ts"],"names":[],"mappings":";;;AAkBA,0CAeC;AAzBD,MAAa,sBAAuB,SAAQ,KAAK;IACtC,OAAO,CAAW;IAE3B,YAAY,IAAY,EAAE,OAAiB;QACzC,KAAK,CAAC,8BAA8B,IAAI,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AARD,wDAQC;AAED,SAAgB,eAAe,CAAC,MAAuB;IACrD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,sBAAsB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE;QAC9B,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAC;AACJ,CAAC","sourcesContent":["import type { OutcomeResponse } from \"./wire\";\n\nexport interface Outcome {\n index: number;\n iconUrl: string;\n name: string;\n}\n\nexport class OutcomeValidationError extends Error {\n readonly details: string[];\n\n constructor(name: string, details: string[]) {\n super(`Outcome validation errors (${name}): ${details.join(\"; \")}`);\n this.name = \"OutcomeValidationError\";\n this.details = details;\n }\n}\n\nexport function outcomeFromWire(source: OutcomeResponse): Outcome {\n const errors: string[] = [];\n if (!source.icon_url) {\n errors.push(\"Missing thumbnail URL\");\n }\n\n if (errors.length > 0) {\n throw new OutcomeValidationError(source.name, errors);\n }\n\n return {\n index: source.index,\n iconUrl: source.icon_url ?? \"\",\n name: source.name,\n };\n}\n"]}
1
+ {"version":3,"file":"outcome.js","sourceRoot":"","sources":["../../../src/domain/market/outcome.ts"],"names":[],"mappings":";;;AAsBA,0CAcC;AApCD,iCAAyC;AAYzC,MAAa,sBAAuB,SAAQ,KAAK;IACtC,OAAO,CAAW;IAE3B,YAAY,IAAY,EAAE,OAAiB;QACzC,KAAK,CAAC,8BAA8B,IAAI,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AARD,wDAQC;AAED,SAAgB,eAAe,CAAC,MAAuB;IACrD,MAAM,QAAQ,GAAG,IAAA,sBAAe,EAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;IACpG,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,sBAAsB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,UAAU,EAAE,QAAQ,CAAC,GAAG;QACxB,aAAa,EAAE,QAAQ,CAAC,MAAM;QAC9B,WAAW,EAAE,QAAQ,CAAC,IAAI;QAC1B,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,QAAQ,EAAE,MAAM,CAAC,SAAS;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["import { resolveIconUrls } from \"./icon\";\nimport type { OutcomeResponse } from \"./wire\";\n\nexport interface Outcome {\n index: number;\n iconUrlLow: string;\n iconUrlMedium: string;\n iconUrlHigh: string;\n name: string;\n nameLong?: string;\n}\n\nexport class OutcomeValidationError extends Error {\n readonly details: string[];\n\n constructor(name: string, details: string[]) {\n super(`Outcome validation errors (${name}): ${details.join(\"; \")}`);\n this.name = \"OutcomeValidationError\";\n this.details = details;\n }\n}\n\nexport function outcomeFromWire(source: OutcomeResponse): Outcome {\n const iconUrls = resolveIconUrls(source.icon_url_low, source.icon_url_medium, source.icon_url_high);\n if (!iconUrls) {\n throw new OutcomeValidationError(source.name, [\"Missing icon URL\"]);\n }\n\n return {\n index: source.index,\n iconUrlLow: iconUrls.low,\n iconUrlMedium: iconUrls.medium,\n iconUrlHigh: iconUrls.high,\n name: source.name,\n nameLong: source.name_long,\n };\n}\n"]}
@@ -1,14 +1,39 @@
1
1
  import type { PubkeyStr } from "../../shared";
2
- import type { DepositAssetResponse } from "./wire";
2
+ import type { DepositAssetResponse, GlobalDepositAssetResponse } from "./wire";
3
3
  export interface Token {
4
4
  id: number;
5
5
  pubkey: PubkeyStr;
6
6
  name: string;
7
7
  symbol: string;
8
+ shortSymbol: string;
8
9
  description?: string;
9
10
  decimals: number;
10
- iconUrl: string;
11
+ iconUrlLow: string;
12
+ iconUrlMedium: string;
13
+ iconUrlHigh: string;
11
14
  }
15
+ /**
16
+ * Display priority for sorting: lower values come first. BTC/WBTC tie at 0,
17
+ * ETH/WETH tie at 1, SOL at 2; everything else falls to the alphabetical tail.
18
+ */
19
+ export declare function tokenDisplayPriority(token: Pick<Token, "symbol">): number;
20
+ /**
21
+ * Shape accepted by {@link sortByDisplayPriority}. Either a token with a
22
+ * top-level `symbol`, or a composite (e.g. `DepositAssetPair`, `OrderBookPair`)
23
+ * that carries its display token on `base`.
24
+ */
25
+ export type DisplaySortable = Pick<Token, "symbol"> | {
26
+ readonly base: Pick<Token, "symbol">;
27
+ };
28
+ /**
29
+ * Returns a new array ordered for display: priority groups first
30
+ * (BTC/WBTC → ETH/WETH → SOL), then all remaining items alphabetically by the
31
+ * display token's symbol.
32
+ *
33
+ * Accepts both pure tokens and composite types whose display token lives on
34
+ * `base` (e.g. `DepositAssetPair`, `OrderBookPair`).
35
+ */
36
+ export declare function sortByDisplayPriority<T extends DisplaySortable>(items: readonly T[]): T[];
12
37
  export interface ConditionalToken extends Token {
13
38
  outcomeIndex: number;
14
39
  outcome: string;
@@ -20,11 +45,37 @@ export interface DepositAsset extends Token {
20
45
  depositAsset: PubkeyStr;
21
46
  numOutcomes: number;
22
47
  }
48
+ /**
49
+ * A base/quote pairing of two `DepositAsset`s.
50
+ *
51
+ * Populated on `Market.depositAssetPairs` during wire→domain conversion —
52
+ * one entry per unique base/quote combination across the market's orderbook
53
+ * pairs.
54
+ */
55
+ export interface DepositAssetPair {
56
+ /** Stable identifier of the form `"{basePubkey}-{quotePubkey}"`. */
57
+ id: string;
58
+ base: DepositAsset;
59
+ quote: DepositAsset;
60
+ }
61
+ /**
62
+ * A globally whitelisted deposit asset (platform-scoped, not market-bound).
63
+ *
64
+ * Distinct from `DepositAsset`, which is bound to a specific market.
65
+ */
66
+ export interface GlobalDepositAsset extends Token {
67
+ depositAsset: PubkeyStr;
68
+ whitelistIndex: number;
69
+ active: boolean;
70
+ }
23
71
  export interface TokenMetadata {
24
72
  pubkey: PubkeyStr;
25
73
  symbol: string;
74
+ shortSymbol: string;
26
75
  decimals: number;
27
- iconUrl: string;
76
+ iconUrlLow: string;
77
+ iconUrlMedium: string;
78
+ iconUrlHigh: string;
28
79
  name: string;
29
80
  }
30
81
  export interface ValidatedTokens {
@@ -39,4 +90,5 @@ export declare class TokenValidationError extends Error {
39
90
  export declare function isUsdStablecoin(pubkey: string): boolean;
40
91
  export declare function currencySymbol(pubkey: string): "" | "$";
41
92
  export declare function validatedTokensFromWire(source: DepositAssetResponse): ValidatedTokens;
93
+ export declare function globalDepositAssetFromWire(source: GlobalDepositAssetResponse): GlobalDepositAsset;
42
94
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/domain/market/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAA4B,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAE7E,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAiB,SAAQ,KAAK;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,SAAS,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAa,SAAQ,KAAK;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,SAAS,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,MAAM,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