@nadohq/mobile-client 0.65.0 → 0.67.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 (211) hide show
  1. package/README.md +202 -10
  2. package/dist/{MobileClient-CfVZXTcz.cjs → MobileClient-vuI5wlB_.cjs} +303 -21
  3. package/dist/MobileClient-vuI5wlB_.cjs.map +1 -0
  4. package/dist/MobileClient.cjs +1 -1
  5. package/dist/MobileClient.d.cts +175 -20
  6. package/dist/MobileClient.d.cts.map +1 -1
  7. package/dist/MobileClient.d.ts +175 -20
  8. package/dist/MobileClient.d.ts.map +1 -1
  9. package/dist/MobileClient.js +303 -21
  10. package/dist/MobileClient.js.map +1 -1
  11. package/dist/{MobileServerFailureError-BZVwlsMg.d.ts → MobileServerFailureError-BeCCNShj.d.cts} +2 -3
  12. package/dist/MobileServerFailureError-BeCCNShj.d.cts.map +1 -0
  13. package/dist/{MobileServerFailureError-CbtK8kD4.d.cts → MobileServerFailureError-hHv28weI.d.ts} +2 -3
  14. package/dist/MobileServerFailureError-hHv28weI.d.ts.map +1 -0
  15. package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.cts +15 -0
  16. package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.cts.map +1 -0
  17. package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.ts +15 -0
  18. package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.ts.map +1 -0
  19. package/dist/{buildSignedMobileRequest-C1v0flCR.d.cts → buildSignedMobileRequest-DcEMKU_4.d.cts} +2 -2
  20. package/dist/{buildSignedMobileRequest-C1v0flCR.d.cts.map → buildSignedMobileRequest-DcEMKU_4.d.cts.map} +1 -1
  21. package/dist/{buildSignedMobileRequest-UeeWdYGU.d.ts → buildSignedMobileRequest-DlTMvoXR.d.ts} +2 -2
  22. package/dist/{buildSignedMobileRequest-UeeWdYGU.d.ts.map → buildSignedMobileRequest-DlTMvoXR.d.ts.map} +1 -1
  23. package/dist/{canonicalize-5eeZrkzQ.d.ts → canonicalize-BOZlflI3.d.ts} +2 -2
  24. package/dist/canonicalize-BOZlflI3.d.ts.map +1 -0
  25. package/dist/{canonicalize-CBaZprTo.d.cts → canonicalize-BvCozzvJ.d.cts} +2 -2
  26. package/dist/canonicalize-BvCozzvJ.d.cts.map +1 -0
  27. package/dist/{clientTypes-_mEgzmNs.d.cts → clientTypes-KpHlCDGZ.d.cts} +341 -38
  28. package/dist/clientTypes-KpHlCDGZ.d.cts.map +1 -0
  29. package/dist/{clientTypes-C9dJufxk.d.ts → clientTypes-XRI41VdC.d.ts} +341 -38
  30. package/dist/clientTypes-XRI41VdC.d.ts.map +1 -0
  31. package/dist/dataMappers.cjs +257 -20
  32. package/dist/dataMappers.cjs.map +1 -1
  33. package/dist/dataMappers.d.cts +98 -15
  34. package/dist/dataMappers.d.cts.map +1 -1
  35. package/dist/dataMappers.d.ts +98 -15
  36. package/dist/dataMappers.d.ts.map +1 -1
  37. package/dist/dataMappers.js +242 -20
  38. package/dist/dataMappers.js.map +1 -1
  39. package/dist/{eip712MethodByType-D8jLoxDu.d.cts → eip712MethodByType-DyAmzH7b.d.cts} +2 -2
  40. package/dist/eip712MethodByType-DyAmzH7b.d.cts.map +1 -0
  41. package/dist/{eip712MethodByType-DcUh8h-l.d.ts → eip712MethodByType-qSSAF6i2.d.ts} +2 -2
  42. package/dist/eip712MethodByType-qSSAF6i2.d.ts.map +1 -0
  43. package/dist/feed-BrgkFqP3.d.cts +23 -0
  44. package/dist/feed-BrgkFqP3.d.cts.map +1 -0
  45. package/dist/feed-DcbhLoo1.d.ts +23 -0
  46. package/dist/feed-DcbhLoo1.d.ts.map +1 -0
  47. package/dist/index-BVVgDSdq.d.cts +1 -0
  48. package/dist/index-BVVgDSdq.d.ts +1 -0
  49. package/dist/index.cjs +8 -2
  50. package/dist/index.d.cts +14 -16
  51. package/dist/index.d.ts +14 -16
  52. package/dist/index.js +4 -3
  53. package/dist/{mobileErrorCodes-CmjYEIYm.d.ts → mobileErrorCodes-CdwX6QTO.d.cts} +8 -3
  54. package/dist/mobileErrorCodes-CdwX6QTO.d.cts.map +1 -0
  55. package/dist/{mobileErrorCodes-CmjYEIYm.d.cts → mobileErrorCodes-CdwX6QTO.d.ts} +8 -3
  56. package/dist/mobileErrorCodes-CdwX6QTO.d.ts.map +1 -0
  57. package/dist/{payloadHash-DhHmgRqL.d.cts → payloadHash-BgGSZock.d.cts} +2 -2
  58. package/dist/payloadHash-BgGSZock.d.cts.map +1 -0
  59. package/dist/{payloadHash-E1_8fpLW.d.ts → payloadHash-Bi6upCLQ.d.ts} +2 -2
  60. package/dist/payloadHash-Bi6upCLQ.d.ts.map +1 -0
  61. package/dist/{serverExecuteTypes-BwWGspOg.d.ts → serverExecuteTypes-DuCWe_H_.d.cts} +23 -14
  62. package/dist/serverExecuteTypes-DuCWe_H_.d.cts.map +1 -0
  63. package/dist/{serverExecuteTypes-B-OJok19.d.cts → serverExecuteTypes-usJ6HMJv.d.ts} +23 -14
  64. package/dist/serverExecuteTypes-usJ6HMJv.d.ts.map +1 -0
  65. package/dist/{serverModelTypes-CiA-dy1R.d.ts → serverModelTypes-CTHMNIQS.d.cts} +170 -13
  66. package/dist/serverModelTypes-CTHMNIQS.d.cts.map +1 -0
  67. package/dist/{serverModelTypes-CiA-dy1R.d.cts → serverModelTypes-CTHMNIQS.d.ts} +170 -13
  68. package/dist/serverModelTypes-CTHMNIQS.d.ts.map +1 -0
  69. package/dist/{serverResponseGuards-CShiXpHT.d.ts → serverResponseGuards-CzmldAad.d.cts} +2 -2
  70. package/dist/{serverResponseGuards-BW69PS7O.d.cts.map → serverResponseGuards-CzmldAad.d.cts.map} +1 -1
  71. package/dist/{serverResponseGuards-BW69PS7O.d.cts → serverResponseGuards-Dvkbjp2_.d.ts} +2 -2
  72. package/dist/{serverResponseGuards-CShiXpHT.d.ts.map → serverResponseGuards-Dvkbjp2_.d.ts.map} +1 -1
  73. package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
  74. package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
  75. package/dist/signing/canonicalize.cjs +53 -2
  76. package/dist/signing/canonicalize.cjs.map +1 -1
  77. package/dist/signing/canonicalize.d.cts +1 -1
  78. package/dist/signing/canonicalize.d.ts +1 -1
  79. package/dist/signing/canonicalize.js +53 -2
  80. package/dist/signing/canonicalize.js.map +1 -1
  81. package/dist/signing/eip712MethodByType.cjs +7 -0
  82. package/dist/signing/eip712MethodByType.cjs.map +1 -1
  83. package/dist/signing/eip712MethodByType.d.cts +1 -1
  84. package/dist/signing/eip712MethodByType.d.ts +1 -1
  85. package/dist/signing/eip712MethodByType.js +7 -0
  86. package/dist/signing/eip712MethodByType.js.map +1 -1
  87. package/dist/signing/index.d.cts +5 -5
  88. package/dist/signing/index.d.ts +5 -5
  89. package/dist/signing/payloadHash.cjs +1 -1
  90. package/dist/signing/payloadHash.d.cts +1 -1
  91. package/dist/signing/payloadHash.d.ts +1 -1
  92. package/dist/signing/payloadHash.js +1 -1
  93. package/dist/signing/types.d.cts +1 -1
  94. package/dist/signing/types.d.ts +1 -1
  95. package/dist/types/MobileServerFailureError.d.cts +1 -1
  96. package/dist/types/MobileServerFailureError.d.ts +1 -1
  97. package/dist/types/MobileUnsupportedNotificationRouteError.cjs +19 -0
  98. package/dist/types/MobileUnsupportedNotificationRouteError.cjs.map +1 -0
  99. package/dist/types/MobileUnsupportedNotificationRouteError.d.cts +2 -0
  100. package/dist/types/MobileUnsupportedNotificationRouteError.d.ts +2 -0
  101. package/dist/types/MobileUnsupportedNotificationRouteError.js +18 -0
  102. package/dist/types/MobileUnsupportedNotificationRouteError.js.map +1 -0
  103. package/dist/types/clientTypes.d.cts +2 -2
  104. package/dist/types/clientTypes.d.ts +2 -2
  105. package/dist/types/index.cjs +4 -0
  106. package/dist/types/index.d.cts +8 -9
  107. package/dist/types/index.d.ts +8 -9
  108. package/dist/types/index.js +3 -2
  109. package/dist/types/mobileErrorCodes.cjs +11 -1
  110. package/dist/types/mobileErrorCodes.cjs.map +1 -1
  111. package/dist/types/mobileErrorCodes.d.cts +1 -1
  112. package/dist/types/mobileErrorCodes.d.ts +1 -1
  113. package/dist/types/mobileErrorCodes.js +11 -1
  114. package/dist/types/mobileErrorCodes.js.map +1 -1
  115. package/dist/types/serverBaseTypes.d.cts +1 -1
  116. package/dist/types/serverBaseTypes.d.ts +1 -1
  117. package/dist/types/serverExecuteTypes.d.cts +2 -2
  118. package/dist/types/serverExecuteTypes.d.ts +2 -2
  119. package/dist/types/serverModelTypes.cjs +15 -0
  120. package/dist/types/serverModelTypes.cjs.map +1 -1
  121. package/dist/types/serverModelTypes.d.cts +2 -2
  122. package/dist/types/serverModelTypes.d.ts +2 -2
  123. package/dist/types/serverModelTypes.js +14 -1
  124. package/dist/types/serverModelTypes.js.map +1 -1
  125. package/dist/types/serverQueryTypes.d.cts +2 -2
  126. package/dist/types/serverQueryTypes.d.ts +2 -2
  127. package/dist/types/serverRequestTypes.d.cts +2 -2
  128. package/dist/types/serverRequestTypes.d.ts +2 -2
  129. package/dist/types-CByl_NyJ.d.ts +825 -0
  130. package/dist/types-CByl_NyJ.d.ts.map +1 -0
  131. package/dist/types-CR5iaKR4.d.cts +825 -0
  132. package/dist/types-CR5iaKR4.d.cts.map +1 -0
  133. package/dist/utils/buildMobileFeedImageMultipart.cjs +31 -0
  134. package/dist/utils/buildMobileFeedImageMultipart.cjs.map +1 -0
  135. package/dist/utils/buildMobileFeedImageMultipart.d.cts +15 -0
  136. package/dist/utils/buildMobileFeedImageMultipart.d.cts.map +1 -0
  137. package/dist/utils/buildMobileFeedImageMultipart.d.ts +15 -0
  138. package/dist/utils/buildMobileFeedImageMultipart.d.ts.map +1 -0
  139. package/dist/utils/buildMobileFeedImageMultipart.js +30 -0
  140. package/dist/utils/buildMobileFeedImageMultipart.js.map +1 -0
  141. package/dist/utils/feed.cjs +12 -0
  142. package/dist/utils/feed.cjs.map +1 -1
  143. package/dist/utils/feed.d.cts +2 -2
  144. package/dist/utils/feed.d.ts +2 -2
  145. package/dist/utils/feed.js +11 -1
  146. package/dist/utils/feed.js.map +1 -1
  147. package/dist/utils/index.cjs +3 -1
  148. package/dist/utils/index.d.cts +3 -3
  149. package/dist/utils/index.d.ts +3 -3
  150. package/dist/utils/index.js +2 -2
  151. package/dist/utils/serverResponseGuards.d.cts +1 -1
  152. package/dist/utils/serverResponseGuards.d.ts +1 -1
  153. package/package.json +3 -3
  154. package/src/MobileClient.ts +444 -19
  155. package/src/dataMappers.test.ts +511 -6
  156. package/src/dataMappers.ts +325 -24
  157. package/src/feedImages.test.ts +309 -0
  158. package/src/notifications.test.ts +950 -0
  159. package/src/signing/canonicalize.ts +72 -0
  160. package/src/signing/eip712MethodByType.ts +10 -0
  161. package/src/signing/signing.test.ts +67 -1
  162. package/src/signing/types.ts +55 -9
  163. package/src/socialFeed.test.ts +63 -2
  164. package/src/types/MobileUnsupportedNotificationRouteError.ts +16 -0
  165. package/src/types/clientTypes.ts +427 -36
  166. package/src/types/index.ts +1 -0
  167. package/src/types/mobileErrorCodes.ts +10 -0
  168. package/src/types/serverExecuteTypes.ts +22 -10
  169. package/src/types/serverModelTypes.ts +216 -11
  170. package/src/types/serverQueryTypes.ts +106 -9
  171. package/src/types/serverRequestTypes.ts +114 -17
  172. package/src/utils/buildMobileFeedImageMultipart.test.ts +45 -0
  173. package/src/utils/buildMobileFeedImageMultipart.ts +36 -0
  174. package/src/utils/feed.ts +16 -0
  175. package/dist/MobileClient-CfVZXTcz.cjs.map +0 -1
  176. package/dist/MobileServerFailureError-BZVwlsMg.d.ts.map +0 -1
  177. package/dist/MobileServerFailureError-CbtK8kD4.d.cts.map +0 -1
  178. package/dist/canonicalize-5eeZrkzQ.d.ts.map +0 -1
  179. package/dist/canonicalize-CBaZprTo.d.cts.map +0 -1
  180. package/dist/clientTypes-C9dJufxk.d.ts.map +0 -1
  181. package/dist/clientTypes-_mEgzmNs.d.cts.map +0 -1
  182. package/dist/eip712MethodByType-D8jLoxDu.d.cts.map +0 -1
  183. package/dist/eip712MethodByType-DcUh8h-l.d.ts.map +0 -1
  184. package/dist/feed-DTJlsg8W.d.cts +0 -14
  185. package/dist/feed-DTJlsg8W.d.cts.map +0 -1
  186. package/dist/feed-DTJlsg8W.d.ts +0 -14
  187. package/dist/feed-DTJlsg8W.d.ts.map +0 -1
  188. package/dist/mobileErrorCodes-CmjYEIYm.d.cts.map +0 -1
  189. package/dist/mobileErrorCodes-CmjYEIYm.d.ts.map +0 -1
  190. package/dist/payloadHash-DhHmgRqL.d.cts.map +0 -1
  191. package/dist/payloadHash-E1_8fpLW.d.ts.map +0 -1
  192. package/dist/serverBaseTypes-B5J1_TyC.d.cts +0 -25
  193. package/dist/serverBaseTypes-B5J1_TyC.d.cts.map +0 -1
  194. package/dist/serverBaseTypes-DnLzsdm-.d.ts +0 -25
  195. package/dist/serverBaseTypes-DnLzsdm-.d.ts.map +0 -1
  196. package/dist/serverExecuteTypes-B-OJok19.d.cts.map +0 -1
  197. package/dist/serverExecuteTypes-BwWGspOg.d.ts.map +0 -1
  198. package/dist/serverModelTypes-CiA-dy1R.d.cts.map +0 -1
  199. package/dist/serverModelTypes-CiA-dy1R.d.ts.map +0 -1
  200. package/dist/serverQueryTypes-CJcjLB7n.d.ts +0 -283
  201. package/dist/serverQueryTypes-CJcjLB7n.d.ts.map +0 -1
  202. package/dist/serverQueryTypes-V1f9yE7L.d.cts +0 -283
  203. package/dist/serverQueryTypes-V1f9yE7L.d.cts.map +0 -1
  204. package/dist/serverRequestTypes-CRlkNSu5.d.cts +0 -270
  205. package/dist/serverRequestTypes-CRlkNSu5.d.cts.map +0 -1
  206. package/dist/serverRequestTypes-DZoOhV2o.d.ts +0 -270
  207. package/dist/serverRequestTypes-DZoOhV2o.d.ts.map +0 -1
  208. package/dist/types-BiRmH5Iv.d.cts +0 -108
  209. package/dist/types-BiRmH5Iv.d.cts.map +0 -1
  210. package/dist/types-DoJuq0Ij.d.ts +0 -108
  211. package/dist/types-DoJuq0Ij.d.ts.map +0 -1
