@nadohq/mobile-client 0.28.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/{MobileClient-9JSAzblH.cjs → MobileClient-CfDtaEeL.cjs} +21 -1
  2. package/dist/MobileClient-CfDtaEeL.cjs.map +1 -0
  3. package/dist/MobileClient.cjs +1 -1
  4. package/dist/MobileClient.d.cts +21 -9
  5. package/dist/MobileClient.d.cts.map +1 -1
  6. package/dist/MobileClient.d.ts +21 -9
  7. package/dist/MobileClient.d.ts.map +1 -1
  8. package/dist/MobileClient.js +21 -1
  9. package/dist/MobileClient.js.map +1 -1
  10. package/dist/{MobileServerFailureError-DUXjO_3w.d.ts → MobileServerFailureError-B11rr9O5.d.cts} +7 -12
  11. package/dist/MobileServerFailureError-B11rr9O5.d.cts.map +1 -0
  12. package/dist/{MobileServerFailureError-BfdqvDBi.d.cts → MobileServerFailureError-DoIvXqYV.d.ts} +7 -12
  13. package/dist/MobileServerFailureError-DoIvXqYV.d.ts.map +1 -0
  14. package/dist/{buildSignedMobileRequest-CDRsRNHm.d.ts → buildSignedMobileRequest-B4KJ6T1y.d.ts} +2 -2
  15. package/dist/{buildSignedMobileRequest-CDRsRNHm.d.ts.map → buildSignedMobileRequest-B4KJ6T1y.d.ts.map} +1 -1
  16. package/dist/{buildSignedMobileRequest-BsbBkU0K.d.cts → buildSignedMobileRequest-EEnDgZF8.d.cts} +2 -2
  17. package/dist/{buildSignedMobileRequest-BsbBkU0K.d.cts.map → buildSignedMobileRequest-EEnDgZF8.d.cts.map} +1 -1
  18. package/dist/{canonicalize-Dm7sXwPg.d.cts → canonicalize-CDdYnhL3.d.cts} +2 -2
  19. package/dist/canonicalize-CDdYnhL3.d.cts.map +1 -0
  20. package/dist/{canonicalize-PX6dTIdF.d.ts → canonicalize-Cc7hdZLJ.d.ts} +2 -2
  21. package/dist/canonicalize-Cc7hdZLJ.d.ts.map +1 -0
  22. package/dist/{clientTypes-DWW2N66c.d.ts → clientTypes-BsOps_pY.d.ts} +67 -3
  23. package/dist/clientTypes-BsOps_pY.d.ts.map +1 -0
  24. package/dist/{clientTypes-Et0PUa2d.d.cts → clientTypes-UFInIAQd.d.cts} +67 -3
  25. package/dist/clientTypes-UFInIAQd.d.cts.map +1 -0
  26. package/dist/dataMappers.cjs +33 -0
  27. package/dist/dataMappers.cjs.map +1 -1
  28. package/dist/dataMappers.d.cts +8 -3
  29. package/dist/dataMappers.d.cts.map +1 -1
  30. package/dist/dataMappers.d.ts +8 -3
  31. package/dist/dataMappers.d.ts.map +1 -1
  32. package/dist/dataMappers.js +33 -1
  33. package/dist/dataMappers.js.map +1 -1
  34. package/dist/{eip712MethodByType-DJgXal9r.d.ts → eip712MethodByType-B67XiwTu.d.ts} +2 -2
  35. package/dist/eip712MethodByType-B67XiwTu.d.ts.map +1 -0
  36. package/dist/{eip712MethodByType-DLh9MRsD.d.cts → eip712MethodByType-DCU415zf.d.cts} +2 -2
  37. package/dist/eip712MethodByType-DCU415zf.d.cts.map +1 -0
  38. package/dist/feed-BF5k6Ryu.d.ts +14 -0
  39. package/dist/feed-BF5k6Ryu.d.ts.map +1 -0
  40. package/dist/feed-CBIwOhTO.d.cts +14 -0
  41. package/dist/feed-CBIwOhTO.d.cts.map +1 -0
  42. package/dist/index.cjs +8 -1
  43. package/dist/index.d.cts +17 -15
  44. package/dist/index.d.ts +17 -15
  45. package/dist/index.js +3 -1
  46. package/dist/{mobileErrorCodes-QG5XbEY6.d.ts → mobileErrorCodes-Cj84nBnT.d.cts} +7 -5
  47. package/dist/mobileErrorCodes-Cj84nBnT.d.cts.map +1 -0
  48. package/dist/{mobileErrorCodes-BeyBKmwh.d.cts → mobileErrorCodes-Czmigq9x.d.ts} +7 -5
  49. package/dist/mobileErrorCodes-Czmigq9x.d.ts.map +1 -0
  50. package/dist/{patterns-BbxH3_VA.d.ts → patterns-B5gi7OfV.d.ts} +1 -1
  51. package/dist/patterns-B5gi7OfV.d.ts.map +1 -0
  52. package/dist/{patterns-B9J2ldpx.d.cts → patterns-Db6fgz8i.d.cts} +1 -1
  53. package/dist/patterns-Db6fgz8i.d.cts.map +1 -0
  54. package/dist/{payloadHash-nj8WuLUP.d.cts → payloadHash-BSoGv3Lz.d.cts} +2 -2
  55. package/dist/payloadHash-BSoGv3Lz.d.cts.map +1 -0
  56. package/dist/{payloadHash-Bmhzs78N.d.ts → payloadHash-BVP2v3p9.d.ts} +2 -2
  57. package/dist/payloadHash-BVP2v3p9.d.ts.map +1 -0
  58. package/dist/serverBaseTypes-A16onlPN.d.cts +25 -0
  59. package/dist/serverBaseTypes-A16onlPN.d.cts.map +1 -0
  60. package/dist/serverBaseTypes-m3zEi0X9.d.ts +25 -0
  61. package/dist/serverBaseTypes-m3zEi0X9.d.ts.map +1 -0
  62. package/dist/{serverExecuteTypes-DKYK1V7C.d.cts → serverExecuteTypes-C-bioiuQ.d.cts} +2 -2
  63. package/dist/serverExecuteTypes-C-bioiuQ.d.cts.map +1 -0
  64. package/dist/{serverExecuteTypes-CXnMjKnt.d.ts → serverExecuteTypes-DfzWOeIx.d.ts} +2 -2
  65. package/dist/serverExecuteTypes-DfzWOeIx.d.ts.map +1 -0
  66. package/dist/serverModelTypes-CPZUvVil.d.cts +143 -0
  67. package/dist/serverModelTypes-CPZUvVil.d.cts.map +1 -0
  68. package/dist/serverModelTypes-CqnqHY5F.d.ts +143 -0
  69. package/dist/serverModelTypes-CqnqHY5F.d.ts.map +1 -0
  70. package/dist/serverQueryTypes-CJLWWZBs.d.ts +91 -0
  71. package/dist/serverQueryTypes-CJLWWZBs.d.ts.map +1 -0
  72. package/dist/serverQueryTypes-C_cCx0Ac.d.cts +91 -0
  73. package/dist/serverQueryTypes-C_cCx0Ac.d.cts.map +1 -0
  74. package/dist/serverRequestTypes-DQDy3K9O.d.ts +62 -0
  75. package/dist/serverRequestTypes-DQDy3K9O.d.ts.map +1 -0
  76. package/dist/serverRequestTypes-DnU_FfMI.d.cts +62 -0
  77. package/dist/serverRequestTypes-DnU_FfMI.d.cts.map +1 -0
  78. package/dist/{serverResponseGuards-DjCNL3CR.d.cts → serverResponseGuards-BlvfJjsa.d.cts} +2 -2
  79. package/dist/{serverResponseGuards-DjCNL3CR.d.cts.map → serverResponseGuards-BlvfJjsa.d.cts.map} +1 -1
  80. package/dist/{serverResponseGuards-C_vZIgGl.d.ts → serverResponseGuards-gpHH8SHk.d.ts} +2 -2
  81. package/dist/{serverResponseGuards-C_vZIgGl.d.ts.map → serverResponseGuards-gpHH8SHk.d.ts.map} +1 -1
  82. package/dist/signing/buildSignedMobileRequest.cjs +1 -1
  83. package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
  84. package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
  85. package/dist/signing/canonicalize.d.cts +1 -1
  86. package/dist/signing/canonicalize.d.ts +1 -1
  87. package/dist/signing/eip712MethodByType.d.cts +1 -1
  88. package/dist/signing/eip712MethodByType.d.ts +1 -1
  89. package/dist/signing/index.d.cts +5 -5
  90. package/dist/signing/index.d.ts +5 -5
  91. package/dist/signing/payloadHash.cjs +1 -1
  92. package/dist/signing/payloadHash.d.cts +1 -1
  93. package/dist/signing/payloadHash.d.ts +1 -1
  94. package/dist/signing/types.d.cts +1 -1
  95. package/dist/signing/types.d.ts +1 -1
  96. package/dist/types/MobileServerFailureError.cjs +5 -7
  97. package/dist/types/MobileServerFailureError.cjs.map +1 -1
  98. package/dist/types/MobileServerFailureError.d.cts +1 -1
  99. package/dist/types/MobileServerFailureError.d.ts +1 -1
  100. package/dist/types/MobileServerFailureError.js +4 -7
  101. package/dist/types/MobileServerFailureError.js.map +1 -1
  102. package/dist/types/clientTypes.d.cts +2 -2
  103. package/dist/types/clientTypes.d.ts +2 -2
  104. package/dist/types/index.cjs +4 -0
  105. package/dist/types/index.d.cts +9 -8
  106. package/dist/types/index.d.ts +9 -8
  107. package/dist/types/index.js +2 -1
  108. package/dist/types/mobileErrorCodes.cjs +9 -5
  109. package/dist/types/mobileErrorCodes.cjs.map +1 -1
  110. package/dist/types/mobileErrorCodes.d.cts +1 -1
  111. package/dist/types/mobileErrorCodes.d.ts +1 -1
  112. package/dist/types/mobileErrorCodes.js +8 -4
  113. package/dist/types/mobileErrorCodes.js.map +1 -1
  114. package/dist/types/serverBaseTypes.d.cts +2 -2
  115. package/dist/types/serverBaseTypes.d.ts +2 -2
  116. package/dist/types/serverExecuteTypes.d.cts +1 -1
  117. package/dist/types/serverExecuteTypes.d.ts +1 -1
  118. package/dist/types/serverModelTypes.cjs +29 -0
  119. package/dist/types/serverModelTypes.cjs.map +1 -0
  120. package/dist/types/serverModelTypes.d.cts +2 -2
  121. package/dist/types/serverModelTypes.d.ts +2 -2
  122. package/dist/types/serverModelTypes.js +26 -1
  123. package/dist/types/serverModelTypes.js.map +1 -0
  124. package/dist/types/serverQueryTypes.d.cts +2 -2
  125. package/dist/types/serverQueryTypes.d.ts +2 -2
  126. package/dist/types/serverRequestTypes.cjs +0 -0
  127. package/dist/types/serverRequestTypes.d.cts +2 -0
  128. package/dist/types/serverRequestTypes.d.ts +2 -0
  129. package/dist/types/serverRequestTypes.js +1 -0
  130. package/dist/{types-uCD4BNZR.d.cts → types-CzOeSYnW.d.cts} +3 -3
  131. package/dist/{types-uCD4BNZR.d.cts.map → types-CzOeSYnW.d.cts.map} +1 -1
  132. package/dist/{types-B76Pn7Sy.d.ts → types-UHjZR-js.d.ts} +3 -3
  133. package/dist/{types-B76Pn7Sy.d.ts.map → types-UHjZR-js.d.ts.map} +1 -1
  134. package/dist/utils/feed.cjs +17 -0
  135. package/dist/utils/feed.cjs.map +1 -0
  136. package/dist/utils/feed.d.cts +2 -0
  137. package/dist/utils/feed.d.ts +2 -0
  138. package/dist/utils/feed.js +15 -0
  139. package/dist/utils/feed.js.map +1 -0
  140. package/dist/utils/index.cjs +3 -0
  141. package/dist/utils/index.d.cts +4 -3
  142. package/dist/utils/index.d.ts +4 -3
  143. package/dist/utils/index.js +2 -1
  144. package/dist/utils/patterns.d.cts +1 -1
  145. package/dist/utils/patterns.d.ts +1 -1
  146. package/dist/utils/serverResponseGuards.d.cts +1 -1
  147. package/dist/utils/serverResponseGuards.d.ts +1 -1
  148. package/package.json +3 -3
  149. package/src/MobileClient.ts +49 -27
  150. package/src/dataMappers.ts +40 -0
  151. package/src/types/MobileServerFailureError.ts +10 -22
  152. package/src/types/clientTypes.ts +70 -0
  153. package/src/types/index.ts +1 -0
  154. package/src/types/mobileErrorCodes.ts +7 -3
  155. package/src/types/serverBaseTypes.ts +7 -28
  156. package/src/types/serverModelTypes.ts +93 -0
  157. package/src/types/serverQueryTypes.ts +83 -39
  158. package/src/types/serverRequestTypes.ts +68 -0
  159. package/src/utils/feed.ts +11 -0
  160. package/src/utils/index.ts +1 -0
  161. package/dist/MobileClient-9JSAzblH.cjs.map +0 -1
  162. package/dist/MobileServerFailureError-BfdqvDBi.d.cts.map +0 -1
  163. package/dist/MobileServerFailureError-DUXjO_3w.d.ts.map +0 -1
  164. package/dist/canonicalize-Dm7sXwPg.d.cts.map +0 -1
  165. package/dist/canonicalize-PX6dTIdF.d.ts.map +0 -1
  166. package/dist/clientTypes-DWW2N66c.d.ts.map +0 -1
  167. package/dist/clientTypes-Et0PUa2d.d.cts.map +0 -1
  168. package/dist/eip712MethodByType-DJgXal9r.d.ts.map +0 -1
  169. package/dist/eip712MethodByType-DLh9MRsD.d.cts.map +0 -1
  170. package/dist/mobileErrorCodes-BeyBKmwh.d.cts.map +0 -1
  171. package/dist/mobileErrorCodes-QG5XbEY6.d.ts.map +0 -1
  172. package/dist/patterns-B9J2ldpx.d.cts.map +0 -1
  173. package/dist/patterns-BbxH3_VA.d.ts.map +0 -1
  174. package/dist/payloadHash-Bmhzs78N.d.ts.map +0 -1
  175. package/dist/payloadHash-nj8WuLUP.d.cts.map +0 -1
  176. package/dist/serverBaseTypes-BicXMrZV.d.cts +0 -43
  177. package/dist/serverBaseTypes-BicXMrZV.d.cts.map +0 -1
  178. package/dist/serverBaseTypes-ewbo8l4R.d.ts +0 -43
  179. package/dist/serverBaseTypes-ewbo8l4R.d.ts.map +0 -1
  180. package/dist/serverExecuteTypes-CXnMjKnt.d.ts.map +0 -1
  181. package/dist/serverExecuteTypes-DKYK1V7C.d.cts.map +0 -1
  182. package/dist/serverModelTypes-CQgfqgW3.d.cts +0 -69
  183. package/dist/serverModelTypes-CQgfqgW3.d.cts.map +0 -1
  184. package/dist/serverModelTypes-vEPhHIit.d.ts +0 -69
  185. package/dist/serverModelTypes-vEPhHIit.d.ts.map +0 -1
  186. package/dist/serverQueryTypes-BI-2TD8F.d.ts +0 -53
  187. package/dist/serverQueryTypes-BI-2TD8F.d.ts.map +0 -1
  188. package/dist/serverQueryTypes-D7Yharse.d.cts +0 -53
  189. package/dist/serverQueryTypes-D7Yharse.d.cts.map +0 -1
