@nadohq/mobile-client 0.29.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 (188) 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-ZggEcEda.d.cts → MobileServerFailureError-B11rr9O5.d.cts} +3 -2
  11. package/dist/MobileServerFailureError-B11rr9O5.d.cts.map +1 -0
  12. package/dist/{MobileServerFailureError-f9KhKnJj.d.ts → MobileServerFailureError-DoIvXqYV.d.ts} +3 -2
  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 +1 -1
  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.map +1 -1
  101. package/dist/types/clientTypes.d.cts +2 -2
  102. package/dist/types/clientTypes.d.ts +2 -2
  103. package/dist/types/index.cjs +4 -0
  104. package/dist/types/index.d.cts +9 -8
  105. package/dist/types/index.d.ts +9 -8
  106. package/dist/types/index.js +2 -1
  107. package/dist/types/mobileErrorCodes.cjs +9 -5
  108. package/dist/types/mobileErrorCodes.cjs.map +1 -1
  109. package/dist/types/mobileErrorCodes.d.cts +1 -1
  110. package/dist/types/mobileErrorCodes.d.ts +1 -1
  111. package/dist/types/mobileErrorCodes.js +8 -4
  112. package/dist/types/mobileErrorCodes.js.map +1 -1
  113. package/dist/types/serverBaseTypes.d.cts +2 -2
  114. package/dist/types/serverBaseTypes.d.ts +2 -2
  115. package/dist/types/serverExecuteTypes.d.cts +1 -1
  116. package/dist/types/serverExecuteTypes.d.ts +1 -1
  117. package/dist/types/serverModelTypes.cjs +29 -0
  118. package/dist/types/serverModelTypes.cjs.map +1 -0
  119. package/dist/types/serverModelTypes.d.cts +2 -2
  120. package/dist/types/serverModelTypes.d.ts +2 -2
  121. package/dist/types/serverModelTypes.js +26 -1
  122. package/dist/types/serverModelTypes.js.map +1 -0
  123. package/dist/types/serverQueryTypes.d.cts +2 -2
  124. package/dist/types/serverQueryTypes.d.ts +2 -2
  125. package/dist/types/serverRequestTypes.cjs +0 -0
  126. package/dist/types/serverRequestTypes.d.cts +2 -0
  127. package/dist/types/serverRequestTypes.d.ts +2 -0
  128. package/dist/types/serverRequestTypes.js +1 -0
  129. package/dist/{types-uCD4BNZR.d.cts → types-CzOeSYnW.d.cts} +3 -3
  130. package/dist/{types-uCD4BNZR.d.cts.map → types-CzOeSYnW.d.cts.map} +1 -1
  131. package/dist/{types-B76Pn7Sy.d.ts → types-UHjZR-js.d.ts} +3 -3
  132. package/dist/{types-B76Pn7Sy.d.ts.map → types-UHjZR-js.d.ts.map} +1 -1
  133. package/dist/utils/feed.cjs +17 -0
  134. package/dist/utils/feed.cjs.map +1 -0
  135. package/dist/utils/feed.d.cts +2 -0
  136. package/dist/utils/feed.d.ts +2 -0
  137. package/dist/utils/feed.js +15 -0
  138. package/dist/utils/feed.js.map +1 -0
  139. package/dist/utils/index.cjs +3 -0
  140. package/dist/utils/index.d.cts +4 -3
  141. package/dist/utils/index.d.ts +4 -3
  142. package/dist/utils/index.js +2 -1
  143. package/dist/utils/patterns.d.cts +1 -1
  144. package/dist/utils/patterns.d.ts +1 -1
  145. package/dist/utils/serverResponseGuards.d.cts +1 -1
  146. package/dist/utils/serverResponseGuards.d.ts +1 -1
  147. package/package.json +3 -3
  148. package/src/MobileClient.ts +49 -27
  149. package/src/dataMappers.ts +40 -0
  150. package/src/types/MobileServerFailureError.ts +2 -4
  151. package/src/types/clientTypes.ts +70 -0
  152. package/src/types/index.ts +1 -0
  153. package/src/types/mobileErrorCodes.ts +7 -3
  154. package/src/types/serverBaseTypes.ts +7 -28
  155. package/src/types/serverModelTypes.ts +93 -0
  156. package/src/types/serverQueryTypes.ts +83 -39
  157. package/src/types/serverRequestTypes.ts +68 -0
  158. package/src/utils/feed.ts +11 -0
  159. package/src/utils/index.ts +1 -0
  160. package/dist/MobileClient-9JSAzblH.cjs.map +0 -1
  161. package/dist/MobileServerFailureError-ZggEcEda.d.cts.map +0 -1
  162. package/dist/MobileServerFailureError-f9KhKnJj.d.ts.map +0 -1
  163. package/dist/canonicalize-Dm7sXwPg.d.cts.map +0 -1
  164. package/dist/canonicalize-PX6dTIdF.d.ts.map +0 -1
  165. package/dist/clientTypes-DWW2N66c.d.ts.map +0 -1
  166. package/dist/clientTypes-Et0PUa2d.d.cts.map +0 -1
  167. package/dist/eip712MethodByType-DJgXal9r.d.ts.map +0 -1
  168. package/dist/eip712MethodByType-DLh9MRsD.d.cts.map +0 -1
  169. package/dist/mobileErrorCodes-BeyBKmwh.d.cts.map +0 -1
  170. package/dist/mobileErrorCodes-QG5XbEY6.d.ts.map +0 -1
  171. package/dist/patterns-B9J2ldpx.d.cts.map +0 -1
  172. package/dist/patterns-BbxH3_VA.d.ts.map +0 -1
  173. package/dist/payloadHash-Bmhzs78N.d.ts.map +0 -1
  174. package/dist/payloadHash-nj8WuLUP.d.cts.map +0 -1
  175. package/dist/serverBaseTypes-BicXMrZV.d.cts +0 -43
  176. package/dist/serverBaseTypes-BicXMrZV.d.cts.map +0 -1
  177. package/dist/serverBaseTypes-ewbo8l4R.d.ts +0 -43
  178. package/dist/serverBaseTypes-ewbo8l4R.d.ts.map +0 -1
  179. package/dist/serverExecuteTypes-CXnMjKnt.d.ts.map +0 -1
  180. package/dist/serverExecuteTypes-DKYK1V7C.d.cts.map +0 -1
  181. package/dist/serverModelTypes-CQgfqgW3.d.cts +0 -69
  182. package/dist/serverModelTypes-CQgfqgW3.d.cts.map +0 -1
  183. package/dist/serverModelTypes-vEPhHIit.d.ts +0 -69
  184. package/dist/serverModelTypes-vEPhHIit.d.ts.map +0 -1
  185. package/dist/serverQueryTypes-BI-2TD8F.d.ts +0 -53
  186. package/dist/serverQueryTypes-BI-2TD8F.d.ts.map +0 -1
  187. package/dist/serverQueryTypes-D7Yharse.d.cts +0 -53
  188. package/dist/serverQueryTypes-D7Yharse.d.cts.map +0 -1
