@nadohq/mobile-client 0.29.0 → 0.31.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 (208) hide show
  1. package/README.md +15 -8
  2. package/dist/{MobileClient-9JSAzblH.cjs → MobileClient-_i0ZV6Dq.cjs} +104 -44
  3. package/dist/MobileClient-_i0ZV6Dq.cjs.map +1 -0
  4. package/dist/MobileClient.cjs +1 -1
  5. package/dist/MobileClient.d.cts +77 -36
  6. package/dist/MobileClient.d.cts.map +1 -1
  7. package/dist/MobileClient.d.ts +77 -36
  8. package/dist/MobileClient.d.ts.map +1 -1
  9. package/dist/MobileClient.js +105 -45
  10. package/dist/MobileClient.js.map +1 -1
  11. package/dist/{MobileServerFailureError-ZggEcEda.d.cts → MobileServerFailureError-BoyAfEZA.d.cts} +3 -2
  12. package/dist/MobileServerFailureError-BoyAfEZA.d.cts.map +1 -0
  13. package/dist/{MobileServerFailureError-f9KhKnJj.d.ts → MobileServerFailureError-MgYVBh5p.d.ts} +3 -2
  14. package/dist/MobileServerFailureError-MgYVBh5p.d.ts.map +1 -0
  15. package/dist/{buildSignedMobileRequest-BsbBkU0K.d.cts → buildSignedMobileRequest-CBMt97aY.d.cts} +2 -2
  16. package/dist/{buildSignedMobileRequest-BsbBkU0K.d.cts.map → buildSignedMobileRequest-CBMt97aY.d.cts.map} +1 -1
  17. package/dist/{buildSignedMobileRequest-CDRsRNHm.d.ts → buildSignedMobileRequest-qEC4gWaI.d.ts} +2 -2
  18. package/dist/{buildSignedMobileRequest-CDRsRNHm.d.ts.map → buildSignedMobileRequest-qEC4gWaI.d.ts.map} +1 -1
  19. package/dist/{canonicalize-PX6dTIdF.d.ts → canonicalize-QNARV_Xc.d.cts} +4 -4
  20. package/dist/canonicalize-QNARV_Xc.d.cts.map +1 -0
  21. package/dist/{canonicalize-Dm7sXwPg.d.cts → canonicalize-wVdGejB1.d.ts} +4 -4
  22. package/dist/canonicalize-wVdGejB1.d.ts.map +1 -0
  23. package/dist/clientTypes-6utzUU-b.d.ts +240 -0
  24. package/dist/clientTypes-6utzUU-b.d.ts.map +1 -0
  25. package/dist/clientTypes-D9qgtNlE.d.cts +240 -0
  26. package/dist/clientTypes-D9qgtNlE.d.cts.map +1 -0
  27. package/dist/dataMappers.cjs +35 -1
  28. package/dist/dataMappers.cjs.map +1 -1
  29. package/dist/dataMappers.d.cts +8 -3
  30. package/dist/dataMappers.d.cts.map +1 -1
  31. package/dist/dataMappers.d.ts +8 -3
  32. package/dist/dataMappers.d.ts.map +1 -1
  33. package/dist/dataMappers.js +35 -2
  34. package/dist/dataMappers.js.map +1 -1
  35. package/dist/{eip712MethodByType-DLh9MRsD.d.cts → eip712MethodByType-CroIPqsJ.d.cts} +2 -2
  36. package/dist/eip712MethodByType-CroIPqsJ.d.cts.map +1 -0
  37. package/dist/{eip712MethodByType-DJgXal9r.d.ts → eip712MethodByType-DBUy4AdI.d.ts} +2 -2
  38. package/dist/eip712MethodByType-DBUy4AdI.d.ts.map +1 -0
  39. package/dist/feed-BF5k6Ryu.d.ts +14 -0
  40. package/dist/feed-BF5k6Ryu.d.ts.map +1 -0
  41. package/dist/feed-CBIwOhTO.d.cts +14 -0
  42. package/dist/feed-CBIwOhTO.d.cts.map +1 -0
  43. package/dist/index.cjs +8 -1
  44. package/dist/index.d.cts +17 -15
  45. package/dist/index.d.ts +17 -15
  46. package/dist/index.js +3 -1
  47. package/dist/{mobileErrorCodes-BeyBKmwh.d.cts → mobileErrorCodes-CuQ5lyBV.d.ts} +8 -8
  48. package/dist/mobileErrorCodes-CuQ5lyBV.d.ts.map +1 -0
  49. package/dist/{mobileErrorCodes-QG5XbEY6.d.ts → mobileErrorCodes-D_SyBm0k.d.cts} +8 -8
  50. package/dist/mobileErrorCodes-D_SyBm0k.d.cts.map +1 -0
  51. package/dist/{patterns-BbxH3_VA.d.ts → patterns-B5gi7OfV.d.ts} +1 -1
  52. package/dist/patterns-B5gi7OfV.d.ts.map +1 -0
  53. package/dist/{patterns-B9J2ldpx.d.cts → patterns-Db6fgz8i.d.cts} +1 -1
  54. package/dist/patterns-Db6fgz8i.d.cts.map +1 -0
  55. package/dist/{payloadHash-nj8WuLUP.d.cts → payloadHash-B0tlFOK8.d.cts} +2 -2
  56. package/dist/payloadHash-B0tlFOK8.d.cts.map +1 -0
  57. package/dist/{payloadHash-Bmhzs78N.d.ts → payloadHash-D1yTQSF4.d.ts} +2 -2
  58. package/dist/payloadHash-D1yTQSF4.d.ts.map +1 -0
  59. package/dist/serverBaseTypes-CzRgwUvA.d.ts +25 -0
  60. package/dist/serverBaseTypes-CzRgwUvA.d.ts.map +1 -0
  61. package/dist/serverBaseTypes-DSRgU2Fb.d.cts +25 -0
  62. package/dist/serverBaseTypes-DSRgU2Fb.d.cts.map +1 -0
  63. package/dist/serverExecuteTypes-BCb6bUMP.d.cts +19 -0
  64. package/dist/serverExecuteTypes-BCb6bUMP.d.cts.map +1 -0
  65. package/dist/serverExecuteTypes-CI3NBW2Z.d.ts +19 -0
  66. package/dist/serverExecuteTypes-CI3NBW2Z.d.ts.map +1 -0
  67. package/dist/serverModelTypes-BYQcsRrx.d.cts +146 -0
  68. package/dist/serverModelTypes-BYQcsRrx.d.cts.map +1 -0
  69. package/dist/serverModelTypes-DvPs5qs3.d.ts +146 -0
  70. package/dist/serverModelTypes-DvPs5qs3.d.ts.map +1 -0
  71. package/dist/serverQueryTypes-9H6P1vJ5.d.cts +92 -0
  72. package/dist/serverQueryTypes-9H6P1vJ5.d.cts.map +1 -0
  73. package/dist/serverQueryTypes-Cbjx0bIj.d.ts +92 -0
  74. package/dist/serverQueryTypes-Cbjx0bIj.d.ts.map +1 -0
  75. package/dist/serverRequestTypes-CHDk6JwE.d.cts +85 -0
  76. package/dist/serverRequestTypes-CHDk6JwE.d.cts.map +1 -0
  77. package/dist/serverRequestTypes-DYTLrCpz.d.ts +85 -0
  78. package/dist/serverRequestTypes-DYTLrCpz.d.ts.map +1 -0
  79. package/dist/{serverResponseGuards-DjCNL3CR.d.cts → serverResponseGuards-DRMHmfXh.d.cts} +2 -2
  80. package/dist/{serverResponseGuards-DjCNL3CR.d.cts.map → serverResponseGuards-DRMHmfXh.d.cts.map} +1 -1
  81. package/dist/{serverResponseGuards-C_vZIgGl.d.ts → serverResponseGuards-DpbZvJfL.d.ts} +2 -2
  82. package/dist/{serverResponseGuards-C_vZIgGl.d.ts.map → serverResponseGuards-DpbZvJfL.d.ts.map} +1 -1
  83. package/dist/signing/buildSignedMobileRequest.cjs +1 -1
  84. package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
  85. package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
  86. package/dist/signing/canonicalize.cjs +4 -37
  87. package/dist/signing/canonicalize.cjs.map +1 -1
  88. package/dist/signing/canonicalize.d.cts +1 -1
  89. package/dist/signing/canonicalize.d.ts +1 -1
  90. package/dist/signing/canonicalize.js +4 -37
  91. package/dist/signing/canonicalize.js.map +1 -1
  92. package/dist/signing/eip712MethodByType.cjs +1 -5
  93. package/dist/signing/eip712MethodByType.cjs.map +1 -1
  94. package/dist/signing/eip712MethodByType.d.cts +1 -1
  95. package/dist/signing/eip712MethodByType.d.ts +1 -1
  96. package/dist/signing/eip712MethodByType.js +1 -5
  97. package/dist/signing/eip712MethodByType.js.map +1 -1
  98. package/dist/signing/index.d.cts +5 -5
  99. package/dist/signing/index.d.ts +5 -5
  100. package/dist/signing/payloadHash.cjs +1 -1
  101. package/dist/signing/payloadHash.d.cts +1 -1
  102. package/dist/signing/payloadHash.d.ts +1 -1
  103. package/dist/signing/types.d.cts +1 -1
  104. package/dist/signing/types.d.ts +1 -1
  105. package/dist/types/MobileServerFailureError.cjs +1 -1
  106. package/dist/types/MobileServerFailureError.cjs.map +1 -1
  107. package/dist/types/MobileServerFailureError.d.cts +1 -1
  108. package/dist/types/MobileServerFailureError.d.ts +1 -1
  109. package/dist/types/MobileServerFailureError.js.map +1 -1
  110. package/dist/types/clientTypes.d.cts +2 -2
  111. package/dist/types/clientTypes.d.ts +2 -2
  112. package/dist/types/index.cjs +4 -0
  113. package/dist/types/index.d.cts +9 -8
  114. package/dist/types/index.d.ts +9 -8
  115. package/dist/types/index.js +2 -1
  116. package/dist/types/mobileErrorCodes.cjs +10 -7
  117. package/dist/types/mobileErrorCodes.cjs.map +1 -1
  118. package/dist/types/mobileErrorCodes.d.cts +1 -1
  119. package/dist/types/mobileErrorCodes.d.ts +1 -1
  120. package/dist/types/mobileErrorCodes.js +9 -6
  121. package/dist/types/mobileErrorCodes.js.map +1 -1
  122. package/dist/types/serverBaseTypes.d.cts +2 -2
  123. package/dist/types/serverBaseTypes.d.ts +2 -2
  124. package/dist/types/serverExecuteTypes.d.cts +2 -2
  125. package/dist/types/serverExecuteTypes.d.ts +2 -2
  126. package/dist/types/serverModelTypes.cjs +29 -0
  127. package/dist/types/serverModelTypes.cjs.map +1 -0
  128. package/dist/types/serverModelTypes.d.cts +2 -2
  129. package/dist/types/serverModelTypes.d.ts +2 -2
  130. package/dist/types/serverModelTypes.js +26 -1
  131. package/dist/types/serverModelTypes.js.map +1 -0
  132. package/dist/types/serverQueryTypes.d.cts +2 -2
  133. package/dist/types/serverQueryTypes.d.ts +2 -2
  134. package/dist/types/serverRequestTypes.cjs +0 -0
  135. package/dist/types/serverRequestTypes.d.cts +2 -0
  136. package/dist/types/serverRequestTypes.d.ts +2 -0
  137. package/dist/types/serverRequestTypes.js +1 -0
  138. package/dist/{types-B76Pn7Sy.d.ts → types-CQE3HD2V.d.ts} +4 -15
  139. package/dist/types-CQE3HD2V.d.ts.map +1 -0
  140. package/dist/{types-uCD4BNZR.d.cts → types-bNB98pYk.d.cts} +4 -15
  141. package/dist/types-bNB98pYk.d.cts.map +1 -0
  142. package/dist/utils/feed.cjs +17 -0
  143. package/dist/utils/feed.cjs.map +1 -0
  144. package/dist/utils/feed.d.cts +2 -0
  145. package/dist/utils/feed.d.ts +2 -0
  146. package/dist/utils/feed.js +15 -0
  147. package/dist/utils/feed.js.map +1 -0
  148. package/dist/utils/index.cjs +3 -0
  149. package/dist/utils/index.d.cts +4 -3
  150. package/dist/utils/index.d.ts +4 -3
  151. package/dist/utils/index.js +2 -1
  152. package/dist/utils/patterns.d.cts +1 -1
  153. package/dist/utils/patterns.d.ts +1 -1
  154. package/dist/utils/serverResponseGuards.d.cts +1 -1
  155. package/dist/utils/serverResponseGuards.d.ts +1 -1
  156. package/package.json +3 -3
  157. package/src/MobileClient.ts +163 -112
  158. package/src/dataMappers.ts +41 -0
  159. package/src/signing/canonicalize.ts +4 -37
  160. package/src/signing/eip712MethodByType.ts +1 -5
  161. package/src/signing/signing.test.ts +17 -60
  162. package/src/signing/types.ts +2 -12
  163. package/src/types/MobileServerFailureError.ts +2 -4
  164. package/src/types/clientTypes.ts +105 -27
  165. package/src/types/index.ts +1 -0
  166. package/src/types/mobileErrorCodes.ts +8 -5
  167. package/src/types/serverBaseTypes.ts +7 -28
  168. package/src/types/serverExecuteTypes.ts +17 -0
  169. package/src/types/serverModelTypes.ts +104 -8
  170. package/src/types/serverQueryTypes.ts +84 -39
  171. package/src/types/serverRequestTypes.ts +91 -0
  172. package/src/utils/feed.ts +11 -0
  173. package/src/utils/index.ts +1 -0
  174. package/dist/MobileClient-9JSAzblH.cjs.map +0 -1
  175. package/dist/MobileServerFailureError-ZggEcEda.d.cts.map +0 -1
  176. package/dist/MobileServerFailureError-f9KhKnJj.d.ts.map +0 -1
  177. package/dist/canonicalize-Dm7sXwPg.d.cts.map +0 -1
  178. package/dist/canonicalize-PX6dTIdF.d.ts.map +0 -1
  179. package/dist/clientTypes-DWW2N66c.d.ts +0 -168
  180. package/dist/clientTypes-DWW2N66c.d.ts.map +0 -1
  181. package/dist/clientTypes-Et0PUa2d.d.cts +0 -168
  182. package/dist/clientTypes-Et0PUa2d.d.cts.map +0 -1
  183. package/dist/eip712MethodByType-DJgXal9r.d.ts.map +0 -1
  184. package/dist/eip712MethodByType-DLh9MRsD.d.cts.map +0 -1
  185. package/dist/mobileErrorCodes-BeyBKmwh.d.cts.map +0 -1
  186. package/dist/mobileErrorCodes-QG5XbEY6.d.ts.map +0 -1
  187. package/dist/patterns-B9J2ldpx.d.cts.map +0 -1
  188. package/dist/patterns-BbxH3_VA.d.ts.map +0 -1
  189. package/dist/payloadHash-Bmhzs78N.d.ts.map +0 -1
  190. package/dist/payloadHash-nj8WuLUP.d.cts.map +0 -1
  191. package/dist/serverBaseTypes-BicXMrZV.d.cts +0 -43
  192. package/dist/serverBaseTypes-BicXMrZV.d.cts.map +0 -1
  193. package/dist/serverBaseTypes-ewbo8l4R.d.ts +0 -43
  194. package/dist/serverBaseTypes-ewbo8l4R.d.ts.map +0 -1
  195. package/dist/serverExecuteTypes-CXnMjKnt.d.ts +0 -11
  196. package/dist/serverExecuteTypes-CXnMjKnt.d.ts.map +0 -1
  197. package/dist/serverExecuteTypes-DKYK1V7C.d.cts +0 -11
  198. package/dist/serverExecuteTypes-DKYK1V7C.d.cts.map +0 -1
  199. package/dist/serverModelTypes-CQgfqgW3.d.cts +0 -69
  200. package/dist/serverModelTypes-CQgfqgW3.d.cts.map +0 -1
  201. package/dist/serverModelTypes-vEPhHIit.d.ts +0 -69
  202. package/dist/serverModelTypes-vEPhHIit.d.ts.map +0 -1
  203. package/dist/serverQueryTypes-BI-2TD8F.d.ts +0 -53
  204. package/dist/serverQueryTypes-BI-2TD8F.d.ts.map +0 -1
  205. package/dist/serverQueryTypes-D7Yharse.d.cts +0 -53
  206. package/dist/serverQueryTypes-D7Yharse.d.cts.map +0 -1
  207. package/dist/types-B76Pn7Sy.d.ts.map +0 -1
  208. package/dist/types-uCD4BNZR.d.cts.map +0 -1