@@ -0,0 +1,29 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/types/serverModelTypes.ts
3
+ /**
4
+ * Every {@link MobileFeedTradePositionDirection} the feed can report, for callers that need the values at
5
+ * runtime (validation, filters, UI enumeration).
6
+ */
7
+ const MOBILE_FEED_TRADE_POSITION_DIRECTIONS = ["long", "short"];
8
+ /**
9
+ * Every {@link MobileFeedTradePositionEffect} the feed can report, for callers that need the values at
10
+ * runtime (validation, filters, UI enumeration).
11
+ */
12
+ const MOBILE_FEED_TRADE_POSITION_EFFECTS = [
13
+ "opened",
14
+ "increased",
15
+ "reduced",
16
+ "closed",
17
+ "flipped"
18
+ ];
19
+ /**
20
+ * Every {@link MobileFeedMarginMode} the feed can report, for callers that need the values at runtime
21
+ * (validation, filters, UI enumeration).
22
+ */
23
+ const MOBILE_FEED_MARGIN_MODES = ["cross", "isolated"];
24
+ //#endregion
25
+ exports.MOBILE_FEED_MARGIN_MODES = MOBILE_FEED_MARGIN_MODES;
26
+ exports.MOBILE_FEED_TRADE_POSITION_DIRECTIONS = MOBILE_FEED_TRADE_POSITION_DIRECTIONS;
27
+ exports.MOBILE_FEED_TRADE_POSITION_EFFECTS = MOBILE_FEED_TRADE_POSITION_EFFECTS;
28
+
29
+ //# sourceMappingURL=serverModelTypes.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverModelTypes.cjs","names":[],"sources":["../../src/types/serverModelTypes.ts"],"sourcesContent":["import { BalanceSide } from '@nadohq/shared';\nimport { Hex } from 'viem';\n\n/**\n * Platform of a device registered for push notifications.\n */\nexport type MobileNotificationPlatform = 'ios' | 'android';\n\n/**\n * Category of push notification.\n */\nexport type MobileNotificationCategory =\n | 'order_fill'\n | 'order_update'\n | 'liquidation'\n | 'funding'\n | 'product_listing'\n | 'announcement';\n\n/**\n * Server-side public profile shape (snake_case).\n */\nexport interface MobileServerProfile {\n subaccount: Hex;\n username: string;\n display_name: string;\n}\n\n/**\n * Server-side identity shape (snake_case) returned by the signed `self_identity` query.\n */\nexport interface MobileServerIdentity {\n subaccount: Hex;\n username: string;\n display_name: string;\n private_mode: boolean;\n}\n\n/**\n * Direction of the position a feed trade resulted in — for `closed`, the direction that was closed. This is\n * NOT the execution buy/sell side, which the feed does not expose. Aliases {@link BalanceSide} so the feed's\n * direction values stay in lockstep with the rest of the SDK.\n */\nexport type MobileFeedTradePositionDirection = BalanceSide;\n\n/**\n * Every {@link MobileFeedTradePositionDirection} the feed can report, for callers that need the values at\n * runtime (validation, filters, UI enumeration).\n */\nexport const MOBILE_FEED_TRADE_POSITION_DIRECTIONS = [\n 'long',\n 'short',\n] as const satisfies readonly MobileFeedTradePositionDirection[];\n\n/**\n * Every {@link MobileFeedTradePositionEffect} the feed can report, for callers that need the values at\n * runtime (validation, filters, UI enumeration).\n */\nexport const MOBILE_FEED_TRADE_POSITION_EFFECTS = [\n 'opened',\n 'increased',\n 'reduced',\n 'closed',\n 'flipped',\n] as const;\n\n/**\n * How a feed trade changed the trader's position in the product.\n */\nexport type MobileFeedTradePositionEffect =\n (typeof MOBILE_FEED_TRADE_POSITION_EFFECTS)[number];\n\n/**\n * Position change of a feed trade. Both keys are single words, so the wire and client shapes are identical\n * and this type is shared by {@link MobileServerFeedTrade} and the client-side `MobileFeedTrade`.\n */\nexport interface MobileFeedTradePosition {\n direction: MobileFeedTradePositionDirection;\n effect: MobileFeedTradePositionEffect;\n}\n\n/**\n * Every {@link MobileFeedMarginMode} the feed can report, for callers that need the values at runtime\n * (validation, filters, UI enumeration).\n */\nexport const MOBILE_FEED_MARGIN_MODES = ['cross', 'isolated'] as const;\n\n/**\n * Margin mode a feed trade was executed under. Shared by the wire and client margin shapes.\n */\nexport type MobileFeedMarginMode = (typeof MOBILE_FEED_MARGIN_MODES)[number];\n\n/**\n * Server-side margin of a feed trade. Branch on `mode` — do not infer isolated state from leverage presence:\n * `estimated_leverage` (a rounded whole-number estimate, not exact submitted leverage) is omitted on `cross`,\n * and also omitted inside `isolated` when no estimate is available.\n */\nexport interface MobileServerFeedMargin {\n mode: MobileFeedMarginMode;\n estimated_leverage?: number;\n}\n\n/**\n * Server-side feed trade shape (snake_case): one row per order digest, enriched at read time with the\n * trader's current identity. Amounts are display-oriented human-unit JSON numbers — do not use them for\n * accounting, order construction, or exact threshold decisions.\n */\nexport interface MobileServerFeedTrade {\n /** Order digest this row is keyed by; the stable id clients use to reconcile live pagination. */\n order_digest: Hex;\n subaccount: Hex;\n username: string;\n display_name: string;\n /** Reserved for a future avatar source; `null` until one is implemented. */\n avatar_url: string | null;\n product_id: number;\n /** Executed quantity in human units. */\n quantity: number;\n /** Trade notional in whole-dollar human units. */\n notional: number;\n /** Average execution price in human units. */\n average_price: number;\n margin: MobileServerFeedMargin;\n position: MobileFeedTradePosition;\n /** Realized PnL of the trade in human units; can be negative. */\n realized_pnl: number;\n /** Fill time as JavaScript-safe integer Unix milliseconds. */\n filled_at_ms: number;\n}\n\n/**\n * Server-side scope limiting a notification category preference. Scopes are rejected by the backend for the\n * MVP (`scopes` must be empty) but are part of the wire format.\n */\nexport type MobileServerNotificationPreferenceScope =\n | { type: 'subaccount'; subaccount: Hex }\n | { type: 'product'; product_id: number };\n\n/**\n * Server-side per-category notification preference (snake_case).\n */\nexport interface MobileServerNotificationCategoryPreference {\n category: MobileNotificationCategory;\n enabled: boolean;\n scopes: MobileServerNotificationPreferenceScope[];\n}\n\n/**\n * Server-side notification preferences shape (snake_case), used in both the `update_preferences` execute and\n * the `notification_preferences` query response.\n */\nexport interface MobileServerNotificationPreferences {\n /** Only `1` is accepted by the backend for the MVP. */\n schema_version: 1;\n categories: MobileServerNotificationCategoryPreference[];\n}\n\n/**\n * Server-side registered push device shape (snake_case).\n */\nexport interface MobileServerRegisteredDevice {\n platform: MobileNotificationPlatform;\n locale: string | null;\n app_version: string | null;\n token_fingerprint_prefix: string;\n last_seen_at: number;\n}\n"],"mappings":";;;;;;AAiDA,MAAa,wCAAwC,CACnD,QACA,OACF;;;;;AAMA,MAAa,qCAAqC;CAChD;CACA;CACA;CACA;CACA;AACF;;;;;AAqBA,MAAa,2BAA2B,CAAC,SAAS,UAAU"}
@@ -1,2 +1,2 @@
1
- import { a as MobileServerNotificationPreferenceScope, c as MobileServerRegisteredDevice, i as MobileServerNotificationCategoryPreference, n as MobileNotificationPlatform, o as MobileServerNotificationPreferences, r as MobileServerIdentity, s as MobileServerProfile, t as MobileNotificationCategory } from "../serverModelTypes-CQgfqgW3.cjs";
2
- export { MobileNotificationCategory, MobileNotificationPlatform, MobileServerIdentity, MobileServerNotificationCategoryPreference, MobileServerNotificationPreferenceScope, MobileServerNotificationPreferences, MobileServerProfile, MobileServerRegisteredDevice };
1
+ import { _ as MobileServerRegisteredDevice, a as MobileFeedTradePosition, c as MobileNotificationCategory, d as MobileServerFeedTrade, f as MobileServerIdentity, g as MobileServerProfile, h as MobileServerNotificationPreferences, i as MobileFeedMarginMode, l as MobileNotificationPlatform, m as MobileServerNotificationPreferenceScope, n as MOBILE_FEED_TRADE_POSITION_DIRECTIONS, o as MobileFeedTradePositionDirection, p as MobileServerNotificationCategoryPreference, r as MOBILE_FEED_TRADE_POSITION_EFFECTS, s as MobileFeedTradePositionEffect, t as MOBILE_FEED_MARGIN_MODES, u as MobileServerFeedMargin } from "../serverModelTypes-CPZUvVil.cjs";
2
+ export { MOBILE_FEED_MARGIN_MODES, MOBILE_FEED_TRADE_POSITION_DIRECTIONS, MOBILE_FEED_TRADE_POSITION_EFFECTS, MobileFeedMarginMode, MobileFeedTradePosition, MobileFeedTradePositionDirection, MobileFeedTradePositionEffect, MobileNotificationCategory, MobileNotificationPlatform, MobileServerFeedMargin, MobileServerFeedTrade, MobileServerIdentity, MobileServerNotificationCategoryPreference, MobileServerNotificationPreferenceScope, MobileServerNotificationPreferences, MobileServerProfile, MobileServerRegisteredDevice };
@@ -1,2 +1,2 @@
1
- import { a as MobileServerNotificationPreferenceScope, c as MobileServerRegisteredDevice, i as MobileServerNotificationCategoryPreference, n as MobileNotificationPlatform, o as MobileServerNotificationPreferences, r as MobileServerIdentity, s as MobileServerProfile, t as MobileNotificationCategory } from "../serverModelTypes-vEPhHIit.js";
2
- export { MobileNotificationCategory, MobileNotificationPlatform, MobileServerIdentity, MobileServerNotificationCategoryPreference, MobileServerNotificationPreferenceScope, MobileServerNotificationPreferences, MobileServerProfile, MobileServerRegisteredDevice };
1
+ import { _ as MobileServerRegisteredDevice, a as MobileFeedTradePosition, c as MobileNotificationCategory, d as MobileServerFeedTrade, f as MobileServerIdentity, g as MobileServerProfile, h as MobileServerNotificationPreferences, i as MobileFeedMarginMode, l as MobileNotificationPlatform, m as MobileServerNotificationPreferenceScope, n as MOBILE_FEED_TRADE_POSITION_DIRECTIONS, o as MobileFeedTradePositionDirection, p as MobileServerNotificationCategoryPreference, r as MOBILE_FEED_TRADE_POSITION_EFFECTS, s as MobileFeedTradePositionEffect, t as MOBILE_FEED_MARGIN_MODES, u as MobileServerFeedMargin } from "../serverModelTypes-CqnqHY5F.js";
2
+ export { MOBILE_FEED_MARGIN_MODES, MOBILE_FEED_TRADE_POSITION_DIRECTIONS, MOBILE_FEED_TRADE_POSITION_EFFECTS, MobileFeedMarginMode, MobileFeedTradePosition, MobileFeedTradePositionDirection, MobileFeedTradePositionEffect, MobileNotificationCategory, MobileNotificationPlatform, MobileServerFeedMargin, MobileServerFeedTrade, MobileServerIdentity, MobileServerNotificationCategoryPreference, MobileServerNotificationPreferenceScope, MobileServerNotificationPreferences, MobileServerProfile, MobileServerRegisteredDevice };
@@ -1 +1,26 @@
1
- export {};
1
+ //#region src/types/serverModelTypes.ts
2
+ /**
3
+ * Every {@link MobileFeedTradePositionDirection} the feed can report, for callers that need the values at
4
+ * runtime (validation, filters, UI enumeration).
5
+ */
6
+ const MOBILE_FEED_TRADE_POSITION_DIRECTIONS = ["long", "short"];
7
+ /**
8
+ * Every {@link MobileFeedTradePositionEffect} the feed can report, for callers that need the values at
9
+ * runtime (validation, filters, UI enumeration).
10
+ */
11
+ const MOBILE_FEED_TRADE_POSITION_EFFECTS = [
12
+ "opened",
13
+ "increased",
14
+ "reduced",
15
+ "closed",
16
+ "flipped"
17
+ ];
18
+ /**
19
+ * Every {@link MobileFeedMarginMode} the feed can report, for callers that need the values at runtime
20
+ * (validation, filters, UI enumeration).
21
+ */
22
+ const MOBILE_FEED_MARGIN_MODES = ["cross", "isolated"];
23
+ //#endregion
24
+ export { MOBILE_FEED_MARGIN_MODES, MOBILE_FEED_TRADE_POSITION_DIRECTIONS, MOBILE_FEED_TRADE_POSITION_EFFECTS };
25
+
26
+ //# sourceMappingURL=serverModelTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverModelTypes.js","names":[],"sources":["../../src/types/serverModelTypes.ts"],"sourcesContent":["import { BalanceSide } from '@nadohq/shared';\nimport { Hex } from 'viem';\n\n/**\n * Platform of a device registered for push notifications.\n */\nexport type MobileNotificationPlatform = 'ios' | 'android';\n\n/**\n * Category of push notification.\n */\nexport type MobileNotificationCategory =\n | 'order_fill'\n | 'order_update'\n | 'liquidation'\n | 'funding'\n | 'product_listing'\n | 'announcement';\n\n/**\n * Server-side public profile shape (snake_case).\n */\nexport interface MobileServerProfile {\n subaccount: Hex;\n username: string;\n display_name: string;\n}\n\n/**\n * Server-side identity shape (snake_case) returned by the signed `self_identity` query.\n */\nexport interface MobileServerIdentity {\n subaccount: Hex;\n username: string;\n display_name: string;\n private_mode: boolean;\n}\n\n/**\n * Direction of the position a feed trade resulted in — for `closed`, the direction that was closed. This is\n * NOT the execution buy/sell side, which the feed does not expose. Aliases {@link BalanceSide} so the feed's\n * direction values stay in lockstep with the rest of the SDK.\n */\nexport type MobileFeedTradePositionDirection = BalanceSide;\n\n/**\n * Every {@link MobileFeedTradePositionDirection} the feed can report, for callers that need the values at\n * runtime (validation, filters, UI enumeration).\n */\nexport const MOBILE_FEED_TRADE_POSITION_DIRECTIONS = [\n 'long',\n 'short',\n] as const satisfies readonly MobileFeedTradePositionDirection[];\n\n/**\n * Every {@link MobileFeedTradePositionEffect} the feed can report, for callers that need the values at\n * runtime (validation, filters, UI enumeration).\n */\nexport const MOBILE_FEED_TRADE_POSITION_EFFECTS = [\n 'opened',\n 'increased',\n 'reduced',\n 'closed',\n 'flipped',\n] as const;\n\n/**\n * How a feed trade changed the trader's position in the product.\n */\nexport type MobileFeedTradePositionEffect =\n (typeof MOBILE_FEED_TRADE_POSITION_EFFECTS)[number];\n\n/**\n * Position change of a feed trade. Both keys are single words, so the wire and client shapes are identical\n * and this type is shared by {@link MobileServerFeedTrade} and the client-side `MobileFeedTrade`.\n */\nexport interface MobileFeedTradePosition {\n direction: MobileFeedTradePositionDirection;\n effect: MobileFeedTradePositionEffect;\n}\n\n/**\n * Every {@link MobileFeedMarginMode} the feed can report, for callers that need the values at runtime\n * (validation, filters, UI enumeration).\n */\nexport const MOBILE_FEED_MARGIN_MODES = ['cross', 'isolated'] as const;\n\n/**\n * Margin mode a feed trade was executed under. Shared by the wire and client margin shapes.\n */\nexport type MobileFeedMarginMode = (typeof MOBILE_FEED_MARGIN_MODES)[number];\n\n/**\n * Server-side margin of a feed trade. Branch on `mode` — do not infer isolated state from leverage presence:\n * `estimated_leverage` (a rounded whole-number estimate, not exact submitted leverage) is omitted on `cross`,\n * and also omitted inside `isolated` when no estimate is available.\n */\nexport interface MobileServerFeedMargin {\n mode: MobileFeedMarginMode;\n estimated_leverage?: number;\n}\n\n/**\n * Server-side feed trade shape (snake_case): one row per order digest, enriched at read time with the\n * trader's current identity. Amounts are display-oriented human-unit JSON numbers — do not use them for\n * accounting, order construction, or exact threshold decisions.\n */\nexport interface MobileServerFeedTrade {\n /** Order digest this row is keyed by; the stable id clients use to reconcile live pagination. */\n order_digest: Hex;\n subaccount: Hex;\n username: string;\n display_name: string;\n /** Reserved for a future avatar source; `null` until one is implemented. */\n avatar_url: string | null;\n product_id: number;\n /** Executed quantity in human units. */\n quantity: number;\n /** Trade notional in whole-dollar human units. */\n notional: number;\n /** Average execution price in human units. */\n average_price: number;\n margin: MobileServerFeedMargin;\n position: MobileFeedTradePosition;\n /** Realized PnL of the trade in human units; can be negative. */\n realized_pnl: number;\n /** Fill time as JavaScript-safe integer Unix milliseconds. */\n filled_at_ms: number;\n}\n\n/**\n * Server-side scope limiting a notification category preference. Scopes are rejected by the backend for the\n * MVP (`scopes` must be empty) but are part of the wire format.\n */\nexport type MobileServerNotificationPreferenceScope =\n | { type: 'subaccount'; subaccount: Hex }\n | { type: 'product'; product_id: number };\n\n/**\n * Server-side per-category notification preference (snake_case).\n */\nexport interface MobileServerNotificationCategoryPreference {\n category: MobileNotificationCategory;\n enabled: boolean;\n scopes: MobileServerNotificationPreferenceScope[];\n}\n\n/**\n * Server-side notification preferences shape (snake_case), used in both the `update_preferences` execute and\n * the `notification_preferences` query response.\n */\nexport interface MobileServerNotificationPreferences {\n /** Only `1` is accepted by the backend for the MVP. */\n schema_version: 1;\n categories: MobileServerNotificationCategoryPreference[];\n}\n\n/**\n * Server-side registered push device shape (snake_case).\n */\nexport interface MobileServerRegisteredDevice {\n platform: MobileNotificationPlatform;\n locale: string | null;\n app_version: string | null;\n token_fingerprint_prefix: string;\n last_seen_at: number;\n}\n"],"mappings":";;;;;AAiDA,MAAa,wCAAwC,CACnD,QACA,OACF;;;;;AAMA,MAAa,qCAAqC;CAChD;CACA;CACA;CACA;CACA;AACF;;;;;AAqBA,MAAa,2BAA2B,CAAC,SAAS,UAAU"}
@@ -1,2 +1,2 @@
1
- import { a as MobileServerRegisteredDevicesResponse, c as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, n as MobileServerProfileRequest, o as MobileServerSelfIdentityResponse, r as MobileServerProfileResponse, s as MobileServerUsernameAvailabilityRequest, t as MobileServerNotificationPreferencesResponse } from "../serverQueryTypes-D7Yharse.cjs";
2
- export { MobileServerNotificationPreferencesResponse, MobileServerProfileRequest, MobileServerProfileResponse, MobileServerPublicQueryRequest, MobileServerRegisteredDevicesResponse, MobileServerSelfIdentityResponse, MobileServerUsernameAvailabilityRequest, MobileServerUsernameAvailabilityResponse };
1
+ import { a as MobileServerPublicQueryResponseByType, c as MobileServerSelfIdentityResponse, d as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, l as MobileServerSignedQueryResponseByType, n as MobileServerNotificationPreferencesResponse, o as MobileServerPublicQuerySuccessResponse, r as MobileServerProfileResponse, s as MobileServerRegisteredDevicesResponse, t as MobileServerFeedResponse, u as MobileServerSignedQuerySuccessResponse } from "../serverQueryTypes-C_cCx0Ac.cjs";
2
+ export { MobileServerFeedResponse, MobileServerNotificationPreferencesResponse, MobileServerProfileResponse, MobileServerPublicQueryRequest, MobileServerPublicQueryResponseByType, MobileServerPublicQuerySuccessResponse, MobileServerRegisteredDevicesResponse, MobileServerSelfIdentityResponse, MobileServerSignedQueryResponseByType, MobileServerSignedQuerySuccessResponse, MobileServerUsernameAvailabilityResponse };
@@ -1,2 +1,2 @@
1
- import { a as MobileServerRegisteredDevicesResponse, c as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, n as MobileServerProfileRequest, o as MobileServerSelfIdentityResponse, r as MobileServerProfileResponse, s as MobileServerUsernameAvailabilityRequest, t as MobileServerNotificationPreferencesResponse } from "../serverQueryTypes-BI-2TD8F.js";
2
- export { MobileServerNotificationPreferencesResponse, MobileServerProfileRequest, MobileServerProfileResponse, MobileServerPublicQueryRequest, MobileServerRegisteredDevicesResponse, MobileServerSelfIdentityResponse, MobileServerUsernameAvailabilityRequest, MobileServerUsernameAvailabilityResponse };
1
+ import { a as MobileServerPublicQueryResponseByType, c as MobileServerSelfIdentityResponse, d as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, l as MobileServerSignedQueryResponseByType, n as MobileServerNotificationPreferencesResponse, o as MobileServerPublicQuerySuccessResponse, r as MobileServerProfileResponse, s as MobileServerRegisteredDevicesResponse, t as MobileServerFeedResponse, u as MobileServerSignedQuerySuccessResponse } from "../serverQueryTypes-CJLWWZBs.js";
2
+ export { MobileServerFeedResponse, MobileServerNotificationPreferencesResponse, MobileServerProfileResponse, MobileServerPublicQueryRequest, MobileServerPublicQueryResponseByType, MobileServerPublicQuerySuccessResponse, MobileServerRegisteredDevicesResponse, MobileServerSelfIdentityResponse, MobileServerSignedQueryResponseByType, MobileServerSignedQuerySuccessResponse, MobileServerUsernameAvailabilityResponse };
File without changes
@@ -0,0 +1,2 @@
1
+ import { a as MobileServerSignedQueryRequestByType, i as MobileServerRequestType, n as MobileServerPublicQueryRequestByType, o as MobileServerSignedQueryRequestType, r as MobileServerPublicQueryRequestType, t as MobileServerExecuteRequestType } from "../serverRequestTypes-DnU_FfMI.cjs";
2
+ export { MobileServerExecuteRequestType, MobileServerPublicQueryRequestByType, MobileServerPublicQueryRequestType, MobileServerRequestType, MobileServerSignedQueryRequestByType, MobileServerSignedQueryRequestType };
@@ -0,0 +1,2 @@
1
+ import { a as MobileServerSignedQueryRequestByType, i as MobileServerRequestType, n as MobileServerPublicQueryRequestByType, o as MobileServerSignedQueryRequestType, r as MobileServerPublicQueryRequestType, t as MobileServerExecuteRequestType } from "../serverRequestTypes-DQDy3K9O.js";
2
+ export { MobileServerExecuteRequestType, MobileServerPublicQueryRequestByType, MobileServerPublicQueryRequestType, MobileServerRequestType, MobileServerSignedQueryRequestByType, MobileServerSignedQueryRequestType };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
- import { n as MobileNotificationPlatform, o as MobileServerNotificationPreferences } from "./serverModelTypes-CQgfqgW3.cjs";
2
- import { h as MobileSignedRequestParams } from "./clientTypes-Et0PUa2d.cjs";
1
+ import { h as MobileServerNotificationPreferences, l as MobileNotificationPlatform } from "./serverModelTypes-CPZUvVil.cjs";
2
+ import { y as MobileSignedRequestParams } from "./clientTypes-UFInIAQd.cjs";
3
3
  import { WalletClientWithAccount } from "@nadohq/shared";