@@ -1,35 +1,14 @@
1
- /**
2
- * Params for each unsigned `public_query`, keyed by request `type`.
3
- */
4
- export interface MobileServerPublicQueryParamsByType {
5
- username_availability: { display_name: string };
6
- profile: { username: string };
7
- }
8
-
9
- /**
10
- * Discriminant `type` values for unsigned `public_query` requests.
11
- */
12
- export type MobileServerPublicQueryType =
13
- keyof MobileServerPublicQueryParamsByType;
1
+ import { MobileServerRequestType } from './serverRequestTypes';
14
2
 
15
3
  /**
16
- * Wire `request_type` the backend echoes on failure envelopes, prefixed by route (`public_query_*`,
17
- * `query_*`, `execute_*`, e.g. `execute_claim_username`). Public-query types are enumerated; signed
18
- * query/execute names are kept as a `${prefix}_${string}` template to avoid duplicating the signed-type
19
- * tags declared in `signing.ts`.
4
+ * Base success envelope shared by every mobile service API route: just the `status` discriminant. Query
5
+ * routes intersect this with their payload (see {@link MobileServerPublicQuerySuccessResponse}), inlining the
6
+ * payload fields alongside `status` rather than nesting them under a `data` key like the engine does; execute
7
+ * routes return it as-is because they carry no payload.
20
8
  */
21
- export type MobileServerRequestType =
22
- | `public_query_${MobileServerPublicQueryType}`
23
- | `query_${string}`
24
- | `execute_${string}`;
25
-
26
- /**
27
- * Successful mobile service API envelope, discriminated on `status`. Payload fields are inlined alongside
28
- * `status` rather than nested under a `data` key, matching the mobile backend's wire format.
29
- */
30
- export type MobileServerSuccessResponse<TData extends object = object> = {
9
+ export interface MobileServerSuccessResponse {
31
10
  status: 'success';
32
- } & TData;
11
+ }
33
12
 
34
13
  /**
35
14
  * Failure envelope returned by any mobile service API route. A response missing this envelope shape
@@ -1,3 +1,4 @@
1
+ import { BalanceSide } from '@nadohq/shared';
1
2
  import { Hex } from 'viem';
2
3
 
3
4
  /**
@@ -35,6 +36,98 @@ export interface MobileServerIdentity {
35
36
  private_mode: boolean;
36
37
  }
37
38
 
39
+ /**
40
+ * Direction of the position a feed trade resulted in — for `closed`, the direction that was closed. This is
41
+ * NOT the execution buy/sell side, which the feed does not expose. Aliases {@link BalanceSide} so the feed's
42
+ * direction values stay in lockstep with the rest of the SDK.
43
+ */
44
+ export type MobileFeedTradePositionDirection = BalanceSide;
45
+
46
+ /**
47
+ * Every {@link MobileFeedTradePositionDirection} the feed can report, for callers that need the values at
48
+ * runtime (validation, filters, UI enumeration).
49
+ */
50
+ export const MOBILE_FEED_TRADE_POSITION_DIRECTIONS = [
51
+ 'long',
52
+ 'short',
53
+ ] as const satisfies readonly MobileFeedTradePositionDirection[];
54
+
55
+ /**
56
+ * Every {@link MobileFeedTradePositionEffect} the feed can report, for callers that need the values at
57
+ * runtime (validation, filters, UI enumeration).
58
+ */
59
+ export const MOBILE_FEED_TRADE_POSITION_EFFECTS = [
60
+ 'opened',
61
+ 'increased',
62
+ 'reduced',
63
+ 'closed',
64
+ 'flipped',
65
+ ] as const;
66
+
67
+ /**
68
+ * How a feed trade changed the trader's position in the product.
69
+ */
70
+ export type MobileFeedTradePositionEffect =
71
+ (typeof MOBILE_FEED_TRADE_POSITION_EFFECTS)[number];
72
+
73
+ /**
74
+ * Position change of a feed trade. Both keys are single words, so the wire and client shapes are identical
75
+ * and this type is shared by {@link MobileServerFeedTrade} and the client-side `MobileFeedTrade`.
76
+ */
77
+ export interface MobileFeedTradePosition {
78
+ direction: MobileFeedTradePositionDirection;
79
+ effect: MobileFeedTradePositionEffect;
80
+ }
81
+
82
+ /**
83
+ * Every {@link MobileFeedMarginMode} the feed can report, for callers that need the values at runtime
84
+ * (validation, filters, UI enumeration).
85
+ */
86
+ export const MOBILE_FEED_MARGIN_MODES = ['cross', 'isolated'] as const;
87
+
88
+ /**
89
+ * Margin mode a feed trade was executed under. Shared by the wire and client margin shapes.
90
+ */
91
+ export type MobileFeedMarginMode = (typeof MOBILE_FEED_MARGIN_MODES)[number];
92
+
93
+ /**
94
+ * Server-side margin of a feed trade. Branch on `mode` — do not infer isolated state from leverage presence:
95
+ * `estimated_leverage` (a rounded whole-number estimate, not exact submitted leverage) is omitted on `cross`,
96
+ * and also omitted inside `isolated` when no estimate is available.
97
+ */
98
+ export interface MobileServerFeedMargin {
99
+ mode: MobileFeedMarginMode;
100
+ estimated_leverage?: number;
101
+ }
102
+
103
+ /**
104
+ * Server-side feed trade shape (snake_case): one row per order digest, enriched at read time with the
105
+ * trader's current identity. Amounts are display-oriented human-unit JSON numbers — do not use them for
106
+ * accounting, order construction, or exact threshold decisions.
107
+ */
108
+ export interface MobileServerFeedTrade {
109
+ /** Order digest this row is keyed by; the stable id clients use to reconcile live pagination. */
110
+ order_digest: Hex;
111
+ subaccount: Hex;
112
+ username: string;
113
+ display_name: string;
114
+ /** Reserved for a future avatar source; `null` until one is implemented. */
115
+ avatar_url: string | null;
116
+ product_id: number;
117
+ /** Executed quantity in human units. */
118
+ quantity: number;
119
+ /** Trade notional in whole-dollar human units. */
120
+ notional: number;
121
+ /** Average execution price in human units. */
122
+ average_price: number;
123
+ margin: MobileServerFeedMargin;
124
+ position: MobileFeedTradePosition;
125
+ /** Realized PnL of the trade in human units; can be negative. */
126
+ realized_pnl: number;
127
+ /** Fill time as JavaScript-safe integer Unix milliseconds. */
128
+ filled_at_ms: number;
129
+ }
130
+
38
131
  /**
39
132
  * Server-side scope limiting a notification category preference. Scopes are rejected by the backend for the
40
133
  * MVP (`scopes` must be empty) but are part of the wire format.
@@ -1,74 +1,118 @@
1
+ import { MobileServerSuccessResponse } from './serverBaseTypes';
1
2
  import {
2
- MobileServerPublicQueryParamsByType,
3
- MobileServerPublicQueryType,
4
- MobileServerSuccessResponse,
5
- } from './serverBaseTypes';
6
- import {
3
+ MobileServerFeedTrade,
7
4
  MobileServerIdentity,
8
5
  MobileServerNotificationPreferences,
9
6
  MobileServerProfile,
10
7
  MobileServerRegisteredDevice,
11
8
  } from './serverModelTypes';
9
+ import {
10
+ MobileServerPublicQueryRequestByType,
11
+ MobileServerPublicQueryRequestType,
12
+ MobileServerSignedQueryRequestType,
13
+ } from './serverRequestTypes';
12
14
 
13
15
  /**
14
16
  * Unsigned `public_query` request body: a `type` discriminant flattened with its params.
15
17
  */
