@nadohq/mobile-client 0.29.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -8
- package/dist/{MobileClient-9JSAzblH.cjs → MobileClient-_i0ZV6Dq.cjs} +104 -44
- package/dist/MobileClient-_i0ZV6Dq.cjs.map +1 -0
- package/dist/MobileClient.cjs +1 -1
- package/dist/MobileClient.d.cts +77 -36
- package/dist/MobileClient.d.cts.map +1 -1
- package/dist/MobileClient.d.ts +77 -36
- package/dist/MobileClient.d.ts.map +1 -1
- package/dist/MobileClient.js +105 -45
- package/dist/MobileClient.js.map +1 -1
- package/dist/{MobileServerFailureError-ZggEcEda.d.cts → MobileServerFailureError-BoyAfEZA.d.cts} +3 -2
- package/dist/MobileServerFailureError-BoyAfEZA.d.cts.map +1 -0
- package/dist/{MobileServerFailureError-f9KhKnJj.d.ts → MobileServerFailureError-MgYVBh5p.d.ts} +3 -2
- package/dist/MobileServerFailureError-MgYVBh5p.d.ts.map +1 -0
- package/dist/{buildSignedMobileRequest-BsbBkU0K.d.cts → buildSignedMobileRequest-CBMt97aY.d.cts} +2 -2
- package/dist/{buildSignedMobileRequest-BsbBkU0K.d.cts.map → buildSignedMobileRequest-CBMt97aY.d.cts.map} +1 -1
- package/dist/{buildSignedMobileRequest-CDRsRNHm.d.ts → buildSignedMobileRequest-qEC4gWaI.d.ts} +2 -2
- package/dist/{buildSignedMobileRequest-CDRsRNHm.d.ts.map → buildSignedMobileRequest-qEC4gWaI.d.ts.map} +1 -1
- package/dist/{canonicalize-PX6dTIdF.d.ts → canonicalize-QNARV_Xc.d.cts} +4 -4
- package/dist/canonicalize-QNARV_Xc.d.cts.map +1 -0
- package/dist/{canonicalize-Dm7sXwPg.d.cts → canonicalize-wVdGejB1.d.ts} +4 -4
- package/dist/canonicalize-wVdGejB1.d.ts.map +1 -0
- package/dist/clientTypes-6utzUU-b.d.ts +240 -0
- package/dist/clientTypes-6utzUU-b.d.ts.map +1 -0
- package/dist/clientTypes-D9qgtNlE.d.cts +240 -0
- package/dist/clientTypes-D9qgtNlE.d.cts.map +1 -0
- package/dist/dataMappers.cjs +35 -1
- package/dist/dataMappers.cjs.map +1 -1
- package/dist/dataMappers.d.cts +8 -3
- package/dist/dataMappers.d.cts.map +1 -1
- package/dist/dataMappers.d.ts +8 -3
- package/dist/dataMappers.d.ts.map +1 -1
- package/dist/dataMappers.js +35 -2
- package/dist/dataMappers.js.map +1 -1
- package/dist/{eip712MethodByType-DLh9MRsD.d.cts → eip712MethodByType-CroIPqsJ.d.cts} +2 -2
- package/dist/eip712MethodByType-CroIPqsJ.d.cts.map +1 -0
- package/dist/{eip712MethodByType-DJgXal9r.d.ts → eip712MethodByType-DBUy4AdI.d.ts} +2 -2
- package/dist/eip712MethodByType-DBUy4AdI.d.ts.map +1 -0
- package/dist/feed-BF5k6Ryu.d.ts +14 -0
- package/dist/feed-BF5k6Ryu.d.ts.map +1 -0
- package/dist/feed-CBIwOhTO.d.cts +14 -0
- package/dist/feed-CBIwOhTO.d.cts.map +1 -0
- package/dist/index.cjs +8 -1
- package/dist/index.d.cts +17 -15
- package/dist/index.d.ts +17 -15
- package/dist/index.js +3 -1
- package/dist/{mobileErrorCodes-BeyBKmwh.d.cts → mobileErrorCodes-CuQ5lyBV.d.ts} +8 -8
- package/dist/mobileErrorCodes-CuQ5lyBV.d.ts.map +1 -0
- package/dist/{mobileErrorCodes-QG5XbEY6.d.ts → mobileErrorCodes-D_SyBm0k.d.cts} +8 -8
- package/dist/mobileErrorCodes-D_SyBm0k.d.cts.map +1 -0
- package/dist/{patterns-BbxH3_VA.d.ts → patterns-B5gi7OfV.d.ts} +1 -1
- package/dist/patterns-B5gi7OfV.d.ts.map +1 -0
- package/dist/{patterns-B9J2ldpx.d.cts → patterns-Db6fgz8i.d.cts} +1 -1
- package/dist/patterns-Db6fgz8i.d.cts.map +1 -0
- package/dist/{payloadHash-nj8WuLUP.d.cts → payloadHash-B0tlFOK8.d.cts} +2 -2
- package/dist/payloadHash-B0tlFOK8.d.cts.map +1 -0
- package/dist/{payloadHash-Bmhzs78N.d.ts → payloadHash-D1yTQSF4.d.ts} +2 -2
- package/dist/payloadHash-D1yTQSF4.d.ts.map +1 -0
- package/dist/serverBaseTypes-CzRgwUvA.d.ts +25 -0
- package/dist/serverBaseTypes-CzRgwUvA.d.ts.map +1 -0
- package/dist/serverBaseTypes-DSRgU2Fb.d.cts +25 -0
- package/dist/serverBaseTypes-DSRgU2Fb.d.cts.map +1 -0
- package/dist/serverExecuteTypes-BCb6bUMP.d.cts +19 -0
- package/dist/serverExecuteTypes-BCb6bUMP.d.cts.map +1 -0
- package/dist/serverExecuteTypes-CI3NBW2Z.d.ts +19 -0
- package/dist/serverExecuteTypes-CI3NBW2Z.d.ts.map +1 -0
- package/dist/serverModelTypes-BYQcsRrx.d.cts +146 -0
- package/dist/serverModelTypes-BYQcsRrx.d.cts.map +1 -0
- package/dist/serverModelTypes-DvPs5qs3.d.ts +146 -0
- package/dist/serverModelTypes-DvPs5qs3.d.ts.map +1 -0
- package/dist/serverQueryTypes-9H6P1vJ5.d.cts +92 -0
- package/dist/serverQueryTypes-9H6P1vJ5.d.cts.map +1 -0
- package/dist/serverQueryTypes-Cbjx0bIj.d.ts +92 -0
- package/dist/serverQueryTypes-Cbjx0bIj.d.ts.map +1 -0
- package/dist/serverRequestTypes-CHDk6JwE.d.cts +85 -0
- package/dist/serverRequestTypes-CHDk6JwE.d.cts.map +1 -0
- package/dist/serverRequestTypes-DYTLrCpz.d.ts +85 -0
- package/dist/serverRequestTypes-DYTLrCpz.d.ts.map +1 -0
- package/dist/{serverResponseGuards-DjCNL3CR.d.cts → serverResponseGuards-DRMHmfXh.d.cts} +2 -2
- package/dist/{serverResponseGuards-DjCNL3CR.d.cts.map → serverResponseGuards-DRMHmfXh.d.cts.map} +1 -1
- package/dist/{serverResponseGuards-C_vZIgGl.d.ts → serverResponseGuards-DpbZvJfL.d.ts} +2 -2
- package/dist/{serverResponseGuards-C_vZIgGl.d.ts.map → serverResponseGuards-DpbZvJfL.d.ts.map} +1 -1
- package/dist/signing/buildSignedMobileRequest.cjs +1 -1
- package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
- package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
- package/dist/signing/canonicalize.cjs +4 -37
- package/dist/signing/canonicalize.cjs.map +1 -1
- package/dist/signing/canonicalize.d.cts +1 -1
- package/dist/signing/canonicalize.d.ts +1 -1
- package/dist/signing/canonicalize.js +4 -37
- package/dist/signing/canonicalize.js.map +1 -1
- package/dist/signing/eip712MethodByType.cjs +1 -5
- package/dist/signing/eip712MethodByType.cjs.map +1 -1
- package/dist/signing/eip712MethodByType.d.cts +1 -1
- package/dist/signing/eip712MethodByType.d.ts +1 -1
- package/dist/signing/eip712MethodByType.js +1 -5
- package/dist/signing/eip712MethodByType.js.map +1 -1
- package/dist/signing/index.d.cts +5 -5
- package/dist/signing/index.d.ts +5 -5
- package/dist/signing/payloadHash.cjs +1 -1
- package/dist/signing/payloadHash.d.cts +1 -1
- package/dist/signing/payloadHash.d.ts +1 -1
- package/dist/signing/types.d.cts +1 -1
- package/dist/signing/types.d.ts +1 -1
- package/dist/types/MobileServerFailureError.cjs +1 -1
- package/dist/types/MobileServerFailureError.cjs.map +1 -1
- package/dist/types/MobileServerFailureError.d.cts +1 -1
- package/dist/types/MobileServerFailureError.d.ts +1 -1
- package/dist/types/MobileServerFailureError.js.map +1 -1
- package/dist/types/clientTypes.d.cts +2 -2
- package/dist/types/clientTypes.d.ts +2 -2
- package/dist/types/index.cjs +4 -0
- package/dist/types/index.d.cts +9 -8
- package/dist/types/index.d.ts +9 -8
- package/dist/types/index.js +2 -1
- package/dist/types/mobileErrorCodes.cjs +10 -7
- package/dist/types/mobileErrorCodes.cjs.map +1 -1
- package/dist/types/mobileErrorCodes.d.cts +1 -1
- package/dist/types/mobileErrorCodes.d.ts +1 -1
- package/dist/types/mobileErrorCodes.js +9 -6
- package/dist/types/mobileErrorCodes.js.map +1 -1
- package/dist/types/serverBaseTypes.d.cts +2 -2
- package/dist/types/serverBaseTypes.d.ts +2 -2
- package/dist/types/serverExecuteTypes.d.cts +2 -2
- package/dist/types/serverExecuteTypes.d.ts +2 -2
- package/dist/types/serverModelTypes.cjs +29 -0
- package/dist/types/serverModelTypes.cjs.map +1 -0
- package/dist/types/serverModelTypes.d.cts +2 -2
- package/dist/types/serverModelTypes.d.ts +2 -2
- package/dist/types/serverModelTypes.js +26 -1
- package/dist/types/serverModelTypes.js.map +1 -0
- package/dist/types/serverQueryTypes.d.cts +2 -2
- package/dist/types/serverQueryTypes.d.ts +2 -2
- package/dist/types/serverRequestTypes.cjs +0 -0
- package/dist/types/serverRequestTypes.d.cts +2 -0
- package/dist/types/serverRequestTypes.d.ts +2 -0
- package/dist/types/serverRequestTypes.js +1 -0
- package/dist/{types-B76Pn7Sy.d.ts → types-CQE3HD2V.d.ts} +4 -15
- package/dist/types-CQE3HD2V.d.ts.map +1 -0
- package/dist/{types-uCD4BNZR.d.cts → types-bNB98pYk.d.cts} +4 -15
- package/dist/types-bNB98pYk.d.cts.map +1 -0
- package/dist/utils/feed.cjs +17 -0
- package/dist/utils/feed.cjs.map +1 -0
- package/dist/utils/feed.d.cts +2 -0
- package/dist/utils/feed.d.ts +2 -0
- package/dist/utils/feed.js +15 -0
- package/dist/utils/feed.js.map +1 -0
- package/dist/utils/index.cjs +3 -0
- package/dist/utils/index.d.cts +4 -3
- package/dist/utils/index.d.ts +4 -3
- package/dist/utils/index.js +2 -1
- package/dist/utils/patterns.d.cts +1 -1
- package/dist/utils/patterns.d.ts +1 -1
- package/dist/utils/serverResponseGuards.d.cts +1 -1
- package/dist/utils/serverResponseGuards.d.ts +1 -1
- package/package.json +3 -3
- package/src/MobileClient.ts +163 -112
- package/src/dataMappers.ts +41 -0
- package/src/signing/canonicalize.ts +4 -37
- package/src/signing/eip712MethodByType.ts +1 -5
- package/src/signing/signing.test.ts +17 -60
- package/src/signing/types.ts +2 -12
- package/src/types/MobileServerFailureError.ts +2 -4
- package/src/types/clientTypes.ts +105 -27
- package/src/types/index.ts +1 -0
- package/src/types/mobileErrorCodes.ts +8 -5
- package/src/types/serverBaseTypes.ts +7 -28
- package/src/types/serverExecuteTypes.ts +17 -0
- package/src/types/serverModelTypes.ts +104 -8
- package/src/types/serverQueryTypes.ts +84 -39
- package/src/types/serverRequestTypes.ts +91 -0
- package/src/utils/feed.ts +11 -0
- package/src/utils/index.ts +1 -0
- package/dist/MobileClient-9JSAzblH.cjs.map +0 -1
- package/dist/MobileServerFailureError-ZggEcEda.d.cts.map +0 -1
- package/dist/MobileServerFailureError-f9KhKnJj.d.ts.map +0 -1
- package/dist/canonicalize-Dm7sXwPg.d.cts.map +0 -1
- package/dist/canonicalize-PX6dTIdF.d.ts.map +0 -1
- package/dist/clientTypes-DWW2N66c.d.ts +0 -168
- package/dist/clientTypes-DWW2N66c.d.ts.map +0 -1
- package/dist/clientTypes-Et0PUa2d.d.cts +0 -168
- package/dist/clientTypes-Et0PUa2d.d.cts.map +0 -1
- package/dist/eip712MethodByType-DJgXal9r.d.ts.map +0 -1
- package/dist/eip712MethodByType-DLh9MRsD.d.cts.map +0 -1
- package/dist/mobileErrorCodes-BeyBKmwh.d.cts.map +0 -1
- package/dist/mobileErrorCodes-QG5XbEY6.d.ts.map +0 -1
- package/dist/patterns-B9J2ldpx.d.cts.map +0 -1
- package/dist/patterns-BbxH3_VA.d.ts.map +0 -1
- package/dist/payloadHash-Bmhzs78N.d.ts.map +0 -1
- package/dist/payloadHash-nj8WuLUP.d.cts.map +0 -1
- package/dist/serverBaseTypes-BicXMrZV.d.cts +0 -43
- package/dist/serverBaseTypes-BicXMrZV.d.cts.map +0 -1
- package/dist/serverBaseTypes-ewbo8l4R.d.ts +0 -43
- package/dist/serverBaseTypes-ewbo8l4R.d.ts.map +0 -1
- package/dist/serverExecuteTypes-CXnMjKnt.d.ts +0 -11
- package/dist/serverExecuteTypes-CXnMjKnt.d.ts.map +0 -1
- package/dist/serverExecuteTypes-DKYK1V7C.d.cts +0 -11
- package/dist/serverExecuteTypes-DKYK1V7C.d.cts.map +0 -1
- package/dist/serverModelTypes-CQgfqgW3.d.cts +0 -69
- package/dist/serverModelTypes-CQgfqgW3.d.cts.map +0 -1
- package/dist/serverModelTypes-vEPhHIit.d.ts +0 -69
- package/dist/serverModelTypes-vEPhHIit.d.ts.map +0 -1
- package/dist/serverQueryTypes-BI-2TD8F.d.ts +0 -53
- package/dist/serverQueryTypes-BI-2TD8F.d.ts.map +0 -1
- package/dist/serverQueryTypes-D7Yharse.d.cts +0 -53
- package/dist/serverQueryTypes-D7Yharse.d.cts.map +0 -1
- package/dist/types-B76Pn7Sy.d.ts.map +0 -1
- package/dist/types-uCD4BNZR.d.cts.map +0 -1
package/src/signing/types.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { WalletClientWithAccount } from '@nadohq/shared';
|
|
2
2
|
import { Hex } from 'viem';
|
|
3
3
|
import { MobileSignedRequestParams } from '../types/clientTypes';
|
|
4
|
-
import {
|
|
5
|
-
MobileNotificationPlatform,
|
|
6
|
-
MobileServerNotificationPreferences,
|
|
7
|
-
} from '../types/serverModelTypes';
|
|
4
|
+
import { MobileNotificationPlatform } from '../types/serverModelTypes';
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* Unsigned inner payloads that can be authenticated against the mobile service API.
|
|
@@ -16,8 +13,7 @@ import {
|
|
|
16
13
|
* {@link canonicalizeMobileInner}, which is the source of truth. Keep the field order here in sync with it.
|
|
17
14
|
*/
|
|
18
15
|
export type MobileSignedInner =
|
|
19
|
-
| { type: '
|
|
20
|
-
| { type: 'update_username'; display_name: string }
|
|
16
|
+
| { type: 'set_username'; display_name: string }
|
|
21
17
|
| { type: 'set_private_mode'; private_mode: boolean }
|
|
22
18
|
| { type: 'self_identity' }
|
|
23
19
|
| {
|
|
@@ -29,12 +25,6 @@ export type MobileSignedInner =
|
|
|
29
25
|
locale: string | null;
|
|
30
26
|
app_version: string | null;
|
|
31
27
|
}
|
|
32
|
-
| { type: 'unregister_expo_token'; expo_token: string }
|
|
33
|
-
| {
|
|
34
|
-
type: 'update_preferences';
|
|
35
|
-
preferences: MobileServerNotificationPreferences;
|
|
36
|
-
}
|
|
37
|
-
| { type: 'notification_preferences' }
|
|
38
28
|
| { type: 'registered_devices' };
|
|
39
29
|
|
|
40
30
|
/**
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { BaseServerFailureError } from '@nadohq/shared';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
MobileServerRequestType,
|
|
5
|
-
} from './serverBaseTypes';
|
|
2
|
+
import { MobileServerFailureResponse } from './serverBaseTypes';
|
|
3
|
+
import { MobileServerRequestType } from './serverRequestTypes';
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* Error thrown when the mobile service API returns a failure envelope, either as a non-2xx HTTP response
|
package/src/types/clientTypes.ts
CHANGED
|
@@ -1,39 +1,47 @@
|
|
|
1
1
|
import { SignatureParams, Subaccount } from '@nadohq/shared';
|
|
2
2
|
import { Hex } from 'viem';
|
|
3
3
|
import {
|
|
4
|
+
MobileFeedMarginMode,
|
|
5
|
+
MobileFeedTradePosition,
|
|
4
6
|
MobileNotificationCategory,
|
|
5
7
|
MobileNotificationPlatform,
|
|
6
8
|
} from './serverModelTypes';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
|
-
* A subaccount's
|
|
11
|
+
* A subaccount's identity on the mobile service API. Every non-isolated subaccount has one implicitly, so
|
|
12
|
+
* both name fields are `null` until a username is claimed — render a local fallback label in that case and
|
|
13
|
+
* key lookups, links, and caches off `subaccount`.
|
|
10
14
|
*
|
|
11
15
|
* `username` and `displayName` are two representations of the same claimed name: `displayName` is what the
|
|
12
16
|
* user entered (preserving casing, e.g. `Alice.One`), while `username` is the canonical, lowercased handle
|
|
13
|
-
* derived from it (e.g. `alice.one`)
|
|
14
|
-
* ({@link MobilePublicProfile}); `displayName` is only for presentation.
|
|
17
|
+
* derived from it (e.g. `alice.one`), unique across identities.
|
|
15
18
|
*/
|
|
16
19
|
export interface MobileIdentity {
|
|
17
20
|
subaccount: Hex;
|
|
18
21
|
/**
|
|
19
|
-
* Canonical, lowercased handle derived from {@link MobileIdentity.displayName}, unique
|
|
20
|
-
*
|
|
22
|
+
* Canonical, lowercased handle derived from {@link MobileIdentity.displayName}, unique across identities,
|
|
23
|
+
* or `null` if no username has been claimed.
|
|
21
24
|
*/
|
|
22
|
-
username: string;
|
|
25
|
+
username: string | null;
|
|
23
26
|
/**
|
|
24
|
-
* User-facing name as claimed, preserving original casing
|
|
27
|
+
* User-facing name as claimed, preserving original casing, or `null` if no username has been claimed.
|
|
28
|
+
* Validated against `MOBILE_DISPLAY_NAME_PATTERN`.
|
|
25
29
|
*/
|
|
26
|
-
displayName: string;
|
|
30
|
+
displayName: string | null;
|
|
27
31
|
privateMode: boolean;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
/**
|
|
31
|
-
* A subaccount's public profile, as returned by an unsigned profile lookup.
|
|
35
|
+
* A subaccount's public profile, as returned by an unsigned profile lookup. Private Mode hides the account's
|
|
36
|
+
* activity, not its profile, so `privateMode` is exposed here too.
|
|
32
37
|
*/
|
|
33
38
|
export interface MobilePublicProfile {
|
|
34
39
|
subaccount: Hex;
|
|
35
|
-
username
|
|
36
|
-
|
|
40
|
+
/** Canonical, lowercased handle, or `null` if no username has been claimed. */
|
|
41
|
+
username: string | null;
|
|
42
|
+
/** User-facing name as claimed, or `null` if no username has been claimed. */
|
|
43
|
+
displayName: string | null;
|
|
44
|
+
privateMode: boolean;
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
/**
|
|
@@ -44,6 +52,58 @@ export interface MobileUsernameAvailability {
|
|
|
44
52
|
available: boolean;
|
|
45
53
|
}
|
|
46
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Margin of a feed trade. Branch on `mode` — do not infer isolated state from leverage presence:
|
|
57
|
+
* `estimatedLeverage` (a rounded whole-number estimate, not exact submitted leverage) is `undefined` on
|
|
58
|
+
* `cross`, and also `undefined` inside `isolated` when no estimate is available.
|
|
59
|
+
*/
|
|
60
|
+
export interface MobileFeedMargin {
|
|
61
|
+
mode: MobileFeedMarginMode;
|
|
62
|
+
estimatedLeverage?: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A single feed trade: one row per order digest, enriched with the trader's current identity at read time
|
|
67
|
+
* (a rename can change an already-fetched trade on the next read). Amounts are display-oriented human-unit
|
|
68
|
+
* numbers — do not use them for accounting, order construction, or exact threshold decisions.
|
|
69
|
+
*/
|
|
70
|
+
export interface MobileFeedTrade {
|
|
71
|
+
/** Order digest this trade is keyed by; the stable id for reconciling live pagination. */
|
|
72
|
+
orderDigest: Hex;
|
|
73
|
+
subaccount: Hex;
|
|
74
|
+
/** `null` when the trader has not claimed a username; render a local fallback label from `subaccount`. */
|
|
75
|
+
username: string | null;
|
|
76
|
+
/** `null` when the trader has not claimed a username; render a local fallback label from `subaccount`. */
|
|
77
|
+
displayName: string | null;
|
|
78
|
+
/** Reserved for a future avatar source; `null` until one is implemented. */
|
|
79
|
+
avatarUrl: string | null;
|
|
80
|
+
productId: number;
|
|
81
|
+
/** Executed quantity in human units. */
|
|
82
|
+
quantity: number;
|
|
83
|
+
/** Trade notional in whole-dollar human units. */
|
|
84
|
+
notional: number;
|
|
85
|
+
/** Average execution price in human units. */
|
|
86
|
+
averagePrice: number;
|
|
87
|
+
margin: MobileFeedMargin;
|
|
88
|
+
/** Resulting position change. `position.direction` is NOT the execution buy/sell side. */
|
|
89
|
+
position: MobileFeedTradePosition;
|
|
90
|
+
/** Realized PnL of the trade in human units; can be negative. */
|
|
91
|
+
realizedPnl: number;
|
|
92
|
+
/** Fill time as a Unix timestamp (milliseconds). */
|
|
93
|
+
filledAt: number;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A page of feed trades. `nextCursor` is `null` when there was no additional candidate at query time.
|
|
98
|
+
* Pagination is live, not snapshot, so a later fill can move a trade between pages — deduplicate by
|
|
99
|
+
* {@link MobileFeedTrade.orderDigest} and treat the merged list as a short-lived view, not an authoritative
|
|
100
|
+
* cache (removals from Private Mode or blacklists are not signaled).
|
|
101
|
+
*/
|
|
102
|
+
export interface MobileFeedPage {
|
|
103
|
+
trades: MobileFeedTrade[];
|
|
104
|
+
nextCursor: string | null;
|
|
105
|
+
}
|
|
106
|
+
|
|
47
107
|
/**
|
|
48
108
|
* Scope limiting a notification category preference. Scopes are part of the wire format but rejected by the
|
|
49
109
|
* backend for the MVP — `scopes` must be empty.
|
|
@@ -98,6 +158,16 @@ export interface MobileRegisteredDevice {
|
|
|
98
158
|
export interface MobileSignedRequestParams
|
|
99
159
|
extends Subaccount, SignatureParams {}
|
|
100
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Common params for the unsigned notification requests, which name their target with an Expo push token
|
|
163
|
+
* instead of a subaccount and signature — the counterpart to {@link MobileSignedRequestParams}. The backend
|
|
164
|
+
* resolves the token's owning wallet and reads or mutates that wallet's state.
|
|
165
|
+
*/
|
|
166
|
+
export interface MobileWithExpoTokenParams {
|
|
167
|
+
/** Expo push token, e.g. `ExponentPushToken[...]`. */
|
|
168
|
+
expoToken: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
101
171
|
/**
|
|
102
172
|
* Params for {@link MobileClient.getUsernameAvailability}.
|
|
103
173
|
*/
|
|
@@ -108,26 +178,36 @@ export interface GetMobileUsernameAvailabilityParams {
|
|
|
108
178
|
/**
|
|
109
179
|
* Params for {@link MobileClient.getPublicProfile}.
|
|
110
180
|
*/
|
|
111
|
-
export
|
|
112
|
-
username: string;
|
|
113
|
-
}
|
|
181
|
+
export type GetMobilePublicProfileParams = Subaccount;
|
|
114
182
|
|
|
115
183
|
/**
|
|
116
|
-
* Params for {@link MobileClient.
|
|
184
|
+
* Params for {@link MobileClient.getFeed}.
|
|
117
185
|
*/
|
|
118
|
-
export
|
|
186
|
+
export interface GetMobileFeedParams {
|
|
187
|
+
/**
|
|
188
|
+
* Minimum notional filter as a whole-dollar safe integer, at least `MOBILE_FEED_MIN_NOTIONAL_FLOOR`
|
|
189
|
+
* ($1,000). Omit for the unfiltered feed.
|
|
190
|
+
*/
|
|
191
|
+
minimumNotional?: number;
|
|
192
|
+
/** Page size, 1–`MOBILE_FEED_MAX_PAGE_SIZE` (50); the backend defaults to 50 when omitted. */
|
|
193
|
+
limit?: number;
|
|
194
|
+
/**
|
|
195
|
+
* Opaque keyset cursor from a prior page's {@link MobileFeedPage.nextCursor}. Send it back unchanged with
|
|
196
|
+
* the exact same `minimumNotional` it was issued for.
|
|
197
|
+
*/
|
|
198
|
+
cursor?: string;
|
|
199
|
+
}
|
|
119
200
|
|
|
120
201
|
/**
|
|
121
|
-
* Params for {@link MobileClient.
|
|
202
|
+
* Params for {@link MobileClient.getSelfIdentity}.
|
|
122
203
|
*/
|
|
123
|
-
export
|
|
124
|
-
displayName: string;
|
|
125
|
-
}
|
|
204
|
+
export type GetMobileSelfIdentityParams = MobileSignedRequestParams;
|
|
126
205
|
|
|
127
206
|
/**
|
|
128
|
-
* Params for {@link MobileClient.
|
|
207
|
+
* Params for {@link MobileClient.setUsername}.
|
|
129
208
|
*/
|
|
130
|
-
export interface
|
|
209
|
+
export interface MobileSetUsernameParams extends MobileSignedRequestParams {
|
|
210
|
+
/** User-facing name to claim, preserving casing. Must match `MOBILE_DISPLAY_NAME_PATTERN`. */
|
|
131
211
|
displayName: string;
|
|
132
212
|
}
|
|
133
213
|
|
|
@@ -160,21 +240,19 @@ export interface MobileRegisterExpoTokenParams extends MobileSignedRequestParams
|
|
|
160
240
|
/**
|
|
161
241
|
* Params for {@link MobileClient.unregisterExpoToken}.
|
|
162
242
|
*/
|
|
163
|
-
export
|
|
164
|
-
expoToken: string;
|
|
165
|
-
}
|
|
243
|
+
export type MobileUnregisterExpoTokenParams = MobileWithExpoTokenParams;
|
|
166
244
|
|
|
167
245
|
/**
|
|
168
246
|
* Params for {@link MobileClient.updateNotificationPreferences}.
|
|
169
247
|
*/
|
|
170
|
-
export interface MobileUpdateNotificationPreferencesParams extends
|
|
248
|
+
export interface MobileUpdateNotificationPreferencesParams extends MobileWithExpoTokenParams {
|
|
171
249
|
preferences: MobileNotificationPreferences;
|
|
172
250
|
}
|
|
173
251
|
|
|
174
252
|
/**
|
|
175
253
|
* Params for {@link MobileClient.getNotificationPreferences}.
|
|
176
254
|
*/
|
|
177
|
-
export type GetMobileNotificationPreferencesParams =
|
|
255
|
+
export type GetMobileNotificationPreferencesParams = MobileWithExpoTokenParams;
|
|
178
256
|
|
|
179
257
|
/**
|
|
180
258
|
* Params for {@link MobileClient.getRegisteredDevices}.
|
package/src/types/index.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { NADO_ERROR_CODES } from '@nadohq/shared';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Numeric error codes returned by the mobile service API. Identity codes (61xx)
|
|
5
|
-
* (
|
|
6
|
-
* error enum, inlined via spread from {@link NADO_ERROR_CODES}.
|
|
4
|
+
* Numeric error codes returned by the mobile service API. Identity codes (61xx), notification codes (62xx),
|
|
5
|
+
* and feed codes (63xx) are mobile-specific; the remaining codes are shared cross-service codes from the
|
|
6
|
+
* backend's common error enum, inlined via spread from {@link NADO_ERROR_CODES}.
|
|
7
7
|
*/
|
|
8
8
|
export const MOBILE_ERROR_CODES = {
|
|
9
9
|
...NADO_ERROR_CODES,
|
|
10
10
|
INVALID_DISPLAY_NAME: 6100,
|
|
11
11
|
USERNAME_UNAVAILABLE: 6101,
|
|
12
|
-
IDENTITY_ALREADY_CLAIMED: 6102,
|
|
13
|
-
IDENTITY_REQUIRED: 6103,
|
|
14
12
|
INVALID_IDENTITY_TARGET: 6104,
|
|
13
|
+
/** Another identity write for the subaccount committed with a later nonce. Re-read before retrying. */
|
|
15
14
|
STALE_IDENTITY_UPDATE: 6105,
|
|
16
15
|
PROFILE_NOT_FOUND: 6106,
|
|
17
16
|
INVALID_EXPO_TOKEN: 6200,
|
|
18
17
|
INVALID_DEVICE_METADATA: 6201,
|
|
19
18
|
INVALID_PREFERENCES: 6202,
|
|
19
|
+
/** Feed `minimumNotional` or `limit` is outside its allowed domain. Fix the request; do not retry unchanged. */
|
|
20
|
+
INVALID_FEED_FILTER: 6300,
|
|
21
|
+
/** Feed cursor is malformed or bound to a different filter. Discard it and restart from the first page. */
|
|
22
|
+
INVALID_FEED_CURSOR: 6301,
|
|
20
23
|
} as const;
|
|
21
24
|
|
|
22
25
|
/**
|
|
@@ -1,35 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
* Params for each unsigned `public_query`, keyed by request `type`.
|
|
3
|
-
*/
|
|
4
|
-
export interface MobileServerPublicQueryParamsByType {
|
|
5
|
-
username_availability: { display_name: string };
|
|
6
|
-
profile: { username: string };
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Discriminant `type` values for unsigned `public_query` requests.
|
|
11
|
-
*/
|
|
12
|
-
export type MobileServerPublicQueryType =
|
|
13
|
-
keyof MobileServerPublicQueryParamsByType;
|
|
1
|
+
import { MobileServerRequestType } from './serverRequestTypes';
|
|
14
2
|
|
|
15
3
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
4
|
+
* Base success envelope shared by every mobile service API route: just the `status` discriminant. Query
|
|
5
|
+
* routes intersect this with their payload (see {@link MobileServerPublicQuerySuccessResponse}), inlining the
|
|
6
|
+
* payload fields alongside `status` rather than nesting them under a `data` key like the engine does; execute
|
|
7
|
+
* routes return it as-is because they carry no payload.
|
|
20
8
|
*/
|
|
21
|
-
export
|
|
22
|
-
| `public_query_${MobileServerPublicQueryType}`
|
|
23
|
-
| `query_${string}`
|
|
24
|
-
| `execute_${string}`;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Successful mobile service API envelope, discriminated on `status`. Payload fields are inlined alongside
|
|
28
|
-
* `status` rather than nested under a `data` key, matching the mobile backend's wire format.
|
|
29
|
-
*/
|
|
30
|
-
export type MobileServerSuccessResponse<TData extends object = object> = {
|
|
9
|
+
export interface MobileServerSuccessResponse {
|
|
31
10
|
status: 'success';
|
|
32
|
-
}
|
|
11
|
+
}
|
|
33
12
|
|
|
34
13
|
/**
|
|
35
14
|
* Failure envelope returned by any mobile service API route. A response missing this envelope shape
|
|
@@ -2,6 +2,23 @@ import {
|
|
|
2
2
|
MobileServerFailureResponse,
|
|
3
3
|
MobileServerSuccessResponse,
|
|
4
4
|
} from './serverBaseTypes';
|
|
5
|
+
import {
|
|
6
|
+
MobileServerPublicExecuteRequestByType,
|
|
7
|
+
MobileServerPublicExecuteRequestType,
|
|
8
|
+
} from './serverRequestTypes';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Unsigned `public_execute` request body: a `type` discriminant flattened with its params, mirroring
|
|
12
|
+
* {@link MobileServerPublicQueryRequest}.
|
|
13
|
+
*/
|
|
14
|
+
export type MobileServerPublicExecuteRequest<
|
|
15
|
+
T extends MobileServerPublicExecuteRequestType =
|
|
16
|
+
MobileServerPublicExecuteRequestType,
|
|
17
|
+
> = {
|
|
18
|
+
[K in MobileServerPublicExecuteRequestType]: {
|
|
19
|
+
type: K;
|
|
20
|
+
} & MobileServerPublicExecuteRequestByType[K];
|
|
21
|
+
}[T];
|
|
5
22
|
|
|
6
23
|
/**
|
|
7
24
|
* Discriminated `execute` result union. Mobile execute routes return no payload beyond the success
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BalanceSide } from '@nadohq/shared';
|
|
1
2
|
import { Hex } from 'viem';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -17,24 +18,119 @@ export type MobileNotificationCategory =
|
|
|
17
18
|
| 'announcement';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
|
-
* Server-side public profile shape (snake_case).
|
|
21
|
+
* Server-side public profile shape (snake_case). Name fields are `null` until the subaccount claims a
|
|
22
|
+
* username.
|
|
21
23
|
*/
|
|
22
24
|
export interface MobileServerProfile {
|
|
23
25
|
subaccount: Hex;
|
|
24
|
-
username: string;
|
|
25
|
-
display_name: string;
|
|
26
|
+
username: string | null;
|
|
27
|
+
display_name: string | null;
|
|
28
|
+
private_mode: boolean;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
|
-
* Server-side identity shape (snake_case) returned by the signed `self_identity` query.
|
|
32
|
+
* Server-side identity shape (snake_case) returned by the signed `self_identity` query. Name fields are
|
|
33
|
+
* `null` until the subaccount claims a username.
|
|
30
34
|
*/
|
|
31
35
|
export interface MobileServerIdentity {
|
|
32
36
|
subaccount: Hex;
|
|
33
|
-
username: string;
|
|
34
|
-
display_name: string;
|
|
37
|
+
username: string | null;
|
|
38
|
+
display_name: string | null;
|
|
35
39
|
private_mode: boolean;
|
|
36
40
|
}
|
|
37
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Direction of the position a feed trade resulted in — for `closed`, the direction that was closed. This is
|
|
44
|
+
* NOT the execution buy/sell side, which the feed does not expose. Aliases {@link BalanceSide} so the feed's
|
|
45
|
+
* direction values stay in lockstep with the rest of the SDK.
|
|
46
|
+
*/
|
|
47
|
+
export type MobileFeedTradePositionDirection = BalanceSide;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Every {@link MobileFeedTradePositionDirection} the feed can report, for callers that need the values at
|
|
51
|
+
* runtime (validation, filters, UI enumeration).
|
|
52
|
+
*/
|
|
53
|
+
export const MOBILE_FEED_TRADE_POSITION_DIRECTIONS = [
|
|
54
|
+
'long',
|
|
55
|
+
'short',
|
|
56
|
+
] as const satisfies readonly MobileFeedTradePositionDirection[];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Every {@link MobileFeedTradePositionEffect} the feed can report, for callers that need the values at
|
|
60
|
+
* runtime (validation, filters, UI enumeration).
|
|
61
|
+
*/
|
|
62
|
+
export const MOBILE_FEED_TRADE_POSITION_EFFECTS = [
|
|
63
|
+
'opened',
|
|
64
|
+
'increased',
|
|
65
|
+
'reduced',
|
|
66
|
+
'closed',
|
|
67
|
+
'flipped',
|
|
68
|
+
] as const;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* How a feed trade changed the trader's position in the product.
|
|
72
|
+
*/
|
|
73
|
+
export type MobileFeedTradePositionEffect =
|
|
74
|
+
(typeof MOBILE_FEED_TRADE_POSITION_EFFECTS)[number];
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Position change of a feed trade. Both keys are single words, so the wire and client shapes are identical
|
|
78
|
+
* and this type is shared by {@link MobileServerFeedTrade} and the client-side `MobileFeedTrade`.
|
|
79
|
+
*/
|
|
80
|
+
export interface MobileFeedTradePosition {
|
|
81
|
+
direction: MobileFeedTradePositionDirection;
|
|
82
|
+
effect: MobileFeedTradePositionEffect;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Every {@link MobileFeedMarginMode} the feed can report, for callers that need the values at runtime
|
|
87
|
+
* (validation, filters, UI enumeration).
|
|
88
|
+
*/
|
|
89
|
+
export const MOBILE_FEED_MARGIN_MODES = ['cross', 'isolated'] as const;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Margin mode a feed trade was executed under. Shared by the wire and client margin shapes.
|
|
93
|
+
*/
|
|
94
|
+
export type MobileFeedMarginMode = (typeof MOBILE_FEED_MARGIN_MODES)[number];
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Server-side margin of a feed trade. Branch on `mode` — do not infer isolated state from leverage presence:
|
|
98
|
+
* `estimated_leverage` (a rounded whole-number estimate, not exact submitted leverage) is omitted on `cross`,
|
|
99
|
+
* and also omitted inside `isolated` when no estimate is available.
|
|
100
|
+
*/
|
|
101
|
+
export interface MobileServerFeedMargin {
|
|
102
|
+
mode: MobileFeedMarginMode;
|
|
103
|
+
estimated_leverage?: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Server-side feed trade shape (snake_case): one row per order digest, enriched at read time with the
|
|
108
|
+
* trader's current identity. Amounts are display-oriented human-unit JSON numbers — do not use them for
|
|
109
|
+
* accounting, order construction, or exact threshold decisions.
|
|
110
|
+
*/
|
|
111
|
+
export interface MobileServerFeedTrade {
|
|
112
|
+
/** Order digest this row is keyed by; the stable id clients use to reconcile live pagination. */
|
|
113
|
+
order_digest: Hex;
|
|
114
|
+
subaccount: Hex;
|
|
115
|
+
username: string | null;
|
|
116
|
+
display_name: string | null;
|
|
117
|
+
/** Reserved for a future avatar source; `null` until one is implemented. */
|
|
118
|
+
avatar_url: string | null;
|
|
119
|
+
product_id: number;
|
|
120
|
+
/** Executed quantity in human units. */
|
|
121
|
+
quantity: number;
|
|
122
|
+
/** Trade notional in whole-dollar human units. */
|
|
123
|
+
notional: number;
|
|
124
|
+
/** Average execution price in human units. */
|
|
125
|
+
average_price: number;
|
|
126
|
+
margin: MobileServerFeedMargin;
|
|
127
|
+
position: MobileFeedTradePosition;
|
|
128
|
+
/** Realized PnL of the trade in human units; can be negative. */
|
|
129
|
+
realized_pnl: number;
|
|
130
|
+
/** Fill time as JavaScript-safe integer Unix milliseconds. */
|
|
131
|
+
filled_at_ms: number;
|
|
132
|
+
}
|
|
133
|
+
|
|
38
134
|
/**
|
|
39
135
|
* Server-side scope limiting a notification category preference. Scopes are rejected by the backend for the
|
|
40
136
|
* MVP (`scopes` must be empty) but are part of the wire format.
|
|
@@ -53,8 +149,8 @@ export interface MobileServerNotificationCategoryPreference {
|
|
|
53
149
|
}
|
|
54
150
|
|
|
55
151
|
/**
|
|
56
|
-
* Server-side notification preferences shape (snake_case), used in both the `update_preferences`
|
|
57
|
-
* the `notification_preferences` query response.
|
|
152
|
+
* Server-side notification preferences shape (snake_case), used in both the `update_preferences` public
|
|
153
|
+
* execute and the `notification_preferences` public query response.
|
|
58
154
|
*/
|
|
59
155
|
export interface MobileServerNotificationPreferences {
|
|
60
156
|
/** Only `1` is accepted by the backend for the MVP. */
|
|
@@ -1,74 +1,119 @@
|
|
|
1
|
+
import { MobileServerSuccessResponse } from './serverBaseTypes';
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
MobileServerPublicQueryType,
|
|
4
|
-
MobileServerSuccessResponse,
|
|
5
|
-
} from './serverBaseTypes';
|
|
6
|
-
import {
|
|
3
|
+
MobileServerFeedTrade,
|
|
7
4
|
MobileServerIdentity,
|
|
8
5
|
MobileServerNotificationPreferences,
|
|
9
6
|
MobileServerProfile,
|
|
10
7
|
MobileServerRegisteredDevice,
|
|
11
8
|
} from './serverModelTypes';
|
|
9
|
+
import {
|
|
10
|
+
MobileServerPublicQueryRequestByType,
|
|
11
|
+
MobileServerPublicQueryRequestType,
|
|
12
|
+
MobileServerSignedQueryRequestType,
|
|
13
|
+
} from './serverRequestTypes';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Unsigned `public_query` request body: a `type` discriminant flattened with its params.
|
|
15
17
|
*/
|
|
16
18
|
export type MobileServerPublicQueryRequest<
|
|
17
|
-
T extends
|
|
19
|
+
T extends MobileServerPublicQueryRequestType =
|
|
20
|
+
MobileServerPublicQueryRequestType,
|
|
18
21
|
> = {
|
|
19
|
-
[K in
|
|
22
|
+
[K in MobileServerPublicQueryRequestType]: {
|
|
20
23
|
type: K;
|
|
21
|
-
} &
|
|
24
|
+
} & MobileServerPublicQueryRequestByType[K];
|
|
22
25
|
}[T];
|
|
23
26
|
|
|
24
27
|
/**
|
|
25
|
-
*
|
|
28
|
+
* Payload of the `username_availability` public query success response.
|
|
26
29
|
*/
|
|
27
|
-
export
|
|
28
|
-
|
|
30
|
+
export interface MobileServerUsernameAvailabilityResponse {
|
|
31
|
+
username: string;
|
|
32
|
+
available: boolean;
|
|
33
|
+
}
|
|
29
34
|
|
|
30
35
|
/**
|
|
31
|
-
*
|
|
36
|
+
* Payload of the `profile` public query success response.
|
|
32
37
|
*/
|
|
33
|
-
export
|
|
34
|
-
|
|
38
|
+
export interface MobileServerProfileResponse {
|
|
39
|
+
profile: MobileServerProfile;
|
|
40
|
+
}
|
|
35
41
|
|
|
36
42
|
/**
|
|
37
|
-
*
|
|
43
|
+
* Payload of the `feed` public query success response.
|
|
38
44
|
*/
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
export interface MobileServerFeedResponse {
|
|
46
|
+
trades: MobileServerFeedTrade[];
|
|
47
|
+
/**
|
|
48
|
+
* `null` when there was no additional candidate at query time; a page may contain fewer than `limit` trades
|
|
49
|
+
* (or none) with a non-null cursor because invalid enrichment rows are omitted and pagination is live
|
|
50
|
+
* rather than snapshot.
|
|
51
|
+
*/
|
|
52
|
+
next_cursor: string | null;
|
|
53
|
+
}
|
|
44
54
|
|
|
45
55
|
/**
|
|
46
|
-
*
|
|
56
|
+
* Payload of the signed `self_identity` query success response. Every non-isolated subaccount has an implicit
|
|
57
|
+
* identity, so the backend returns one for any valid sender, with `null` name fields when no username has
|
|
58
|
+
* been claimed; `identity` stays nullable to match the backend's `Option`.
|
|
47
59
|
*/
|
|
48
|
-
export
|
|
49
|
-
|
|
50
|
-
}
|
|
60
|
+
export interface MobileServerSelfIdentityResponse {
|
|
61
|
+
identity: MobileServerIdentity | null;
|
|
62
|
+
}
|
|
51
63
|
|
|
52
64
|
/**
|
|
53
|
-
*
|
|
54
|
-
* claimed a username yet — this is normal data, not an error.
|
|
65
|
+
* Payload of the `notification_preferences` public query success response.
|
|
55
66
|
*/
|
|
56
|
-
export
|
|
57
|
-
|
|
58
|
-
}
|
|
67
|
+
export interface MobileServerNotificationPreferencesResponse {
|
|
68
|
+
preferences: MobileServerNotificationPreferences;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Payload of the signed `registered_devices` query success response.
|
|
73
|
+
*/
|
|
74
|
+
export interface MobileServerRegisteredDevicesResponse {
|
|
75
|
+
devices: MobileServerRegisteredDevice[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Success payloads for each unsigned `public_query`, keyed by request `type`. Counterpart to
|
|
80
|
+
* {@link MobileServerPublicQueryRequestByType} so a query's request params and response share one lookup,
|
|
81
|
+
* matching engine's `EngineServerQueryResponseByType`. Holds the unwrapped payload; the envelope is applied
|
|
82
|
+
* by {@link MobileServerPublicQuerySuccessResponse}.
|
|
83
|
+
*/
|
|
84
|
+
export interface MobileServerPublicQueryResponseByType {
|
|
85
|
+
username_availability: MobileServerUsernameAvailabilityResponse;
|
|
86
|
+
profile: MobileServerProfileResponse;
|
|
87
|
+
feed: MobileServerFeedResponse;
|
|
88
|
+
notification_preferences: MobileServerNotificationPreferencesResponse;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Success payloads for each signed `query`, keyed by request `type`. Counterpart to
|
|
93
|
+
* {@link MobileServerSignedQueryRequestByType} so a signed query's request params and response share one
|
|
94
|
+
* lookup, matching the public route. Holds the unwrapped payload; the envelope is applied by
|
|
95
|
+
* {@link MobileServerSignedQuerySuccessResponse}.
|
|
96
|
+
*/
|
|
97
|
+
export interface MobileServerSignedQueryResponseByType {
|
|
98
|
+
self_identity: MobileServerSelfIdentityResponse;
|
|
99
|
+
registered_devices: MobileServerRegisteredDevicesResponse;
|
|
100
|
+
}
|
|
59
101
|
|
|
60
102
|
/**
|
|
61
|
-
*
|
|
103
|
+
* Full success response for an unsigned `public_query`: the {@link MobileServerSuccessResponse} envelope with
|
|
104
|
+
* the query's payload inlined alongside `status`. Derived from {@link MobileServerPublicQueryResponseByType},
|
|
105
|
+
* mirroring engine's `EngineServerQuerySuccessResponse` (inlined here instead of nested under `data`).
|
|
62
106
|
*/
|
|
63
|
-
export type
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
107
|
+
export type MobileServerPublicQuerySuccessResponse<
|
|
108
|
+
T extends MobileServerPublicQueryRequestType =
|
|
109
|
+
MobileServerPublicQueryRequestType,
|
|
110
|
+
> = MobileServerSuccessResponse & MobileServerPublicQueryResponseByType[T];
|
|
67
111
|
|
|
68
112
|
/**
|
|
69
|
-
*
|
|
113
|
+
* Full success response for a signed `query`: the {@link MobileServerSuccessResponse} envelope with the
|
|
114
|
+
* query's payload inlined alongside `status`. Derived from {@link MobileServerSignedQueryResponseByType}.
|
|
70
115
|
*/
|
|
71
|
-
export type
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
116
|
+
export type MobileServerSignedQuerySuccessResponse<
|
|
117
|
+
T extends MobileServerSignedQueryRequestType =
|
|
118
|
+
MobileServerSignedQueryRequestType,
|
|
119
|
+
> = MobileServerSuccessResponse & MobileServerSignedQueryResponseByType[T];
|