4
4
  import { Hex } from "viem";
5
5
 
@@ -70,4 +70,4 @@ interface BuildSignedMobileRequestParams extends MobileSignedRequestParams {
70
70
  }
71
71
  //#endregion
72
72
  export { MobileSignedRequest as i, MobileSignedInner as n, MobileSignedInnerParams as r, BuildSignedMobileRequestParams as t };
73
- //# sourceMappingURL=types-uCD4BNZR.d.cts.map
73
+ //# sourceMappingURL=types-CzOeSYnW.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-uCD4BNZR.d.cts","names":[],"sources":["../src/signing/src/signing/types.ts"],"mappings":";;;;;;;;AAiBA;;;;;;;KAAY,iBAAA;EACN,IAAA;EAAwB,YAAA;AAAA;EACxB,IAAA;EAAyB,YAAA;AAAA;EACzB,IAAA;EAA0B,YAAA;AAAA;EAC1B,IAAA;AAAA;EAEA,IAAA;EACA,UAAA;EACA,QAAA,EAAU,0BAAA;EAGV,MAAA;EACA,WAAA;AAAA;EAEA,IAAA;EAA+B,UAAA;AAAA;EAE/B,IAAA;EACA,WAAA,EAAa,mCAAmC;AAAA;EAEhD,IAAA;AAAA;EACA,IAAA;AAAA;;;;;KAMM,uBAAA,WAAkC,iBAAA,YAA6B,IAAA,CACzE,OAAA,CAAQ,iBAAA;EAAqB,IAAA,EAAM,CAAA;AAAA;;;AAAC;AAQtC;KAAY,mBAAA,WACA,iBAAA,GAAoB,iBAAA,IAC5B,CAAA;EACF,SAAA,EAAW,GAAA;EACX,MAAA,EAAQ,GAAA;EACR,KAAA;AAAA;;;;UAMe,8BAAA,SAAuC,yBAAA;EACtD,YAAA,EAAc,uBAAA;EACd,KAAA,EAAO,iBAAA;EAZuB;;;EAgB9B,KAAA;AAAA"}
1
+ {"version":3,"file":"types-CzOeSYnW.d.cts","names":[],"sources":["../src/signing/src/signing/types.ts"],"mappings":";;;;;;;;AAiBA;;;;;;;KAAY,iBAAA;EACN,IAAA;EAAwB,YAAA;AAAA;EACxB,IAAA;EAAyB,YAAA;AAAA;EACzB,IAAA;EAA0B,YAAA;AAAA;EAC1B,IAAA;AAAA;EAEA,IAAA;EACA,UAAA;EACA,QAAA,EAAU,0BAAA;EAGV,MAAA;EACA,WAAA;AAAA;EAEA,IAAA;EAA+B,UAAA;AAAA;EAE/B,IAAA;EACA,WAAA,EAAa,mCAAmC;AAAA;EAEhD,IAAA;AAAA;EACA,IAAA;AAAA;;;;;KAMM,uBAAA,WAAkC,iBAAA,YAA6B,IAAA,CACzE,OAAA,CAAQ,iBAAA;EAAqB,IAAA,EAAM,CAAA;AAAA;;;AAAC;AAQtC;KAAY,mBAAA,WACA,iBAAA,GAAoB,iBAAA,IAC5B,CAAA;EACF,SAAA,EAAW,GAAA;EACX,MAAA,EAAQ,GAAA;EACR,KAAA;AAAA;;;;UAMe,8BAAA,SAAuC,yBAAA;EACtD,YAAA,EAAc,uBAAA;EACd,KAAA,EAAO,iBAAA;EAZuB;;;EAgB9B,KAAA;AAAA"}
@@ -1,5 +1,5 @@
1
- import { n as MobileNotificationPlatform, o as MobileServerNotificationPreferences } from "./serverModelTypes-vEPhHIit.js";
2
- import { h as MobileSignedRequestParams } from "./clientTypes-DWW2N66c.js";
1
+ import { h as MobileServerNotificationPreferences, l as MobileNotificationPlatform } from "./serverModelTypes-CqnqHY5F.js";
2
+ import { y as MobileSignedRequestParams } from "./clientTypes-BsOps_pY.js";
3
3
  import { WalletClientWithAccount } from "@nadohq/shared";