@@ -1,10 +1,14 @@
1
- import { mapMobileAvatarPreset, mapMobileAvatarSelectionToServer, mapMobileAvatarUpload, mapMobileFeedPage, mapMobileFollowBatchResult, mapMobileFollowListPage, mapMobileFollowListParamsToServer, mapMobileFollowMutationResult, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobileProfileSearchPage, mapMobileProfileSearchParamsToServer, mapMobileProfilesIncludeToServer, mapMobilePublicProfile, mapMobileRegisteredWallet, mapMobileSocialFeedActionResolutionResult, mapMobileSocialFeedCommentResult, mapMobileSocialFeedCommentsPage, mapMobileSocialFeedDrawingMutationResult, mapMobileSocialFeedDrawingResult, mapMobileSocialFeedItem, mapMobileSocialFeedItemResponse, mapMobileSocialFeedLikeResult, mapMobileSocialFeedListParamsToServer, mapMobileSocialFeedMentionToServer, mapMobileSocialFeedPage, mapMobileSocialFeedPositionChart, mapMobileSocialFeedPositionHistory, mapMobileSocialFeedPositionResolutionResult, mapMobileSocialFeedPositionsPage, mapMobileSocialFeedPresence, mapMobileSocialFeedRankedPage, mapMobileSocialFeedReadParamsToServer, mapMobileSocialFeedTopTradersPage, mapMobileSocialFeedUpdates, mapMobileSocialFeedViewsResult, mapMobileSocialFeedWatchers } from "./dataMappers.js";
1
+ import { mapMobileAvatarPreset, mapMobileAvatarSelectionToServer, mapMobileAvatarUpload, mapMobileFeedPage, mapMobileFollowBatchResult, mapMobileFollowListPage, mapMobileFollowListParamsToServer, mapMobileFollowMutationResult, mapMobileNotificationCapabilitiesToServer, mapMobileNotificationInboxV2, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobileNotificationRegistrationV2, mapMobileNotificationSettingsToServer, mapMobileNotificationSettingsV2, mapMobileNotificationSubscriptions, mapMobileNotificationSubscriptionsUpdateToServer, mapMobileProductEventToServer, mapMobileProfileSearchPage, mapMobileProfileSearchParamsToServer, mapMobileProfilesIncludeToServer, mapMobilePublicProfile, mapMobileRegisteredWallet, mapMobileSocialFeedActionResolutionResult, mapMobileSocialFeedCommentResult, mapMobileSocialFeedCommentsPage, mapMobileSocialFeedDrawingMutationResult, mapMobileSocialFeedDrawingResult, mapMobileSocialFeedItem, mapMobileSocialFeedItemResponse, mapMobileSocialFeedLikeResult, mapMobileSocialFeedListParamsToServer, mapMobileSocialFeedMentionToServer, mapMobileSocialFeedPage, mapMobileSocialFeedPositionChart, mapMobileSocialFeedPositionHistory, mapMobileSocialFeedPositionResolutionResult, mapMobileSocialFeedPositionThoughts, mapMobileSocialFeedPositionsPage, mapMobileSocialFeedPresence, mapMobileSocialFeedRankedPage, mapMobileSocialFeedReadParamsToServer, mapMobileSocialFeedTopTradersPage, mapMobileSocialFeedUpdates, mapMobileSocialFeedUploadedImage, mapMobileSocialFeedWatchers } from "./dataMappers.js";
2
+ import { getMobileNonce } from "./signing/nonce.js";
2
3
  import { buildSignedMobileRequest } from "./signing/buildSignedMobileRequest.js";
