@nadohq/mobile-client 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +0 -11
  2. package/dist/{MobileClient-SQ7byUxo.cjs → MobileClient-D5TNTnLx.cjs} +3 -21
  3. package/dist/MobileClient-D5TNTnLx.cjs.map +1 -0
  4. package/dist/MobileClient.cjs +1 -1
  5. package/dist/MobileClient.d.cts +10 -16
  6. package/dist/MobileClient.d.cts.map +1 -1
  7. package/dist/MobileClient.d.ts +10 -16
  8. package/dist/MobileClient.d.ts.map +1 -1
  9. package/dist/MobileClient.js +4 -22
  10. package/dist/MobileClient.js.map +1 -1
  11. package/dist/{MobileServerFailureError-N3nGgdmg.d.cts → MobileServerFailureError-CPFjwUBx.d.cts} +3 -3
  12. package/dist/{MobileServerFailureError-N3nGgdmg.d.cts.map → MobileServerFailureError-CPFjwUBx.d.cts.map} +1 -1
  13. package/dist/{MobileServerFailureError-A2EcYe6Y.d.ts → MobileServerFailureError-Terv2Wzy.d.ts} +3 -3
  14. package/dist/{MobileServerFailureError-A2EcYe6Y.d.ts.map → MobileServerFailureError-Terv2Wzy.d.ts.map} +1 -1
  15. package/dist/{buildSignedMobileRequest-B8iVGxQc.d.ts → buildSignedMobileRequest-BScnCGPF.d.ts} +2 -2
  16. package/dist/{buildSignedMobileRequest-B8iVGxQc.d.ts.map → buildSignedMobileRequest-BScnCGPF.d.ts.map} +1 -1
  17. package/dist/{buildSignedMobileRequest-CtRX4zl4.d.cts → buildSignedMobileRequest-CXfnhc-4.d.cts} +2 -2
  18. package/dist/{buildSignedMobileRequest-CtRX4zl4.d.cts.map → buildSignedMobileRequest-CXfnhc-4.d.cts.map} +1 -1
  19. package/dist/{canonicalize-Cz1rz_ER.d.ts → canonicalize-CQ-pMYIt.d.ts} +2 -2
  20. package/dist/canonicalize-CQ-pMYIt.d.ts.map +1 -0
  21. package/dist/{canonicalize-afPLlUjE.d.cts → canonicalize-hzhboB-C.d.cts} +2 -2
  22. package/dist/canonicalize-hzhboB-C.d.cts.map +1 -0
  23. package/dist/{clientTypes-DqDZEcBu.d.ts → clientTypes-BwakovWk.d.cts} +3 -30
  24. package/dist/clientTypes-BwakovWk.d.cts.map +1 -0
  25. package/dist/{clientTypes-DIipTg9D.d.cts → clientTypes-D-o1_2Yc.d.ts} +3 -30
  26. package/dist/clientTypes-D-o1_2Yc.d.ts.map +1 -0
  27. package/dist/dataMappers.cjs +0 -12
  28. package/dist/dataMappers.cjs.map +1 -1
  29. package/dist/dataMappers.d.cts +4 -8
  30. package/dist/dataMappers.d.cts.map +1 -1
  31. package/dist/dataMappers.d.ts +4 -8
  32. package/dist/dataMappers.d.ts.map +1 -1
  33. package/dist/dataMappers.js +1 -12
  34. package/dist/dataMappers.js.map +1 -1
  35. package/dist/{eip712MethodByType-CUAcWwX0.d.cts → eip712MethodByType-3aiJkrHj.d.cts} +2 -2
  36. package/dist/eip712MethodByType-3aiJkrHj.d.cts.map +1 -0
  37. package/dist/{eip712MethodByType-BzfeoDTF.d.ts → eip712MethodByType-zNvZukU7.d.ts} +2 -2
  38. package/dist/eip712MethodByType-zNvZukU7.d.ts.map +1 -0
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.d.cts +14 -14
  41. package/dist/index.d.ts +14 -14
  42. package/dist/{payloadHash-yIWBW4Iq.d.ts → payloadHash-BxL26uwq.d.ts} +2 -2
  43. package/dist/payloadHash-BxL26uwq.d.ts.map +1 -0
  44. package/dist/{payloadHash-CgKXMvZU.d.cts → payloadHash-DVkEt-Rg.d.cts} +2 -2
  45. package/dist/payloadHash-DVkEt-Rg.d.cts.map +1 -0
  46. package/dist/{serverBaseTypes-ClQZqTAK.d.ts → serverBaseTypes-B_KHFDab.d.ts} +2 -2
  47. package/dist/{serverBaseTypes-ClQZqTAK.d.ts.map → serverBaseTypes-B_KHFDab.d.ts.map} +1 -1
  48. package/dist/{serverBaseTypes-_a1pE464.d.cts → serverBaseTypes-C8KjE9Fm.d.cts} +2 -2
  49. package/dist/{serverBaseTypes-_a1pE464.d.cts.map → serverBaseTypes-C8KjE9Fm.d.cts.map} +1 -1
  50. package/dist/{serverExecuteTypes-CUla9jFj.d.cts → serverExecuteTypes-Cb5v7y0A.d.cts} +3 -3
  51. package/dist/{serverExecuteTypes-CUla9jFj.d.cts.map → serverExecuteTypes-Cb5v7y0A.d.cts.map} +1 -1
  52. package/dist/{serverExecuteTypes-BD8Awy8Q.d.ts → serverExecuteTypes-GFjZj_DC.d.ts} +3 -3
  53. package/dist/{serverExecuteTypes-BD8Awy8Q.d.ts.map → serverExecuteTypes-GFjZj_DC.d.ts.map} +1 -1
  54. package/dist/{serverModelTypes-BIGPd52y.d.ts → serverModelTypes-CwgibK-l.d.cts} +2 -12
  55. package/dist/serverModelTypes-CwgibK-l.d.cts.map +1 -0
  56. package/dist/{serverModelTypes-DGYc_3XP.d.cts → serverModelTypes-_cX99seo.d.ts} +2 -12
  57. package/dist/serverModelTypes-_cX99seo.d.ts.map +1 -0
  58. package/dist/{serverQueryTypes-4J8qNQld.d.ts → serverQueryTypes-DwE1iJ9f.d.cts} +5 -27
  59. package/dist/serverQueryTypes-DwE1iJ9f.d.cts.map +1 -0
  60. package/dist/{serverQueryTypes-C_rvZnol.d.cts → serverQueryTypes-NIrPm2Sl.d.ts} +5 -27
  61. package/dist/serverQueryTypes-NIrPm2Sl.d.ts.map +1 -0
  62. package/dist/{serverRequestTypes-w1r41ff7.d.ts → serverRequestTypes-516zXnQ6.d.ts} +9 -24
  63. package/dist/{serverRequestTypes-w1r41ff7.d.ts.map → serverRequestTypes-516zXnQ6.d.ts.map} +1 -1
  64. package/dist/{serverRequestTypes-Cw661qjM.d.cts → serverRequestTypes-GAtVYIda.d.cts} +9 -24
  65. package/dist/{serverRequestTypes-Cw661qjM.d.cts.map → serverRequestTypes-GAtVYIda.d.cts.map} +1 -1
  66. package/dist/{serverResponseGuards-DNJZw8yq.d.ts → serverResponseGuards-Cep5s7j5.d.ts} +2 -2
  67. package/dist/{serverResponseGuards-DNJZw8yq.d.ts.map → serverResponseGuards-Cep5s7j5.d.ts.map} +1 -1
  68. package/dist/{serverResponseGuards-DEyNjgwq.d.cts → serverResponseGuards-Dxt9_aGh.d.cts} +2 -2
  69. package/dist/{serverResponseGuards-DEyNjgwq.d.cts.map → serverResponseGuards-Dxt9_aGh.d.cts.map} +1 -1
  70. package/dist/signing/buildSignedMobileRequest.cjs +1 -1
  71. package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
  72. package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
  73. package/dist/signing/canonicalize.cjs +0 -1
  74. package/dist/signing/canonicalize.cjs.map +1 -1
  75. package/dist/signing/canonicalize.d.cts +1 -1
  76. package/dist/signing/canonicalize.d.ts +1 -1
  77. package/dist/signing/canonicalize.js +0 -1
  78. package/dist/signing/canonicalize.js.map +1 -1
  79. package/dist/signing/eip712MethodByType.cjs +0 -1
  80. package/dist/signing/eip712MethodByType.cjs.map +1 -1
  81. package/dist/signing/eip712MethodByType.d.cts +1 -1
  82. package/dist/signing/eip712MethodByType.d.ts +1 -1
  83. package/dist/signing/eip712MethodByType.js +0 -1
  84. package/dist/signing/eip712MethodByType.js.map +1 -1
  85. package/dist/signing/index.d.cts +5 -5
  86. package/dist/signing/index.d.ts +5 -5
  87. package/dist/signing/payloadHash.cjs +1 -1
  88. package/dist/signing/payloadHash.d.cts +1 -1
  89. package/dist/signing/payloadHash.d.ts +1 -1
  90. package/dist/signing/types.d.cts +1 -1
  91. package/dist/signing/types.d.ts +1 -1
  92. package/dist/types/MobileServerFailureError.cjs +1 -1
  93. package/dist/types/MobileServerFailureError.d.cts +1 -1
  94. package/dist/types/MobileServerFailureError.d.ts +1 -1
  95. package/dist/types/clientTypes.d.cts +2 -2
  96. package/dist/types/clientTypes.d.ts +2 -2
  97. package/dist/types/index.d.cts +8 -8
  98. package/dist/types/index.d.ts +8 -8
  99. package/dist/types/mobileErrorCodes.cjs +1 -1
  100. package/dist/types/serverBaseTypes.d.cts +1 -1
  101. package/dist/types/serverBaseTypes.d.ts +1 -1
  102. package/dist/types/serverExecuteTypes.d.cts +1 -1
  103. package/dist/types/serverExecuteTypes.d.ts +1 -1
  104. package/dist/types/serverModelTypes.cjs.map +1 -1
  105. package/dist/types/serverModelTypes.d.cts +2 -2
  106. package/dist/types/serverModelTypes.d.ts +2 -2
  107. package/dist/types/serverModelTypes.js.map +1 -1
  108. package/dist/types/serverQueryTypes.d.cts +2 -2
  109. package/dist/types/serverQueryTypes.d.ts +2 -2
  110. package/dist/types/serverRequestTypes.d.cts +2 -2
  111. package/dist/types/serverRequestTypes.d.ts +2 -2
  112. package/dist/{types-DNd9S0Rz.d.ts → types-47IPsDyA.d.cts} +3 -5
  113. package/dist/types-47IPsDyA.d.cts.map +1 -0
  114. package/dist/{types-BycRkqAj.d.cts → types-D5kFJzEX.d.ts} +3 -5
  115. package/dist/types-D5kFJzEX.d.ts.map +1 -0
  116. package/dist/utils/index.d.cts +1 -1
  117. package/dist/utils/index.d.ts +1 -1
  118. package/dist/utils/serverResponseGuards.d.cts +1 -1
  119. package/dist/utils/serverResponseGuards.d.ts +1 -1
  120. package/package.json +3 -3
  121. package/src/MobileClient.ts +7 -45
  122. package/src/dataMappers.ts +0 -16
  123. package/src/signing/canonicalize.ts +0 -2
  124. package/src/signing/eip712MethodByType.ts +0 -1
  125. package/src/signing/signing.test.ts +0 -8
  126. package/src/signing/types.ts +0 -1
  127. package/src/types/clientTypes.ts +0 -29
  128. package/src/types/serverModelTypes.ts +0 -11
  129. package/src/types/serverQueryTypes.ts +0 -30
  130. package/src/types/serverRequestTypes.ts +4 -26
  131. package/dist/MobileClient-SQ7byUxo.cjs.map +0 -1
  132. package/dist/canonicalize-Cz1rz_ER.d.ts.map +0 -1
  133. package/dist/canonicalize-afPLlUjE.d.cts.map +0 -1
  134. package/dist/clientTypes-DIipTg9D.d.cts.map +0 -1
  135. package/dist/clientTypes-DqDZEcBu.d.ts.map +0 -1
  136. package/dist/eip712MethodByType-BzfeoDTF.d.ts.map +0 -1
  137. package/dist/eip712MethodByType-CUAcWwX0.d.cts.map +0 -1
  138. package/dist/payloadHash-CgKXMvZU.d.cts.map +0 -1
  139. package/dist/payloadHash-yIWBW4Iq.d.ts.map +0 -1
  140. package/dist/serverModelTypes-BIGPd52y.d.ts.map +0 -1
  141. package/dist/serverModelTypes-DGYc_3XP.d.cts.map +0 -1
  142. package/dist/serverQueryTypes-4J8qNQld.d.ts.map +0 -1
  143. package/dist/serverQueryTypes-C_rvZnol.d.cts.map +0 -1
  144. package/dist/types-BycRkqAj.d.cts.map +0 -1
  145. package/dist/types-DNd9S0Rz.d.ts.map +0 -1