4
4
  import { Hex } from "viem";
5
5
 
@@ -70,4 +70,4 @@ interface BuildSignedMobileRequestParams extends MobileSignedRequestParams {
70
70
  }
71
71
  //#endregion
72
72
  export { MobileSignedRequest as i, MobileSignedInner as n, MobileSignedInnerParams as r, BuildSignedMobileRequestParams as t };
73
- //# sourceMappingURL=types-B76Pn7Sy.d.ts.map
73
+ //# sourceMappingURL=types-UHjZR-js.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-B76Pn7Sy.d.ts","names":[],"sources":["../src/signing/src/signing/types.ts"],"mappings":";;;;;;;;AAiBA;;;;;;;KAAY,iBAAA;EACN,IAAA;EAAwB,YAAA;AAAA;EACxB,IAAA;EAAyB,YAAA;AAAA;EACzB,IAAA;EAA0B,YAAA;AAAA;EAC1B,IAAA;AAAA;EAEA,IAAA;EACA,UAAA;EACA,QAAA,EAAU,0BAAA;EAGV,MAAA;EACA,WAAA;AAAA;EAEA,IAAA;EAA+B,UAAA;AAAA;EAE/B,IAAA;EACA,WAAA,EAAa,mCAAmC;AAAA;EAEhD,IAAA;AAAA;EACA,IAAA;AAAA;;;;;KAMM,uBAAA,WAAkC,iBAAA,YAA6B,IAAA,CACzE,OAAA,CAAQ,iBAAA;EAAqB,IAAA,EAAM,CAAA;AAAA;;;AAAC;AAQtC;KAAY,mBAAA,WACA,iBAAA,GAAoB,iBAAA,IAC5B,CAAA;EACF,SAAA,EAAW,GAAA;EACX,MAAA,EAAQ,GAAA;EACR,KAAA;AAAA;;;;UAMe,8BAAA,SAAuC,yBAAA;EACtD,YAAA,EAAc,uBAAA;EACd,KAAA,EAAO,iBAAA;EAZuB;;;EAgB9B,KAAA;AAAA"}
1
+ {"version":3,"file":"types-UHjZR-js.d.ts","names":[],"sources":["../src/signing/src/signing/types.ts"],"mappings":";;;;;;;;AAiBA;;;;;;;KAAY,iBAAA;EACN,IAAA;EAAwB,YAAA;AAAA;EACxB,IAAA;EAAyB,YAAA;AAAA;EACzB,IAAA;EAA0B,YAAA;AAAA;EAC1B,IAAA;AAAA;EAEA,IAAA;EACA,UAAA;EACA,QAAA,EAAU,0BAAA;EAGV,MAAA;EACA,WAAA;AAAA;EAEA,IAAA;EAA+B,UAAA;AAAA;EAE/B,IAAA;EACA,WAAA,EAAa,mCAAmC;AAAA;EAEhD,IAAA;AAAA;EACA,IAAA;AAAA;;;;;KAMM,uBAAA,WAAkC,iBAAA,YAA6B,IAAA,CACzE,OAAA,CAAQ,iBAAA;EAAqB,IAAA,EAAM,CAAA;AAAA;;;AAAC;AAQtC;KAAY,mBAAA,WACA,iBAAA,GAAoB,iBAAA,IAC5B,CAAA;EACF,SAAA,EAAW,GAAA;EACX,MAAA,EAAQ,GAAA;EACR,KAAA;AAAA;;;;UAMe,8BAAA,SAAuC,yBAAA;EACtD,YAAA,EAAc,uBAAA;EACd,KAAA,EAAO,iBAAA;EAZuB;;;EAgB9B,KAAA;AAAA"}
@@ -0,0 +1,17 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/utils/feed.ts
3
+ /**
4
+ * Maximum feed page size the backend accepts; also the default when `limit` is omitted. Requests above this
5
+ * fail with `INVALID_FEED_FILTER`.
6
+ */
7
+ const MOBILE_FEED_MAX_PAGE_SIZE = 50;
8
+ /**
9
+ * Lowest minimum notional the backend accepts, in whole dollars. Filtered requests below this fail with
10
+ * `INVALID_FEED_FILTER`; omitting the filter entirely returns the unfiltered feed.
11
+ */
12
+ const MOBILE_FEED_MIN_NOTIONAL_FLOOR = 1e3;
13
+ //#endregion
14
+ exports.MOBILE_FEED_MAX_PAGE_SIZE = MOBILE_FEED_MAX_PAGE_SIZE;
15
+ exports.MOBILE_FEED_MIN_NOTIONAL_FLOOR = MOBILE_FEED_MIN_NOTIONAL_FLOOR;
16
+
17
+ //# sourceMappingURL=feed.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feed.cjs","names":[],"sources":["../../src/utils/feed.ts"],"sourcesContent":["/**\n * Maximum feed page size the backend accepts; also the default when `limit` is omitted. Requests above this\n * fail with `INVALID_FEED_FILTER`.\n */\nexport const MOBILE_FEED_MAX_PAGE_SIZE = 50;\n\n/**\n * Lowest minimum notional the backend accepts, in whole dollars. Filtered requests below this fail with\n * `INVALID_FEED_FILTER`; omitting the filter entirely returns the unfiltered feed.\n */\nexport const MOBILE_FEED_MIN_NOTIONAL_FLOOR = 1_000;\n"],"mappings":";;;;;;AAIA,MAAa,4BAA4B;;;;;AAMzC,MAAa,iCAAiC"}
@@ -0,0 +1,2 @@
1
+ import { n as MOBILE_FEED_MIN_NOTIONAL_FLOOR, t as MOBILE_FEED_MAX_PAGE_SIZE } from "../feed-CBIwOhTO.cjs";
2
+ export { MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR };
@@ -0,0 +1,2 @@
1
+ import { n as MOBILE_FEED_MIN_NOTIONAL_FLOOR, t as MOBILE_FEED_MAX_PAGE_SIZE } from "../feed-BF5k6Ryu.js";
2
+ export { MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR };
@@ -0,0 +1,15 @@
1
+ //#region src/utils/feed.ts
2
+ /**
3
+ * Maximum feed page size the backend accepts; also the default when `limit` is omitted. Requests above this
4
+ * fail with `INVALID_FEED_FILTER`.
5
+ */
6
+ const MOBILE_FEED_MAX_PAGE_SIZE = 50;
7
+ /**
8
+ * Lowest minimum notional the backend accepts, in whole dollars. Filtered requests below this fail with
9
+ * `INVALID_FEED_FILTER`; omitting the filter entirely returns the unfiltered feed.
10
+ */
11
+ const MOBILE_FEED_MIN_NOTIONAL_FLOOR = 1e3;
12
+ //#endregion
13
+ export { MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR };
14
+
15
+ //# sourceMappingURL=feed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feed.js","names":[],"sources":["../../src/utils/feed.ts"],"sourcesContent":["/**\n * Maximum feed page size the backend accepts; also the default when `limit` is omitted. Requests above this\n * fail with `INVALID_FEED_FILTER`.\n */\nexport const MOBILE_FEED_MAX_PAGE_SIZE = 50;\n\n/**\n * Lowest minimum notional the backend accepts, in whole dollars. Filtered requests below this fail with\n * `INVALID_FEED_FILTER`; omitting the filter entirely returns the unfiltered feed.\n */\nexport const MOBILE_FEED_MIN_NOTIONAL_FLOOR = 1_000;\n"],"mappings":";;;;;AAIA,MAAa,4BAA4B;;;;;AAMzC,MAAa,iCAAiC"}
@@ -1,6 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_utils_serverResponseGuards = require("./serverResponseGuards.cjs");
3
+ const require_utils_feed = require("./feed.cjs");
3
4
  const require_utils_patterns = require("./patterns.cjs");