3
4
  import "./signing/index.js";
4
5
  import { MobileServerFailureError } from "./types/MobileServerFailureError.js";
6
+ import { buildMobileFeedImageMultipart } from "./utils/buildMobileFeedImageMultipart.js";
7
+ import { MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES } from "./utils/feed.js";
5
8
  import { isMobileServerFailureResponse, isMobileServerSuccessResponse } from "./utils/serverResponseGuards.js";
6
9
  import { WalletNotProvidedError, getNadoClientTypeHeaders, subaccountToHex } from "@nadohq/shared";
7
10
  import axios from "axios";
11
+ import { bytesToString, keccak256, zeroHash } from "viem";
8
12
  //#region src/MobileClient.ts
9
13
  /**
10
14
  * Client for the Nado mobile service API: usernames, bios, avatars, public profile lookups, the global
@@ -255,6 +259,7 @@ var MobileClient = class {
255
259
  /**
256
260
  * Reads one item visible to viewAs, including that account's own hidden content.
257
261
  * Creates an item session directly when sessionId is omitted.
262
+ * Reading does not increment views; use {@link recordFeedViews} independently when reporting views.
258
263
  * @param params - Item UUID, preview limit, and optional existing session/read identity.
259
264
  * @returns The complete item and authorized reading session.
260
265
  * @throws {MobileServerFailureError} On inaccessible content or session mismatch/expiry.
@@ -301,6 +306,7 @@ var MobileClient = class {
301
306
  *
302
307
  * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is
303
308
  * not currently registered to a wallet.
309
+ * @deprecated Use {@link getNotificationSettingsV2} instead.
304
310
  */