16
18
  export type MobileServerPublicQueryRequest<
17
- T extends MobileServerPublicQueryType = MobileServerPublicQueryType,
19
+ T extends MobileServerPublicQueryRequestType =
20
+ MobileServerPublicQueryRequestType,
18
21
  > = {
19
- [K in MobileServerPublicQueryType]: {
22
+ [K in MobileServerPublicQueryRequestType]: {
20
23
  type: K;
21
- } & MobileServerPublicQueryParamsByType[K];
24
+ } & MobileServerPublicQueryRequestByType[K];
22
25
  }[T];
23
26
 
24
27
  /**
25
- * Request body for the `username_availability` public query.
28
+ * Payload of the `username_availability` public query success response.
26
29
  */
27
- export type MobileServerUsernameAvailabilityRequest =
28
- MobileServerPublicQueryRequest<'username_availability'>;
30
+ export interface MobileServerUsernameAvailabilityResponse {
31
+ username: string;
32
+ available: boolean;
33
+ }
29
34
 
30
35
  /**
31
- * Request body for the `profile` public query.
36
+ * Payload of the `profile` public query success response.
32
37
  */
33
- export type MobileServerProfileRequest =
34
- MobileServerPublicQueryRequest<'profile'>;
38
+ export interface MobileServerProfileResponse {
39
+ profile: MobileServerProfile;
40
+ }
35
41
 
36
42
  /**
37
- * Successful response for the `username_availability` public query.
43
+ * Payload of the `feed` public query success response.
38
44
  */
39
- export type MobileServerUsernameAvailabilityResponse =
40
- MobileServerSuccessResponse<{
41
- username: string;
42
- available: boolean;
43
- }>;
45
+ export interface MobileServerFeedResponse {
46
+ trades: MobileServerFeedTrade[];
47
+ /**
48
+ * `null` when there was no additional candidate at query time; a page may contain fewer than `limit` trades
49
+ * (or none) with a non-null cursor because invalid enrichment rows are omitted and pagination is live
50
+ * rather than snapshot.
51
+ */
52
+ next_cursor: string | null;
53
+ }
44
54
 
45
55
  /**
46
- * Successful response for the `profile` public query.
56
+ * Payload of the signed `self_identity` query success response. A `null` identity means the subaccount has
57
+ * not claimed a username yet — this is normal data, not an error.
47
58
  */
48
- export type MobileServerProfileResponse = MobileServerSuccessResponse<{
49
- profile: MobileServerProfile;
50
- }>;
59
+ export interface MobileServerSelfIdentityResponse {
60
+ identity: MobileServerIdentity | null;
61
+ }
51
62
 
52
63
  /**
53
- * Successful response for the signed `self_identity` query. A `null` identity means the subaccount has not
54
- * claimed a username yet — this is normal data, not an error.
64
+ * Payload of the signed `notification_preferences` query success response.
55
65
  */
56
- export type MobileServerSelfIdentityResponse = MobileServerSuccessResponse<{
57
- identity: MobileServerIdentity | null;
58
- }>;
66
+ export interface MobileServerNotificationPreferencesResponse {
67
+ preferences: MobileServerNotificationPreferences;
68
+ }
69
+
70
+ /**
71
+ * Payload of the signed `registered_devices` query success response.
72
+ */
73
+ export interface MobileServerRegisteredDevicesResponse {
74
+ devices: MobileServerRegisteredDevice[];
75
+ }
76
+
77
+ /**
78
+ * Success payloads for each unsigned `public_query`, keyed by request `type`. Counterpart to
79
+ * {@link MobileServerPublicQueryRequestByType} so a query's request params and response share one lookup,
80
+ * matching engine's `EngineServerQueryResponseByType`. Holds the unwrapped payload; the envelope is applied
81
+ * by {@link MobileServerPublicQuerySuccessResponse}.
82
+ */
83
+ export interface MobileServerPublicQueryResponseByType {
84
+ username_availability: MobileServerUsernameAvailabilityResponse;
85
+ profile: MobileServerProfileResponse;
86
+ feed: MobileServerFeedResponse;
87
+ }
88
+
89
+ /**
90
+ * Success payloads for each signed `query`, keyed by request `type`. Counterpart to
91
+ * {@link MobileServerSignedQueryRequestByType} so a signed query's request params and response share one
92
+ * lookup, matching the public route. Holds the unwrapped payload; the envelope is applied by
93
+ * {@link MobileServerSignedQuerySuccessResponse}.
94
+ */
95
+ export interface MobileServerSignedQueryResponseByType {
96
+ self_identity: MobileServerSelfIdentityResponse;
97
+ notification_preferences: MobileServerNotificationPreferencesResponse;
98
+ registered_devices: MobileServerRegisteredDevicesResponse;
99
+ }
59
100
 