4
5
  exports.MOBILE_DISPLAY_NAME_PATTERN = require_utils_patterns.MOBILE_DISPLAY_NAME_PATTERN;
6
+ exports.MOBILE_FEED_MAX_PAGE_SIZE = require_utils_feed.MOBILE_FEED_MAX_PAGE_SIZE;
7
+ exports.MOBILE_FEED_MIN_NOTIONAL_FLOOR = require_utils_feed.MOBILE_FEED_MIN_NOTIONAL_FLOOR;
5
8
  exports.isMobileServerFailureResponse = require_utils_serverResponseGuards.isMobileServerFailureResponse;
6
9
  exports.isMobileServerSuccessResponse = require_utils_serverResponseGuards.isMobileServerSuccessResponse;
@@ -1,3 +1,4 @@
1
- import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-B9J2ldpx.cjs";
2
- import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-DjCNL3CR.cjs";
3
- export { MOBILE_DISPLAY_NAME_PATTERN, isMobileServerFailureResponse, isMobileServerSuccessResponse };
1
+ import { n as MOBILE_FEED_MIN_NOTIONAL_FLOOR, t as MOBILE_FEED_MAX_PAGE_SIZE } from "../feed-CBIwOhTO.cjs";
2
+ import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-Db6fgz8i.cjs";
3
+ import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-BlvfJjsa.cjs";
4
+ export { MOBILE_DISPLAY_NAME_PATTERN, MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR, isMobileServerFailureResponse, isMobileServerSuccessResponse };
@@ -1,3 +1,4 @@
1
- import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-BbxH3_VA.js";
2
- import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-C_vZIgGl.js";
3
- export { MOBILE_DISPLAY_NAME_PATTERN, isMobileServerFailureResponse, isMobileServerSuccessResponse };
1
+ import { n as MOBILE_FEED_MIN_NOTIONAL_FLOOR, t as MOBILE_FEED_MAX_PAGE_SIZE } from "../feed-BF5k6Ryu.js";
2
+ import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-B5gi7OfV.js";
3
+ import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-gpHH8SHk.js";
4
+ export { MOBILE_DISPLAY_NAME_PATTERN, MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR, isMobileServerFailureResponse, isMobileServerSuccessResponse };
@@ -1,3 +1,4 @@
1
1
  import { isMobileServerFailureResponse, isMobileServerSuccessResponse } from "./serverResponseGuards.js";