305
311
  async getNotificationPreferences(params) {
306
312
  const body = {
@@ -393,11 +399,48 @@ var MobileClient = class {
393
399
  return mapMobileSocialFeedDrawingResult(await this.publicQuery(body));
394
400
  }
395
401
  /**
396
- * Reads a comment thread with an optional anchor and bidirectional pagination.
402
+ * Resolves a backend feed image path against this client's mobile gateway URL.
403
+ * @param path - Backend path from image metadata, rooted at /v1/mobile or the mobile service root.
404
+ * @returns An absolute URL suitable for authenticated fetches.
405
+ */
406
+ resolveFeedImageUrl(path) {
407
+ return `${this.opts.url}${path.replace(/^\/v1\/mobile(?=\/)/, "")}`;
408
+ }
409
+ /**
410
+ * Prepares a protected image request for native image components without downloading or encoding bytes.
411
+ * Does not increment view counts.
412
+ * @param params - Image path from metadata plus the original session credentials.
413
+ * @returns Absolute URL and headers; pass them as the image source's URI and headers.
414
+ */
415
+ getFeedImageRequest(params) {
416
+ return {
417
+ url: this.resolveFeedImageUrl(params.path),
418
+ headers: {
419
+ "x-feed-session-id": params.sessionId,
420
+ "x-feed-viewer-token": params.viewerToken
421
+ }
422
+ };
423
+ }
424
+ /**
425
+ * Fetches protected feed image bytes using the reading session that fully delivered the parent item.
426
+ * Does not increment view counts.
427
+ * @param params - Image path from metadata plus the original session credentials.
428
+ * @returns Raw image bytes.
429
+ * @throws {MobileServerFailureError} On session, permission, or availability errors.
430
+ */
431
+ async getFeedImageBytes(params) {
432
+ const { url, headers } = this.getFeedImageRequest(params);
433
+ return this.publicGetBytes(url, headers);
434
+ }
435
+ /**
436
+ * Reads top-level comment groups with all readable descendants and bidirectional pagination.
437
+ * The limit counts groups, not descendants. Groups are newest first; their flat replies are oldest first,
438
+ * with depth then UUID breaking timestamp ties. An anchor at any depth selects its top-level group.
439
+ * Preview cursors open the first complete group page in the same snapshot; do not prepend preview items.
397
440
  * Independent reads create a public-only session; reused sessions retain their original scope.
398
- * @param params - Root item, optional anchor or cursor (mutually exclusive), page size, and read perspective.
441
+ * @param params - Root item, optional anchor or cursor (mutually exclusive), group limit, and read perspective.
399
442
  * Paging requires the original session and viewer token.
400
- * @returns Replies, total count, forward and backward cursors, the anchor, and the actual reading session.
443
+ * @returns Complete comment groups, whole-thread reply and top-level counts, cursors, anchor, and session.
401
444
  * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,
402
445
  * or unavailable data. Restart pagination with a new session after expiry; do not reuse the old cursor.
403
446
  */
@@ -420,7 +463,8 @@ var MobileClient = class {
420
463
  * the original position session and viewer token, not a feed session.
421
464
  * @returns Position metrics, ordered action/take history, summary, trading hints, cursor, and reading session.
422
465
  * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,
423
- * or unavailable source data. Restart with a new position session after expiry.
466
+ * unavailable source data, or SOCIAL_FEED_HISTORY_TOO_LARGE when the initial directory exceeds capacity.
467
+ * Restart with a new position session after expiry.
424
468
  * @throws {MobileUnsupportedFeedItemError} If a timeline entry or take has an unsupported kind.
425
469
  */
426
470
  async getPositionHistory(params) {
@@ -436,6 +480,47 @@ var MobileClient = class {
436
480
  return mapMobileSocialFeedPositionHistory(await this.publicQuery(body));
437
481
  }
438
482
  /**
483
+ * Reads the most recent 500 lifecycle actions, without authored text, drawings, or images.
484
+ * Creates a new position session on every call. A null nextCursor means no pagination, not complete
485
+ * history; use getPositionHistory with a fresh session for the full lifecycle. takeCount is always zero.
486
+ * @param params - Position and read perspective; an existing viewer token may be reused.
487
+ * @returns Position metrics, owner, recent actions, response-scope counts, trading hints, and a new session.
488
+ * @throws {MobileServerFailureError} On invalid parameters, inaccessible content, unavailable data,
489
+ * or SOCIAL_FEED_HISTORY_TOO_LARGE when the initial directory exceeds capacity.
490
+ * @throws {MobileUnsupportedFeedItemError} If a timeline entry or take has an unsupported kind.
491
+ */
492
+ async getPositionHistoryAll(params) {
493
+ const body = {
494
+ type: "position_history_all",
495
+ position_id: params.positionId,
496
+ ...mapMobileSocialFeedReadParamsToServer(params)
497
+ };
498
+ return mapMobileSocialFeedPositionHistory(await this.publicQuery(body));
499
+ }
500
+ /**
501
+ * Reads published position thoughts with both nonblank text and a saved drawing, without signing.
502
+ * Keeps descending drawing creation time / item UUID order; editing a drawing does not move the item.
503
+ * Continue until nextCursor is null, even after an empty page. There is no 500-item total cap.
504
+ * Keep positionId, limit, sessionId, and viewerToken unchanged when paging; omitted viewAs inherits
505
+ * the session. History/feed sessions cannot be substituted. Refresh to include newly eligible content.
506
+ * @param params - Position, page size, read perspective, and original thoughts-session credentials for paging.
507
+ * @returns Complete thoughts and drawings in server order, a continuation cursor, and the reading session.
508
+ * @throws {MobileServerFailureError} On invalid parameters, session mismatch/expiry, inaccessible content,
509
+ * unavailable source data, or SOCIAL_FEED_HISTORY_TOO_LARGE when the initial directory exceeds capacity.
510
+ * @throws {MobileUnsupportedFeedItemError} If an item is not a post or trade card.
511
+ */
512
+ async getPositionThoughts(params) {
513
+ const body = {
514
+ type: "position_thoughts",
515
+ position_id: params.positionId,
516
+ limit: params.limit,
517
+ session_id: params.sessionId,
518
+ cursor: params.cursor,
519
+ ...mapMobileSocialFeedReadParamsToServer(params)
520
+ };
521
+ return mapMobileSocialFeedPositionThoughts(await this.publicQuery(body));
522
+ }
523
+ /**
439
524
  * Reads candles and action markers without creating a reading session.
440
525
  * Preserve the original range, interval, and read perspective when paging with nextBeforeMs.
441
526
  * @param params - Position, candle interval, half-open time range, pagination, and optional original session
@@ -475,6 +560,57 @@ var MobileClient = class {
475
560
  return mapMobileSocialFeedWatchers(await this.publicQuery(body));
476
561
  }
477
562
  /**
563
+ * Reads the token's latest registration generation and saved capabilities, including legacy v1 registrations.
564
+ * @param params - Active Expo token credential; no wallet signature is needed.
565
+ * @returns Saved generation as an opaque string and the complete capability declaration.
566
+ * @throws {MobileServerFailureError} If the token is invalid or inactive (`INVALID_EXPO_TOKEN`).
567
+ */
568
+ async getNotificationRegistrationV2(params) {
569
+ return mapMobileNotificationRegistrationV2(await this.publicQuery({
570
+ type: "notification_registration_v2",
571
+ expo_token: params.expoToken
572
+ }));
573
+ }
574
+ /**
575
+ * Reads the wallet's full v2 settings document, including legacy preference mappings.
576
+ * @param params - Active Expo token credential. Before displaying settings, compare the wallet returned by
577
+ * {@link MobileClient.getRegisteredWallet} with the connected wallet (case-insensitively).
578
+ * @returns CamelCase settings with the current settings revision.
579
+ * @throws {MobileServerFailureError} If the token is invalid or inactive (`INVALID_EXPO_TOKEN`).
580
+ */
581
+ async getNotificationSettingsV2(params) {
582
+ return mapMobileNotificationSettingsV2(await this.publicQuery({
583
+ type: "notification_settings_v2",
584
+ expo_token: params.expoToken
585
+ }));
586
+ }
587
+ /**
588
+ * Reads wallet market subscriptions and the signing Identity's enabled trader bells.
589
+ * @param params - Wallet authentication context; no Expo token is needed.
590
+ * @returns Subscriptions, import state, and the independent subscription revision.
591
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
592
+ * @throws {MobileServerFailureError} If authentication or the query fails.
593
+ */
594
+ async getNotificationSubscriptions(params) {
595
+ const request = await this.getSignedRequest("notification_subscriptions", params, {});
596
+ return mapMobileNotificationSubscriptions(await this.query(request));
597
+ }
598
+ /**
599
+ * Reads private accepted notification intents, not delivery receipts or read states.
600
+ * @param params - Wallet authentication and optional cursor/page size (1-50, default 20).
601
+ * @returns A camelCase page; discard cached pages and cursors when switching wallets.
602
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
603
+ * @throws {MobileServerFailureError} If authentication or pagination validation fails.
604
+ * @throws {MobileUnsupportedNotificationRouteError} If a notification has an unsupported route name.
605
+ */
606
+ async getNotificationInboxV2(params) {
607
+ const request = await this.getSignedRequest("notification_inbox_v2", params, {
608
+ cursor: params.cursor ?? null,
609
+ limit: params.limit ?? null
610
+ });
611
+ return mapMobileNotificationInboxV2(await this.query(request));
612
+ }
613
+ /**
478
614
  * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout
479
615
  * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown
480
616
  * well-formed token succeeds.
@@ -502,6 +638,7 @@ var MobileClient = class {
502
638
  *
503
639
  * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated, or
504
640
  * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.
641
+ * @deprecated Use {@link updateNotificationSettingsV2} instead.
505
642
  */
506
643
  async updateNotificationPreferences(params) {
507
644
  const body = {
@@ -512,22 +649,36 @@ var MobileClient = class {
512
649
  return this.publicExecute(body);
513
650
  }
514
651
  /**
515
- * Reports qualified exposures without signing. Ordinary reads and root previews do not count as exposures.
516
- * The caller must satisfy the session's viewTracking requirements before reporting an item.
517
- * @param params - Original reading session and viewer token, plus one to fifty fully delivered, readable,
518
- * interactive item IDs. The service deduplicates repeated exposures.
519
- * @returns Separate lists of newly accepted and already-counted item IDs.
520
- * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, or any ineligible item.
521
- * A rejected batch is not partially counted. Acquire a new session after expiry and re-evaluate exposure eligibility.
652
+ * Replaces all v2 settings fields using optimistic concurrency; legacy overlapping preferences are synced.
653
+ * @param params - Active Expo token, latest settings revision, and complete replacement settings.
654
+ * @returns The saved settings document with its incremented revision.
655
+ * @throws {MobileServerFailureError} On invalid token/settings or revision conflict (`NOTIFICATION_REVISION_CONFLICT`). Re-read and
656
+ * merge only the user's current change before retrying; never blindly replay a stale document.
657
+ */
658
+ async updateNotificationSettingsV2(params) {
659
+ return mapMobileNotificationSettingsV2(await this.publicExecute({
660
+ type: "update_notification_settings_v2",
661
+ expo_token: params.expoToken,
662
+ expected_revision: params.expectedRevision,
663
+ settings: mapMobileNotificationSettingsToServer(params.settings)
664
+ }));
665
+ }
666
+ /**
667
+ * Reports views for posts, trade cards, comments, and replies without signing or a reading session.
668
+ * Duplicate IDs count once within a request; another request increments them again. Only supplied IDs
669
+ * count, not their parents. Missing, deleted, unpublished, excluded, or unsupported targets are skipped.
670
+ * A successful response does not identify skipped items. Read interaction.viewCount for current counts.
671
+ * This operation is not idempotent: retrying an uncertain result may count twice. No automatic retry is made.
672
+ * @param params - itemIds: 1–50 canonical lowercase item UUIDs, including any same-request duplicates.
673
+ * @returns Only the success status, even when every target was skipped.
674
+ * @throws {MobileServerFailureError} On invalid parameters, disabled writes, rate limiting, or unavailable data.
522
675
  */
523
676
  async recordFeedViews(params) {
524
677
  const body = {
525
678
  type: "record_feed_views",
526
- session_id: params.sessionId,
527
- item_ids: params.itemIds,
528
- viewer_token: params.viewerToken
679
+ item_ids: params.itemIds
529
680
  };
530
- return mapMobileSocialFeedViewsResult(await this.publicExecute(body));
681
+ return this.publicExecute(body);
531
682
  }
532
683
  /**
533
684
  * Registers, renews, or leaves a page lease without signing or authenticating the displayed account.
@@ -616,11 +767,13 @@ var MobileClient = class {
616
767
  }
617
768
  /**
618
769
  * Registers an Expo push token for the wallet, transferring active ownership of the token if another
619
- * wallet had registered it. Idempotent per `(wallet, token)`.
770
+ * wallet had registered it. Each registration advances its generation and cancels old pending deliveries.
771
+ * This legacy method replaces capabilities with v1; use registerExpoTokenV2 consistently after upgrading.
620
772
  *
621
773
  * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is not a valid Expo
622
774
  * push token, or `INVALID_DEVICE_METADATA` if `locale` (max 35 chars) or `appVersion` (max 64 chars) is
623
775
  * too long.
776
+ * @deprecated Use {@link registerExpoTokenV2} instead.
624
777
  */
625
778
  async registerExpoToken(params) {
626
779
  const signedRequest = await this.getSignedRequest("register_expo_token", params, {
@@ -632,6 +785,47 @@ var MobileClient = class {
632
785
  return this.execute(signedRequest);
633
786
  }
634
787
  /**
788
+ * Registers a device with its actual v2 capabilities; do not use repeated registration as a heartbeat.
789
+ * @param params - Wallet authentication, Expo token, metadata, and supported notification types/routes.
790
+ * @returns Success only; query registration separately for its new generation.
791
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
792
+ * @throws {MobileServerFailureError} On `INVALID_EXPO_TOKEN`, `INVALID_DEVICE_METADATA`,
793
+ * `NOTIFICATION_DEVICE_LIMIT` when the wallet already has 32 active devices, or authentication errors.
794
+ */
795
+ async registerExpoTokenV2(params) {
796
+ const request = await this.getSignedRequest("register_expo_token_v2", params, {
797
+ expo_token: params.expoToken,
798
+ platform: params.platform,
799
+ locale: params.locale ?? null,
800
+ app_version: params.appVersion ?? null,
801
+ capabilities: mapMobileNotificationCapabilitiesToServer(params.capabilities)
802
+ });
803
+ return this.execute(request);
804
+ }
805
+ /**
806
+ * Applies exactly one bell, market, or one-time favorites-import operation.
807
+ * @param params - Wallet authentication and subscription update with the latest subscription revision.
808
+ * @returns Success only; re-query subscriptions for the new revision even after a repeated ON/OFF.
809
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
810
+ * @throws {MobileServerFailureError} On `NOTIFICATION_REVISION_CONFLICT`, `INVALID_NOTIFICATION_REQUEST`, or
811
+ * `INVALID_IDENTITY_TARGET`.
812
+ */
813
+ async updateNotificationSubscriptions(params) {
814
+ const request = await this.getSignedRequest("update_notification_subscriptions", params, mapMobileNotificationSubscriptionsUpdateToServer(params.update));
815
+ return this.execute(request);
816
+ }
817
+ /**
818
+ * Atomically records 1-50 analytics events after the user has consented to analytics.
819
+ * @param params - Wallet authentication and events with stable UUIDs and actual millisecond timestamps.
820
+ * @returns Success only; reuse event IDs on retries. Notification clicks do not mark an inbox item as read.
821
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
822
+ * @throws {MobileServerFailureError} If any event, timestamp, batch size, or notification ownership is invalid.
823
+ */
824
+ async recordProductEvents(params) {
825
+ const request = await this.getSignedRequest("record_product_events", params, { events: params.events.map(mapMobileProductEventToServer) });
826
+ return this.execute(request);
827
+ }
828
+ /**
635
829
  * Sets whether the signing subaccount follows a Profile. Both directions are idempotent: following again
636
830
  * keeps the original relationship creation time, so it does not move the account in recency order, and
637
831
  * unfollowing a relationship that does not exist succeeds with `isFollowing: false`. Unfollowing deletes
@@ -696,11 +890,42 @@ var MobileClient = class {
696
890
  action_id: params.actionId,
697
891
  text: params.text,
698
892
  mentions: params.mentions.map(mapMobileSocialFeedMentionToServer),
699
- drawing_data_json: params.drawingDataJson
893
+ drawing_data_json: params.drawingDataJson,
894
+ image_ids: params.imageIds,
895
+ image_urls: params.imageUrls
700
896
  });
701
897
  return mapMobileSocialFeedItem((await this.execute(request)).item);
702
898
  }
703
899
  /**
900
+ * Uploads one static JPEG/PNG for a later {@link createFeedPost} via multipart execute.
901
+ * The whole HTTP request must stay within 2 MiB including signature overhead; upload one file per call
902
+ * and bind up to nine ready IDs at publication. There is no complete/PUT step — success means ready.
903
+ * @param params - Author subaccount and signing options, plus the original file bytes.
904
+ * @returns Ready image metadata, including original and thumbnail paths.
905
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
906
+ * @throws {RangeError} If the complete multipart request exceeds {@link MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES}.
907
+ * @throws {MobileServerFailureError} On authentication, format/size/hash errors (`INVALID_SOCIAL_FEED_IMAGE`),
908
+ * or when publishing is disabled (`SERVICE_UNAVAILABLE`), or image storage is unavailable
909
+ * (`SOCIAL_FEED_DATA_UNAVAILABLE`, 6320, HTTP 503).
910
+ */
911
+ async createFeedPostImageUpload(params) {
912
+ return this.createFeedImageUpload("create_feed_post_image_uploads", params);
913
+ }
914
+ /**
915
+ * Uploads one static JPEG/PNG for a later {@link createFeedComment} via multipart execute.
916
+ * Same size and readiness rules as {@link createFeedPostImageUpload}; comment text remains required.
917
+ * @param params - Author subaccount and signing options, plus the original file bytes.
918
+ * @returns Ready image metadata, including original and thumbnail paths.
919
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
920
+ * @throws {RangeError} If the complete multipart request exceeds {@link MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES}.
921
+ * @throws {MobileServerFailureError} On authentication, format/size/hash errors (`INVALID_SOCIAL_FEED_IMAGE`),
922
+ * or when comments are disabled (`SERVICE_UNAVAILABLE`), or image storage is unavailable
923
+ * (`SOCIAL_FEED_DATA_UNAVAILABLE`, 6320, HTTP 503).
924
+ */
925
+ async createFeedCommentImageUpload(params) {
926
+ return this.createFeedImageUpload("create_feed_comment_image_uploads", params);
927
+ }
928
+ /**
704
929
  * First attaches a drawing to an owned post or trade card while the author still holds its position.
705
930
  * The original JSON is signed unchanged; false and zero are valid drawing documents.
706
931
  * For an exact retry after a timeout, generate a nonce up front with {@link getMobileNonce} and reuse
@@ -756,7 +981,9 @@ var MobileClient = class {
756
981
  reply_to_item_id: params.replyToItemId,
757
982
  text: params.text,
758
983
  mentions: params.mentions.map(mapMobileSocialFeedMentionToServer),
759
- attached_position_id: params.attachedPositionId
984
+ attached_position_id: params.attachedPositionId,
985
+ image_ids: params.imageIds,
986
+ image_urls: params.imageUrls
760
987
  });
761
988
  return mapMobileSocialFeedCommentResult(await this.execute(request));
762
989
  }
@@ -798,18 +1025,73 @@ var MobileClient = class {
798
1025
  this.checkServerStatus(response);
799
1026
  return response.data;
800
1027
  }
1028
+ async publicGetBytes(url, headers) {
1029
+ const response = await this.axiosInstance.get(url, {
1030
+ responseType: "arraybuffer",
1031
+ headers
1032
+ });
1033
+ if (response.status < 200 || response.status >= 300) {
1034
+ const responseText = bytesToString(new Uint8Array(response.data));
1035
+ let errorData;
1036
+ try {
1037
+ errorData = JSON.parse(responseText);
1038
+ } catch {
1039
+ errorData = responseText;
1040
+ }
1041
+ this.checkResponseStatus({
1042
+ ...response,
1043
+ data: errorData
1044
+ });
1045
+ }
1046
+ return new Uint8Array(response.data);
1047
+ }
801
1048
  async publicExecute(body) {
802
1049
  const response = await this.axiosInstance.post(`${this.opts.url}/public_execute`, body);
803
1050
  this.checkResponseStatus(response);
804
1051
  this.checkServerStatus(response);
805
1052
  return response.data;
806
1053
  }
807
- async execute(body) {
808
- const response = await this.axiosInstance.post(`${this.opts.url}/execute`, body);
1054
+ /**
1055
+ * Sends an authenticated read through the signed query route.
1056
+ * @param body - Canonical inner payload with its signature, sender, and nonce.
1057
+ * @returns The successful query envelope and its type-specific payload.
1058
+ * @throws {MobileServerFailureError} For a structured service failure, including non-2xx responses.
1059
+ */
1060
+ async query(body) {
1061
+ const response = await this.axiosInstance.post(`${this.opts.url}/query`, body);
1062
+ this.checkResponseStatus(response);
1063
+ this.checkServerStatus(response);
1064
+ return response.data;
1065
+ }
1066
+ async execute(body, fileBytes) {
1067
+ const multipart = fileBytes == null ? void 0 : buildMobileFeedImageMultipart(JSON.stringify(body), fileBytes);
1068
+ if (multipart) this.checkFeedImageRequestSize(multipart.body.byteLength);
1069
+ const response = await this.axiosInstance.post(`${this.opts.url}/execute`, multipart?.body ?? body, multipart ? { headers: { "Content-Type": multipart.contentType } } : void 0);
809
1070
  this.checkResponseStatus(response);
810
1071
  this.checkServerStatus(response);
811
1072
  return response.data;
812
1073
  }
1074
+ async createFeedImageUpload(type, params) {
1075
+ const nonce = params.nonce ?? getMobileNonce();
1076
+ const sizePayload = {
1077
+ type,
1078
+ content_hash: zeroHash,
1079
+ signature: `0x${"00".repeat(65)}`,
1080
+ sender: subaccountToHex(params),
1081
+ nonce: nonce.toString()
1082
+ };
1083
+ const overhead = buildMobileFeedImageMultipart(JSON.stringify(sizePayload), new Uint8Array()).body.byteLength;
1084
+ this.checkFeedImageRequestSize(overhead + params.fileBytes.byteLength);
1085
+ const contentHash = keccak256(params.fileBytes);
1086
+ const request = await this.getSignedRequest(type, {
1087
+ ...params,
1088
+ nonce
1089
+ }, { content_hash: contentHash });
1090
+ return mapMobileSocialFeedUploadedImage((await this.execute(request, params.fileBytes)).image);
1091
+ }
1092
+ checkFeedImageRequestSize(byteLength) {
1093
+ if (byteLength > 2097152) throw new RangeError(`Feed image upload request exceeds ${MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES} bytes (2 MiB).`);
1094
+ }
813
1095
  /**
814
1096
  * Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns
815
1097
  * failure envelopes with non-2xx statuses (e.g. 404 for `PROFILE_NOT_FOUND`), so a non-2xx response with a