@nadohq/mobile-client 0.36.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/README.md +19 -6
  2. package/dist/{MobileClient-D5TNTnLx.cjs → MobileClient-wjTrqP9z.cjs} +75 -12
  3. package/dist/MobileClient-wjTrqP9z.cjs.map +1 -0
  4. package/dist/MobileClient.cjs +1 -1
  5. package/dist/MobileClient.d.cts +62 -16
  6. package/dist/MobileClient.d.cts.map +1 -1
  7. package/dist/MobileClient.d.ts +62 -16
  8. package/dist/MobileClient.d.ts.map +1 -1
  9. package/dist/MobileClient.js +75 -12
  10. package/dist/MobileClient.js.map +1 -1
  11. package/dist/{MobileServerFailureError-CPFjwUBx.d.cts → MobileServerFailureError-BvQYrxjx.d.cts} +3 -3
  12. package/dist/{MobileServerFailureError-CPFjwUBx.d.cts.map → MobileServerFailureError-BvQYrxjx.d.cts.map} +1 -1
  13. package/dist/{MobileServerFailureError-Terv2Wzy.d.ts → MobileServerFailureError-CrNpL_L4.d.ts} +3 -3
  14. package/dist/{MobileServerFailureError-Terv2Wzy.d.ts.map → MobileServerFailureError-CrNpL_L4.d.ts.map} +1 -1
  15. package/dist/{buildSignedMobileRequest-BScnCGPF.d.ts → buildSignedMobileRequest-BqLRFLKV.d.ts} +2 -2
  16. package/dist/{buildSignedMobileRequest-BScnCGPF.d.ts.map → buildSignedMobileRequest-BqLRFLKV.d.ts.map} +1 -1
  17. package/dist/{buildSignedMobileRequest-CXfnhc-4.d.cts → buildSignedMobileRequest-DkkwEqIu.d.cts} +2 -2
  18. package/dist/{buildSignedMobileRequest-CXfnhc-4.d.cts.map → buildSignedMobileRequest-DkkwEqIu.d.cts.map} +1 -1
  19. package/dist/{canonicalize-CQ-pMYIt.d.ts → canonicalize-BRhCpYm1.d.ts} +2 -2
  20. package/dist/canonicalize-BRhCpYm1.d.ts.map +1 -0
  21. package/dist/{canonicalize-hzhboB-C.d.cts → canonicalize-DtpaaA2B.d.cts} +2 -2
  22. package/dist/canonicalize-DtpaaA2B.d.cts.map +1 -0
  23. package/dist/{clientTypes-BwakovWk.d.cts → clientTypes-CB_itU4Z.d.ts} +147 -14
  24. package/dist/clientTypes-CB_itU4Z.d.ts.map +1 -0
  25. package/dist/{clientTypes-D-o1_2Yc.d.ts → clientTypes-CceWsQzi.d.cts} +147 -14
  26. package/dist/clientTypes-CceWsQzi.d.cts.map +1 -0
  27. package/dist/dataMappers.cjs +79 -6
  28. package/dist/dataMappers.cjs.map +1 -1
  29. package/dist/dataMappers.d.cts +27 -5
  30. package/dist/dataMappers.d.cts.map +1 -1
  31. package/dist/dataMappers.d.ts +27 -5
  32. package/dist/dataMappers.d.ts.map +1 -1
  33. package/dist/dataMappers.js +75 -7
  34. package/dist/dataMappers.js.map +1 -1
  35. package/dist/{eip712MethodByType-3aiJkrHj.d.cts → eip712MethodByType-1xUkvTIp.d.cts} +2 -2
  36. package/dist/eip712MethodByType-1xUkvTIp.d.cts.map +1 -0
  37. package/dist/{eip712MethodByType-zNvZukU7.d.ts → eip712MethodByType-CrqBJIrp.d.ts} +2 -2
  38. package/dist/eip712MethodByType-CrqBJIrp.d.ts.map +1 -0
  39. package/dist/follow-Bh3UmXMc.d.cts +23 -0
  40. package/dist/follow-Bh3UmXMc.d.cts.map +1 -0
  41. package/dist/follow-DjkQm1vR.d.ts +23 -0
  42. package/dist/follow-DjkQm1vR.d.ts.map +1 -0
  43. package/dist/index.cjs +6 -1
  44. package/dist/index.d.cts +17 -16
  45. package/dist/index.d.ts +17 -16
  46. package/dist/index.js +2 -1
  47. package/dist/{mobileErrorCodes-CuQ5lyBV.d.ts → mobileErrorCodes-B3eR6t4b.d.ts} +8 -2
  48. package/dist/mobileErrorCodes-B3eR6t4b.d.ts.map +1 -0
  49. package/dist/{mobileErrorCodes-D_SyBm0k.d.cts → mobileErrorCodes-DkzBW4v3.d.cts} +8 -2
  50. package/dist/mobileErrorCodes-DkzBW4v3.d.cts.map +1 -0
  51. package/dist/{patterns-B5gi7OfV.d.ts → patterns-C-aUAnKl.d.ts} +1 -1
  52. package/dist/patterns-C-aUAnKl.d.ts.map +1 -0
  53. package/dist/{patterns-Db6fgz8i.d.cts → patterns-DS8P5LH0.d.cts} +1 -1
  54. package/dist/patterns-DS8P5LH0.d.cts.map +1 -0
  55. package/dist/{payloadHash-DVkEt-Rg.d.cts → payloadHash-CIo8Hkh6.d.cts} +2 -2
  56. package/dist/payloadHash-CIo8Hkh6.d.cts.map +1 -0
  57. package/dist/{payloadHash-BxL26uwq.d.ts → payloadHash-Cv4WwZCZ.d.ts} +2 -2
  58. package/dist/payloadHash-Cv4WwZCZ.d.ts.map +1 -0
  59. package/dist/{serverBaseTypes-B_KHFDab.d.ts → serverBaseTypes-C2JGib--.d.ts} +2 -2
  60. package/dist/{serverBaseTypes-B_KHFDab.d.ts.map → serverBaseTypes-C2JGib--.d.ts.map} +1 -1
  61. package/dist/{serverBaseTypes-C8KjE9Fm.d.cts → serverBaseTypes-YkCmgmt1.d.cts} +2 -2
  62. package/dist/{serverBaseTypes-C8KjE9Fm.d.cts.map → serverBaseTypes-YkCmgmt1.d.cts.map} +1 -1
  63. package/dist/serverExecuteTypes-C2NoNEwu.d.ts +50 -0
  64. package/dist/serverExecuteTypes-C2NoNEwu.d.ts.map +1 -0
  65. package/dist/serverExecuteTypes-DPZbs9ym.d.cts +50 -0
  66. package/dist/serverExecuteTypes-DPZbs9ym.d.cts.map +1 -0
  67. package/dist/{serverModelTypes-_cX99seo.d.ts → serverModelTypes-CDcRlRtw.d.ts} +57 -10
  68. package/dist/serverModelTypes-CDcRlRtw.d.ts.map +1 -0
  69. package/dist/{serverModelTypes-CwgibK-l.d.cts → serverModelTypes-CUzqFA6x.d.cts} +57 -10
  70. package/dist/serverModelTypes-CUzqFA6x.d.cts.map +1 -0
  71. package/dist/{serverQueryTypes-DwE1iJ9f.d.cts → serverQueryTypes-B0xI1G39.d.ts} +21 -9
  72. package/dist/serverQueryTypes-B0xI1G39.d.ts.map +1 -0
  73. package/dist/{serverQueryTypes-NIrPm2Sl.d.ts → serverQueryTypes-RdcIqRnM.d.cts} +21 -9
  74. package/dist/serverQueryTypes-RdcIqRnM.d.cts.map +1 -0
  75. package/dist/serverRequestTypes-Ddws3yXc.d.cts +116 -0
  76. package/dist/serverRequestTypes-Ddws3yXc.d.cts.map +1 -0
  77. package/dist/serverRequestTypes-Dv9NR-hQ.d.ts +116 -0
  78. package/dist/serverRequestTypes-Dv9NR-hQ.d.ts.map +1 -0
  79. package/dist/{serverResponseGuards-Cep5s7j5.d.ts → serverResponseGuards-BjIzucYt.d.ts} +2 -2
  80. package/dist/{serverResponseGuards-Cep5s7j5.d.ts.map → serverResponseGuards-BjIzucYt.d.ts.map} +1 -1
  81. package/dist/{serverResponseGuards-Dxt9_aGh.d.cts → serverResponseGuards-Dg9WbqBA.d.cts} +2 -2
  82. package/dist/{serverResponseGuards-Dxt9_aGh.d.cts.map → serverResponseGuards-Dg9WbqBA.d.cts.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 +5 -0
  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 +5 -0
  91. package/dist/signing/canonicalize.js.map +1 -1
  92. package/dist/signing/eip712MethodByType.cjs +2 -1
  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 +2 -1
  97. package/dist/signing/eip712MethodByType.js.map +1 -1
  98. package/dist/signing/index.d.cts +6 -6
  99. package/dist/signing/index.d.ts +6 -6
  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 +2 -2
  104. package/dist/signing/types.d.ts +2 -2
  105. package/dist/types/MobileServerFailureError.cjs +1 -1
  106. package/dist/types/MobileServerFailureError.d.cts +1 -1
  107. package/dist/types/MobileServerFailureError.d.ts +1 -1
  108. package/dist/types/clientTypes.d.cts +2 -2
  109. package/dist/types/clientTypes.d.ts +2 -2
  110. package/dist/types/index.d.cts +9 -9
  111. package/dist/types/index.d.ts +9 -9
  112. package/dist/types/mobileErrorCodes.cjs +13 -1
  113. package/dist/types/mobileErrorCodes.cjs.map +1 -1
  114. package/dist/types/mobileErrorCodes.d.cts +1 -1
  115. package/dist/types/mobileErrorCodes.d.ts +1 -1
  116. package/dist/types/mobileErrorCodes.js +12 -0
  117. package/dist/types/mobileErrorCodes.js.map +1 -1
  118. package/dist/types/serverBaseTypes.d.cts +1 -1
  119. package/dist/types/serverBaseTypes.d.ts +1 -1
  120. package/dist/types/serverExecuteTypes.d.cts +2 -2
  121. package/dist/types/serverExecuteTypes.d.ts +2 -2
  122. package/dist/types/serverModelTypes.cjs.map +1 -1
  123. package/dist/types/serverModelTypes.d.cts +2 -2
  124. package/dist/types/serverModelTypes.d.ts +2 -2
  125. package/dist/types/serverModelTypes.js.map +1 -1
  126. package/dist/types/serverQueryTypes.d.cts +2 -2
  127. package/dist/types/serverQueryTypes.d.ts +2 -2
  128. package/dist/types/serverRequestTypes.d.cts +2 -2
  129. package/dist/types/serverRequestTypes.d.ts +2 -2
  130. package/dist/{types-47IPsDyA.d.cts → types-BIIvIzG2.d.ts} +20 -7
  131. package/dist/types-BIIvIzG2.d.ts.map +1 -0
  132. package/dist/{types-D5kFJzEX.d.ts → types-UmYaeq1C.d.cts} +20 -7
  133. package/dist/types-UmYaeq1C.d.cts.map +1 -0
  134. package/dist/utils/follow.cjs +28 -0
  135. package/dist/utils/follow.cjs.map +1 -0
  136. package/dist/utils/follow.d.cts +2 -0
  137. package/dist/utils/follow.d.ts +2 -0
  138. package/dist/utils/follow.js +24 -0
  139. package/dist/utils/follow.js.map +1 -0
  140. package/dist/utils/index.cjs +5 -0
  141. package/dist/utils/index.d.cts +4 -3
  142. package/dist/utils/index.d.ts +4 -3
  143. package/dist/utils/index.js +2 -1
  144. package/dist/utils/patterns.d.cts +1 -1
  145. package/dist/utils/patterns.d.ts +1 -1
  146. package/dist/utils/serverResponseGuards.d.cts +1 -1
  147. package/dist/utils/serverResponseGuards.d.ts +1 -1
  148. package/package.json +3 -3
  149. package/src/MobileClient.ts +117 -21
  150. package/src/dataMappers.ts +109 -5
  151. package/src/signing/canonicalize.ts +6 -0
  152. package/src/signing/eip712MethodByType.ts +1 -0
  153. package/src/signing/signing.test.ts +32 -4
  154. package/src/signing/types.ts +18 -1
  155. package/src/types/clientTypes.ts +152 -11
  156. package/src/types/mobileErrorCodes.ts +12 -0
  157. package/src/types/serverExecuteTypes.ts +40 -2
  158. package/src/types/serverModelTypes.ts +58 -8
  159. package/src/types/serverQueryTypes.ts +18 -4
  160. package/src/types/serverRequestTypes.ts +50 -4
  161. package/src/utils/follow.ts +22 -0
  162. package/src/utils/index.ts +1 -0
  163. package/dist/MobileClient-D5TNTnLx.cjs.map +0 -1
  164. package/dist/canonicalize-CQ-pMYIt.d.ts.map +0 -1
  165. package/dist/canonicalize-hzhboB-C.d.cts.map +0 -1
  166. package/dist/clientTypes-BwakovWk.d.cts.map +0 -1
  167. package/dist/clientTypes-D-o1_2Yc.d.ts.map +0 -1
  168. package/dist/eip712MethodByType-3aiJkrHj.d.cts.map +0 -1
  169. package/dist/eip712MethodByType-zNvZukU7.d.ts.map +0 -1
  170. package/dist/mobileErrorCodes-CuQ5lyBV.d.ts.map +0 -1
  171. package/dist/mobileErrorCodes-D_SyBm0k.d.cts.map +0 -1
  172. package/dist/patterns-B5gi7OfV.d.ts.map +0 -1
  173. package/dist/patterns-Db6fgz8i.d.cts.map +0 -1
  174. package/dist/payloadHash-BxL26uwq.d.ts.map +0 -1
  175. package/dist/payloadHash-DVkEt-Rg.d.cts.map +0 -1
  176. package/dist/serverExecuteTypes-Cb5v7y0A.d.cts +0 -19
  177. package/dist/serverExecuteTypes-Cb5v7y0A.d.cts.map +0 -1
  178. package/dist/serverExecuteTypes-GFjZj_DC.d.ts +0 -19
  179. package/dist/serverExecuteTypes-GFjZj_DC.d.ts.map +0 -1
  180. package/dist/serverModelTypes-CwgibK-l.d.cts.map +0 -1
  181. package/dist/serverModelTypes-_cX99seo.d.ts.map +0 -1
  182. package/dist/serverQueryTypes-DwE1iJ9f.d.cts.map +0 -1
  183. package/dist/serverQueryTypes-NIrPm2Sl.d.ts.map +0 -1
  184. package/dist/serverRequestTypes-516zXnQ6.d.ts +0 -72
  185. package/dist/serverRequestTypes-516zXnQ6.d.ts.map +0 -1
  186. package/dist/serverRequestTypes-GAtVYIda.d.cts +0 -72
  187. package/dist/serverRequestTypes-GAtVYIda.d.cts.map +0 -1
  188. package/dist/types-47IPsDyA.d.cts.map +0 -1
  189. package/dist/types-D5kFJzEX.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MobileClient.js","names":[],"sources":["../src/MobileClient.ts"],"sourcesContent":["import {\n getNadoClientTypeHeaders,\n subaccountToHex,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n mapMobileFeedPage,\n mapMobileNotificationPreferences,\n mapMobileNotificationPreferencesToServer,\n mapMobilePublicProfile,\n mapMobileRegisteredWallet,\n} from './dataMappers';\nimport {\n buildSignedMobileRequest,\n MobileSignedInner,\n MobileSignedInnerParams,\n MobileSignedRequest,\n} from './signing';\nimport {\n GetMobileFeedParams,\n GetMobileNotificationPreferencesParams,\n GetMobilePublicProfileParams,\n GetMobileRegisteredWalletParams,\n GetMobileUsernameAvailabilityParams,\n MobileFeedPage,\n MobileNotificationPreferences,\n MobilePublicProfile,\n MobileRegisteredWallet,\n MobileRegisterExpoTokenParams,\n MobileSetPrivateModeParams,\n MobileSetUsernameParams,\n MobileSignedRequestParams,\n MobileUnregisterExpoTokenParams,\n MobileUpdateNotificationPreferencesParams,\n MobileUsernameAvailability,\n} from './types/clientTypes';\nimport { MobileServerFailureError } from './types/MobileServerFailureError';\nimport { MobileServerSuccessResponse } from './types/serverBaseTypes';\nimport {\n MobileServerExecuteResult,\n MobileServerPublicExecuteRequest,\n} from './types/serverExecuteTypes';\nimport {\n MobileServerPublicQueryRequest,\n MobileServerPublicQuerySuccessResponse,\n} from './types/serverQueryTypes';\nimport {\n MobileServerPublicQueryRequestByType,\n MobileServerPublicQueryRequestType,\n} from './types/serverRequestTypes';\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 * If provided, identifies the calling client, sent as a header with every request.\n */\n clientType?: string;\n}\n\n/**\n * Client for the Nado mobile service API: usernames, public profile lookups, the global trade feed, privacy\n * settings, and 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 headers: getNadoClientTypeHeaders(opts.clientType),\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: MobileServerPublicQueryRequest<'username_availability'> = {\n type: 'username_availability',\n display_name: params.displayName,\n };\n const data = await this.publicQuery(body);\n return { username: data.username, available: data.available };\n }\n\n /**\n * Looks up a subaccount's public profile. Every non-isolated subaccount resolves, with `username` and\n * `displayName` `null` until a username is claimed. Private Mode does not hide the profile itself, only the\n * account's activity.\n *\n * @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the subaccount is in the\n * engine-created isolated namespace, which cannot own a profile.\n */\n async getPublicProfile(\n params: GetMobilePublicProfileParams,\n ): Promise<MobilePublicProfile> {\n const body: MobileServerPublicQueryRequest<'profile'> = {\n type: 'profile',\n subaccount: subaccountToHex(params),\n };\n const data = await this.publicQuery(body);\n return mapMobilePublicProfile(data.profile);\n }\n\n /**\n * Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a\n * whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a\n * username are included with `null` name fields; only private accounts are filtered out. The feed is\n * best-effort rather than authoritative history, and pagination is live (not snapshot), so deduplicate pages\n * by {@link MobileFeedTrade.orderDigest}.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_FEED_FILTER` if `minimumNotional` or\n * `limit` is outside its allowed domain (fix the request; do not retry unchanged), or\n * `INVALID_FEED_CURSOR` if the cursor is malformed or was issued for a different `minimumNotional`\n * (discard the cursor and restart from the first page).\n */\n async getFeed(params: GetMobileFeedParams = {}): Promise<MobileFeedPage> {\n const body: MobileServerPublicQueryRequest<'feed'> = {\n type: 'feed',\n minimum_notional: params.minimumNotional,\n limit: params.limit,\n cursor: params.cursor,\n };\n const data = await this.publicQuery(body);\n return mapMobileFeedPage(data);\n }\n\n /**\n * Fetches the push notification preferences of the wallet that owns the given Expo push token. Unsigned —\n * the token identifies the wallet on its own. Falls back to the backend's defaults if the wallet has never\n * updated its preferences.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet.\n */\n async getNotificationPreferences(\n params: GetMobileNotificationPreferencesParams,\n ): Promise<MobileNotificationPreferences> {\n const body: MobileServerPublicQueryRequest<'notification_preferences'> = {\n type: 'notification_preferences',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileNotificationPreferences(data.preferences);\n }\n\n /**\n * Resolves the wallet that an Expo push token is currently registered to, along with the redacted metadata\n * of the device that registered it. Unsigned — the token identifies the wallet on its own. Use it to check\n * whether a locally held token is still active and which wallet currently owns it, since registering the\n * same token under another wallet transfers ownership.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet — including a token that was unregistered. The backend does not\n * distinguish those cases.\n */\n async getRegisteredWallet(\n params: GetMobileRegisteredWalletParams,\n ): Promise<MobileRegisteredWallet> {\n const body: MobileServerPublicQueryRequest<'registered_wallet'> = {\n type: 'registered_wallet',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileRegisteredWallet(data);\n }\n\n /*\n Public executes\n */\n\n /**\n * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout\n * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown\n * well-formed token succeeds.\n *\n * A registration that commits after this call re-activates the token, so stop or await any in-flight\n * {@link MobileClient.registerExpoToken} before unregistering.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed.\n */\n async unregisterExpoToken(\n params: MobileUnregisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'unregister_expo_token'> = {\n type: 'unregister_expo_token',\n expo_token: params.expoToken,\n };\n return this.publicExecute(body);\n }\n\n /**\n * Replaces the push notification preferences of the wallet that owns the given Expo push token. Possession\n * of an active token is the credential rather than a signature, so anyone holding the token can overwrite\n * that wallet's preferences. The backend requires `schemaVersion` of 1, exactly one entry per known\n * category, and empty `scopes` on every entry.\n *\n * Writes are last-write-wins on commit order rather than ordered by a client nonce, so callers must\n * serialize their own preference writes.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated, or\n * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.\n */\n async updateNotificationPreferences(\n params: MobileUpdateNotificationPreferencesParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'update_preferences'> = {\n type: 'update_preferences',\n expo_token: params.expoToken,\n preferences: mapMobileNotificationPreferencesToServer(params.preferences),\n };\n return this.publicExecute(body);\n }\n\n /*\n Signed executes\n */\n\n /**\n * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first\n * username and renames an existing one, so callers never need to read the current identity first.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_DISPLAY_NAME` if the display name violates\n * `MOBILE_DISPLAY_NAME_PATTERN`, `USERNAME_UNAVAILABLE` if the derived username is reserved or already\n * taken by another subaccount, `INVALID_IDENTITY_TARGET` if the sender is in the engine-created isolated\n * namespace, or `STALE_IDENTITY_UPDATE` if another identity write for this subaccount committed with a\n * later nonce (re-read the identity before retrying).\n */\n async setUsername(\n params: MobileSetUsernameParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest('set_username', 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 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 unknown as MobileSignedInner;\n return buildSignedMobileRequest({ ...params, walletClient, inner });\n }\n\n // Spelled out as an intersection rather than `MobileServerPublicQueryRequest<T>`: the latter is an indexed\n // access on a mapped type, which is not an inference site, so `T` would always widen to the full union.\n protected async publicQuery<T extends MobileServerPublicQueryRequestType>(\n body: { type: T } & MobileServerPublicQueryRequestByType[T],\n ): Promise<MobileServerPublicQuerySuccessResponse<T>> {\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 MobileServerPublicQuerySuccessResponse<T>;\n }\n\n protected async publicExecute(\n body: MobileServerPublicExecuteRequest,\n ): Promise<MobileServerSuccessResponse> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/mobile/public_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 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":";;;;;;;;;;;;AAmFA,IAAa,eAAb,MAA0B;CAIxB,YAAY,MAAwB;EAClC,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAM,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;GACtB,SAAS,yBAAyB,KAAK,UAAU;EACnD,CAAC;CACH;;;;;;CAOA,gBACE,0BACA;EACA,KAAK,KAAK,2BAA2B,4BAA4B,KAAA;CACnE;;;;CASA,MAAM,wBACJ,QACqC;EACrC,MAAM,OAAgE;GACpE,MAAM;GACN,cAAc,OAAO;EACvB;EACA,MAAM,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AI,GAC7C,MAAM,IAAI,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,IAAI,8BAA8B,IAAI,GACpC,MAAM,IAAI,yBAAyB,MAAM,SAAS,MAAM;EAE1D,IAAI,CAAC,8BAA8B,IAAI,GACrC,MAAM,IAAI,MACR,4EAA4E,KAAK,UAAU,IAAI,GACjG;CAEJ;AACF"}
1
+ {"version":3,"file":"MobileClient.js","names":[],"sources":["../src/MobileClient.ts"],"sourcesContent":["import {\n getNadoClientTypeHeaders,\n subaccountToHex,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n mapMobileFeedPage,\n mapMobileFollowListPage,\n mapMobileFollowListParamsToServer,\n mapMobileFollowMutationResult,\n mapMobileNotificationPreferences,\n mapMobileNotificationPreferencesToServer,\n mapMobileProfilesIncludeToServer,\n mapMobilePublicProfile,\n mapMobileRegisteredWallet,\n} from './dataMappers';\nimport {\n buildSignedMobileRequest,\n MobileSignedInner,\n MobileSignedInnerByType,\n MobileSignedInnerParams,\n MobileSignedRequest,\n} from './signing';\nimport {\n GetMobileFeedParams,\n GetMobileFollowersParams,\n GetMobileFollowingParams,\n GetMobileNotificationPreferencesParams,\n GetMobileProfilesParams,\n GetMobileRegisteredWalletParams,\n GetMobileUsernameAvailabilityParams,\n MobileFeedPage,\n MobileFollowListPage,\n MobileFollowMutationResult,\n MobileNotificationPreferences,\n MobilePublicProfile,\n MobileRegisteredWallet,\n MobileRegisterExpoTokenParams,\n MobileSetFollowParams,\n MobileSetPrivateModeParams,\n MobileSetUsernameParams,\n MobileSignedRequestParams,\n MobileUnregisterExpoTokenParams,\n MobileUpdateNotificationPreferencesParams,\n MobileUsernameAvailability,\n} from './types/clientTypes';\nimport { MobileServerFailureError } from './types/MobileServerFailureError';\nimport { MobileServerSuccessResponse } from './types/serverBaseTypes';\nimport {\n MobileServerExecuteResult,\n MobileServerExecuteSuccessResponse,\n MobileServerPublicExecuteRequest,\n} from './types/serverExecuteTypes';\nimport {\n MobileServerPublicQueryRequest,\n MobileServerPublicQuerySuccessResponse,\n} from './types/serverQueryTypes';\nimport {\n MobileServerExecuteRequestType,\n MobileServerPublicQueryRequestByType,\n MobileServerPublicQueryRequestType,\n} from './types/serverRequestTypes';\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 * If provided, identifies the calling client, sent as a header with every request.\n */\n clientType?: string;\n}\n\n/**\n * Client for the Nado mobile service API: usernames, public profile lookups, the global trade feed, the\n * follower/following graph, privacy settings, and 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 headers: getNadoClientTypeHeaders(opts.clientType),\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: MobileServerPublicQueryRequest<'username_availability'> = {\n type: 'username_availability',\n display_name: params.displayName,\n };\n const data = await this.publicQuery(body);\n return { username: data.username, available: data.available };\n }\n\n /**\n * Looks up public profiles, optionally with follower totals and a follow summary. Returns one profile per\n * requested subaccount, in the requested order, so callers can correlate positionally. Every non-isolated\n * subaccount resolves, with `username` and `displayName` `null` until a username is claimed. Private Mode\n * does not hide the profile itself, only the account's activity.\n *\n * This is the only profile route, so use it for a single subaccount too. It is unsigned, which means\n * `include.followSummary.viewAs` is an unauthenticated claim.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PROFILES_REQUEST` if `subaccounts` is empty,\n * holds duplicates, or exceeds `MOBILE_PROFILES_MAX_BATCH_SIZE` (25), or `PROFILE_NOT_FOUND` if any\n * requested subaccount — or the follow summary's `viewAs` — is in the engine-created isolated namespace.\n * One isolated member fails the whole batch rather than being omitted.\n */\n async getProfiles(\n params: GetMobileProfilesParams,\n ): Promise<MobilePublicProfile[]> {\n const body: MobileServerPublicQueryRequest<'profiles'> = {\n type: 'profiles',\n subaccounts: params.subaccounts.map(subaccountToHex),\n include: params.include\n ? mapMobileProfilesIncludeToServer(params.include)\n : undefined,\n };\n const data = await this.publicQuery(body);\n return data.profiles.map(mapMobilePublicProfile);\n }\n\n /**\n * Fetches a page of the accounts that follow the given Profile.\n *\n * Ordering depends on `viewAs`. With it, accounts the Viewer already follows come first, unfamiliar\n * accounts second, and every row carries an `isFollowing`. Without it, the page is ordered by the listed\n * relationship alone and no row carries an `isFollowing`. In both cases the newest listed relationship\n * comes first within a group, with a bytes32 tie-break. The grouping is evaluated per request against the\n * live graph, so following an account from inside the list moves it between groups on the next page —\n * deduplicate by subaccount and do not re-sort locally.\n *\n * @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the viewed Profile or `viewAs`\n * is isolated, `INVALID_FOLLOW_CURSOR` if the cursor is malformed or was issued for a different `viewAs`,\n * Profile, or list direction (discard it and restart from the first page), or `INVALID_FOLLOW_LIMIT` if\n * `limit` is outside 1–50.\n */\n async getFollowers(\n params: GetMobileFollowersParams,\n ): Promise<MobileFollowListPage> {\n const body: MobileServerPublicQueryRequest<'followers'> = {\n type: 'followers',\n ...mapMobileFollowListParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileFollowListPage(data);\n }\n\n /**\n * Fetches a page of the accounts the given Profile follows. Ordering, cursor rules, and errors match\n * {@link MobileClient.getFollowers}. When `viewAs` reads its own Following list every row is familiar, so\n * every `isFollowing` is `true`.\n */\n async getFollowing(\n params: GetMobileFollowingParams,\n ): Promise<MobileFollowListPage> {\n const body: MobileServerPublicQueryRequest<'following'> = {\n type: 'following',\n ...mapMobileFollowListParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileFollowListPage(data);\n }\n\n /**\n * Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a\n * whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a\n * username are included with `null` name fields; only private accounts are filtered out. The feed is\n * best-effort rather than authoritative history, and pagination is live (not snapshot), so deduplicate pages\n * by {@link MobileFeedTrade.orderDigest}.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_FEED_FILTER` if `minimumNotional` or\n * `limit` is outside its allowed domain (fix the request; do not retry unchanged), or\n * `INVALID_FEED_CURSOR` if the cursor is malformed or was issued for a different `minimumNotional`\n * (discard the cursor and restart from the first page).\n */\n async getFeed(params: GetMobileFeedParams = {}): Promise<MobileFeedPage> {\n const body: MobileServerPublicQueryRequest<'feed'> = {\n type: 'feed',\n minimum_notional: params.minimumNotional,\n limit: params.limit,\n cursor: params.cursor,\n };\n const data = await this.publicQuery(body);\n return mapMobileFeedPage(data);\n }\n\n /**\n * Fetches the push notification preferences of the wallet that owns the given Expo push token. Unsigned —\n * the token identifies the wallet on its own. Falls back to the backend's defaults if the wallet has never\n * updated its preferences.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet.\n */\n async getNotificationPreferences(\n params: GetMobileNotificationPreferencesParams,\n ): Promise<MobileNotificationPreferences> {\n const body: MobileServerPublicQueryRequest<'notification_preferences'> = {\n type: 'notification_preferences',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileNotificationPreferences(data.preferences);\n }\n\n /**\n * Resolves the wallet that an Expo push token is currently registered to, along with the redacted metadata\n * of the device that registered it. Unsigned — the token identifies the wallet on its own. Use it to check\n * whether a locally held token is still active and which wallet currently owns it, since registering the\n * same token under another wallet transfers ownership.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet — including a token that was unregistered. The backend does not\n * distinguish those cases.\n */\n async getRegisteredWallet(\n params: GetMobileRegisteredWalletParams,\n ): Promise<MobileRegisteredWallet> {\n const body: MobileServerPublicQueryRequest<'registered_wallet'> = {\n type: 'registered_wallet',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileRegisteredWallet(data);\n }\n\n /*\n Public executes\n */\n\n /**\n * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout\n * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown\n * well-formed token succeeds.\n *\n * A registration that commits after this call re-activates the token, so stop or await any in-flight\n * {@link MobileClient.registerExpoToken} before unregistering.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed.\n */\n async unregisterExpoToken(\n params: MobileUnregisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'unregister_expo_token'> = {\n type: 'unregister_expo_token',\n expo_token: params.expoToken,\n };\n return this.publicExecute(body);\n }\n\n /**\n * Replaces the push notification preferences of the wallet that owns the given Expo push token. Possession\n * of an active token is the credential rather than a signature, so anyone holding the token can overwrite\n * that wallet's preferences. The backend requires `schemaVersion` of 1, exactly one entry per known\n * category, and empty `scopes` on every entry.\n *\n * Writes are last-write-wins on commit order rather than ordered by a client nonce, so callers must\n * serialize their own preference writes.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated, or\n * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.\n */\n async updateNotificationPreferences(\n params: MobileUpdateNotificationPreferencesParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'update_preferences'> = {\n type: 'update_preferences',\n expo_token: params.expoToken,\n preferences: mapMobileNotificationPreferencesToServer(params.preferences),\n };\n return this.publicExecute(body);\n }\n\n /*\n Signed executes\n */\n\n /**\n * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first\n * username and renames an existing one, so callers never need to read the current identity first.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_DISPLAY_NAME` if the display name violates\n * `MOBILE_DISPLAY_NAME_PATTERN`, `USERNAME_UNAVAILABLE` if the derived username is reserved or already\n * taken by another subaccount, `INVALID_IDENTITY_TARGET` if the sender is in the engine-created isolated\n * namespace, or `STALE_IDENTITY_UPDATE` if another identity write for this subaccount committed with a\n * later nonce (re-read the identity before retrying).\n */\n async setUsername(\n params: MobileSetUsernameParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest('set_username', 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 * Sets whether the signing subaccount follows a Profile. Both directions are idempotent: following again\n * keeps the original relationship creation time, so it does not move the account in recency order, and\n * unfollowing a relationship that does not exist succeeds with `isFollowing: false`. Unfollowing deletes\n * the relationship rather than deactivating it, so a later follow gets a new creation time and moves the\n * account to the front of recency order.\n *\n * Only `isFollowing: true` is checked against the canonical Query DB subaccount index, so unfollowing still\n * works while that index lags.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_FOLLOW_TARGET` if the target is the sender or\n * either party is isolated, `FOLLOWER_NOT_ELIGIBLE` if the sender is not yet in the canonical Query DB\n * subaccount index, or `FOLLOWING_NOT_FOUND` if the target is not. Both index errors are transient for an\n * account that is being recorded, so they are retryable after catch-up — unlike `INVALID_FOLLOW_TARGET`.\n */\n async setFollow(\n params: MobileSetFollowParams,\n ): Promise<MobileFollowMutationResult> {\n const signedRequest = await this.getSignedRequest('set_follow', params, {\n subaccount: subaccountToHex(params.target),\n is_following: params.isFollowing,\n });\n const data = await this.execute(signedRequest);\n return mapMobileFollowMutationResult(data);\n }\n\n /*\n Base Fns\n */\n\n // Returns the request narrowed to `type` so `execute` can infer its response from the request it is given,\n // instead of being told the type a second time at the call site.\n protected async getSignedRequest<T extends MobileSignedInner['type']>(\n type: T,\n params: MobileSignedRequestParams,\n innerParams: MobileSignedInnerParams<T>,\n ): Promise<MobileSignedRequest<MobileSignedInnerByType<T>>> {\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 = {\n type,\n ...innerParams,\n } as unknown as MobileSignedInnerByType<T>;\n return buildSignedMobileRequest({ ...params, walletClient, inner });\n }\n\n // Spelled out as an intersection rather than `MobileServerPublicQueryRequest<T>`: the latter is an indexed\n // access on a mapped type, which is not an inference site, so `T` would always widen to the full union.\n protected async publicQuery<T extends MobileServerPublicQueryRequestType>(\n body: { type: T } & MobileServerPublicQueryRequestByType[T],\n ): Promise<MobileServerPublicQuerySuccessResponse<T>> {\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 MobileServerPublicQuerySuccessResponse<T>;\n }\n\n protected async publicExecute(\n body: MobileServerPublicExecuteRequest,\n ): Promise<MobileServerSuccessResponse> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/mobile/public_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 // `T` is inferred from the body's `type` rather than declared by the caller, for the same reason\n // `publicQuery` spells its body out as an intersection: an indexed access is not an inference site.\n protected async execute<T extends MobileServerExecuteRequestType>(\n body: MobileSignedRequest & { type: T },\n ): Promise<MobileServerExecuteSuccessResponse<T>> {\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 MobileServerExecuteSuccessResponse<T>;\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":";;;;;;;;;;;;AA+FA,IAAa,eAAb,MAA0B;CAIxB,YAAY,MAAwB;EAClC,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAM,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;GACtB,SAAS,yBAAyB,KAAK,UAAU;EACnD,CAAC;CACH;;;;;;CAOA,gBACE,0BACA;EACA,KAAK,KAAK,2BAA2B,4BAA4B,KAAA;CACnE;;;;CASA,MAAM,wBACJ,QACqC;EACrC,MAAM,OAAgE;GACpE,MAAM;GACN,cAAc,OAAO;EACvB;EACA,MAAM,OAAO,MAAM,KAAK,YAAY,IAAI;EACxC,OAAO;GAAE,UAAU,KAAK;GAAU,WAAW,KAAK;EAAU;CAC9D;;;;;;;;;;;;;;;CAgBA,MAAM,YACJ,QACgC;EAChC,MAAM,OAAmD;GACvD,MAAM;GACN,aAAa,OAAO,YAAY,IAAI,eAAe;GACnD,SAAS,OAAO,UACZ,iCAAiC,OAAO,OAAO,IAC/C,KAAA;EACN;EAEA,QAAO,MADY,KAAK,YAAY,IAAI,GAC5B,SAAS,IAAI,sBAAsB;CACjD;;;;;;;;;;;;;;;;CAiBA,MAAM,aACJ,QAC+B;EAC/B,MAAM,OAAoD;GACxD,MAAM;GACN,GAAG,kCAAkC,MAAM;EAC7C;EAEA,O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;EACjC,KAAK,kBAAkB,QAAQ;EAG/B,OAAO,SAAS;CAClB;;;;;;CAOA,oBAA4B,UAAkC;EAC5D,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS,KAC9C;EAEF,IAAI,8BAA8B,SAAS,IAAI,GAC7C,MAAM,IAAI,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,IAAI,8BAA8B,IAAI,GACpC,MAAM,IAAI,yBAAyB,MAAM,SAAS,MAAM;EAE1D,IAAI,CAAC,8BAA8B,IAAI,GACrC,MAAM,IAAI,MACR,4EAA4E,KAAK,UAAU,IAAI,GACjG;CAEJ;AACF"}
@@ -1,5 +1,5 @@
1
- import { o as MobileServerRequestType } from "./serverRequestTypes-GAtVYIda.cjs";
2
- import { t as MobileServerFailureResponse } from "./serverBaseTypes-C8KjE9Fm.cjs";
1
+ import { c as MobileServerRequestType } from "./serverRequestTypes-Ddws3yXc.cjs";
2
+ import { t as MobileServerFailureResponse } from "./serverBaseTypes-YkCmgmt1.cjs";
3
3
  import { BaseServerFailureError } from "@nadohq/shared";
4
4
 
5
5
  //#region src/types/MobileServerFailureError.d.ts
@@ -20,4 +20,4 @@ declare class MobileServerFailureError extends BaseServerFailureError {
20
20
  }
21
21
  //#endregion
22
22
  export { MobileServerFailureError as t };
23
- //# sourceMappingURL=MobileServerFailureError-CPFjwUBx.d.cts.map
23
+ //# sourceMappingURL=MobileServerFailureError-BvQYrxjx.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobileServerFailureError-CPFjwUBx.d.cts","names":[],"sources":["../src/types/src/types/MobileServerFailureError.ts"],"mappings":";;;;;;;AASA;;;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
+ {"version":3,"file":"MobileServerFailureError-BvQYrxjx.d.cts","names":[],"sources":["../src/types/src/types/MobileServerFailureError.ts"],"mappings":";;;;;;;AASA;;;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,5 +1,5 @@
1
- import { o as MobileServerRequestType } from "./serverRequestTypes-516zXnQ6.js";
2
- import { t as MobileServerFailureResponse } from "./serverBaseTypes-B_KHFDab.js";
1
+ import { c as MobileServerRequestType } from "./serverRequestTypes-Dv9NR-hQ.js";
2
+ import { t as MobileServerFailureResponse } from "./serverBaseTypes-C2JGib--.js";
3
3
  import { BaseServerFailureError } from "@nadohq/shared";
4
4
 
5
5
  //#region src/types/MobileServerFailureError.d.ts
@@ -20,4 +20,4 @@ declare class MobileServerFailureError extends BaseServerFailureError {
20
20
  }
21
21
  //#endregion
22
22
  export { MobileServerFailureError as t };
23
- //# sourceMappingURL=MobileServerFailureError-Terv2Wzy.d.ts.map
23
+ //# sourceMappingURL=MobileServerFailureError-CrNpL_L4.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobileServerFailureError-Terv2Wzy.d.ts","names":[],"sources":["../src/types/src/types/MobileServerFailureError.ts"],"mappings":";;;;;;;AASA;;;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
+ {"version":3,"file":"MobileServerFailureError-CrNpL_L4.d.ts","names":[],"sources":["../src/types/src/types/MobileServerFailureError.ts"],"mappings":";;;;;;;AASA;;;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,4 +1,4 @@
1
- import { i as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-D5kFJzEX.js";
1
+ import { a as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-BIIvIzG2.js";
2
2
 
3
3
  //#region src/signing/buildSignedMobileRequest.d.ts
4
4
  /**
@@ -11,4 +11,4 @@ declare function buildSignedMobileRequest<T extends MobileSignedInner>(params: B
11
11
  }): Promise<MobileSignedRequest<T>>;
12
12
  //#endregion
13
13
  export { buildSignedMobileRequest as t };
14
- //# sourceMappingURL=buildSignedMobileRequest-BScnCGPF.d.ts.map
14
+ //# sourceMappingURL=buildSignedMobileRequest-BqLRFLKV.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildSignedMobileRequest-BScnCGPF.d.ts","names":[],"sources":["../src/signing/src/signing/buildSignedMobileRequest.ts"],"mappings":";;;;;AAgBA;;;iBAAsB,wBAAA,WAAmC,iBAAA,CAAA,CACvD,MAAA,EAAQ,8BAAA;EAAmC,KAAA,EAAO,CAAA;AAAA,IACjD,OAAA,CAAQ,mBAAA,CAAoB,CAAA"}
1
+ {"version":3,"file":"buildSignedMobileRequest-BqLRFLKV.d.ts","names":[],"sources":["../src/signing/src/signing/buildSignedMobileRequest.ts"],"mappings":";;;;;AAgBA;;;iBAAsB,wBAAA,WAAmC,iBAAA,CAAA,CACvD,MAAA,EAAQ,8BAAA;EAAmC,KAAA,EAAO,CAAA;AAAA,IACjD,OAAA,CAAQ,mBAAA,CAAoB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { i as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-47IPsDyA.cjs";
1
+ import { a as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-UmYaeq1C.cjs";
2
2
 
3
3
  //#region src/signing/buildSignedMobileRequest.d.ts
4
4
  /**
@@ -11,4 +11,4 @@ declare function buildSignedMobileRequest<T extends MobileSignedInner>(params: B
11
11
  }): Promise<MobileSignedRequest<T>>;
12
12
  //#endregion
13
13
  export { buildSignedMobileRequest as t };
14
- //# sourceMappingURL=buildSignedMobileRequest-CXfnhc-4.d.cts.map
14
+ //# sourceMappingURL=buildSignedMobileRequest-DkkwEqIu.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildSignedMobileRequest-CXfnhc-4.d.cts","names":[],"sources":["../src/signing/src/signing/buildSignedMobileRequest.ts"],"mappings":";;;;;AAgBA;;;iBAAsB,wBAAA,WAAmC,iBAAA,CAAA,CACvD,MAAA,EAAQ,8BAAA;EAAmC,KAAA,EAAO,CAAA;AAAA,IACjD,OAAA,CAAQ,mBAAA,CAAoB,CAAA"}
1
+ {"version":3,"file":"buildSignedMobileRequest-DkkwEqIu.d.cts","names":[],"sources":["../src/signing/src/signing/buildSignedMobileRequest.ts"],"mappings":";;;;;AAgBA;;;iBAAsB,wBAAA,WAAmC,iBAAA,CAAA,CACvD,MAAA,EAAQ,8BAAA;EAAmC,KAAA,EAAO,CAAA;AAAA,IACjD,OAAA,CAAQ,mBAAA,CAAoB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { n as MobileSignedInner } from "./types-D5kFJzEX.js";
1
+ import { n as MobileSignedInner } from "./types-BIIvIzG2.js";
2
2
 
3
3
  //#region src/signing/canonicalize.d.ts
4
4
  /**
@@ -11,4 +11,4 @@ import { n as MobileSignedInner } from "./types-D5kFJzEX.js";
11
11
  declare function canonicalizeMobileInner(inner: MobileSignedInner): MobileSignedInner;
12
12
  //#endregion
13
13
  export { canonicalizeMobileInner as t };
14
- //# sourceMappingURL=canonicalize-CQ-pMYIt.d.ts.map
14
+ //# sourceMappingURL=canonicalize-BRhCpYm1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize-BRhCpYm1.d.ts","names":[],"sources":["../src/signing/src/signing/canonicalize.ts"],"mappings":";;;;;AASA;;;;;iBAAgB,uBAAA,CACd,KAAA,EAAO,iBAAA,GACN,iBAAiB"}
@@ -1,4 +1,4 @@
1
- import { n as MobileSignedInner } from "./types-47IPsDyA.cjs";
1
+ import { n as MobileSignedInner } from "./types-UmYaeq1C.cjs";
2
2
 
3
3
  //#region src/signing/canonicalize.d.ts
4
4
  /**
@@ -11,4 +11,4 @@ import { n as MobileSignedInner } from "./types-47IPsDyA.cjs";
11
11
  declare function canonicalizeMobileInner(inner: MobileSignedInner): MobileSignedInner;
12
12
  //#endregion
13
13
  export { canonicalizeMobileInner as t };
14
- //# sourceMappingURL=canonicalize-hzhboB-C.d.cts.map
14
+ //# sourceMappingURL=canonicalize-DtpaaA2B.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize-DtpaaA2B.d.cts","names":[],"sources":["../src/signing/src/signing/canonicalize.ts"],"mappings":";;;;;AASA;;;;;iBAAgB,uBAAA,CACd,KAAA,EAAO,iBAAA,GACN,iBAAiB"}
@@ -1,11 +1,15 @@
1
- import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-CwgibK-l.cjs";
1
+ import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-CDcRlRtw.js";
2
2
  import { SignatureParams, Subaccount } from "@nadohq/shared";
3
3
  import { Hex } from "viem";
4
4
 
5
5
  //#region src/types/clientTypes.d.ts
6
6
  /**
7
7
  * A subaccount's public profile, as returned by an unsigned profile lookup. Private Mode hides the account's
8
- * activity, not its profile, so `privateMode` is exposed here too.
8
+ * activity, not its profile, so `privateMode` is exposed here too. A subaccount with no identity row still
9
+ * yields a profile, with `null` names and `privateMode: false`.
10
+ *
11
+ * The last three fields are `undefined` unless the matching {@link MobileProfilesInclude} asked for them —
12
+ * absent means "not requested" rather than "none".
9
13
  */
10
14
  interface MobilePublicProfile {
11
15
  subaccount: Hex;
@@ -14,6 +18,77 @@ interface MobilePublicProfile {
14
18
  /** User-facing name as claimed, or `null` if no username has been claimed. */
15
19
  displayName: string | null;
16
20
  privateMode: boolean;
21
+ /**
22
+ * Exact count at query time rather than a cached counter, including unnamed and private accounts — Private
23
+ * Mode hides activity, not relationships. Requires the `followCounts` include.
24
+ */
25
+ followerCount?: number;
26
+ followingCount?: number;
27
+ /** Requires the `followSummary` include, and is relative to that include's `viewAs`. */
28
+ followSummary?: MobileFollowSummary;
29
+ }
30
+ /**
31
+ * The identity fields the backend attaches to a subaccount wherever it surfaces one alongside other data.
32
+ * Resolved at read time, so a rename shows up on the next read without any change to the surrounding record.
33
+ */
34
+ interface MobileIdentitySummary {
35
+ subaccount: Hex;
36
+ /** `null` when the account has not claimed a username; render a local fallback label from `subaccount`. */
37
+ username: string | null;
38
+ /** `null` when the account has not claimed a username; render a local fallback label from `subaccount`. */
39
+ displayName: string | null;
40
+ /** Reserved for a future avatar source; `null` until one is implemented. */
41
+ avatarUrl: string | null;
42
+ }
43
+ /**
44
+ * A viewer's relationship with one Profile, plus the Followed By preview: accounts the viewer follows that
45
+ * also follow that Profile. Every preview entry is therefore already familiar to the viewer, which is why it
46
+ * carries no `isFollowing` of its own.
47
+ */
48
+ interface MobileFollowSummary {
49
+ /** The direct `viewer -> viewed Profile` relationship. */
50
+ isFollowing: boolean;
51
+ /** Exact size of the two-edge intersection, independent of how many previews came back. */
52
+ followedByCount: number;
53
+ /**
54
+ * Newest `preview -> viewed Profile` relationship first, with a bytes32 tie-break. Capped at
55
+ * `MOBILE_FOLLOWED_BY_PREVIEW_LIMIT` (2) by the backend and not client-configurable.
56
+ */
57
+ followedBy: MobileIdentitySummary[];
58
+ }
59
+ /**
60
+ * One row of a Followers or Following page.
61
+ */
62
+ interface MobileFollowListAccount {
63
+ identity: MobileIdentitySummary;
64
+ /**
65
+ * Whether the `viewAs` Viewer follows this account — not the listed relationship that put it in the page.
66
+ * The Viewer can appear in another Profile's list, and does not follow themself, so their own row is
67
+ * `false`. `undefined` when the request named no `viewAs`, which is a missing perspective rather than a
68
+ * known "not following".
69
+ */
70
+ isFollowing?: boolean;
71
+ /** This account's own follower count. */
72
+ followerCount: number;
73
+ }
74
+ /**
75
+ * A page of Followers or Following. Pagination is live rather than snapshot: a Follow or Unfollow between
76
+ * pages can move an account, so an account can appear twice or not at all across one session. Deduplicate by
77
+ * {@link MobileIdentitySummary.subaccount} and restart from `cursor: undefined` on refresh.
78
+ */
79
+ interface MobileFollowListPage {
80
+ accounts: MobileFollowListAccount[];
81
+ /** `null` means the list is complete. */
82
+ nextCursor: string | null;
83
+ }
84
+ /**
85
+ * Post-commit state of a follow or unfollow. The mutation and its count share one database transaction, so
86
+ * these values are authoritative — apply them rather than re-reading.
87
+ */
88
+ interface MobileFollowMutationResult {
89
+ isFollowing: boolean;
90
+ /** The *target's* follower count after the mutation, not the sender's. */
91
+ followerCount: number;
17
92
  }
18
93
  /**
19
94
  * Result of a username availability check.
@@ -36,16 +111,9 @@ interface MobileFeedMargin {
36
111
  * (a rename can change an already-fetched trade on the next read). Amounts are display-oriented human-unit
37
112
  * numbers — do not use them for accounting, order construction, or exact threshold decisions.
38
113
  */
39
- interface MobileFeedTrade {
114
+ interface MobileFeedTrade extends MobileIdentitySummary {
40
115
  /** Order digest this trade is keyed by; the stable id for reconciling live pagination. */
41
116
  orderDigest: Hex;
42
- subaccount: Hex;
43
- /** `null` when the trader has not claimed a username; render a local fallback label from `subaccount`. */
44
- username: string | null;
45
- /** `null` when the trader has not claimed a username; render a local fallback label from `subaccount`. */
46
- displayName: string | null;
47
- /** Reserved for a future avatar source; `null` until one is implemented. */
48
- avatarUrl: string | null;
49
117
  productId: number;
50
118
  /** Executed quantity in human units. */
51
119
  quantity: number;
@@ -142,9 +210,31 @@ interface GetMobileUsernameAvailabilityParams {
142
210
  displayName: string;
143
211
  }
144
212
  /**
145
- * Params for {@link MobileClient.getPublicProfile}.
213
+ * Opt-in extras for a profiles lookup. Each one adds fields that are otherwise absent from every returned
214
+ * profile, and costs extra rate-limit weight per profile, so ask only for what the UI shows.
146
215
  */
147
- type GetMobilePublicProfileParams = Subaccount;
216
+ interface MobileProfilesInclude {
217
+ /** Populates `followerCount` and `followingCount`. */
218
+ followCounts?: boolean;
219
+ /**
220
+ * Populates `followSummary`, relative to `viewAs`. This viewer identity is an unauthenticated claim — the
221
+ * route takes no signature — so do not treat the result as proof of who is asking.
222
+ */
223
+ followSummary?: {
224
+ viewAs: Subaccount;
225
+ };
226
+ }
227
+ /**
228
+ * Params for {@link MobileClient.getProfiles}.
229
+ */
230
+ interface GetMobileProfilesParams {
231
+ /**
232
+ * 1–`MOBILE_PROFILES_MAX_BATCH_SIZE` (25) distinct subaccounts. Duplicates and an empty list are rejected
233
+ * rather than deduplicated, and results come back in this exact order.
234
+ */
235
+ subaccounts: Subaccount[];
236
+ include?: MobileProfilesInclude;
237
+ }
148
238
  /**
149
239
  * Params for {@link MobileClient.getFeed}.
150
240
  */
@@ -175,6 +265,49 @@ interface MobileSetUsernameParams extends MobileSignedRequestParams {
175
265
  interface MobileSetPrivateModeParams extends MobileSignedRequestParams {
176
266
  privateMode: boolean;
177
267
  }
268
+ /**
269
+ * Params for {@link MobileClient.setFollow}. The subaccount carried by {@link MobileSignedRequestParams} is
270
+ * the signing Follower; `target` is the Profile on the other end of the relationship.
271
+ */
272
+ interface MobileSetFollowParams extends MobileSignedRequestParams {
273
+ /** The Profile being followed or unfollowed. Must not be the signing subaccount. */
274
+ target: Subaccount;
275
+ /** `true` follows the target, `false` unfollows it. Both directions are idempotent. */
276
+ isFollowing: boolean;
277
+ }
278
+ /**
279
+ * Common params for a Followers or Following page.
280
+ */
281
+ interface GetMobileFollowListParams {
282
+ /** The Profile whose Followers or Following are being listed. */
283
+ target: Subaccount;
284
+ /**
285
+ * Viewer to resolve the page against, which turns on familiar-first ordering and populates every row's
286
+ * {@link MobileFollowListAccount.isFollowing}. Omit it for a plain recency-ordered list with no
287
+ * `isFollowing` at all. The route is unsigned, so this is an unauthenticated claim rather than proof of
288
+ * who is asking.
289
+ */
290
+ viewAs?: Subaccount;
291
+ /**
292
+ * Opaque cursor from the previous page's {@link MobileFollowListPage.nextCursor}. Omit for the first page.
293
+ * A cursor is bound to its `viewAs` (including its absence), Profile, and list direction — reusing it
294
+ * elsewhere fails with `INVALID_FOLLOW_CURSOR`.
295
+ */
296
+ cursor?: string;
297
+ /**
298
+ * Page size, 1–`MOBILE_FOLLOW_LIST_MAX_PAGE_SIZE` (50); the backend defaults to
299
+ * `MOBILE_FOLLOW_LIST_DEFAULT_PAGE_SIZE` (25) when omitted.
300
+ */
301
+ limit?: number;
302
+ }
303
+ /**
304
+ * Params for {@link MobileClient.getFollowers}.
305
+ */
306
+ type GetMobileFollowersParams = GetMobileFollowListParams;
307
+ /**
308
+ * Params for {@link MobileClient.getFollowing}.
309
+ */
310
+ type GetMobileFollowingParams = GetMobileFollowListParams;
178
311
  /**
179
312
  * Params for {@link MobileClient.registerExpoToken}.
180
313
  */
@@ -212,5 +345,5 @@ type GetMobileNotificationPreferencesParams = MobileWithExpoTokenParams;
212
345
  */
213
346
  type GetMobileRegisteredWalletParams = MobileWithExpoTokenParams;
214
347
  //#endregion
215
- export { MobileSignedRequestParams as _, GetMobileUsernameAvailabilityParams as a, MobileUsernameAvailability as b, MobileFeedTrade as c, MobileNotificationPreferences as d, MobilePublicProfile as f, MobileSetUsernameParams as g, MobileSetPrivateModeParams as h, GetMobileRegisteredWalletParams as i, MobileNotificationCategoryPreference as l, MobileRegisteredWallet as m, GetMobileNotificationPreferencesParams as n, MobileFeedMargin as o, MobileRegisterExpoTokenParams as p, GetMobilePublicProfileParams as r, MobileFeedPage as s, GetMobileFeedParams as t, MobileNotificationPreferenceScope as u, MobileUnregisterExpoTokenParams as v, MobileWithExpoTokenParams as x, MobileUpdateNotificationPreferencesParams as y };
216
- //# sourceMappingURL=clientTypes-BwakovWk.d.cts.map
348
+ export { MobileUsernameAvailability as A, MobileRegisteredWallet as C, MobileSignedRequestParams as D, MobileSetUsernameParams as E, MobileUnregisterExpoTokenParams as O, MobileRegisterExpoTokenParams as S, MobileSetPrivateModeParams as T, MobileNotificationCategoryPreference as _, GetMobileNotificationPreferencesParams as a, MobileProfilesInclude as b, GetMobileUsernameAvailabilityParams as c, MobileFeedTrade as d, MobileFollowListAccount as f, MobileIdentitySummary as g, MobileFollowSummary as h, GetMobileFollowingParams as i, MobileWithExpoTokenParams as j, MobileUpdateNotificationPreferencesParams as k, MobileFeedMargin as l, MobileFollowMutationResult as m, GetMobileFollowListParams as n, GetMobileProfilesParams as o, MobileFollowListPage as p, GetMobileFollowersParams as r, GetMobileRegisteredWalletParams as s, GetMobileFeedParams as t, MobileFeedPage as u, MobileNotificationPreferenceScope as v, MobileSetFollowParams as w, MobilePublicProfile as x, MobileNotificationPreferences as y };
349
+ //# sourceMappingURL=clientTypes-CB_itU4Z.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientTypes-CB_itU4Z.d.ts","names":[],"sources":["../src/types/src/types/clientTypes.ts"],"mappings":";;;;;;;AAiBA;;;;;;UAAiB,mBAAA;EACf,UAAA,EAAY,GAAA;EAKZ;EAHA,QAAA;EASA;EAPA,WAAA;EACA,WAAA;EAQmC;AAAA;AAOrC;;EAVE,aAAA;EACA,cAAA;EAUA;EARA,aAAA,GAAgB,mBAAmB;AAAA;;;;AAc1B;UAPM,qBAAA;EACf,UAAA,EAAY,GAAG;;EAEf,QAAA;EAcA;EAZA,WAAA;EAmBA;EAjBA,SAAA;AAAA;AAiBiC;AAMnC;;;;AANmC,UATlB,mBAAA;EAgBL;EAdV,WAAA;EAuBA;EArBA,eAAA;EAqBa;AAQf;;;EAxBE,UAAA,EAAY,qBAAqB;AAAA;;;;UAMlB,uBAAA;EAC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AA;;AA2DE;AAMb;UA3DiB,mCAAA;EACf,WAAW;AAAA;AA2DA;AAOb;;;AAPa,UApDI,qBAAA;EA2D8B;EAzD7C,YAAA;EA2DQ;;;AAEG;EAxDX,aAAA;IAAkB,MAAA,EAAQ,UAAU;EAAA;AAAA;;;;UAMrB,uBAAA;EAuEf;;;AAKK;EAvEL,WAAA,EAAa,UAAA;EACb,OAAA,GAAU,qBAAqB;AAAA;;AA4E+B;AAKhE;UA3EiB,mBAAA;;;AA2E+C;AAKhE;EA3EE,eAAA;;EAEA,KAAA;EAyEqD;;;;EApErD,MAAA;AAAA;;AAiFU;AAMZ;UAjFiB,uBAAA,SAAgC,yBAAyB;;EAExE,WAAW;AAAA;AAoFb;;;AAAA,UA9EiB,0BAAA,SAAmC,yBAAyB;EAC3E,WAAW;AAAA;;;AA8E+B;AAM5C;UA7EiB,qBAAA,SAA8B,yBAAyB;;EAEtE,MAAA,EAAQ,UAAA;EA2EoE;EAzE5E,WAAA;AAAA;;;AA8EqE;UAxEtD,yBAAA;;EAEf,MAAA,EAAQ,UAAA;;;;;;;EAOR,MAAA,GAAS,UAAU;;;;;;EAMnB,MAAA;;;;;EAKA,KAAA;AAAA;;;;KAMU,wBAAA,GAA2B,yBAAyB;;;;KAKpD,wBAAA,GAA2B,yBAAyB;;;;UAK/C,6BAAA,SAAsC,yBAAyB;;;;EAI9E,SAAA;EACA,QAAA,EAAU,0BAAA;;;;EAIV,MAAA;;;;EAIA,UAAA;AAAA;;;;KAMU,+BAAA,GAAkC,yBAAyB;;;;UAKtD,yCAAA,SAAkD,yBAAyB;EAC1F,WAAA,EAAa,6BAAA;AAAA;;;;KAMH,sCAAA,GAAyC,yBAAyB;;;;KAKlE,+BAAA,GAAkC,yBAAyB"}
@@ -1,11 +1,15 @@
1
- import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-_cX99seo.js";
1
+ import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-CUzqFA6x.cjs";
2
2
  import { SignatureParams, Subaccount } from "@nadohq/shared";
3
3
  import { Hex } from "viem";
4
4
 
5
5
  //#region src/types/clientTypes.d.ts
6
6
  /**
7
7
  * A subaccount's public profile, as returned by an unsigned profile lookup. Private Mode hides the account's
8
- * activity, not its profile, so `privateMode` is exposed here too.
8
+ * activity, not its profile, so `privateMode` is exposed here too. A subaccount with no identity row still
9
+ * yields a profile, with `null` names and `privateMode: false`.
10
+ *
11
+ * The last three fields are `undefined` unless the matching {@link MobileProfilesInclude} asked for them —
12
+ * absent means "not requested" rather than "none".
9
13
  */
10
14
  interface MobilePublicProfile {
11
15
  subaccount: Hex;
@@ -14,6 +18,77 @@ interface MobilePublicProfile {
14
18
  /** User-facing name as claimed, or `null` if no username has been claimed. */
15
19
  displayName: string | null;
16
20
  privateMode: boolean;
21
+ /**
22
+ * Exact count at query time rather than a cached counter, including unnamed and private accounts — Private
23
+ * Mode hides activity, not relationships. Requires the `followCounts` include.
24
+ */
25
+ followerCount?: number;
26
+ followingCount?: number;
27
+ /** Requires the `followSummary` include, and is relative to that include's `viewAs`. */
28
+ followSummary?: MobileFollowSummary;
29
+ }
30
+ /**
31
+ * The identity fields the backend attaches to a subaccount wherever it surfaces one alongside other data.
32
+ * Resolved at read time, so a rename shows up on the next read without any change to the surrounding record.
33
+ */
34
+ interface MobileIdentitySummary {
35
+ subaccount: Hex;
36
+ /** `null` when the account has not claimed a username; render a local fallback label from `subaccount`. */
37
+ username: string | null;
38
+ /** `null` when the account has not claimed a username; render a local fallback label from `subaccount`. */
39
+ displayName: string | null;
40
+ /** Reserved for a future avatar source; `null` until one is implemented. */
41
+ avatarUrl: string | null;
42
+ }
43
+ /**
44
+ * A viewer's relationship with one Profile, plus the Followed By preview: accounts the viewer follows that
45
+ * also follow that Profile. Every preview entry is therefore already familiar to the viewer, which is why it
46
+ * carries no `isFollowing` of its own.
47
+ */
48
+ interface MobileFollowSummary {
49
+ /** The direct `viewer -> viewed Profile` relationship. */
50
+ isFollowing: boolean;
51
+ /** Exact size of the two-edge intersection, independent of how many previews came back. */
52
+ followedByCount: number;
53
+ /**
54
+ * Newest `preview -> viewed Profile` relationship first, with a bytes32 tie-break. Capped at
55
+ * `MOBILE_FOLLOWED_BY_PREVIEW_LIMIT` (2) by the backend and not client-configurable.
56
+ */
57
+ followedBy: MobileIdentitySummary[];
58
+ }
59
+ /**
60
+ * One row of a Followers or Following page.
61
+ */
62
+ interface MobileFollowListAccount {
63
+ identity: MobileIdentitySummary;
64
+ /**
65
+ * Whether the `viewAs` Viewer follows this account — not the listed relationship that put it in the page.
66
+ * The Viewer can appear in another Profile's list, and does not follow themself, so their own row is
67
+ * `false`. `undefined` when the request named no `viewAs`, which is a missing perspective rather than a
68
+ * known "not following".
69
+ */
70
+ isFollowing?: boolean;
71
+ /** This account's own follower count. */
72
+ followerCount: number;
73
+ }
74
+ /**
75
+ * A page of Followers or Following. Pagination is live rather than snapshot: a Follow or Unfollow between
76
+ * pages can move an account, so an account can appear twice or not at all across one session. Deduplicate by
77
+ * {@link MobileIdentitySummary.subaccount} and restart from `cursor: undefined` on refresh.
78
+ */
79
+ interface MobileFollowListPage {
80
+ accounts: MobileFollowListAccount[];
81
+ /** `null` means the list is complete. */
82
+ nextCursor: string | null;
83
+ }
84
+ /**
85
+ * Post-commit state of a follow or unfollow. The mutation and its count share one database transaction, so
86
+ * these values are authoritative — apply them rather than re-reading.
87
+ */
88
+ interface MobileFollowMutationResult {
89
+ isFollowing: boolean;
90
+ /** The *target's* follower count after the mutation, not the sender's. */
91
+ followerCount: number;
17
92
  }
18
93
  /**
19
94
  * Result of a username availability check.
@@ -36,16 +111,9 @@ interface MobileFeedMargin {
36
111
  * (a rename can change an already-fetched trade on the next read). Amounts are display-oriented human-unit
37
112
  * numbers — do not use them for accounting, order construction, or exact threshold decisions.
38
113
  */
39
- interface MobileFeedTrade {
114
+ interface MobileFeedTrade extends MobileIdentitySummary {
40
115
  /** Order digest this trade is keyed by; the stable id for reconciling live pagination. */
41
116
  orderDigest: Hex;
42
- subaccount: Hex;
43
- /** `null` when the trader has not claimed a username; render a local fallback label from `subaccount`. */
44
- username: string | null;
45
- /** `null` when the trader has not claimed a username; render a local fallback label from `subaccount`. */
46
- displayName: string | null;
47
- /** Reserved for a future avatar source; `null` until one is implemented. */
48
- avatarUrl: string | null;
49
117
  productId: number;
50
118
  /** Executed quantity in human units. */
51
119
  quantity: number;
@@ -142,9 +210,31 @@ interface GetMobileUsernameAvailabilityParams {
142
210
  displayName: string;
143
211
  }
144
212
  /**
145
- * Params for {@link MobileClient.getPublicProfile}.
213
+ * Opt-in extras for a profiles lookup. Each one adds fields that are otherwise absent from every returned
214
+ * profile, and costs extra rate-limit weight per profile, so ask only for what the UI shows.
146
215
  */
147
- type GetMobilePublicProfileParams = Subaccount;
216
+ interface MobileProfilesInclude {
217
+ /** Populates `followerCount` and `followingCount`. */
218
+ followCounts?: boolean;
219
+ /**
220
+ * Populates `followSummary`, relative to `viewAs`. This viewer identity is an unauthenticated claim — the
221
+ * route takes no signature — so do not treat the result as proof of who is asking.
222
+ */
223
+ followSummary?: {
224
+ viewAs: Subaccount;
225
+ };
226
+ }
227
+ /**
228
+ * Params for {@link MobileClient.getProfiles}.
229
+ */
230
+ interface GetMobileProfilesParams {
231
+ /**
232
+ * 1–`MOBILE_PROFILES_MAX_BATCH_SIZE` (25) distinct subaccounts. Duplicates and an empty list are rejected
233
+ * rather than deduplicated, and results come back in this exact order.
234
+ */
235
+ subaccounts: Subaccount[];
236
+ include?: MobileProfilesInclude;
237
+ }
148
238
  /**
149
239
  * Params for {@link MobileClient.getFeed}.
150
240
  */
@@ -175,6 +265,49 @@ interface MobileSetUsernameParams extends MobileSignedRequestParams {
175
265
  interface MobileSetPrivateModeParams extends MobileSignedRequestParams {
176
266
  privateMode: boolean;
177
267
  }
268
+ /**
269
+ * Params for {@link MobileClient.setFollow}. The subaccount carried by {@link MobileSignedRequestParams} is
270
+ * the signing Follower; `target` is the Profile on the other end of the relationship.
271
+ */
272
+ interface MobileSetFollowParams extends MobileSignedRequestParams {
273
+ /** The Profile being followed or unfollowed. Must not be the signing subaccount. */
274
+ target: Subaccount;
275
+ /** `true` follows the target, `false` unfollows it. Both directions are idempotent. */
276
+ isFollowing: boolean;
277
+ }
278
+ /**
279
+ * Common params for a Followers or Following page.
280
+ */
281
+ interface GetMobileFollowListParams {
282
+ /** The Profile whose Followers or Following are being listed. */
283
+ target: Subaccount;
284
+ /**
285
+ * Viewer to resolve the page against, which turns on familiar-first ordering and populates every row's
286
+ * {@link MobileFollowListAccount.isFollowing}. Omit it for a plain recency-ordered list with no
287
+ * `isFollowing` at all. The route is unsigned, so this is an unauthenticated claim rather than proof of
288
+ * who is asking.
289
+ */
290
+ viewAs?: Subaccount;
291
+ /**
292
+ * Opaque cursor from the previous page's {@link MobileFollowListPage.nextCursor}. Omit for the first page.
293
+ * A cursor is bound to its `viewAs` (including its absence), Profile, and list direction — reusing it
294
+ * elsewhere fails with `INVALID_FOLLOW_CURSOR`.
295
+ */
296
+ cursor?: string;
297
+ /**
298
+ * Page size, 1–`MOBILE_FOLLOW_LIST_MAX_PAGE_SIZE` (50); the backend defaults to
299
+ * `MOBILE_FOLLOW_LIST_DEFAULT_PAGE_SIZE` (25) when omitted.
300
+ */
301
+ limit?: number;
302
+ }
303
+ /**
304
+ * Params for {@link MobileClient.getFollowers}.
305
+ */
306
+ type GetMobileFollowersParams = GetMobileFollowListParams;
307
+ /**
308
+ * Params for {@link MobileClient.getFollowing}.
309
+ */
310
+ type GetMobileFollowingParams = GetMobileFollowListParams;
178
311
  /**
179
312
  * Params for {@link MobileClient.registerExpoToken}.
180
313
  */
@@ -212,5 +345,5 @@ type GetMobileNotificationPreferencesParams = MobileWithExpoTokenParams;
212
345
  */
213
346
  type GetMobileRegisteredWalletParams = MobileWithExpoTokenParams;
214
347
  //#endregion
215
- export { MobileSignedRequestParams as _, GetMobileUsernameAvailabilityParams as a, MobileUsernameAvailability as b, MobileFeedTrade as c, MobileNotificationPreferences as d, MobilePublicProfile as f, MobileSetUsernameParams as g, MobileSetPrivateModeParams as h, GetMobileRegisteredWalletParams as i, MobileNotificationCategoryPreference as l, MobileRegisteredWallet as m, GetMobileNotificationPreferencesParams as n, MobileFeedMargin as o, MobileRegisterExpoTokenParams as p, GetMobilePublicProfileParams as r, MobileFeedPage as s, GetMobileFeedParams as t, MobileNotificationPreferenceScope as u, MobileUnregisterExpoTokenParams as v, MobileWithExpoTokenParams as x, MobileUpdateNotificationPreferencesParams as y };
216
- //# sourceMappingURL=clientTypes-D-o1_2Yc.d.ts.map
348
+ export { MobileUsernameAvailability as A, MobileRegisteredWallet as C, MobileSignedRequestParams as D, MobileSetUsernameParams as E, MobileUnregisterExpoTokenParams as O, MobileRegisterExpoTokenParams as S, MobileSetPrivateModeParams as T, MobileNotificationCategoryPreference as _, GetMobileNotificationPreferencesParams as a, MobileProfilesInclude as b, GetMobileUsernameAvailabilityParams as c, MobileFeedTrade as d, MobileFollowListAccount as f, MobileIdentitySummary as g, MobileFollowSummary as h, GetMobileFollowingParams as i, MobileWithExpoTokenParams as j, MobileUpdateNotificationPreferencesParams as k, MobileFeedMargin as l, MobileFollowMutationResult as m, GetMobileFollowListParams as n, GetMobileProfilesParams as o, MobileFollowListPage as p, GetMobileFollowersParams as r, GetMobileRegisteredWalletParams as s, GetMobileFeedParams as t, MobileFeedPage as u, MobileNotificationPreferenceScope as v, MobileSetFollowParams as w, MobilePublicProfile as x, MobileNotificationPreferences as y };
349
+ //# sourceMappingURL=clientTypes-CceWsQzi.d.cts.map