2
+ import { MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR } from "./feed.js";
2
3
  import { MOBILE_DISPLAY_NAME_PATTERN } from "./patterns.js";
3
- export { MOBILE_DISPLAY_NAME_PATTERN, isMobileServerFailureResponse, isMobileServerSuccessResponse };
4
+ export { MOBILE_DISPLAY_NAME_PATTERN, MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR, isMobileServerFailureResponse, isMobileServerSuccessResponse };
@@ -1,2 +1,2 @@
1
- import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-B9J2ldpx.cjs";
1
+ import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-Db6fgz8i.cjs";
2
2
  export { MOBILE_DISPLAY_NAME_PATTERN };
@@ -1,2 +1,2 @@
1
- import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-BbxH3_VA.js";
1
+ import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-B5gi7OfV.js";
2
2
  export { MOBILE_DISPLAY_NAME_PATTERN };
@@ -1,2 +1,2 @@
1
- import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-DjCNL3CR.cjs";
1
+ import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-BlvfJjsa.cjs";
2
2
  export { isMobileServerFailureResponse, isMobileServerSuccessResponse };
@@ -1,2 +1,2 @@
1
- import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-C_vZIgGl.js";
1
+ import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-gpHH8SHk.js";
2
2
  export { isMobileServerFailureResponse, isMobileServerSuccessResponse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadohq/mobile-client",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "HTTP client for the Nado mobile service API — username claims, profiles, privacy settings, and push notification devices & preferences",
@@ -42,7 +42,7 @@
42
42
  "types": "./dist/index.d.ts",
43
43
  "dependencies": {
44
44
  "@msgpack/msgpack": "3.1.3",
45
- "@nadohq/shared": "^0.28.0",
45
+ "@nadohq/shared": "^0.30.0",
46
46
  "axios": "1.16.1"
47
47
  },
48
48
  "peerDependencies": {
@@ -54,5 +54,5 @@
54
54
  "bignumber.js": "11.1.1",
55
55
  "viem": "2.52.0"
56
56
  },
57
- "gitHead": "12206fb18e68e917ce03051727dc7a97f401dd27"
57
+ "gitHead": "792b9deb17d69d86a8ed6f9ec4e9b3f453bcb3e8"
58
58
  }
