@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
@@ -21,12 +21,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  }) : target, mod));
22
22
  //#endregion
23
23
  const require_dataMappers = require("./dataMappers.cjs");
24
+ const require_signing_nonce = require("./signing/nonce.cjs");
24
25
  const require_signing_buildSignedMobileRequest = require("./signing/buildSignedMobileRequest.cjs");
25
26
  const require_types_MobileServerFailureError = require("./types/MobileServerFailureError.cjs");
27
+ const require_utils_buildMobileFeedImageMultipart = require("./utils/buildMobileFeedImageMultipart.cjs");
28
+ const require_utils_feed = require("./utils/feed.cjs");
26
29
  const require_utils_serverResponseGuards = require("./utils/serverResponseGuards.cjs");
27
30
  let _nadohq_shared = require("@nadohq/shared");
28
31
  let axios = require("axios");
29
32
  axios = __toESM(axios, 1);
33
+ let viem = require("viem");
30
34
  //#region src/MobileClient.ts
31
35
  /**
32
36
  * Client for the Nado mobile service API: usernames, bios, avatars, public profile lookups, the global
@@ -277,6 +281,7 @@ var MobileClient = class {
277
281
  /**
278
282
  * Reads one item visible to viewAs, including that account's own hidden content.
279
283
  * Creates an item session directly when sessionId is omitted.
284
+ * Reading does not increment views; use {@link recordFeedViews} independently when reporting views.
280
285
  * @param params - Item UUID, preview limit, and optional existing session/read identity.
281
286
  * @returns The complete item and authorized reading session.
282
287
  * @throws {MobileServerFailureError} On inaccessible content or session mismatch/expiry.
@@ -323,6 +328,7 @@ var MobileClient = class {
323
328
  *
324
329
  * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is
325
330
  * not currently registered to a wallet.
331
+ * @deprecated Use {@link getNotificationSettingsV2} instead.
326
332
  */
