@nadohq/mobile-client 0.32.0 → 0.34.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 +2 -2
  2. package/dist/{MobileClient-_i0ZV6Dq.cjs → MobileClient-SQ7byUxo.cjs} +18 -8
  3. package/dist/MobileClient-SQ7byUxo.cjs.map +1 -0
  4. package/dist/MobileClient.cjs +1 -1
  5. package/dist/MobileClient.d.cts +17 -10
  6. package/dist/MobileClient.d.cts.map +1 -1
  7. package/dist/MobileClient.d.ts +17 -10
  8. package/dist/MobileClient.d.ts.map +1 -1
  9. package/dist/MobileClient.js +18 -8
  10. package/dist/MobileClient.js.map +1 -1
  11. package/dist/{MobileServerFailureError-MgYVBh5p.d.ts → MobileServerFailureError-A2EcYe6Y.d.ts} +3 -3
  12. package/dist/{MobileServerFailureError-MgYVBh5p.d.ts.map → MobileServerFailureError-A2EcYe6Y.d.ts.map} +1 -1
  13. package/dist/{MobileServerFailureError-BoyAfEZA.d.cts → MobileServerFailureError-N3nGgdmg.d.cts} +3 -3
  14. package/dist/{MobileServerFailureError-BoyAfEZA.d.cts.map → MobileServerFailureError-N3nGgdmg.d.cts.map} +1 -1
  15. package/dist/{buildSignedMobileRequest-qEC4gWaI.d.ts → buildSignedMobileRequest-B8iVGxQc.d.ts} +2 -2
  16. package/dist/{buildSignedMobileRequest-qEC4gWaI.d.ts.map → buildSignedMobileRequest-B8iVGxQc.d.ts.map} +1 -1
  17. package/dist/{buildSignedMobileRequest-CBMt97aY.d.cts → buildSignedMobileRequest-CtRX4zl4.d.cts} +2 -2
  18. package/dist/{buildSignedMobileRequest-CBMt97aY.d.cts.map → buildSignedMobileRequest-CtRX4zl4.d.cts.map} +1 -1
  19. package/dist/{canonicalize-wVdGejB1.d.ts → canonicalize-Cz1rz_ER.d.ts} +2 -2
  20. package/dist/canonicalize-Cz1rz_ER.d.ts.map +1 -0
  21. package/dist/{canonicalize-QNARV_Xc.d.cts → canonicalize-afPLlUjE.d.cts} +2 -2
  22. package/dist/canonicalize-afPLlUjE.d.cts.map +1 -0
  23. package/dist/{clientTypes-D9qgtNlE.d.cts → clientTypes-DIipTg9D.d.cts} +10 -7
  24. package/dist/clientTypes-DIipTg9D.d.cts.map +1 -0
  25. package/dist/{clientTypes-6utzUU-b.d.ts → clientTypes-DqDZEcBu.d.ts} +10 -7
  26. package/dist/clientTypes-DqDZEcBu.d.ts.map +1 -0
  27. package/dist/dataMappers.cjs +4 -3
  28. package/dist/dataMappers.cjs.map +1 -1
  29. package/dist/dataMappers.d.cts +6 -6
  30. package/dist/dataMappers.d.cts.map +1 -1
  31. package/dist/dataMappers.d.ts +6 -6
  32. package/dist/dataMappers.d.ts.map +1 -1
  33. package/dist/dataMappers.js +4 -3
  34. package/dist/dataMappers.js.map +1 -1
  35. package/dist/{eip712MethodByType-DBUy4AdI.d.ts → eip712MethodByType-BzfeoDTF.d.ts} +2 -2
  36. package/dist/eip712MethodByType-BzfeoDTF.d.ts.map +1 -0
  37. package/dist/{eip712MethodByType-CroIPqsJ.d.cts → eip712MethodByType-CUAcWwX0.d.cts} +2 -2
  38. package/dist/eip712MethodByType-CUAcWwX0.d.cts.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-B0tlFOK8.d.cts → payloadHash-CgKXMvZU.d.cts} +2 -2
  43. package/dist/payloadHash-CgKXMvZU.d.cts.map +1 -0
  44. package/dist/{payloadHash-D1yTQSF4.d.ts → payloadHash-yIWBW4Iq.d.ts} +2 -2
  45. package/dist/payloadHash-yIWBW4Iq.d.ts.map +1 -0
  46. package/dist/{serverBaseTypes-CzRgwUvA.d.ts → serverBaseTypes-ClQZqTAK.d.ts} +2 -2
  47. package/dist/{serverBaseTypes-CzRgwUvA.d.ts.map → serverBaseTypes-ClQZqTAK.d.ts.map} +1 -1
  48. package/dist/{serverBaseTypes-DSRgU2Fb.d.cts → serverBaseTypes-_a1pE464.d.cts} +2 -2
  49. package/dist/{serverBaseTypes-DSRgU2Fb.d.cts.map → serverBaseTypes-_a1pE464.d.cts.map} +1 -1
  50. package/dist/{serverExecuteTypes-CI3NBW2Z.d.ts → serverExecuteTypes-BD8Awy8Q.d.ts} +3 -3
  51. package/dist/{serverExecuteTypes-CI3NBW2Z.d.ts.map → serverExecuteTypes-BD8Awy8Q.d.ts.map} +1 -1
  52. package/dist/{serverExecuteTypes-BCb6bUMP.d.cts → serverExecuteTypes-CUla9jFj.d.cts} +3 -3
  53. package/dist/{serverExecuteTypes-BCb6bUMP.d.cts.map → serverExecuteTypes-CUla9jFj.d.cts.map} +1 -1
  54. package/dist/{serverModelTypes-DvPs5qs3.d.ts → serverModelTypes-BIGPd52y.d.ts} +2 -12
  55. package/dist/{serverModelTypes-DvPs5qs3.d.ts.map → serverModelTypes-BIGPd52y.d.ts.map} +1 -1
  56. package/dist/{serverModelTypes-BYQcsRrx.d.cts → serverModelTypes-DGYc_3XP.d.cts} +2 -12
  57. package/dist/{serverModelTypes-BYQcsRrx.d.cts.map → serverModelTypes-DGYc_3XP.d.cts.map} +1 -1
  58. package/dist/{serverQueryTypes-9H6P1vJ5.d.cts → serverQueryTypes-4J8qNQld.d.ts} +16 -9
  59. package/dist/serverQueryTypes-4J8qNQld.d.ts.map +1 -0
  60. package/dist/{serverQueryTypes-Cbjx0bIj.d.ts → serverQueryTypes-C_rvZnol.d.cts} +16 -9
  61. package/dist/serverQueryTypes-C_rvZnol.d.cts.map +1 -0
  62. package/dist/{serverRequestTypes-DYTLrCpz.d.ts → serverRequestTypes-Cw661qjM.d.cts} +6 -4
  63. package/dist/serverRequestTypes-Cw661qjM.d.cts.map +1 -0
  64. package/dist/{serverRequestTypes-CHDk6JwE.d.cts → serverRequestTypes-w1r41ff7.d.ts} +6 -4
  65. package/dist/serverRequestTypes-w1r41ff7.d.ts.map +1 -0
  66. package/dist/{serverResponseGuards-DRMHmfXh.d.cts → serverResponseGuards-DEyNjgwq.d.cts} +2 -2
  67. package/dist/{serverResponseGuards-DRMHmfXh.d.cts.map → serverResponseGuards-DEyNjgwq.d.cts.map} +1 -1
  68. package/dist/{serverResponseGuards-DpbZvJfL.d.ts → serverResponseGuards-DNJZw8yq.d.ts} +2 -2
  69. package/dist/{serverResponseGuards-DpbZvJfL.d.ts.map → serverResponseGuards-DNJZw8yq.d.ts.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 +1 -2
  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 +1 -2
  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 +1 -1
  111. package/dist/types/serverRequestTypes.d.ts +1 -1
  112. package/dist/{types-CQE3HD2V.d.ts → types-BycRkqAj.d.cts} +3 -5
  113. package/dist/types-BycRkqAj.d.cts.map +1 -0
  114. package/dist/{types-bNB98pYk.d.cts → types-DNd9S0Rz.d.ts} +3 -5
  115. package/dist/types-DNd9S0Rz.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 +24 -18
  122. package/src/dataMappers.ts +10 -7
  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 +1 -2
  127. package/src/types/clientTypes.ts +7 -4
  128. package/src/types/serverModelTypes.ts +0 -11
  129. package/src/types/serverQueryTypes.ts +12 -5
  130. package/src/types/serverRequestTypes.ts +1 -1
  131. package/dist/MobileClient-_i0ZV6Dq.cjs.map +0 -1
  132. package/dist/canonicalize-QNARV_Xc.d.cts.map +0 -1
  133. package/dist/canonicalize-wVdGejB1.d.ts.map +0 -1
  134. package/dist/clientTypes-6utzUU-b.d.ts.map +0 -1
  135. package/dist/clientTypes-D9qgtNlE.d.cts.map +0 -1
  136. package/dist/eip712MethodByType-CroIPqsJ.d.cts.map +0 -1
  137. package/dist/eip712MethodByType-DBUy4AdI.d.ts.map +0 -1
  138. package/dist/payloadHash-B0tlFOK8.d.cts.map +0 -1
  139. package/dist/payloadHash-D1yTQSF4.d.ts.map +0 -1
  140. package/dist/serverQueryTypes-9H6P1vJ5.d.cts.map +0 -1
  141. package/dist/serverQueryTypes-Cbjx0bIj.d.ts.map +0 -1
  142. package/dist/serverRequestTypes-CHDk6JwE.d.cts.map +0 -1
  143. package/dist/serverRequestTypes-DYTLrCpz.d.ts.map +0 -1
  144. package/dist/types-CQE3HD2V.d.ts.map +0 -1
  145. package/dist/types-bNB98pYk.d.cts.map +0 -1
package/README.md CHANGED
@@ -52,7 +52,7 @@ await mobile.setUsername({
52
52
 
53
53
  ### Public Queries
54
54
 
55
- `getUsernameAvailability`, `getPublicProfile`, `getFeed`, `getNotificationPreferences`.
55
+ `getUsernameAvailability`, `getPublicProfile`, `getFeed`, `getNotificationPreferences`, `getRegisteredWallet`.
56
56
 
57
57
  ### Public Executes
58
58
 
@@ -61,7 +61,7 @@ push token rather than a wallet signature, so they still work at logout when a s
61
61
 
62
62
  ### Signed Queries
63
63
 
64
- `getSelfIdentity`, `getRegisteredDevices`.
64
+ `getSelfIdentity`.
65
65
 
66
66
  ### Signed Executes
67
67
 
@@ -114,6 +114,23 @@ var MobileClient = class {
114
114
  return require_dataMappers.mapMobileNotificationPreferences((await this.publicQuery(body)).preferences);
115
115
  }
116
116
  /**
117
+ * Resolves the wallet that an Expo push token is currently registered to, along with the redacted metadata
118
+ * of the device that registered it. Unsigned — the token identifies the wallet on its own. Use it to check
119
+ * whether a locally held token is still active and which wallet currently owns it, since registering the
120
+ * same token under another wallet transfers ownership.
121
+ *
122
+ * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is
123
+ * not currently registered to a wallet — including a token that was unregistered. The backend does not
124
+ * distinguish those cases.
125
+ */
126
+ async getRegisteredWallet(params) {
127
+ const body = {
128
+ type: "registered_wallet",
129
+ expo_token: params.expoToken
130
+ };
131
+ return require_dataMappers.mapMobileRegisteredWallet(await this.publicQuery(body));
132
+ }
133
+ /**
117
134
  * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout
118
135
  * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown
119
136
  * well-formed token succeeds.
@@ -164,13 +181,6 @@ var MobileClient = class {
164
181
  return data.identity ? require_dataMappers.mapMobileIdentity(data.identity) : null;
165
182
  }
166
183
  /**
167
- * Fetches the devices registered for push notifications for a wallet.
168
- */
169
- async getRegisteredDevices(params) {
170
- const signedRequest = await this.getSignedRequest("registered_devices", params, {});
171
- return (await this.query(signedRequest)).devices.map(require_dataMappers.mapMobileRegisteredDevice);
172
- }
173
- /**
174
184
  * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
175
185
  * username and renames an existing one, so callers never need to read the current identity first.
176
186
  *
@@ -275,4 +285,4 @@ Object.defineProperty(exports, "__toESM", {
275
285
  }
276
286
  });
277
287
 
278
- //# sourceMappingURL=MobileClient-_i0ZV6Dq.cjs.map
288
+ //# sourceMappingURL=MobileClient-SQ7byUxo.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobileClient-SQ7byUxo.cjs","names":["mapMobilePublicProfile","mapMobileFeedPage","mapMobileNotificationPreferences","mapMobileRegisteredWallet","mapMobileNotificationPreferencesToServer","mapMobileIdentity","WalletNotProvidedError","buildSignedMobileRequest","isMobileServerFailureResponse","MobileServerFailureError","isMobileServerSuccessResponse"],"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,MAAA,QAAM,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;EACxB,CAAC;CACH;;;;;;CAOA,gBACE,0BACA;EACA,KAAK,KAAK,2BAA2B,4BAA4B,KAAA;CACnE;;;;CASA,MAAM,wBACJ,QACqC;EACrC,MAAM,OAAgE;GACpE,MAAM;GACN,cAAc,OAAO;EACvB;EACA,MAAM,OAAO,MAAM,KAAK,YAAY,IAAI;EACxC,OAAO;GAAE,UAAU,KAAK;GAAU,WAAW,KAAK;EAAU;CAC9D;;;;;;;;;CAUA,MAAM,iBACJ,QAC8B;EAC9B,MAAM,OAAkD;GACtD,MAAM;GACN,aAAA,GAAA,eAAA,iBAA4B,MAAM;EACpC;EAEA,OAAOA,oBAAAA,wBAAuB,MADX,KAAK,YAAY,IAAI,GACL,OAAO;CAC5C;;;;;;;;;;;;;CAcA,MAAM,QAAQ,SAA8B,CAAC,GAA4B;EACvE,MAAM,O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/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-_i0ZV6Dq.cjs");
2
+ const require_MobileClient = require("./MobileClient-SQ7byUxo.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 MobileRegisteredDevice, h as MobileRegisterExpoTokenParams, i as GetMobileRegisteredDevicesParams, 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-D9qgtNlE.cjs";
2
- import { i as MobileSignedRequest, n as MobileSignedInner, r as MobileSignedInnerParams } from "./types-bNB98pYk.cjs";
3
- import { a as MobileServerPublicQueryRequestType, c as MobileServerSignedQueryRequestType, i as MobileServerPublicQueryRequestByType } from "./serverRequestTypes-CHDk6JwE.cjs";
4
- import { n as MobileServerSuccessResponse } from "./serverBaseTypes-DSRgU2Fb.cjs";
5
- import { n as MobileServerPublicExecuteRequest } from "./serverExecuteTypes-BCb6bUMP.cjs";
6
- import { o as MobileServerPublicQuerySuccessResponse, u as MobileServerSignedQuerySuccessResponse } from "./serverQueryTypes-9H6P1vJ5.cjs";
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";
7
7
  import { WalletClientWithAccount } from "@nadohq/shared";
8
8
  import { AxiosInstance } from "axios";
9
9
 
@@ -74,6 +74,17 @@ declare class MobileClient {
74
74
  * not currently registered to a wallet.
75
75
  */
76
76
  getNotificationPreferences(params: GetMobileNotificationPreferencesParams): Promise<MobileNotificationPreferences>;
77
+ /**
78
+ * Resolves the wallet that an Expo push token is currently registered to, along with the redacted metadata
79
+ * of the device that registered it. Unsigned — the token identifies the wallet on its own. Use it to check
80
+ * whether a locally held token is still active and which wallet currently owns it, since registering the
81
+ * same token under another wallet transfers ownership.
82
+ *
83
+ * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is
84
+ * not currently registered to a wallet — including a token that was unregistered. The backend does not
85
+ * distinguish those cases.
86
+ */
87
+ getRegisteredWallet(params: GetMobileRegisteredWalletParams): Promise<MobileRegisteredWallet>;
77
88
  /**
78
89
  * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout
79
90
  * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown
@@ -107,10 +118,6 @@ declare class MobileClient {
107
118
  * engine-created isolated namespace, which cannot own an identity.
108
119
  */
109
120
  getSelfIdentity(params: GetMobileSelfIdentityParams): Promise<MobileIdentity | null>;
110
- /**
111
- * Fetches the devices registered for push notifications for a wallet.
112
- */
113
- getRegisteredDevices(params: GetMobileRegisteredDevicesParams): Promise<MobileRegisteredDevice[]>;
114
121
  /**
115
122
  * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
116
123
  * username and renames an existing one, so callers never need to read the current identity first.
@@ -1 +1 @@
1
- {"version":3,"file":"MobileClient.d.cts","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,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cAAA;EA3FA;;;;;;;;;;EAmHL,WAAA,CACJ,MAAA,EAAQ,uBAAA,GACP,OAAA,CAAQ,2BAAA;EAnDL;;;EA6DA,cAAA,CACJ,MAAA,EAAQ,0BAAA,GACP,OAAA,CAAQ,2BAAA;EA7DA;;;;;;;;EA8EL,iBAAA,CACJ,MAAA,EAAQ,6BAAA,GACP,OAAA,CAAQ,2BAAA;EAAA,UAkBK,gBAAA,WAA2B,iBAAA,SAAA,CACzC,IAAA,EAAM,CAAA,EACN,MAAA,EAAQ,yBAAA,EACR,WAAA,EAAa,uBAAA,CAAwB,CAAA,IACpC,OAAA,CAAQ,mBAAA;EAAA,UAeK,WAAA,WAAsB,kCAAA,CAAA,CACpC,IAAA;IAAQ,IAAA,EAAM,CAAA;EAAA,IAAM,oCAAA,CAAqC,CAAA,IACxD,OAAA,CAAQ,sCAAA,CAAuC,CAAA;EAAA,UAalC,aAAA,CACd,IAAA,EAAM,gCAAA,GACL,OAAA,CAAQ,2BAAA;EAAA,UAaK,KAAA,WAAgB,kCAAA,CAAA,CAC9B,IAAA,EAAM,mBAAA,GACL,OAAA,CAAQ,sCAAA,CAAuC,CAAA;EAAA,UAalC,OAAA,CACd,IAAA,EAAM,mBAAA,GACL,OAAA,CAAQ,2BAAA;EAtFL;;;;;EAAA,QAwGE,mBAAA;EAAA,QAYA,iBAAA;AAAA"}
@@ -1,9 +1,9 @@
1
- import { S as MobileUsernameAvailability, _ as MobileSetPrivateModeParams, a as GetMobileSelfIdentityParams, b as MobileUnregisterExpoTokenParams, c as MobileFeedPage, g as MobileRegisteredDevice, h as MobileRegisterExpoTokenParams, i as GetMobileRegisteredDevicesParams, 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-6utzUU-b.js";
2
- import { i as MobileSignedRequest, n as MobileSignedInner, r as MobileSignedInnerParams } from "./types-CQE3HD2V.js";
3
- import { a as MobileServerPublicQueryRequestType, c as MobileServerSignedQueryRequestType, i as MobileServerPublicQueryRequestByType } from "./serverRequestTypes-DYTLrCpz.js";
4
- import { n as MobileServerSuccessResponse } from "./serverBaseTypes-CzRgwUvA.js";
5
- import { n as MobileServerPublicExecuteRequest } from "./serverExecuteTypes-CI3NBW2Z.js";
6
- import { o as MobileServerPublicQuerySuccessResponse, u as MobileServerSignedQuerySuccessResponse } from "./serverQueryTypes-Cbjx0bIj.js";
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-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";
7
7
  import { WalletClientWithAccount } from "@nadohq/shared";
8
8
  import { AxiosInstance } from "axios";
9
9
 
@@ -74,6 +74,17 @@ declare class MobileClient {
74
74
  * not currently registered to a wallet.
75
75
  */
76
76
  getNotificationPreferences(params: GetMobileNotificationPreferencesParams): Promise<MobileNotificationPreferences>;
77
+ /**
78
+ * Resolves the wallet that an Expo push token is currently registered to, along with the redacted metadata
79
+ * of the device that registered it. Unsigned — the token identifies the wallet on its own. Use it to check
80
+ * whether a locally held token is still active and which wallet currently owns it, since registering the
81
+ * same token under another wallet transfers ownership.
82
+ *
83
+ * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is
84
+ * not currently registered to a wallet — including a token that was unregistered. The backend does not
85
+ * distinguish those cases.
86
+ */
87
+ getRegisteredWallet(params: GetMobileRegisteredWalletParams): Promise<MobileRegisteredWallet>;
77
88
  /**
78
89
  * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout
79
90
  * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown
@@ -107,10 +118,6 @@ declare class MobileClient {
107
118
  * engine-created isolated namespace, which cannot own an identity.
108
119
  */
109
120
  getSelfIdentity(params: GetMobileSelfIdentityParams): Promise<MobileIdentity | null>;
110
- /**
111
- * Fetches the devices registered for push notifications for a wallet.
112
- */
113
- getRegisteredDevices(params: GetMobileRegisteredDevicesParams): Promise<MobileRegisteredDevice[]>;
114
121
  /**
115
122
  * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
116
123
  * username and renames an existing one, so callers never need to read the current identity first.
@@ -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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;;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,CAAQ,2BAAA;EA7DA;;;;;;;;EA8EL,iBAAA,CACJ,MAAA,EAAQ,6BAAA,GACP,OAAA,CAAQ,2BAAA;EAAA,UAkBK,gBAAA,WAA2B,iBAAA,SAAA,CACzC,IAAA,EAAM,CAAA,EACN,MAAA,EAAQ,yBAAA,EACR,WAAA,EAAa,uBAAA,CAAwB,CAAA,IACpC,OAAA,CAAQ,mBAAA;EAAA,UAeK,WAAA,WAAsB,kCAAA,CAAA,CACpC,IAAA;IAAQ,IAAA,EAAM,CAAA;EAAA,IAAM,oCAAA,CAAqC,CAAA,IACxD,OAAA,CAAQ,sCAAA,CAAuC,CAAA;EAAA,UAalC,aAAA,CACd,IAAA,EAAM,gCAAA,GACL,OAAA,CAAQ,2BAAA;EAAA,UAaK,KAAA,WAAgB,kCAAA,CAAA,CAC9B,IAAA,EAAM,mBAAA,GACL,OAAA,CAAQ,sCAAA,CAAuC,CAAA;EAAA,UAalC,OAAA,CACd,IAAA,EAAM,mBAAA,GACL,OAAA,CAAQ,2BAAA;EAtFL;;;;;EAAA,QAwGE,mBAAA;EAAA,QAYA,iBAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import { mapMobileFeedPage, mapMobileIdentity, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobilePublicProfile, mapMobileRegisteredDevice } from "./dataMappers.js";
1
+ import { mapMobileFeedPage, mapMobileIdentity, 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";
@@ -92,6 +92,23 @@ var MobileClient = class {
92
92
  return mapMobileNotificationPreferences((await this.publicQuery(body)).preferences);
93
93
  }
94
94
  /**
95
+ * Resolves the wallet that an Expo push token is currently registered to, along with the redacted metadata
96
+ * of the device that registered it. Unsigned — the token identifies the wallet on its own. Use it to check
97
+ * whether a locally held token is still active and which wallet currently owns it, since registering the
98
+ * same token under another wallet transfers ownership.
99
+ *
100
+ * @throws {MobileServerFailureError} With error code `INVALID_EXPO_TOKEN` if the token is malformed, or is
101
+ * not currently registered to a wallet — including a token that was unregistered. The backend does not
102
+ * distinguish those cases.
103
+ */
104
+ async getRegisteredWallet(params) {
105
+ const body = {
106
+ type: "registered_wallet",
107
+ expo_token: params.expoToken
108
+ };
109
+ return mapMobileRegisteredWallet(await this.publicQuery(body));
110
+ }
111
+ /**
95
112
  * Unregisters an Expo push token, stopping delivery to that device. Unsigned, so it still works at logout
96
113
  * when a wallet signature may no longer be obtainable. Idempotent: unregistering an inactive or unknown
97
114
  * well-formed token succeeds.
@@ -142,13 +159,6 @@ var MobileClient = class {
142
159
  return data.identity ? mapMobileIdentity(data.identity) : null;
143
160
  }
144
161
  /**
145
- * Fetches the devices registered for push notifications for a wallet.
146
- */
147
- async getRegisteredDevices(params) {
148
- const signedRequest = await this.getSignedRequest("registered_devices", params, {});
149
- return (await this.query(signedRequest)).devices.map(mapMobileRegisteredDevice);
150
- }
151
- /**
152
162
  * Sets a subaccount's username, derived from the given display name. Upserts: the same call claims a first
153
163
  * username and renames an existing one, so callers never need to read the current identity first.
154
164
  *
@@ -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 mapMobileRegisteredDevice,\n} from './dataMappers';\nimport {\n buildSignedMobileRequest,\n MobileSignedInner,\n MobileSignedInnerParams,\n MobileSignedRequest,\n} from './signing';\nimport {\n GetMobileFeedParams,\n GetMobileNotificationPreferencesParams,\n GetMobilePublicProfileParams,\n GetMobileRegisteredDevicesParams,\n GetMobileSelfIdentityParams,\n GetMobileUsernameAvailabilityParams,\n MobileFeedPage,\n MobileIdentity,\n MobileNotificationPreferences,\n MobilePublicProfile,\n MobileRegisteredDevice,\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 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 * Fetches the devices registered for push notifications for a wallet.\n */\n async getRegisteredDevices(\n params: GetMobileRegisteredDevicesParams,\n ): Promise<MobileRegisteredDevice[]> {\n const signedRequest = await this.getSignedRequest(\n 'registered_devices',\n params,\n {},\n );\n const data = await this.query<'registered_devices'>(signedRequest);\n return data.devices.map(mapMobileRegisteredDevice);\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,4BAA4B,KAAA;CACnE;;;;CASA,MAAM,wBACJ,QACqC;EACrC,MAAM,OAAgE;GACpE,MAAM;GACN,cAAc,OAAO;EACvB;EACA,MAAM,OAAO,MAAM,KAAK,YAAY,IAAI;EACxC,OAAO;GAAE,UAAU,KAAK;GAAU,WAAW,KAAK;EAAU;CAC9D;;;;;;;;;CAUA,MAAM,iBACJ,QAC8B;EAC9B,MAAM,OAAkD;GACtD,MAAM;GACN,YAAY,gBAAgB,MAAM;EACpC;EAEA,OAAO,wBAAuB,MADX,KAAK,YAAY,IAAI,GACL,OAAO;CAC5C;;;;;;;;;;;;;CAcA,MAAM,QAAQ,SAA8B,CAAC,GAA4B;EACvE,MAAM,OAA+C;GACnD,MAAM;GACN,kBAAkB,OAAO;GACzB,OAAO,OAAO;GACd,QAAQ,OAAO;EACjB;EAEA,OAAO,kBAAkB,MADN,KAAK,YAAY,IAAI,CACX;CAC/B;;;;;;;;;CAUA,MAAM,2BACJ,QACwC;EACxC,MAAM,OAAmE;GACvE,MAAM;GACN,YAAY,OAAO;EACrB;EAEA,OAAO,kCA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AEA,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 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,4BAA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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,5 +1,5 @@
1
- import { o as MobileServerRequestType } from "./serverRequestTypes-DYTLrCpz.js";
2
- import { t as MobileServerFailureResponse } from "./serverBaseTypes-CzRgwUvA.js";
1
+ import { o as MobileServerRequestType } from "./serverRequestTypes-w1r41ff7.js";
2
+ import { t as MobileServerFailureResponse } from "./serverBaseTypes-ClQZqTAK.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-MgYVBh5p.d.ts.map
23
+ //# sourceMappingURL=MobileServerFailureError-A2EcYe6Y.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobileServerFailureError-MgYVBh5p.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-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,5 +1,5 @@
1
- import { o as MobileServerRequestType } from "./serverRequestTypes-CHDk6JwE.cjs";
2
- import { t as MobileServerFailureResponse } from "./serverBaseTypes-DSRgU2Fb.cjs";
1
+ import { o as MobileServerRequestType } from "./serverRequestTypes-Cw661qjM.cjs";
2
+ import { t as MobileServerFailureResponse } from "./serverBaseTypes-_a1pE464.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-BoyAfEZA.d.cts.map
23
+ //# sourceMappingURL=MobileServerFailureError-N3nGgdmg.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobileServerFailureError-BoyAfEZA.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-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,4 +1,4 @@
1
- import { i as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-CQE3HD2V.js";
1
+ import { i as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-DNd9S0Rz.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-qEC4gWaI.d.ts.map
14
+ //# sourceMappingURL=buildSignedMobileRequest-B8iVGxQc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildSignedMobileRequest-qEC4gWaI.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-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,4 +1,4 @@
1
- import { i as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-bNB98pYk.cjs";
1
+ import { i as MobileSignedRequest, n as MobileSignedInner, t as BuildSignedMobileRequestParams } from "./types-BycRkqAj.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-CBMt97aY.d.cts.map
14
+ //# sourceMappingURL=buildSignedMobileRequest-CtRX4zl4.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildSignedMobileRequest-CBMt97aY.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-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,4 +1,4 @@
1
- import { n as MobileSignedInner } from "./types-CQE3HD2V.js";
1
+ import { n as MobileSignedInner } from "./types-DNd9S0Rz.js";
2
2
 
3
3
  //#region src/signing/canonicalize.d.ts
4
4
  /**
@@ -11,4 +11,4 @@ import { n as MobileSignedInner } from "./types-CQE3HD2V.js";
11
11
  declare function canonicalizeMobileInner(inner: MobileSignedInner): MobileSignedInner;
12
12
  //#endregion
13
13
  export { canonicalizeMobileInner as t };
14
- //# sourceMappingURL=canonicalize-wVdGejB1.d.ts.map
14
+ //# sourceMappingURL=canonicalize-Cz1rz_ER.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize-Cz1rz_ER.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-bNB98pYk.cjs";
1
+ import { n as MobileSignedInner } from "./types-BycRkqAj.cjs";
2
2
 
3
3
  //#region src/signing/canonicalize.d.ts
4
4
  /**
@@ -11,4 +11,4 @@ import { n as MobileSignedInner } from "./types-bNB98pYk.cjs";
11
11
  declare function canonicalizeMobileInner(inner: MobileSignedInner): MobileSignedInner;
12
12
  //#endregion
13
13
  export { canonicalizeMobileInner as t };
14
- //# sourceMappingURL=canonicalize-QNARV_Xc.d.cts.map
14
+ //# sourceMappingURL=canonicalize-afPLlUjE.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize-afPLlUjE.d.cts","names":[],"sources":["../src/signing/src/signing/canonicalize.ts"],"mappings":";;;;;AASA;;;;;iBAAgB,uBAAA,CACd,KAAA,EAAO,iBAAA,GACN,iBAAiB"}
@@ -1,4 +1,4 @@
1
- import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-BYQcsRrx.cjs";
1
+ import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-DGYc_3XP.cjs";
2
2
  import { SignatureParams, Subaccount } from "@nadohq/shared";
3
3
  import { Hex } from "viem";
4
4
 
@@ -123,9 +123,12 @@ interface MobileNotificationPreferences {
123
123
  categories: MobileNotificationCategoryPreference[];
124
124
  }
125
125
  /**
126
- * A device registered for push notifications.
126
+ * The wallet an Expo push token is currently registered to, alongside the redacted metadata of the device
127
+ * that registered it.
127
128
  */
128
- interface MobileRegisteredDevice {
129
+ interface MobileRegisteredWallet {
130
+ /** Address of the wallet that owns the token's active registration. */
131
+ wallet: Hex;
129
132
  /** Push platform the device registered under. */
130
133
  platform: MobileNotificationPlatform;
131
134
  /** BCP-47 locale tag reported at registration, or `null` if none was provided. */
@@ -232,9 +235,9 @@ interface MobileUpdateNotificationPreferencesParams extends MobileWithExpoTokenP
232
235
  */
233
236
  type GetMobileNotificationPreferencesParams = MobileWithExpoTokenParams;
234
237
  /**
235
- * Params for {@link MobileClient.getRegisteredDevices}.
238
+ * Params for {@link MobileClient.getRegisteredWallet}.
236
239
  */
237
- type GetMobileRegisteredDevicesParams = MobileSignedRequestParams;
240
+ type GetMobileRegisteredWalletParams = MobileWithExpoTokenParams;
238
241
  //#endregion
239
- export { MobileWithExpoTokenParams as C, MobileUsernameAvailability as S, MobileSetPrivateModeParams as _, GetMobileSelfIdentityParams as a, MobileUnregisterExpoTokenParams as b, MobileFeedPage as c, MobileNotificationCategoryPreference as d, MobileNotificationPreferenceScope as f, MobileRegisteredDevice as g, MobileRegisterExpoTokenParams as h, GetMobileRegisteredDevicesParams 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 };
240
- //# sourceMappingURL=clientTypes-D9qgtNlE.d.cts.map
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-DIipTg9D.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientTypes-DIipTg9D.d.cts","names":[],"sources":["../src/types/src/types/clientTypes.ts"],"mappings":";;;;;;;AAkBA;;;;;;;UAAiB,cAAA;EACf,UAAA,EAAY,GAAG;EAWJ;AAAA;AAOb;;EAbE,QAAA;EAce;;;;EATf,WAAA;EACA,WAAA;AAAA;AAaW;AAMb;;;AANa,UANI,mBAAA;EACf,UAAA,EAAY,GAAG;EAqBA;EAnBf,QAAA;;EAEA,WAAA;EACA,WAAA;AAAA;;;AAkBiB;UAZF,0BAAA;EACf,QAAA;EACA,SAAS;AAAA;;;;;;UAQM,gBAAA;EACf,IAAA,EAAM,oBAAoB;EAC1B,iBAAA;AAAA;;;;;;UAQe,eAAA;EAgBf;EAdA,WAAA,EAAa,GAAA;EACb,UAAA,EAAY,GAAA;EAgBZ;EAdA,QAAA;EAgBA;EAdA,WAAA;EAgBQ;EAdR,SAAA;EACA,SAAA;EAsB6B;EApB7B,QAAA;EAqBuB;EAnBvB,QAAA;EAmBQ;EAjBR,YAAA;EACA,MAAA,EAAQ,gBAAA;EAiBE;EAfV,QAAA,EAAU,uBAAA;EAsB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WAAA,EAAa,6BAAA;AAAA;;;;KAMH,sCAAA,GAAyC,yBAAyB;;;;KAKlE,+BAAA,GAAkC,yBAAyB"}
@@ -1,4 +1,4 @@
1
- import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-DvPs5qs3.js";
1
+ import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-BIGPd52y.js";
2
2
  import { SignatureParams, Subaccount } from "@nadohq/shared";
3
3
  import { Hex } from "viem";
4
4
 
@@ -123,9 +123,12 @@ interface MobileNotificationPreferences {
123
123
  categories: MobileNotificationCategoryPreference[];
124
124
  }
125
125
  /**
126
- * A device registered for push notifications.
126
+ * The wallet an Expo push token is currently registered to, alongside the redacted metadata of the device
127
+ * that registered it.
127
128
  */
128
- interface MobileRegisteredDevice {
129
+ interface MobileRegisteredWallet {
130
+ /** Address of the wallet that owns the token's active registration. */
131
+ wallet: Hex;
129
132
  /** Push platform the device registered under. */
130
133
  platform: MobileNotificationPlatform;
131
134
  /** BCP-47 locale tag reported at registration, or `null` if none was provided. */
@@ -232,9 +235,9 @@ interface MobileUpdateNotificationPreferencesParams extends MobileWithExpoTokenP
232
235
  */
233
236
  type GetMobileNotificationPreferencesParams = MobileWithExpoTokenParams;
234
237
  /**
235
- * Params for {@link MobileClient.getRegisteredDevices}.
238
+ * Params for {@link MobileClient.getRegisteredWallet}.
236
239
  */
237
- type GetMobileRegisteredDevicesParams = MobileSignedRequestParams;
240
+ type GetMobileRegisteredWalletParams = MobileWithExpoTokenParams;
238
241
  //#endregion
239
- export { MobileWithExpoTokenParams as C, MobileUsernameAvailability as S, MobileSetPrivateModeParams as _, GetMobileSelfIdentityParams as a, MobileUnregisterExpoTokenParams as b, MobileFeedPage as c, MobileNotificationCategoryPreference as d, MobileNotificationPreferenceScope as f, MobileRegisteredDevice as g, MobileRegisterExpoTokenParams as h, GetMobileRegisteredDevicesParams 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 };
240
- //# sourceMappingURL=clientTypes-6utzUU-b.d.ts.map
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientTypes-DqDZEcBu.d.ts","names":[],"sources":["../src/types/src/types/clientTypes.ts"],"mappings":";;;;;;;AAkBA;;;;;;;UAAiB,cAAA;EACf,UAAA,EAAY,GAAG;EAWJ;AAAA;AAOb;;EAbE,QAAA;EAce;;;;EATf,WAAA;EACA,WAAA;AAAA;AAaW;AAMb;;;AANa,UANI,mBAAA;EACf,UAAA,EAAY,GAAG;EAqBA;EAnBf,QAAA;;EAEA,WAAA;EACA,WAAA;AAAA;;;AAkBiB;UAZF,0BAAA;EACf,QAAA;EACA,SAAS;AAAA;;;;;;UAQM,gBAAA;EACf,IAAA,EAAM,oBAAoB;EAC1B,iBAAA;AAAA;;;;;;UAQe,eAAA;EAgBf;EAdA,WAA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