@nadohq/mobile-client 0.64.0 → 0.65.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.
- package/README.md +20 -2
- package/dist/{MobileClient-aDxiM_Kf.cjs → MobileClient-CfVZXTcz.cjs} +298 -1
- package/dist/MobileClient-CfVZXTcz.cjs.map +1 -0
- package/dist/MobileClient.cjs +1 -1
- package/dist/MobileClient.d.cts +173 -7
- package/dist/MobileClient.d.cts.map +1 -1
- package/dist/MobileClient.d.ts +173 -7
- package/dist/MobileClient.d.ts.map +1 -1
- package/dist/MobileClient.js +298 -1
- package/dist/MobileClient.js.map +1 -1
- package/dist/{MobileServerFailureError-Dd3c6P_Z.d.ts → MobileServerFailureError-BZVwlsMg.d.ts} +3 -3
- package/dist/{MobileServerFailureError-Dd3c6P_Z.d.ts.map → MobileServerFailureError-BZVwlsMg.d.ts.map} +1 -1
- package/dist/{MobileServerFailureError-Bpa_WA9f.d.cts → MobileServerFailureError-CbtK8kD4.d.cts} +3 -3
- package/dist/{MobileServerFailureError-Bpa_WA9f.d.cts.map → MobileServerFailureError-CbtK8kD4.d.cts.map} +1 -1
- package/dist/MobileUnsupportedFeedItemError-BsZvW8i2.d.cts +15 -0
- package/dist/MobileUnsupportedFeedItemError-BsZvW8i2.d.cts.map +1 -0
- package/dist/MobileUnsupportedFeedItemError-BsZvW8i2.d.ts +15 -0
- package/dist/MobileUnsupportedFeedItemError-BsZvW8i2.d.ts.map +1 -0
- package/dist/{buildSignedMobileRequest-NHbMAPzd.d.cts → buildSignedMobileRequest-C1v0flCR.d.cts} +2 -2
- package/dist/{buildSignedMobileRequest-NHbMAPzd.d.cts.map → buildSignedMobileRequest-C1v0flCR.d.cts.map} +1 -1
- package/dist/{buildSignedMobileRequest-Cb1T74xV.d.ts → buildSignedMobileRequest-UeeWdYGU.d.ts} +2 -2
- package/dist/{buildSignedMobileRequest-Cb1T74xV.d.ts.map → buildSignedMobileRequest-UeeWdYGU.d.ts.map} +1 -1
- package/dist/{canonicalize-BBYGh17w.d.ts → canonicalize-5eeZrkzQ.d.ts} +2 -2
- package/dist/canonicalize-5eeZrkzQ.d.ts.map +1 -0
- package/dist/{canonicalize-BF_SiNvO.d.cts → canonicalize-CBaZprTo.d.cts} +2 -2
- package/dist/canonicalize-CBaZprTo.d.cts.map +1 -0
- package/dist/{clientTypes-BWFKo9oE.d.cts → clientTypes-C9dJufxk.d.ts} +569 -25
- package/dist/clientTypes-C9dJufxk.d.ts.map +1 -0
- package/dist/{clientTypes-DCTiUV0H.d.ts → clientTypes-_mEgzmNs.d.cts} +569 -25
- package/dist/clientTypes-_mEgzmNs.d.cts.map +1 -0
- package/dist/dataMappers.cjs +488 -9
- package/dist/dataMappers.cjs.map +1 -1
- package/dist/dataMappers.d.cts +190 -7
- package/dist/dataMappers.d.cts.map +1 -1
- package/dist/dataMappers.d.ts +190 -7
- package/dist/dataMappers.d.ts.map +1 -1
- package/dist/dataMappers.js +460 -10
- package/dist/dataMappers.js.map +1 -1
- package/dist/{eip712MethodByType-BSx11xG-.d.cts → eip712MethodByType-D8jLoxDu.d.cts} +2 -2
- package/dist/eip712MethodByType-D8jLoxDu.d.cts.map +1 -0
- package/dist/{eip712MethodByType-DkiAjCLs.d.ts → eip712MethodByType-DcUh8h-l.d.ts} +2 -2
- package/dist/eip712MethodByType-DcUh8h-l.d.ts.map +1 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +16 -15
- package/dist/index.d.ts +16 -15
- package/dist/index.js +2 -1
- package/dist/{mobileErrorCodes-3LtreeZM.d.ts → mobileErrorCodes-CmjYEIYm.d.cts} +18 -4
- package/dist/mobileErrorCodes-CmjYEIYm.d.cts.map +1 -0
- package/dist/{mobileErrorCodes-3LtreeZM.d.cts → mobileErrorCodes-CmjYEIYm.d.ts} +18 -4
- package/dist/mobileErrorCodes-CmjYEIYm.d.ts.map +1 -0
- package/dist/{payloadHash-BOWGjqdb.d.cts → payloadHash-DhHmgRqL.d.cts} +2 -2
- package/dist/payloadHash-DhHmgRqL.d.cts.map +1 -0
- package/dist/{payloadHash-Bzf4CtjV.d.ts → payloadHash-E1_8fpLW.d.ts} +2 -2
- package/dist/payloadHash-E1_8fpLW.d.ts.map +1 -0
- package/dist/{serverBaseTypes-KREDe2M9.d.cts → serverBaseTypes-B5J1_TyC.d.cts} +2 -2
- package/dist/{serverBaseTypes-KREDe2M9.d.cts.map → serverBaseTypes-B5J1_TyC.d.cts.map} +1 -1
- package/dist/{serverBaseTypes-DWf3iGWy.d.ts → serverBaseTypes-DnLzsdm-.d.ts} +2 -2
- package/dist/{serverBaseTypes-DWf3iGWy.d.ts.map → serverBaseTypes-DnLzsdm-.d.ts.map} +1 -1
- package/dist/serverExecuteTypes-B-OJok19.d.cts +162 -0
- package/dist/serverExecuteTypes-B-OJok19.d.cts.map +1 -0
- package/dist/serverExecuteTypes-BwWGspOg.d.ts +162 -0
- package/dist/serverExecuteTypes-BwWGspOg.d.ts.map +1 -0
- package/dist/{serverModelTypes-DAqEyYtB.d.cts → serverModelTypes-CiA-dy1R.d.cts} +299 -24
- package/dist/serverModelTypes-CiA-dy1R.d.cts.map +1 -0
- package/dist/{serverModelTypes-DAqEyYtB.d.ts → serverModelTypes-CiA-dy1R.d.ts} +299 -24
- package/dist/serverModelTypes-CiA-dy1R.d.ts.map +1 -0
- package/dist/{serverQueryTypes-DNdMpmDr.d.cts → serverQueryTypes-CJcjLB7n.d.ts} +117 -5
- package/dist/serverQueryTypes-CJcjLB7n.d.ts.map +1 -0
- package/dist/{serverQueryTypes-BFdwq0Z2.d.ts → serverQueryTypes-V1f9yE7L.d.cts} +117 -5
- package/dist/serverQueryTypes-V1f9yE7L.d.cts.map +1 -0
- package/dist/{serverRequestTypes-CxDRFKfv.d.cts → serverRequestTypes-CRlkNSu5.d.cts} +77 -7
- package/dist/serverRequestTypes-CRlkNSu5.d.cts.map +1 -0
- package/dist/{serverRequestTypes-BNA7FCY6.d.ts → serverRequestTypes-DZoOhV2o.d.ts} +77 -7
- package/dist/serverRequestTypes-DZoOhV2o.d.ts.map +1 -0
- package/dist/{serverResponseGuards-Dkdok0Sm.d.cts → serverResponseGuards-BW69PS7O.d.cts} +2 -2
- package/dist/{serverResponseGuards-Dkdok0Sm.d.cts.map → serverResponseGuards-BW69PS7O.d.cts.map} +1 -1
- package/dist/{serverResponseGuards-BU1Xv_tG.d.ts → serverResponseGuards-CShiXpHT.d.ts} +2 -2
- package/dist/{serverResponseGuards-BU1Xv_tG.d.ts.map → serverResponseGuards-CShiXpHT.d.ts.map} +1 -1
- package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
- package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
- package/dist/signing/canonicalize.cjs +37 -0
- package/dist/signing/canonicalize.cjs.map +1 -1
- package/dist/signing/canonicalize.d.cts +1 -1
- package/dist/signing/canonicalize.d.ts +1 -1
- package/dist/signing/canonicalize.js +37 -0
- package/dist/signing/canonicalize.js.map +1 -1
- package/dist/signing/eip712MethodByType.cjs +5 -0
- package/dist/signing/eip712MethodByType.cjs.map +1 -1
- package/dist/signing/eip712MethodByType.d.cts +1 -1
- package/dist/signing/eip712MethodByType.d.ts +1 -1
- package/dist/signing/eip712MethodByType.js +5 -0
- package/dist/signing/eip712MethodByType.js.map +1 -1
- package/dist/signing/index.d.cts +5 -5
- package/dist/signing/index.d.ts +5 -5
- package/dist/signing/payloadHash.d.cts +1 -1
- package/dist/signing/payloadHash.d.ts +1 -1
- package/dist/signing/types.d.cts +1 -1
- package/dist/signing/types.d.ts +1 -1
- package/dist/types/MobileServerFailureError.d.cts +1 -1
- package/dist/types/MobileServerFailureError.d.ts +1 -1
- package/dist/types/MobileUnsupportedFeedItemError.cjs +19 -0
- package/dist/types/MobileUnsupportedFeedItemError.cjs.map +1 -0
- package/dist/types/MobileUnsupportedFeedItemError.d.cts +2 -0
- package/dist/types/MobileUnsupportedFeedItemError.d.ts +2 -0
- package/dist/types/MobileUnsupportedFeedItemError.js +18 -0
- package/dist/types/MobileUnsupportedFeedItemError.js.map +1 -0
- package/dist/types/clientTypes.d.cts +2 -2
- package/dist/types/clientTypes.d.ts +2 -2
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +10 -9
- package/dist/types/index.d.ts +10 -9
- package/dist/types/index.js +2 -1
- package/dist/types/mobileErrorCodes.cjs +28 -0
- package/dist/types/mobileErrorCodes.cjs.map +1 -1
- package/dist/types/mobileErrorCodes.d.cts +1 -1
- package/dist/types/mobileErrorCodes.d.ts +1 -1
- package/dist/types/mobileErrorCodes.js +28 -0
- package/dist/types/mobileErrorCodes.js.map +1 -1
- package/dist/types/serverBaseTypes.d.cts +1 -1
- package/dist/types/serverBaseTypes.d.ts +1 -1
- package/dist/types/serverExecuteTypes.d.cts +2 -2
- package/dist/types/serverExecuteTypes.d.ts +2 -2
- package/dist/types/serverModelTypes.cjs.map +1 -1
- package/dist/types/serverModelTypes.d.cts +2 -2
- package/dist/types/serverModelTypes.d.ts +2 -2
- package/dist/types/serverModelTypes.js.map +1 -1
- package/dist/types/serverQueryTypes.d.cts +2 -2
- package/dist/types/serverQueryTypes.d.ts +2 -2
- package/dist/types/serverRequestTypes.d.cts +1 -1
- package/dist/types/serverRequestTypes.d.ts +1 -1
- package/dist/{types-BCr2G5gS.d.cts → types-BiRmH5Iv.d.cts} +31 -7
- package/dist/types-BiRmH5Iv.d.cts.map +1 -0
- package/dist/{types-C18k-9Vy.d.ts → types-DoJuq0Ij.d.ts} +31 -7
- package/dist/types-DoJuq0Ij.d.ts.map +1 -0
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/serverResponseGuards.d.cts +1 -1
- package/dist/utils/serverResponseGuards.d.ts +1 -1
- package/package.json +3 -3
- package/src/MobileClient.ts +409 -4
- package/src/dataMappers.test.ts +742 -0
- package/src/dataMappers.ts +671 -12
- package/src/signing/canonicalize.ts +53 -0
- package/src/signing/eip712MethodByType.ts +5 -0
- package/src/signing/signing.test.ts +347 -0
- package/src/signing/types.ts +57 -4
- package/src/types/MobileUnsupportedFeedItemError.ts +18 -0
- package/src/types/clientTypes.ts +645 -23
- package/src/types/index.ts +1 -0
- package/src/types/mobileErrorCodes.ts +28 -0
- package/src/types/serverExecuteTypes.ts +92 -3
- package/src/types/serverModelTypes.ts +376 -22
- package/src/types/serverQueryTypes.ts +138 -0
- package/src/types/serverRequestTypes.ts +115 -4
- package/dist/MobileClient-aDxiM_Kf.cjs.map +0 -1
- package/dist/canonicalize-BBYGh17w.d.ts.map +0 -1
- package/dist/canonicalize-BF_SiNvO.d.cts.map +0 -1
- package/dist/clientTypes-BWFKo9oE.d.cts.map +0 -1
- package/dist/clientTypes-DCTiUV0H.d.ts.map +0 -1
- package/dist/eip712MethodByType-BSx11xG-.d.cts.map +0 -1
- package/dist/eip712MethodByType-DkiAjCLs.d.ts.map +0 -1
- package/dist/mobileErrorCodes-3LtreeZM.d.cts.map +0 -1
- package/dist/mobileErrorCodes-3LtreeZM.d.ts.map +0 -1
- package/dist/payloadHash-BOWGjqdb.d.cts.map +0 -1
- package/dist/payloadHash-Bzf4CtjV.d.ts.map +0 -1
- package/dist/serverExecuteTypes-DVRa6ifu.d.cts +0 -89
- package/dist/serverExecuteTypes-DVRa6ifu.d.cts.map +0 -1
- package/dist/serverExecuteTypes-DlYZCp1f.d.ts +0 -89
- package/dist/serverExecuteTypes-DlYZCp1f.d.ts.map +0 -1
- package/dist/serverModelTypes-DAqEyYtB.d.cts.map +0 -1
- package/dist/serverModelTypes-DAqEyYtB.d.ts.map +0 -1
- package/dist/serverQueryTypes-BFdwq0Z2.d.ts.map +0 -1
- package/dist/serverQueryTypes-DNdMpmDr.d.cts.map +0 -1
- package/dist/serverRequestTypes-BNA7FCY6.d.ts.map +0 -1
- package/dist/serverRequestTypes-CxDRFKfv.d.cts.map +0 -1
- package/dist/types-BCr2G5gS.d.cts.map +0 -1
- package/dist/types-C18k-9Vy.d.ts.map +0 -1
package/dist/MobileClient.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mapMobileAvatarPreset, mapMobileAvatarSelectionToServer, mapMobileAvatarUpload, mapMobileFeedPage, mapMobileFollowBatchResult, mapMobileFollowListPage, mapMobileFollowListParamsToServer, mapMobileFollowMutationResult, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobileProfileSearchPage, mapMobileProfileSearchParamsToServer, mapMobileProfilesIncludeToServer, mapMobilePublicProfile, mapMobileRegisteredWallet, mapMobileSocialFeedItemResponse, mapMobileSocialFeedListParamsToServer, mapMobileSocialFeedPage, mapMobileSocialFeedRankedPage, mapMobileSocialFeedReadParamsToServer, mapMobileSocialFeedTopTradersPage, mapMobileSocialFeedUpdates } from "./dataMappers.js";
|
|
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";
|
|
2
2
|
import { buildSignedMobileRequest } from "./signing/buildSignedMobileRequest.js";
|
|
3
3
|
import "./signing/index.js";
|
|
4
4
|
import { MobileServerFailureError } from "./types/MobileServerFailureError.js";
|
|
@@ -157,6 +157,7 @@ var MobileClient = class {
|
|
|
157
157
|
* @param params - Filters, pagination, optional viewing account, and browser credential; no signing identity.
|
|
158
158
|
* @returns A fixed-session page with its ranking version and new-content watermark.
|
|
159
159
|
* @throws {MobileServerFailureError} On invalid parameters, session mismatch/expiry, or unavailable data.
|
|
160
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
160
161
|
*/
|
|
161
162
|
async getForYouFeed(params = {}) {
|
|
162
163
|
const body = {
|
|
@@ -173,6 +174,7 @@ var MobileClient = class {
|
|
|
173
174
|
* @param params - Filters, pagination, optional viewing account, and browser credential.
|
|
174
175
|
* @returns A page with its qualification cohort; an unavailable cohort fails instead of returning an empty ranking.
|
|
175
176
|
* @throws {MobileServerFailureError} On request/session errors or unavailable cohort data.
|
|
177
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
176
178
|
*/
|
|
177
179
|
async getTopTradersFeed(params = {}) {
|
|
178
180
|
const body = {
|
|
@@ -188,6 +190,7 @@ var MobileClient = class {
|
|
|
188
190
|
* @param params - Required viewing account on every request, filters, pagination, and browser credential.
|
|
189
191
|
* @returns A chronological Friends page and reading session.
|
|
190
192
|
* @throws {MobileServerFailureError} On invalid viewing account, session errors, or feed query failure.
|
|
193
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
191
194
|
*/
|
|
192
195
|
async getFriendsFeed(params) {
|
|
193
196
|
const body = {
|
|
@@ -204,6 +207,7 @@ var MobileClient = class {
|
|
|
204
207
|
* @param params - Target identity, filters, pagination, and optional public viewing account.
|
|
205
208
|
* @returns An author page without main-feed ranking or cohort fields.
|
|
206
209
|
* @throws {MobileServerFailureError} On invalid parameters, session errors, or inaccessible content.
|
|
210
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
207
211
|
*/
|
|
208
212
|
async getProfileFeed(params) {
|
|
209
213
|
const body = {
|
|
@@ -220,6 +224,7 @@ var MobileClient = class {
|
|
|
220
224
|
* @param params - Product ID, content/size filters, pagination, and public viewing account.
|
|
221
225
|
* @returns A market page without main-feed ranking fields.
|
|
222
226
|
* @throws {MobileServerFailureError} On an unknown market, session errors, or unavailable data.
|
|
227
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
223
228
|
*/
|
|
224
229
|
async getMarketFeed(params) {
|
|
225
230
|
const body = {
|
|
@@ -236,6 +241,7 @@ var MobileClient = class {
|
|
|
236
241
|
* @param params - Position UUID, filters, pagination, and public viewing account.
|
|
237
242
|
* @returns A fixed-session position feed page.
|
|
238
243
|
* @throws {MobileServerFailureError} On inaccessible content, session errors, or unavailable data.
|
|
244
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
239
245
|
*/
|
|
240
246
|
async getPositionFeed(params) {
|
|
241
247
|
const body = {
|
|
@@ -252,6 +258,7 @@ var MobileClient = class {
|
|
|
252
258
|
* @param params - Item UUID, preview limit, and optional existing session/read identity.
|
|
253
259
|
* @returns The complete item and authorized reading session.
|
|
254
260
|
* @throws {MobileServerFailureError} On inaccessible content or session mismatch/expiry.
|
|
261
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
255
262
|
*/
|
|
256
263
|
async getFeedItem(params) {
|
|
257
264
|
const body = {
|
|
@@ -320,6 +327,154 @@ var MobileClient = class {
|
|
|
320
327
|
return mapMobileRegisteredWallet(await this.publicQuery(body));
|
|
321
328
|
}
|
|
322
329
|
/**
|
|
330
|
+
* Lists a selected account's current positions without signing or authenticating ownership.
|
|
331
|
+
* Publication and attachment eligibility are hints that the service rechecks on writes.
|
|
332
|
+
* @param params - Viewing subaccount, optional market filter, page size, and opaque cursor.
|
|
333
|
+
* @returns Current position candidates, their eligibility hints, the next cursor, and observation time.
|
|
334
|
+
* @throws {MobileServerFailureError} On invalid parameters, an unsupported viewing account, or unavailable
|
|
335
|
+
* position data. An account with no open positions returns an empty page instead of an error.
|
|
336
|
+
*/
|
|
337
|
+
async getSelfFeedPositions(params) {
|
|
338
|
+
const body = {
|
|
339
|
+
type: "self_feed_positions",
|
|
340
|
+
view_as: subaccountToHex(params.viewAs),
|
|
341
|
+
product_id: params.productId,
|
|
342
|
+
cursor: params.cursor,
|
|
343
|
+
limit: params.limit
|
|
344
|
+
};
|
|
345
|
+
return mapMobileSocialFeedPositionsPage(await this.publicQuery(body));
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Resolves a slash command against a selected account without changing the caller's input.
|
|
349
|
+
* @param params - Viewing subaccount, original command text, and optional market disambiguation.
|
|
350
|
+
* @returns The resolution, nullable market, candidate positions, and reason for an empty result.
|
|
351
|
+
* @throws {MobileServerFailureError} On invalid parameters, an unsupported viewing account, or unavailable
|
|
352
|
+
* source data. Unknown markets and accounts without open positions are normal resolution results.
|
|
353
|
+
*/
|
|
354
|
+
async resolveFeedPosition(params) {
|
|
355
|
+
const body = {
|
|
356
|
+
type: "resolve_feed_position",
|
|
357
|
+
view_as: subaccountToHex(params.viewAs),
|
|
358
|
+
input: params.input,
|
|
359
|
+
product_id: params.productId
|
|
360
|
+
};
|
|
361
|
+
return mapMobileSocialFeedPositionResolutionResult(await this.publicQuery(body));
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Resolves every trusted lifecycle segment of an order without requiring a signature.
|
|
365
|
+
* @param params - Order-owning subaccount and order digest; selecting the account is not authentication.
|
|
366
|
+
* @returns Trusted action candidates and their observation time, or a pending result with no actions.
|
|
367
|
+
* @throws {MobileServerFailureError} On invalid parameters, an inaccessible order, or unavailable source
|
|
368
|
+
* data. Pending projection is a successful result, not a source failure.
|
|
369
|
+
*/
|
|
370
|
+
async resolveFeedAction(params) {
|
|
371
|
+
const body = {
|
|
372
|
+
type: "resolve_feed_action",
|
|
373
|
+
view_as: subaccountToHex(params.viewAs),
|
|
374
|
+
order_digest: params.orderDigest
|
|
375
|
+
};
|
|
376
|
+
return mapMobileSocialFeedActionResolutionResult(await this.publicQuery(body));
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Reads a drawing publicly without issuing a reading session. Supplied sessions retain their scope.
|
|
380
|
+
* @param params - Parent item, optional viewing account, and optional original session and viewer token.
|
|
381
|
+
* @returns The parent ID and version, with a nullable drawing whose data may legitimately be false or zero.
|
|
382
|
+
* @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, unavailable data,
|
|
383
|
+
* or `SOCIAL_FEED_DRAWING_UNAVAILABLE` when the parent is inaccessible. A readable parent without a drawing
|
|
384
|
+
* returns null. Acquire a new reading session when the original has expired.
|
|
385
|
+
*/
|
|
386
|
+
async getFeedChartDrawing(params) {
|
|
387
|
+
const body = {
|
|
388
|
+
type: "feed_chart_drawing",
|
|
389
|
+
item_id: params.itemId,
|
|
390
|
+
session_id: params.sessionId,
|
|
391
|
+
...mapMobileSocialFeedReadParamsToServer(params)
|
|
392
|
+
};
|
|
393
|
+
return mapMobileSocialFeedDrawingResult(await this.publicQuery(body));
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Reads a comment thread with an optional anchor and bidirectional pagination.
|
|
397
|
+
* 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.
|
|
399
|
+
* Paging requires the original session and viewer token.
|
|
400
|
+
* @returns Replies, total count, forward and backward cursors, the anchor, and the actual reading session.
|
|
401
|
+
* @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,
|
|
402
|
+
* or unavailable data. Restart pagination with a new session after expiry; do not reuse the old cursor.
|
|
403
|
+
*/
|
|
404
|
+
async getFeedComments(params) {
|
|
405
|
+
const body = {
|
|
406
|
+
type: "feed_comments",
|
|
407
|
+
root_item_id: params.rootItemId,
|
|
408
|
+
cursor: params.cursor,
|
|
409
|
+
limit: params.limit,
|
|
410
|
+
anchor_reply_id: params.anchorReplyId,
|
|
411
|
+
session_id: params.sessionId,
|
|
412
|
+
...mapMobileSocialFeedReadParamsToServer(params)
|
|
413
|
+
};
|
|
414
|
+
return mapMobileSocialFeedCommentsPage(await this.publicQuery(body));
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Reads the full position lifecycle and creates or reuses a position session.
|
|
418
|
+
* Unlike getPositionFeed, this includes lifecycle actions as well as published takes.
|
|
419
|
+
* @param params - Position, optional takes-only filter, pagination, and read perspective. Paging requires
|
|
420
|
+
* the original position session and viewer token, not a feed session.
|
|
421
|
+
* @returns Position metrics, ordered action/take history, summary, trading hints, cursor, and reading session.
|
|
422
|
+
* @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,
|
|
423
|
+
* or unavailable source data. Restart with a new position session after expiry.
|
|
424
|
+
* @throws {MobileUnsupportedFeedItemError} If a timeline entry or take has an unsupported kind.
|
|
425
|
+
*/
|
|
426
|
+
async getPositionHistory(params) {
|
|
427
|
+
const body = {
|
|
428
|
+
type: "position_history",
|
|
429
|
+
position_id: params.positionId,
|
|
430
|
+
takes_only: params.takesOnly,
|
|
431
|
+
cursor: params.cursor,
|
|
432
|
+
limit: params.limit,
|
|
433
|
+
session_id: params.sessionId,
|
|
434
|
+
...mapMobileSocialFeedReadParamsToServer(params)
|
|
435
|
+
};
|
|
436
|
+
return mapMobileSocialFeedPositionHistory(await this.publicQuery(body));
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Reads candles and action markers without creating a reading session.
|
|
440
|
+
* Preserve the original range, interval, and read perspective when paging with nextBeforeMs.
|
|
441
|
+
* @param params - Position, candle interval, half-open time range, pagination, and optional original session
|
|
442
|
+
* and viewer token. An independent read omits both session credentials.
|
|
443
|
+
* @returns Candles with decimal prices and x18 volume, action markers, a nullable liquidation line, and paging metadata.
|
|
444
|
+
* @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,
|
|
445
|
+
* or wholly unavailable chart sources. Partially available data is returned with its quality indicator.
|
|
446
|
+
*/
|
|
447
|
+
async getPositionChart(params) {
|
|
448
|
+
const body = {
|
|
449
|
+
type: "position_chart",
|
|
450
|
+
position_id: params.positionId,
|
|
451
|
+
session_id: params.sessionId,
|
|
452
|
+
interval: params.interval,
|
|
453
|
+
range: {
|
|
454
|
+
from_ms: params.range.fromMs,
|
|
455
|
+
to_ms: params.range.toMs
|
|
456
|
+
},
|
|
457
|
+
before_ms: params.beforeMs,
|
|
458
|
+
limit: params.limit,
|
|
459
|
+
...mapMobileSocialFeedReadParamsToServer(params)
|
|
460
|
+
};
|
|
461
|
+
return mapMobileSocialFeedPositionChart(await this.publicQuery(body));
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Reads active visitor counts and self-reported account previews without registering presence.
|
|
465
|
+
* @param params - Position and optional viewing account, used only for preview relationship information.
|
|
466
|
+
* @returns The visitor count, public account previews, and observation time; previews need not match the count.
|
|
467
|
+
* @throws {MobileServerFailureError} On invalid parameters, an unavailable position, or unavailable source data.
|
|
468
|
+
*/
|
|
469
|
+
async getPositionWatchers(params) {
|
|
470
|
+
const body = {
|
|
471
|
+
type: "position_watchers",
|
|
472
|
+
position_id: params.positionId,
|
|
473
|
+
view_as: params.viewAs === void 0 ? void 0 : subaccountToHex(params.viewAs)
|
|
474
|
+
};
|
|
475
|
+
return mapMobileSocialFeedWatchers(await this.publicQuery(body));
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
323
478
|
* Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout
|
|
324
479
|
* when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown
|
|
325
480
|
* well-formed token succeeds.
|
|
@@ -357,6 +512,45 @@ var MobileClient = class {
|
|
|
357
512
|
return this.publicExecute(body);
|
|
358
513
|
}
|
|
359
514
|
/**
|
|
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.
|
|
522
|
+
*/
|
|
523
|
+
async recordFeedViews(params) {
|
|
524
|
+
const body = {
|
|
525
|
+
type: "record_feed_views",
|
|
526
|
+
session_id: params.sessionId,
|
|
527
|
+
item_ids: params.itemIds,
|
|
528
|
+
viewer_token: params.viewerToken
|
|
529
|
+
};
|
|
530
|
+
return mapMobileSocialFeedViewsResult(await this.publicExecute(body));
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Registers, renews, or leaves a page lease without signing or authenticating the displayed account.
|
|
534
|
+
* Omitting watcherSubaccount preserves its value; null clears it. This operation does not record item views.
|
|
535
|
+
* @param params - Authorized position, original session and viewer token, page-scoped viewSessionId,
|
|
536
|
+
* lease state, and optional self-reported display account. Retain viewSessionId for the lifetime of the page.
|
|
537
|
+
* @returns Visitor count, public previews, recommended heartbeat interval, and remaining lease lifetime.
|
|
538
|
+
* @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, or an inaccessible
|
|
539
|
+
* position. Rejected requests leave leases unchanged; acquire a new reading session after expiry.
|
|
540
|
+
*/
|
|
541
|
+
async setPositionPresence(params) {
|
|
542
|
+
const body = {
|
|
543
|
+
type: "position_presence",
|
|
544
|
+
position_id: params.positionId,
|
|
545
|
+
session_id: params.sessionId,
|
|
546
|
+
view_session_id: params.viewSessionId,
|
|
547
|
+
state: params.state,
|
|
548
|
+
viewer_token: params.viewerToken,
|
|
549
|
+
...params.watcherSubaccount === void 0 ? {} : { watcher_subaccount: params.watcherSubaccount === null ? null : subaccountToHex(params.watcherSubaccount) }
|
|
550
|
+
};
|
|
551
|
+
return mapMobileSocialFeedPresence(await this.publicExecute(body));
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
360
554
|
* Updates the biography, or clears it when the text is whitespace-only.
|
|
361
555
|
*
|
|
362
556
|
* Serialize this with {@link MobileClient.setAvatar}, {@link MobileClient.setUsername} and
|
|
@@ -482,6 +676,109 @@ var MobileClient = class {
|
|
|
482
676
|
});
|
|
483
677
|
return mapMobileFollowBatchResult(await this.execute(signedRequest));
|
|
484
678
|
}
|
|
679
|
+
/**
|
|
680
|
+
* Publishes text, a drawing, or both atomically using the signed author identity.
|
|
681
|
+
* For an idempotent retry, reuse clientRequestId and the exact original content with a valid signature.
|
|
682
|
+
* The SDK does not trim text or reformat the signed drawing JSON.
|
|
683
|
+
* @param params - Author subaccount and signing options, request UUID, owned position, original text and
|
|
684
|
+
* mentions, plus an optional trusted action and original drawing JSON.
|
|
685
|
+
* @returns The published item, including authoritative interaction state and any drawing or comment preview.
|
|
686
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
687
|
+
* @throws {MobileServerFailureError} On authentication, ownership, eligibility, content, mention, or drawing
|
|
688
|
+
* errors, or `SOCIAL_FEED_REQUEST_CONFLICT` when a request UUID is reused with different content. Do not
|
|
689
|
+
* change an earlier request to retry it; use a new UUID for a genuinely new publication.
|
|
690
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
691
|
+
*/
|
|
692
|
+
async createFeedPost(params) {
|
|
693
|
+
const request = await this.getSignedRequest("create_feed_post", params, {
|
|
694
|
+
client_request_id: params.clientRequestId,
|
|
695
|
+
position_id: params.positionId,
|
|
696
|
+
action_id: params.actionId,
|
|
697
|
+
text: params.text,
|
|
698
|
+
mentions: params.mentions.map(mapMobileSocialFeedMentionToServer),
|
|
699
|
+
drawing_data_json: params.drawingDataJson
|
|
700
|
+
});
|
|
701
|
+
return mapMobileSocialFeedItem((await this.execute(request)).item);
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* First attaches a drawing to an owned post or trade card while the author still holds its position.
|
|
705
|
+
* The original JSON is signed unchanged; false and zero are valid drawing documents.
|
|
706
|
+
* For an exact retry after a timeout, generate a nonce up front with {@link getMobileNonce} and reuse
|
|
707
|
+
* that nonce and the original JSON before its receive deadline. A fresh nonce is not an exact replay.
|
|
708
|
+
* If a retry returns `SOCIAL_FEED_DRAWING_EXISTS`, use {@link getFeedChartDrawing} to confirm that the
|
|
709
|
+
* stored data matches the intended drawing before treating the original create as successful.
|
|
710
|
+
* @param params - Author subaccount and signing options, parent item, and complete original drawing JSON.
|
|
711
|
+
* @returns The parent ID and updated version together with the stored drawing.
|
|
712
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
713
|
+
* @throws {MobileServerFailureError} On authentication, ownership, eligibility, or invalid/oversized drawing
|
|
714
|
+
* errors, an unavailable parent, or `SOCIAL_FEED_DRAWING_EXISTS` for a conflicting existing drawing.
|
|
715
|
+
* Read the existing drawing and use updateFeedChartDrawing when replacement is intended.
|
|
716
|
+
*/
|
|
717
|
+
async createFeedChartDrawing(params) {
|
|
718
|
+
const request = await this.getSignedRequest("create_feed_chart_drawing", params, {
|
|
719
|
+
item_id: params.itemId,
|
|
720
|
+
data_json: params.dataJson
|
|
721
|
+
});
|
|
722
|
+
return mapMobileSocialFeedDrawingMutationResult(await this.execute(request));
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Replaces an existing drawing, including after the associated position has closed.
|
|
726
|
+
* Serialize writes per item and preserve the original JSON text when retrying.
|
|
727
|
+
* @param params - Author subaccount and signing options, parent item, and complete replacement JSON.
|
|
728
|
+
* @returns The parent ID and updated version together with the stored replacement drawing.
|
|
729
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
730
|
+
* @throws {MobileServerFailureError} On authentication, ownership, or invalid/oversized drawing errors, an
|
|
731
|
+
* unavailable parent or drawing, or `STALE_SOCIAL_FEED_DRAWING_UPDATE`. Re-read the drawing before retrying
|
|
732
|
+
* a stale or conflicting update instead of blindly replacing newer content.
|
|
733
|
+
*/
|
|
734
|
+
async updateFeedChartDrawing(params) {
|
|
735
|
+
const request = await this.getSignedRequest("update_feed_chart_drawing", params, {
|
|
736
|
+
item_id: params.itemId,
|
|
737
|
+
data_json: params.dataJson
|
|
738
|
+
});
|
|
739
|
+
return mapMobileSocialFeedDrawingMutationResult(await this.execute(request));
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Publishes a comment or reply atomically; an invalid position attachment rejects the entire request.
|
|
743
|
+
* For an idempotent retry, reuse clientRequestId and the unmodified text, mentions, and attachment.
|
|
744
|
+
* @param params - Author subaccount and signing options, request UUID, root item, original nonblank text
|
|
745
|
+
* and mentions, plus an optional reply target in the same thread and currently owned position attachment.
|
|
746
|
+
* @returns The created reply and authoritative root comment count; this write does not create a reading session.
|
|
747
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
748
|
+
* @throws {MobileServerFailureError} On authentication, inaccessible content, invalid text/mentions/reply
|
|
749
|
+
* relationships, an ineligible attachment, or `SOCIAL_FEED_REQUEST_CONFLICT`. Correct invalid input before
|
|
750
|
+
* a new submission, and never reuse an existing request UUID with different content.
|
|
751
|
+
*/
|
|
752
|
+
async createFeedComment(params) {
|
|
753
|
+
const request = await this.getSignedRequest("create_feed_comment", params, {
|
|
754
|
+
client_request_id: params.clientRequestId,
|
|
755
|
+
root_item_id: params.rootItemId,
|
|
756
|
+
reply_to_item_id: params.replyToItemId,
|
|
757
|
+
text: params.text,
|
|
758
|
+
mentions: params.mentions.map(mapMobileSocialFeedMentionToServer),
|
|
759
|
+
attached_position_id: params.attachedPositionId
|
|
760
|
+
});
|
|
761
|
+
return mapMobileSocialFeedCommentResult(await this.execute(request));
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Sets or clears a signed user's like without requiring an open position.
|
|
765
|
+
* Serialize mutations per item and author. Retrying the same isLiked state with a fresh nonce is safe
|
|
766
|
+
* when no newer change intervenes; an unchanged state does not increment the count or version again.
|
|
767
|
+
* Pass the original nonce on a retry before its deadline to avoid overwriting a newer change from
|
|
768
|
+
* another device. Re-read the current state if that retry conflicts.
|
|
769
|
+
* @param params - Acting subaccount and signing options, interactive item, and desired like state.
|
|
770
|
+
* @returns The applied like state, authoritative count, and item version after the mutation.
|
|
771
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
772
|
+
* @throws {MobileServerFailureError} On authentication errors, inaccessible or non-interactive content,
|
|
773
|
+
* or `STALE_SOCIAL_FEED_LIKE_UPDATE`. Re-read the current state before submitting a new mutation after a conflict.
|
|
774
|
+
*/
|
|
775
|
+
async setFeedLike(params) {
|
|
776
|
+
const request = await this.getSignedRequest("set_feed_like", params, {
|
|
777
|
+
item_id: params.itemId,
|
|
778
|
+
is_liked: params.isLiked
|
|
779
|
+
});
|
|
780
|
+
return mapMobileSocialFeedLikeResult(await this.execute(request));
|
|
781
|
+
}
|
|
485
782
|
async getSignedRequest(type, params, innerParams) {
|
|
486
783
|
const walletClient = this.opts.linkedSignerWalletClient ?? this.opts.walletClient;
|
|
487
784
|
if (walletClient == null) throw new WalletNotProvidedError();
|
package/dist/MobileClient.js.map
CHANGED
|
@@ -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 mapMobileAvatarPreset,\n mapMobileAvatarSelectionToServer,\n mapMobileAvatarUpload,\n mapMobileFeedPage,\n mapMobileFollowBatchResult,\n mapMobileFollowListPage,\n mapMobileFollowListParamsToServer,\n mapMobileFollowMutationResult,\n mapMobileNotificationPreferences,\n mapMobileNotificationPreferencesToServer,\n mapMobileProfileSearchPage,\n mapMobileProfileSearchParamsToServer,\n mapMobileProfilesIncludeToServer,\n mapMobilePublicProfile,\n mapMobileRegisteredWallet,\n mapMobileSocialFeedItemResponse,\n mapMobileSocialFeedListParamsToServer,\n mapMobileSocialFeedPage,\n mapMobileSocialFeedRankedPage,\n mapMobileSocialFeedReadParamsToServer,\n mapMobileSocialFeedTopTradersPage,\n mapMobileSocialFeedUpdates,\n} from './dataMappers';\nimport {\n buildSignedMobileRequest,\n MobileSignedInner,\n MobileSignedInnerByType,\n MobileSignedInnerParams,\n MobileSignedRequest,\n} from './signing';\nimport {\n GetMobileFeedItemParams,\n GetMobileFeedParams,\n GetMobileFeedUpdatesParams,\n GetMobileFollowersParams,\n GetMobileFollowingParams,\n GetMobileForYouFeedParams,\n GetMobileFriendsFeedParams,\n GetMobileMarketFeedParams,\n GetMobileNotificationPreferencesParams,\n GetMobilePositionFeedParams,\n GetMobileProfileFeedParams,\n GetMobileProfilesParams,\n GetMobileRegisteredWalletParams,\n GetMobileTopTradersFeedParams,\n GetMobileUsernameAvailabilityParams,\n MobileAvatarPreset,\n MobileAvatarUpload,\n MobileCreateAvatarUploadParams,\n MobileFeedPage,\n MobileFollowBatchResultItem,\n MobileFollowListPage,\n MobileFollowMutationResult,\n MobileNotificationPreferences,\n MobileProfileSearchPage,\n MobilePublicProfile,\n MobileRegisteredWallet,\n MobileRegisterExpoTokenParams,\n MobileSetAvatarParams,\n MobileSetBioParams,\n MobileSetFollowBatchParams,\n MobileSetFollowParams,\n MobileSetPrivateModeParams,\n MobileSetUsernameParams,\n MobileSignedRequestParams,\n MobileSocialFeedItemResponse,\n MobileSocialFeedPage,\n MobileSocialFeedRankedPage,\n MobileSocialFeedTopTradersPage,\n MobileSocialFeedUpdates,\n MobileUnregisterExpoTokenParams,\n MobileUpdateNotificationPreferencesParams,\n MobileUsernameAvailability,\n SearchMobileProfilesParams,\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, bios, avatars, public profile lookups, the global\n * trade feed, session-based social feeds, the follower/following graph, privacy settings, and push\n * 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 * Returns the current server-owned avatar catalogue in display order.\n *\n * @throws {MobileServerFailureError} With `SERVICE_UNAVAILABLE` when avatar storage is not configured.\n */\n async getAvatarPresets(): Promise<MobileAvatarPreset[]> {\n const body: MobileServerPublicQueryRequest<'avatar_presets'> = {\n type: 'avatar_presets',\n };\n const data = await this.publicQuery(body);\n return data.presets.map(mapMobileAvatarPreset);\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 * Searches claimed profiles by the start of their username, in ascending username order with an exact\n * match first. Only current claimed identities match: an unnamed profile never does, and Private Mode does\n * not hide one. Takes the same `include` as {@link MobileClient.getProfiles}, so a page can carry follower\n * totals and a follow summary without a second request; as there, `include.followSummary.viewAs` is an\n * unauthenticated claim on an unsigned route.\n *\n * Pagination is live rather than snapshot, so deduplicate matches by subaccount across pages. A cursor is\n * bound to the query alone, so `include` and `limit` may change between pages.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PROFILE_SEARCH_REQUEST` if `query` is outside\n * the username alphabet or length or `limit` is out of range (1-50, or 1-25 with an include),\n * `INVALID_PROFILE_SEARCH_CURSOR` if the cursor is malformed or was issued for a different query (discard\n * it and restart from the first page), or `PROFILE_NOT_FOUND` if `include.followSummary.viewAs` is in the\n * engine-created isolated namespace.\n */\n async searchProfiles(\n params: SearchMobileProfilesParams,\n ): Promise<MobileProfileSearchPage> {\n const body: MobileServerPublicQueryRequest<'search_profiles'> = {\n type: 'search_profiles',\n ...mapMobileProfileSearchParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileProfileSearchPage(data);\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 chronological For You recommendations with server-side author/thread constraints.\n * Always public, with optional viewAs for relationship state. Preserve the session, viewAs, filters, and limit\n * when paging, including through empty pages with a nextCursor. A 6312 error requires a refresh.\n * @param params - Filters, pagination, optional viewing account, and browser credential; no signing identity.\n * @returns A fixed-session page with its ranking version and new-content watermark.\n * @throws {MobileServerFailureError} On invalid parameters, session mismatch/expiry, or unavailable data.\n */\n async getForYouFeed(\n params: GetMobileForYouFeedParams = {},\n ): Promise<MobileSocialFeedRankedPage> {\n const body: MobileServerPublicQueryRequest<'for_you_feed'> = {\n type: 'for_you_feed',\n market_category: params.marketCategory,\n ...mapMobileSocialFeedListParamsToServer(params),\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedRankedPage(data);\n }\n\n /**\n * Fetches chronological content by qualified Top Traders, with official account PnL badges.\n * Always public; neither a wallet nor one-click trading setup is required.\n * @param params - Filters, pagination, optional viewing account, and browser credential.\n * @returns A page with its qualification cohort; an unavailable cohort fails instead of returning an empty ranking.\n * @throws {MobileServerFailureError} On request/session errors or unavailable cohort data.\n */\n async getTopTradersFeed(\n params: GetMobileTopTradersFeedParams = {},\n ): Promise<MobileSocialFeedTopTradersPage> {\n const body: MobileServerPublicQueryRequest<'top_traders_feed'> = {\n type: 'top_traders_feed',\n market_category: params.marketCategory,\n ...mapMobileSocialFeedListParamsToServer(params),\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedTopTradersPage(data);\n }\n\n /**\n * Fetches public content by authors followed by viewAs, without a signature. One-way following is sufficient.\n * @param params - Required viewing account on every request, filters, pagination, and browser credential.\n * @returns A chronological Friends page and reading session.\n * @throws {MobileServerFailureError} On invalid viewing account, session errors, or feed query failure.\n */\n async getFriendsFeed(\n params: GetMobileFriendsFeedParams,\n ): Promise<MobileSocialFeedRankedPage> {\n const body: MobileServerPublicQueryRequest<'friends_feed'> = {\n type: 'friends_feed',\n market_category: params.marketCategory,\n ...mapMobileSocialFeedListParamsToServer(params),\n view_as: subaccountToHex(params.viewAs),\n viewer_token: params.viewerToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedRankedPage(data);\n }\n\n /**\n * Fetches an author's content visible to viewAs, including that account's own hidden content.\n * @param params - Target identity, filters, pagination, and optional public viewing account.\n * @returns An author page without main-feed ranking or cohort fields.\n * @throws {MobileServerFailureError} On invalid parameters, session errors, or inaccessible content.\n */\n async getProfileFeed(\n params: GetMobileProfileFeedParams,\n ): Promise<MobileSocialFeedPage> {\n const body: MobileServerPublicQueryRequest<'profile_feed'> = {\n type: 'profile_feed',\n subaccount: subaccountToHex(params.subaccount),\n market_category: params.marketCategory,\n ...mapMobileSocialFeedListParamsToServer(params),\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedPage(data);\n }\n\n /**\n * Fetches published content for one market.\n * @param params - Product ID, content/size filters, pagination, and public viewing account.\n * @returns A market page without main-feed ranking fields.\n * @throws {MobileServerFailureError} On an unknown market, session errors, or unavailable data.\n */\n async getMarketFeed(\n params: GetMobileMarketFeedParams,\n ): Promise<MobileSocialFeedPage> {\n const body: MobileServerPublicQueryRequest<'market_feed'> = {\n type: 'market_feed',\n product_id: params.productId,\n ...mapMobileSocialFeedListParamsToServer(params),\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedPage(data);\n }\n\n /**\n * Fetches already published content for a position lifecycle. This is not full position history\n * and includes hidden content owned by viewAs under account_view. It does not recreate suppressed activity.\n * @param params - Position UUID, filters, pagination, and public viewing account.\n * @returns A fixed-session position feed page.\n * @throws {MobileServerFailureError} On inaccessible content, session errors, or unavailable data.\n */\n async getPositionFeed(\n params: GetMobilePositionFeedParams,\n ): Promise<MobileSocialFeedPage> {\n const body: MobileServerPublicQueryRequest<'position_feed'> = {\n type: 'position_feed',\n position_id: params.positionId,\n ...mapMobileSocialFeedListParamsToServer(params),\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedPage(data);\n }\n\n /**\n * Reads one item visible to viewAs, including that account's own hidden content.\n * Creates an item session directly when sessionId is omitted.\n * @param params - Item UUID, preview limit, and optional existing session/read identity.\n * @returns The complete item and authorized reading session.\n * @throws {MobileServerFailureError} On inaccessible content or session mismatch/expiry.\n */\n async getFeedItem(\n params: GetMobileFeedItemParams,\n ): Promise<MobileSocialFeedItemResponse> {\n const body: MobileServerPublicQueryRequest<'feed_item'> = {\n type: 'feed_item',\n item_id: params.itemId,\n comment_preview_limit: params.commentPreviewLimit,\n session_id: params.sessionId,\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedItemResponse(data);\n }\n\n /**\n * Polls authorized visible items and positions without inserting or reordering list members.\n * Increment requestSeq across the entire session, including viewport changes; never reset it for a new viewport.\n * Accept only the current session and viewportRevision's latest requestSeq; discard stale patches and cursors together.\n * Updates currently always return reset=true. Apply current author details, follow state, and badges even if the item version is unchanged.\n * Null patches clear values;\n * omitted fields leave them unchanged. Stop polling off-screen and refresh on error 6312.\n * @param params - Session, visible IDs, update baseline, sequence, and matching read identity.\n * @returns Item/position patches, revoked targets, and a new-content hint.\n * @throws {MobileServerFailureError} On invalid or unauthorized targets, session expiry, or unavailable data.\n */\n async getFeedUpdates(\n params: GetMobileFeedUpdatesParams,\n ): Promise<MobileSocialFeedUpdates> {\n const body: MobileServerPublicQueryRequest<'feed_updates'> = {\n type: 'feed_updates',\n session_id: params.sessionId,\n visible_item_ids: params.visibleItemIds,\n visible_position_ids: params.visiblePositionIds,\n update_cursor: params.updateCursor,\n viewport_revision: params.viewportRevision,\n request_seq: params.requestSeq,\n viewer_token: params.viewerToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedUpdates(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 * Updates the biography, or clears it when the text is whitespace-only.\n *\n * Serialize this with {@link MobileClient.setAvatar}, {@link MobileClient.setUsername} and\n * {@link MobileClient.setPrivateMode} for the same subaccount: all share the identity update nonce.\n *\n * @throws {MobileServerFailureError} With `INVALID_BIO` for exceeding `MOBILE_BIO_MAX_LENGTH` or null\n * characters, `INVALID_IDENTITY_TARGET` for an isolated subaccount, or `STALE_IDENTITY_UPDATE` when a\n * later write has committed (re-read the profile before retrying).\n */\n async setBio(\n params: MobileSetBioParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest('set_bio', params, {\n bio: params.bio,\n });\n return this.execute(signedRequest);\n }\n\n /**\n * Creates a short-lived upload grant. The caller uploads an image meeting {@link MobileAvatarUpload}'s requirements;\n * file access and transport remain platform-specific. This does not change the saved avatar.\n *\n * @throws {MobileServerFailureError} With `INVALID_AVATAR` for a zero or oversized upload,\n * `INVALID_IDENTITY_TARGET` for an isolated subaccount, or `SERVICE_UNAVAILABLE` when storage is unavailable.\n */\n async createAvatarUpload(\n params: MobileCreateAvatarUploadParams,\n ): Promise<MobileAvatarUpload> {\n const signedRequest = await this.getSignedRequest(\n 'create_avatar_upload',\n params,\n { content_length: params.contentLength },\n );\n const data = await this.execute(signedRequest);\n return mapMobileAvatarUpload(data);\n }\n\n /**\n * Publishes a preset/staged upload, or clears the saved avatar when avatar is null.\n * Uploaded JPEG/PNG images must be square, at most 4096 × 4096 pixels, and within\n * `MOBILE_AVATAR_MAX_UPLOAD_BYTES`. A successful PUT can still fail this publication check.\n *\n * Serialize identity writes for the same subaccount; see {@link MobileClient.setBio}.\n *\n * @throws {MobileServerFailureError} With `INVALID_AVATAR` for an invalid preset, staging key, or image,\n * `INVALID_IDENTITY_TARGET` for an isolated subaccount, `SERVICE_UNAVAILABLE` when storage is unavailable,\n * or `STALE_IDENTITY_UPDATE` when a later write has committed (re-read the profile before retrying).\n */\n async setAvatar(\n params: MobileSetAvatarParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest('set_avatar', params, {\n avatar: mapMobileAvatarSelectionToServer(params.avatar),\n });\n return this.execute(signedRequest);\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 * Serialize identity writes for the same subaccount; see {@link MobileClient.setBio}.\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 * Serialize identity writes for the same subaccount; see {@link MobileClient.setBio}.\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 * Sets whether the signing subaccount follows each of up to `MOBILE_FOLLOW_BATCH_MAX_SIZE` (25) Profiles in\n * one signed request, which costs far less of the shared IP rate limit than one {@link MobileClient.setFollow}\n * per target. The server validates the whole list before writing and commits every target in one database\n * transaction, so the batch either fully applies or changes nothing. Each target has the same idempotent\n * semantics as `setFollow`, so resending a batch is safe.\n *\n * Targets are lowercased before signing but not deduplicated, and two spellings of one subaccount are a\n * duplicate. Longer lists must be split by the caller; each request commits on its own, so earlier chunks\n * stay applied when a later one fails.\n *\n * @returns One result per target, in request order, carrying each target's post-commit follower count.\n * @throws {MobileServerFailureError} With error code `INVALID_FOLLOW_BATCH` if `targets` is empty, holds\n * duplicates, or exceeds the maximum, or `INVALID_FOLLOW_TARGET` if any target is the sender or either party\n * is isolated. Either rejects the whole batch before any write, so do not retry it unchanged.\n */\n async setFollowBatch(\n params: MobileSetFollowBatchParams,\n ): Promise<MobileFollowBatchResultItem[]> {\n const signedRequest = await this.getSignedRequest(\n 'set_follow_batch',\n params,\n {\n subaccounts: params.targets.map(subaccountToHex),\n is_following: params.isFollowing,\n },\n );\n const data = await this.execute(signedRequest);\n return mapMobileFollowBatchResult(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}/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}/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}/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":";;;;;;;;;;;;;AAmIA,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;;;;;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,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 mapMobileAvatarPreset,\n mapMobileAvatarSelectionToServer,\n mapMobileAvatarUpload,\n mapMobileFeedPage,\n mapMobileFollowBatchResult,\n mapMobileFollowListPage,\n mapMobileFollowListParamsToServer,\n mapMobileFollowMutationResult,\n mapMobileNotificationPreferences,\n mapMobileNotificationPreferencesToServer,\n mapMobileProfileSearchPage,\n mapMobileProfileSearchParamsToServer,\n mapMobileProfilesIncludeToServer,\n mapMobilePublicProfile,\n mapMobileRegisteredWallet,\n mapMobileSocialFeedActionResolutionResult,\n mapMobileSocialFeedCommentResult,\n mapMobileSocialFeedCommentsPage,\n mapMobileSocialFeedDrawingMutationResult,\n mapMobileSocialFeedDrawingResult,\n mapMobileSocialFeedItem,\n mapMobileSocialFeedItemResponse,\n mapMobileSocialFeedLikeResult,\n mapMobileSocialFeedListParamsToServer,\n mapMobileSocialFeedMentionToServer,\n mapMobileSocialFeedPage,\n mapMobileSocialFeedPositionChart,\n mapMobileSocialFeedPositionHistory,\n mapMobileSocialFeedPositionResolutionResult,\n mapMobileSocialFeedPositionsPage,\n mapMobileSocialFeedPresence,\n mapMobileSocialFeedRankedPage,\n mapMobileSocialFeedReadParamsToServer,\n mapMobileSocialFeedTopTradersPage,\n mapMobileSocialFeedUpdates,\n mapMobileSocialFeedViewsResult,\n mapMobileSocialFeedWatchers,\n} from './dataMappers';\nimport {\n buildSignedMobileRequest,\n MobileSignedInner,\n MobileSignedInnerByType,\n MobileSignedInnerParams,\n MobileSignedRequest,\n} from './signing';\nimport {\n GetMobileFeedChartDrawingParams,\n GetMobileFeedCommentsParams,\n GetMobileFeedItemParams,\n GetMobileFeedParams,\n GetMobileFeedUpdatesParams,\n GetMobileFollowersParams,\n GetMobileFollowingParams,\n GetMobileForYouFeedParams,\n GetMobileFriendsFeedParams,\n GetMobileMarketFeedParams,\n GetMobileNotificationPreferencesParams,\n GetMobilePositionChartParams,\n GetMobilePositionFeedParams,\n GetMobilePositionHistoryParams,\n GetMobilePositionWatchersParams,\n GetMobileProfileFeedParams,\n GetMobileProfilesParams,\n GetMobileRegisteredWalletParams,\n GetMobileSelfFeedPositionsParams,\n GetMobileTopTradersFeedParams,\n GetMobileUsernameAvailabilityParams,\n MobileAvatarPreset,\n MobileAvatarUpload,\n MobileCreateAvatarUploadParams,\n MobileCreateFeedCommentParams,\n MobileCreateFeedPostParams,\n MobileFeedChartDrawingParams,\n MobileFeedPage,\n MobileFollowBatchResultItem,\n MobileFollowListPage,\n MobileFollowMutationResult,\n MobileNotificationPreferences,\n MobilePositionPresenceParams,\n MobileProfileSearchPage,\n MobilePublicProfile,\n MobileRecordFeedViewsParams,\n MobileRegisteredWallet,\n MobileRegisterExpoTokenParams,\n MobileSetAvatarParams,\n MobileSetBioParams,\n MobileSetFeedLikeParams,\n MobileSetFollowBatchParams,\n MobileSetFollowParams,\n MobileSetPrivateModeParams,\n MobileSetUsernameParams,\n MobileSignedRequestParams,\n MobileSocialFeedActionResolutionResult,\n MobileSocialFeedCommentResult,\n MobileSocialFeedCommentsPage,\n MobileSocialFeedDrawingMutationResult,\n MobileSocialFeedDrawingResult,\n MobileSocialFeedItem,\n MobileSocialFeedItemResponse,\n MobileSocialFeedLikeResult,\n MobileSocialFeedPage,\n MobileSocialFeedPositionChart,\n MobileSocialFeedPositionHistory,\n MobileSocialFeedPositionResolutionResult,\n MobileSocialFeedPositionsPage,\n MobileSocialFeedPresence,\n MobileSocialFeedRankedPage,\n MobileSocialFeedTopTradersPage,\n MobileSocialFeedUpdates,\n MobileSocialFeedViewsResult,\n MobileSocialFeedWatchers,\n MobileUnregisterExpoTokenParams,\n MobileUpdateNotificationPreferencesParams,\n MobileUsernameAvailability,\n ResolveMobileFeedActionParams,\n ResolveMobileFeedPositionParams,\n SearchMobileProfilesParams,\n} from './types/clientTypes';\nimport { MobileServerFailureError } from './types/MobileServerFailureError';\nimport { MobileServerSuccessResponse } from './types/serverBaseTypes';\nimport {\n MobileServerExecuteResult,\n MobileServerExecuteSuccessResponse,\n MobileServerPublicExecuteRequest,\n MobileServerPublicExecuteSuccessResponse,\n} from './types/serverExecuteTypes';\nimport {\n MobileServerPublicQueryRequest,\n MobileServerPublicQuerySuccessResponse,\n} from './types/serverQueryTypes';\nimport {\n MobileServerExecuteRequestType,\n MobileServerPublicExecuteRequestByType,\n MobileServerPublicExecuteRequestType,\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, bios, avatars, public profile lookups, the global\n * trade feed, session-based social feeds, the follower/following graph, privacy settings, and push\n * 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 * Returns the current server-owned avatar catalogue in display order.\n *\n * @throws {MobileServerFailureError} With `SERVICE_UNAVAILABLE` when avatar storage is not configured.\n */\n async getAvatarPresets(): Promise<MobileAvatarPreset[]> {\n const body: MobileServerPublicQueryRequest<'avatar_presets'> = {\n type: 'avatar_presets',\n };\n const data = await this.publicQuery(body);\n return data.presets.map(mapMobileAvatarPreset);\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 * Searches claimed profiles by the start of their username, in ascending username order with an exact\n * match first. Only current claimed identities match: an unnamed profile never does, and Private Mode does\n * not hide one. Takes the same `include` as {@link MobileClient.getProfiles}, so a page can carry follower\n * totals and a follow summary without a second request; as there, `include.followSummary.viewAs` is an\n * unauthenticated claim on an unsigned route.\n *\n * Pagination is live rather than snapshot, so deduplicate matches by subaccount across pages. A cursor is\n * bound to the query alone, so `include` and `limit` may change between pages.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PROFILE_SEARCH_REQUEST` if `query` is outside\n * the username alphabet or length or `limit` is out of range (1-50, or 1-25 with an include),\n * `INVALID_PROFILE_SEARCH_CURSOR` if the cursor is malformed or was issued for a different query (discard\n * it and restart from the first page), or `PROFILE_NOT_FOUND` if `include.followSummary.viewAs` is in the\n * engine-created isolated namespace.\n */\n async searchProfiles(\n params: SearchMobileProfilesParams,\n ): Promise<MobileProfileSearchPage> {\n const body: MobileServerPublicQueryRequest<'search_profiles'> = {\n type: 'search_profiles',\n ...mapMobileProfileSearchParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileProfileSearchPage(data);\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 chronological For You recommendations with server-side author/thread constraints.\n * Always public, with optional viewAs for relationship state. Preserve the session, viewAs, filters, and limit\n * when paging, including through empty pages with a nextCursor. A 6312 error requires a refresh.\n * @param params - Filters, pagination, optional viewing account, and browser credential; no signing identity.\n * @returns A fixed-session page with its ranking version and new-content watermark.\n * @throws {MobileServerFailureError} On invalid parameters, session mismatch/expiry, or unavailable data.\n * @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.\n */\n async getForYouFeed(\n params: GetMobileForYouFeedParams = {},\n ): Promise<MobileSocialFeedRankedPage> {\n const body: MobileServerPublicQueryRequest<'for_you_feed'> = {\n type: 'for_you_feed',\n market_category: params.marketCategory,\n ...mapMobileSocialFeedListParamsToServer(params),\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedRankedPage(data);\n }\n\n /**\n * Fetches chronological content by qualified Top Traders, with official account PnL badges.\n * Always public; neither a wallet nor one-click trading setup is required.\n * @param params - Filters, pagination, optional viewing account, and browser credential.\n * @returns A page with its qualification cohort; an unavailable cohort fails instead of returning an empty ranking.\n * @throws {MobileServerFailureError} On request/session errors or unavailable cohort data.\n * @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.\n */\n async getTopTradersFeed(\n params: GetMobileTopTradersFeedParams = {},\n ): Promise<MobileSocialFeedTopTradersPage> {\n const body: MobileServerPublicQueryRequest<'top_traders_feed'> = {\n type: 'top_traders_feed',\n market_category: params.marketCategory,\n ...mapMobileSocialFeedListParamsToServer(params),\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedTopTradersPage(data);\n }\n\n /**\n * Fetches public content by authors followed by viewAs, without a signature. One-way following is sufficient.\n * @param params - Required viewing account on every request, filters, pagination, and browser credential.\n * @returns A chronological Friends page and reading session.\n * @throws {MobileServerFailureError} On invalid viewing account, session errors, or feed query failure.\n * @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.\n */\n async getFriendsFeed(\n params: GetMobileFriendsFeedParams,\n ): Promise<MobileSocialFeedRankedPage> {\n const body: MobileServerPublicQueryRequest<'friends_feed'> = {\n type: 'friends_feed',\n market_category: params.marketCategory,\n ...mapMobileSocialFeedListParamsToServer(params),\n view_as: subaccountToHex(params.viewAs),\n viewer_token: params.viewerToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedRankedPage(data);\n }\n\n /**\n * Fetches an author's content visible to viewAs, including that account's own hidden content.\n * @param params - Target identity, filters, pagination, and optional public viewing account.\n * @returns An author page without main-feed ranking or cohort fields.\n * @throws {MobileServerFailureError} On invalid parameters, session errors, or inaccessible content.\n * @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.\n */\n async getProfileFeed(\n params: GetMobileProfileFeedParams,\n ): Promise<MobileSocialFeedPage> {\n const body: MobileServerPublicQueryRequest<'profile_feed'> = {\n type: 'profile_feed',\n subaccount: subaccountToHex(params.subaccount),\n market_category: params.marketCategory,\n ...mapMobileSocialFeedListParamsToServer(params),\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedPage(data);\n }\n\n /**\n * Fetches published content for one market.\n * @param params - Product ID, content/size filters, pagination, and public viewing account.\n * @returns A market page without main-feed ranking fields.\n * @throws {MobileServerFailureError} On an unknown market, session errors, or unavailable data.\n * @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.\n */\n async getMarketFeed(\n params: GetMobileMarketFeedParams,\n ): Promise<MobileSocialFeedPage> {\n const body: MobileServerPublicQueryRequest<'market_feed'> = {\n type: 'market_feed',\n product_id: params.productId,\n ...mapMobileSocialFeedListParamsToServer(params),\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedPage(data);\n }\n\n /**\n * Fetches already published content for a position lifecycle. This is not full position history\n * and includes hidden content owned by viewAs under account_view. It does not recreate suppressed activity.\n * @param params - Position UUID, filters, pagination, and public viewing account.\n * @returns A fixed-session position feed page.\n * @throws {MobileServerFailureError} On inaccessible content, session errors, or unavailable data.\n * @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.\n */\n async getPositionFeed(\n params: GetMobilePositionFeedParams,\n ): Promise<MobileSocialFeedPage> {\n const body: MobileServerPublicQueryRequest<'position_feed'> = {\n type: 'position_feed',\n position_id: params.positionId,\n ...mapMobileSocialFeedListParamsToServer(params),\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedPage(data);\n }\n\n /**\n * Reads one item visible to viewAs, including that account's own hidden content.\n * Creates an item session directly when sessionId is omitted.\n * @param params - Item UUID, preview limit, and optional existing session/read identity.\n * @returns The complete item and authorized reading session.\n * @throws {MobileServerFailureError} On inaccessible content or session mismatch/expiry.\n * @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.\n */\n async getFeedItem(\n params: GetMobileFeedItemParams,\n ): Promise<MobileSocialFeedItemResponse> {\n const body: MobileServerPublicQueryRequest<'feed_item'> = {\n type: 'feed_item',\n item_id: params.itemId,\n comment_preview_limit: params.commentPreviewLimit,\n session_id: params.sessionId,\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedItemResponse(data);\n }\n\n /**\n * Polls authorized visible items and positions without inserting or reordering list members.\n * Increment requestSeq across the entire session, including viewport changes; never reset it for a new viewport.\n * Accept only the current session and viewportRevision's latest requestSeq; discard stale patches and cursors together.\n * Updates currently always return reset=true. Apply current author details, follow state, and badges even if the item version is unchanged.\n * Null patches clear values;\n * omitted fields leave them unchanged. Stop polling off-screen and refresh on error 6312.\n * @param params - Session, visible IDs, update baseline, sequence, and matching read identity.\n * @returns Item/position patches, revoked targets, and a new-content hint.\n * @throws {MobileServerFailureError} On invalid or unauthorized targets, session expiry, or unavailable data.\n */\n async getFeedUpdates(\n params: GetMobileFeedUpdatesParams,\n ): Promise<MobileSocialFeedUpdates> {\n const body: MobileServerPublicQueryRequest<'feed_updates'> = {\n type: 'feed_updates',\n session_id: params.sessionId,\n visible_item_ids: params.visibleItemIds,\n visible_position_ids: params.visiblePositionIds,\n update_cursor: params.updateCursor,\n viewport_revision: params.viewportRevision,\n request_seq: params.requestSeq,\n viewer_token: params.viewerToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileSocialFeedUpdates(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 * Lists a selected account's current positions without signing or authenticating ownership.\n * Publication and attachment eligibility are hints that the service rechecks on writes.\n * @param params - Viewing subaccount, optional market filter, page size, and opaque cursor.\n * @returns Current position candidates, their eligibility hints, the next cursor, and observation time.\n * @throws {MobileServerFailureError} On invalid parameters, an unsupported viewing account, or unavailable\n * position data. An account with no open positions returns an empty page instead of an error.\n */\n async getSelfFeedPositions(\n params: GetMobileSelfFeedPositionsParams,\n ): Promise<MobileSocialFeedPositionsPage> {\n const body: MobileServerPublicQueryRequest<'self_feed_positions'> = {\n type: 'self_feed_positions',\n view_as: subaccountToHex(params.viewAs),\n product_id: params.productId,\n cursor: params.cursor,\n limit: params.limit,\n };\n return mapMobileSocialFeedPositionsPage(await this.publicQuery(body));\n }\n\n /**\n * Resolves a slash command against a selected account without changing the caller's input.\n * @param params - Viewing subaccount, original command text, and optional market disambiguation.\n * @returns The resolution, nullable market, candidate positions, and reason for an empty result.\n * @throws {MobileServerFailureError} On invalid parameters, an unsupported viewing account, or unavailable\n * source data. Unknown markets and accounts without open positions are normal resolution results.\n */\n async resolveFeedPosition(\n params: ResolveMobileFeedPositionParams,\n ): Promise<MobileSocialFeedPositionResolutionResult> {\n const body: MobileServerPublicQueryRequest<'resolve_feed_position'> = {\n type: 'resolve_feed_position',\n view_as: subaccountToHex(params.viewAs),\n input: params.input,\n product_id: params.productId,\n };\n return mapMobileSocialFeedPositionResolutionResult(\n await this.publicQuery(body),\n );\n }\n\n /**\n * Resolves every trusted lifecycle segment of an order without requiring a signature.\n * @param params - Order-owning subaccount and order digest; selecting the account is not authentication.\n * @returns Trusted action candidates and their observation time, or a pending result with no actions.\n * @throws {MobileServerFailureError} On invalid parameters, an inaccessible order, or unavailable source\n * data. Pending projection is a successful result, not a source failure.\n */\n async resolveFeedAction(\n params: ResolveMobileFeedActionParams,\n ): Promise<MobileSocialFeedActionResolutionResult> {\n const body: MobileServerPublicQueryRequest<'resolve_feed_action'> = {\n type: 'resolve_feed_action',\n view_as: subaccountToHex(params.viewAs),\n order_digest: params.orderDigest,\n };\n return mapMobileSocialFeedActionResolutionResult(\n await this.publicQuery(body),\n );\n }\n\n /**\n * Reads a drawing publicly without issuing a reading session. Supplied sessions retain their scope.\n * @param params - Parent item, optional viewing account, and optional original session and viewer token.\n * @returns The parent ID and version, with a nullable drawing whose data may legitimately be false or zero.\n * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, unavailable data,\n * or `SOCIAL_FEED_DRAWING_UNAVAILABLE` when the parent is inaccessible. A readable parent without a drawing\n * returns null. Acquire a new reading session when the original has expired.\n */\n async getFeedChartDrawing(\n params: GetMobileFeedChartDrawingParams,\n ): Promise<MobileSocialFeedDrawingResult> {\n const body: MobileServerPublicQueryRequest<'feed_chart_drawing'> = {\n type: 'feed_chart_drawing',\n item_id: params.itemId,\n session_id: params.sessionId,\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n return mapMobileSocialFeedDrawingResult(await this.publicQuery(body));\n }\n\n /**\n * Reads a comment thread with an optional anchor and bidirectional pagination.\n * Independent reads create a public-only session; reused sessions retain their original scope.\n * @param params - Root item, optional anchor or cursor (mutually exclusive), page size, and read perspective.\n * Paging requires the original session and viewer token.\n * @returns Replies, total count, forward and backward cursors, the anchor, and the actual reading session.\n * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,\n * or unavailable data. Restart pagination with a new session after expiry; do not reuse the old cursor.\n */\n async getFeedComments(\n params: GetMobileFeedCommentsParams,\n ): Promise<MobileSocialFeedCommentsPage> {\n const body: MobileServerPublicQueryRequest<'feed_comments'> = {\n type: 'feed_comments',\n root_item_id: params.rootItemId,\n cursor: params.cursor,\n limit: params.limit,\n anchor_reply_id: params.anchorReplyId,\n session_id: params.sessionId,\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n return mapMobileSocialFeedCommentsPage(await this.publicQuery(body));\n }\n\n /**\n * Reads the full position lifecycle and creates or reuses a position session.\n * Unlike getPositionFeed, this includes lifecycle actions as well as published takes.\n * @param params - Position, optional takes-only filter, pagination, and read perspective. Paging requires\n * the original position session and viewer token, not a feed session.\n * @returns Position metrics, ordered action/take history, summary, trading hints, cursor, and reading session.\n * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,\n * or unavailable source data. Restart with a new position session after expiry.\n * @throws {MobileUnsupportedFeedItemError} If a timeline entry or take has an unsupported kind.\n */\n async getPositionHistory(\n params: GetMobilePositionHistoryParams,\n ): Promise<MobileSocialFeedPositionHistory> {\n const body: MobileServerPublicQueryRequest<'position_history'> = {\n type: 'position_history',\n position_id: params.positionId,\n takes_only: params.takesOnly,\n cursor: params.cursor,\n limit: params.limit,\n session_id: params.sessionId,\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n return mapMobileSocialFeedPositionHistory(await this.publicQuery(body));\n }\n\n /**\n * Reads candles and action markers without creating a reading session.\n * Preserve the original range, interval, and read perspective when paging with nextBeforeMs.\n * @param params - Position, candle interval, half-open time range, pagination, and optional original session\n * and viewer token. An independent read omits both session credentials.\n * @returns Candles with decimal prices and x18 volume, action markers, a nullable liquidation line, and paging metadata.\n * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,\n * or wholly unavailable chart sources. Partially available data is returned with its quality indicator.\n */\n async getPositionChart(\n params: GetMobilePositionChartParams,\n ): Promise<MobileSocialFeedPositionChart> {\n const body: MobileServerPublicQueryRequest<'position_chart'> = {\n type: 'position_chart',\n position_id: params.positionId,\n session_id: params.sessionId,\n interval: params.interval,\n range: { from_ms: params.range.fromMs, to_ms: params.range.toMs },\n before_ms: params.beforeMs,\n limit: params.limit,\n ...mapMobileSocialFeedReadParamsToServer(params),\n };\n return mapMobileSocialFeedPositionChart(await this.publicQuery(body));\n }\n\n /**\n * Reads active visitor counts and self-reported account previews without registering presence.\n * @param params - Position and optional viewing account, used only for preview relationship information.\n * @returns The visitor count, public account previews, and observation time; previews need not match the count.\n * @throws {MobileServerFailureError} On invalid parameters, an unavailable position, or unavailable source data.\n */\n async getPositionWatchers(\n params: GetMobilePositionWatchersParams,\n ): Promise<MobileSocialFeedWatchers> {\n const body: MobileServerPublicQueryRequest<'position_watchers'> = {\n type: 'position_watchers',\n position_id: params.positionId,\n view_as:\n params.viewAs === undefined\n ? undefined\n : subaccountToHex(params.viewAs),\n };\n return mapMobileSocialFeedWatchers(await this.publicQuery(body));\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 * Reports qualified exposures without signing. Ordinary reads and root previews do not count as exposures.\n * The caller must satisfy the session's viewTracking requirements before reporting an item.\n * @param params - Original reading session and viewer token, plus one to fifty fully delivered, readable,\n * interactive item IDs. The service deduplicates repeated exposures.\n * @returns Separate lists of newly accepted and already-counted item IDs.\n * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, or any ineligible item.\n * A rejected batch is not partially counted. Acquire a new session after expiry and re-evaluate exposure eligibility.\n */\n async recordFeedViews(\n params: MobileRecordFeedViewsParams,\n ): Promise<MobileSocialFeedViewsResult> {\n const body: MobileServerPublicExecuteRequest<'record_feed_views'> = {\n type: 'record_feed_views',\n session_id: params.sessionId,\n item_ids: params.itemIds,\n viewer_token: params.viewerToken,\n };\n return mapMobileSocialFeedViewsResult(await this.publicExecute(body));\n }\n\n /**\n * Registers, renews, or leaves a page lease without signing or authenticating the displayed account.\n * Omitting watcherSubaccount preserves its value; null clears it. This operation does not record item views.\n * @param params - Authorized position, original session and viewer token, page-scoped viewSessionId,\n * lease state, and optional self-reported display account. Retain viewSessionId for the lifetime of the page.\n * @returns Visitor count, public previews, recommended heartbeat interval, and remaining lease lifetime.\n * @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, or an inaccessible\n * position. Rejected requests leave leases unchanged; acquire a new reading session after expiry.\n */\n async setPositionPresence(\n params: MobilePositionPresenceParams,\n ): Promise<MobileSocialFeedPresence> {\n const body: MobileServerPublicExecuteRequest<'position_presence'> = {\n type: 'position_presence',\n position_id: params.positionId,\n session_id: params.sessionId,\n view_session_id: params.viewSessionId,\n state: params.state,\n viewer_token: params.viewerToken,\n ...(params.watcherSubaccount === undefined\n ? {}\n : {\n watcher_subaccount:\n params.watcherSubaccount === null\n ? null\n : subaccountToHex(params.watcherSubaccount),\n }),\n };\n return mapMobileSocialFeedPresence(await this.publicExecute(body));\n }\n\n /*\n Signed executes\n */\n\n /**\n * Updates the biography, or clears it when the text is whitespace-only.\n *\n * Serialize this with {@link MobileClient.setAvatar}, {@link MobileClient.setUsername} and\n * {@link MobileClient.setPrivateMode} for the same subaccount: all share the identity update nonce.\n *\n * @throws {MobileServerFailureError} With `INVALID_BIO` for exceeding `MOBILE_BIO_MAX_LENGTH` or null\n * characters, `INVALID_IDENTITY_TARGET` for an isolated subaccount, or `STALE_IDENTITY_UPDATE` when a\n * later write has committed (re-read the profile before retrying).\n */\n async setBio(\n params: MobileSetBioParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest('set_bio', params, {\n bio: params.bio,\n });\n return this.execute(signedRequest);\n }\n\n /**\n * Creates a short-lived upload grant. The caller uploads an image meeting {@link MobileAvatarUpload}'s requirements;\n * file access and transport remain platform-specific. This does not change the saved avatar.\n *\n * @throws {MobileServerFailureError} With `INVALID_AVATAR` for a zero or oversized upload,\n * `INVALID_IDENTITY_TARGET` for an isolated subaccount, or `SERVICE_UNAVAILABLE` when storage is unavailable.\n */\n async createAvatarUpload(\n params: MobileCreateAvatarUploadParams,\n ): Promise<MobileAvatarUpload> {\n const signedRequest = await this.getSignedRequest(\n 'create_avatar_upload',\n params,\n { content_length: params.contentLength },\n );\n const data = await this.execute(signedRequest);\n return mapMobileAvatarUpload(data);\n }\n\n /**\n * Publishes a preset/staged upload, or clears the saved avatar when avatar is null.\n * Uploaded JPEG/PNG images must be square, at most 4096 × 4096 pixels, and within\n * `MOBILE_AVATAR_MAX_UPLOAD_BYTES`. A successful PUT can still fail this publication check.\n *\n * Serialize identity writes for the same subaccount; see {@link MobileClient.setBio}.\n *\n * @throws {MobileServerFailureError} With `INVALID_AVATAR` for an invalid preset, staging key, or image,\n * `INVALID_IDENTITY_TARGET` for an isolated subaccount, `SERVICE_UNAVAILABLE` when storage is unavailable,\n * or `STALE_IDENTITY_UPDATE` when a later write has committed (re-read the profile before retrying).\n */\n async setAvatar(\n params: MobileSetAvatarParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest('set_avatar', params, {\n avatar: mapMobileAvatarSelectionToServer(params.avatar),\n });\n return this.execute(signedRequest);\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 * Serialize identity writes for the same subaccount; see {@link MobileClient.setBio}.\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 * Serialize identity writes for the same subaccount; see {@link MobileClient.setBio}.\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 * Sets whether the signing subaccount follows each of up to `MOBILE_FOLLOW_BATCH_MAX_SIZE` (25) Profiles in\n * one signed request, which costs far less of the shared IP rate limit than one {@link MobileClient.setFollow}\n * per target. The server validates the whole list before writing and commits every target in one database\n * transaction, so the batch either fully applies or changes nothing. Each target has the same idempotent\n * semantics as `setFollow`, so resending a batch is safe.\n *\n * Targets are lowercased before signing but not deduplicated, and two spellings of one subaccount are a\n * duplicate. Longer lists must be split by the caller; each request commits on its own, so earlier chunks\n * stay applied when a later one fails.\n *\n * @returns One result per target, in request order, carrying each target's post-commit follower count.\n * @throws {MobileServerFailureError} With error code `INVALID_FOLLOW_BATCH` if `targets` is empty, holds\n * duplicates, or exceeds the maximum, or `INVALID_FOLLOW_TARGET` if any target is the sender or either party\n * is isolated. Either rejects the whole batch before any write, so do not retry it unchanged.\n */\n async setFollowBatch(\n params: MobileSetFollowBatchParams,\n ): Promise<MobileFollowBatchResultItem[]> {\n const signedRequest = await this.getSignedRequest(\n 'set_follow_batch',\n params,\n {\n subaccounts: params.targets.map(subaccountToHex),\n is_following: params.isFollowing,\n },\n );\n const data = await this.execute(signedRequest);\n return mapMobileFollowBatchResult(data);\n }\n\n /**\n * Publishes text, a drawing, or both atomically using the signed author identity.\n * For an idempotent retry, reuse clientRequestId and the exact original content with a valid signature.\n * The SDK does not trim text or reformat the signed drawing JSON.\n * @param params - Author subaccount and signing options, request UUID, owned position, original text and\n * mentions, plus an optional trusted action and original drawing JSON.\n * @returns The published item, including authoritative interaction state and any drawing or comment preview.\n * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.\n * @throws {MobileServerFailureError} On authentication, ownership, eligibility, content, mention, or drawing\n * errors, or `SOCIAL_FEED_REQUEST_CONFLICT` when a request UUID is reused with different content. Do not\n * change an earlier request to retry it; use a new UUID for a genuinely new publication.\n * @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.\n */\n async createFeedPost(\n params: MobileCreateFeedPostParams,\n ): Promise<MobileSocialFeedItem> {\n const request = await this.getSignedRequest('create_feed_post', params, {\n client_request_id: params.clientRequestId,\n position_id: params.positionId,\n action_id: params.actionId,\n text: params.text,\n mentions: params.mentions.map(mapMobileSocialFeedMentionToServer),\n drawing_data_json: params.drawingDataJson,\n });\n return mapMobileSocialFeedItem((await this.execute(request)).item);\n }\n\n /**\n * First attaches a drawing to an owned post or trade card while the author still holds its position.\n * The original JSON is signed unchanged; false and zero are valid drawing documents.\n * For an exact retry after a timeout, generate a nonce up front with {@link getMobileNonce} and reuse\n * that nonce and the original JSON before its receive deadline. A fresh nonce is not an exact replay.\n * If a retry returns `SOCIAL_FEED_DRAWING_EXISTS`, use {@link getFeedChartDrawing} to confirm that the\n * stored data matches the intended drawing before treating the original create as successful.\n * @param params - Author subaccount and signing options, parent item, and complete original drawing JSON.\n * @returns The parent ID and updated version together with the stored drawing.\n * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.\n * @throws {MobileServerFailureError} On authentication, ownership, eligibility, or invalid/oversized drawing\n * errors, an unavailable parent, or `SOCIAL_FEED_DRAWING_EXISTS` for a conflicting existing drawing.\n * Read the existing drawing and use updateFeedChartDrawing when replacement is intended.\n */\n async createFeedChartDrawing(\n params: MobileFeedChartDrawingParams,\n ): Promise<MobileSocialFeedDrawingMutationResult> {\n const request = await this.getSignedRequest(\n 'create_feed_chart_drawing',\n params,\n { item_id: params.itemId, data_json: params.dataJson },\n );\n return mapMobileSocialFeedDrawingMutationResult(\n await this.execute(request),\n );\n }\n\n /**\n * Replaces an existing drawing, including after the associated position has closed.\n * Serialize writes per item and preserve the original JSON text when retrying.\n * @param params - Author subaccount and signing options, parent item, and complete replacement JSON.\n * @returns The parent ID and updated version together with the stored replacement drawing.\n * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.\n * @throws {MobileServerFailureError} On authentication, ownership, or invalid/oversized drawing errors, an\n * unavailable parent or drawing, or `STALE_SOCIAL_FEED_DRAWING_UPDATE`. Re-read the drawing before retrying\n * a stale or conflicting update instead of blindly replacing newer content.\n */\n async updateFeedChartDrawing(\n params: MobileFeedChartDrawingParams,\n ): Promise<MobileSocialFeedDrawingMutationResult> {\n const request = await this.getSignedRequest(\n 'update_feed_chart_drawing',\n params,\n { item_id: params.itemId, data_json: params.dataJson },\n );\n return mapMobileSocialFeedDrawingMutationResult(\n await this.execute(request),\n );\n }\n\n /**\n * Publishes a comment or reply atomically; an invalid position attachment rejects the entire request.\n * For an idempotent retry, reuse clientRequestId and the unmodified text, mentions, and attachment.\n * @param params - Author subaccount and signing options, request UUID, root item, original nonblank text\n * and mentions, plus an optional reply target in the same thread and currently owned position attachment.\n * @returns The created reply and authoritative root comment count; this write does not create a reading session.\n * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.\n * @throws {MobileServerFailureError} On authentication, inaccessible content, invalid text/mentions/reply\n * relationships, an ineligible attachment, or `SOCIAL_FEED_REQUEST_CONFLICT`. Correct invalid input before\n * a new submission, and never reuse an existing request UUID with different content.\n */\n async createFeedComment(\n params: MobileCreateFeedCommentParams,\n ): Promise<MobileSocialFeedCommentResult> {\n const request = await this.getSignedRequest('create_feed_comment', params, {\n client_request_id: params.clientRequestId,\n root_item_id: params.rootItemId,\n reply_to_item_id: params.replyToItemId,\n text: params.text,\n mentions: params.mentions.map(mapMobileSocialFeedMentionToServer),\n attached_position_id: params.attachedPositionId,\n });\n return mapMobileSocialFeedCommentResult(await this.execute(request));\n }\n\n /**\n * Sets or clears a signed user's like without requiring an open position.\n * Serialize mutations per item and author. Retrying the same isLiked state with a fresh nonce is safe\n * when no newer change intervenes; an unchanged state does not increment the count or version again.\n * Pass the original nonce on a retry before its deadline to avoid overwriting a newer change from\n * another device. Re-read the current state if that retry conflicts.\n * @param params - Acting subaccount and signing options, interactive item, and desired like state.\n * @returns The applied like state, authoritative count, and item version after the mutation.\n * @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.\n * @throws {MobileServerFailureError} On authentication errors, inaccessible or non-interactive content,\n * or `STALE_SOCIAL_FEED_LIKE_UPDATE`. Re-read the current state before submitting a new mutation after a conflict.\n */\n async setFeedLike(\n params: MobileSetFeedLikeParams,\n ): Promise<MobileSocialFeedLikeResult> {\n const request = await this.getSignedRequest('set_feed_like', params, {\n item_id: params.itemId,\n is_liked: params.isLiked,\n });\n return mapMobileSocialFeedLikeResult(await this.execute(request));\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}/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<T extends MobileServerPublicExecuteRequestType>(\n body: { type: T } & MobileServerPublicExecuteRequestByType[T],\n ): Promise<MobileServerPublicExecuteSuccessResponse<T>> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/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 MobileServerPublicExecuteSuccessResponse<T>;\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}/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":";;;;;;;;;;;;;AAiLA,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;;;;;;CAWA,MAAM,mBAAkD;EAKtD,QAAO,MADY,KAAK,YAAY,EAFlC,MAAM,iBAE+B,CAAC,GAC5B,QAAQ,IAAI,qBAAqB;CAC/C;;;;CAKA,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;;;;;;;;;;;;;;;;;CAkBA,MAAM,eACJ,QACkC;EAClC,MAAM,OAA0D;GAC9D,MAAM;GACN,GAAG,qCAAqC,MAAM;EAChD;EAEA,OAAO,2BAA2B,MADf,KAAK,YAAY,IAAI,CACF;CACxC;;;;;;;;;;;;;;;;CAiBA,MAAM,aACJ,QAC+B;EAC/B,MAAM,OAAoD;GACxD,MAAM;GACN,GAAG,kCAAkC,MAAM;EAC7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