package/README.md CHANGED
@@ -32,13 +32,6 @@ const profile = await mobile.getPublicProfile({
32
32
  });
33
33
 
34
34
  // Signed operations
35
- const identity = await mobile.getSelfIdentity({
36
- subaccountOwner: walletClient.account.address,
37
- subaccountName: 'default',
38
- chainId: ink.id,
39
- verifyingAddr: '0x...',
40
- });
41
-
42
35
  await mobile.setUsername({
43
36
  subaccountOwner: walletClient.account.address,
44
37
  subaccountName: 'default',
@@ -59,10 +52,6 @@ await mobile.setUsername({
59
52
  `unregisterExpoToken`, `updateNotificationPreferences`. These are authenticated by possession of an active Expo
60
53
  push token rather than a wallet signature, so they still work at logout when a signature may be unobtainable.
61
54
 
62
- ### Signed Queries
63
-
64
- `getSelfIdentity`.
65
-
66
55
  ### Signed Executes
67
56
 
68
57
  `setUsername`, `setPrivateMode`, `registerExpoToken`.
@@ -37,7 +37,8 @@ var MobileClient = class {
37
37
  this.opts = opts;
38
38
  this.axiosInstance = axios.default.create({
39
39
  withCredentials: true,
40
- validateStatus: () => true
40
+ validateStatus: () => true,
41
+ headers: (0, _nadohq_shared.getNadoClientTypeHeaders)(opts.clientType)
41
42
  });
42
43
  }
43
44
  /**
@@ -168,19 +169,6 @@ var MobileClient = class {
168
169
  return this.publicExecute(body);
169
170
  }
170
171
  /**
171
- * Fetches the caller's own identity for a subaccount. Every non-isolated subaccount has an implicit
172
- * identity, so this resolves for any valid sender with `username` and `displayName` `null` until a username
173
- * is claimed.
174
- *
175
- * @throws {MobileServerFailureError} With error code `INVALID_IDENTITY_TARGET` if the sender is in the
176
- * engine-created isolated namespace, which cannot own an identity.
177
- */
178
- async getSelfIdentity(params) {
179
- const signedRequest = await this.getSignedRequest("self_identity", params, {});
180
- const data = await this.query(signedRequest);
181
- return data.identity ? require_dataMappers.mapMobileIdentity(data.identity) : null;
182
- }
183
- /**
184
172
  * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
185
173
  * username and renames an existing one, so callers never need to read the current identity first.
186
174
  *
@@ -243,12 +231,6 @@ var MobileClient = class {
243
231
  this.checkServerStatus(response);
244
232
  return response.data;
245
233
  }
246
- async query(body) {
247
- const response = await this.axiosInstance.post(`${this.opts.url}/mobile/query`, body);
248
- this.checkResponseStatus(response);
249
- this.checkServerStatus(response);
250
- return response.data;
251
- }
252
234
  async execute(body) {
253
235
  const response = await this.axiosInstance.post(`${this.opts.url}/mobile/execute`, body);
254
236
  this.checkResponseStatus(response);
@@ -285,4 +267,4 @@ Object.defineProperty(exports, "__toESM", {
285
267
  }
286
268
  });
287
269
 
288
- //# sourceMappingURL=MobileClient-SQ7byUxo.cjs.map
270
+ //# sourceMappingURL=MobileClient-D5TNTnLx.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobileClient-D5TNTnLx.cjs","names":["mapMobilePublicProfile","mapMobileFeedPage","mapMobileNotificationPreferences","mapMobileRegisteredWallet","mapMobileNotificationPreferencesToServer","WalletNotProvidedError","buildSignedMobileRequest","isMobileServerFailureResponse","MobileServerFailureError","isMobileServerSuccessResponse"],"sources":["../src/MobileClient.ts"],"sourcesContent":["import {\n getNadoClientTypeHeaders,\n subaccountToHex,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n mapMobileFeedPage,\n mapMobileNotificationPreferences,\n mapMobileNotificationPreferencesToServer,\n mapMobilePublicProfile,\n mapMobileRegisteredWallet,\n} from './dataMappers';\nimport {\n buildSignedMobileRequest,\n MobileSignedInner,\n MobileSignedInnerParams,\n MobileSignedRequest,\n} from './signing';\nimport {\n GetMobileFeedParams,\n GetMobileNotificationPreferencesParams,\n GetMobilePublicProfileParams,\n GetMobileRegisteredWalletParams,\n GetMobileUsernameAvailabilityParams,\n MobileFeedPage,\n MobileNotificationPreferences,\n MobilePublicProfile,\n MobileRegisteredWallet,\n MobileRegisterExpoTokenParams,\n MobileSetPrivateModeParams,\n MobileSetUsernameParams,\n MobileSignedRequestParams,\n MobileUnregisterExpoTokenParams,\n MobileUpdateNotificationPreferencesParams,\n MobileUsernameAvailability,\n} from './types/clientTypes';\nimport { MobileServerFailureError } from './types/MobileServerFailureError';\nimport { MobileServerSuccessResponse } from './types/serverBaseTypes';\nimport {\n MobileServerExecuteResult,\n MobileServerPublicExecuteRequest,\n} from './types/serverExecuteTypes';\nimport {\n MobileServerPublicQueryRequest,\n MobileServerPublicQuerySuccessResponse,\n} from './types/serverQueryTypes';\nimport {\n MobileServerPublicQueryRequestByType,\n MobileServerPublicQueryRequestType,\n} from './types/serverRequestTypes';\nimport {\n isMobileServerFailureResponse,\n isMobileServerSuccessResponse,\n} from './utils/serverResponseGuards';\n\n/**\n * Options for constructing a {@link MobileClient}.\n */\nexport interface MobileClientOpts {\n /**\n * Base URL of the mobile service API, e.g. {@link MOBILE_CLIENT_ENDPOINTS}.\n */\n url: string;\n /**\n * Wallet client used to sign requests.\n */\n walletClient?: WalletClientWithAccount;\n /**\n * If provided, this signer is used instead of `walletClient` for all signed requests.\n */\n linkedSignerWalletClient?: WalletClientWithAccount;\n /**\n * If provided, identifies the calling client, sent as a header with every request.\n */\n clientType?: string;\n}\n\n/**\n * Client for the Nado mobile service API: usernames, public profile lookups, the global trade feed, privacy\n * settings, and push notification device/preference management.\n */\nexport class MobileClient {\n readonly opts: MobileClientOpts;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: MobileClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n headers: getNadoClientTypeHeaders(opts.clientType),\n });\n }\n\n /**\n * Sets the linked signer for requests\n *\n * @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer\n */\n public setLinkedSigner(\n linkedSignerWalletClient: WalletClientWithAccount | null,\n ) {\n this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? undefined;\n }\n\n /*\n Public queries\n */\n\n /**\n * Checks whether a username derived from the given display name is available to claim.\n */\n async getUsernameAvailability(\n params: GetMobileUsernameAvailabilityParams,\n ): Promise<MobileUsernameAvailability> {\n const body: MobileServerPublicQueryRequest<'username_availability'> = {\n type: 'username_availability',\n display_name: params.displayName,\n };\n const data = await this.publicQuery(body);\n return { username: data.username, available: data.available };\n }\n\n /**\n * Looks up a subaccount's public profile. Every non-isolated subaccount resolves, with `username` and\n * `displayName` `null` until a username is claimed. Private Mode does not hide the profile itself, only the\n * account's activity.\n *\n * @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the subaccount is in the\n * engine-created isolated namespace, which cannot own a profile.\n */\n async getPublicProfile(\n params: GetMobilePublicProfileParams,\n ): Promise<MobilePublicProfile> {\n const body: MobileServerPublicQueryRequest<'profile'> = {\n type: 'profile',\n subaccount: subaccountToHex(params),\n };\n const data = await this.publicQuery(body);\n return mapMobilePublicProfile(data.profile);\n }\n\n /**\n * Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a\n * whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a\n * username are included with `null` name fields; only private accounts are filtered out. The feed is\n * best-effort rather than authoritative history, and pagination is live (not snapshot), so deduplicate pages\n * by {@link MobileFeedTrade.orderDigest}.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_FEED_FILTER` if `minimumNotional` or\n * `limit` is outside its allowed domain (fix the request; do not retry unchanged), or\n * `INVALID_FEED_CURSOR` if the cursor is malformed or was issued for a different `minimumNotional`\n * (discard the cursor and restart from the first page).\n */\n async getFeed(params: GetMobileFeedParams = {}): Promise<MobileFeedPage> {\n const body: MobileServerPublicQueryRequest<'feed'> = {\n type: 'feed',\n minimum_notional: params.minimumNotional,\n limit: params.limit,\n cursor: params.cursor,\n };\n const data = await this.publicQuery(body);\n return mapMobileFeedPage(data);\n }\n\n /**\n * Fetches the push notification preferences of the wallet that owns the given Expo push token. Unsigned —\n * the token identifies the wallet on its own. Falls back to the backend's defaults if the wallet has never\n * updated its preferences.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet.\n */\n async getNotificationPreferences(\n params: GetMobileNotificationPreferencesParams,\n ): Promise<MobileNotificationPreferences> {\n const body: MobileServerPublicQueryRequest<'notification_preferences'> = {\n type: 'notification_preferences',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileNotificationPreferences(data.preferences);\n }\n\n /**\n * Resolves the wallet that an Expo push token is currently registered to, along with the redacted metadata\n * of the device that registered it. Unsigned — the token identifies the wallet on its own. Use it to check\n * whether a locally held token is still active and which wallet currently owns it, since registering the\n * same token under another wallet transfers ownership.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet — including a token that was unregistered. The backend does not\n * distinguish those cases.\n */\n async getRegisteredWallet(\n params: GetMobileRegisteredWalletParams,\n ): Promise<MobileRegisteredWallet> {\n const body: MobileServerPublicQueryRequest<'registered_wallet'> = {\n type: 'registered_wallet',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileRegisteredWallet(data);\n }\n\n /*\n Public executes\n */\n\n /**\n * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout\n * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown\n * well-formed token succeeds.\n *\n * A registration that commits after this call re-activates the token, so stop or await any in-flight\n * {@link MobileClient.registerExpoToken} before unregistering.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed.\n */\n async unregisterExpoToken(\n params: MobileUnregisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'unregister_expo_token'> = {\n type: 'unregister_expo_token',\n expo_token: params.expoToken,\n };\n return this.publicExecute(body);\n }\n\n /**\n * Replaces the push notification preferences of the wallet that owns the given Expo push token. Possession\n * of an active token is the credential rather than a signature, so anyone holding the token can overwrite\n * that wallet's preferences. The backend requires `schemaVersion` of 1, exactly one entry per known\n * category, and empty `scopes` on every entry.\n *\n * Writes are last-write-wins on commit order rather than ordered by a client nonce, so callers must\n * serialize their own preference writes.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated, or\n * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.\n */\n async updateNotificationPreferences(\n params: MobileUpdateNotificationPreferencesParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'update_preferences'> = {\n type: 'update_preferences',\n expo_token: params.expoToken,\n preferences: mapMobileNotificationPreferencesToServer(params.preferences),\n };\n return this.publicExecute(body);\n }\n\n /*\n Signed executes\n */\n\n /**\n * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first\n * username and renames an existing one, so callers never need to read the current identity first.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_DISPLAY_NAME` if the display name violates\n * `MOBILE_DISPLAY_NAME_PATTERN`, `USERNAME_UNAVAILABLE` if the derived username is reserved or already\n * taken by another subaccount, `INVALID_IDENTITY_TARGET` if the sender is in the engine-created isolated\n * namespace, or `STALE_IDENTITY_UPDATE` if another identity write for this subaccount committed with a\n * later nonce (re-read the identity before retrying).\n */\n async setUsername(\n params: MobileSetUsernameParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest('set_username', params, {\n display_name: params.displayName,\n });\n return this.execute(signedRequest);\n }\n\n /**\n * Sets whether a subaccount's profile is private.\n */\n async setPrivateMode(\n params: MobileSetPrivateModeParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'set_private_mode',\n params,\n { private_mode: params.privateMode },\n );\n return this.execute(signedRequest);\n }\n\n /**\n * Registers an Expo push token for the wallet, transferring active ownership of the token if another\n * wallet had registered it. Idempotent per `(wallet, token)`.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is not a valid Expo\n * push token, or `INVALID_DEVICE_METADATA` if `locale` (max 35 chars) or `appVersion` (max 64 chars) is\n * too long.\n */\n async registerExpoToken(\n params: MobileRegisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'register_expo_token',\n params,\n {\n expo_token: params.expoToken,\n platform: params.platform,\n locale: params.locale ?? null,\n app_version: params.appVersion ?? null,\n },\n );\n return this.execute(signedRequest);\n }\n\n /*\n Base Fns\n */\n\n protected async getSignedRequest<T extends MobileSignedInner['type']>(\n type: T,\n params: MobileSignedRequestParams,\n innerParams: MobileSignedInnerParams<T>,\n ): Promise<MobileSignedRequest> {\n // Use the linked signer if provided, otherwise use the default signer provided to the client\n const walletClient =\n this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\n\n if (walletClient == null) {\n throw new WalletNotProvidedError();\n }\n\n const inner = { type, ...innerParams } as unknown as MobileSignedInner;\n return buildSignedMobileRequest({ ...params, walletClient, inner });\n }\n\n // Spelled out as an intersection rather than `MobileServerPublicQueryRequest<T>`: the latter is an indexed\n // access on a mapped type, which is not an inference site, so `T` would always widen to the full union.\n protected async publicQuery<T extends MobileServerPublicQueryRequestType>(\n body: { type: T } & MobileServerPublicQueryRequestByType[T],\n ): Promise<MobileServerPublicQuerySuccessResponse<T>> {\n const response = await this.axiosInstance.post<unknown>(\n `${this.opts.url}/mobile/public_query`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n return response.data as MobileServerPublicQuerySuccessResponse<T>;\n }\n\n protected async publicExecute(\n body: MobileServerPublicExecuteRequest,\n ): Promise<MobileServerSuccessResponse> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/mobile/public_execute`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as MobileServerSuccessResponse;\n }\n\n protected async execute(\n body: MobileSignedRequest,\n ): Promise<MobileServerSuccessResponse> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/mobile/execute`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as MobileServerSuccessResponse;\n }\n\n /**\n * Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns\n * failure envelopes with non-2xx statuses (e.g. 404 for `PROFILE_NOT_FOUND`), so a non-2xx response with a\n * failure envelope still throws the typed error; anything else is a transport-level error.\n */\n private checkResponseStatus(response: AxiosResponse<unknown>) {\n if (response.status >= 200 && response.status < 300) {\n return;\n }\n if (isMobileServerFailureResponse(response.data)) {\n throw new MobileServerFailureError(response.data, response.status);\n }\n throw new Error(\n `Unexpected response from mobile service: ${response.status} ${response.statusText}. Data: ${JSON.stringify(response.data)}`,\n );\n }\n\n private checkServerStatus(response: AxiosResponse<unknown>) {\n const { data } = response;\n\n if (isMobileServerFailureResponse(data)) {\n throw new MobileServerFailureError(data, response.status);\n }\n if (!isMobileServerSuccessResponse(data)) {\n throw new Error(\n `Unexpected response from mobile service: missing success envelope. Data: ${JSON.stringify(data)}`,\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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C,MAAM,WAAW,MAAM,KAAK,cAAc,KACxC,GAAG,KAAK,KAAK,IAAI,yBACjB,IACF;EAEA,KAAK,oBAAoB,QAAQ;EACjC,KAAK,kBAAkB,QAAQ;EAG/B,OAAO,SAAS;CAClB;CAEA,MAAgB,QACd,MACsC;EACtC,MAAM,WAAW,MAAM,KAAK,cAAc,KACxC,GAAG,KAAK,KAAK,IAAI,kBACjB,IACF;EAEA,KAAK,oBAAoB,QAAQ;EACjC,KAAK,kBAAkB,QAAQ;EAG/B,OAAO,SAAS;CAClB;;;;;;CAOA,oBAA4B,UAAkC;EAC5D,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS,KAC9C;EAEF,IAAIC,mCAAAA,8BAA8B,SAAS,IAAI,GAC7C,MAAM,IAAIC,uCAAAA,yBAAyB,SAAS,MAAM,SAAS,MAAM;EAEnE,MAAM,IAAI,MACR,4CAA4C,SAAS,OAAO,GAAG,SAAS,WAAW,UAAU,KAAK,UAAU,SAAS,IAAI,GAC3H;CACF;CAEA,kBAA0B,UAAkC;EAC1D,MAAM,EAAE,SAAS;EAEjB,IAAID,mCAAAA,8BAA8B,IAAI,GACpC,MAAM,IAAIC,uCAAAA,yBAAyB,MAAM,SAAS,MAAM;EAE1D,IAAI,CAACC,mCAAAA,8BAA8B,IAAI,GACrC,MAAM,IAAI,MACR,4EAA4E,KAAK,UAAU,IAAI,GACjG;CAEJ;AACF"}
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_MobileClient = require("./MobileClient-SQ7byUxo.cjs");
2
+ const require_MobileClient = require("./MobileClient-D5TNTnLx.cjs");
3
3
  require("./signing/index.cjs");
4
4
  exports.MobileClient = require_MobileClient.MobileClient;
@@ -1,9 +1,9 @@
1
- import { S as MobileUsernameAvailability, _ as MobileSetPrivateModeParams, a as GetMobileSelfIdentityParams, b as MobileUnregisterExpoTokenParams, c as MobileFeedPage, g as MobileRegisteredWallet, h as MobileRegisterExpoTokenParams, i as GetMobileRegisteredWalletParams, m as MobilePublicProfile, n as GetMobileNotificationPreferencesParams, o as GetMobileUsernameAvailabilityParams, p as MobileNotificationPreferences, r as GetMobilePublicProfileParams, t as GetMobileFeedParams, u as MobileIdentity, v as MobileSetUsernameParams, x as MobileUpdateNotificationPreferencesParams, y as MobileSignedRequestParams } from "./clientTypes-DIipTg9D.cjs";
2
- import { i as MobileSignedRequest, n as MobileSignedInner, r as MobileSignedInnerParams } from "./types-BycRkqAj.cjs";
3
- import { a as MobileServerPublicQueryRequestType, c as MobileServerSignedQueryRequestType, i as MobileServerPublicQueryRequestByType } from "./serverRequestTypes-Cw661qjM.cjs";
4
- import { n as MobileServerSuccessResponse } from "./serverBaseTypes-_a1pE464.cjs";
5
- import { n as MobileServerPublicExecuteRequest } from "./serverExecuteTypes-CUla9jFj.cjs";
6
- import { o as MobileServerPublicQuerySuccessResponse, u as MobileServerSignedQuerySuccessResponse } from "./serverQueryTypes-C_rvZnol.cjs";
1
+ import { _ as MobileSignedRequestParams, a as GetMobileUsernameAvailabilityParams, b as MobileUsernameAvailability, d as MobileNotificationPreferences, f as MobilePublicProfile, g as MobileSetUsernameParams, h as MobileSetPrivateModeParams, i as GetMobileRegisteredWalletParams, m as MobileRegisteredWallet, n as GetMobileNotificationPreferencesParams, p as MobileRegisterExpoTokenParams, r as GetMobilePublicProfileParams, s as MobileFeedPage, t as GetMobileFeedParams, v as MobileUnregisterExpoTokenParams, y as MobileUpdateNotificationPreferencesParams } from "./clientTypes-BwakovWk.cjs";
2
+ import { i as MobileSignedRequest, n as MobileSignedInner, r as MobileSignedInnerParams } from "./types-47IPsDyA.cjs";
3
+ import { a as MobileServerPublicQueryRequestType, i as MobileServerPublicQueryRequestByType } from "./serverRequestTypes-GAtVYIda.cjs";
4
+ import { n as MobileServerSuccessResponse } from "./serverBaseTypes-C8KjE9Fm.cjs";
5
+ import { n as MobileServerPublicExecuteRequest } from "./serverExecuteTypes-Cb5v7y0A.cjs";
6
+ import { o as MobileServerPublicQuerySuccessResponse } from "./serverQueryTypes-DwE1iJ9f.cjs";
7
7
  import { WalletClientWithAccount } from "@nadohq/shared";
8
8
  import { AxiosInstance } from "axios";
9
9
 
@@ -24,6 +24,10 @@ interface MobileClientOpts {
24
24
  * If provided, this signer is used instead of `walletClient` for all signed requests.
25
25
  */
26
26
  linkedSignerWalletClient?: WalletClientWithAccount;
27
+ /**
28
+ * If provided, identifies the calling client, sent as a header with every request.
29
+ */
30
+ clientType?: string;
27
31
  }
28
32
  /**
29
33
  * Client for the Nado mobile service API: usernames, public profile lookups, the global trade feed, privacy
@@ -109,15 +113,6 @@ declare class MobileClient {
109
113
  * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.
110
114
  */
111
115
  updateNotificationPreferences(params: MobileUpdateNotificationPreferencesParams): Promise<MobileServerSuccessResponse>;
112
- /**
113
- * Fetches the caller's own identity for a subaccount. Every non-isolated subaccount has an implicit
114
- * identity, so this resolves for any valid sender with `username` and `displayName` `null` until a username
115
- * is claimed.
116
- *
117
- * @throws {MobileServerFailureError} With error code `INVALID_IDENTITY_TARGET` if the sender is in the
118
- * engine-created isolated namespace, which cannot own an identity.
119
- */
120
- getSelfIdentity(params: GetMobileSelfIdentityParams): Promise<MobileIdentity | null>;
121
116
  /**
122
117
  * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
123
118
  * username and renames an existing one, so callers never need to read the current identity first.
@@ -147,7 +142,6 @@ declare class MobileClient {
147
142
  type: T;
148
143
  } & MobileServerPublicQueryRequestByType[T]): Promise<MobileServerPublicQuerySuccessResponse<T>>;
149
144
  protected publicExecute(body: MobileServerPublicExecuteRequest): Promise<MobileServerSuccessResponse>;
150
- protected query<T extends MobileServerSignedQueryRequestType>(body: MobileSignedRequest): Promise<MobileServerSignedQuerySuccessResponse<T>>;
151
145
  protected execute(body: MobileSignedRequest): Promise<MobileServerSuccessResponse>;
152
146
  /**
153
147
  * Validates the HTTP status before interpreting the body. Unlike the engine, the m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okenParams, c as MobileFeedPage, g as MobileRegisteredWallet, h as MobileRegisterExpoTokenParams, i as GetMobileRegisteredWalletParams, m as MobilePublicProfile, n as GetMobileNotificationPreferencesParams, o as GetMobileUsernameAvailabilityParams, p as MobileNotificationPreferences, r as GetMobilePublicProfileParams, t as GetMobileFeedParams, u as MobileIdentity, v as MobileSetUsernameParams, x as MobileUpdateNotificationPreferencesParams, y as MobileSignedRequestParams } from "./clientTypes-DqDZEcBu.js";
2
- import { i as MobileSignedRequest, n as MobileSignedInner, r as MobileSignedInnerParams } from "./types-DNd9S0Rz.js";
3
- import { a as MobileServerPublicQueryRequestType, c as MobileServerSignedQueryRequestType, i as MobileServerPublicQueryRequestByType } from "./serverRequestTypes-w1r41ff7.js";
4
- import { n as MobileServerSuccessResponse } from "./serverBaseTypes-ClQZqTAK.js";
5
- import { n as MobileServerPublicExecuteRequest } from "./serverExecuteTypes-BD8Awy8Q.js";
6
- import { o as MobileServerPublicQuerySuccessResponse, u as MobileServerSignedQuerySuccessResponse } from "./serverQueryTypes-4J8qNQld.js";
1
+ import { _ as MobileSignedRequestParams, a as GetMobileUsernameAvailabilityParams, b as MobileUsernameAvailability, d as MobileNotificationPreferences, f as MobilePublicProfile, g as MobileSetUsernameParams, h as MobileSetPrivateModeParams, i as GetMobileRegisteredWalletParams, m as MobileRegisteredWallet, n as GetMobileNotificationPreferencesParams, p as MobileRegisterExpoTokenParams, r as GetMobilePublicProfileParams, s as MobileFeedPage, t as GetMobileFeedParams, v as MobileUnregisterExpoTokenParams, y as MobileUpdateNotificationPreferencesParams } from "./clientTypes-D-o1_2Yc.js";
2
+ import { i as MobileSignedRequest, n as MobileSignedInner, r as MobileSignedInnerParams } from "./types-D5kFJzEX.js";
3
+ import { a as MobileServerPublicQueryRequestType, i as MobileServerPublicQueryRequestByType } from "./serverRequestTypes-516zXnQ6.js";
4
+ import { n as MobileServerSuccessResponse } from "./serverBaseTypes-B_KHFDab.js";
5
+ import { n as MobileServerPublicExecuteRequest } from "./serverExecuteTypes-GFjZj_DC.js";
6
+ import { o as MobileServerPublicQuerySuccessResponse } from "./serverQueryTypes-NIrPm2Sl.js";
7
7
  import { WalletClientWithAccount } from "@nadohq/shared";
8
8
  import { AxiosInstance } from "axios";
9
9
 
@@ -24,6 +24,10 @@ interface MobileClientOpts {
24
24
  * If provided, this signer is used instead of `walletClient` for all signed requests.
25
25
  */
26
26
  linkedSignerWalletClient?: WalletClientWithAccount;
27
+ /**
28
+ * If provided, identifies the calling client, sent as a header with every request.
29
+ */
30
+ clientType?: string;
27
31
  }
28
32
  /**
29
33
  * Client for the Nado mobile service API: usernames, public profile lookups, the global trade feed, privacy
@@ -109,15 +113,6 @@ declare class MobileClient {
109
113
  * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.
110
114
  */
111
115
  updateNotificationPreferences(params: MobileUpdateNotificationPreferencesParams): Promise<MobileServerSuccessResponse>;
112
- /**
113
- * Fetches the caller's own identity for a subaccount. Every non-isolated subaccount has an implicit
114
- * identity, so this resolves for any valid sender with `username` and `displayName` `null` until a username
115
- * is claimed.
116
- *
117
- * @throws {MobileServerFailureError} With error code `INVALID_IDENTITY_TARGET` if the sender is in the
118
- * engine-created isolated namespace, which cannot own an identity.
119
- */
120
- getSelfIdentity(params: GetMobileSelfIdentityParams): Promise<MobileIdentity | null>;
121
116
  /**
122
117
  * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
123
118
  * username and renames an existing one, so callers never need to read the current identity first.
@@ -147,7 +142,6 @@ declare class MobileClient {
147
142
  type: T;
148
143
  } & MobileServerPublicQueryRequestByType[T]): Promise<MobileServerPublicQuerySuccessResponse<T>>;
149
144
  protected publicExecute(body: MobileServerPublicExecuteRequest): Promise<MobileServerSuccessResponse>;
150
- protected query<T extends MobileServerSignedQueryRequestType>(body: MobileSignedRequest): Promise<MobileServerSignedQuerySuccessResponse<T>>;
151
145
  protected execute(body: MobileSignedRequest): Promise<MobileServerSuccessResponse>;
152
146
  /**
153
147
  * Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns
@@ -1 +1 @@
1
- {"version":3,"file":"MobileClient.d.ts","names":[],"sources":["../src/src/MobileClient.ts"],"mappings":";;;;;;;;;;;;;UAgEiB,gBAAA;EAAgB;;;EAI/B,GAAA;EAIA;;;EAAA,YAAA,GAAe,uBAAA;EAImC;AAAA;AAOpD;EAPE,wBAAA,GAA2B,uBAAuB;AAAA;;;;;cAOvC,YAAA;EAAA,SACF,IAAA,EAAM,gBAAA;EAAA,SACN,aAAA,EAAe,aAAA;cAEZ,IAAA,EAAM,gBAAA;EAgDP;;;;;EAlCJ,eAAA,CACL,wBAAA,EAA0B,uBAAA;EA2EjB;;;EA/DL,uBAAA,CACJ,MAAA,EAAQ,mCAAA,GACP,OAAA,CAAQ,0BAAA;EAkFR;;;;;;;;EAjEG,gBAAA,CACJ,MAAA,EAAQ,4BAAA,GACP,OAAA,CAAQ,mBAAA;EAqIR;;;;;;;;;;;;EAhHG,OAAA,CAAQ,MAAA,GAAQ,mBAAA,GAA2B,OAAA,CAAQ,cAAA;EA8LlB;;;;;;;;EA3KjC,0BAAA,CACJ,MAAA,EAAQ,sCAAA,GACP,OAAA,CAAQ,6BAAA;EA2LA;;;;;;;;;;EAxKL,mBAAA,CACJ,MAAA,EAAQ,+BAAA,GACP,OAAA,CAAQ,sBAAA;EAmNA;;;;;;;;;;EA5LL,mBAAA,CACJ,MAAA,EAAQ,+BAAA,GACP,OAAA,CAAQ,2BAAA;EA1HJ;;;;;;;;;;;;EA8ID,6BAAA,CACJ,MAAA,EAAQ,yCAAA,GACP,OAAA,CAAQ,2BAAA;EAzFL;;;;;;;;EA8GA,eAAA,CACJ,MAAA,EAAQ,2BAAA,GACP,OAAA,CAAQ,cAAA;EA3FA;;;;;;;;;;EAmHL,WAAA,CACJ,MAAA,EAAQ,uBAAA,GACP,OAAA,CAAQ,2BAAA;EAnDL;;;EA6DA,cAAA,CACJ,MAAA,EAAQ,0BAAA,GACP,OAAA,CAA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, mapMobileNotificationPreferencesToServer, mapMobilePublicProfile, mapMobileRegisteredWallet } from "./dataMappers.js";
1
+ import { mapMobileFeedPage, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobilePublicProfile, mapMobileRegisteredWallet } 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";
5
5
  import { isMobileServerFailureResponse, isMobileServerSuccessResponse } from "./utils/serverResponseGuards.js";
6
- import { WalletNotProvidedError, subaccountToHex } from "@nadohq/shared";
6
+ import { WalletNotProvidedError, getNadoClientTypeHeaders, subaccountToHex } from "@nadohq/shared";
7
7
  import axios from "axios";
8
8
  //#region src/MobileClient.ts
9
9
  /**
@@ -15,7 +15,8 @@ var MobileClient = class {
15
15
  this.opts = opts;
16
16
  this.axiosInstance = axios.create({
17
17
  withCredentials: true,
18
- validateStatus: () => true
18
+ validateStatus: () => true,
19
+ headers: getNadoClientTypeHeaders(opts.clientType)
19
20
  });
20
21
  }
21
22
  /**
@@ -146,19 +147,6 @@ var MobileClient = class {
146
147
  return this.publicExecute(body);
147
148
  }
148
149
  /**
149
- * Fetches the caller's own identity for a subaccount. Every non-isolated subaccount has an implicit
150
- * identity, so this resolves for any valid sender with `username` and `displayName` `null` until a username
151
- * is claimed.
152
- *
153
- * @throws {MobileServerFailureError} With error code `INVALID_IDENTITY_TARGET` if the sender is in the
154
- * engine-created isolated namespace, which cannot own an identity.
155
- */
156
- async getSelfIdentity(params) {
157
- const signedRequest = await this.getSignedRequest("self_identity", params, {});
158
- const data = await this.query(signedRequest);
159
- return data.identity ? mapMobileIdentity(data.identity) : null;
160
- }
161
- /**
162
150
  * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
163
151
  * username and renames an existing one, so callers never need to read the current identity first.
164
152
  *
@@ -221,12 +209,6 @@ var MobileClient = class {
221
209
  this.checkServerStatus(response);
222
210
  return response.data;
223
211
  }
224
- async query(body) {
225
- const response = await this.axiosInstance.post(`${this.opts.url}/mobile/query`, body);
226
- this.checkResponseStatus(response);
227
- this.checkServerStatus(response);
228
- return response.data;
229
- }
230
212
  async execute(body) {
231
213
  const response = await this.axiosInstance.post(`${this.opts.url}/mobile/execute`, body);
232
214
  this.checkResponseStatus(response);
@@ -1 +1 @@
1
- {"version":3,"file":"MobileClient.js","names":[],"sources":["../src/MobileClient.ts"],"sourcesContent":["import {\n subaccountToHex,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n mapMobileFeedPage,\n mapMobileIdentity,\n mapMobileNotificationPreferences,\n mapMobileNotificationPreferencesToServer,\n mapMobilePublicProfile,\n mapMobileRegisteredWallet,\n} from './dataMappers';\nimport {\n buildSignedMobileRequest,\n MobileSignedInner,\n MobileSignedInnerParams,\n MobileSignedRequest,\n} from './signing';\nimport {\n GetMobileFeedParams,\n GetMobileNotificationPreferencesParams,\n GetMobilePublicProfileParams,\n GetMobileRegisteredWalletParams,\n GetMobileSelfIdentityParams,\n GetMobileUsernameAvailabilityParams,\n MobileFeedPage,\n MobileIdentity,\n MobileNotificationPreferences,\n MobilePublicProfile,\n MobileRegisteredWallet,\n MobileRegisterExpoTokenParams,\n MobileSetPrivateModeParams,\n MobileSetUsernameParams,\n MobileSignedRequestParams,\n MobileUnregisterExpoTokenParams,\n MobileUpdateNotificationPreferencesParams,\n MobileUsernameAvailability,\n} from './types/clientTypes';\nimport { MobileServerFailureError } from './types/MobileServerFailureError';\nimport { MobileServerSuccessResponse } from './types/serverBaseTypes';\nimport {\n MobileServerExecuteResult,\n MobileServerPublicExecuteRequest,\n} from './types/serverExecuteTypes';\nimport {\n MobileServerPublicQueryRequest,\n MobileServerPublicQuerySuccessResponse,\n MobileServerSignedQuerySuccessResponse,\n} from './types/serverQueryTypes';\nimport {\n MobileServerPublicQueryRequestByType,\n MobileServerPublicQueryRequestType,\n MobileServerSignedQueryRequestType,\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\n/**\n * Client for the Nado mobile service API: usernames, public profile lookups, the global trade feed, privacy\n * settings, and push notification device/preference management.\n */\nexport class MobileClient {\n readonly opts: MobileClientOpts;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: MobileClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n });\n }\n\n /**\n * Sets the linked signer for requests\n *\n * @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer\n */\n public setLinkedSigner(\n linkedSignerWalletClient: WalletClientWithAccount | null,\n ) {\n this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? undefined;\n }\n\n /*\n Public queries\n */\n\n /**\n * Checks whether a username derived from the given display name is available to claim.\n */\n async getUsernameAvailability(\n params: GetMobileUsernameAvailabilityParams,\n ): Promise<MobileUsernameAvailability> {\n const body: MobileServerPublicQueryRequest<'username_availability'> = {\n type: 'username_availability',\n display_name: params.displayName,\n };\n const data = await this.publicQuery(body);\n return { username: data.username, available: data.available };\n }\n\n /**\n * Looks up a subaccount's public profile. Every non-isolated subaccount resolves, with `username` and\n * `displayName` `null` until a username is claimed. Private Mode does not hide the profile itself, only the\n * account's activity.\n *\n * @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the subaccount is in the\n * engine-created isolated namespace, which cannot own a profile.\n */\n async getPublicProfile(\n params: GetMobilePublicProfileParams,\n ): Promise<MobilePublicProfile> {\n const body: MobileServerPublicQueryRequest<'profile'> = {\n type: 'profile',\n subaccount: subaccountToHex(params),\n };\n const data = await this.publicQuery(body);\n return mapMobilePublicProfile(data.profile);\n }\n\n /**\n * Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a\n * whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a\n * username are included with `null` name fields; only private accounts are filtered out. The feed is\n * best-effort rather than authoritative history, and pagination is live (not snapshot), so deduplicate pages\n * by {@link MobileFeedTrade.orderDigest}.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_FEED_FILTER` if `minimumNotional` or\n * `limit` is outside its allowed domain (fix the request; do not retry unchanged), or\n * `INVALID_FEED_CURSOR` if the cursor is malformed or was issued for a different `minimumNotional`\n * (discard the cursor and restart from the first page).\n */\n async getFeed(params: GetMobileFeedParams = {}): Promise<MobileFeedPage> {\n const body: MobileServerPublicQueryRequest<'feed'> = {\n type: 'feed',\n minimum_notional: params.minimumNotional,\n limit: params.limit,\n cursor: params.cursor,\n };\n const data = await this.publicQuery(body);\n return mapMobileFeedPage(data);\n }\n\n /**\n * Fetches the push notification preferences of the wallet that owns the given Expo push token. Unsigned —\n * the token identifies the wallet on its own. Falls back to the backend's defaults if the wallet has never\n * updated its preferences.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet.\n */\n async getNotificationPreferences(\n params: GetMobileNotificationPreferencesParams,\n ): Promise<MobileNotificationPreferences> {\n const body: MobileServerPublicQueryRequest<'notification_preferences'> = {\n type: 'notification_preferences',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileNotificationPreferences(data.preferences);\n }\n\n /**\n * Resolves the wallet that an Expo push token is currently registered to, along with the redacted metadata\n * of the device that registered it. Unsigned — the token identifies the wallet on its own. Use it to check\n * whether a locally held token is still active and which wallet currently owns it, since registering the\n * same token under another wallet transfers ownership.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet — including a token that was unregistered. The backend does not\n * distinguish those cases.\n */\n async getRegisteredWallet(\n params: GetMobileRegisteredWalletParams,\n ): Promise<MobileRegisteredWallet> {\n const body: MobileServerPublicQueryRequest<'registered_wallet'> = {\n type: 'registered_wallet',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileRegisteredWallet(data);\n }\n\n /*\n Public executes\n */\n\n /**\n * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout\n * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown\n * well-formed token succeeds.\n *\n * A registration that commits after this call re-activates the token, so stop or await any in-flight\n * {@link MobileClient.registerExpoToken} before unregistering.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed.\n */\n async unregisterExpoToken(\n params: MobileUnregisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'unregister_expo_token'> = {\n type: 'unregister_expo_token',\n expo_token: params.expoToken,\n };\n return this.publicExecute(body);\n }\n\n /**\n * Replaces the push notification preferences of the wallet that owns the given Expo push token. Possession\n * of an active token is the credential rather than a signature, so anyone holding the token can overwrite\n * that wallet's preferences. The backend requires `schemaVersion` of 1, exactly one entry per known\n * category, and empty `scopes` on every entry.\n *\n * Writes are last-write-wins on commit order rather than ordered by a client nonce, so callers must\n * serialize their own preference writes.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated, or\n * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.\n */\n async updateNotificationPreferences(\n params: MobileUpdateNotificationPreferencesParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'update_preferences'> = {\n type: 'update_preferences',\n expo_token: params.expoToken,\n preferences: mapMobileNotificationPreferencesToServer(params.preferences),\n };\n return this.publicExecute(body);\n }\n\n /*\n Signed queries\n */\n\n /**\n * Fetches the caller's own identity for a subaccount. Every non-isolated subaccount has an implicit\n * identity, so this resolves for any valid sender with `username` and `displayName` `null` until a username\n * is claimed.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_IDENTITY_TARGET` if the sender is in the\n * engine-created isolated namespace, which cannot own an identity.\n */\n async getSelfIdentity(\n params: GetMobileSelfIdentityParams,\n ): Promise<MobileIdentity | null> {\n const signedRequest = await this.getSignedRequest(\n 'self_identity',\n params,\n {},\n );\n const data = await this.query<'self_identity'>(signedRequest);\n return data.identity ? mapMobileIdentity(data.identity) : null;\n }\n\n /*\n Signed executes\n */\n\n /**\n * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first\n * username and renames an existing one, so callers never need to read the current identity first.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_DISPLAY_NAME` if the display name violates\n * `MOBILE_DISPLAY_NAME_PATTERN`, `USERNAME_UNAVAILABLE` if the derived username is reserved or already\n * taken by another subaccount, `INVALID_IDENTITY_TARGET` if the sender is in the engine-created isolated\n * namespace, or `STALE_IDENTITY_UPDATE` if another identity write for this subaccount committed with a\n * later nonce (re-read the identity before retrying).\n */\n async setUsername(\n params: MobileSetUsernameParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest('set_username', params, {\n display_name: params.displayName,\n });\n return this.execute(signedRequest);\n }\n\n /**\n * Sets whether a subaccount's profile is private.\n */\n async setPrivateMode(\n params: MobileSetPrivateModeParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'set_private_mode',\n params,\n { private_mode: params.privateMode },\n );\n return this.execute(signedRequest);\n }\n\n /**\n * Registers an Expo push token for the wallet, transferring active ownership of the token if another\n * wallet had registered it. Idempotent per `(wallet, token)`.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is not a valid Expo\n * push token, or `INVALID_DEVICE_METADATA` if `locale` (max 35 chars) or `appVersion` (max 64 chars) is\n * too long.\n */\n async registerExpoToken(\n params: MobileRegisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'register_expo_token',\n params,\n {\n expo_token: params.expoToken,\n platform: params.platform,\n locale: params.locale ?? null,\n app_version: params.appVersion ?? null,\n },\n );\n return this.execute(signedRequest);\n }\n\n /*\n Base Fns\n */\n\n protected async getSignedRequest<T extends MobileSignedInner['type']>(\n type: T,\n params: MobileSignedRequestParams,\n innerParams: MobileSignedInnerParams<T>,\n ): Promise<MobileSignedRequest> {\n // Use the linked signer if provided, otherwise use the default signer provided to the client\n const walletClient =\n this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\n\n if (walletClient == null) {\n throw new WalletNotProvidedError();\n }\n\n const inner = { type, ...innerParams } as MobileSignedInner;\n return buildSignedMobileRequest({ ...params, walletClient, inner });\n }\n\n // Spelled out as an intersection rather than `MobileServerPublicQueryRequest<T>`: the latter is an indexed\n // access on a mapped type, which is not an inference site, so `T` would always widen to the full union.\n protected async publicQuery<T extends MobileServerPublicQueryRequestType>(\n body: { type: T } & MobileServerPublicQueryRequestByType[T],\n ): Promise<MobileServerPublicQuerySuccessResponse<T>> {\n const response = await this.axiosInstance.post<unknown>(\n `${this.opts.url}/mobile/public_query`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n return response.data as MobileServerPublicQuerySuccessResponse<T>;\n }\n\n protected async publicExecute(\n body: MobileServerPublicExecuteRequest,\n ): Promise<MobileServerSuccessResponse> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/mobile/public_execute`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as MobileServerSuccessResponse;\n }\n\n protected async query<T extends MobileServerSignedQueryRequestType>(\n body: MobileSignedRequest,\n ): Promise<MobileServerSignedQuerySuccessResponse<T>> {\n const response = await this.axiosInstance.post<unknown>(\n `${this.opts.url}/mobile/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 MobileServerSignedQuerySuccessResponse<T>;\n }\n\n protected async execute(\n body: MobileSignedRequest,\n ): Promise<MobileServerSuccessResponse> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/mobile/execute`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as MobileServerSuccessResponse;\n }\n\n /**\n * Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns\n * failure envelopes with non-2xx statuses (e.g. 404 for `PROFILE_NOT_FOUND`), so a non-2xx response with a\n * failure envelope still throws the typed error; anything else is a transport-level error.\n */\n private checkResponseStatus(response: AxiosResponse<unknown>) {\n if (response.status >= 200 && response.status < 300) {\n return;\n }\n if (isMobileServerFailureResponse(response.data)) {\n throw new MobileServerFailureError(response.data, response.status);\n }\n throw new Error(\n `Unexpected response from mobile service: ${response.status} ${response.statusText}. Data: ${JSON.stringify(response.data)}`,\n );\n }\n\n private checkServerStatus(response: AxiosResponse<unknown>) {\n const { data } = response;\n\n if (isMobileServerFailureResponse(data)) {\n throw new MobileServerFailureError(data, response.status);\n }\n if (!isMobileServerSuccessResponse(data)) {\n throw new Error(\n `Unexpected response from mobile service: missing success envelope. Data: ${JSON.stringify(data)}`,\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAmFA,IAAa,eAAb,MAA0B;CAIxB,YAAY,MAAwB;EAClC,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAM,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;EACxB,CAAC;CACH;;;;;;CAOA,gBACE,0BACA;EACA,KAAK,KAAK,2BAA2B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AG/B,OAAO,SAAS;CAClB;CAEA,MAAgB,MACd,MACoD;EACpD,MAAM,WAAW,MAAM,KAAK,cAAc,KACxC,GAAG,KAAK,KAAK,IAAI,gBACjB,IACF;EAEA,KAAK,oBAAoB,QAAQ;EACjC,KAAK,kBAAkB,QAAQ;EAG/B,OAAO,SAAS;CAClB;CAEA,MAAgB,QACd,MACsC;EACtC,MAAM,WAAW,MAAM,KAAK,cAAc,KACxC,GAAG,KAAK,KAAK,IAAI,kBACjB,IACF;EAEA,KAAK,oBAAoB,QAAQ;EACjC,KAAK,kBAAkB,QAAQ;EAG/B,OAAO,SAAS;CAClB;;;;;;CAOA,oBAA4B,UAAkC;EAC5D,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS,KAC9C;EAEF,IAAI,8BAA8B,SAAS,IAAI,GAC7C,MAAM,IAAI,yBAAyB,SAAS,MAAM,SAAS,MAAM;EAEnE,MAAM,IAAI,MACR,4CAA4C,SAAS,OAAO,GAAG,SAAS,WAAW,UAAU,KAAK,UAAU,SAAS,IAAI,GAC3H;CACF;CAEA,kBAA0B,UAAkC;EAC1D,MAAM,EAAE,SAAS;EAEjB,IAAI,8BAA8B,IAAI,GACpC,MAAM,IAAI,yBAAyB,MAAM,SAAS,MAAM;EAE1D,IAAI,CAAC,8BAA8B,IAAI,GACrC,MAAM,IAAI,MACR,4EAA4E,KAAK,UAAU,IAAI,GACjG;CAEJ;AACF"}
1
+ {"version":3,"file":"MobileClient.js","names":[],"sources":["../src/MobileClient.ts"],"sourcesContent":["import {\n getNadoClientTypeHeaders,\n subaccountToHex,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n mapMobileFeedPage,\n mapMobileNotificationPreferences,\n mapMobileNotificationPreferencesToServer,\n mapMobilePublicProfile,\n mapMobileRegisteredWallet,\n} from './dataMappers';\nimport {\n buildSignedMobileRequest,\n MobileSignedInner,\n MobileSignedInnerParams,\n MobileSignedRequest,\n} from './signing';\nimport {\n GetMobileFeedParams,\n GetMobileNotificationPreferencesParams,\n GetMobilePublicProfileParams,\n GetMobileRegisteredWalletParams,\n GetMobileUsernameAvailabilityParams,\n MobileFeedPage,\n MobileNotificationPreferences,\n MobilePublicProfile,\n MobileRegisteredWallet,\n MobileRegisterExpoTokenParams,\n MobileSetPrivateModeParams,\n MobileSetUsernameParams,\n MobileSignedRequestParams,\n MobileUnregisterExpoTokenParams,\n MobileUpdateNotificationPreferencesParams,\n MobileUsernameAvailability,\n} from './types/clientTypes';\nimport { MobileServerFailureError } from './types/MobileServerFailureError';\nimport { MobileServerSuccessResponse } from './types/serverBaseTypes';\nimport {\n MobileServerExecuteResult,\n MobileServerPublicExecuteRequest,\n} from './types/serverExecuteTypes';\nimport {\n MobileServerPublicQueryRequest,\n MobileServerPublicQuerySuccessResponse,\n} from './types/serverQueryTypes';\nimport {\n MobileServerPublicQueryRequestByType,\n MobileServerPublicQueryRequestType,\n} from './types/serverRequestTypes';\nimport {\n isMobileServerFailureResponse,\n isMobileServerSuccessResponse,\n} from './utils/serverResponseGuards';\n\n/**\n * Options for constructing a {@link MobileClient}.\n */\nexport interface MobileClientOpts {\n /**\n * Base URL of the mobile service API, e.g. {@link MOBILE_CLIENT_ENDPOINTS}.\n */\n url: string;\n /**\n * Wallet client used to sign requests.\n */\n walletClient?: WalletClientWithAccount;\n /**\n * If provided, this signer is used instead of `walletClient` for all signed requests.\n */\n linkedSignerWalletClient?: WalletClientWithAccount;\n /**\n * If provided, identifies the calling client, sent as a header with every request.\n */\n clientType?: string;\n}\n\n/**\n * Client for the Nado mobile service API: usernames, public profile lookups, the global trade feed, privacy\n * settings, and push notification device/preference management.\n */\nexport class MobileClient {\n readonly opts: MobileClientOpts;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: MobileClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n headers: getNadoClientTypeHeaders(opts.clientType),\n });\n }\n\n /**\n * Sets the linked signer for requests\n *\n * @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer\n */\n public setLinkedSigner(\n linkedSignerWalletClient: WalletClientWithAccount | null,\n ) {\n this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? undefined;\n }\n\n /*\n Public queries\n */\n\n /**\n * Checks whether a username derived from the given display name is available to claim.\n */\n async getUsernameAvailability(\n params: GetMobileUsernameAvailabilityParams,\n ): Promise<MobileUsernameAvailability> {\n const body: MobileServerPublicQueryRequest<'username_availability'> = {\n type: 'username_availability',\n display_name: params.displayName,\n };\n const data = await this.publicQuery(body);\n return { username: data.username, available: data.available };\n }\n\n /**\n * Looks up a subaccount's public profile. Every non-isolated subaccount resolves, with `username` and\n * `displayName` `null` until a username is claimed. Private Mode does not hide the profile itself, only the\n * account's activity.\n *\n * @throws {MobileServerFailureError} With error code `PROFILE_NOT_FOUND` if the subaccount is in the\n * engine-created isolated namespace, which cannot own a profile.\n */\n async getPublicProfile(\n params: GetMobilePublicProfileParams,\n ): Promise<MobilePublicProfile> {\n const body: MobileServerPublicQueryRequest<'profile'> = {\n type: 'profile',\n subaccount: subaccountToHex(params),\n };\n const data = await this.publicQuery(body);\n return mapMobilePublicProfile(data.profile);\n }\n\n /**\n * Fetches a page of the global trade feed: public perpetual trades, newest first, optionally filtered by a\n * whole-dollar minimum notional (omitted means unfiltered). Trades by subaccounts that have not claimed a\n * username are included with `null` name fields; only private accounts are filtered out. The feed is\n * best-effort rather than authoritative history, and pagination is live (not snapshot), so deduplicate pages\n * by {@link MobileFeedTrade.orderDigest}.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_FEED_FILTER` if `minimumNotional` or\n * `limit` is outside its allowed domain (fix the request; do not retry unchanged), or\n * `INVALID_FEED_CURSOR` if the cursor is malformed or was issued for a different `minimumNotional`\n * (discard the cursor and restart from the first page).\n */\n async getFeed(params: GetMobileFeedParams = {}): Promise<MobileFeedPage> {\n const body: MobileServerPublicQueryRequest<'feed'> = {\n type: 'feed',\n minimum_notional: params.minimumNotional,\n limit: params.limit,\n cursor: params.cursor,\n };\n const data = await this.publicQuery(body);\n return mapMobileFeedPage(data);\n }\n\n /**\n * Fetches the push notification preferences of the wallet that owns the given Expo push token. Unsigned —\n * the token identifies the wallet on its own. Falls back to the backend's defaults if the wallet has never\n * updated its preferences.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet.\n */\n async getNotificationPreferences(\n params: GetMobileNotificationPreferencesParams,\n ): Promise<MobileNotificationPreferences> {\n const body: MobileServerPublicQueryRequest<'notification_preferences'> = {\n type: 'notification_preferences',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileNotificationPreferences(data.preferences);\n }\n\n /**\n * Resolves the wallet that an Expo push token is currently registered to, along with the redacted metadata\n * of the device that registered it. Unsigned — the token identifies the wallet on its own. Use it to check\n * whether a locally held token is still active and which wallet currently owns it, since registering the\n * same token under another wallet transfers ownership.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is\n * not currently registered to a wallet — including a token that was unregistered. The backend does not\n * distinguish those cases.\n */\n async getRegisteredWallet(\n params: GetMobileRegisteredWalletParams,\n ): Promise<MobileRegisteredWallet> {\n const body: MobileServerPublicQueryRequest<'registered_wallet'> = {\n type: 'registered_wallet',\n expo_token: params.expoToken,\n };\n const data = await this.publicQuery(body);\n return mapMobileRegisteredWallet(data);\n }\n\n /*\n Public executes\n */\n\n /**\n * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout\n * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown\n * well-formed token succeeds.\n *\n * A registration that commits after this call re-activates the token, so stop or await any in-flight\n * {@link MobileClient.registerExpoToken} before unregistering.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed.\n */\n async unregisterExpoToken(\n params: MobileUnregisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'unregister_expo_token'> = {\n type: 'unregister_expo_token',\n expo_token: params.expoToken,\n };\n return this.publicExecute(body);\n }\n\n /**\n * Replaces the push notification preferences of the wallet that owns the given Expo push token. Possession\n * of an active token is the credential rather than a signature, so anyone holding the token can overwrite\n * that wallet's preferences. The backend requires `schemaVersion` of 1, exactly one entry per known\n * category, and empty `scopes` on every entry.\n *\n * Writes are last-write-wins on commit order rather than ordered by a client nonce, so callers must\n * serialize their own preference writes.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_PREFERENCES` if those rules are violated, or\n * `INVALID_EXPO_TOKEN` if the token is malformed or is not currently registered to a wallet.\n */\n async updateNotificationPreferences(\n params: MobileUpdateNotificationPreferencesParams,\n ): Promise<MobileServerSuccessResponse> {\n const body: MobileServerPublicExecuteRequest<'update_preferences'> = {\n type: 'update_preferences',\n expo_token: params.expoToken,\n preferences: mapMobileNotificationPreferencesToServer(params.preferences),\n };\n return this.publicExecute(body);\n }\n\n /*\n Signed executes\n */\n\n /**\n * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first\n * username and renames an existing one, so callers never need to read the current identity first.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_DISPLAY_NAME` if the display name violates\n * `MOBILE_DISPLAY_NAME_PATTERN`, `USERNAME_UNAVAILABLE` if the derived username is reserved or already\n * taken by another subaccount, `INVALID_IDENTITY_TARGET` if the sender is in the engine-created isolated\n * namespace, or `STALE_IDENTITY_UPDATE` if another identity write for this subaccount committed with a\n * later nonce (re-read the identity before retrying).\n */\n async setUsername(\n params: MobileSetUsernameParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest('set_username', params, {\n display_name: params.displayName,\n });\n return this.execute(signedRequest);\n }\n\n /**\n * Sets whether a subaccount's profile is private.\n */\n async setPrivateMode(\n params: MobileSetPrivateModeParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'set_private_mode',\n params,\n { private_mode: params.privateMode },\n );\n return this.execute(signedRequest);\n }\n\n /**\n * Registers an Expo push token for the wallet, transferring active ownership of the token if another\n * wallet had registered it. Idempotent per `(wallet, token)`.\n *\n * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is not a valid Expo\n * push token, or `INVALID_DEVICE_METADATA` if `locale` (max 35 chars) or `appVersion` (max 64 chars) is\n * too long.\n */\n async registerExpoToken(\n params: MobileRegisterExpoTokenParams,\n ): Promise<MobileServerSuccessResponse> {\n const signedRequest = await this.getSignedRequest(\n 'register_expo_token',\n params,\n {\n expo_token: params.expoToken,\n platform: params.platform,\n locale: params.locale ?? null,\n app_version: params.appVersion ?? null,\n },\n );\n return this.execute(signedRequest);\n }\n\n /*\n Base Fns\n */\n\n protected async getSignedRequest<T extends MobileSignedInner['type']>(\n type: T,\n params: MobileSignedRequestParams,\n innerParams: MobileSignedInnerParams<T>,\n ): Promise<MobileSignedRequest> {\n // Use the linked signer if provided, otherwise use the default signer provided to the client\n const walletClient =\n this.opts.linkedSignerWalletClient ?? this.opts.walletClient;\n\n if (walletClient == null) {\n throw new WalletNotProvidedError();\n }\n\n const inner = { type, ...innerParams } as unknown as MobileSignedInner;\n return buildSignedMobileRequest({ ...params, walletClient, inner });\n }\n\n // Spelled out as an intersection rather than `MobileServerPublicQueryRequest<T>`: the latter is an indexed\n // access on a mapped type, which is not an inference site, so `T` would always widen to the full union.\n protected async publicQuery<T extends MobileServerPublicQueryRequestType>(\n body: { type: T } & MobileServerPublicQueryRequestByType[T],\n ): Promise<MobileServerPublicQuerySuccessResponse<T>> {\n const response = await this.axiosInstance.post<unknown>(\n `${this.opts.url}/mobile/public_query`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus throws on failure responses so the cast to the success response is acceptable here\n return response.data as MobileServerPublicQuerySuccessResponse<T>;\n }\n\n protected async publicExecute(\n body: MobileServerPublicExecuteRequest,\n ): Promise<MobileServerSuccessResponse> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/mobile/public_execute`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as MobileServerSuccessResponse;\n }\n\n protected async execute(\n body: MobileSignedRequest,\n ): Promise<MobileServerSuccessResponse> {\n const response = await this.axiosInstance.post<MobileServerExecuteResult>(\n `${this.opts.url}/mobile/execute`,\n body,\n );\n\n this.checkResponseStatus(response);\n this.checkServerStatus(response);\n\n // checkServerStatus catches the failure result and throws the error, so the cast to the success response is acceptable here\n return response.data as MobileServerSuccessResponse;\n }\n\n /**\n * Validates the HTTP status before interpreting the body. Unlike the engine, the mobile backend returns\n * failure envelopes with non-2xx statuses (e.g. 404 for `PROFILE_NOT_FOUND`), so a non-2xx response with a\n * failure envelope still throws the typed error; anything else is a transport-level error.\n */\n private checkResponseStatus(response: AxiosResponse<unknown>) {\n if (response.status >= 200 && response.status < 300) {\n return;\n }\n if (isMobileServerFailureResponse(response.data)) {\n throw new MobileServerFailureError(response.data, response.status);\n }\n throw new Error(\n `Unexpected response from mobile service: ${response.status} ${response.statusText}. Data: ${JSON.stringify(response.data)}`,\n );\n }\n\n private checkServerStatus(response: AxiosResponse<unknown>) {\n const { data } = response;\n\n if (isMobileServerFailureResponse(data)) {\n throw new MobileServerFailureError(data, response.status);\n }\n if (!isMobileServerSuccessResponse(data)) {\n throw new Error(\n `Unexpected response from mobile service: missing success envelope. Data: ${JSON.stringify(data)}`,\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAmFA,IAAa,eAAb,MAA0B;CAIxB,YAAY,MAAwB;EAClC,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAM,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;GACtB,SAAS,yBAAyB,KAAK,UAAU;EACnD,CAAC;CACH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Q;EACjC,KAAK,kBAAkB,QAAQ;EAG/B,OAAO,SAAS;CAClB;;;;;;CAOA,oBAA4B,UAAkC;EAC5D,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS,KAC9C;EAEF,IAAI,8BAA8B,SAAS,IAAI,GAC7C,MAAM,IAAI,yBAAyB,SAAS,MAAM,SAAS,MAAM;EAEnE,MAAM,IAAI,MACR,4CAA4C,SAAS,OAAO,GAAG,SAAS,WAAW,UAAU,KAAK,UAAU,SAAS,IAAI,GAC3H;CACF;CAEA,kBAA0B,UAAkC;EAC1D,MAAM,EAAE,SAAS;EAEjB,IAAI,8BAA8B,IAAI,GACpC,MAAM,IAAI,yBAAyB,MAAM,SAAS,MAAM;EAE1D,IAAI,CAAC,8BAA8B,IAAI,GACrC,MAAM,IAAI,MACR,4EAA4E,KAAK,UAAU,IAAI,GACjG;CAEJ;AACF"}
@@ -1,5 +1,5 @@
1
- import { o as MobileServerRequestType } from "./serverRequestTypes-Cw661qjM.cjs";
2
- import { t as MobileServerFailureResponse } from "./serverBaseTypes-_a1pE464.cjs";
1
+ import { o as MobileServerRequestType } from "./serverRequestTypes-GAtVYIda.cjs";
2
+ import { t as MobileServerFailureResponse } from "./serverBaseTypes-C8KjE9Fm.cjs";
3
3
  import { BaseServerFailureError } from "@nadohq/shared";
4
4
 
5
5
  //#region src/types/MobileServerFailureError.d.ts
@@ -20,4 +20,4 @@ declare class MobileServerFailureError extends BaseServerFailureError {
20
20
  }
21
21
  //#endregion
22
22
  export { MobileServerFailureError as t };
23
- //# sourceMappingURL=MobileServerFailureError-N3nGgdmg.d.cts.map
23
+ //# sourceMappingURL=MobileServerFailureError-CPFjwUBx.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobileServerFailureError-N3nGgdmg.d.cts","names":[],"sources":["../src/types/src/types/MobileServerFailureError.ts"],"mappings":";;;;;;;AASA;;;cAAa,wBAAA,SAAiC,sBAAA;EAAA,SAC3B,YAAA,EAAc,2BAAA;EAAA,SACd,WAAA,EAAa,uBAAA;EAFc;;;;EAAA,SAQnC,UAAA;cAEG,YAAA,EAAc,2BAAA,EAA6B,UAAA;AAAA"}
1
+ {"version":3,"file":"MobileServerFailureError-CPFjwUBx.d.cts","names":[],"sources":["../src/types/src/types/MobileServerFailureError.ts"],"mappings":";;;;;;;AASA;;;cAAa,wBAAA,SAAiC,sBAAA;EAAA,SAC3B,YAAA,EAAc,2BAAA;EAAA,SACd,WAAA,EAAa,uBAAA;EAFc;;;;EAAA,SAQnC,UAAA;cAEG,YAAA,EAAc,2BAAA,EAA6B,UAAA;AAAA"}
@@ -1,5 +1,5 @@
1
- import { o as MobileServerRequestType } from "./serverRequestTypes-w1r41ff7.js";
2
- import { t as MobileServerFailureResponse } from "./serverBaseTypes-ClQZqTAK.js";
1
+ import { o as MobileServerRequestType } from "./serverRequestTypes-516zXnQ6.js";
2
+ import { t as MobileServerFailureResponse } from "./serverBaseTypes-B_KHFDab.js";
3
3
  import { BaseServerFailureError } from "@nadohq/shared";
4
4
 
5
5
  //#region src/types/MobileServerFailureError.d.ts
@@ -20,4 +20,4 @@ declare class MobileServerFailureError extends BaseServerFailureError {
20
20
  }
21
21
  //#endregion
22
22
  export { MobileServerFailureError as t };
23
- //# sourceMappingURL=MobileServerFailureError-A2EcYe6Y.d.ts.map
23
+ //# sourceMappingURL=MobileServerFailureError-Terv2Wzy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobileServerFailureError-A2EcYe6Y.d.ts","names":[],"sources":["../src/types/src/types/MobileServerFailureError.ts"],"mappings":";;;;;;;AASA;;;cAAa,wBAAA,SAAiC,sBAAA;EAAA,SAC3B,YAAA,EAAc,2BAAA;EAAA,SACd,WAAA,EAAa,uBAAA;EAFc;;;;EAAA,SAQnC,UAAA;cAEG,YAAA,EAAc,2BAAA,EAA6B,UAAA;AAAA"}
1
+ {"version":3,"file":"MobileServerFailureError-Terv2Wzy.d.ts","names":[],"sources":["../src/types/src/types/MobileServerFailureError.ts"],"mappings":";;;;;;;AASA;;;cAAa,wBAAA,SAAiC,sBAAA;EAAA,SAC3B,YAAA,EAAc,2BAAA;EAAA,SACd,WAAA,EAAa,uBAAA;EAFc;;;;EAAA,SAQnC,UAAA;cAEG,YAAA,EAAc,2BAAA,EAA6B,UAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import { i as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-DNd9S0Rz.js";
1
+ import { i as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-D5kFJzEX.js";
2
2
 
3
3
  //#region src/signing/buildSignedMobileRequest.d.ts
4
4
  /**
@@ -11,4 +11,4 @@ declare function buildSignedMobileRequest<T extends MobileSignedInner>(params: B
11
11
  }): Promise<MobileSignedRequest<T>>;
12
12
  //#endregion
13
13
  export { buildSignedMobileRequest as t };
14
- //# sourceMappingURL=buildSignedMobileRequest-B8iVGxQc.d.ts.map
14
+ //# sourceMappingURL=buildSignedMobileRequest-BScnCGPF.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildSignedMobileRequest-B8iVGxQc.d.ts","names":[],"sources":["../src/signing/src/signing/buildSignedMobileRequest.ts"],"mappings":";;;;;AAgBA;;;iBAAsB,wBAAA,WAAmC,iBAAA,CAAA,CACvD,MAAA,EAAQ,8BAAA;EAAmC,KAAA,EAAO,CAAA;AAAA,IACjD,OAAA,CAAQ,mBAAA,CAAoB,CAAA"}
1
+ {"version":3,"file":"buildSignedMobileRequest-BScnCGPF.d.ts","names":[],"sources":["../src/signing/src/signing/buildSignedMobileRequest.ts"],"mappings":";;;;;AAgBA;;;iBAAsB,wBAAA,WAAmC,iBAAA,CAAA,CACvD,MAAA,EAAQ,8BAAA;EAAmC,KAAA,EAAO,CAAA;AAAA,IACjD,OAAA,CAAQ,mBAAA,CAAoB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { i as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-BycRkqAj.cjs";
1
+ import { i as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-47IPsDyA.cjs";
2
2
 
3
3
  //#region src/signing/buildSignedMobileRequest.d.ts
4
4
  /**
@@ -11,4 +11,4 @@ declare function buildSignedMobileRequest<T extends MobileSignedInner>(params: B
11
11
  }): Promise<MobileSignedRequest<T>>;
12
12
  //#endregion
13
13
  export { buildSignedMobileRequest as t };
14
- //# sourceMappingURL=buildSignedMobileRequest-CtRX4zl4.d.cts.map
14
+ //# sourceMappingURL=buildSignedMobileRequest-CXfnhc-4.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildSignedMobileRequest-CtRX4zl4.d.cts","names":[],"sources":["../src/signing/src/signing/buildSignedMobileRequest.ts"],"mappings":";;;;;AAgBA;;;iBAAsB,wBAAA,WAAmC,iBAAA,CAAA,CACvD,MAAA,EAAQ,8BAAA;EAAmC,KAAA,EAAO,CAAA;AAAA,IACjD,OAAA,CAAQ,mBAAA,CAAoB,CAAA"}
1
+ {"version":3,"file":"buildSignedMobileRequest-CXfnhc-4.d.cts","names":[],"sources":["../src/signing/src/signing/buildSignedMobileRequest.ts"],"mappings":";;;;;AAgBA;;;iBAAsB,wBAAA,WAAmC,iBAAA,CAAA,CACvD,MAAA,EAAQ,8BAAA;EAAmC,KAAA,EAAO,CAAA;AAAA,IACjD,OAAA,CAAQ,mBAAA,CAAoB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { n as MobileSignedInner } from "./types-DNd9S0Rz.js";
1
+ import { n as MobileSignedInner } from "./types-D5kFJzEX.js";
2
2
 
3
3
  //#region src/signing/canonicalize.d.ts
4
4
  /**
@@ -11,4 +11,4 @@ import { n as MobileSignedInner } from "./types-DNd9S0Rz.js";
11
11
  declare function canonicalizeMobileInner(inner: MobileSignedInner): MobileSignedInner;
12
12
  //#endregion
13
13
  export { canonicalizeMobileInner as t };
14
- //# sourceMappingURL=canonicalize-Cz1rz_ER.d.ts.map
14
+ //# sourceMappingURL=canonicalize-CQ-pMYIt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize-CQ-pMYIt.d.ts","names":[],"sources":["../src/signing/src/signing/canonicalize.ts"],"mappings":";;;;;AASA;;;;;iBAAgB,uBAAA,CACd,KAAA,EAAO,iBAAA,GACN,iBAAiB"}
@@ -1,4 +1,4 @@
1
- import { n as MobileSignedInner } from "./types-BycRkqAj.cjs";
1
+ import { n as MobileSignedInner } from "./types-47IPsDyA.cjs";
2
2
 
3
3
  //#region src/signing/canonicalize.d.ts
4
4
  /**
@@ -11,4 +11,4 @@ import { n as MobileSignedInner } from "./types-BycRkqAj.cjs";
11
11
  declare function canonicalizeMobileInner(inner: MobileSignedInner): MobileSignedInner;
12
12
  //#endregion
13
13
  export { canonicalizeMobileInner as t };
14
- //# sourceMappingURL=canonicalize-afPLlUjE.d.cts.map
14
+ //# sourceMappingURL=canonicalize-hzhboB-C.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize-hzhboB-C.d.cts","names":[],"sources":["../src/signing/src/signing/canonicalize.ts"],"mappings":";;;;;AASA;;;;;iBAAgB,uBAAA,CACd,KAAA,EAAO,iBAAA,GACN,iBAAiB"}
@@ -1,31 +1,8 @@
1
- import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-BIGPd52y.js";
1
+ import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-CwgibK-l.cjs";
2
2
  import { SignatureParams, Subaccount } from "@nadohq/shared";
3
3
  import { Hex } from "viem";
4
4
 
5
5
  //#region src/types/clientTypes.d.ts
6
- /**
7
- * A subaccount's identity on the mobile service API. Every non-isolated subaccount has one implicitly, so
8
- * both name fields are `null` until a username is claimed — render a local fallback label in that case and
9
- * key lookups, links, and caches off `subaccount`.
10
- *
11
- * `username` and `displayName` are two representations of the same claimed name: `displayName` is what the
12
- * user entered (preserving casing, e.g. `Alice.One`), while `username` is the canonical, lowercased handle
13
- * derived from it (e.g. `alice.one`), unique across identities.
14
- */
15
- interface MobileIdentity {
16
- subaccount: Hex;
17
- /**
18
- * Canonical, lowercased handle derived from {@link MobileIdentity.displayName}, unique across identities,
19
- * or `null` if no username has been claimed.
20
- */
21
- username: string | null;
22
- /**
23
- * User-facing name as claimed, preserving original casing, or `null` if no username has been claimed.
24
- * Validated against `MOBILE_DISPLAY_NAME_PATTERN`.
25
- */
26
- displayName: string | null;
27
- privateMode: boolean;
28
- }
29
6
  /**
30
7
  * A subaccount's public profile, as returned by an unsigned profile lookup. Private Mode hides the account's
31
8
  * activity, not its profile, so `privateMode` is exposed here too.
@@ -185,10 +162,6 @@ interface GetMobileFeedParams {
185
162
  */
186
163
  cursor?: string;
187
164
  }
188
- /**
189
- * Params for {@link MobileClient.getSelfIdentity}.
190
- */
191
- type GetMobileSelfIdentityParams = MobileSignedRequestParams;
192
165
  /**
193
166
  * Params for {@link MobileClient.setUsername}.
194
167
  */
@@ -239,5 +212,5 @@ type GetMobileNotificationPreferencesParams = MobileWithExpoTokenParams;
239
212
  */
240
213
  type GetMobileRegisteredWalletParams = MobileWithExpoTokenParams;
241
214
  //#endregion
242
- export { MobileWithExpoTokenParams as C, MobileUsernameAvailability as S, MobileSetPrivateModeParams as _, GetMobileSelfIdentityParams as a, MobileUnregisterExpoTokenParams as b, MobileFeedPage as c, MobileNotificationCategoryPreference as d, MobileNotificationPreferenceScope as f, MobileRegisteredWallet as g, MobileRegisterExpoTokenParams as h, GetMobileRegisteredWalletParams as i, MobileFeedTrade as l, MobilePublicProfile as m, GetMobileNotificationPreferencesParams as n, GetMobileUsernameAvailabilityParams as o, MobileNotificationPreferences as p, GetMobilePublicProfileParams as r, MobileFeedMargin as s, GetMobileFeedParams as t, MobileIdentity as u, MobileSetUsernameParams as v, MobileUpdateNotificationPreferencesParams as x, MobileSignedRequestParams as y };
243
- //# sourceMappingURL=clientTypes-DqDZEcBu.d.ts.map
215
+ export { MobileSignedRequestParams as _, GetMobileUsernameAvailabilityParams as a, MobileUsernameAvailability as b, MobileFeedTrade as c, MobileNotificationPreferences as d, MobilePublicProfile as f, MobileSetUsernameParams as g, MobileSetPrivateModeParams as h, GetMobileRegisteredWalletParams as i, MobileNotificationCategoryPreference as l, MobileRegisteredWallet as m, GetMobileNotificationPreferencesParams as n, MobileFeedMargin as o, MobileRegisterExpoTokenParams as p, GetMobilePublicProfileParams as r, MobileFeedPage as s, GetMobileFeedParams as t, MobileNotificationPreferenceScope as u, MobileUnregisterExpoTokenParams as v, MobileWithExpoTokenParams as x, MobileUpdateNotificationPreferencesParams as y };
216
+ //# sourceMappingURL=clientTypes-BwakovWk.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientTypes-BwakovWk.d.cts","names":[],"sources":["../src/types/src/types/clientTypes.ts"],"mappings":";;;;;;;AAaA;;UAAiB,mBAAA;EACf,UAAA,EAAY,GAAG;EAAf;EAEA,QAAA;EAAA;EAEA,WAAA;EACA,WAAA;AAAA;AAAW;AAMb;;AANa,UAMI,0BAAA;EACf,QAAA;EACA,SAAS;AAAA;;;;;;UAQM,gBAAA;EACf,IAAA,EAAM,oBAAoB;EAC1B,iBAAA;AAAA;;;;;;UAQe,eAAA;EAmBkB;EAjBjC,WAAA,EAAa,GAAA;EACb,UAAA,EAAY,GAAA;EADC;EAGb,QAAA;EAFY;EAIZ,WAAA;EAAA;EAEA,SAAA;EACA,SAAA;EAEA;EAAA,QAAA;EAIA;EAFA,QAAA;EAGQ;EADR,YAAA;EACA,MAAA,EAAQ,gBAAA;EAIR;EAFA,QAAA,EAAU,uBAAA;EAIF;EAFR,WAAA;EAWe;EATf,QAAA;AAAA;;;;;;AAWU;UAFK,cAAA;EACf,MAAA,EAAQ,eAAe;EACvB,UAAA;AAAA;;;;;KAOU,iCAAA;EACN,IAAA;EAAoB,UAAA,EAAY,GAAG;AAAA;EACnC,IAAA;EAAiB,SA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