60
101
  /**
61
- * Successful response for the signed `notification_preferences` query.
102
+ * Full success response for an unsigned `public_query`: the {@link MobileServerSuccessResponse} envelope with
103
+ * the query's payload inlined alongside `status`. Derived from {@link MobileServerPublicQueryResponseByType},
104
+ * mirroring engine's `EngineServerQuerySuccessResponse` (inlined here instead of nested under `data`).
62
105
  */
63
- export type MobileServerNotificationPreferencesResponse =
64
- MobileServerSuccessResponse<{
65
- preferences: MobileServerNotificationPreferences;
66
- }>;
106
+ export type MobileServerPublicQuerySuccessResponse<
107
+ T extends MobileServerPublicQueryRequestType =
108
+ MobileServerPublicQueryRequestType,
109
+ > = MobileServerSuccessResponse & MobileServerPublicQueryResponseByType[T];
67
110
 
68
111
  /**
69
- * Successful response for the signed `registered_devices` query.
112
+ * Full success response for a signed `query`: the {@link MobileServerSuccessResponse} envelope with the
113
+ * query's payload inlined alongside `status`. Derived from {@link MobileServerSignedQueryResponseByType}.
70
114
  */
71
- export type MobileServerRegisteredDevicesResponse =
72
- MobileServerSuccessResponse<{
73
- devices: MobileServerRegisteredDevice[];
74
- }>;
115
+ export type MobileServerSignedQuerySuccessResponse<
116
+ T extends MobileServerSignedQueryRequestType =
117
+ MobileServerSignedQueryRequestType,
118
+ > = MobileServerSuccessResponse & MobileServerSignedQueryResponseByType[T];
@@ -0,0 +1,68 @@
1
+ import { MobileSignedInner } from '../signing/types';
2
+
3
+ /**
4
+ * Params for each unsigned `public_query`, keyed by request `type`.
5
+ */
6
+ export interface MobileServerPublicQueryRequestByType {
7
+ username_availability: { display_name: string };
8
+ profile: { username: string };
9
+ feed: {
10
+ /**
11
+ * Minimum notional as a whole-dollar JSON integer (NOT an x18 string), at least $1,000. Omitted or
12
+ * `null` means unfiltered.
13
+ */
14
+ minimum_notional?: number;
15
+ /** Page size, 1–50; the backend defaults to `MOBILE_FEED_MAX_PAGE_SIZE` (50) when omitted. */
16
+ limit?: number;
17
+ /**
18
+ * Opaque keyset cursor from a prior page's `next_cursor`. Bound to the exact `minimum_notional` it was
19
+ * issued for (including the unfiltered state) — reusing it with a different filter fails.
20
+ */
21
+ cursor?: string;
22
+ };
23
+ }
24
+
25
+ /**
26
+ * Discriminant `type` values for unsigned `public_query` requests.
27
+ */
28
+ export type MobileServerPublicQueryRequestType =
29
+ keyof MobileServerPublicQueryRequestByType;
30
+
31
+ /**
32
+ * Params for each signed `query`, keyed by request `type`. These queries identify the caller through the
33
+ * signed envelope (`sender`) and take no further params, so every entry is empty — the signed counterpart to
34
+ * {@link MobileServerPublicQueryRequestByType}, kept so both query routes expose one params lookup keyed by
35
+ * type (matching engine's `EngineServerQueryRequestByType`, which likewise uses `Record<string, never>` for
36
+ * param-less queries).
37
+ */
38
+ export interface MobileServerSignedQueryRequestByType {
39
+ self_identity: Record<string, never>;
40
+ notification_preferences: Record<string, never>;
41
+ registered_devices: Record<string, never>;
42
+ }
43
+
44
+ /**
45
+ * Discriminant `type` values for signed `query` requests: the read-only subset of {@link MobileSignedInner}
46
+ * tags, keyed the same way as {@link MobileServerPublicQueryRequestType}.
47
+ */
48
+ export type MobileServerSignedQueryRequestType =
49
+ keyof MobileServerSignedQueryRequestByType;
50
+
51
+ /**
52
+ * Discriminant `type` values for signed `execute` requests: the write subset of {@link MobileSignedInner}
53
+ * tags, derived as everything that is not a signed query so the two routes cannot overlap or drift.
54
+ */
55
+ export type MobileServerExecuteRequestType = Exclude<
56
+ MobileSignedInner['type'],
57
+ MobileServerSignedQueryRequestType
58
+ >;
59
+
60
+ /**
61
+ * Wire `request_type` the backend echoes on failure envelopes, prefixed by the route that produced it:
62
+ * `public_query_*` for unsigned queries, `query_*` for signed queries, and `execute_*` for signed writes
63
+ * (e.g. `execute_claim_username`).
64
+ */
65
+ export type MobileServerRequestType =
66
+ | `public_query_${MobileServerPublicQueryRequestType}`
67
+ | `query_${MobileServerSignedQueryRequestType}`
68
+ | `execute_${MobileServerExecuteRequestType}`;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Maximum feed page size the backend accepts; also the default when `limit` is omitted. Requests above this
3
+ * fail with `INVALID_FEED_FILTER`.
4
+ */
5
+ export const MOBILE_FEED_MAX_PAGE_SIZE = 50;
6
+
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
+ export const MOBILE_FEED_MIN_NOTIONAL_FLOOR = 1_000;
@@ -1,2 +1,3 @@
1
+ export * from './feed';
1
2
  export * from './patterns';
2
3
  export * from './serverResponseGuards';
