@nadohq/mobile-client 0.35.0 → 0.37.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 +19 -6
- package/dist/{MobileClient-D5TNTnLx.cjs → MobileClient-C9S_o_eC.cjs} +82 -12
- package/dist/MobileClient-C9S_o_eC.cjs.map +1 -0
- package/dist/MobileClient.cjs +1 -1
- package/dist/MobileClient.d.cts +64 -16
- package/dist/MobileClient.d.cts.map +1 -1
- package/dist/MobileClient.d.ts +64 -16
- package/dist/MobileClient.d.ts.map +1 -1
- package/dist/MobileClient.js +82 -12
- package/dist/MobileClient.js.map +1 -1
- package/dist/{MobileServerFailureError-CPFjwUBx.d.cts → MobileServerFailureError-CVK3aLOi.d.cts} +3 -3
- package/dist/{MobileServerFailureError-CPFjwUBx.d.cts.map → MobileServerFailureError-CVK3aLOi.d.cts.map} +1 -1
- package/dist/{MobileServerFailureError-Terv2Wzy.d.ts → MobileServerFailureError-D-76n3pS.d.ts} +3 -3
- package/dist/{MobileServerFailureError-Terv2Wzy.d.ts.map → MobileServerFailureError-D-76n3pS.d.ts.map} +1 -1
- package/dist/{buildSignedMobileRequest-BScnCGPF.d.ts → buildSignedMobileRequest-42meR4yV.d.ts} +2 -2
- package/dist/{buildSignedMobileRequest-BScnCGPF.d.ts.map → buildSignedMobileRequest-42meR4yV.d.ts.map} +1 -1
- package/dist/{buildSignedMobileRequest-CXfnhc-4.d.cts → buildSignedMobileRequest-BDxji7Vy.d.cts} +2 -2
- package/dist/{buildSignedMobileRequest-CXfnhc-4.d.cts.map → buildSignedMobileRequest-BDxji7Vy.d.cts.map} +1 -1
- package/dist/{canonicalize-CQ-pMYIt.d.ts → canonicalize-BebHhHcF.d.ts} +2 -2
- package/dist/canonicalize-BebHhHcF.d.ts.map +1 -0
- package/dist/{canonicalize-hzhboB-C.d.cts → canonicalize-CIDJLLgg.d.cts} +2 -2
- package/dist/canonicalize-CIDJLLgg.d.cts.map +1 -0
- package/dist/{clientTypes-BwakovWk.d.cts → clientTypes-2I3x4TTt.d.ts} +142 -14
- package/dist/clientTypes-2I3x4TTt.d.ts.map +1 -0
- package/dist/{clientTypes-D-o1_2Yc.d.ts → clientTypes-tLld8E6J.d.cts} +142 -14
- package/dist/clientTypes-tLld8E6J.d.cts.map +1 -0
- package/dist/dataMappers.cjs +65 -6
- package/dist/dataMappers.cjs.map +1 -1
- package/dist/dataMappers.d.cts +21 -5
- package/dist/dataMappers.d.cts.map +1 -1
- package/dist/dataMappers.d.ts +21 -5
- package/dist/dataMappers.d.ts.map +1 -1
- package/dist/dataMappers.js +62 -7
- package/dist/dataMappers.js.map +1 -1
- package/dist/{eip712MethodByType-3aiJkrHj.d.cts → eip712MethodByType-2-vyN5SU.d.cts} +2 -2
- package/dist/eip712MethodByType-2-vyN5SU.d.cts.map +1 -0
- package/dist/{eip712MethodByType-zNvZukU7.d.ts → eip712MethodByType-CAVpvZoS.d.ts} +2 -2
- package/dist/eip712MethodByType-CAVpvZoS.d.ts.map +1 -0
- package/dist/follow-Bh3UmXMc.d.cts +23 -0
- package/dist/follow-Bh3UmXMc.d.cts.map +1 -0
- package/dist/follow-DjkQm1vR.d.ts +23 -0
- package/dist/follow-DjkQm1vR.d.ts.map +1 -0
- package/dist/index.cjs +6 -1
- package/dist/index.d.cts +17 -16
- package/dist/index.d.ts +17 -16
- package/dist/index.js +2 -1
- package/dist/{mobileErrorCodes-CuQ5lyBV.d.ts → mobileErrorCodes-B3eR6t4b.d.ts} +8 -2
- package/dist/mobileErrorCodes-B3eR6t4b.d.ts.map +1 -0
- package/dist/{mobileErrorCodes-D_SyBm0k.d.cts → mobileErrorCodes-DkzBW4v3.d.cts} +8 -2
- package/dist/mobileErrorCodes-DkzBW4v3.d.cts.map +1 -0
- package/dist/{patterns-B5gi7OfV.d.ts → patterns-C-aUAnKl.d.ts} +1 -1
- package/dist/patterns-C-aUAnKl.d.ts.map +1 -0
- package/dist/{patterns-Db6fgz8i.d.cts → patterns-DS8P5LH0.d.cts} +1 -1
- package/dist/patterns-DS8P5LH0.d.cts.map +1 -0
- package/dist/{payloadHash-DVkEt-Rg.d.cts → payloadHash-BVPYKdk4.d.cts} +2 -2
- package/dist/payloadHash-BVPYKdk4.d.cts.map +1 -0
- package/dist/{payloadHash-BxL26uwq.d.ts → payloadHash-DMqE5aMo.d.ts} +2 -2
- package/dist/payloadHash-DMqE5aMo.d.ts.map +1 -0
- package/dist/{serverBaseTypes-C8KjE9Fm.d.cts → serverBaseTypes-BybrVE6L.d.cts} +2 -2
- package/dist/{serverBaseTypes-C8KjE9Fm.d.cts.map → serverBaseTypes-BybrVE6L.d.cts.map} +1 -1
- package/dist/{serverBaseTypes-B_KHFDab.d.ts → serverBaseTypes-DPB1vEvv.d.ts} +2 -2
- package/dist/{serverBaseTypes-B_KHFDab.d.ts.map → serverBaseTypes-DPB1vEvv.d.ts.map} +1 -1
- package/dist/serverExecuteTypes-DoR0InCd.d.cts +50 -0
- package/dist/serverExecuteTypes-DoR0InCd.d.cts.map +1 -0
- package/dist/serverExecuteTypes-ih4Xbr3J.d.ts +50 -0
- package/dist/serverExecuteTypes-ih4Xbr3J.d.ts.map +1 -0
- package/dist/{serverModelTypes-_cX99seo.d.ts → serverModelTypes-DV-eARP8.d.ts} +54 -10
- package/dist/serverModelTypes-DV-eARP8.d.ts.map +1 -0
- package/dist/{serverModelTypes-CwgibK-l.d.cts → serverModelTypes-KSm0CAcF.d.cts} +54 -10
- package/dist/serverModelTypes-KSm0CAcF.d.cts.map +1 -0
- package/dist/{serverQueryTypes-NIrPm2Sl.d.ts → serverQueryTypes-B9OOpiJB.d.cts} +32 -9
- package/dist/serverQueryTypes-B9OOpiJB.d.cts.map +1 -0
- package/dist/{serverQueryTypes-DwE1iJ9f.d.cts → serverQueryTypes-LygPrZn7.d.ts} +32 -9
- package/dist/serverQueryTypes-LygPrZn7.d.ts.map +1 -0
- package/dist/serverRequestTypes-BDXIPjtw.d.ts +101 -0
- package/dist/serverRequestTypes-BDXIPjtw.d.ts.map +1 -0
- package/dist/serverRequestTypes-q4xTJHk0.d.cts +101 -0
- package/dist/serverRequestTypes-q4xTJHk0.d.cts.map +1 -0
- package/dist/{serverResponseGuards-Cep5s7j5.d.ts → serverResponseGuards-BcdkKV30.d.ts} +2 -2
- package/dist/{serverResponseGuards-Cep5s7j5.d.ts.map → serverResponseGuards-BcdkKV30.d.ts.map} +1 -1
- package/dist/{serverResponseGuards-Dxt9_aGh.d.cts → serverResponseGuards-k6xK1bZ1.d.cts} +2 -2
- package/dist/{serverResponseGuards-Dxt9_aGh.d.cts.map → serverResponseGuards-k6xK1bZ1.d.cts.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 +17 -0
- package/dist/signing/canonicalize.cjs.map +1 -1
- package/dist/signing/canonicalize.d.cts +1 -1
- package/dist/signing/canonicalize.d.ts +1 -1
- package/dist/signing/canonicalize.js +17 -0
- package/dist/signing/canonicalize.js.map +1 -1
- package/dist/signing/eip712MethodByType.cjs +4 -1
- 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 +4 -1
- package/dist/signing/eip712MethodByType.js.map +1 -1
- package/dist/signing/index.d.cts +6 -6
- package/dist/signing/index.d.ts +6 -6
- 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 +2 -2
- package/dist/signing/types.d.ts +2 -2
- package/dist/types/MobileServerFailureError.cjs +1 -1
- package/dist/types/MobileServerFailureError.d.cts +1 -1
- package/dist/types/MobileServerFailureError.d.ts +1 -1
- package/dist/types/clientTypes.d.cts +2 -2
- package/dist/types/clientTypes.d.ts +2 -2
- package/dist/types/index.d.cts +9 -9
- package/dist/types/index.d.ts +9 -9
- package/dist/types/mobileErrorCodes.cjs +13 -1
- package/dist/types/mobileErrorCodes.cjs.map +1 -1
- package/dist/types/mobileErrorCodes.d.cts +1 -1
- package/dist/types/mobileErrorCodes.d.ts +1 -1
- package/dist/types/mobileErrorCodes.js +12 -0
- package/dist/types/mobileErrorCodes.js.map +1 -1
- package/dist/types/serverBaseTypes.d.cts +1 -1
- package/dist/types/serverBaseTypes.d.ts +1 -1
- package/dist/types/serverExecuteTypes.d.cts +2 -2
- package/dist/types/serverExecuteTypes.d.ts +2 -2
- package/dist/types/serverModelTypes.cjs.map +1 -1
- package/dist/types/serverModelTypes.d.cts +2 -2
- package/dist/types/serverModelTypes.d.ts +2 -2
- package/dist/types/serverModelTypes.js.map +1 -1
- package/dist/types/serverQueryTypes.d.cts +2 -2
- package/dist/types/serverQueryTypes.d.ts +2 -2
- package/dist/types/serverRequestTypes.d.cts +2 -2
- package/dist/types/serverRequestTypes.d.ts +2 -2
- package/dist/{types-47IPsDyA.d.cts → types-B8lDIhBP.d.ts} +30 -7
- package/dist/types-B8lDIhBP.d.ts.map +1 -0
- package/dist/{types-D5kFJzEX.d.ts → types-CClB00EN.d.cts} +30 -7
- package/dist/types-CClB00EN.d.cts.map +1 -0
- package/dist/utils/follow.cjs +28 -0
- package/dist/utils/follow.cjs.map +1 -0
- package/dist/utils/follow.d.cts +2 -0
- package/dist/utils/follow.d.ts +2 -0
- package/dist/utils/follow.js +24 -0
- package/dist/utils/follow.js.map +1 -0
- package/dist/utils/index.cjs +5 -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 +138 -21
- package/src/dataMappers.ts +89 -5
- package/src/signing/canonicalize.ts +20 -0
- package/src/signing/eip712MethodByType.ts +3 -0
- package/src/signing/signing.test.ts +58 -4
- package/src/signing/types.ts +34 -1
- package/src/types/clientTypes.ts +148 -11
- package/src/types/mobileErrorCodes.ts +12 -0
- package/src/types/serverExecuteTypes.ts +40 -2
- package/src/types/serverModelTypes.ts +55 -8
- package/src/types/serverQueryTypes.ts +35 -4
- package/src/types/serverRequestTypes.ts +41 -6
- package/src/utils/follow.ts +22 -0
- package/src/utils/index.ts +1 -0
- package/dist/MobileClient-D5TNTnLx.cjs.map +0 -1
- package/dist/canonicalize-CQ-pMYIt.d.ts.map +0 -1
- package/dist/canonicalize-hzhboB-C.d.cts.map +0 -1
- package/dist/clientTypes-BwakovWk.d.cts.map +0 -1
- package/dist/clientTypes-D-o1_2Yc.d.ts.map +0 -1
- package/dist/eip712MethodByType-3aiJkrHj.d.cts.map +0 -1
- package/dist/eip712MethodByType-zNvZukU7.d.ts.map +0 -1
- package/dist/mobileErrorCodes-CuQ5lyBV.d.ts.map +0 -1
- package/dist/mobileErrorCodes-D_SyBm0k.d.cts.map +0 -1
- package/dist/patterns-B5gi7OfV.d.ts.map +0 -1
- package/dist/patterns-Db6fgz8i.d.cts.map +0 -1
- package/dist/payloadHash-BxL26uwq.d.ts.map +0 -1
- package/dist/payloadHash-DVkEt-Rg.d.cts.map +0 -1
- package/dist/serverExecuteTypes-Cb5v7y0A.d.cts +0 -19
- package/dist/serverExecuteTypes-Cb5v7y0A.d.cts.map +0 -1
- package/dist/serverExecuteTypes-GFjZj_DC.d.ts +0 -19
- package/dist/serverExecuteTypes-GFjZj_DC.d.ts.map +0 -1
- package/dist/serverModelTypes-CwgibK-l.d.cts.map +0 -1
- package/dist/serverModelTypes-_cX99seo.d.ts.map +0 -1
- package/dist/serverQueryTypes-DwE1iJ9f.d.cts.map +0 -1
- package/dist/serverQueryTypes-NIrPm2Sl.d.ts.map +0 -1
- package/dist/serverRequestTypes-516zXnQ6.d.ts +0 -72
- package/dist/serverRequestTypes-516zXnQ6.d.ts.map +0 -1
- package/dist/serverRequestTypes-GAtVYIda.d.cts +0 -72
- package/dist/serverRequestTypes-GAtVYIda.d.cts.map +0 -1
- package/dist/types-47IPsDyA.d.cts.map +0 -1
- package/dist/types-D5kFJzEX.d.ts.map +0 -1
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-
|
|
1
|
+
import { a as MobileFeedTradePosition, c as MobileNotificationCategory, i as MobileFeedMarginMode, l as MobileNotificationPlatform } from "./serverModelTypes-KSm0CAcF.cjs";
|
|
2
2
|
import { SignatureParams, Subaccount } from "@nadohq/shared";
|
|
3
3
|
import { Hex } from "viem";
|
|
4
4
|
|
|
5
5
|
//#region src/types/clientTypes.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* A subaccount's public profile, as returned by an unsigned profile lookup. Private Mode hides the account's
|
|
8
|
-
* activity, not its profile, so `privateMode` is exposed here too.
|
|
8
|
+
* activity, not its profile, so `privateMode` is exposed here too. A subaccount with no identity row still
|
|
9
|
+
* yields a profile, with `null` names and `privateMode: false`.
|
|
10
|
+
*
|
|
11
|
+
* The last three fields are `undefined` unless the matching {@link MobileProfilesInclude} asked for them —
|
|
12
|
+
* absent means "not requested" rather than "none".
|
|
9
13
|
*/
|
|
10
14
|
interface MobilePublicProfile {
|
|
11
15
|
subaccount: Hex;
|
|
@@ -14,6 +18,75 @@ interface MobilePublicProfile {
|
|
|
14
18
|
/** User-facing name as claimed, or `null` if no username has been claimed. */
|
|
15
19
|
displayName: string | null;
|
|
16
20
|
privateMode: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Exact count at query time rather than a cached counter, including unnamed and private accounts — Private
|
|
23
|
+
* Mode hides activity, not relationships. Requires the `followCounts` include.
|
|
24
|
+
*/
|
|
25
|
+
followerCount?: number;
|
|
26
|
+
followingCount?: number;
|
|
27
|
+
/** Requires the `followSummary` include, and is relative to that include's `viewAs`. */
|
|
28
|
+
followSummary?: MobileFollowSummary;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The identity fields the backend attaches to a subaccount wherever it surfaces one alongside other data.
|
|
32
|
+
* Resolved at read time, so a rename shows up on the next read without any change to the surrounding record.
|
|
33
|
+
*/
|
|
34
|
+
interface MobileIdentitySummary {
|
|
35
|
+
subaccount: Hex;
|
|
36
|
+
/** `null` when the account has not claimed a username; render a local fallback label from `subaccount`. */
|
|
37
|
+
username: string | null;
|
|
38
|
+
/** `null` when the account has not claimed a username; render a local fallback label from `subaccount`. */
|
|
39
|
+
displayName: string | null;
|
|
40
|
+
/** Reserved for a future avatar source; `null` until one is implemented. */
|
|
41
|
+
avatarUrl: string | null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A viewer's relationship with one Profile, plus the Followed By preview: accounts the viewer follows that
|
|
45
|
+
* also follow that Profile. Every preview entry is therefore already familiar to the viewer, which is why it
|
|
46
|
+
* carries no `isFollowing` of its own.
|
|
47
|
+
*/
|
|
48
|
+
interface MobileFollowSummary {
|
|
49
|
+
/** The direct `viewer -> viewed Profile` relationship. */
|
|
50
|
+
isFollowing: boolean;
|
|
51
|
+
/** Exact size of the two-edge intersection, independent of how many previews came back. */
|
|
52
|
+
followedByCount: number;
|
|
53
|
+
/**
|
|
54
|
+
* Newest `preview -> viewed Profile` relationship first, with a bytes32 tie-break. Capped at
|
|
55
|
+
* `MOBILE_FOLLOWED_BY_PREVIEW_LIMIT` (2) by the backend and not client-configurable.
|
|
56
|
+
*/
|
|
57
|
+
followedBy: MobileIdentitySummary[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* One row of a Followers or Following page.
|
|
61
|
+
*/
|
|
62
|
+
interface MobileFollowListAccount {
|
|
63
|
+
identity: MobileIdentitySummary;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the *Viewer* follows this account — not the listed relationship that put it in the page. The
|
|
66
|
+
* Viewer can appear in another Profile's list, and does not follow themself, so their own row is `false`.
|
|
67
|
+
*/
|
|
68
|
+
isFollowing: boolean;
|
|
69
|
+
/** This account's own follower count. */
|
|
70
|
+
followerCount: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A page of Followers or Following. Pagination is live rather than snapshot: a Follow or Unfollow between
|
|
74
|
+
* pages can move an account, so an account can appear twice or not at all across one session. Deduplicate by
|
|
75
|
+
* {@link MobileIdentitySummary.subaccount} and restart from `cursor: undefined` on refresh.
|
|
76
|
+
*/
|
|
77
|
+
interface MobileFollowListPage {
|
|
78
|
+
accounts: MobileFollowListAccount[];
|
|
79
|
+
/** `null` means the list is complete. */
|
|
80
|
+
nextCursor: string | null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Post-commit state of a follow or unfollow. The mutation and its count share one database transaction, so
|
|
84
|
+
* these values are authoritative — apply them rather than re-reading.
|
|
85
|
+
*/
|
|
86
|
+
interface MobileFollowMutationResult {
|
|
87
|
+
isFollowing: boolean;
|
|
88
|
+
/** The *target's* follower count after the mutation, not the sender's. */
|
|
89
|
+
followerCount: number;
|
|
17
90
|
}
|
|
18
91
|
/**
|
|
19
92
|
* Result of a username availability check.
|
|
@@ -36,16 +109,9 @@ interface MobileFeedMargin {
|
|
|
36
109
|
* (a rename can change an already-fetched trade on the next read). Amounts are display-oriented human-unit
|
|
37
110
|
* numbers — do not use them for accounting, order construction, or exact threshold decisions.
|
|
38
111
|
*/
|
|
39
|
-
interface MobileFeedTrade {
|
|
112
|
+
interface MobileFeedTrade extends MobileIdentitySummary {
|
|
40
113
|
/** Order digest this trade is keyed by; the stable id for reconciling live pagination. */
|
|
41
114
|
orderDigest: Hex;
|
|
42
|
-
subaccount: Hex;
|
|
43
|
-
/** `null` when the trader has not claimed a username; render a local fallback label from `subaccount`. */
|
|
44
|
-
username: string | null;
|
|
45
|
-
/** `null` when the trader has not claimed a username; render a local fallback label from `subaccount`. */
|
|
46
|
-
displayName: string | null;
|
|
47
|
-
/** Reserved for a future avatar source; `null` until one is implemented. */
|
|
48
|
-
avatarUrl: string | null;
|
|
49
115
|
productId: number;
|
|
50
116
|
/** Executed quantity in human units. */
|
|
51
117
|
quantity: number;
|
|
@@ -142,9 +208,32 @@ interface GetMobileUsernameAvailabilityParams {
|
|
|
142
208
|
displayName: string;
|
|
143
209
|
}
|
|
144
210
|
/**
|
|
145
|
-
*
|
|
211
|
+
* Opt-in extras for a profiles lookup. Each one adds fields that are otherwise absent from every returned
|
|
212
|
+
* profile, and costs extra rate-limit weight per profile, so ask only for what the UI shows.
|
|
146
213
|
*/
|
|
147
|
-
|
|
214
|
+
interface MobileProfilesInclude {
|
|
215
|
+
/** Populates `followerCount` and `followingCount`. */
|
|
216
|
+
followCounts?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Populates `followSummary`, relative to `viewAs`. Unlike the signed follow list reads, this viewer
|
|
219
|
+
* identity is an unauthenticated claim — the route takes no signature — so do not treat the result as
|
|
220
|
+
* proof of who is asking.
|
|
221
|
+
*/
|
|
222
|
+
followSummary?: {
|
|
223
|
+
viewAs: Subaccount;
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Params for {@link MobileClient.getProfiles}.
|
|
228
|
+
*/
|
|
229
|
+
interface GetMobileProfilesParams {
|
|
230
|
+
/**
|
|
231
|
+
* 1–`MOBILE_PROFILES_MAX_BATCH_SIZE` (25) distinct subaccounts. Duplicates and an empty list are rejected
|
|
232
|
+
* rather than deduplicated, and results come back in this exact order.
|
|
233
|
+
*/
|
|
234
|
+
subaccounts: Subaccount[];
|
|
235
|
+
include?: MobileProfilesInclude;
|
|
236
|
+
}
|
|
148
237
|
/**
|
|
149
238
|
* Params for {@link MobileClient.getFeed}.
|
|
150
239
|
*/
|
|
@@ -175,6 +264,45 @@ interface MobileSetUsernameParams extends MobileSignedRequestParams {
|
|
|
175
264
|
interface MobileSetPrivateModeParams extends MobileSignedRequestParams {
|
|
176
265
|
privateMode: boolean;
|
|
177
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* Common params for the signed follow requests. The subaccount carried by {@link MobileSignedRequestParams}
|
|
269
|
+
* is the signing Viewer (the Follower, for mutations); `target` is the other party.
|
|
270
|
+
*/
|
|
271
|
+
interface MobileFollowRequestParams extends MobileSignedRequestParams {
|
|
272
|
+
/** The Profile being followed, unfollowed, or read. Must not be the signing subaccount. */
|
|
273
|
+
target: Subaccount;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Params for {@link MobileClient.setFollow}.
|
|
277
|
+
*/
|
|
278
|
+
interface MobileSetFollowParams extends MobileFollowRequestParams {
|
|
279
|
+
/** `true` follows the target, `false` unfollows it. Both directions are idempotent. */
|
|
280
|
+
isFollowing: boolean;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Common params for a Followers or Following page.
|
|
284
|
+
*/
|
|
285
|
+
interface GetMobileFollowListParams extends MobileFollowRequestParams {
|
|
286
|
+
/**
|
|
287
|
+
* Opaque cursor from the previous page's {@link MobileFollowListPage.nextCursor}. Omit for the first page.
|
|
288
|
+
* A cursor is bound to its Viewer, Profile, and list direction — reusing it elsewhere fails with
|
|
289
|
+
* `INVALID_FOLLOW_CURSOR`.
|
|
290
|
+
*/
|
|
291
|
+
cursor?: string;
|
|
292
|
+
/**
|
|
293
|
+
* Page size, 1–`MOBILE_FOLLOW_LIST_MAX_PAGE_SIZE` (50); the backend defaults to
|
|
294
|
+
* `MOBILE_FOLLOW_LIST_DEFAULT_PAGE_SIZE` (25) when omitted.
|
|
295
|
+
*/
|
|
296
|
+
limit?: number;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Params for {@link MobileClient.getFollowers}.
|
|
300
|
+
*/
|
|
301
|
+
type GetMobileFollowersParams = GetMobileFollowListParams;
|
|
302
|
+
/**
|
|
303
|
+
* Params for {@link MobileClient.getFollowing}.
|
|
304
|
+
*/
|
|
305
|
+
type GetMobileFollowingParams = GetMobileFollowListParams;
|
|
178
306
|
/**
|
|
179
307
|
* Params for {@link MobileClient.registerExpoToken}.
|
|
180
308
|
*/
|
|
@@ -212,5 +340,5 @@ type GetMobileNotificationPreferencesParams = MobileWithExpoTokenParams;
|
|
|
212
340
|
*/
|
|
213
341
|
type GetMobileRegisteredWalletParams = MobileWithExpoTokenParams;
|
|
214
342
|
//#endregion
|
|
215
|
-
export { MobileSignedRequestParams as _,
|
|
216
|
-
//# sourceMappingURL=clientTypes-
|
|
343
|
+
export { MobileUpdateNotificationPreferencesParams as A, MobileRegisterExpoTokenParams as C, MobileSetUsernameParams as D, MobileSetPrivateModeParams as E, MobileWithExpoTokenParams as M, MobileSignedRequestParams as O, MobilePublicProfile as S, MobileSetFollowParams as T, MobileIdentitySummary as _, GetMobileNotificationPreferencesParams as a, MobileNotificationPreferences as b, GetMobileUsernameAvailabilityParams as c, MobileFeedTrade as d, MobileFollowListAccount as f, MobileFollowSummary as g, MobileFollowRequestParams as h, GetMobileFollowingParams as i, MobileUsernameAvailability as j, MobileUnregisterExpoTokenParams as k, MobileFeedMargin as l, MobileFollowMutationResult as m, GetMobileFollowListParams as n, GetMobileProfilesParams as o, MobileFollowListPage as p, GetMobileFollowersParams as r, GetMobileRegisteredWalletParams as s, GetMobileFeedParams as t, MobileFeedPage as u, MobileNotificationCategoryPreference as v, MobileRegisteredWallet as w, MobileProfilesInclude as x, MobileNotificationPreferenceScope as y };
|
|
344
|
+
//# sourceMappingURL=clientTypes-tLld8E6J.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientTypes-tLld8E6J.d.cts","names":[],"sources":["../src/types/src/types/clientTypes.ts"],"mappings":";;;;;;;AAiBA;;;;;;UAAiB,mBAAA;EACf,UAAA,EAAY,GAAA;EAKZ;EAHA,QAAA;EASA;EAPA,WAAA;EACA,WAAA;EAQmC;AAAA;AAOrC;;EAVE,aAAA;EACA,cAAA;EAUA;EARA,aAAA,GAAgB,mBAAmB;AAAA;;;;AAc1B;UAPM,qBAAA;EACf,UAAA,EAAY,GAAG;;EAEf,QAAA;EAcA;EAZA,WAAA;EAmBA;EAjBA,SAAA;AAAA;AAiBiC;AAMnC;;;;AANmC,UATlB,mBAAA;EAgBL;EAdV,WAAA;EAqBA;EAnBA,eAAA;EAmBa;AAQf;;;EAtBE,UAAA,EAAY,qBAAqB;AAAA;;;;UAMlB,uBAAA;EACf,QAAA,EAAU,qBAAqB;EAyBU;;;AAG5B;EAvBb,WAAA;EA6ByC;EA3BzC,aAAA;AAAA;AA6BS;AAQX;;;;AARW,UArBM,oBAAA;EACf,QAAA,EAAU,uBAAuB;EA8BjC;EA5BA,UAAA;AAAA;AAoCF;;;;AAAA,UA7BiB,0BAAA;EACf,WAAA;EA4BuC;EA1BvC,aAAa;AAAA;;;;UAME,0BAAA;EACf,QAAA;EACA,SAAS;AAAA;;;;;;UAQM,gBAAA;EACf,IAAA,EAAM,oBAAoB;EAC1B,iBAAA;AAAA;;;;;;UAQe,eAAA,SAAwB,qBAAA;EA2B7B;EAzBV,WAAA,EAAa,GAAA;EACb,SAAA;EA+B2C;EA7B3C,QAAA;EA8BuC;EA5BvC,QAAA;EA4BwB;EA1BxB,YAAA;EACA,MAAA,EAAQ,gBAAA;EA0Ba;EAxBrB,QAAA,EAAU,uBAAA;EAwBoB;EAtB9B,WAAA;EA2BmD;EAzBnD,QAAA;AAAA;;;;;;;UASe,cAAA;EACf,MAAA,EAAQ,eAAe;EACvB,UAAA;AAAA;;;;;KAOU,iCAAA;EACN,IAAA;EAAoB,UAAA,EAAY,GAAG;AAAA;EACnC,IAAA;EAAiB,SAAA;AAAA;;;;UAKN,oCAAA;EACf,QAAA,EAAU,0BAAA;EACV,OAAA;EACA,MAAA,EAAQ,iCAAiC;AAAA;AAkC/B;AAMZ;;;AANY,UA3BK,6BAAA;EAkCoB;EAhCnC,aAAA;EACA,UAAA,EAAY,oCAAoC;AAAA;;AAwCvC;AAMX;;UAvCiB,sBAAA;EAwCJ;EAtCX,MAAA,EAAQ,GAAA;EA6CO;EA3Cf,QAAA,EAAU,0BAA0B;;EAEpC,MAAA;EA2CA;EAzCA,UAAA;EA+CkB;;;AAAkB;EA1CpC,sBAAA;EAgDsC;;;EA5CtC,UAAA;AAAA;;;;UAMe,yBAAA,SACP,UAAA,EAAY,eAAe;;;;;;UAOpB,yBAAA;EAsDT;EApDN,SAAS;AAAA;;;;UAMM,mCAAA;EACf,WAAW;AAAA;;;AA4DA;AAOb;UA5DiB,qBAAA;;EAEf,YAAA;EA0DiD;;;;AAE/B;EAtDlB,aAAA;IAAkB,MAAA,EAAQ,UAAU;EAAA;AAAA;AA8DzB;AAMb;;AANa,UAxDI,uBAAA;EA8D2D;;;;EAzD1E,WAAA,EAAa,UAAA;EACb,OAAA,GAAU,qBAAqB;AAAA;;;;UAMhB,mBAAA;EAwEL;;;;EAnEV,eAAA;EAwEe;EAtEf,KAAA;;;;;EAKA,MAAA;AAAA;;;;UAMe,uBAAA,SAAgC,yBAAyB;EA8E9D;EA5EV,WAAW;AAAA;;AA4E0D;AAKvE;UA3EiB,0BAAA,SAAmC,yBAAyB;EAC3E,WAAW;AAAA;;;;;UAOI,yBAAA,SAAkC,yBAAyB;EA0EhE;EAxEV,MAAA,EAAQ,UAAA;AAAA;;AAwEoE;AAK9E;UAvEiB,qBAAA,SAA8B,yBAAyB;;EAEtE,WAAW;AAAA;;;;UAMI,yBAAA,SAAkC,yBAAyB;;;;;;EAM1E,MAAA;;;;;EAKA,KAAA;AAAA;;;;KAMU,wBAAA,GAA2B,yBAAyB;;;;KAKpD,wBAAA,GAA2B,yBAAyB;;;;UAK/C,6BAAA,SAAsC,yBAAyB;;;;EAI9E,SAAA;EACA,QAAA,EAAU,0BAAA;;;;EAIV,MAAA;;;;EAIA,UAAA;AAAA;;;;KAMU,+BAAA,GAAkC,yBAAyB;;;;UAKtD,yCAAA,SAAkD,yBAAyB;EAC1F,WAAA,EAAa,6BAAA;AAAA;;;;KAMH,sCAAA,GAAyC,yBAAyB;;;;KAKlE,+BAAA,GAAkC,yBAAyB"}
|
package/dist/dataMappers.cjs
CHANGED
|
@@ -1,14 +1,64 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./MobileClient-C9S_o_eC.cjs");
|
|
3
|
+
let _nadohq_shared = require("@nadohq/shared");
|
|
2
4
|
//#region src/dataMappers.ts
|
|
3
5
|
/**
|
|
4
|
-
* Maps a server-side public profile (snake_case) to its client-side (camelCase) representation.
|
|
6
|
+
* Maps a server-side public profile (snake_case) to its client-side (camelCase) representation. The three
|
|
7
|
+
* include-gated fields stay `undefined` when the backend omitted them, rather than being coerced to `null`
|
|
8
|
+
* or zero, so callers can tell "not requested" from a real value.
|
|
5
9
|
*/
|
|
6
10
|
function mapMobilePublicProfile(server) {
|
|
7
11
|
return {
|
|
8
12
|
subaccount: server.subaccount,
|
|
9
13
|
username: server.username,
|
|
10
14
|
displayName: server.display_name,
|
|
11
|
-
privateMode: server.private_mode
|
|
15
|
+
privateMode: server.private_mode,
|
|
16
|
+
followerCount: server.follower_count,
|
|
17
|
+
followingCount: server.following_count,
|
|
18
|
+
followSummary: server.follow_summary ? mapMobileFollowSummary(server.follow_summary) : void 0
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Maps a server-side identity summary (snake_case) to its client-side (camelCase) representation.
|
|
23
|
+
*/
|
|
24
|
+
function mapMobileIdentitySummary(server) {
|
|
25
|
+
return {
|
|
26
|
+
subaccount: server.subaccount,
|
|
27
|
+
username: server.username,
|
|
28
|
+
displayName: server.display_name,
|
|
29
|
+
avatarUrl: server.avatar_url
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Maps a server-side follow summary to its client-side representation.
|
|
34
|
+
*/
|
|
35
|
+
function mapMobileFollowSummary(server) {
|
|
36
|
+
return {
|
|
37
|
+
isFollowing: server.is_following,
|
|
38
|
+
followedByCount: server.followed_by_count,
|
|
39
|
+
followedBy: server.followed_by.map(mapMobileIdentitySummary)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Maps a server-side Followers or Following response to a client-side {@link MobileFollowListPage}.
|
|
44
|
+
*/
|
|
45
|
+
function mapMobileFollowListPage(server) {
|
|
46
|
+
return {
|
|
47
|
+
accounts: server.accounts.map((account) => ({
|
|
48
|
+
identity: mapMobileIdentitySummary(account.identity),
|
|
49
|
+
isFollowing: account.is_following,
|
|
50
|
+
followerCount: account.follower_count
|
|
51
|
+
})),
|
|
52
|
+
nextCursor: server.next_cursor
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Maps a server-side follow or unfollow response to its client-side representation.
|
|
57
|
+
*/
|
|
58
|
+
function mapMobileFollowMutationResult(server) {
|
|
59
|
+
return {
|
|
60
|
+
isFollowing: server.is_following,
|
|
61
|
+
followerCount: server.follower_count
|
|
12
62
|
};
|
|
13
63
|
}
|
|
14
64
|
/**
|
|
@@ -35,6 +85,15 @@ function mapMobileNotificationPreferenceScope(server) {
|
|
|
35
85
|
};
|
|
36
86
|
}
|
|
37
87
|
/**
|
|
88
|
+
* Maps client-side profiles includes (camelCase) to the server-side (snake_case) wire shape.
|
|
89
|
+
*/
|
|
90
|
+
function mapMobileProfilesIncludeToServer(include) {
|
|
91
|
+
return {
|
|
92
|
+
follow_counts: include.followCounts,
|
|
93
|
+
follow_summary: include.followSummary ? { view_as: (0, _nadohq_shared.subaccountToHex)(include.followSummary.viewAs) } : void 0
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
38
97
|
* Maps client-side notification preferences (camelCase) to the server-side (snake_case) wire shape.
|
|
39
98
|
*/
|
|
40
99
|
function mapMobileNotificationPreferencesToServer(preferences) {
|
|
@@ -62,11 +121,8 @@ function mapMobileNotificationPreferenceScopeToServer(scope) {
|
|
|
62
121
|
*/
|
|
63
122
|
function mapMobileFeedTrade(server) {
|
|
64
123
|
return {
|
|
124
|
+
...mapMobileIdentitySummary(server),
|
|
65
125
|
orderDigest: server.order_digest,
|
|
66
|
-
subaccount: server.subaccount,
|
|
67
|
-
username: server.username,
|
|
68
|
-
displayName: server.display_name,
|
|
69
|
-
avatarUrl: server.avatar_url,
|
|
70
126
|
productId: server.product_id,
|
|
71
127
|
quantity: server.quantity,
|
|
72
128
|
notional: server.notional,
|
|
@@ -104,8 +160,11 @@ function mapMobileRegisteredWallet(server) {
|
|
|
104
160
|
}
|
|
105
161
|
//#endregion
|
|
106
162
|
exports.mapMobileFeedPage = mapMobileFeedPage;
|
|
163
|
+
exports.mapMobileFollowListPage = mapMobileFollowListPage;
|
|
164
|
+
exports.mapMobileFollowMutationResult = mapMobileFollowMutationResult;
|
|
107
165
|
exports.mapMobileNotificationPreferences = mapMobileNotificationPreferences;
|
|
108
166
|
exports.mapMobileNotificationPreferencesToServer = mapMobileNotificationPreferencesToServer;
|
|
167
|
+
exports.mapMobileProfilesIncludeToServer = mapMobileProfilesIncludeToServer;
|
|
109
168
|
exports.mapMobilePublicProfile = mapMobilePublicProfile;
|
|
110
169
|
exports.mapMobileRegisteredWallet = mapMobileRegisteredWallet;
|
|
111
170
|
|
package/dist/dataMappers.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataMappers.cjs","names":[],"sources":["../src/dataMappers.ts"],"sourcesContent":["import {\n MobileFeedPage,\n MobileFeedTrade,\n MobileNotificationPreferenceScope,\n MobileNotificationPreferences,\n MobilePublicProfile,\n MobileRegisteredWallet,\n} from './types/clientTypes';\nimport {\n MobileServerFeedTrade,\n MobileServerNotificationPreferenceScope,\n MobileServerNotificationPreferences,\n MobileServerProfile,\n} from './types/serverModelTypes';\nimport {\n MobileServerFeedResponse,\n MobileServerRegisteredWalletResponse,\n} from './types/serverQueryTypes';\n\n/**\n * Maps a server-side public profile (snake_case) to its client-side (camelCase) representation.\n */\nexport function mapMobilePublicProfile(\n server: MobileServerProfile,\n): MobilePublicProfile {\n return {\n subaccount: server.subaccount,\n username: server.username,\n displayName: server.display_name,\n privateMode: server.private_mode,\n };\n}\n\n/**\n * Maps server-side notification preferences (snake_case) to their client-side (camelCase) representation.\n */\nexport function mapMobileNotificationPreferences(\n server: MobileServerNotificationPreferences,\n): MobileNotificationPreferences {\n return {\n schemaVersion: server.schema_version,\n categories: server.categories.map((category) => ({\n category: category.category,\n enabled: category.enabled,\n scopes: category.scopes.map(mapMobileNotificationPreferenceScope),\n })),\n };\n}\n\nfunction mapMobileNotificationPreferenceScope(\n server: MobileServerNotificationPreferenceScope,\n): MobileNotificationPreferenceScope {\n if (server.type === 'subaccount') {\n return { type: 'subaccount', subaccount: server.subaccount };\n }\n return { type: 'product', productId: server.product_id };\n}\n\n/**\n * Maps client-side notification preferences (camelCase) to the server-side (snake_case) wire shape.\n */\nexport function mapMobileNotificationPreferencesToServer(\n preferences: MobileNotificationPreferences,\n): MobileServerNotificationPreferences {\n return {\n schema_version: preferences.schemaVersion,\n categories: preferences.categories.map((category) => ({\n category: category.category,\n enabled: category.enabled,\n scopes: category.scopes.map(mapMobileNotificationPreferenceScopeToServer),\n })),\n };\n}\n\nfunction mapMobileNotificationPreferenceScopeToServer(\n scope: MobileNotificationPreferenceScope,\n): MobileServerNotificationPreferenceScope {\n if (scope.type === 'subaccount') {\n return { type: 'subaccount', subaccount: scope.subaccount };\n }\n return { type: 'product', product_id: scope.productId };\n}\n\n/**\n * Maps a server-side feed trade (snake_case) to its client-side (camelCase) representation.\n */\nfunction mapMobileFeedTrade(server: MobileServerFeedTrade): MobileFeedTrade {\n return {\n
|
|
1
|
+
{"version":3,"file":"dataMappers.cjs","names":[],"sources":["../src/dataMappers.ts"],"sourcesContent":["import { subaccountToHex } from '@nadohq/shared';\nimport {\n MobileFeedPage,\n MobileFeedTrade,\n MobileFollowListPage,\n MobileFollowMutationResult,\n MobileFollowSummary,\n MobileIdentitySummary,\n MobileNotificationPreferenceScope,\n MobileNotificationPreferences,\n MobileProfilesInclude,\n MobilePublicProfile,\n MobileRegisteredWallet,\n} from './types/clientTypes';\nimport { MobileServerFollowMutationResponse } from './types/serverExecuteTypes';\nimport {\n MobileServerFeedTrade,\n MobileServerFollowSummary,\n MobileServerIdentitySummary,\n MobileServerNotificationPreferenceScope,\n MobileServerNotificationPreferences,\n MobileServerProfile,\n} from './types/serverModelTypes';\nimport {\n MobileServerFeedResponse,\n MobileServerFollowListResponse,\n MobileServerRegisteredWalletResponse,\n} from './types/serverQueryTypes';\nimport { MobileServerProfilesInclude } from './types/serverRequestTypes';\n\n/**\n * Maps a server-side public profile (snake_case) to its client-side (camelCase) representation. The three\n * include-gated fields stay `undefined` when the backend omitted them, rather than being coerced to `null`\n * or zero, so callers can tell \"not requested\" from a real value.\n */\nexport function mapMobilePublicProfile(\n server: MobileServerProfile,\n): MobilePublicProfile {\n return {\n subaccount: server.subaccount,\n username: server.username,\n displayName: server.display_name,\n privateMode: server.private_mode,\n followerCount: server.follower_count,\n followingCount: server.following_count,\n followSummary: server.follow_summary\n ? mapMobileFollowSummary(server.follow_summary)\n : undefined,\n };\n}\n\n/**\n * Maps a server-side identity summary (snake_case) to its client-side (camelCase) representation.\n */\nfunction mapMobileIdentitySummary(\n server: MobileServerIdentitySummary,\n): MobileIdentitySummary {\n return {\n subaccount: server.subaccount,\n username: server.username,\n displayName: server.display_name,\n avatarUrl: server.avatar_url,\n };\n}\n\n/**\n * Maps a server-side follow summary to its client-side representation.\n */\nfunction mapMobileFollowSummary(\n server: MobileServerFollowSummary,\n): MobileFollowSummary {\n return {\n isFollowing: server.is_following,\n followedByCount: server.followed_by_count,\n followedBy: server.followed_by.map(mapMobileIdentitySummary),\n };\n}\n\n/**\n * Maps a server-side Followers or Following response to a client-side {@link MobileFollowListPage}.\n */\nexport function mapMobileFollowListPage(\n server: MobileServerFollowListResponse,\n): MobileFollowListPage {\n return {\n accounts: server.accounts.map((account) => ({\n identity: mapMobileIdentitySummary(account.identity),\n isFollowing: account.is_following,\n followerCount: account.follower_count,\n })),\n nextCursor: server.next_cursor,\n };\n}\n\n/**\n * Maps a server-side follow or unfollow response to its client-side representation.\n */\nexport function mapMobileFollowMutationResult(\n server: MobileServerFollowMutationResponse,\n): MobileFollowMutationResult {\n return {\n isFollowing: server.is_following,\n followerCount: server.follower_count,\n };\n}\n\n/**\n * Maps server-side notification preferences (snake_case) to their client-side (camelCase) representation.\n */\nexport function mapMobileNotificationPreferences(\n server: MobileServerNotificationPreferences,\n): MobileNotificationPreferences {\n return {\n schemaVersion: server.schema_version,\n categories: server.categories.map((category) => ({\n category: category.category,\n enabled: category.enabled,\n scopes: category.scopes.map(mapMobileNotificationPreferenceScope),\n })),\n };\n}\n\nfunction mapMobileNotificationPreferenceScope(\n server: MobileServerNotificationPreferenceScope,\n): MobileNotificationPreferenceScope {\n if (server.type === 'subaccount') {\n return { type: 'subaccount', subaccount: server.subaccount };\n }\n return { type: 'product', productId: server.product_id };\n}\n\n/**\n * Maps client-side profiles includes (camelCase) to the server-side (snake_case) wire shape.\n */\nexport function mapMobileProfilesIncludeToServer(\n include: MobileProfilesInclude,\n): MobileServerProfilesInclude {\n return {\n follow_counts: include.followCounts,\n follow_summary: include.followSummary\n ? { view_as: subaccountToHex(include.followSummary.viewAs) }\n : undefined,\n };\n}\n\n/**\n * Maps client-side notification preferences (camelCase) to the server-side (snake_case) wire shape.\n */\nexport function mapMobileNotificationPreferencesToServer(\n preferences: MobileNotificationPreferences,\n): MobileServerNotificationPreferences {\n return {\n schema_version: preferences.schemaVersion,\n categories: preferences.categories.map((category) => ({\n category: category.category,\n enabled: category.enabled,\n scopes: category.scopes.map(mapMobileNotificationPreferenceScopeToServer),\n })),\n };\n}\n\nfunction mapMobileNotificationPreferenceScopeToServer(\n scope: MobileNotificationPreferenceScope,\n): MobileServerNotificationPreferenceScope {\n if (scope.type === 'subaccount') {\n return { type: 'subaccount', subaccount: scope.subaccount };\n }\n return { type: 'product', product_id: scope.productId };\n}\n\n/**\n * Maps a server-side feed trade (snake_case) to its client-side (camelCase) representation.\n */\nfunction mapMobileFeedTrade(server: MobileServerFeedTrade): MobileFeedTrade {\n return {\n ...mapMobileIdentitySummary(server),\n orderDigest: server.order_digest,\n productId: server.product_id,\n quantity: server.quantity,\n notional: server.notional,\n averagePrice: server.average_price,\n margin: {\n mode: server.margin.mode,\n estimatedLeverage: server.margin.estimated_leverage,\n },\n position: server.position,\n realizedPnl: server.realized_pnl,\n filledAt: server.filled_at_ms,\n };\n}\n\n/**\n * Maps a server-side feed response to a client-side {@link MobileFeedPage}.\n */\nexport function mapMobileFeedPage(\n server: MobileServerFeedResponse,\n): MobileFeedPage {\n return {\n trades: server.trades.map(mapMobileFeedTrade),\n nextCursor: server.next_cursor,\n };\n}\n\n/**\n * Maps a server-side registered wallet (snake_case) to its client-side (camelCase) representation.\n */\nexport function mapMobileRegisteredWallet(\n server: MobileServerRegisteredWalletResponse,\n): MobileRegisteredWallet {\n return {\n wallet: server.wallet,\n platform: server.platform,\n locale: server.locale,\n appVersion: server.app_version,\n tokenFingerprintPrefix: server.token_fingerprint_prefix,\n lastSeenAt: server.last_seen_at,\n };\n}\n"],"mappings":";;;;;;;;;AAmCA,SAAgB,uBACd,QACqB;CACrB,OAAO;EACL,YAAY,OAAO;EACnB,UAAU,OAAO;EACjB,aAAa,OAAO;EACpB,aAAa,OAAO;EACpB,eAAe,OAAO;EACtB,gBAAgB,OAAO;EACvB,eAAe,OAAO,iBAClB,uBAAuB,OAAO,cAAc,IAC5C,KAAA;CACN;AACF;;;;AAKA,SAAS,yBACP,QACuB;CACvB,OAAO;EACL,YAAY,OAAO;EACnB,UAAU,OAAO;EACjB,aAAa,OAAO;EACpB,WAAW,OAAO;CACpB;AACF;;;;AAKA,SAAS,uBACP,QACqB;CACrB,OAAO;EACL,aAAa,OAAO;EACpB,iBAAiB,OAAO;EACxB,YAAY,OAAO,YAAY,IAAI,wBAAwB;CAC7D;AACF;;;;AAKA,SAAgB,wBACd,QACsB;CACtB,OAAO;EACL,UAAU,OAAO,SAAS,KAAK,aAAa;GAC1C,UAAU,yBAAyB,QAAQ,QAAQ;GACnD,aAAa,QAAQ;GACrB,eAAe,QAAQ;EACzB,EAAE;EACF,YAAY,OAAO;CACrB;AACF;;;;AAKA,SAAgB,8BACd,QAC4B;CAC5B,OAAO;EACL,aAAa,OAAO;EACpB,eAAe,OAAO;CACxB;AACF;;;;AAKA,SAAgB,iCACd,QAC+B;CAC/B,OAAO;EACL,eAAe,OAAO;EACtB,YAAY,OAAO,WAAW,KAAK,cAAc;GAC/C,UAAU,SAAS;GACnB,SAAS,SAAS;GAClB,QAAQ,SAAS,OAAO,IAAI,oCAAoC;EAClE,EAAE;CACJ;AACF;AAEA,SAAS,qCACP,QACmC;CACnC,IAAI,OAAO,SAAS,cAClB,OAAO;EAAE,MAAM;EAAc,YAAY,OAAO;CAAW;CAE7D,OAAO;EAAE,MAAM;EAAW,WAAW,OAAO;CAAW;AACzD;;;;AAKA,SAAgB,iCACd,SAC6B;CAC7B,OAAO;EACL,eAAe,QAAQ;EACvB,gBAAgB,QAAQ,gBACpB,EAAE,UAAA,GAAA,eAAA,iBAAyB,QAAQ,cAAc,MAAM,EAAE,IACzD,KAAA;CACN;AACF;;;;AAKA,SAAgB,yCACd,aACqC;CACrC,OAAO;EACL,gBAAgB,YAAY;EAC5B,YAAY,YAAY,WAAW,KAAK,cAAc;GACpD,UAAU,SAAS;GACnB,SAAS,SAAS;GAClB,QAAQ,SAAS,OAAO,IAAI,4CAA4C;EAC1E,EAAE;CACJ;AACF;AAEA,SAAS,6CACP,OACyC;CACzC,IAAI,MAAM,SAAS,cACjB,OAAO;EAAE,MAAM;EAAc,YAAY,MAAM;CAAW;CAE5D,OAAO;EAAE,MAAM;EAAW,YAAY,MAAM;CAAU;AACxD;;;;AAKA,SAAS,mBAAmB,QAAgD;CAC1E,OAAO;EACL,GAAG,yBAAyB,MAAM;EAClC,aAAa,OAAO;EACpB,WAAW,OAAO;EAClB,UAAU,OAAO;EACjB,UAAU,OAAO;EACjB,cAAc,OAAO;EACrB,QAAQ;GACN,MAAM,OAAO,OAAO;GACpB,mBAAmB,OAAO,OAAO;EACnC;EACA,UAAU,OAAO;EACjB,aAAa,OAAO;EACpB,UAAU,OAAO;CACnB;AACF;;;;AAKA,SAAgB,kBACd,QACgB;CAChB,OAAO;EACL,QAAQ,OAAO,OAAO,IAAI,kBAAkB;EAC5C,YAAY,OAAO;CACrB;AACF;;;;AAKA,SAAgB,0BACd,QACwB;CACxB,OAAO;EACL,QAAQ,OAAO;EACf,UAAU,OAAO;EACjB,QAAQ,OAAO;EACf,YAAY,OAAO;EACnB,wBAAwB,OAAO;EAC/B,YAAY,OAAO;CACrB;AACF"}
|
package/dist/dataMappers.d.cts
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { _ as MobileServerNotificationPreferences, v as MobileServerProfile } from "./serverModelTypes-KSm0CAcF.cjs";
|
|
2
|
+
import { S as MobilePublicProfile, b as MobileNotificationPreferences, m as MobileFollowMutationResult, p as MobileFollowListPage, u as MobileFeedPage, w as MobileRegisteredWallet, x as MobileProfilesInclude } from "./clientTypes-tLld8E6J.cjs";
|
|
3
|
+
import { n as MobileServerProfilesInclude } from "./serverRequestTypes-q4xTJHk0.cjs";
|
|
4
|
+
import { a as MobileServerFollowMutationResponse } from "./serverExecuteTypes-DoR0InCd.cjs";
|
|
5
|
+
import { c as MobileServerRegisteredWalletResponse, n as MobileServerFollowListResponse, t as MobileServerFeedResponse } from "./serverQueryTypes-B9OOpiJB.cjs";
|
|
4
6
|
|
|
5
7
|
//#region src/dataMappers.d.ts
|
|
6
8
|
/**
|
|
7
|
-
* Maps a server-side public profile (snake_case) to its client-side (camelCase) representation.
|
|
9
|
+
* Maps a server-side public profile (snake_case) to its client-side (camelCase) representation. The three
|
|
10
|
+
* include-gated fields stay `undefined` when the backend omitted them, rather than being coerced to `null`
|
|
11
|
+
* or zero, so callers can tell "not requested" from a real value.
|
|
8
12
|
*/
|
|
9
13
|
declare function mapMobilePublicProfile(server: MobileServerProfile): MobilePublicProfile;
|
|
14
|
+
/**
|
|
15
|
+
* Maps a server-side Followers or Following response to a client-side {@link MobileFollowListPage}.
|
|
16
|
+
*/
|
|
17
|
+
declare function mapMobileFollowListPage(server: MobileServerFollowListResponse): MobileFollowListPage;
|
|
18
|
+
/**
|
|
19
|
+
* Maps a server-side follow or unfollow response to its client-side representation.
|
|
20
|
+
*/
|
|
21
|
+
declare function mapMobileFollowMutationResult(server: MobileServerFollowMutationResponse): MobileFollowMutationResult;
|
|
10
22
|
/**
|
|
11
23
|
* Maps server-side notification preferences (snake_case) to their client-side (camelCase) representation.
|
|
12
24
|
*/
|
|
13
25
|
declare function mapMobileNotificationPreferences(server: MobileServerNotificationPreferences): MobileNotificationPreferences;
|
|
26
|
+
/**
|
|
27
|
+
* Maps client-side profiles includes (camelCase) to the server-side (snake_case) wire shape.
|
|
28
|
+
*/
|
|
29
|
+
declare function mapMobileProfilesIncludeToServer(include: MobileProfilesInclude): MobileServerProfilesInclude;
|
|
14
30
|
/**
|
|
15
31
|
* Maps client-side notification preferences (camelCase) to the server-side (snake_case) wire shape.
|
|
16
32
|
*/
|
|
@@ -24,5 +40,5 @@ declare function mapMobileFeedPage(server: MobileServerFeedResponse): MobileFeed
|
|
|
24
40
|
*/
|
|
25
41
|
declare function mapMobileRegisteredWallet(server: MobileServerRegisteredWalletResponse): MobileRegisteredWallet;
|
|
26
42
|
//#endregion
|
|
27
|
-
export { mapMobileFeedPage, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobilePublicProfile, mapMobileRegisteredWallet };
|
|
43
|
+
export { mapMobileFeedPage, mapMobileFollowListPage, mapMobileFollowMutationResult, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobileProfilesIncludeToServer, mapMobilePublicProfile, mapMobileRegisteredWallet };
|
|
28
44
|
//# sourceMappingURL=dataMappers.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataMappers.d.cts","names":[],"sources":["../src/src/dataMappers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataMappers.d.cts","names":[],"sources":["../src/src/dataMappers.ts"],"mappings":";;;;;;;;;AAmCA;;;iBAAgB,sBAAA,CACd,MAAA,EAAQ,mBAAA,GACP,mBAAmB;;;;iBA4CN,uBAAA,CACd,MAAA,EAAQ,8BAAA,GACP,oBAAoB;AA9CD;AA4CtB;;AA5CsB,iBA4DN,6BAAA,CACd,MAAA,EAAQ,kCAAA,GACP,0BAA0B;;;;iBAUb,gCAAA,CACd,MAAA,EAAQ,mCAAA,GACP,6BAA6B;;AA5BT;AAcvB;iBAqCgB,gCAAA,CACd,OAAA,EAAS,qBAAA,GACR,2BAA2B;;;;iBAYd,wCAAA,CACd,WAAA,EAAa,6BAAA,GACZ,mCAAmC;;;AAnDT;iBA+Fb,iBAAA,CACd,MAAA,EAAQ,wBAAA,GACP,cAAc;;;;iBAUD,yBAAA,CACd,MAAA,EAAQ,oCAAA,GACP,sBAAsB"}
|
package/dist/dataMappers.d.ts
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { _ as MobileServerNotificationPreferences, v as MobileServerProfile } from "./serverModelTypes-DV-eARP8.js";
|
|
2
|
+
import { S as MobilePublicProfile, b as MobileNotificationPreferences, m as MobileFollowMutationResult, p as MobileFollowListPage, u as MobileFeedPage, w as MobileRegisteredWallet, x as MobileProfilesInclude } from "./clientTypes-2I3x4TTt.js";
|
|
3
|
+
import { n as MobileServerProfilesInclude } from "./serverRequestTypes-BDXIPjtw.js";
|
|
4
|
+
import { a as MobileServerFollowMutationResponse } from "./serverExecuteTypes-ih4Xbr3J.js";
|
|
5
|
+
import { c as MobileServerRegisteredWalletResponse, n as MobileServerFollowListResponse, t as MobileServerFeedResponse } from "./serverQueryTypes-LygPrZn7.js";
|
|
4
6
|
|
|
5
7
|
//#region src/dataMappers.d.ts
|
|
6
8
|
/**
|
|
7
|
-
* Maps a server-side public profile (snake_case) to its client-side (camelCase) representation.
|
|
9
|
+
* Maps a server-side public profile (snake_case) to its client-side (camelCase) representation. The three
|
|
10
|
+
* include-gated fields stay `undefined` when the backend omitted them, rather than being coerced to `null`
|
|
11
|
+
* or zero, so callers can tell "not requested" from a real value.
|
|
8
12
|
*/
|
|
9
13
|
declare function mapMobilePublicProfile(server: MobileServerProfile): MobilePublicProfile;
|
|
14
|
+
/**
|
|
15
|
+
* Maps a server-side Followers or Following response to a client-side {@link MobileFollowListPage}.
|
|
16
|
+
*/
|
|
17
|
+
declare function mapMobileFollowListPage(server: MobileServerFollowListResponse): MobileFollowListPage;
|
|
18
|
+
/**
|
|
19
|
+
* Maps a server-side follow or unfollow response to its client-side representation.
|
|
20
|
+
*/
|
|
21
|
+
declare function mapMobileFollowMutationResult(server: MobileServerFollowMutationResponse): MobileFollowMutationResult;
|
|
10
22
|
/**
|
|
11
23
|
* Maps server-side notification preferences (snake_case) to their client-side (camelCase) representation.
|
|
12
24
|
*/
|
|
13
25
|
declare function mapMobileNotificationPreferences(server: MobileServerNotificationPreferences): MobileNotificationPreferences;
|
|
26
|
+
/**
|
|
27
|
+
* Maps client-side profiles includes (camelCase) to the server-side (snake_case) wire shape.
|
|
28
|
+
*/
|
|
29
|
+
declare function mapMobileProfilesIncludeToServer(include: MobileProfilesInclude): MobileServerProfilesInclude;
|
|
14
30
|
/**
|
|
15
31
|
* Maps client-side notification preferences (camelCase) to the server-side (snake_case) wire shape.
|
|
16
32
|
*/
|
|
@@ -24,5 +40,5 @@ declare function mapMobileFeedPage(server: MobileServerFeedResponse): MobileFeed
|
|
|
24
40
|
*/
|
|
25
41
|
declare function mapMobileRegisteredWallet(server: MobileServerRegisteredWalletResponse): MobileRegisteredWallet;
|
|
26
42
|
//#endregion
|
|
27
|
-
export { mapMobileFeedPage, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobilePublicProfile, mapMobileRegisteredWallet };
|
|
43
|
+
export { mapMobileFeedPage, mapMobileFollowListPage, mapMobileFollowMutationResult, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobileProfilesIncludeToServer, mapMobilePublicProfile, mapMobileRegisteredWallet };
|
|
28
44
|
//# sourceMappingURL=dataMappers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataMappers.d.ts","names":[],"sources":["../src/src/dataMappers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataMappers.d.ts","names":[],"sources":["../src/src/dataMappers.ts"],"mappings":";;;;;;;;;AAmCA;;;iBAAgB,sBAAA,CACd,MAAA,EAAQ,mBAAA,GACP,mBAAmB;;;;iBA4CN,uBAAA,CACd,MAAA,EAAQ,8BAAA,GACP,oBAAoB;AA9CD;AA4CtB;;AA5CsB,iBA4DN,6BAAA,CACd,MAAA,EAAQ,kCAAA,GACP,0BAA0B;;;;iBAUb,gCAAA,CACd,MAAA,EAAQ,mCAAA,GACP,6BAA6B;;AA5BT;AAcvB;iBAqCgB,gCAAA,CACd,OAAA,EAAS,qBAAA,GACR,2BAA2B;;;;iBAYd,wCAAA,CACd,WAAA,EAAa,6BAAA,GACZ,mCAAmC;;;AAnDT;iBA+Fb,iBAAA,CACd,MAAA,EAAQ,wBAAA,GACP,cAAc;;;;iBAUD,yBAAA,CACd,MAAA,EAAQ,oCAAA,GACP,sBAAsB"}
|
package/dist/dataMappers.js
CHANGED
|
@@ -1,13 +1,62 @@
|
|
|
1
|
+
import { subaccountToHex } from "@nadohq/shared";
|
|
1
2
|
//#region src/dataMappers.ts
|
|
2
3
|
/**
|
|
3
|
-
* Maps a server-side public profile (snake_case) to its client-side (camelCase) representation.
|
|
4
|
+
* Maps a server-side public profile (snake_case) to its client-side (camelCase) representation. The three
|
|
5
|
+
* include-gated fields stay `undefined` when the backend omitted them, rather than being coerced to `null`
|
|
6
|
+
* or zero, so callers can tell "not requested" from a real value.
|
|
4
7
|
*/
|
|
5
8
|
function mapMobilePublicProfile(server) {
|
|
6
9
|
return {
|
|
7
10
|
subaccount: server.subaccount,
|
|
8
11
|
username: server.username,
|
|
9
12
|
displayName: server.display_name,
|
|
10
|
-
privateMode: server.private_mode
|
|
13
|
+
privateMode: server.private_mode,
|
|
14
|
+
followerCount: server.follower_count,
|
|
15
|
+
followingCount: server.following_count,
|
|
16
|
+
followSummary: server.follow_summary ? mapMobileFollowSummary(server.follow_summary) : void 0
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Maps a server-side identity summary (snake_case) to its client-side (camelCase) representation.
|
|
21
|
+
*/
|
|
22
|
+
function mapMobileIdentitySummary(server) {
|
|
23
|
+
return {
|
|
24
|
+
subaccount: server.subaccount,
|
|
25
|
+
username: server.username,
|
|
26
|
+
displayName: server.display_name,
|
|
27
|
+
avatarUrl: server.avatar_url
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Maps a server-side follow summary to its client-side representation.
|
|
32
|
+
*/
|
|
33
|
+
function mapMobileFollowSummary(server) {
|
|
34
|
+
return {
|
|
35
|
+
isFollowing: server.is_following,
|
|
36
|
+
followedByCount: server.followed_by_count,
|
|
37
|
+
followedBy: server.followed_by.map(mapMobileIdentitySummary)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Maps a server-side Followers or Following response to a client-side {@link MobileFollowListPage}.
|
|
42
|
+
*/
|
|
43
|
+
function mapMobileFollowListPage(server) {
|
|
44
|
+
return {
|
|
45
|
+
accounts: server.accounts.map((account) => ({
|
|
46
|
+
identity: mapMobileIdentitySummary(account.identity),
|
|
47
|
+
isFollowing: account.is_following,
|
|
48
|
+
followerCount: account.follower_count
|
|
49
|
+
})),
|
|
50
|
+
nextCursor: server.next_cursor
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Maps a server-side follow or unfollow response to its client-side representation.
|
|
55
|
+
*/
|
|
56
|
+
function mapMobileFollowMutationResult(server) {
|
|
57
|
+
return {
|
|
58
|
+
isFollowing: server.is_following,
|
|
59
|
+
followerCount: server.follower_count
|
|
11
60
|
};
|
|
12
61
|
}
|
|
13
62
|
/**
|
|
@@ -34,6 +83,15 @@ function mapMobileNotificationPreferenceScope(server) {
|
|
|
34
83
|
};
|
|
35
84
|
}
|
|
36
85
|
/**
|
|
86
|
+
* Maps client-side profiles includes (camelCase) to the server-side (snake_case) wire shape.
|
|
87
|
+
*/
|
|
88
|
+
function mapMobileProfilesIncludeToServer(include) {
|
|
89
|
+
return {
|
|
90
|
+
follow_counts: include.followCounts,
|
|
91
|
+
follow_summary: include.followSummary ? { view_as: subaccountToHex(include.followSummary.viewAs) } : void 0
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
37
95
|
* Maps client-side notification preferences (camelCase) to the server-side (snake_case) wire shape.
|
|
38
96
|
*/
|
|
39
97
|
function mapMobileNotificationPreferencesToServer(preferences) {
|
|
@@ -61,11 +119,8 @@ function mapMobileNotificationPreferenceScopeToServer(scope) {
|
|
|
61
119
|
*/
|
|
62
120
|
function mapMobileFeedTrade(server) {
|
|
63
121
|
return {
|
|
122
|
+
...mapMobileIdentitySummary(server),
|
|
64
123
|
orderDigest: server.order_digest,
|
|
65
|
-
subaccount: server.subaccount,
|
|
66
|
-
username: server.username,
|
|
67
|
-
displayName: server.display_name,
|
|
68
|
-
avatarUrl: server.avatar_url,
|
|
69
124
|
productId: server.product_id,
|
|
70
125
|
quantity: server.quantity,
|
|
71
126
|
notional: server.notional,
|
|
@@ -102,6 +157,6 @@ function mapMobileRegisteredWallet(server) {
|
|
|
102
157
|
};
|
|
103
158
|
}
|
|
104
159
|
//#endregion
|
|
105
|
-
export { mapMobileFeedPage, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobilePublicProfile, mapMobileRegisteredWallet };
|
|
160
|
+
export { mapMobileFeedPage, mapMobileFollowListPage, mapMobileFollowMutationResult, mapMobileNotificationPreferences, mapMobileNotificationPreferencesToServer, mapMobileProfilesIncludeToServer, mapMobilePublicProfile, mapMobileRegisteredWallet };
|
|
106
161
|
|
|
107
162
|
//# sourceMappingURL=dataMappers.js.map
|
package/dist/dataMappers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataMappers.js","names":[],"sources":["../src/dataMappers.ts"],"sourcesContent":["import {\n MobileFeedPage,\n MobileFeedTrade,\n MobileNotificationPreferenceScope,\n MobileNotificationPreferences,\n MobilePublicProfile,\n MobileRegisteredWallet,\n} from './types/clientTypes';\nimport {\n MobileServerFeedTrade,\n MobileServerNotificationPreferenceScope,\n MobileServerNotificationPreferences,\n MobileServerProfile,\n} from './types/serverModelTypes';\nimport {\n MobileServerFeedResponse,\n MobileServerRegisteredWalletResponse,\n} from './types/serverQueryTypes';\n\n/**\n * Maps a server-side public profile (snake_case) to its client-side (camelCase) representation.\n */\nexport function mapMobilePublicProfile(\n server: MobileServerProfile,\n): MobilePublicProfile {\n return {\n subaccount: server.subaccount,\n username: server.username,\n displayName: server.display_name,\n privateMode: server.private_mode,\n };\n}\n\n/**\n * Maps server-side notification preferences (snake_case) to their client-side (camelCase) representation.\n */\nexport function mapMobileNotificationPreferences(\n server: MobileServerNotificationPreferences,\n): MobileNotificationPreferences {\n return {\n schemaVersion: server.schema_version,\n categories: server.categories.map((category) => ({\n category: category.category,\n enabled: category.enabled,\n scopes: category.scopes.map(mapMobileNotificationPreferenceScope),\n })),\n };\n}\n\nfunction mapMobileNotificationPreferenceScope(\n server: MobileServerNotificationPreferenceScope,\n): MobileNotificationPreferenceScope {\n if (server.type === 'subaccount') {\n return { type: 'subaccount', subaccount: server.subaccount };\n }\n return { type: 'product', productId: server.product_id };\n}\n\n/**\n * Maps client-side notification preferences (camelCase) to the server-side (snake_case) wire shape.\n */\nexport function mapMobileNotificationPreferencesToServer(\n preferences: MobileNotificationPreferences,\n): MobileServerNotificationPreferences {\n return {\n schema_version: preferences.schemaVersion,\n categories: preferences.categories.map((category) => ({\n category: category.category,\n enabled: category.enabled,\n scopes: category.scopes.map(mapMobileNotificationPreferenceScopeToServer),\n })),\n };\n}\n\nfunction mapMobileNotificationPreferenceScopeToServer(\n scope: MobileNotificationPreferenceScope,\n): MobileServerNotificationPreferenceScope {\n if (scope.type === 'subaccount') {\n return { type: 'subaccount', subaccount: scope.subaccount };\n }\n return { type: 'product', product_id: scope.productId };\n}\n\n/**\n * Maps a server-side feed trade (snake_case) to its client-side (camelCase) representation.\n */\nfunction mapMobileFeedTrade(server: MobileServerFeedTrade): MobileFeedTrade {\n return {\n
|
|
1
|
+
{"version":3,"file":"dataMappers.js","names":[],"sources":["../src/dataMappers.ts"],"sourcesContent":["import { subaccountToHex } from '@nadohq/shared';\nimport {\n MobileFeedPage,\n MobileFeedTrade,\n MobileFollowListPage,\n MobileFollowMutationResult,\n MobileFollowSummary,\n MobileIdentitySummary,\n MobileNotificationPreferenceScope,\n MobileNotificationPreferences,\n MobileProfilesInclude,\n MobilePublicProfile,\n MobileRegisteredWallet,\n} from './types/clientTypes';\nimport { MobileServerFollowMutationResponse } from './types/serverExecuteTypes';\nimport {\n MobileServerFeedTrade,\n MobileServerFollowSummary,\n MobileServerIdentitySummary,\n MobileServerNotificationPreferenceScope,\n MobileServerNotificationPreferences,\n MobileServerProfile,\n} from './types/serverModelTypes';\nimport {\n MobileServerFeedResponse,\n MobileServerFollowListResponse,\n MobileServerRegisteredWalletResponse,\n} from './types/serverQueryTypes';\nimport { MobileServerProfilesInclude } from './types/serverRequestTypes';\n\n/**\n * Maps a server-side public profile (snake_case) to its client-side (camelCase) representation. The three\n * include-gated fields stay `undefined` when the backend omitted them, rather than being coerced to `null`\n * or zero, so callers can tell \"not requested\" from a real value.\n */\nexport function mapMobilePublicProfile(\n server: MobileServerProfile,\n): MobilePublicProfile {\n return {\n subaccount: server.subaccount,\n username: server.username,\n displayName: server.display_name,\n privateMode: server.private_mode,\n followerCount: server.follower_count,\n followingCount: server.following_count,\n followSummary: server.follow_summary\n ? mapMobileFollowSummary(server.follow_summary)\n : undefined,\n };\n}\n\n/**\n * Maps a server-side identity summary (snake_case) to its client-side (camelCase) representation.\n */\nfunction mapMobileIdentitySummary(\n server: MobileServerIdentitySummary,\n): MobileIdentitySummary {\n return {\n subaccount: server.subaccount,\n username: server.username,\n displayName: server.display_name,\n avatarUrl: server.avatar_url,\n };\n}\n\n/**\n * Maps a server-side follow summary to its client-side representation.\n */\nfunction mapMobileFollowSummary(\n server: MobileServerFollowSummary,\n): MobileFollowSummary {\n return {\n isFollowing: server.is_following,\n followedByCount: server.followed_by_count,\n followedBy: server.followed_by.map(mapMobileIdentitySummary),\n };\n}\n\n/**\n * Maps a server-side Followers or Following response to a client-side {@link MobileFollowListPage}.\n */\nexport function mapMobileFollowListPage(\n server: MobileServerFollowListResponse,\n): MobileFollowListPage {\n return {\n accounts: server.accounts.map((account) => ({\n identity: mapMobileIdentitySummary(account.identity),\n isFollowing: account.is_following,\n followerCount: account.follower_count,\n })),\n nextCursor: server.next_cursor,\n };\n}\n\n/**\n * Maps a server-side follow or unfollow response to its client-side representation.\n */\nexport function mapMobileFollowMutationResult(\n server: MobileServerFollowMutationResponse,\n): MobileFollowMutationResult {\n return {\n isFollowing: server.is_following,\n followerCount: server.follower_count,\n };\n}\n\n/**\n * Maps server-side notification preferences (snake_case) to their client-side (camelCase) representation.\n */\nexport function mapMobileNotificationPreferences(\n server: MobileServerNotificationPreferences,\n): MobileNotificationPreferences {\n return {\n schemaVersion: server.schema_version,\n categories: server.categories.map((category) => ({\n category: category.category,\n enabled: category.enabled,\n scopes: category.scopes.map(mapMobileNotificationPreferenceScope),\n })),\n };\n}\n\nfunction mapMobileNotificationPreferenceScope(\n server: MobileServerNotificationPreferenceScope,\n): MobileNotificationPreferenceScope {\n if (server.type === 'subaccount') {\n return { type: 'subaccount', subaccount: server.subaccount };\n }\n return { type: 'product', productId: server.product_id };\n}\n\n/**\n * Maps client-side profiles includes (camelCase) to the server-side (snake_case) wire shape.\n */\nexport function mapMobileProfilesIncludeToServer(\n include: MobileProfilesInclude,\n): MobileServerProfilesInclude {\n return {\n follow_counts: include.followCounts,\n follow_summary: include.followSummary\n ? { view_as: subaccountToHex(include.followSummary.viewAs) }\n : undefined,\n };\n}\n\n/**\n * Maps client-side notification preferences (camelCase) to the server-side (snake_case) wire shape.\n */\nexport function mapMobileNotificationPreferencesToServer(\n preferences: MobileNotificationPreferences,\n): MobileServerNotificationPreferences {\n return {\n schema_version: preferences.schemaVersion,\n categories: preferences.categories.map((category) => ({\n category: category.category,\n enabled: category.enabled,\n scopes: category.scopes.map(mapMobileNotificationPreferenceScopeToServer),\n })),\n };\n}\n\nfunction mapMobileNotificationPreferenceScopeToServer(\n scope: MobileNotificationPreferenceScope,\n): MobileServerNotificationPreferenceScope {\n if (scope.type === 'subaccount') {\n return { type: 'subaccount', subaccount: scope.subaccount };\n }\n return { type: 'product', product_id: scope.productId };\n}\n\n/**\n * Maps a server-side feed trade (snake_case) to its client-side (camelCase) representation.\n */\nfunction mapMobileFeedTrade(server: MobileServerFeedTrade): MobileFeedTrade {\n return {\n ...mapMobileIdentitySummary(server),\n orderDigest: server.order_digest,\n productId: server.product_id,\n quantity: server.quantity,\n notional: server.notional,\n averagePrice: server.average_price,\n margin: {\n mode: server.margin.mode,\n estimatedLeverage: server.margin.estimated_leverage,\n },\n position: server.position,\n realizedPnl: server.realized_pnl,\n filledAt: server.filled_at_ms,\n };\n}\n\n/**\n * Maps a server-side feed response to a client-side {@link MobileFeedPage}.\n */\nexport function mapMobileFeedPage(\n server: MobileServerFeedResponse,\n): MobileFeedPage {\n return {\n trades: server.trades.map(mapMobileFeedTrade),\n nextCursor: server.next_cursor,\n };\n}\n\n/**\n * Maps a server-side registered wallet (snake_case) to its client-side (camelCase) representation.\n */\nexport function mapMobileRegisteredWallet(\n server: MobileServerRegisteredWalletResponse,\n): MobileRegisteredWallet {\n return {\n wallet: server.wallet,\n platform: server.platform,\n locale: server.locale,\n appVersion: server.app_version,\n tokenFingerprintPrefix: server.token_fingerprint_prefix,\n lastSeenAt: server.last_seen_at,\n };\n}\n"],"mappings":";;;;;;;AAmCA,SAAgB,uBACd,QACqB;CACrB,OAAO;EACL,YAAY,OAAO;EACnB,UAAU,OAAO;EACjB,aAAa,OAAO;EACpB,aAAa,OAAO;EACpB,eAAe,OAAO;EACtB,gBAAgB,OAAO;EACvB,eAAe,OAAO,iBAClB,uBAAuB,OAAO,cAAc,IAC5C,KAAA;CACN;AACF;;;;AAKA,SAAS,yBACP,QACuB;CACvB,OAAO;EACL,YAAY,OAAO;EACnB,UAAU,OAAO;EACjB,aAAa,OAAO;EACpB,WAAW,OAAO;CACpB;AACF;;;;AAKA,SAAS,uBACP,QACqB;CACrB,OAAO;EACL,aAAa,OAAO;EACpB,iBAAiB,OAAO;EACxB,YAAY,OAAO,YAAY,IAAI,wBAAwB;CAC7D;AACF;;;;AAKA,SAAgB,wBACd,QACsB;CACtB,OAAO;EACL,UAAU,OAAO,SAAS,KAAK,aAAa;GAC1C,UAAU,yBAAyB,QAAQ,QAAQ;GACnD,aAAa,QAAQ;GACrB,eAAe,QAAQ;EACzB,EAAE;EACF,YAAY,OAAO;CACrB;AACF;;;;AAKA,SAAgB,8BACd,QAC4B;CAC5B,OAAO;EACL,aAAa,OAAO;EACpB,eAAe,OAAO;CACxB;AACF;;;;AAKA,SAAgB,iCACd,QAC+B;CAC/B,OAAO;EACL,eAAe,OAAO;EACtB,YAAY,OAAO,WAAW,KAAK,cAAc;GAC/C,UAAU,SAAS;GACnB,SAAS,SAAS;GAClB,QAAQ,SAAS,OAAO,IAAI,oCAAoC;EAClE,EAAE;CACJ;AACF;AAEA,SAAS,qCACP,QACmC;CACnC,IAAI,OAAO,SAAS,cAClB,OAAO;EAAE,MAAM;EAAc,YAAY,OAAO;CAAW;CAE7D,OAAO;EAAE,MAAM;EAAW,WAAW,OAAO;CAAW;AACzD;;;;AAKA,SAAgB,iCACd,SAC6B;CAC7B,OAAO;EACL,eAAe,QAAQ;EACvB,gBAAgB,QAAQ,gBACpB,EAAE,SAAS,gBAAgB,QAAQ,cAAc,MAAM,EAAE,IACzD,KAAA;CACN;AACF;;;;AAKA,SAAgB,yCACd,aACqC;CACrC,OAAO;EACL,gBAAgB,YAAY;EAC5B,YAAY,YAAY,WAAW,KAAK,cAAc;GACpD,UAAU,SAAS;GACnB,SAAS,SAAS;GAClB,QAAQ,SAAS,OAAO,IAAI,4CAA4C;EAC1E,EAAE;CACJ;AACF;AAEA,SAAS,6CACP,OACyC;CACzC,IAAI,MAAM,SAAS,cACjB,OAAO;EAAE,MAAM;EAAc,YAAY,MAAM;CAAW;CAE5D,OAAO;EAAE,MAAM;EAAW,YAAY,MAAM;CAAU;AACxD;;;;AAKA,SAAS,mBAAmB,QAAgD;CAC1E,OAAO;EACL,GAAG,yBAAyB,MAAM;EAClC,aAAa,OAAO;EACpB,WAAW,OAAO;EAClB,UAAU,OAAO;EACjB,UAAU,OAAO;EACjB,cAAc,OAAO;EACrB,QAAQ;GACN,MAAM,OAAO,OAAO;GACpB,mBAAmB,OAAO,OAAO;EACnC;EACA,UAAU,OAAO;EACjB,aAAa,OAAO;EACpB,UAAU,OAAO;CACnB;AACF;;;;AAKA,SAAgB,kBACd,QACgB;CAChB,OAAO;EACL,QAAQ,OAAO,OAAO,IAAI,kBAAkB;EAC5C,YAAY,OAAO;CACrB;AACF;;;;AAKA,SAAgB,0BACd,QACwB;CACxB,OAAO;EACL,QAAQ,OAAO;EACf,UAAU,OAAO;EACjB,QAAQ,OAAO;EACf,YAAY,OAAO;EACnB,wBAAwB,OAAO;EAC/B,YAAY,OAAO;CACrB;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as MobileSignedInner } from "./types-
|
|
1
|
+
import { n as MobileSignedInner } from "./types-CClB00EN.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/signing/eip712MethodByType.d.ts
|
|
4
4
|
/**
|
|
@@ -7,4 +7,4 @@ import { n as MobileSignedInner } from "./types-47IPsDyA.cjs";
|
|
|
7
7
|
declare const MOBILE_EIP712_METHOD_BY_TYPE: Record<MobileSignedInner['type'], string>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { MOBILE_EIP712_METHOD_BY_TYPE as t };
|
|
10
|
-
//# sourceMappingURL=eip712MethodByType-
|
|
10
|
+
//# sourceMappingURL=eip712MethodByType-2-vyN5SU.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip712MethodByType-2-vyN5SU.d.cts","names":[],"sources":["../src/signing/src/signing/eip712MethodByType.ts"],"mappings":";;;;;AAKA;cAAa,4BAAA,EAA8B,MAAM,CAC/C,iBAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as MobileSignedInner } from "./types-
|
|
1
|
+
import { n as MobileSignedInner } from "./types-B8lDIhBP.js";
|
|
2
2
|
|
|
3
3
|
//#region src/signing/eip712MethodByType.d.ts
|
|
4
4
|
/**
|
|
@@ -7,4 +7,4 @@ import { n as MobileSignedInner } from "./types-D5kFJzEX.js";
|
|
|
7
7
|
declare const MOBILE_EIP712_METHOD_BY_TYPE: Record<MobileSignedInner['type'], string>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { MOBILE_EIP712_METHOD_BY_TYPE as t };
|
|
10
|
-
//# sourceMappingURL=eip712MethodByType-
|
|
10
|
+
//# sourceMappingURL=eip712MethodByType-CAVpvZoS.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip712MethodByType-CAVpvZoS.d.ts","names":[],"sources":["../src/signing/src/signing/eip712MethodByType.ts"],"mappings":";;;;;AAKA;cAAa,4BAAA,EAA8B,MAAM,CAC/C,iBAAA"}
|