@nadohq/mobile-client 0.64.0 → 0.66.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 +124 -7
- package/dist/MobileClient-M4oC4lrX.cjs +1101 -0
- package/dist/MobileClient-M4oC4lrX.cjs.map +1 -0
- package/dist/MobileClient.cjs +1 -1
- package/dist/MobileClient.d.cts +306 -10
- package/dist/MobileClient.d.cts.map +1 -1
- package/dist/MobileClient.d.ts +306 -10
- package/dist/MobileClient.d.ts.map +1 -1
- package/dist/MobileClient.js +544 -5
- package/dist/MobileClient.js.map +1 -1
- package/dist/{MobileServerFailureError-Dd3c6P_Z.d.ts → MobileServerFailureError-C9iqNsxI.d.ts} +2 -3
- package/dist/MobileServerFailureError-C9iqNsxI.d.ts.map +1 -0
- package/dist/{MobileServerFailureError-Bpa_WA9f.d.cts → MobileServerFailureError-MtS2reel.d.cts} +2 -3
- package/dist/MobileServerFailureError-MtS2reel.d.cts.map +1 -0
- 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/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.cts +15 -0
- package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.cts.map +1 -0
- package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.ts +15 -0
- package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.ts.map +1 -0
- package/dist/{buildSignedMobileRequest-Cb1T74xV.d.ts → buildSignedMobileRequest-BR-KJhIF.d.ts} +2 -2
- package/dist/{buildSignedMobileRequest-Cb1T74xV.d.ts.map → buildSignedMobileRequest-BR-KJhIF.d.ts.map} +1 -1
- package/dist/{buildSignedMobileRequest-NHbMAPzd.d.cts → buildSignedMobileRequest-DyKCK34Y.d.cts} +2 -2
- package/dist/{buildSignedMobileRequest-NHbMAPzd.d.cts.map → buildSignedMobileRequest-DyKCK34Y.d.cts.map} +1 -1
- package/dist/{canonicalize-BBYGh17w.d.ts → canonicalize-Bv6UIAbR.d.ts} +2 -2
- package/dist/canonicalize-Bv6UIAbR.d.ts.map +1 -0
- package/dist/{canonicalize-BF_SiNvO.d.cts → canonicalize-CWh3XZzj.d.cts} +2 -2
- package/dist/canonicalize-CWh3XZzj.d.cts.map +1 -0
- package/dist/clientTypes-BUn5_OzK.d.ts +1665 -0
- package/dist/clientTypes-BUn5_OzK.d.ts.map +1 -0
- package/dist/clientTypes-DOpUcu80.d.cts +1665 -0
- package/dist/clientTypes-DOpUcu80.d.cts.map +1 -0
- package/dist/dataMappers.cjs +691 -14
- package/dist/dataMappers.cjs.map +1 -1
- package/dist/dataMappers.d.cts +254 -8
- package/dist/dataMappers.d.cts.map +1 -1
- package/dist/dataMappers.d.ts +254 -8
- package/dist/dataMappers.d.ts.map +1 -1
- package/dist/dataMappers.js +651 -15
- package/dist/dataMappers.js.map +1 -1
- package/dist/{eip712MethodByType-BSx11xG-.d.cts → eip712MethodByType-CJ6BoayT.d.cts} +2 -2
- package/dist/eip712MethodByType-CJ6BoayT.d.cts.map +1 -0
- package/dist/{eip712MethodByType-DkiAjCLs.d.ts → eip712MethodByType-Dx4mvgni.d.ts} +2 -2
- package/dist/eip712MethodByType-Dx4mvgni.d.ts.map +1 -0
- package/dist/{feed-DTJlsg8W.d.ts → feed-DErOLaoY.d.cts} +4 -2
- package/dist/feed-DErOLaoY.d.cts.map +1 -0
- package/dist/{feed-DTJlsg8W.d.cts → feed-DErOLaoY.d.ts} +4 -2
- package/dist/feed-DErOLaoY.d.ts.map +1 -0
- package/dist/index.cjs +9 -2
- package/dist/index.d.cts +15 -16
- package/dist/index.d.ts +15 -16
- package/dist/index.js +5 -3
- package/dist/{mobileErrorCodes-3LtreeZM.d.ts → mobileErrorCodes-vD6rbFuF.d.cts} +25 -6
- package/dist/mobileErrorCodes-vD6rbFuF.d.cts.map +1 -0
- package/dist/{mobileErrorCodes-3LtreeZM.d.cts → mobileErrorCodes-vD6rbFuF.d.ts} +25 -6
- package/dist/mobileErrorCodes-vD6rbFuF.d.ts.map +1 -0
- package/dist/{payloadHash-BOWGjqdb.d.cts → payloadHash-CdkF2Ocr.d.cts} +2 -2
- package/dist/payloadHash-CdkF2Ocr.d.cts.map +1 -0
- package/dist/{payloadHash-Bzf4CtjV.d.ts → payloadHash-HD29K77M.d.ts} +2 -2
- package/dist/payloadHash-HD29K77M.d.ts.map +1 -0
- package/dist/serverExecuteTypes-5JyyIXRK.d.ts +178 -0
- package/dist/serverExecuteTypes-5JyyIXRK.d.ts.map +1 -0
- package/dist/serverExecuteTypes-CHrQ9Rtq.d.cts +178 -0
- package/dist/serverExecuteTypes-CHrQ9Rtq.d.cts.map +1 -0
- package/dist/serverModelTypes-CGUZCi0y.d.cts +938 -0
- package/dist/serverModelTypes-CGUZCi0y.d.cts.map +1 -0
- package/dist/serverModelTypes-CGUZCi0y.d.ts +938 -0
- package/dist/serverModelTypes-CGUZCi0y.d.ts.map +1 -0
- package/dist/{serverResponseGuards-BU1Xv_tG.d.ts → serverResponseGuards-Bvw8ltYJ.d.ts} +2 -2
- package/dist/{serverResponseGuards-BU1Xv_tG.d.ts.map → serverResponseGuards-Bvw8ltYJ.d.ts.map} +1 -1
- package/dist/{serverResponseGuards-Dkdok0Sm.d.cts → serverResponseGuards-i1njcYKN.d.cts} +2 -2
- package/dist/{serverResponseGuards-Dkdok0Sm.d.cts.map → serverResponseGuards-i1njcYKN.d.cts.map} +1 -1
- package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
- package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
- package/dist/signing/canonicalize.cjs +86 -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 +86 -0
- package/dist/signing/canonicalize.js.map +1 -1
- package/dist/signing/eip712MethodByType.cjs +12 -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 +12 -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.cjs +1 -1
- package/dist/signing/payloadHash.d.cts +1 -1
- package/dist/signing/payloadHash.d.ts +1 -1
- package/dist/signing/payloadHash.js +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/MobileUnsupportedNotificationRouteError.cjs +19 -0
- package/dist/types/MobileUnsupportedNotificationRouteError.cjs.map +1 -0
- package/dist/types/MobileUnsupportedNotificationRouteError.d.cts +2 -0
- package/dist/types/MobileUnsupportedNotificationRouteError.d.ts +2 -0
- package/dist/types/MobileUnsupportedNotificationRouteError.js +18 -0
- package/dist/types/MobileUnsupportedNotificationRouteError.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 +6 -0
- package/dist/types/index.d.cts +9 -9
- package/dist/types/index.d.ts +9 -9
- package/dist/types/index.js +4 -2
- package/dist/types/mobileErrorCodes.cjs +39 -1
- 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 +39 -1
- 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 +15 -0
- 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 +14 -1
- 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 +2 -2
- package/dist/types/serverRequestTypes.d.ts +2 -2
- package/dist/types-C9YE4EIt.d.cts +794 -0
- package/dist/types-C9YE4EIt.d.cts.map +1 -0
- package/dist/types-Cwy1y_9x.d.ts +794 -0
- package/dist/types-Cwy1y_9x.d.ts.map +1 -0
- package/dist/utils/buildMobileFeedImageMultipart.cjs +31 -0
- package/dist/utils/buildMobileFeedImageMultipart.cjs.map +1 -0
- package/dist/utils/buildMobileFeedImageMultipart.d.cts +15 -0
- package/dist/utils/buildMobileFeedImageMultipart.d.cts.map +1 -0
- package/dist/utils/buildMobileFeedImageMultipart.d.ts +15 -0
- package/dist/utils/buildMobileFeedImageMultipart.d.ts.map +1 -0
- package/dist/utils/buildMobileFeedImageMultipart.js +30 -0
- package/dist/utils/buildMobileFeedImageMultipart.js.map +1 -0
- package/dist/utils/feed.cjs +3 -0
- package/dist/utils/feed.cjs.map +1 -1
- package/dist/utils/feed.d.cts +2 -2
- package/dist/utils/feed.d.ts +2 -2
- package/dist/utils/feed.js +3 -1
- package/dist/utils/feed.js.map +1 -1
- package/dist/utils/index.cjs +2 -1
- package/dist/utils/index.d.cts +3 -3
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +2 -2
- 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 +789 -7
- package/src/dataMappers.test.ts +848 -0
- package/src/dataMappers.ts +924 -17
- package/src/feedImages.test.ts +309 -0
- package/src/notifications.test.ts +950 -0
- package/src/signing/canonicalize.ts +119 -0
- package/src/signing/eip712MethodByType.ts +15 -0
- package/src/signing/signing.test.ts +362 -0
- package/src/signing/types.ts +108 -13
- package/src/socialFeed.test.ts +38 -2
- package/src/types/MobileUnsupportedFeedItemError.ts +18 -0
- package/src/types/MobileUnsupportedNotificationRouteError.ts +16 -0
- package/src/types/clientTypes.ts +1012 -34
- package/src/types/index.ts +2 -0
- package/src/types/mobileErrorCodes.ts +38 -0
- package/src/types/serverExecuteTypes.ts +112 -3
- package/src/types/serverModelTypes.ts +581 -28
- package/src/types/serverQueryTypes.ts +212 -5
- package/src/types/serverRequestTypes.ts +213 -13
- package/src/utils/buildMobileFeedImageMultipart.test.ts +45 -0
- package/src/utils/buildMobileFeedImageMultipart.ts +36 -0
- package/src/utils/feed.ts +3 -0
- package/dist/MobileClient-aDxiM_Kf.cjs +0 -562
- package/dist/MobileClient-aDxiM_Kf.cjs.map +0 -1
- package/dist/MobileServerFailureError-Bpa_WA9f.d.cts.map +0 -1
- package/dist/MobileServerFailureError-Dd3c6P_Z.d.ts.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 +0 -844
- package/dist/clientTypes-BWFKo9oE.d.cts.map +0 -1
- package/dist/clientTypes-DCTiUV0H.d.ts +0 -844
- 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/feed-DTJlsg8W.d.cts.map +0 -1
- package/dist/feed-DTJlsg8W.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/serverBaseTypes-DWf3iGWy.d.ts +0 -25
- package/dist/serverBaseTypes-DWf3iGWy.d.ts.map +0 -1
- package/dist/serverBaseTypes-KREDe2M9.d.cts +0 -25
- package/dist/serverBaseTypes-KREDe2M9.d.cts.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 +0 -508
- package/dist/serverModelTypes-DAqEyYtB.d.cts.map +0 -1
- package/dist/serverModelTypes-DAqEyYtB.d.ts +0 -508
- package/dist/serverModelTypes-DAqEyYtB.d.ts.map +0 -1
- package/dist/serverQueryTypes-BFdwq0Z2.d.ts +0 -171
- package/dist/serverQueryTypes-BFdwq0Z2.d.ts.map +0 -1
- package/dist/serverQueryTypes-DNdMpmDr.d.cts +0 -171
- package/dist/serverQueryTypes-DNdMpmDr.d.cts.map +0 -1
- package/dist/serverRequestTypes-BNA7FCY6.d.ts +0 -200
- package/dist/serverRequestTypes-BNA7FCY6.d.ts.map +0 -1
- package/dist/serverRequestTypes-CxDRFKfv.d.cts +0 -200
- package/dist/serverRequestTypes-CxDRFKfv.d.cts.map +0 -1
- package/dist/types-BCr2G5gS.d.cts +0 -84
- package/dist/types-BCr2G5gS.d.cts.map +0 -1
- package/dist/types-C18k-9Vy.d.ts +0 -84
- package/dist/types-C18k-9Vy.d.ts.map +0 -1
package/dist/MobileClient.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
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, mapMobileNotificationCapabilitiesToServer, mapMobileNotificationInboxV2, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobileNotificationRegistrationV2, mapMobileNotificationSettingsToServer, mapMobileNotificationSettingsV2, mapMobileNotificationSubscriptions, mapMobileNotificationSubscriptionsUpdateToServer, mapMobileProductEventToServer, mapMobileProfileSearchPage, mapMobileProfileSearchParamsToServer, mapMobileProfilesIncludeToServer, mapMobilePublicProfile, mapMobileRegisteredWallet, mapMobileSocialFeedActionResolutionResult, mapMobileSocialFeedCommentResult, mapMobileSocialFeedCommentsPage, mapMobileSocialFeedDrawingMutationResult, mapMobileSocialFeedDrawingResult, mapMobileSocialFeedImage, mapMobileSocialFeedItem, mapMobileSocialFeedItemResponse, mapMobileSocialFeedLikeResult, mapMobileSocialFeedListParamsToServer, mapMobileSocialFeedMentionToServer, mapMobileSocialFeedPage, mapMobileSocialFeedPositionChart, mapMobileSocialFeedPositionHistory, mapMobileSocialFeedPositionResolutionResult, mapMobileSocialFeedPositionsPage, mapMobileSocialFeedPresence, mapMobileSocialFeedRankedPage, mapMobileSocialFeedReadParamsToServer, mapMobileSocialFeedTopTradersPage, mapMobileSocialFeedUpdates, mapMobileSocialFeedViewsResult, mapMobileSocialFeedWatchers } from "./dataMappers.js";
|
|
2
|
+
import { getMobileNonce } from "./signing/nonce.js";
|
|
2
3
|
import { buildSignedMobileRequest } from "./signing/buildSignedMobileRequest.js";
|
|
3
4
|
import "./signing/index.js";
|
|
4
5
|
import { MobileServerFailureError } from "./types/MobileServerFailureError.js";
|
|
6
|
+
import { buildMobileFeedImageMultipart } from "./utils/buildMobileFeedImageMultipart.js";
|
|
7
|
+
import { MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES } from "./utils/feed.js";
|
|
5
8
|
import { isMobileServerFailureResponse, isMobileServerSuccessResponse } from "./utils/serverResponseGuards.js";
|
|
6
9
|
import { WalletNotProvidedError, getNadoClientTypeHeaders, subaccountToHex } from "@nadohq/shared";
|
|
7
10
|
import axios from "axios";
|
|
11
|
+
import { bytesToString, keccak256, zeroHash } from "viem";
|
|
8
12
|
//#region src/MobileClient.ts
|
|
9
13
|
/**
|
|
10
14
|
* Client for the Nado mobile service API: usernames, bios, avatars, public profile lookups, the global
|
|
@@ -157,6 +161,7 @@ var MobileClient = class {
|
|
|
157
161
|
* @param params - Filters, pagination, optional viewing account, and browser credential; no signing identity.
|
|
158
162
|
* @returns A fixed-session page with its ranking version and new-content watermark.
|
|
159
163
|
* @throws {MobileServerFailureError} On invalid parameters, session mismatch/expiry, or unavailable data.
|
|
164
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
160
165
|
*/
|
|
161
166
|
async getForYouFeed(params = {}) {
|
|
162
167
|
const body = {
|
|
@@ -173,6 +178,7 @@ var MobileClient = class {
|
|
|
173
178
|
* @param params - Filters, pagination, optional viewing account, and browser credential.
|
|
174
179
|
* @returns A page with its qualification cohort; an unavailable cohort fails instead of returning an empty ranking.
|
|
175
180
|
* @throws {MobileServerFailureError} On request/session errors or unavailable cohort data.
|
|
181
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
176
182
|
*/
|
|
177
183
|
async getTopTradersFeed(params = {}) {
|
|
178
184
|
const body = {
|
|
@@ -188,6 +194,7 @@ var MobileClient = class {
|
|
|
188
194
|
* @param params - Required viewing account on every request, filters, pagination, and browser credential.
|
|
189
195
|
* @returns A chronological Friends page and reading session.
|
|
190
196
|
* @throws {MobileServerFailureError} On invalid viewing account, session errors, or feed query failure.
|
|
197
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
191
198
|
*/
|
|
192
199
|
async getFriendsFeed(params) {
|
|
193
200
|
const body = {
|
|
@@ -204,6 +211,7 @@ var MobileClient = class {
|
|
|
204
211
|
* @param params - Target identity, filters, pagination, and optional public viewing account.
|
|
205
212
|
* @returns An author page without main-feed ranking or cohort fields.
|
|
206
213
|
* @throws {MobileServerFailureError} On invalid parameters, session errors, or inaccessible content.
|
|
214
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
207
215
|
*/
|
|
208
216
|
async getProfileFeed(params) {
|
|
209
217
|
const body = {
|
|
@@ -220,6 +228,7 @@ var MobileClient = class {
|
|
|
220
228
|
* @param params - Product ID, content/size filters, pagination, and public viewing account.
|
|
221
229
|
* @returns A market page without main-feed ranking fields.
|
|
222
230
|
* @throws {MobileServerFailureError} On an unknown market, session errors, or unavailable data.
|
|
231
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
223
232
|
*/
|
|
224
233
|
async getMarketFeed(params) {
|
|
225
234
|
const body = {
|
|
@@ -236,6 +245,7 @@ var MobileClient = class {
|
|
|
236
245
|
* @param params - Position UUID, filters, pagination, and public viewing account.
|
|
237
246
|
* @returns A fixed-session position feed page.
|
|
238
247
|
* @throws {MobileServerFailureError} On inaccessible content, session errors, or unavailable data.
|
|
248
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
239
249
|
*/
|
|
240
250
|
async getPositionFeed(params) {
|
|
241
251
|
const body = {
|
|
@@ -249,14 +259,18 @@ var MobileClient = class {
|
|
|
249
259
|
/**
|
|
250
260
|
* Reads one item visible to viewAs, including that account's own hidden content.
|
|
251
261
|
* Creates an item session directly when sessionId is omitted.
|
|
252
|
-
* @
|
|
262
|
+
* Pass {@link GetMobileFeedItemParams.viewEventId} when the user navigates into the detail so the
|
|
263
|
+
* subsequent {@link recordFeedViews} call can count that visit; omit it for prefetch.
|
|
264
|
+
* @param params - Item UUID, optional detail-visit event, preview limit, and optional existing session/read identity.
|
|
253
265
|
* @returns The complete item and authorized reading session.
|
|
254
266
|
* @throws {MobileServerFailureError} On inaccessible content or session mismatch/expiry.
|
|
267
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
255
268
|
*/
|
|
256
269
|
async getFeedItem(params) {
|
|
257
270
|
const body = {
|
|
258
271
|
type: "feed_item",
|
|
259
272
|
item_id: params.itemId,
|
|
273
|
+
view_event_id: params.viewEventId,
|
|
260
274
|
comment_preview_limit: params.commentPreviewLimit,
|
|
261
275
|
session_id: params.sessionId,
|
|
262
276
|
...mapMobileSocialFeedReadParamsToServer(params)
|
|
@@ -294,6 +308,7 @@ var MobileClient = class {
|
|
|
294
308
|
*
|
|
295
309
|
* @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is
|
|
296
310
|
* not currently registered to a wallet.
|
|
311
|
+
* @deprecated Use {@link getNotificationSettingsV2} instead.
|
|
297
312
|
*/
|
|
298
313
|
async getNotificationPreferences(params) {
|
|
299
314
|
const body = {
|
|
@@ -320,6 +335,239 @@ var MobileClient = class {
|
|
|
320
335
|
return mapMobileRegisteredWallet(await this.publicQuery(body));
|
|
321
336
|
}
|
|
322
337
|
/**
|
|
338
|
+
* Lists a selected account's current positions without signing or authenticating ownership.
|
|
339
|
+
* Publication and attachment eligibility are hints that the service rechecks on writes.
|
|
340
|
+
* @param params - Viewing subaccount, optional market filter, page size, and opaque cursor.
|
|
341
|
+
* @returns Current position candidates, their eligibility hints, the next cursor, and observation time.
|
|
342
|
+
* @throws {MobileServerFailureError} On invalid parameters, an unsupported viewing account, or unavailable
|
|
343
|
+
* position data. An account with no open positions returns an empty page instead of an error.
|
|
344
|
+
*/
|
|
345
|
+
async getSelfFeedPositions(params) {
|
|
346
|
+
const body = {
|
|
347
|
+
type: "self_feed_positions",
|
|
348
|
+
view_as: subaccountToHex(params.viewAs),
|
|
349
|
+
product_id: params.productId,
|
|
350
|
+
cursor: params.cursor,
|
|
351
|
+
limit: params.limit
|
|
352
|
+
};
|
|
353
|
+
return mapMobileSocialFeedPositionsPage(await this.publicQuery(body));
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Resolves a slash command against a selected account without changing the caller's input.
|
|
357
|
+
* @param params - Viewing subaccount, original command text, and optional market disambiguation.
|
|
358
|
+
* @returns The resolution, nullable market, candidate positions, and reason for an empty result.
|
|
359
|
+
* @throws {MobileServerFailureError} On invalid parameters, an unsupported viewing account, or unavailable
|
|
360
|
+
* source data. Unknown markets and accounts without open positions are normal resolution results.
|
|
361
|
+
*/
|
|
362
|
+
async resolveFeedPosition(params) {
|
|
363
|
+
const body = {
|
|
364
|
+
type: "resolve_feed_position",
|
|
365
|
+
view_as: subaccountToHex(params.viewAs),
|
|
366
|
+
input: params.input,
|
|
367
|
+
product_id: params.productId
|
|
368
|
+
};
|
|
369
|
+
return mapMobileSocialFeedPositionResolutionResult(await this.publicQuery(body));
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Resolves every trusted lifecycle segment of an order without requiring a signature.
|
|
373
|
+
* @param params - Order-owning subaccount and order digest; selecting the account is not authentication.
|
|
374
|
+
* @returns Trusted action candidates and their observation time, or a pending result with no actions.
|
|
375
|
+
* @throws {MobileServerFailureError} On invalid parameters, an inaccessible order, or unavailable source
|
|
376
|
+
* data. Pending projection is a successful result, not a source failure.
|
|
377
|
+
*/
|
|
378
|
+
async resolveFeedAction(params) {
|
|
379
|
+
const body = {
|
|
380
|
+
type: "resolve_feed_action",
|
|
381
|
+
view_as: subaccountToHex(params.viewAs),
|
|
382
|
+
order_digest: params.orderDigest
|
|
383
|
+
};
|
|
384
|
+
return mapMobileSocialFeedActionResolutionResult(await this.publicQuery(body));
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Reads a drawing publicly without issuing a reading session. Supplied sessions retain their scope.
|
|
388
|
+
* @param params - Parent item, optional viewing account, and optional original session and viewer token.
|
|
389
|
+
* @returns The parent ID and version, with a nullable drawing whose data may legitimately be false or zero.
|
|
390
|
+
* @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, unavailable data,
|
|
391
|
+
* or `SOCIAL_FEED_DRAWING_UNAVAILABLE` when the parent is inaccessible. A readable parent without a drawing
|
|
392
|
+
* returns null. Acquire a new reading session when the original has expired.
|
|
393
|
+
*/
|
|
394
|
+
async getFeedChartDrawing(params) {
|
|
395
|
+
const body = {
|
|
396
|
+
type: "feed_chart_drawing",
|
|
397
|
+
item_id: params.itemId,
|
|
398
|
+
session_id: params.sessionId,
|
|
399
|
+
...mapMobileSocialFeedReadParamsToServer(params)
|
|
400
|
+
};
|
|
401
|
+
return mapMobileSocialFeedDrawingResult(await this.publicQuery(body));
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Resolves a backend feed image path against this client's mobile gateway URL.
|
|
405
|
+
* @param path - Backend path from image metadata, rooted at /v1/mobile or the mobile service root.
|
|
406
|
+
* @returns An absolute URL suitable for authenticated fetches.
|
|
407
|
+
*/
|
|
408
|
+
resolveFeedImageUrl(path) {
|
|
409
|
+
return `${this.opts.url}${path.replace(/^\/v1\/mobile(?=\/)/, "")}`;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Prepares a protected image request for native image components without downloading or encoding bytes.
|
|
413
|
+
* Does not count as a detail visit or recorded view.
|
|
414
|
+
* @param params - Image path from metadata plus the original session credentials.
|
|
415
|
+
* @returns Absolute URL and headers; pass them as the image source's URI and headers.
|
|
416
|
+
*/
|
|
417
|
+
getFeedImageRequest(params) {
|
|
418
|
+
return {
|
|
419
|
+
url: this.resolveFeedImageUrl(params.path),
|
|
420
|
+
headers: {
|
|
421
|
+
"x-feed-session-id": params.sessionId,
|
|
422
|
+
"x-feed-viewer-token": params.viewerToken
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Fetches protected feed image bytes using the reading session that fully delivered the parent item.
|
|
428
|
+
* Does not count as a detail visit or recorded view.
|
|
429
|
+
* @param params - Image path from metadata plus the original session credentials.
|
|
430
|
+
* @returns Raw image bytes.
|
|
431
|
+
* @throws {MobileServerFailureError} On session, permission, or availability errors.
|
|
432
|
+
*/
|
|
433
|
+
async getFeedImageBytes(params) {
|
|
434
|
+
const { url, headers } = this.getFeedImageRequest(params);
|
|
435
|
+
return this.publicGetBytes(url, headers);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Reads a comment thread with an optional anchor and bidirectional pagination.
|
|
439
|
+
* Independent reads create a public-only session; reused sessions retain their original scope.
|
|
440
|
+
* @param params - Root item, optional anchor or cursor (mutually exclusive), page size, and read perspective.
|
|
441
|
+
* Paging requires the original session and viewer token.
|
|
442
|
+
* @returns Replies, total count, forward and backward cursors, the anchor, and the actual reading session.
|
|
443
|
+
* @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,
|
|
444
|
+
* or unavailable data. Restart pagination with a new session after expiry; do not reuse the old cursor.
|
|
445
|
+
*/
|
|
446
|
+
async getFeedComments(params) {
|
|
447
|
+
const body = {
|
|
448
|
+
type: "feed_comments",
|
|
449
|
+
root_item_id: params.rootItemId,
|
|
450
|
+
cursor: params.cursor,
|
|
451
|
+
limit: params.limit,
|
|
452
|
+
anchor_reply_id: params.anchorReplyId,
|
|
453
|
+
session_id: params.sessionId,
|
|
454
|
+
...mapMobileSocialFeedReadParamsToServer(params)
|
|
455
|
+
};
|
|
456
|
+
return mapMobileSocialFeedCommentsPage(await this.publicQuery(body));
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Reads the full position lifecycle and creates or reuses a position session.
|
|
460
|
+
* Unlike getPositionFeed, this includes lifecycle actions as well as published takes.
|
|
461
|
+
* @param params - Position, optional takes-only filter, pagination, and read perspective. Paging requires
|
|
462
|
+
* the original position session and viewer token, not a feed session.
|
|
463
|
+
* @returns Position metrics, ordered action/take history, summary, trading hints, cursor, and reading session.
|
|
464
|
+
* @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,
|
|
465
|
+
* or unavailable source data. Restart with a new position session after expiry.
|
|
466
|
+
* @throws {MobileUnsupportedFeedItemError} If a timeline entry or take has an unsupported kind.
|
|
467
|
+
*/
|
|
468
|
+
async getPositionHistory(params) {
|
|
469
|
+
const body = {
|
|
470
|
+
type: "position_history",
|
|
471
|
+
position_id: params.positionId,
|
|
472
|
+
takes_only: params.takesOnly,
|
|
473
|
+
cursor: params.cursor,
|
|
474
|
+
limit: params.limit,
|
|
475
|
+
session_id: params.sessionId,
|
|
476
|
+
...mapMobileSocialFeedReadParamsToServer(params)
|
|
477
|
+
};
|
|
478
|
+
return mapMobileSocialFeedPositionHistory(await this.publicQuery(body));
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Reads candles and action markers without creating a reading session.
|
|
482
|
+
* Preserve the original range, interval, and read perspective when paging with nextBeforeMs.
|
|
483
|
+
* @param params - Position, candle interval, half-open time range, pagination, and optional original session
|
|
484
|
+
* and viewer token. An independent read omits both session credentials.
|
|
485
|
+
* @returns Candles with decimal prices and x18 volume, action markers, a nullable liquidation line, and paging metadata.
|
|
486
|
+
* @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, inaccessible content,
|
|
487
|
+
* or wholly unavailable chart sources. Partially available data is returned with its quality indicator.
|
|
488
|
+
*/
|
|
489
|
+
async getPositionChart(params) {
|
|
490
|
+
const body = {
|
|
491
|
+
type: "position_chart",
|
|
492
|
+
position_id: params.positionId,
|
|
493
|
+
session_id: params.sessionId,
|
|
494
|
+
interval: params.interval,
|
|
495
|
+
range: {
|
|
496
|
+
from_ms: params.range.fromMs,
|
|
497
|
+
to_ms: params.range.toMs
|
|
498
|
+
},
|
|
499
|
+
before_ms: params.beforeMs,
|
|
500
|
+
limit: params.limit,
|
|
501
|
+
...mapMobileSocialFeedReadParamsToServer(params)
|
|
502
|
+
};
|
|
503
|
+
return mapMobileSocialFeedPositionChart(await this.publicQuery(body));
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Reads active visitor counts and self-reported account previews without registering presence.
|
|
507
|
+
* @param params - Position and optional viewing account, used only for preview relationship information.
|
|
508
|
+
* @returns The visitor count, public account previews, and observation time; previews need not match the count.
|
|
509
|
+
* @throws {MobileServerFailureError} On invalid parameters, an unavailable position, or unavailable source data.
|
|
510
|
+
*/
|
|
511
|
+
async getPositionWatchers(params) {
|
|
512
|
+
const body = {
|
|
513
|
+
type: "position_watchers",
|
|
514
|
+
position_id: params.positionId,
|
|
515
|
+
view_as: params.viewAs === void 0 ? void 0 : subaccountToHex(params.viewAs)
|
|
516
|
+
};
|
|
517
|
+
return mapMobileSocialFeedWatchers(await this.publicQuery(body));
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Reads the token's latest registration generation and saved capabilities, including legacy v1 registrations.
|
|
521
|
+
* @param params - Active Expo token credential; no wallet signature is needed.
|
|
522
|
+
* @returns Saved generation as an opaque string and the complete capability declaration.
|
|
523
|
+
* @throws {MobileServerFailureError} If the token is invalid or inactive (`INVALID_EXPO_TOKEN`).
|
|
524
|
+
*/
|
|
525
|
+
async getNotificationRegistrationV2(params) {
|
|
526
|
+
return mapMobileNotificationRegistrationV2(await this.publicQuery({
|
|
527
|
+
type: "notification_registration_v2",
|
|
528
|
+
expo_token: params.expoToken
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Reads the wallet's full v2 settings document, including legacy preference mappings.
|
|
533
|
+
* @param params - Active Expo token credential. Before displaying settings, compare the wallet returned by
|
|
534
|
+
* {@link MobileClient.getRegisteredWallet} with the connected wallet (case-insensitively).
|
|
535
|
+
* @returns CamelCase settings with the current settings revision.
|
|
536
|
+
* @throws {MobileServerFailureError} If the token is invalid or inactive (`INVALID_EXPO_TOKEN`).
|
|
537
|
+
*/
|
|
538
|
+
async getNotificationSettingsV2(params) {
|
|
539
|
+
return mapMobileNotificationSettingsV2(await this.publicQuery({
|
|
540
|
+
type: "notification_settings_v2",
|
|
541
|
+
expo_token: params.expoToken
|
|
542
|
+
}));
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Reads wallet market subscriptions and the signing Identity's enabled trader bells.
|
|
546
|
+
* @param params - Wallet authentication context; no Expo token is needed.
|
|
547
|
+
* @returns Subscriptions, import state, and the independent subscription revision.
|
|
548
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
549
|
+
* @throws {MobileServerFailureError} If authentication or the query fails.
|
|
550
|
+
*/
|
|
551
|
+
async getNotificationSubscriptions(params) {
|
|
552
|
+
const request = await this.getSignedRequest("notification_subscriptions", params, {});
|
|
553
|
+
return mapMobileNotificationSubscriptions(await this.query(request));
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Reads private accepted notification intents, not delivery receipts or read states.
|
|
557
|
+
* @param params - Wallet authentication and optional cursor/page size (1-50, default 20).
|
|
558
|
+
* @returns A camelCase page; discard cached pages and cursors when switching wallets.
|
|
559
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
560
|
+
* @throws {MobileServerFailureError} If authentication or pagination validation fails.
|
|
561
|
+
* @throws {MobileUnsupportedNotificationRouteError} If a notification has an unsupported route name.
|
|
562
|
+
*/
|
|
563
|
+
async getNotificationInboxV2(params) {
|
|
564
|
+
const request = await this.getSignedRequest("notification_inbox_v2", params, {
|
|
565
|
+
cursor: params.cursor ?? null,
|
|
566
|
+
limit: params.limit ?? null
|
|
567
|
+
});
|
|
568
|
+
return mapMobileNotificationInboxV2(await this.query(request));
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
323
571
|
* Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout
|
|
324
572
|
* when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown
|
|
325
573
|
* well-formed token succeeds.
|
|
@@ -347,6 +595,7 @@ var MobileClient = class {
|
|
|
347
595
|
*
|
|
348
596
|
* @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated, or
|
|
349
597
|
* `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.
|
|
598
|
+
* @deprecated Use {@link updateNotificationSettingsV2} instead.
|
|
350
599
|
*/
|
|
351
600
|
async updateNotificationPreferences(params) {
|
|
352
601
|
const body = {
|
|
@@ -357,6 +606,64 @@ var MobileClient = class {
|
|
|
357
606
|
return this.publicExecute(body);
|
|
358
607
|
}
|
|
359
608
|
/**
|
|
609
|
+
* Replaces all v2 settings fields using optimistic concurrency; legacy overlapping preferences are synced.
|
|
610
|
+
* @param params - Active Expo token, latest settings revision, and complete replacement settings.
|
|
611
|
+
* @returns The saved settings document with its incremented revision.
|
|
612
|
+
* @throws {MobileServerFailureError} On invalid token/settings or revision conflict (`NOTIFICATION_REVISION_CONFLICT`). Re-read and
|
|
613
|
+
* merge only the user's current change before retrying; never blindly replay a stale document.
|
|
614
|
+
*/
|
|
615
|
+
async updateNotificationSettingsV2(params) {
|
|
616
|
+
return mapMobileNotificationSettingsV2(await this.publicExecute({
|
|
617
|
+
type: "update_notification_settings_v2",
|
|
618
|
+
expo_token: params.expoToken,
|
|
619
|
+
expected_revision: params.expectedRevision,
|
|
620
|
+
settings: mapMobileNotificationSettingsToServer(params.settings)
|
|
621
|
+
}));
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Reports a detail visit without signing. Feed-list card impressions and previews do not count.
|
|
625
|
+
* After the primary detail target is shown in the foreground, send the same viewEventId previously
|
|
626
|
+
* registered through {@link getFeedItem}, together with that response's sessionId and viewerToken.
|
|
627
|
+
* Reuse the event ID on retries for the same visit; generate a new one only after leaving and re-entering.
|
|
628
|
+
* @param params - Original reading session and viewer token, the registered detail-visit event, and exactly
|
|
629
|
+
* one fully delivered, readable detail-target item ID.
|
|
630
|
+
* @returns Separate lists of newly accepted and already-counted item IDs for that event.
|
|
631
|
+
* @throws {MobileServerFailureError} On invalid parameters, an unregistered or rebound event
|
|
632
|
+
* (`SOCIAL_FEED_VIEW_EVENT_REBOUND`), session mismatch or expiry, or an ineligible item.
|
|
633
|
+
* Acquire a new session after expiry, re-register the same event via getFeedItem, then retry.
|
|
634
|
+
*/
|
|
635
|
+
async recordFeedViews(params) {
|
|
636
|
+
const body = {
|
|
637
|
+
type: "record_feed_views",
|
|
638
|
+
session_id: params.sessionId,
|
|
639
|
+
viewer_token: params.viewerToken,
|
|
640
|
+
view_event_id: params.viewEventId,
|
|
641
|
+
item_ids: [params.itemId]
|
|
642
|
+
};
|
|
643
|
+
return mapMobileSocialFeedViewsResult(await this.publicExecute(body));
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Registers, renews, or leaves a page lease without signing or authenticating the displayed account.
|
|
647
|
+
* Omitting watcherSubaccount preserves its value; null clears it. This operation does not record item views.
|
|
648
|
+
* @param params - Authorized position, original session and viewer token, page-scoped viewSessionId,
|
|
649
|
+
* lease state, and optional self-reported display account. Retain viewSessionId for the lifetime of the page.
|
|
650
|
+
* @returns Visitor count, public previews, recommended heartbeat interval, and remaining lease lifetime.
|
|
651
|
+
* @throws {MobileServerFailureError} On invalid parameters, session mismatch or expiry, or an inaccessible
|
|
652
|
+
* position. Rejected requests leave leases unchanged; acquire a new reading session after expiry.
|
|
653
|
+
*/
|
|
654
|
+
async setPositionPresence(params) {
|
|
655
|
+
const body = {
|
|
656
|
+
type: "position_presence",
|
|
657
|
+
position_id: params.positionId,
|
|
658
|
+
session_id: params.sessionId,
|
|
659
|
+
view_session_id: params.viewSessionId,
|
|
660
|
+
state: params.state,
|
|
661
|
+
viewer_token: params.viewerToken,
|
|
662
|
+
...params.watcherSubaccount === void 0 ? {} : { watcher_subaccount: params.watcherSubaccount === null ? null : subaccountToHex(params.watcherSubaccount) }
|
|
663
|
+
};
|
|
664
|
+
return mapMobileSocialFeedPresence(await this.publicExecute(body));
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
360
667
|
* Updates the biography, or clears it when the text is whitespace-only.
|
|
361
668
|
*
|
|
362
669
|
* Serialize this with {@link MobileClient.setAvatar}, {@link MobileClient.setUsername} and
|
|
@@ -422,11 +729,13 @@ var MobileClient = class {
|
|
|
422
729
|
}
|
|
423
730
|
/**
|
|
424
731
|
* Registers an Expo push token for the wallet, transferring active ownership of the token if another
|
|
425
|
-
* wallet had registered it.
|
|
732
|
+
* wallet had registered it. Each registration advances its generation and cancels old pending deliveries.
|
|
733
|
+
* This legacy method replaces capabilities with v1; use registerExpoTokenV2 consistently after upgrading.
|
|
426
734
|
*
|
|
427
735
|
* @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is not a valid Expo
|
|
428
736
|
* push token, or `INVALID_DEVICE_METADATA` if `locale` (max 35 chars) or `appVersion` (max 64 chars) is
|
|
429
737
|
* too long.
|
|
738
|
+
* @deprecated Use {@link registerExpoTokenV2} instead.
|
|
430
739
|
*/
|
|
431
740
|
async registerExpoToken(params) {
|
|
432
741
|
const signedRequest = await this.getSignedRequest("register_expo_token", params, {
|
|
@@ -438,6 +747,47 @@ var MobileClient = class {
|
|
|
438
747
|
return this.execute(signedRequest);
|
|
439
748
|
}
|
|
440
749
|
/**
|
|
750
|
+
* Registers a device with its actual v2 capabilities; do not use repeated registration as a heartbeat.
|
|
751
|
+
* @param params - Wallet authentication, Expo token, metadata, and supported notification types/routes.
|
|
752
|
+
* @returns Success only; query registration separately for its new generation.
|
|
753
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
754
|
+
* @throws {MobileServerFailureError} On `INVALID_EXPO_TOKEN`, `INVALID_DEVICE_METADATA`,
|
|
755
|
+
* `NOTIFICATION_DEVICE_LIMIT` when the wallet already has 32 active devices, or authentication errors.
|
|
756
|
+
*/
|
|
757
|
+
async registerExpoTokenV2(params) {
|
|
758
|
+
const request = await this.getSignedRequest("register_expo_token_v2", params, {
|
|
759
|
+
expo_token: params.expoToken,
|
|
760
|
+
platform: params.platform,
|
|
761
|
+
locale: params.locale ?? null,
|
|
762
|
+
app_version: params.appVersion ?? null,
|
|
763
|
+
capabilities: mapMobileNotificationCapabilitiesToServer(params.capabilities)
|
|
764
|
+
});
|
|
765
|
+
return this.execute(request);
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Applies exactly one bell, market, or one-time favorites-import operation.
|
|
769
|
+
* @param params - Wallet authentication and subscription update with the latest subscription revision.
|
|
770
|
+
* @returns Success only; re-query subscriptions for the new revision even after a repeated ON/OFF.
|
|
771
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
772
|
+
* @throws {MobileServerFailureError} On `NOTIFICATION_REVISION_CONFLICT`, `INVALID_NOTIFICATION_REQUEST`, or
|
|
773
|
+
* `INVALID_IDENTITY_TARGET`.
|
|
774
|
+
*/
|
|
775
|
+
async updateNotificationSubscriptions(params) {
|
|
776
|
+
const request = await this.getSignedRequest("update_notification_subscriptions", params, mapMobileNotificationSubscriptionsUpdateToServer(params.update));
|
|
777
|
+
return this.execute(request);
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Atomically records 1-50 analytics events after the user has consented to analytics.
|
|
781
|
+
* @param params - Wallet authentication and events with stable UUIDs and actual millisecond timestamps.
|
|
782
|
+
* @returns Success only; reuse event IDs on retries. Notification clicks do not mark an inbox item as read.
|
|
783
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
784
|
+
* @throws {MobileServerFailureError} If any event, timestamp, batch size, or notification ownership is invalid.
|
|
785
|
+
*/
|
|
786
|
+
async recordProductEvents(params) {
|
|
787
|
+
const request = await this.getSignedRequest("record_product_events", params, { events: params.events.map(mapMobileProductEventToServer) });
|
|
788
|
+
return this.execute(request);
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
441
791
|
* Sets whether the signing subaccount follows a Profile. Both directions are idempotent: following again
|
|
442
792
|
* keeps the original relationship creation time, so it does not move the account in recency order, and
|
|
443
793
|
* unfollowing a relationship that does not exist succeeds with `isFollowing: false`. Unfollowing deletes
|
|
@@ -482,6 +832,140 @@ var MobileClient = class {
|
|
|
482
832
|
});
|
|
483
833
|
return mapMobileFollowBatchResult(await this.execute(signedRequest));
|
|
484
834
|
}
|
|
835
|
+
/**
|
|
836
|
+
* Publishes text, a drawing, or both atomically using the signed author identity.
|
|
837
|
+
* For an idempotent retry, reuse clientRequestId and the exact original content with a valid signature.
|
|
838
|
+
* The SDK does not trim text or reformat the signed drawing JSON.
|
|
839
|
+
* @param params - Author subaccount and signing options, request UUID, owned position, original text and
|
|
840
|
+
* mentions, plus an optional trusted action and original drawing JSON.
|
|
841
|
+
* @returns The published item, including authoritative interaction state and any drawing or comment preview.
|
|
842
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
843
|
+
* @throws {MobileServerFailureError} On authentication, ownership, eligibility, content, mention, or drawing
|
|
844
|
+
* errors, or `SOCIAL_FEED_REQUEST_CONFLICT` when a request UUID is reused with different content. Do not
|
|
845
|
+
* change an earlier request to retry it; use a new UUID for a genuinely new publication.
|
|
846
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported item kind.
|
|
847
|
+
*/
|
|
848
|
+
async createFeedPost(params) {
|
|
849
|
+
const request = await this.getSignedRequest("create_feed_post", params, {
|
|
850
|
+
client_request_id: params.clientRequestId,
|
|
851
|
+
position_id: params.positionId,
|
|
852
|
+
action_id: params.actionId,
|
|
853
|
+
text: params.text,
|
|
854
|
+
mentions: params.mentions.map(mapMobileSocialFeedMentionToServer),
|
|
855
|
+
drawing_data_json: params.drawingDataJson,
|
|
856
|
+
image_ids: params.imageIds
|
|
857
|
+
});
|
|
858
|
+
return mapMobileSocialFeedItem((await this.execute(request)).item);
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Uploads one static JPEG/PNG for a later {@link createFeedPost} via multipart execute.
|
|
862
|
+
* The whole HTTP request must stay within 2 MiB including signature overhead; upload one file per call
|
|
863
|
+
* and bind up to nine ready IDs at publication. There is no complete/PUT step — success means ready.
|
|
864
|
+
* @param params - Author subaccount and signing options, plus the original file bytes.
|
|
865
|
+
* @returns Ready image metadata, including original and thumbnail paths.
|
|
866
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
867
|
+
* @throws {RangeError} If the complete multipart request exceeds {@link MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES}.
|
|
868
|
+
* @throws {MobileServerFailureError} On authentication, format/size/hash errors (`INVALID_SOCIAL_FEED_IMAGE`),
|
|
869
|
+
* or when publishing is disabled (`SERVICE_UNAVAILABLE`), or image storage is unavailable
|
|
870
|
+
* (`SOCIAL_FEED_DATA_UNAVAILABLE`, 6320, HTTP 503).
|
|
871
|
+
*/
|
|
872
|
+
async createFeedPostImageUpload(params) {
|
|
873
|
+
return this.createFeedImageUpload("create_feed_post_image_uploads", params);
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Uploads one static JPEG/PNG for a later {@link createFeedComment} via multipart execute.
|
|
877
|
+
* Same size and readiness rules as {@link createFeedPostImageUpload}; comment text remains required.
|
|
878
|
+
* @param params - Author subaccount and signing options, plus the original file bytes.
|
|
879
|
+
* @returns Ready image metadata, including original and thumbnail paths.
|
|
880
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
881
|
+
* @throws {RangeError} If the complete multipart request exceeds {@link MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES}.
|
|
882
|
+
* @throws {MobileServerFailureError} On authentication, format/size/hash errors (`INVALID_SOCIAL_FEED_IMAGE`),
|
|
883
|
+
* or when comments are disabled (`SERVICE_UNAVAILABLE`), or image storage is unavailable
|
|
884
|
+
* (`SOCIAL_FEED_DATA_UNAVAILABLE`, 6320, HTTP 503).
|
|
885
|
+
*/
|
|
886
|
+
async createFeedCommentImageUpload(params) {
|
|
887
|
+
return this.createFeedImageUpload("create_feed_comment_image_uploads", params);
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* First attaches a drawing to an owned post or trade card while the author still holds its position.
|
|
891
|
+
* The original JSON is signed unchanged; false and zero are valid drawing documents.
|
|
892
|
+
* For an exact retry after a timeout, generate a nonce up front with {@link getMobileNonce} and reuse
|
|
893
|
+
* that nonce and the original JSON before its receive deadline. A fresh nonce is not an exact replay.
|
|
894
|
+
* If a retry returns `SOCIAL_FEED_DRAWING_EXISTS`, use {@link getFeedChartDrawing} to confirm that the
|
|
895
|
+
* stored data matches the intended drawing before treating the original create as successful.
|
|
896
|
+
* @param params - Author subaccount and signing options, parent item, and complete original drawing JSON.
|
|
897
|
+
* @returns The parent ID and updated version together with the stored drawing.
|
|
898
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
899
|
+
* @throws {MobileServerFailureError} On authentication, ownership, eligibility, or invalid/oversized drawing
|
|
900
|
+
* errors, an unavailable parent, or `SOCIAL_FEED_DRAWING_EXISTS` for a conflicting existing drawing.
|
|
901
|
+
* Read the existing drawing and use updateFeedChartDrawing when replacement is intended.
|
|
902
|
+
*/
|
|
903
|
+
async createFeedChartDrawing(params) {
|
|
904
|
+
const request = await this.getSignedRequest("create_feed_chart_drawing", params, {
|
|
905
|
+
item_id: params.itemId,
|
|
906
|
+
data_json: params.dataJson
|
|
907
|
+
});
|
|
908
|
+
return mapMobileSocialFeedDrawingMutationResult(await this.execute(request));
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Replaces an existing drawing, including after the associated position has closed.
|
|
912
|
+
* Serialize writes per item and preserve the original JSON text when retrying.
|
|
913
|
+
* @param params - Author subaccount and signing options, parent item, and complete replacement JSON.
|
|
914
|
+
* @returns The parent ID and updated version together with the stored replacement drawing.
|
|
915
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
916
|
+
* @throws {MobileServerFailureError} On authentication, ownership, or invalid/oversized drawing errors, an
|
|
917
|
+
* unavailable parent or drawing, or `STALE_SOCIAL_FEED_DRAWING_UPDATE`. Re-read the drawing before retrying
|
|
918
|
+
* a stale or conflicting update instead of blindly replacing newer content.
|
|
919
|
+
*/
|
|
920
|
+
async updateFeedChartDrawing(params) {
|
|
921
|
+
const request = await this.getSignedRequest("update_feed_chart_drawing", params, {
|
|
922
|
+
item_id: params.itemId,
|
|
923
|
+
data_json: params.dataJson
|
|
924
|
+
});
|
|
925
|
+
return mapMobileSocialFeedDrawingMutationResult(await this.execute(request));
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Publishes a comment or reply atomically; an invalid position attachment rejects the entire request.
|
|
929
|
+
* For an idempotent retry, reuse clientRequestId and the unmodified text, mentions, and attachment.
|
|
930
|
+
* @param params - Author subaccount and signing options, request UUID, root item, original nonblank text
|
|
931
|
+
* and mentions, plus an optional reply target in the same thread and currently owned position attachment.
|
|
932
|
+
* @returns The created reply and authoritative root comment count; this write does not create a reading session.
|
|
933
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
934
|
+
* @throws {MobileServerFailureError} On authentication, inaccessible content, invalid text/mentions/reply
|
|
935
|
+
* relationships, an ineligible attachment, or `SOCIAL_FEED_REQUEST_CONFLICT`. Correct invalid input before
|
|
936
|
+
* a new submission, and never reuse an existing request UUID with different content.
|
|
937
|
+
*/
|
|
938
|
+
async createFeedComment(params) {
|
|
939
|
+
const request = await this.getSignedRequest("create_feed_comment", params, {
|
|
940
|
+
client_request_id: params.clientRequestId,
|
|
941
|
+
root_item_id: params.rootItemId,
|
|
942
|
+
reply_to_item_id: params.replyToItemId,
|
|
943
|
+
text: params.text,
|
|
944
|
+
mentions: params.mentions.map(mapMobileSocialFeedMentionToServer),
|
|
945
|
+
attached_position_id: params.attachedPositionId,
|
|
946
|
+
image_ids: params.imageIds
|
|
947
|
+
});
|
|
948
|
+
return mapMobileSocialFeedCommentResult(await this.execute(request));
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Sets or clears a signed user's like without requiring an open position.
|
|
952
|
+
* Serialize mutations per item and author. Retrying the same isLiked state with a fresh nonce is safe
|
|
953
|
+
* when no newer change intervenes; an unchanged state does not increment the count or version again.
|
|
954
|
+
* Pass the original nonce on a retry before its deadline to avoid overwriting a newer change from
|
|
955
|
+
* another device. Re-read the current state if that retry conflicts.
|
|
956
|
+
* @param params - Acting subaccount and signing options, interactive item, and desired like state.
|
|
957
|
+
* @returns The applied like state, authoritative count, and item version after the mutation.
|
|
958
|
+
* @throws {WalletNotProvidedError} If neither a linked signer nor a default wallet is configured.
|
|
959
|
+
* @throws {MobileServerFailureError} On authentication errors, inaccessible or non-interactive content,
|
|
960
|
+
* or `STALE_SOCIAL_FEED_LIKE_UPDATE`. Re-read the current state before submitting a new mutation after a conflict.
|
|
961
|
+
*/
|
|
962
|
+
async setFeedLike(params) {
|
|
963
|
+
const request = await this.getSignedRequest("set_feed_like", params, {
|
|
964
|
+
item_id: params.itemId,
|
|
965
|
+
is_liked: params.isLiked
|
|
966
|
+
});
|
|
967
|
+
return mapMobileSocialFeedLikeResult(await this.execute(request));
|
|
968
|
+
}
|
|
485
969
|
async getSignedRequest(type, params, innerParams) {
|
|
486
970
|
const walletClient = this.opts.linkedSignerWalletClient ?? this.opts.walletClient;
|
|
487
971
|
if (walletClient == null) throw new WalletNotProvidedError();
|
|
@@ -501,18 +985,73 @@ var MobileClient = class {
|
|
|
501
985
|
this.checkServerStatus(response);
|
|
502
986
|
return response.data;
|
|
503
987
|
}
|
|
988
|
+
async publicGetBytes(url, headers) {
|
|
989
|
+
const response = await this.axiosInstance.get(url, {
|
|
990
|
+
responseType: "arraybuffer",
|
|
991
|
+
headers
|
|
992
|
+
});
|
|
993
|
+
if (response.status < 200 || response.status >= 300) {
|
|
994
|
+
const responseText = bytesToString(new Uint8Array(response.data));
|
|
995
|
+
let errorData;
|
|
996
|
+
try {
|
|
997
|
+
errorData = JSON.parse(responseText);
|
|
998
|
+
} catch {
|
|
999
|
+
errorData = responseText;
|
|
1000
|
+
}
|
|
1001
|
+
this.checkResponseStatus({
|
|
1002
|
+
...response,
|
|
1003
|
+
data: errorData
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
return new Uint8Array(response.data);
|
|
1007
|
+
}
|
|
504
1008
|
async publicExecute(body) {
|
|
505
1009
|
const response = await this.axiosInstance.post(`${this.opts.url}/public_execute`, body);
|
|
506
1010
|
this.checkResponseStatus(response);
|
|
507
1011
|
this.checkServerStatus(response);
|
|
508
1012
|
return response.data;
|
|
509
1013
|
}
|
|
510
|
-
|
|
511
|
-
|
|
1014
|
+
/**
|
|
1015
|
+
* Sends an authenticated read through the signed query route.
|
|
1016
|
+
* @param body - Canonical inner payload with its signature, sender, and nonce.
|
|
1017
|
+
* @returns The successful query envelope and its type-specific payload.
|
|
1018
|
+
* @throws {MobileServerFailureError} For a structured service failure, including non-2xx responses.
|
|
1019
|
+
*/
|
|
1020
|
+
async query(body) {
|
|
1021
|
+
const response = await this.axiosInstance.post(`${this.opts.url}/query`, body);
|
|
512
1022
|
this.checkResponseStatus(response);
|
|
513
1023
|
this.checkServerStatus(response);
|
|
514
1024
|
return response.data;
|
|
515
1025
|
}
|
|
1026
|
+
async execute(body, fileBytes) {
|
|
1027
|
+
const multipart = fileBytes == null ? void 0 : buildMobileFeedImageMultipart(JSON.stringify(body), fileBytes);
|
|
1028
|
+
if (multipart) this.checkFeedImageRequestSize(multipart.body.byteLength);
|
|
1029
|
+
const response = await this.axiosInstance.post(`${this.opts.url}/execute`, multipart?.body ?? body, multipart ? { headers: { "Content-Type": multipart.contentType } } : void 0);
|
|
1030
|
+
this.checkResponseStatus(response);
|
|
1031
|
+
this.checkServerStatus(response);
|
|
1032
|
+
return response.data;
|
|
1033
|
+
}
|
|
1034
|
+
async createFeedImageUpload(type, params) {
|
|
1035
|
+
const nonce = params.nonce ?? getMobileNonce();
|
|
1036
|
+
const sizePayload = {
|
|
1037
|
+
type,
|
|
1038
|
+
content_hash: zeroHash,
|
|
1039
|
+
signature: `0x${"00".repeat(65)}`,
|
|
1040
|
+
sender: subaccountToHex(params),
|
|
1041
|
+
nonce: nonce.toString()
|
|
1042
|
+
};
|
|
1043
|
+
const overhead = buildMobileFeedImageMultipart(JSON.stringify(sizePayload), new Uint8Array()).body.byteLength;
|
|
1044
|
+
this.checkFeedImageRequestSize(overhead + params.fileBytes.byteLength);
|
|
1045
|
+
const contentHash = keccak256(params.fileBytes);
|
|
1046
|
+
const request = await this.getSignedRequest(type, {
|
|
1047
|
+
...params,
|
|
1048
|
+
nonce
|
|
1049
|
+
}, { content_hash: contentHash });
|
|
1050
|
+
return mapMobileSocialFeedImage((await this.execute(request, params.fileBytes)).image);
|
|
1051
|
+
}
|
|
1052
|
+
checkFeedImageRequestSize(byteLength) {
|
|
1053
|
+
if (byteLength > 2097152) throw new RangeError(`Feed image upload request exceeds ${MOBILE_FEED_IMAGE_MAX_REQUEST_BYTES} bytes (2 MiB).`);
|
|
1054
|
+
}
|
|
516
1055
|
/**
|
|
517
1056
|
* Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns
|
|
518
1057
|
* failure envelopes with non-2xx statuses (e.g. 404 for `PROFILE_NOT_FOUND`), so a non-2xx response with a
|