@@ -1 +0,0 @@
1
- {"version":3,"file":"MobileClient-9JSAzblH.cjs","names":["mapMobilePublicProfile","mapMobileIdentity","mapMobileNotificationPreferences","mapMobileRegisteredDevice","mapMobileNotificationPreferencesToServer","WalletNotProvidedError","buildSignedMobileRequest","isMobileServerFailureResponse","MobileServerFailureError","isMobileServerSuccessResponse"],"sources":["../src/MobileClient.ts"],"sourcesContent":["import {\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n mapMobileIdentity,\n mapMobileNotificationPreferences,\n mapMobileNotificationPreferencesToServer,\n mapMobilePublicProfile,\n mapMobileRegisteredDevice,\n} from './dataMappers';\nimport {\n buildSignedMobileRequest,\n MobileSignedInner,\n MobileSignedInnerParams,\n MobileSignedRequest,\n} from './signing';\nimport {\n GetMobileNotificationPreferencesParams,\n GetMobilePublicProfileParams,\n GetMobileRegisteredDevicesParams,\n GetMobileSelfIdentityParams,\n GetMobileUsernameAvailabilityParams,\n MobileClaimUsernameParams,\n MobileIdentity,\n MobileNotificationPreferences,\n MobilePublicProfile,\n MobileRegisteredDevice,\n MobileRegisterExpoTokenParams,\n MobileSetPrivateModeParams,\n MobileSignedRequestParams,\n MobileUnregisterExpoTokenParams,\n MobileUpdateNotificationPreferencesParams,\n MobileUpdateUsernameParams,\n MobileUsernameAvailability,\n} from './types/clientTypes';\nimport { MobileServerFailureError } from './types/MobileServerFailureError';\nimport { MobileServerSuccessResponse } from './types/serverBaseTypes';\nimport { MobileServerExecuteResult } from './types/serverExecuteTypes';\nimport {\n MobileServerNotificationPreferencesResponse,\n MobileServerProfileRequest,\n MobileServerProfileResponse,\n MobileServerRegisteredDevicesResponse,\n MobileServerSelfIdentityResponse,\n MobileServerUsernameAvailabilityRequest,\n MobileServerUsernameAvailabilityResponse,\n} from './types/serverQueryTypes';\nimport {\n isMobileServerFailureResponse,\n isMobileServerSuccessResponse,\n} from './utils/serverResponseGuards';\n\n/**\n * Options for constructing a {@link MobileClient}.\n */\nexport interface MobileClientOpts {\n /**\n * Base URL of the mobile service API, e.g. {@link MOBILE_CLIENT_ENDPOINTS}.\n */\n url: string;\n /**\n * Wallet client used to sign requests.\n */\n walletClient?: WalletClientWithAccount;\n /**\n * If provided, this signer is used instead of `walletClient` for all signed requests.\n */\n linkedSignerWalletClient?: WalletClientWithAccount;\n}\n\n/**\n * Client for the Nado mobile service API: username claims, public profile lookups, privacy settings, and\n * push notification device/preference management.\n */\nexport class MobileClient {\n readonly opts: MobileClientOpts;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: MobileClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n });\n }\n\n /**\n * Sets the linked signer for requests\n *\n * @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer\n */\n public setLinkedSigner(\n linkedSignerWalletClient: WalletClientWithAccount | null,\n ) {\n this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? undefined;\n }\n\n /*\n Public queries\n */\n\n /**\n * Checks whether a username derived from the given display name is available to claim.\n */\n async getUsernameAvailability(\n params: GetMobileUsernameAvailabilityParams,\n ): Promise<MobileUsernameAvailability> {\n const body: MobileServerUsernameAvailabilityRequest = {\n type: 'username_availability',\n display_name: params.displayName,\n };\n const data =\n await this.publicQuery<MobileServerUsernameAvailabilityResponse>(body);\n return { username: data.username, available: data.available };\n }\n\n /**\n * Looks up a subaccount's public profile by username.\n *\n * @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if no identity has claimed the\n * username or it is invalid. Private Mode does not hide the profile itself, only the account's activity.\n */\n async getPublicProfile(\n params: GetMobilePublicProfileParams,\n ): Promise<MobilePublicProfile> {\n const body: MobileServerProfileRequest = {\n type: 'profile',\n username: params.username,\n };\n const data = await this.publicQuery<MobileServerProfileResponse>(body);\n return mapMobilePublicProfile(data.profile);\n }\n\n /*\n Signed queries\n */\n\n /**\n * Fetches the caller's own identity for a subaccount. Returns `null` if the subaccount has not claimed a\n * username yet — this is normal data, not an error.\n */\n async getSelfIdentity(\n params: GetMobileSelfIdentityParams,\n ): Promise<MobileIdentity | null> {\n const signedRequest = await this.getSignedRequest(\n 'self_identity',\n params,\n {},\n );\n const data =\n await this.query<MobileServerSelfIdentityResponse>(signedRequest);\n return data.identity ? mapMobileIdentity(data.identity) : null;\n }\n\n /**\n * Fetches a wallet's push notification preferences. Falls back to the backend's defaults if the wallet has\n * never updated its preferences.\n */\n async getNotificationPreferences(\n params: GetMobileNotificationPreferencesParams,\n ): Promise<MobileNotificationPreferences> {\n const signedRequest = await this.getSignedRequest(\n 'notification_preferences',\n params,\n {},\n );\n const data =\n await this.query<MobileServerNotificationPreferencesResponse>(\n signedRequest,\n );\n return mapMobileNotificationPreferences(data.preferences);\n }\n\n /**\n * Fetches the devices registered for push notifications for a wallet.\n */\n async getRegisteredDevices(\n params: GetMobileRegisteredDevicesParams,\n ): Promise<MobileRegisteredDevice[]> {\n const signedRequest = await this.getSignedRequest(\n 'registered_devices',\n params,\n {},\n );\n const data =\n await this.query<MobileServerRegisteredDevicesResponse>(signedRequest);\n return data.devices.map(mapMobileRegisteredDevice);\n }\n\n /*\n Signed executes\n */\n\n /**\n * Claims a username for a subaccount, derived from the given display name.\n */\n async claimUsername(\n params: MobileClaimUsernameParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'claim_username',\n params,\n {\n display_name: params.displayName,\n },\n );\n return this.execute(signedRequest);\n }\n\n /**\n * Updates the display name for a subaccount's already-claimed identity.\n */\n async updateUsername(\n params: MobileUpdateUsernameParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'update_username',\n params,\n { display_name: params.displayName },\n );\n return this.execute(signedRequest);\n }\n\n /**\n * Sets whether a subaccount's profile is private.\n */\n async setPrivateMode(\n params: MobileSetPrivateModeParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'set_private_mode',\n params,\n { private_mode: params.privateMode },\n );\n return this.execute(signedRequest);\n }\n\n /**\n * Registers an Expo push token for the wallet, transferring active ownership of the token if another\n * wallet had registered it. Idempotent per `(wallet, token)`.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is not a valid Expo\n * push token, or `INVALID_DEVICE_METADATA` if `locale` (max 35 chars) or `appVersion` (max 64 chars) is\n * too long.\n */\n async registerExpoToken(\n params: MobileRegisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'register_expo_token',\n params,\n {\n expo_token: params.expoToken,\n platform: params.platform,\n locale: params.locale ?? null,\n app_version: params.appVersion ?? null,\n },\n );\n return this.execute(signedRequest);\n }\n\n /**\n * Unregisters an Expo push token for the wallet. Idempotent — unregistering an unknown token succeeds.\n */\n async unregisterExpoToken(\n params: MobileUnregisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'unregister_expo_token',\n params,\n { expo_token: params.expoToken },\n );\n return this.execute(signedRequest);\n }\n\n /**\n * Replaces the wallet's push notification preferences. The backend requires `schemaVersion` of 1, exactly\n * one entry per known category, and empty `scopes` on every entry.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated.\n */\n async updateNotificationPreferences(\n params: MobileUpdateNotificationPreferencesParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'update_preferences',\n params,\n {\n preferences: mapMobileNotificationPreferencesToServer(\n params.preferences,\n ),\n },\n );\n return this.execute(signedRequest);\n }\n\n /*\n Base Fns\n */\n\n protected async getSignedRequest<T extends MobileSignedInner['type']>(\n type: T,\n params: MobileSignedRequestParams,\n innerParams: MobileSignedInnerParams<T>,\n ): Promise<MobileSignedRequest> {\n // Use the linked signer if provided, otherwise use the default signer provided to the client\n const walletClient =\n this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\n\n if (walletClient == null) {\n throw new WalletNotProvidedError();\n }\n\n const inner = { type, ...innerParams } as MobileSignedInner;\n return buildSignedMobileRequest({ ...params, walletClient, inner });\n }\n\n protected async publicQuery<TResponse extends { status: 'success' }>(\n body: object,\n ): Promise<TResponse> {\n const response = await this.axiosInstance.post<unknown>(\n `${this.opts.url}/mobile/public_query`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n return response.data as TResponse;\n }\n\n protected async query<TResponse extends { status: 'success' }>(\n body: MobileSignedRequest,\n ): Promise<TResponse> {\n const response = await this.axiosInstance.post<unknown>(\n `${this.opts.url}/mobile/query`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n return response.data as TResponse;\n }\n\n protected async execute(\n body: MobileSignedRequest,\n ): Promise<MobileServerSuccessResponse> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/mobile/execute`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as MobileServerSuccessResponse;\n }\n\n /**\n * Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns\n * failure envelopes with non-2xx statuses (e.g. 404 for `PROFILE_NOT_FOUND`), so a non-2xx response with a\n * failure envelope still throws the typed error; anything else is a transport-level error.\n */\n private checkResponseStatus(response: AxiosResponse<unknown>) {\n if (response.status >= 200 && response.status < 300) {\n return;\n }\n if (isMobileServerFailureResponse(response.data)) {\n throw new MobileServerFailureError(response.data, response.status);\n }\n throw new Error(\n `Unexpected response from mobile service: ${response.status} ${response.statusText}. Data: ${JSON.stringify(response.data)}`,\n );\n }\n\n private checkServerStatus(response: AxiosResponse<unknown>) {\n const { data } = response;\n\n if (isMobileServerFailureResponse(data)) {\n throw new MobileServerFailureError(data, response.status);\n }\n if (!isMobileServerSuccessResponse(data)) {\n throw new Error(\n `Unexpected response from mobile service: missing success envelope. Data: ${JSON.stringify(data)}`,\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,IAAa,eAAb,MAA0B;CAIxB,YAAY,MAAwB;EAClC,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAA,QAAM,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;EACxB,CAAC;CACH;;;;;;CAOA,gBACE,0BACA;EACA,KAAK,KAAK,2BAA2B,4BAA4B,KAAA;CACnE;;;;CASA,MAAM,wBACJ,QACqC;EACrC,MAAM,OAAgD;GACpD,MAAM;GACN,cAAc,OAAO;EACvB;EACA,MAAM,OACJ,MAAM,KAAK,YAAsD,IAAI;EACvE,OAAO;GAAE,UAAU,KAAK;GAAU,WAAW,KAAK;EAAU;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/B,OAAO,SAAS;CAClB;;;;;;CAOA,oBAA4B,UAAkC;EAC5D,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS,KAC9C;EAEF,IAAIC,mCAAAA,8BAA8B,SAAS,IAAI,GAC7C,MAAM,IAAIC,uCAAAA,yBAAyB,SAAS,MAAM,SAAS,MAAM;EAEnE,MAAM,IAAI,MACR,4CAA4C,SAAS,OAAO,GAAG,SAAS,WAAW,UAAU,KAAK,UAAU,SAAS,IAAI,GAC3H;CACF;CAEA,kBAA0B,UAAkC;EAC1D,MAAM,EAAE,SAAS;EAEjB,IAAID,mCAAAA,8BAA8B,IAAI,GACpC,MAAM,IAAIC,uCAAAA,yBAAyB,MAAM,SAAS,MAAM;EAE1D,IAAI,CAACC,mCAAAA,8BAA8B,IAAI,GACrC,MAAM,IAAI,MACR,4EAA4E,KAAK,UAAU,IAAI,GACjG;CAEJ;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MobileServerFailureError-ZggEcEda.d.cts","names":[],"sources":["../src/types/src/types/MobileServerFailureError.ts"],"mappings":";;;;;;AAWA;;;cAAa,wBAAA,SAAiC,sBAAA;EAAA,SAC3B,YAAA,EAAc,2BAAA;EAAA,SACd,WAAA,EAAa,uBAAA;EAFc;;;;EAAA,SAQnC,UAAA;cAEG,YAAA,EAAc,2BAAA,EAA6B,UAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MobileServerFailureError-f9KhKnJj.d.ts","names":[],"sources":["../src/types/src/types/MobileServerFailureError.ts"],"mappings":";;;;;;AAWA;;;cAAa,wBAAA,SAAiC,sBAAA;EAAA,SAC3B,YAAA,EAAc,2BAAA;EAAA,SACd,WAAA,EAAa,uBAAA;EAFc;;;;EAAA,SAQnC,UAAA;cAEG,YAAA,EAAc,2BAAA,EAA6B,UAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"canonicalize-Dm7sXwPg.d.cts","names":[],"sources":["../src/signing/src/signing/canonicalize.ts"],"mappings":";;;;;AAUA;;;;;iBAAgB,uBAAA,CACd,KAAA,EAAO,iBAAA,GACN,iBAAiB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"canonicalize-PX6dTIdF.d.ts","names":[],"sources":["../src/signing/src/signing/canonicalize.ts"],"mappings":";;;;;AAUA;;;;;iBAAgB,uBAAA,CACd,KAAA,EAAO,iBAAA,GACN,iBAAiB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"clientTypes-DWW2N66c.d.ts","names":[],"sources":["../src/types/src/types/clientTypes.ts"],"mappings":";;;;;;;AAeA;;;;;;UAAiB,cAAA;EACf,UAAA,EAAY,GAAG;EAUf;;AAAW;AAMb;EAXE,QAAA;;;;EAIA,WAAA;EACA,WAAA;AAAA;;AASW;AAMb;UATiB,mBAAA;EACf,UAAA,EAAY,GAAG;EACf,QAAA;EACA,WAAA;AAAA;;;;UAMe,0BAAA;EACf,QAAA;EACA,SAAS;AAAA;;;AASqB;AAKhC;KAPY,iCAAA;EACN,IAAA;EAAoB,UAAA,EAAY,GAAG;AAAA;EACnC,IAAA;EAAiB,SAAA;AAAA;;;AAQoB;UAH1B,oCAAA;EACf,QAAA,EAAU,0BAAA;EACV,OAAA;EACA,MAAA,EAAQ,iCAAiC;AAAA;;;;AAUO;UAHjC,6BAAA;EASsB;EAPrC,aAAA;EACA,UAAA,EAAY,oCAAoC;AAAA;;;;UAMjC,sBAAA;EAef;EAbA,QAAA,EAAU,0BAA0B;EAa1B;EAXV,MAAA;EAkBA;EAhBA,UAAA;EAgBQ;AAA2B;AAKrC;;EAhBE,sBAAA;EAiBW;AAAA;AAMb;EAnBE,UAAA;AAAA;;AAoBQ;AAMV;UApBiB,yBAAA,SACP,UAAA,EAAY,eAAe;;AAmB8B;AAKnE;UAnBiB,mCAAA;EACf,WAAW;AAAA;AAmBA;AAMb;;AANa,UAbI,4BAAA;EACf,QAAQ;AAAA;AAyBV;;;AAAA,KAnBY,2BAAA,GAA8B,yBAAyB;AAoBtD;AAMb;;AANa,U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AAKrC;;EAhBE,sBAAA;EAiBW;AAAA;AAMb;EAnBE,UAAA;AAAA;;AAoBQ;AAMV;UApBiB,yBAAA,SACP,UAAA,EAAY,eAAe;;AAmB8B;AAKnE;UAnBiB,mCAAA;EACf,WAAW;AAAA;AAmBA;AAMb;;AANa,UAbI,4BAAA;EACf,QAAQ;AAAA;AAyBV;;;AAAA,KAnBY,2BAAA,GAA8B,yBAAyB;AAoBtD;AAMb;;AANa,UAfI,yBAAA,SAAkC,yBAAyB;EAC1E,WAAW;AAAA;;;;UAMI,0BAAA,SAAmC,yBAAyB;EAC3E,WAAW;AAAA;AA0BD;AAMZ;;AANY,UApBK,0BAAA,SAAmC,yBAAyB;EAC3E,WAAW;AAAA;AAgCb;;;AAAA,UA1BiB,6BAAA,SAAsC,yBAAyB;EA0Bb;;;EAtBjE,SAAA;EACA,QAAA,EAAU,0BAAA;EA4BA;;;EAxBV,MAAA;EAwB4E;AAK9E;;EAzBE,UAAA;AAAA;AAyBsE;;;AAAA,UAnBvD,+BAAA,SAAwC,yBAAyB;EAChF,SAAS;AAAA;;;;UAMM,yCAAA,SAAkD,yBAAyB;EAC1F,WAAA,EAAa,6BAAA;AAAA;;;;KAMH,sCAAA,GAAyC,yBAAyB;;;;KAKlE,gCAAA,GAAmC,yBAAyB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"eip712MethodByType-DJgXal9r.d.ts","names":[],"sources":["../src/signing/src/signing/eip712MethodByType.ts"],"mappings":";;;;;AAKA;cAAa,4BAAA,EAA8B,MAAM,CAC/C,iBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"eip712MethodByType-DLh9MRsD.d.cts","names":[],"sources":["../src/signing/src/signing/eip712MethodByType.ts"],"mappings":";;;;;AAKA;cAAa,4BAAA,EAA8B,MAAM,CAC/C,iBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mobileErrorCodes-BeyBKmwh.d.cts","names":[],"sources":["../src/types/src/types/mobileErrorCodes.ts"],"mappings":";;AAOA;;;;cAAa,kBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAiBb;;;AAAA,KAAY,eAAA,WACF,kBAAA,eAAiC,kBAAkB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mobileErrorCodes-QG5XbEY6.d.ts","names":[],"sources":["../src/types/src/types/mobileErrorCodes.ts"],"mappings":";;AAOA;;;;cAAa,kBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAiBb;;;AAAA,KAAY,eAAA,WACF,kBAAA,eAAiC,kBAAkB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"patterns-B9J2ldpx.d.cts","names":[],"sources":["../src/utils/src/utils/patterns.ts"],"mappings":";;AAGA;;cAAa,2BAAA,EAA2B,MAA0B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"patterns-BbxH3_VA.d.ts","names":[],"sources":["../src/utils/src/utils/patterns.ts"],"mappings":";;AAGA;;cAAa,2BAAA,EAA2B,MAA0B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"payloadHash-Bmhzs78N.d.ts","names":[],"sources":["../src/signing/src/signing/payloadHash.ts"],"mappings":";;;;;;AASA;;;iBAAgB,oBAAA,CAAqB,KAAA,EAAO,iBAAA,GAAoB,GAAG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"payloadHash-nj8WuLUP.d.cts","names":[],"sources":["../src/signing/src/signing/payloadHash.ts"],"mappings":";;;;;;AASA;;;iBAAgB,oBAAA,CAAqB,KAAA,EAAO,iBAAA,GAAoB,GAAG"}
@@ -1,43 +0,0 @@
1
- //#region src/types/serverBaseTypes.d.ts
2
- /**
3
- * Params for each unsigned `public_query`, keyed by request `type`.
4
- */
5
- interface MobileServerPublicQueryParamsByType {
6
- username_availability: {
7
- display_name: string;
8
- };
9
- profile: {
10
- username: string;
11
- };
12
- }
13
- /**
14
- * Discriminant `type` values for unsigned `public_query` requests.
15
- */
16
- type MobileServerPublicQueryType = keyof MobileServerPublicQueryParamsByType;
17
- /**
18
- * Wire `request_type` the backend echoes on failure envelopes, prefixed by route (`public_query_*`,
19
- * `query_*`, `execute_*`, e.g. `execute_claim_username`). Public-query types are enumerated; signed
20
- * query/execute names are kept as a `${prefix}_${string}` template to avoid duplicating the signed-type
21
- * tags declared in `signing.ts`.
22
- */
23
- type MobileServerRequestType = `public_query_${MobileServerPublicQueryType}` | `query_${string}` | `execute_${string}`;
24
- /**
25
- * Successful mobile service API envelope, discriminated on `status`. Payload fields are inlined alongside
26
- * `status` rather than nested under a `data` key, matching the mobile backend's wire format.
27
- */
28
- type MobileServerSuccessResponse<TData extends object = object> = {
29
- status: 'success';
30
- } & TData;
31
- /**
32
- * Failure envelope returned by any mobile service API route. A response missing this envelope shape
33
- * (e.g. a malformed body, or a non-JSON response) is a transport-level error, not a domain error.
34
- */
35
- interface MobileServerFailureResponse {
36
- status: 'failure';
37
- error: string;
38
- error_code: number;
39
- request_type: MobileServerRequestType;
40
- }
41
- //#endregion
42
- export { MobileServerSuccessResponse as a, MobileServerRequestType as i, MobileServerPublicQueryParamsByType as n, MobileServerPublicQueryType as r, MobileServerFailureResponse as t };
43
- //# sourceMappingURL=serverBaseTypes-BicXMrZV.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serverBaseTypes-BicXMrZV.d.cts","names":[],"sources":["../src/types/src/types/serverBaseTypes.ts"],"mappings":";;AAGA;;UAAiB,mCAAA;EACf,qBAAA;IAAyB,YAAA;EAAA;EACzB,OAAA;IAAW,QAAA;EAAA;AAAA;AAMb;;;AAAA,KAAY,2BAAA,SACJ,mCAAmC;AAAA;AAQ3C;;;;AAC+C;AATJ,KAQ/B,uBAAA,mBACQ,2BAA2B;;;;;KAQnC,2BAAA;EACV,MAAA;AAAA,IACE,KAAK;AAAA;AAMT;;;AANS,UAMQ,2BAAA;EACf,MAAA;EACA,KAAA;EACA,UAAA;EACA,YAAA,EAAc,uBAAuB;AAAA"}
@@ -1,43 +0,0 @@
1
- //#region src/types/serverBaseTypes.d.ts
2
- /**
3
- * Params for each unsigned `public_query`, keyed by request `type`.
4
- */
5
- interface MobileServerPublicQueryParamsByType {
6
- username_availability: {
7
- display_name: string;
8
- };
9
- profile: {
10
- username: string;
11
- };
12
- }
13
- /**
14
- * Discriminant `type` values for unsigned `public_query` requests.
15
- */
16
- type MobileServerPublicQueryType = keyof MobileServerPublicQueryParamsByType;
17
- /**
18
- * Wire `request_type` the backend echoes on failure envelopes, prefixed by route (`public_query_*`,
19
- * `query_*`, `execute_*`, e.g. `execute_claim_username`). Public-query types are enumerated; signed
20
- * query/execute names are kept as a `${prefix}_${string}` template to avoid duplicating the signed-type
21
- * tags declared in `signing.ts`.
22
- */
23
- type MobileServerRequestType = `public_query_${MobileServerPublicQueryType}` | `query_${string}` | `execute_${string}`;
24
- /**
25
- * Successful mobile service API envelope, discriminated on `status`. Payload fields are inlined alongside
26
- * `status` rather than nested under a `data` key, matching the mobile backend's wire format.
27
- */
28
- type MobileServerSuccessResponse<TData extends object = object> = {
29
- status: 'success';
30
- } & TData;
31
- /**
32
- * Failure envelope returned by any mobile service API route. A response missing this envelope shape
33
- * (e.g. a malformed body, or a non-JSON response) is a transport-level error, not a domain error.
34
- */
35
- interface MobileServerFailureResponse {
36
- status: 'failure';
37
- error: string;
38
- error_code: number;
39
- request_type: MobileServerRequestType;
40
- }
41
- //#endregion
42
- export { MobileServerSuccessResponse as a, MobileServerRequestType as i, MobileServerPublicQueryParamsByType as n, MobileServerPublicQueryType as r, MobileServerFailureResponse as t };
43
- //# sourceMappingURL=serverBaseTypes-ewbo8l4R.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serverBaseTypes-ewbo8l4R.d.ts","names":[],"sources":["../src/types/src/types/serverBaseTypes.ts"],"mappings":";;AAGA;;UAAiB,mCAAA;EACf,qBAAA;IAAyB,YAAA;EAAA;EACzB,OAAA;IAAW,QAAA;EAAA;AAAA;AAMb;;;AAAA,KAAY,2BAAA,SACJ,mCAAmC;AAAA;AAQ3C;;;;AAC+C;AATJ,KAQ/B,uBAAA,mBACQ,2BAA2B;;;;;KAQnC,2BAAA;EACV,MAAA;AAAA,IACE,KAAK;AAAA;AAMT;;;AANS,UAMQ,2BAAA;EACf,MAAA;EACA,KAAA;EACA,UAAA;EACA,YAAA,EAAc,uBAAuB;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"serverExecuteTypes-CXnMjKnt.d.ts","names":[],"sources":["../src/types/src/types/serverExecuteTypes.ts"],"mappings":";;;;;AASA;;KAAY,yBAAA,GACR,2BAAA,GACA,2BAA2B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"serverExecuteTypes-DKYK1V7C.d.cts","names":[],"sources":["../src/types/src/types/serverExecuteTypes.ts"],"mappings":";;;;;AASA;;KAAY,yBAAA,GACR,2BAAA,GACA,2BAA2B"}