327
333
  async getNotificationPreferences(params) {
328
334
  const body = {
@@ -415,11 +421,48 @@ var MobileClient = class {
415
421
  return require_dataMappers.mapMobileSocialFeedDrawingResult(await this.publicQuery(body));
416
422
  }
417
423
  /**
418
- * Reads a comment thread with an optional anchor and bidirectional pagination.
424
+ * Resolves a backend feed image path against this client's mobile gateway URL.
425
+ * @param path - Backend path from image metadata, rooted at /v1/mobile or the mobile service root.
426
+ * @returns An absolute URL suitable for authenticated fetches.
427
+ */
428
+ resolveFeedImageUrl(path) {
429
+ return `${this.opts.url}${path.replace(/^\/v1\/mobile(?=\/)/, "")}`;
430
+ }
431
+ /**
432
+ * Prepares a protected image request for native image components without downloading or encoding bytes.
433
+ * Does not increment view counts.
434
+ * @param params - Image path from metadata plus the original session credentials.
435
+ * @returns Absolute URL and headers; pass them as the image source's URI and headers.
436
+ */
437
+ getFeedImageRequest(params) {
438
+ return {
439
+ url: this.resolveFeedImageUrl(params.path),
440
+ headers: {
441
+ "x-feed-session-id": params.sessionId,
442
+ "x-feed-viewer-token": params.viewerToken
443
+ }
444
+ };
445
+ }
446
+ /**
447
+ * Fetches protected feed image bytes using the reading session that fully delivered the parent item.
448
+ * Does not increment view counts.
449
+ * @param params - Image path from metadata plus the original session credentials.
450
+ * @returns Raw image bytes.
451
+ * @throws {MobileServerFailureError} On session, permission, or availability errors.
452
+ */
453
+ async getFeedImageBytes(params) {
454
+ const { url, headers } = this.getFeedImageRequest(params);
455
+ return this.publicGetBytes(url, headers);
456
+ }
457
+ /**
458
+ * Reads top-level comment groups with all readable descendants and bidirectional pagination.
459
+ * The limit counts groups, not descendants. Groups are newest first; their flat replies are oldest first,
460
+ * with depth then UUID breaking timestamp ties. An anchor at any depth selects its top-level group.
461
+ * Preview cursors open the first complete group page in the same snapshot; do not prepend preview items.
419
462
  * Independent reads create a public-only session; reused sessions retain their original scope.
420
- * @param params - Root item, optional anchor or cursor (mutually exclusive), page size, and read perspective.
463
+ * @param params - Root item, optional anchor or cursor (mutually exclusive), group limit, and read perspective.
421
464
  * Paging requires the original session and viewer token.
422
- * @returns Replies, total count, forward and backward cursors, the anchor, and the actual reading session.
465
+ * @returns Complete comment groups, whole-thread reply and top-level counts, cursors, anchor, and session.
423
466
  * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,
424
467
  * or unavailable data. Restart pagination with a new session after expiry; do not reuse the old cursor.
425
468
  */
@@ -442,7 +485,8 @@ var MobileClient = class {
442
485
  * the original position session and viewer token, not a feed session.
443
486
  * @returns Position metrics, ordered action/take history, summary, trading hints, cursor, and reading session.
444
487
  * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,
445
- * or unavailable source data. Restart with a new position session after expiry.
488
+ * unavailable source data, or SOCIAL_FEED_HISTORY_TOO_LARGE when the initial directory exceeds capacity.
489
+ * Restart with a new position session after expiry.
446
490
  * @throws {MobileUnsupportedFeedItemError} If a timeline entry or take has an unsupported kind.
447
491
  */
448
492
  async getPositionHistory(params) {
@@ -458,6 +502,47 @@ var MobileClient = class {
458
502
  return require_dataMappers.mapMobileSocialFeedPositionHistory(await this.publicQuery(body));
459
503
  }
460
504
  /**
505
+ * Reads the most recent 500 lifecycle actions, without authored text, drawings, or images.
506
+ * Creates a new position session on every call. A null nextCursor means no pagination, not complete
507
+ * history; use getPositionHistory with a fresh session for the full lifecycle. takeCount is always zero.
508
+ * @param params - Position and read perspective; an existing viewer token may be reused.
509
+ * @returns Position metrics, owner, recent actions, response-scope counts, trading hints, and a new session.
510
+ * @throws {MobileServerFailureError} On invalid parameters, inaccessible content, unavailable data,
511
+ * or SOCIAL_FEED_HISTORY_TOO_LARGE when the initial directory exceeds capacity.
512
+ * @throws {MobileUnsupportedFeedItemError} If a timeline entry or take has an unsupported kind.
513
+ */
514
+ async getPositionHistoryAll(params) {
515
+ const body = {
516
+ type: "position_history_all",
517
+ position_id: params.positionId,
518
+ ...require_dataMappers.mapMobileSocialFeedReadParamsToServer(params)
519
+ };
520
+ return require_dataMappers.mapMobileSocialFeedPositionHistory(await this.publicQuery(body));
521
+ }
522
+ /**
523
+ * Reads published position thoughts with both nonblank text and a saved drawing, without signing.
524
+ * Keeps descending drawing creation time / item UUID order; editing a drawing does not move the item.
525
+ * Continue until nextCursor is null, even after an empty page. There is no 500-item total cap.
526
+ * Keep positionId, limit, sessionId, and viewerToken unchanged when paging; omitted viewAs inherits
527
+ * the session. History/feed sessions cannot be substituted. Refresh to include newly eligible content.
528
+ * @param params - Position, page size, read perspective, and original thoughts-session credentials for paging.
529
+ * @returns Complete thoughts and drawings in server order, a continuation cursor, and the reading session.
530
+ * @throws {MobileServerFailureError} On invalid parameters, session mismatch/expiry, inaccessible content,
531
+ * unavailable source data, or SOCIAL_FEED_HISTORY_TOO_LARGE when the initial directory exceeds capacity.
532
+ * @throws {MobileUnsupportedFeedItemError} If an item is not a post or trade card.
533
+ */
534
+ async getPositionThoughts(params) {
535
+ const body = {
536
+ type: "position_thoughts",
537
+ position_id: params.positionId,
538
+ limit: params.limit,
539
+ session_id: params.sessionId,
540
+ cursor: params.cursor,
541
+ ...require_dataMappers.mapMobileSocialFeedReadParamsToServer(params)
542
+ };
543
+ return require_dataMappers.mapMobileSocialFeedPositionThoughts(await this.publicQuery(body));
544
+ }
545
+ /**
461
546
  * Reads candles and action markers without creating a reading session.
462
547
  * Preserve the original range, interval, and read perspective when paging with nextBeforeMs.
463
548
  * @param params - Position, candle interval, half-open time range, pagination, and optional original session
@@ -497,6 +582,57 @@ var MobileClient = class {
497
582
  return require_dataMappers.mapMobileSocialFeedWatchers(await this.publicQuery(body));
498
583
  }
499
584
  /**
585
+ * Reads the token's latest registration generation and saved capabilities, including legacy v1 registrations.
586
+ * @param params - Active Expo token credential; no wallet signature is needed.
587
+ * @returns Saved generation as an opaque string and the complete capability declaration.
588
+ * @throws {MobileServerFailureError} If the token is invalid or inactive (`INVALID_EXPO_TOKEN`).
589
+ */
590
+ async getNotificationRegistrationV2(params) {
591
+ return require_dataMappers.mapMobileNotificationRegistrationV2(await this.publicQuery({
592
+ type: "notification_registration_v2",
593
+ expo_token: params.expoToken
594
+ }));
595
+ }
596
+ /**
597
+ * Reads the wallet's full v2 settings document, including legacy preference mappings.
598
+ * @param params - Active Expo token credential. Before displaying settings, compare the wallet returned by
599
+ * {@link MobileClient.getRegisteredWallet} with the connected wallet (case-insensitively).
600
+ * @returns CamelCase settings with the current settings revision.
601
+ * @throws {MobileServerFailureError} If the token is invalid or inactive (`INVALID_EXPO_TOKEN`).
602
+ */
603
+ async getNotificationSettingsV2(params) {
604
+ return require_dataMappers.mapMobileNotificationSettingsV2(await this.publicQuery({
605
+ type: "notification_settings_v2",
606
+ expo_token: params.expoToken
607
+ }));
608
+ }
609
+ /**
610
+ * Reads wallet market subscriptions and the signing Identity's enabled trader bells.
611
+ * @param params - Wallet authentication context; no Expo token is needed.
612
+ * @returns Subscriptions, import state, and the independent subscription revision.
613
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
614
+ * @throws {MobileServerFailureError} If authentication or the query fails.
615
+ */
616
+ async getNotificationSubscriptions(params) {
617
+ const request = await this.getSignedRequest("notification_subscriptions", params, {});
618
+ return require_dataMappers.mapMobileNotificationSubscriptions(await this.query(request));
619
+ }
620
+ /**
621
+ * Reads private accepted notification intents, not delivery receipts or read states.
622
+ * @param params - Wallet authentication and optional cursor/page size (1-50, default 20).
623
+ * @returns A camelCase page; discard cached pages and cursors when switching wallets.
624
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
625
+ * @throws {MobileServerFailureError} If authentication or pagination validation fails.
626
+ * @throws {MobileUnsupportedNotificationRouteError} If a notification has an unsupported route name.
627
+ */
628
+ async getNotificationInboxV2(params) {
629
+ const request = await this.getSignedRequest("notification_inbox_v2", params, {
630
+ cursor: params.cursor ?? null,
631
+ limit: params.limit ?? null
632
+ });
633
+ return require_dataMappers.mapMobileNotificationInboxV2(await this.query(request));
634
+ }
635
+ /**
500
636
  * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout
501
637
  * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown
502
638
  * well-formed token succeeds.
@@ -524,6 +660,7 @@ var MobileClient = class {
524
660
  *
525
661
  * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated, or
526
662
  * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.
663
+ * @deprecated Use {@link updateNotificationSettingsV2} instead.
527
664
  */
528
665
  async updateNotificationPreferences(params) {
529
666
  const body = {
@@ -534,22 +671,36 @@ var MobileClient = class {
534
671
  return this.publicExecute(body);
535
672
  }
536
673
  /**
537
- * Reports qualified exposures without signing. Ordinary reads and root previews do not count as exposures.
538
- * The caller must satisfy the session's viewTracking requirements before reporting an item.
539
- * @param params - Original reading session and viewer token, plus one to fifty fully delivered, readable,
540
- * interactive item IDs. The service deduplicates repeated exposures.
541
- * @returns Separate lists of newly accepted and already-counted item IDs.
542
- * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, or any ineligible item.
543
- * A rejected batch is not partially counted. Acquire a new session after expiry and re-evaluate exposure eligibility.
674
+ * Replaces all v2 settings fields using optimistic concurrency; legacy overlapping preferences are synced.
675
+ * @param params - Active Expo token, latest settings revision, and complete replacement settings.
676
+ * @returns The saved settings document with its incremented revision.
677
+ * @throws {MobileServerFailureError} On invalid token/settings or revision conflict (`NOTIFICATION_REVISION_CONFLICT`). Re-read and
678
+ * merge only the user's current change before retrying; never blindly replay a stale document.
679
+ */
680
+ async updateNotificationSettingsV2(params) {
681
+ return require_dataMappers.mapMobileNotificationSettingsV2(await this.publicExecute({
682
+ type: "update_notification_settings_v2",
683
+ expo_token: params.expoToken,
684
+ expected_revision: params.expectedRevision,
685
+ settings: require_dataMappers.mapMobileNotificationSettingsToServer(params.settings)
686
+ }));
687
+ }
688
+ /**
689
+ * Reports views for posts, trade cards, comments, and replies without signing or a reading session.
690
+ * Duplicate IDs count once within a request; another request increments them again. Only supplied IDs
691
+ * count, not their parents. Missing, deleted, unpublished, excluded, or unsupported targets are skipped.
692
+ * A successful response does not identify skipped items. Read interaction.viewCount for current counts.
693
+ * This operation is not idempotent: retrying an uncertain result may count twice. No automatic retry is made.
694
+ * @param params - itemIds: 1–50 canonical lowercase item UUIDs, including any same-request duplicates.
695
+ * @returns Only the success status, even when every target was skipped.
696
+ * @throws {MobileServerFailureError} On invalid parameters, disabled writes, rate limiting, or unavailable data.
544
697
  */
545
698
  async recordFeedViews(params) {
546
699
  const body = {
547
700
  type: "record_feed_views",
548
- session_id: params.sessionId,
549
- item_ids: params.itemIds,
550
- viewer_token: params.viewerToken
701
+ item_ids: params.itemIds
551
702
  };
552
- return require_dataMappers.mapMobileSocialFeedViewsResult(await this.publicExecute(body));
703
+ return this.publicExecute(body);
553
704
  }
554
705
  /**
555
706
  * Registers, renews, or leaves a page lease without signing or authenticating the displayed account.
@@ -638,11 +789,13 @@ var MobileClient = class {
638
789
  }
639
790
  /**
640
791
  * Registers an Expo push token for the wallet, transferring active ownership of the token if another
641
- * wallet had registered it. Idempotent per `(wallet, token)`.
792
+ * wallet had registered it. Each registration advances its generation and cancels old pending deliveries.
793
+ * This legacy method replaces capabilities with v1; use registerExpoTokenV2 consistently after upgrading.
642
794
  *
643
795
  * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is not a valid Expo
644
796
  * push token, or `INVALID_DEVICE_METADATA` if `locale` (max 35 chars) or `appVersion` (max 64 chars) is
645
797
  * too long.
798
+ * @deprecated Use {@link registerExpoTokenV2} instead.
646
799
  */
647
800
  async registerExpoToken(params) {
648
801
  const signedRequest = await this.getSignedRequest("register_expo_token", params, {
@@ -654,6 +807,47 @@ var MobileClient = class {
654
807
  return this.execute(signedRequest);
655
808
  }
656
809
  /**
810
+ * Registers a device with its actual v2 capabilities; do not use repeated registration as a heartbeat.
811
+ * @param params - Wallet authentication, Expo token, metadata, and supported notification types/routes.
812
+ * @returns Success only; query registration separately for its new generation.
813
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
814
+ * @throws {MobileServerFailureError} On `INVALID_EXPO_TOKEN`, `INVALID_DEVICE_METADATA`,
815
+ * `NOTIFICATION_DEVICE_LIMIT` when the wallet already has 32 active devices, or authentication errors.
816
+ */
817
+ async registerExpoTokenV2(params) {
818
+ const request = await this.getSignedRequest("register_expo_token_v2", params, {
819
+ expo_token: params.expoToken,
820
+ platform: params.platform,
821
+ locale: params.locale ?? null,
822
+ app_version: params.appVersion ?? null,
823
+ capabilities: require_dataMappers.mapMobileNotificationCapabilitiesToServer(params.capabilities)
824
+ });
825
+ return this.execute(request);
826
+ }
827
+ /**
828
+ * Applies exactly one bell, market, or one-time favorites-import operation.
829
+ * @param params - Wallet authentication and subscription update with the latest subscription revision.
830
+ * @returns Success only; re-query subscriptions for the new revision even after a repeated ON/OFF.
831
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
832
+ * @throws {MobileServerFailureError} On `NOTIFICATION_REVISION_CONFLICT`, `INVALID_NOTIFICATION_REQUEST`, or
833
+ * `INVALID_IDENTITY_TARGET`.
834
+ */
835
+ async updateNotificationSubscriptions(params) {
836
+ const request = await this.getSignedRequest("update_notification_subscriptions", params, require_dataMappers.mapMobileNotificationSubscriptionsUpdateToServer(params.update));
837
+ return this.execute(request);
838
+ }
839
+ /**
840
+ * Atomically records 1-50 analytics events after the user has consented to analytics.
841
+ * @param params - Wallet authentication and events with stable UUIDs and actual millisecond timestamps.
842
+ * @returns Success only; reuse event IDs on retries. Notification clicks do not mark an inbox item as read.
843
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
844
+ * @throws {MobileServerFailureError} If any event, timestamp, batch size, or notification ownership is invalid.
845
+ */
846
+ async recordProductEvents(params) {
847
+ const request = await this.getSignedRequest("record_product_events", params, { events: params.events.map(require_dataMappers.mapMobileProductEventToServer) });
848
+ return this.execute(request);
849
+ }
850
+ /**
657
851
  * Sets whether the signing subaccount follows a Profile. Both directions are idempotent: following again
658
852
  * keeps the original relationship creation time, so it does not move the account in recency order, and
659
853
  * unfollowing a relationship that does not exist succeeds with `isFollowing: false`. Unfollowing deletes
@@ -718,11 +912,42 @@ var MobileClient = class {
718
912
  action_id: params.actionId,
719
913
  text: params.text,
720
914
  mentions: params.mentions.map(require_dataMappers.mapMobileSocialFeedMentionToServer),
721
- drawing_data_json: params.drawingDataJson
915
+ drawing_data_json: params.drawingDataJson,
916
+ image_ids: params.imageIds,
917
+ image_urls: params.imageUrls
722
918
  });
723
919
  return require_dataMappers.mapMobileSocialFeedItem((await this.execute(request)).item);
724
920
  }
725
921
  /**
922
+ * Uploads one static JPEG/PNG for a later {@link createFeedPost} via multipart execute.
923
+ * The whole HTTP request must stay within 2 MiB including signature overhead; upload one file per call
924
+ * and bind up to nine ready IDs at publication. There is no complete/PUT step — success means ready.
925
+ * @param params - Author subaccount and signing options, plus the original file bytes.
926
+ * @returns Ready image metadata, including original and thumbnail paths.
927
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
928
+ * @throws {RangeError} If the complete multipart request exceeds {@link MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES}.
929
+ * @throws {MobileServerFailureError} On authentication, format/size/hash errors (`INVALID_SOCIAL_FEED_IMAGE`),
930
+ * or when publishing is disabled (`SERVICE_UNAVAILABLE`), or image storage is unavailable
931
+ * (`SOCIAL_FEED_DATA_UNAVAILABLE`, 6320, HTTP 503).
932
+ */
933
+ async createFeedPostImageUpload(params) {
934
+ return this.createFeedImageUpload("create_feed_post_image_uploads", params);
935
+ }
936
+ /**
937
+ * Uploads one static JPEG/PNG for a later {@link createFeedComment} via multipart execute.
938
+ * Same size and readiness rules as {@link createFeedPostImageUpload}; comment text remains required.
939
+ * @param params - Author subaccount and signing options, plus the original file bytes.
940
+ * @returns Ready image metadata, including original and thumbnail paths.
941
+ * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
942
+ * @throws {RangeError} If the complete multipart request exceeds {@link MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES}.
943
+ * @throws {MobileServerFailureError} On authentication, format/size/hash errors (`INVALID_SOCIAL_FEED_IMAGE`),
944
+ * or when comments are disabled (`SERVICE_UNAVAILABLE`), or image storage is unavailable
945
+ * (`SOCIAL_FEED_DATA_UNAVAILABLE`, 6320, HTTP 503).
946
+ */
947
+ async createFeedCommentImageUpload(params) {
948
+ return this.createFeedImageUpload("create_feed_comment_image_uploads", params);
949
+ }
950
+ /**
726
951
  * First attaches a drawing to an owned post or trade card while the author still holds its position.
727
952
  * The original JSON is signed unchanged; false and zero are valid drawing documents.
728
953
  * For an exact retry after a timeout, generate a nonce up front with {@link getMobileNonce} and reuse
@@ -778,7 +1003,9 @@ var MobileClient = class {
778
1003
  reply_to_item_id: params.replyToItemId,
779
1004
  text: params.text,
780
1005
  mentions: params.mentions.map(require_dataMappers.mapMobileSocialFeedMentionToServer),
781
- attached_position_id: params.attachedPositionId
1006
+ attached_position_id: params.attachedPositionId,
1007
+ image_ids: params.imageIds,
1008
+ image_urls: params.imageUrls
782
1009
  });
783
1010
  return require_dataMappers.mapMobileSocialFeedCommentResult(await this.execute(request));
784
1011
  }
@@ -820,18 +1047,73 @@ var MobileClient = class {
820
1047
  this.checkServerStatus(response);
821
1048
  return response.data;
822
1049
  }
1050
+ async publicGetBytes(url, headers) {
1051
+ const response = await this.axiosInstance.get(url, {
1052
+ responseType: "arraybuffer",
1053
+ headers
1054
+ });
1055
+ if (response.status < 200 || response.status >= 300) {
1056
+ const responseText = (0, viem.bytesToString)(new Uint8Array(response.data));
1057
+ let errorData;
1058
+ try {
1059
+ errorData = JSON.parse(responseText);
1060
+ } catch {
1061
+ errorData = responseText;
1062
+ }
1063
+ this.checkResponseStatus({
1064
+ ...response,
1065
+ data: errorData
1066
+ });
1067
+ }
1068
+ return new Uint8Array(response.data);
1069
+ }
823
1070
  async publicExecute(body) {
824
1071
  const response = await this.axiosInstance.post(`${this.opts.url}/public_execute`, body);
825
1072
  this.checkResponseStatus(response);
826
1073
  this.checkServerStatus(response);
827
1074
  return response.data;
828
1075
  }
829
- async execute(body) {
830
- const response = await this.axiosInstance.post(`${this.opts.url}/execute`, body);
1076
+ /**
1077
+ * Sends an authenticated read through the signed query route.
1078
+ * @param body - Canonical inner payload with its signature, sender, and nonce.
1079
+ * @returns The successful query envelope and its type-specific payload.
1080
+ * @throws {MobileServerFailureError} For a structured service failure, including non-2xx responses.
1081
+ */
1082
+ async query(body) {
1083
+ const response = await this.axiosInstance.post(`${this.opts.url}/query`, body);
1084
+ this.checkResponseStatus(response);
1085
+ this.checkServerStatus(response);
1086
+ return response.data;
1087
+ }
1088
+ async execute(body, fileBytes) {
1089
+ const multipart = fileBytes == null ? void 0 : require_utils_buildMobileFeedImageMultipart.buildMobileFeedImageMultipart(JSON.stringify(body), fileBytes);
1090
+ if (multipart) this.checkFeedImageRequestSize(multipart.body.byteLength);
1091
+ const response = await this.axiosInstance.post(`${this.opts.url}/execute`, multipart?.body ?? body, multipart ? { headers: { "Content-Type": multipart.contentType } } : void 0);
831
1092
  this.checkResponseStatus(response);
832
1093
  this.checkServerStatus(response);
833
1094
  return response.data;
834
1095
  }
1096
+ async createFeedImageUpload(type, params) {
1097
+ const nonce = params.nonce ?? require_signing_nonce.getMobileNonce();
1098
+ const sizePayload = {
1099
+ type,
1100
+ content_hash: viem.zeroHash,
1101
+ signature: `0x${"00".repeat(65)}`,
1102
+ sender: (0, _nadohq_shared.subaccountToHex)(params),
1103
+ nonce: nonce.toString()
1104
+ };
1105
+ const overhead = require_utils_buildMobileFeedImageMultipart.buildMobileFeedImageMultipart(JSON.stringify(sizePayload), new Uint8Array()).body.byteLength;
1106
+ this.checkFeedImageRequestSize(overhead + params.fileBytes.byteLength);
1107
+ const contentHash = (0, viem.keccak256)(params.fileBytes);
1108
+ const request = await this.getSignedRequest(type, {
1109
+ ...params,
1110
+ nonce
1111
+ }, { content_hash: contentHash });
1112
+ return require_dataMappers.mapMobileSocialFeedUploadedImage((await this.execute(request, params.fileBytes)).image);
1113
+ }
1114
+ checkFeedImageRequestSize(byteLength) {
1115
+ if (byteLength > 2097152) throw new RangeError(`Feed image upload request exceeds ${require_utils_feed.MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES} bytes (2 MiB).`);
1116
+ }
835
1117
  /**
836
1118
  * Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns
837
1119
  * failure envelopes with non-2xx statuses (e.g. 404 for `PROFILE_NOT_FOUND`), so a non-2xx response with a
@@ -856,4 +1138,4 @@ Object.defineProperty(exports, "MobileClient", {
856
1138
  }
857
1139
  });
858
1140
 
859
- //# sourceMappingURL=MobileClient-CfVZXTcz.cjs.map
1141
+ //# sourceMappingURL=MobileClient-vuI5wlB_.cjs.map