@@ -0,0 +1,91 @@
1
+ import { Hex } from 'viem';
2
+ import { MobileSignedInner } from '../signing/types';
3
+ import { MobileServerNotificationPreferences } from './serverModelTypes';
4
+
5
+ /**
6
+ * Params for each unsigned `public_query`, keyed by request `type`.
7
+ */
8
+ export interface MobileServerPublicQueryRequestByType {
9
+ username_availability: { display_name: string };
10
+ profile: { subaccount: Hex };
11
+ feed: {
12
+ /**
13
+ * Minimum notional as a whole-dollar JSON integer (NOT an x18 string), at least $1,000. Omitted or
14
+ * `null` means unfiltered.
15
+ */
16
+ minimum_notional?: number;
17
+ /** Page size, 1–50; the backend defaults to `MOBILE_FEED_MAX_PAGE_SIZE` (50) when omitted. */
18
+ limit?: number;
19
+ /**
20
+ * Opaque keyset cursor from a prior page's `next_cursor`. Bound to the exact `minimum_notional` it was
21
+ * issued for (including the unfiltered state) — reusing it with a different filter fails.
22
+ */
23
+ cursor?: string;
24
+ };
25
+ notification_preferences: { expo_token: string };
26
+ }
27
+
28
+ /**
29
+ * Discriminant `type` values for unsigned `public_query` requests.
30
+ */
31
+ export type MobileServerPublicQueryRequestType =
32
+ keyof MobileServerPublicQueryRequestByType;
33
+
34
+ /**
35
+ * Params for each unsigned `public_execute`, keyed by request `type`. Possession of an active Expo push token
36
+ * authorizes these notification-only mutations: the backend resolves the token's owning wallet and mutates
37
+ * its state, so no signature, sender, or nonce is sent. Ordering is the backend's last-write-wins commit
38
+ * order, so callers must serialize their own writes.
39
+ */
40
+ export interface MobileServerPublicExecuteRequestByType {
41
+ unregister_expo_token: { expo_token: string };
42
+ update_preferences: {
43
+ expo_token: string;
44
+ preferences: MobileServerNotificationPreferences;
45
+ };
46
+ }
47
+
48
+ /**
49
+ * Discriminant `type` values for unsigned `public_execute` requests.
50
+ */
51
+ export type MobileServerPublicExecuteRequestType =
52
+ keyof MobileServerPublicExecuteRequestByType;
53
+
54
+ /**
55
+ * Params for each signed `query`, keyed by request `type`. These queries identify the caller through the
56
+ * signed envelope (`sender`) and take no further params, so every entry is empty — the signed counterpart to
57
+ * {@link MobileServerPublicQueryRequestByType}, kept so both query routes expose one params lookup keyed by
58
+ * type (matching engine's `EngineServerQueryRequestByType`, which likewise uses `Record<string, never>` for
59
+ * param-less queries).
60
+ */
61
+ export interface MobileServerSignedQueryRequestByType {
62
+ self_identity: Record<string, never>;
63
+ registered_devices: Record<string, never>;
64
+ }
65
+
66
+ /**
67
+ * Discriminant `type` values for signed `query` requests: the read-only subset of {@link MobileSignedInner}
68
+ * tags, keyed the same way as {@link MobileServerPublicQueryRequestType}.
69
+ */
70
+ export type MobileServerSignedQueryRequestType =
71
+ keyof MobileServerSignedQueryRequestByType;
72
+
73
+ /**
74
+ * Discriminant `type` values for signed `execute` requests: the write subset of {@link MobileSignedInner}
75
+ * tags, derived as everything that is not a signed query so the two routes cannot overlap or drift.
76
+ */
77
+ export type MobileServerExecuteRequestType = Exclude<
78
+ MobileSignedInner['type'],
79
+ MobileServerSignedQueryRequestType
80
+ >;
81
+
82
+ /**
83
+ * Wire `request_type` the backend echoes on failure envelopes, prefixed by the route that produced it:
84
+ * `public_query_*` for unsigned queries, `public_execute_*` for unsigned writes, `query_*` for signed
85
+ * queries, and `execute_*` for signed writes (e.g. `execute_set_username`).
86
+ */
87
+ export type MobileServerRequestType =
88
+ | `public_query_${MobileServerPublicQueryRequestType}`
89
+ | `public_execute_${MobileServerPublicExecuteRequestType}`
90
+ | `query_${MobileServerSignedQueryRequestType}`
91
+ | `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":"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"}
@@ -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,168 +0,0 @@
1
- import { n as MobileNotificationPlatform, t as MobileNotificationCategory } from "./serverModelTypes-vEPhHIit.js";
2
- import { SignatureParams, Subaccount } from "@nadohq/shared";
3
- import { Hex } from "viem";
4
-
5
- //#region src/types/clientTypes.d.ts
6
- /**
7
- * A subaccount's claimed identity on the mobile service API.
8
- *
9
- * `username` and `displayName` are two representations of the same claimed name: `displayName` is what the
10
- * user entered (preserving casing, e.g. `Alice.One`), while `username` is the canonical, lowercased handle
11
- * derived from it (e.g. `alice.one`). `username` is the unique key used for profile lookups
12
- * ({@link MobilePublicProfile}); `displayName` is only for presentation.
13
- */
14
- interface MobileIdentity {
15
- subaccount: Hex;
16
- /**
17
- * Canonical, lowercased handle derived from {@link MobileIdentity.displayName}, unique per identity and
18
- * used for profile lookups.
19
- */
20
- username: string;
21
- /**
22
- * User-facing name as claimed, preserving original casing. Validated against `MOBILE_DISPLAY_NAME_PATTERN`.
23
- */
24
- displayName: string;
25
- privateMode: boolean;
26
- }
27
- /**
28
- * A subaccount's public profile, as returned by an unsigned profile lookup.
29
- */
30
- interface MobilePublicProfile {
31
- subaccount: Hex;
32
- username: string;
33
- displayName: string;
34
- }
35
- /**
36
- * Result of a username availability check.
37
- */
38
- interface MobileUsernameAvailability {
39
- username: string;
40
- available: boolean;
41
- }
42
- /**
43
- * Scope limiting a notification category preference. Scopes are part of the wire format but rejected by the
44
- * backend for the MVP — `scopes` must be empty.
45
- */
46
- type MobileNotificationPreferenceScope = {
47
- type: 'subaccount';
48
- subaccount: Hex;
49
- } | {
50
- type: 'product';
51
- productId: number;
52
- };
53
- /**
54
- * A per-category push notification preference.
55
- */
56
- interface MobileNotificationCategoryPreference {
57
- category: MobileNotificationCategory;
58
- enabled: boolean;
59
- scopes: MobileNotificationPreferenceScope[];
60
- }
61
- /**
62
- * A wallet's push notification preferences. The backend requires exactly one entry per known category and
63
- * `schemaVersion` of 1.
64
- */
65
- interface MobileNotificationPreferences {
66
- /** Only `1` is accepted by the backend for the MVP. */
67
- schemaVersion: 1;
68
- categories: MobileNotificationCategoryPreference[];
69
- }
70
- /**
71
- * A device registered for push notifications.
72
- */
73
- interface MobileRegisteredDevice {
74
- /** Push platform the device registered under. */
75
- platform: MobileNotificationPlatform;
76
- /** BCP-47 locale tag reported at registration, or `null` if none was provided. */
77
- locale: string | null;
78
- /** App version string reported at registration, or `null` if none was provided. */
79
- appVersion: string | null;
80
- /**
81
- * First 8 hex chars of `keccak256` over the bracket-stripped Expo token — a stable, non-reversible
82
- * identifier for the device's push token. The raw token is never returned by the backend.
83
- */
84
- tokenFingerprintPrefix: string;
85
- /**
86
- * Unix timestamp (milliseconds) of the device's last registration refresh.
87
- */
88
- lastSeenAt: number;
89
- }
90
- /**
91
- * Common params for signed requests that authenticate as a given subaccount.
92
- */
93
- interface MobileSignedRequestParams extends Subaccount, SignatureParams {}
94
- /**
95
- * Params for {@link MobileClient.getUsernameAvailability}.
96
- */
97
- interface GetMobileUsernameAvailabilityParams {
98
- displayName: string;
99
- }
100
- /**
101
- * Params for {@link MobileClient.getPublicProfile}.
102
- */
103
- interface GetMobilePublicProfileParams {
104
- username: string;
105
- }
106
- /**
107
- * Params for {@link MobileClient.getSelfIdentity}.
108
- */
109
- type GetMobileSelfIdentityParams = MobileSignedRequestParams;
110
- /**
111
- * Params for {@link MobileClient.claimUsername}.
112
- */
113
- interface MobileClaimUsernameParams extends MobileSignedRequestParams {
114
- displayName: string;
115
- }
116
- /**
117
- * Params for {@link MobileClient.updateUsername}.
118
- */
119
- interface MobileUpdateUsernameParams extends MobileSignedRequestParams {
120
- displayName: string;
121
- }
122
- /**
123
- * Params for {@link MobileClient.setPrivateMode}.
124
- */
125
- interface MobileSetPrivateModeParams extends MobileSignedRequestParams {
126
- privateMode: boolean;
127
- }
128
- /**
129
- * Params for {@link MobileClient.registerExpoToken}.
130
- */
131
- interface MobileRegisterExpoTokenParams extends MobileSignedRequestParams {
132
- /**
133
- * Expo push token, e.g. `ExponentPushToken[...]`.
134
- */
135
- expoToken: string;
136
- platform: MobileNotificationPlatform;
137
- /**
138
- * BCP-47 locale tag, max 35 chars.
139
- */
140
- locale?: string;
141
- /**
142
- * App version string, max 64 chars.
143
- */
144
- appVersion?: string;
145
- }
146
- /**
147
- * Params for {@link MobileClient.unregisterExpoToken}.
148
- */
149
- interface MobileUnregisterExpoTokenParams extends MobileSignedRequestParams {
150
- expoToken: string;
151
- }
152
- /**
153
- * Params for {@link MobileClient.updateNotificationPreferences}.
154
- */
155
- interface MobileUpdateNotificationPreferencesParams extends MobileSignedRequestParams {
156
- preferences: MobileNotificationPreferences;
157
- }
158
- /**
159
- * Params for {@link MobileClient.getNotificationPreferences}.
160
- */
161
- type GetMobileNotificationPreferencesParams = MobileSignedRequestParams;
162
- /**
163
- * Params for {@link MobileClient.getRegisteredDevices}.
164
- */
165
- type GetMobileRegisteredDevicesParams = MobileSignedRequestParams;
166
- //#endregion
167
- export { MobileUpdateNotificationPreferencesParams as _, GetMobileUsernameAvailabilityParams as a, MobileNotificationCategoryPreference as c, MobilePublicProfile as d, MobileRegisterExpoTokenParams as f, MobileUnregisterExpoTokenParams as g, MobileSignedRequestParams as h, GetMobileSelfIdentityParams as i, MobileNotificationPreferenceScope as l, MobileSetPrivateModeParams as m, GetMobilePublicProfileParams as n, MobileClaimUsernameParams as o, MobileRegisteredDevice as p, GetMobileRegisteredDevicesParams as r, MobileIdentity as s, GetMobileNotificationPreferencesParams as t, MobileNotificationPreferences as u, MobileUpdateUsernameParams as v, MobileUsernameAvailability as y };
168
- //# sourceMappingURL=clientTypes-DWW2N66c.d.ts.map
@@ -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,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,168 +0,0 @@
1
- import { n as MobileNotificationPlatform, t as MobileNotificationCategory } from "./serverModelTypes-CQgfqgW3.cjs";
2
- import { SignatureParams, Subaccount } from "@nadohq/shared";
3
- import { Hex } from "viem";
4
-
5
- //#region src/types/clientTypes.d.ts
6
- /**
7
- * A subaccount's claimed identity on the mobile service API.
8
- *
9
- * `username` and `displayName` are two representations of the same claimed name: `displayName` is what the
10
- * user entered (preserving casing, e.g. `Alice.One`), while `username` is the canonical, lowercased handle
11
- * derived from it (e.g. `alice.one`). `username` is the unique key used for profile lookups
12
- * ({@link MobilePublicProfile}); `displayName` is only for presentation.
13
- */
14
- interface MobileIdentity {
15
- subaccount: Hex;
16
- /**
17
- * Canonical, lowercased handle derived from {@link MobileIdentity.displayName}, unique per identity and
18
- * used for profile lookups.
19
- */
20
- username: string;
21
- /**
22
- * User-facing name as claimed, preserving original casing. Validated against `MOBILE_DISPLAY_NAME_PATTERN`.
23
- */
24
- displayName: string;
25
- privateMode: boolean;
26
- }
27
- /**
28
- * A subaccount's public profile, as returned by an unsigned profile lookup.
29
- */
30
- interface MobilePublicProfile {
31
- subaccount: Hex;
32
- username: string;
33
- displayName: string;
34
- }
35
- /**
36
- * Result of a username availability check.
37
- */
38
- interface MobileUsernameAvailability {
39
- username: string;
40
- available: boolean;
41
- }
42
- /**
43
- * Scope limiting a notification category preference. Scopes are part of the wire format but rejected by the
44
- * backend for the MVP — `scopes` must be empty.
45
- */
46
- type MobileNotificationPreferenceScope = {
47
- type: 'subaccount';
48
- subaccount: Hex;
49
- } | {
50
- type: 'product';
51
- productId: number;
52
- };
53
- /**
54
- * A per-category push notification preference.
55
- */
56
- interface MobileNotificationCategoryPreference {
57
- category: MobileNotificationCategory;
58
- enabled: boolean;
59
- scopes: MobileNotificationPreferenceScope[];
60
- }
61
- /**
62
- * A wallet's push notification preferences. The backend requires exactly one entry per known category and
63
- * `schemaVersion` of 1.
64
- */
65
- interface MobileNotificationPreferences {
66
- /** Only `1` is accepted by the backend for the MVP. */
67
- schemaVersion: 1;
68
- categories: MobileNotificationCategoryPreference[];
69
- }
70
- /**
71
- * A device registered for push notifications.
72
- */
73
- interface MobileRegisteredDevice {
74
- /** Push platform the device registered under. */
75
- platform: MobileNotificationPlatform;
76
- /** BCP-47 locale tag reported at registration, or `null` if none was provided. */
77
- locale: string | null;
78
- /** App version string reported at registration, or `null` if none was provided. */
79
- appVersion: string | null;
80
- /**
81
- * First 8 hex chars of `keccak256` over the bracket-stripped Expo token — a stable, non-reversible
82
- * identifier for the device's push token. The raw token is never returned by the backend.
83
- */
84
- tokenFingerprintPrefix: string;
85
- /**
86
- * Unix timestamp (milliseconds) of the device's last registration refresh.
87
- */
88
- lastSeenAt: number;
89
- }
90
- /**
91
- * Common params for signed requests that authenticate as a given subaccount.
92
- */
93
- interface MobileSignedRequestParams extends Subaccount, SignatureParams {}
94
- /**
95
- * Params for {@link MobileClient.getUsernameAvailability}.
96
- */
97
- interface GetMobileUsernameAvailabilityParams {
98
- displayName: string;
99
- }
100
- /**
101
- * Params for {@link MobileClient.getPublicProfile}.
102
- */
103
- interface GetMobilePublicProfileParams {
104
- username: string;
105
- }
106
- /**
107
- * Params for {@link MobileClient.getSelfIdentity}.
108
- */
109
- type GetMobileSelfIdentityParams = MobileSignedRequestParams;
110
- /**
111
- * Params for {@link MobileClient.claimUsername}.
112
- */
113
- interface MobileClaimUsernameParams extends MobileSignedRequestParams {
114
- displayName: string;
115
- }
116
- /**
117
- * Params for {@link MobileClient.updateUsername}.
118
- */
119
- interface MobileUpdateUsernameParams extends MobileSignedRequestParams {
120
- displayName: string;
121
- }
122
- /**
123
- * Params for {@link MobileClient.setPrivateMode}.
124
- */
125
- interface MobileSetPrivateModeParams extends MobileSignedRequestParams {
126
- privateMode: boolean;
127
- }
128
- /**
129
- * Params for {@link MobileClient.registerExpoToken}.
130
- */
131
- interface MobileRegisterExpoTokenParams extends MobileSignedRequestParams {
132
- /**
133
- * Expo push token, e.g. `ExponentPushToken[...]`.
134
- */
135
- expoToken: string;
136
- platform: MobileNotificationPlatform;
137
- /**
138
- * BCP-47 locale tag, max 35 chars.
139
- */
140
- locale?: string;
141
- /**
142
- * App version string, max 64 chars.
143
- */
144
- appVersion?: string;
145
- }
146
- /**
147
- * Params for {@link MobileClient.unregisterExpoToken}.
148
- */
149
- interface MobileUnregisterExpoTokenParams extends MobileSignedRequestParams {
150
- expoToken: string;
151
- }
152
- /**
153
- * Params for {@link MobileClient.updateNotificationPreferences}.
154
- */
155
- interface MobileUpdateNotificationPreferencesParams extends MobileSignedRequestParams {
156
- preferences: MobileNotificationPreferences;
157
- }
158
- /**
159
- * Params for {@link MobileClient.getNotificationPreferences}.
160
- */
161
- type GetMobileNotificationPreferencesParams = MobileSignedRequestParams;
162
- /**
163
- * Params for {@link MobileClient.getRegisteredDevices}.
164
- */
165
- type GetMobileRegisteredDevicesParams = MobileSignedRequestParams;
166
- //#endregion
167
- export { MobileUpdateNotificationPreferencesParams as _, GetMobileUsernameAvailabilityParams as a, MobileNotificationCategoryPreference as c, MobilePublicProfile as d, MobileRegisterExpoTokenParams as f, MobileUnregisterExpoTokenParams as g, MobileSignedRequestParams as h, GetMobileSelfIdentityParams as i, MobileNotificationPreferenceScope as l, MobileSetPrivateModeParams as m, GetMobilePublicProfileParams as n, MobileClaimUsernameParams as o, MobileRegisteredDevice as p, GetMobileRegisteredDevicesParams as r, MobileIdentity as s, GetMobileNotificationPreferencesParams as t, MobileNotificationPreferences as u, MobileUpdateUsernameParams as v, MobileUsernameAvailability as y };
168
- //# sourceMappingURL=clientTypes-Et0PUa2d.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clientTypes-Et0PUa2d.d.cts","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,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,11 +0,0 @@
1
- import { a as MobileServerSuccessResponse, t as MobileServerFailureResponse } from "./serverBaseTypes-ewbo8l4R.js";
2
-
3
- //#region src/types/serverExecuteTypes.d.ts
4
- /**
5
- * Discriminated `execute` result union. Mobile execute routes return no payload beyond the success
6
- * discriminant, so the success arm is the base success envelope; failures use the uniform failure envelope.
7
- */
8
- type MobileServerExecuteResult = MobileServerSuccessResponse | MobileServerFailureResponse;
9
- //#endregion
10
- export { MobileServerExecuteResult as t };
11
- //# sourceMappingURL=serverExecuteTypes-CXnMjKnt.d.ts.map
@@ -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"}