@@ -4,6 +4,7 @@ import {
4
4
  } from '@nadohq/shared';
5
5
  import axios, { AxiosInstance, AxiosResponse } from 'axios';
6
6
  import {
7
+ mapMobileFeedPage,
7
8
  mapMobileIdentity,
8
9
  mapMobileNotificationPreferences,
9
10
  mapMobileNotificationPreferencesToServer,
@@ -17,12 +18,14 @@ import {
17
18
  MobileSignedRequest,
18
19
  } from './signing';
19
20
  import {
21
+ GetMobileFeedParams,
20
22
  GetMobileNotificationPreferencesParams,
21
23
  GetMobilePublicProfileParams,
22
24
  GetMobileRegisteredDevicesParams,
23
25
  GetMobileSelfIdentityParams,
24
26
  GetMobileUsernameAvailabilityParams,
25
27
  MobileClaimUsernameParams,
28
+ MobileFeedPage,
26
29
  MobileIdentity,
27
30
  MobileNotificationPreferences,
28
31
  MobilePublicProfile,
@@ -39,14 +42,15 @@ import { MobileServerFailureError } from './types/MobileServerFailureError';
39
42
  import { MobileServerSuccessResponse } from './types/serverBaseTypes';
40
43
  import { MobileServerExecuteResult } from './types/serverExecuteTypes';
41
44
  import {
42
- MobileServerNotificationPreferencesResponse,
43
- MobileServerProfileRequest,
44
- MobileServerProfileResponse,
45
- MobileServerRegisteredDevicesResponse,
46
- MobileServerSelfIdentityResponse,
47
- MobileServerUsernameAvailabilityRequest,
48
- MobileServerUsernameAvailabilityResponse,
45
+ MobileServerPublicQueryRequest,
46
+ MobileServerPublicQuerySuccessResponse,
47
+ MobileServerSignedQuerySuccessResponse,
49
48
  } from './types/serverQueryTypes';
49
+ import {
50
+ MobileServerPublicQueryRequestByType,
51
+ MobileServerPublicQueryRequestType,
52
+ MobileServerSignedQueryRequestType,
53
+ } from './types/serverRequestTypes';
50
54
  import {
51
55
  isMobileServerFailureResponse,
52
56
  isMobileServerSuccessResponse,
@@ -108,12 +112,11 @@ export class MobileClient {
108
112
  async getUsernameAvailability(
109
113
  params: GetMobileUsernameAvailabilityParams,
110
114
  ): Promise<MobileUsernameAvailability> {
111
- const body: MobileServerUsernameAvailabilityRequest = {
115
+ const body: MobileServerPublicQueryRequest<'username_availability'> = {
112
116
  type: 'username_availability',
113
117
  display_name: params.displayName,
114
118
  };
115
- const data =
116
- await this.publicQuery<MobileServerUsernameAvailabilityResponse>(body);
119
+ const data = await this.publicQuery(body);
117
120
  return { username: data.username, available: data.available };
118
121
  }
119
122
 
@@ -126,14 +129,36 @@ export class MobileClient {
126
129
  async getPublicProfile(
127
130
  params: GetMobilePublicProfileParams,
128
131
  ): Promise<MobilePublicProfile> {
129
- const body: MobileServerProfileRequest = {
132
+ const body: MobileServerPublicQueryRequest<'profile'> = {
130
133
  type: 'profile',
131
134
  username: params.username,
132
135
  };
133
- const data = await this.publicQuery<MobileServerProfileResponse>(body);
136
+ const data = await this.publicQuery(body);
134
137
  return mapMobilePublicProfile(data.profile);
135
138
  }
136
139
 
140
+ /**
141
+ * Fetches a page of the global trade feed: public, named, perpetual trades, newest first, optionally
142
+ * filtered by a whole-dollar minimum notional (omitted means unfiltered). The feed is best-effort rather
143
+ * than authoritative history, and pagination is live (not snapshot), so deduplicate pages by
144
+ * {@link MobileFeedTrade.orderDigest}.
145
+ *
146
+ * @throws {MobileServerFailureError} With error code `INVALID_FEED_FILTER` if `minimumNotional` or
147
+ * `limit` is outside its allowed domain (fix the request; do not retry unchanged), or
148
+ * `INVALID_FEED_CURSOR` if the cursor is malformed or was issued for a different `minimumNotional`
149
+ * (discard the cursor and restart from the first page).
150
+ */
151
+ async getFeed(params: GetMobileFeedParams = {}): Promise<MobileFeedPage> {
152
+ const body: MobileServerPublicQueryRequest<'feed'> = {
153
+ type: 'feed',
154
+ minimum_notional: params.minimumNotional,
155
+ limit: params.limit,
156
+ cursor: params.cursor,
157
+ };
158
+ const data = await this.publicQuery(body);
159
+ return mapMobileFeedPage(data);
160
+ }
161
+
137
162
  /*
138
163
  Signed queries
139
164
  */
@@ -150,8 +175,7 @@ export class MobileClient {
150
175
  params,
151
176
  {},
152
177
  );
153
- const data =
154
- await this.query<MobileServerSelfIdentityResponse>(signedRequest);
178
+ const data = await this.query<'self_identity'>(signedRequest);
155
179
  return data.identity ? mapMobileIdentity(data.identity) : null;
156
180
  }
157
181
 
@@ -167,10 +191,7 @@ export class MobileClient {
167
191
  params,
168
192
  {},
169
193
  );
170
- const data =
171
- await this.query<MobileServerNotificationPreferencesResponse>(
172
- signedRequest,
173
- );
194
+ const data = await this.query<'notification_preferences'>(signedRequest);
174
195
  return mapMobileNotificationPreferences(data.preferences);
175
196
  }
176
197
 
@@ -185,8 +206,7 @@ export class MobileClient {
185
206
  params,
186
207
  {},
187
208
  );
188
- const data =
189
- await this.query<MobileServerRegisteredDevicesResponse>(signedRequest);
209
+ const data = await this.query<'registered_devices'>(signedRequest);
190
210
  return data.devices.map(mapMobileRegisteredDevice);
191
211
  }
192
212
 
@@ -318,9 +338,11 @@ export class MobileClient {
318
338
  return buildSignedMobileRequest({ ...params, walletClient, inner });
319
339
  }
320
340
 
321
- protected async publicQuery<TResponse extends { status: 'success' }>(
322
- body: object,
323
- ): Promise<TResponse> {
341
+ // Spelled out as an intersection rather than `MobileServerPublicQueryRequest<T>`: the latter is an indexed
342
+ // access on a mapped type, which is not an inference site, so `T` would always widen to the full union.
343
+ protected async publicQuery<T extends MobileServerPublicQueryRequestType>(
344
+ body: { type: T } & MobileServerPublicQueryRequestByType[T],
345
+ ): Promise<MobileServerPublicQuerySuccessResponse<T>> {
324
346
  const response = await this.axiosInstance.post<unknown>(
325
347
  `${this.opts.url}/mobile/public_query`,
326
348
  body,
@@ -330,12 +352,12 @@ export class MobileClient {
330
352
  this.checkServerStatus(response);
331
353
 
332
354
  // checkServerStatus throws on failure responses so the cast to the success response is acceptable here
333
- return response.data as TResponse;
355
+ return response.data as MobileServerPublicQuerySuccessResponse<T>;
334
356
  }
335
357
 
336
- protected async query<TResponse extends { status: 'success' }>(
358
+ protected async query<T extends MobileServerSignedQueryRequestType>(
337
359
  body: MobileSignedRequest,
338
- ): Promise<TResponse> {
360
+ ): Promise<MobileServerSignedQuerySuccessResponse<T>> {
339
361
  const response = await this.axiosInstance.post<unknown>(
340
362
  `${this.opts.url}/mobile/query`,
341
363
  body,
@@ -345,7 +367,7 @@ export class MobileClient {
345
367
  this.checkServerStatus(response);
346
368
 
347
369
  // checkServerStatus throws on failure responses so the cast to the success response is acceptable here
348
- return response.data as TResponse;
370
+ return response.data as MobileServerSignedQuerySuccessResponse<T>;
349
371
  }
350
372
 
351
373
  protected async execute(
@@ -1,4 +1,6 @@
1
1
  import {
2
+ MobileFeedPage,
3
+ MobileFeedTrade,
2
4
  MobileIdentity,
3
5
  MobileNotificationPreferenceScope,
4
6
  MobileNotificationPreferences,
@@ -6,12 +8,14 @@ import {
6
8
  MobileRegisteredDevice,
7
9
  } from './types/clientTypes';
8
10
  import {
11
+ MobileServerFeedTrade,
9
12
  MobileServerIdentity,
10
13
  MobileServerNotificationPreferenceScope,
11
14
  MobileServerNotificationPreferences,
12
15
  MobileServerProfile,
13
16
  MobileServerRegisteredDevice,
14
17
  } from './types/serverModelTypes';
18
+ import { MobileServerFeedResponse } from './types/serverQueryTypes';
15
19
 
16
20
  /**
17
21
  * Maps a server-side identity (snake_case) to its client-side (camelCase) representation.
@@ -90,6 +94,42 @@ function mapMobileNotificationPreferenceScopeToServer(
90
94
  return { type: 'product', product_id: scope.productId };
91
95
  }
92
96
 
97
+ /**
98
+ * Maps a server-side feed trade (snake_case) to its client-side (camelCase) representation.
99
+ */
100
+ function mapMobileFeedTrade(server: MobileServerFeedTrade): MobileFeedTrade {
101
+ return {
102
+ orderDigest: server.order_digest,
103
+ subaccount: server.subaccount,
104
+ username: server.username,
105
+ displayName: server.display_name,
106
+ avatarUrl: server.avatar_url,
107
+ productId: server.product_id,
108
+ quantity: server.quantity,
109
+ notional: server.notional,
110
+ averagePrice: server.average_price,
111
+ margin: {
112
+ mode: server.margin.mode,
113
+ estimatedLeverage: server.margin.estimated_leverage,
114
+ },
115
+ position: server.position,
116
+ realizedPnl: server.realized_pnl,
117
+ filledAt: server.filled_at_ms,
118
+ };
119
+ }
120
+
121
+ /**
122
+ * Maps a server-side feed response to a client-side {@link MobileFeedPage}.
123
+ */
124
+ export function mapMobileFeedPage(
125
+ server: MobileServerFeedResponse,
126
+ ): MobileFeedPage {
127
+ return {
128
+ trades: server.trades.map(mapMobileFeedTrade),
129
+ nextCursor: server.next_cursor,
130
+ };
131
+ }
132
+
93
133
  /**
94
134
  * Maps a server-side registered device (snake_case) to its client-side (camelCase) representation.
95
135
  */
@@ -1,36 +1,24 @@
1
- import {
2
- MobileServerFailureResponse,
3
- MobileServerRequestType,
4
- } from './serverBaseTypes';
1
+ import { BaseServerFailureError } from '@nadohq/shared';
2
+ import { MobileServerFailureResponse } from './serverBaseTypes';
3
+ import { MobileServerRequestType } from './serverRequestTypes';
5
4
 
6
5
  /**
7
6
  * Error thrown when the mobile service API returns a failure envelope, either as a non-2xx HTTP response
8
7
  * or a 2xx response with `status: 'failure'`. The numeric error code is exposed directly on
9
- * {@link errorCode} for comparison against {@link MOBILE_ERROR_CODES}.
8
+ * {@link BaseServerFailureError.errorCode} for comparison against {@link MOBILE_ERROR_CODES}.
10
9
  */
11
- export class MobileServerFailureError extends Error {
10
+ export class MobileServerFailureError extends BaseServerFailureError {
11
+ declare readonly responseData: MobileServerFailureResponse;
12
+ declare readonly requestType: MobileServerRequestType;
13
+
12
14
  /**
13
15
  * HTTP status code of the response, e.g. `404` for `PROFILE_NOT_FOUND`. Unlike the engine, the mobile
14
16
  * backend maps domain failures onto HTTP statuses.
15
17
  */
16
18
  readonly httpStatus: number;
17
- /**
18
- * Numeric mobile service API error code, see {@link MOBILE_ERROR_CODES}.
19
- */
20
- readonly errorCode: number;
21
- /**
22
- * The request type that failed, e.g. `public_query_profile`, `execute_claim_username`.
23
- */
24
- readonly requestType: MobileServerRequestType;
25
19
 
26
- constructor(
27
- readonly responseData: MobileServerFailureResponse,
28
- httpStatus: number,
29
- ) {
30
- super(`${responseData.error_code}: ${responseData.error}`);
31
- this.name = 'MobileServerFailureError';
20
+ constructor(responseData: MobileServerFailureResponse, httpStatus: number) {
21
+ super(responseData, 'MobileServerFailureError');
32
22
  this.httpStatus = httpStatus;
33
- this.errorCode = responseData.error_code;
34
- this.requestType = responseData.request_type;
35
23
  }
36
24
  }