@nadohq/mobile-client 0.29.0 → 0.30.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/dist/{MobileClient-9JSAzblH.cjs → MobileClient-CfDtaEeL.cjs} +21 -1
- package/dist/MobileClient-CfDtaEeL.cjs.map +1 -0
- package/dist/MobileClient.cjs +1 -1
- package/dist/MobileClient.d.cts +21 -9
- package/dist/MobileClient.d.cts.map +1 -1
- package/dist/MobileClient.d.ts +21 -9
- package/dist/MobileClient.d.ts.map +1 -1
- package/dist/MobileClient.js +21 -1
- package/dist/MobileClient.js.map +1 -1
- package/dist/{MobileServerFailureError-ZggEcEda.d.cts → MobileServerFailureError-B11rr9O5.d.cts} +3 -2
- package/dist/MobileServerFailureError-B11rr9O5.d.cts.map +1 -0
- package/dist/{MobileServerFailureError-f9KhKnJj.d.ts → MobileServerFailureError-DoIvXqYV.d.ts} +3 -2
- package/dist/MobileServerFailureError-DoIvXqYV.d.ts.map +1 -0
- package/dist/{buildSignedMobileRequest-CDRsRNHm.d.ts → buildSignedMobileRequest-B4KJ6T1y.d.ts} +2 -2
- package/dist/{buildSignedMobileRequest-CDRsRNHm.d.ts.map → buildSignedMobileRequest-B4KJ6T1y.d.ts.map} +1 -1
- package/dist/{buildSignedMobileRequest-BsbBkU0K.d.cts → buildSignedMobileRequest-EEnDgZF8.d.cts} +2 -2
- package/dist/{buildSignedMobileRequest-BsbBkU0K.d.cts.map → buildSignedMobileRequest-EEnDgZF8.d.cts.map} +1 -1
- package/dist/{canonicalize-Dm7sXwPg.d.cts → canonicalize-CDdYnhL3.d.cts} +2 -2
- package/dist/canonicalize-CDdYnhL3.d.cts.map +1 -0
- package/dist/{canonicalize-PX6dTIdF.d.ts → canonicalize-Cc7hdZLJ.d.ts} +2 -2
- package/dist/canonicalize-Cc7hdZLJ.d.ts.map +1 -0
- package/dist/{clientTypes-DWW2N66c.d.ts → clientTypes-BsOps_pY.d.ts} +67 -3
- package/dist/clientTypes-BsOps_pY.d.ts.map +1 -0
- package/dist/{clientTypes-Et0PUa2d.d.cts → clientTypes-UFInIAQd.d.cts} +67 -3
- package/dist/clientTypes-UFInIAQd.d.cts.map +1 -0
- package/dist/dataMappers.cjs +33 -0
- 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 +33 -1
- package/dist/dataMappers.js.map +1 -1
- package/dist/{eip712MethodByType-DJgXal9r.d.ts → eip712MethodByType-B67XiwTu.d.ts} +2 -2
- package/dist/eip712MethodByType-B67XiwTu.d.ts.map +1 -0
- package/dist/{eip712MethodByType-DLh9MRsD.d.cts → eip712MethodByType-DCU415zf.d.cts} +2 -2
- package/dist/eip712MethodByType-DCU415zf.d.cts.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-QG5XbEY6.d.ts → mobileErrorCodes-Cj84nBnT.d.cts} +7 -5
- package/dist/mobileErrorCodes-Cj84nBnT.d.cts.map +1 -0
- package/dist/{mobileErrorCodes-BeyBKmwh.d.cts → mobileErrorCodes-Czmigq9x.d.ts} +7 -5
- package/dist/mobileErrorCodes-Czmigq9x.d.ts.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-BSoGv3Lz.d.cts} +2 -2
- package/dist/payloadHash-BSoGv3Lz.d.cts.map +1 -0
- package/dist/{payloadHash-Bmhzs78N.d.ts → payloadHash-BVP2v3p9.d.ts} +2 -2
- package/dist/payloadHash-BVP2v3p9.d.ts.map +1 -0
- package/dist/serverBaseTypes-A16onlPN.d.cts +25 -0
- package/dist/serverBaseTypes-A16onlPN.d.cts.map +1 -0
- package/dist/serverBaseTypes-m3zEi0X9.d.ts +25 -0
- package/dist/serverBaseTypes-m3zEi0X9.d.ts.map +1 -0
- package/dist/{serverExecuteTypes-DKYK1V7C.d.cts → serverExecuteTypes-C-bioiuQ.d.cts} +2 -2
- package/dist/serverExecuteTypes-C-bioiuQ.d.cts.map +1 -0
- package/dist/{serverExecuteTypes-CXnMjKnt.d.ts → serverExecuteTypes-DfzWOeIx.d.ts} +2 -2
- package/dist/serverExecuteTypes-DfzWOeIx.d.ts.map +1 -0
- package/dist/serverModelTypes-CPZUvVil.d.cts +143 -0
- package/dist/serverModelTypes-CPZUvVil.d.cts.map +1 -0
- package/dist/serverModelTypes-CqnqHY5F.d.ts +143 -0
- package/dist/serverModelTypes-CqnqHY5F.d.ts.map +1 -0
- package/dist/serverQueryTypes-CJLWWZBs.d.ts +91 -0
- package/dist/serverQueryTypes-CJLWWZBs.d.ts.map +1 -0
- package/dist/serverQueryTypes-C_cCx0Ac.d.cts +91 -0
- package/dist/serverQueryTypes-C_cCx0Ac.d.cts.map +1 -0
- package/dist/serverRequestTypes-DQDy3K9O.d.ts +62 -0
- package/dist/serverRequestTypes-DQDy3K9O.d.ts.map +1 -0
- package/dist/serverRequestTypes-DnU_FfMI.d.cts +62 -0
- package/dist/serverRequestTypes-DnU_FfMI.d.cts.map +1 -0
- package/dist/{serverResponseGuards-DjCNL3CR.d.cts → serverResponseGuards-BlvfJjsa.d.cts} +2 -2
- package/dist/{serverResponseGuards-DjCNL3CR.d.cts.map → serverResponseGuards-BlvfJjsa.d.cts.map} +1 -1
- package/dist/{serverResponseGuards-C_vZIgGl.d.ts → serverResponseGuards-gpHH8SHk.d.ts} +2 -2
- package/dist/{serverResponseGuards-C_vZIgGl.d.ts.map → serverResponseGuards-gpHH8SHk.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.d.cts +1 -1
- package/dist/signing/canonicalize.d.ts +1 -1
- package/dist/signing/eip712MethodByType.d.cts +1 -1
- package/dist/signing/eip712MethodByType.d.ts +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 +9 -5
- 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 +8 -4
- 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 +1 -1
- package/dist/types/serverExecuteTypes.d.ts +1 -1
- 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-uCD4BNZR.d.cts → types-CzOeSYnW.d.cts} +3 -3
- package/dist/{types-uCD4BNZR.d.cts.map → types-CzOeSYnW.d.cts.map} +1 -1
- package/dist/{types-B76Pn7Sy.d.ts → types-UHjZR-js.d.ts} +3 -3
- package/dist/{types-B76Pn7Sy.d.ts.map → types-UHjZR-js.d.ts.map} +1 -1
- 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 +49 -27
- package/src/dataMappers.ts +40 -0
- package/src/types/MobileServerFailureError.ts +2 -4
- package/src/types/clientTypes.ts +70 -0
- package/src/types/index.ts +1 -0
- package/src/types/mobileErrorCodes.ts +7 -3
- package/src/types/serverBaseTypes.ts +7 -28
- package/src/types/serverModelTypes.ts +93 -0
- package/src/types/serverQueryTypes.ts +83 -39
- package/src/types/serverRequestTypes.ts +68 -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.map +0 -1
- 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.map +0 -1
- 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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { MobileNotificationCategory, MobileNotificationPlatform, MobileServerIdentity, MobileServerNotificationCategoryPreference, MobileServerNotificationPreferenceScope, MobileServerNotificationPreferences, MobileServerProfile, MobileServerRegisteredDevice };
|
|
1
|
+
import { _ as MobileServerRegisteredDevice, a as MobileFeedTradePosition, c as MobileNotificationCategory, d as MobileServerFeedTrade, f as MobileServerIdentity, g as MobileServerProfile, h as MobileServerNotificationPreferences, i as MobileFeedMarginMode, l as MobileNotificationPlatform, m as MobileServerNotificationPreferenceScope, n as MOBILE_FEED_TRADE_POSITION_DIRECTIONS, o as MobileFeedTradePositionDirection, p as MobileServerNotificationCategoryPreference, r as MOBILE_FEED_TRADE_POSITION_EFFECTS, s as MobileFeedTradePositionEffect, t as MOBILE_FEED_MARGIN_MODES, u as MobileServerFeedMargin } from "../serverModelTypes-CqnqHY5F.js";
|
|
2
|
+
export { MOBILE_FEED_MARGIN_MODES, MOBILE_FEED_TRADE_POSITION_DIRECTIONS, MOBILE_FEED_TRADE_POSITION_EFFECTS, MobileFeedMarginMode, MobileFeedTradePosition, MobileFeedTradePositionDirection, MobileFeedTradePositionEffect, MobileNotificationCategory, MobileNotificationPlatform, MobileServerFeedMargin, MobileServerFeedTrade, MobileServerIdentity, MobileServerNotificationCategoryPreference, MobileServerNotificationPreferenceScope, MobileServerNotificationPreferences, MobileServerProfile, MobileServerRegisteredDevice };
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/types/serverModelTypes.ts
|
|
2
|
+
/**
|
|
3
|
+
* Every {@link MobileFeedTradePositionDirection} the feed can report, for callers that need the values at
|
|
4
|
+
* runtime (validation, filters, UI enumeration).
|
|
5
|
+
*/
|
|
6
|
+
const MOBILE_FEED_TRADE_POSITION_DIRECTIONS = ["long", "short"];
|
|
7
|
+
/**
|
|
8
|
+
* Every {@link MobileFeedTradePositionEffect} the feed can report, for callers that need the values at
|
|
9
|
+
* runtime (validation, filters, UI enumeration).
|
|
10
|
+
*/
|
|
11
|
+
const MOBILE_FEED_TRADE_POSITION_EFFECTS = [
|
|
12
|
+
"opened",
|
|
13
|
+
"increased",
|
|
14
|
+
"reduced",
|
|
15
|
+
"closed",
|
|
16
|
+
"flipped"
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Every {@link MobileFeedMarginMode} the feed can report, for callers that need the values at runtime
|
|
20
|
+
* (validation, filters, UI enumeration).
|
|
21
|
+
*/
|
|
22
|
+
const MOBILE_FEED_MARGIN_MODES = ["cross", "isolated"];
|
|
23
|
+
//#endregion
|
|
24
|
+
export { MOBILE_FEED_MARGIN_MODES, MOBILE_FEED_TRADE_POSITION_DIRECTIONS, MOBILE_FEED_TRADE_POSITION_EFFECTS };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=serverModelTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverModelTypes.js","names":[],"sources":["../../src/types/serverModelTypes.ts"],"sourcesContent":["import { BalanceSide } from '@nadohq/shared';\nimport { Hex } from 'viem';\n\n/**\n * Platform of a device registered for push notifications.\n */\nexport type MobileNotificationPlatform = 'ios' | 'android';\n\n/**\n * Category of push notification.\n */\nexport type MobileNotificationCategory =\n | 'order_fill'\n | 'order_update'\n | 'liquidation'\n | 'funding'\n | 'product_listing'\n | 'announcement';\n\n/**\n * Server-side public profile shape (snake_case).\n */\nexport interface MobileServerProfile {\n subaccount: Hex;\n username: string;\n display_name: string;\n}\n\n/**\n * Server-side identity shape (snake_case) returned by the signed `self_identity` query.\n */\nexport interface MobileServerIdentity {\n subaccount: Hex;\n username: string;\n display_name: string;\n private_mode: boolean;\n}\n\n/**\n * Direction of the position a feed trade resulted in — for `closed`, the direction that was closed. This is\n * NOT the execution buy/sell side, which the feed does not expose. Aliases {@link BalanceSide} so the feed's\n * direction values stay in lockstep with the rest of the SDK.\n */\nexport type MobileFeedTradePositionDirection = BalanceSide;\n\n/**\n * Every {@link MobileFeedTradePositionDirection} the feed can report, for callers that need the values at\n * runtime (validation, filters, UI enumeration).\n */\nexport const MOBILE_FEED_TRADE_POSITION_DIRECTIONS = [\n 'long',\n 'short',\n] as const satisfies readonly MobileFeedTradePositionDirection[];\n\n/**\n * Every {@link MobileFeedTradePositionEffect} the feed can report, for callers that need the values at\n * runtime (validation, filters, UI enumeration).\n */\nexport const MOBILE_FEED_TRADE_POSITION_EFFECTS = [\n 'opened',\n 'increased',\n 'reduced',\n 'closed',\n 'flipped',\n] as const;\n\n/**\n * How a feed trade changed the trader's position in the product.\n */\nexport type MobileFeedTradePositionEffect =\n (typeof MOBILE_FEED_TRADE_POSITION_EFFECTS)[number];\n\n/**\n * Position change of a feed trade. Both keys are single words, so the wire and client shapes are identical\n * and this type is shared by {@link MobileServerFeedTrade} and the client-side `MobileFeedTrade`.\n */\nexport interface MobileFeedTradePosition {\n direction: MobileFeedTradePositionDirection;\n effect: MobileFeedTradePositionEffect;\n}\n\n/**\n * Every {@link MobileFeedMarginMode} the feed can report, for callers that need the values at runtime\n * (validation, filters, UI enumeration).\n */\nexport const MOBILE_FEED_MARGIN_MODES = ['cross', 'isolated'] as const;\n\n/**\n * Margin mode a feed trade was executed under. Shared by the wire and client margin shapes.\n */\nexport type MobileFeedMarginMode = (typeof MOBILE_FEED_MARGIN_MODES)[number];\n\n/**\n * Server-side margin of a feed trade. Branch on `mode` — do not infer isolated state from leverage presence:\n * `estimated_leverage` (a rounded whole-number estimate, not exact submitted leverage) is omitted on `cross`,\n * and also omitted inside `isolated` when no estimate is available.\n */\nexport interface MobileServerFeedMargin {\n mode: MobileFeedMarginMode;\n estimated_leverage?: number;\n}\n\n/**\n * Server-side feed trade shape (snake_case): one row per order digest, enriched at read time with the\n * trader's current identity. Amounts are display-oriented human-unit JSON numbers — do not use them for\n * accounting, order construction, or exact threshold decisions.\n */\nexport interface MobileServerFeedTrade {\n /** Order digest this row is keyed by; the stable id clients use to reconcile live pagination. */\n order_digest: Hex;\n subaccount: Hex;\n username: string;\n display_name: string;\n /** Reserved for a future avatar source; `null` until one is implemented. */\n avatar_url: string | null;\n product_id: number;\n /** Executed quantity in human units. */\n quantity: number;\n /** Trade notional in whole-dollar human units. */\n notional: number;\n /** Average execution price in human units. */\n average_price: number;\n margin: MobileServerFeedMargin;\n position: MobileFeedTradePosition;\n /** Realized PnL of the trade in human units; can be negative. */\n realized_pnl: number;\n /** Fill time as JavaScript-safe integer Unix milliseconds. */\n filled_at_ms: number;\n}\n\n/**\n * Server-side scope limiting a notification category preference. Scopes are rejected by the backend for the\n * MVP (`scopes` must be empty) but are part of the wire format.\n */\nexport type MobileServerNotificationPreferenceScope =\n | { type: 'subaccount'; subaccount: Hex }\n | { type: 'product'; product_id: number };\n\n/**\n * Server-side per-category notification preference (snake_case).\n */\nexport interface MobileServerNotificationCategoryPreference {\n category: MobileNotificationCategory;\n enabled: boolean;\n scopes: MobileServerNotificationPreferenceScope[];\n}\n\n/**\n * Server-side notification preferences shape (snake_case), used in both the `update_preferences` execute and\n * the `notification_preferences` query response.\n */\nexport interface MobileServerNotificationPreferences {\n /** Only `1` is accepted by the backend for the MVP. */\n schema_version: 1;\n categories: MobileServerNotificationCategoryPreference[];\n}\n\n/**\n * Server-side registered push device shape (snake_case).\n */\nexport interface MobileServerRegisteredDevice {\n platform: MobileNotificationPlatform;\n locale: string | null;\n app_version: string | null;\n token_fingerprint_prefix: string;\n last_seen_at: number;\n}\n"],"mappings":";;;;;AAiDA,MAAa,wCAAwC,CACnD,QACA,OACF;;;;;AAMA,MAAa,qCAAqC;CAChD;CACA;CACA;CACA;CACA;AACF;;;;;AAqBA,MAAa,2BAA2B,CAAC,SAAS,UAAU"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export {
|
|
1
|
+
import { a as MobileServerPublicQueryResponseByType, c as MobileServerSelfIdentityResponse, d as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, l as MobileServerSignedQueryResponseByType, n as MobileServerNotificationPreferencesResponse, o as MobileServerPublicQuerySuccessResponse, r as MobileServerProfileResponse, s as MobileServerRegisteredDevicesResponse, t as MobileServerFeedResponse, u as MobileServerSignedQuerySuccessResponse } from "../serverQueryTypes-C_cCx0Ac.cjs";
|
|
2
|
+
export { MobileServerFeedResponse, MobileServerNotificationPreferencesResponse, MobileServerProfileResponse, MobileServerPublicQueryRequest, MobileServerPublicQueryResponseByType, MobileServerPublicQuerySuccessResponse, MobileServerRegisteredDevicesResponse, MobileServerSelfIdentityResponse, MobileServerSignedQueryResponseByType, MobileServerSignedQuerySuccessResponse, MobileServerUsernameAvailabilityResponse };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export {
|
|
1
|
+
import { a as MobileServerPublicQueryResponseByType, c as MobileServerSelfIdentityResponse, d as MobileServerUsernameAvailabilityResponse, i as MobileServerPublicQueryRequest, l as MobileServerSignedQueryResponseByType, n as MobileServerNotificationPreferencesResponse, o as MobileServerPublicQuerySuccessResponse, r as MobileServerProfileResponse, s as MobileServerRegisteredDevicesResponse, t as MobileServerFeedResponse, u as MobileServerSignedQuerySuccessResponse } from "../serverQueryTypes-CJLWWZBs.js";
|
|
2
|
+
export { MobileServerFeedResponse, MobileServerNotificationPreferencesResponse, MobileServerProfileResponse, MobileServerPublicQueryRequest, MobileServerPublicQueryResponseByType, MobileServerPublicQuerySuccessResponse, MobileServerRegisteredDevicesResponse, MobileServerSelfIdentityResponse, MobileServerSignedQueryResponseByType, MobileServerSignedQuerySuccessResponse, MobileServerUsernameAvailabilityResponse };
|
|
File without changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as MobileServerSignedQueryRequestByType, i as MobileServerRequestType, n as MobileServerPublicQueryRequestByType, o as MobileServerSignedQueryRequestType, r as MobileServerPublicQueryRequestType, t as MobileServerExecuteRequestType } from "../serverRequestTypes-DnU_FfMI.cjs";
|
|
2
|
+
export { MobileServerExecuteRequestType, MobileServerPublicQueryRequestByType, MobileServerPublicQueryRequestType, MobileServerRequestType, MobileServerSignedQueryRequestByType, MobileServerSignedQueryRequestType };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as MobileServerSignedQueryRequestByType, i as MobileServerRequestType, n as MobileServerPublicQueryRequestByType, o as MobileServerSignedQueryRequestType, r as MobileServerPublicQueryRequestType, t as MobileServerExecuteRequestType } from "../serverRequestTypes-DQDy3K9O.js";
|
|
2
|
+
export { MobileServerExecuteRequestType, MobileServerPublicQueryRequestByType, MobileServerPublicQueryRequestType, MobileServerRequestType, MobileServerSignedQueryRequestByType, MobileServerSignedQueryRequestType };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { h as MobileServerNotificationPreferences, l as MobileNotificationPlatform } from "./serverModelTypes-CPZUvVil.cjs";
|
|
2
|
+
import { y as MobileSignedRequestParams } from "./clientTypes-UFInIAQd.cjs";
|
|
3
3
|
import { WalletClientWithAccount } from "@nadohq/shared";
|
|
4
4
|
import { Hex } from "viem";
|
|
5
5
|
|
|
@@ -70,4 +70,4 @@ interface BuildSignedMobileRequestParams extends MobileSignedRequestParams {
|
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
72
|
export { MobileSignedRequest as i, MobileSignedInner as n, MobileSignedInnerParams as r, BuildSignedMobileRequestParams as t };
|
|
73
|
-
//# sourceMappingURL=types-
|
|
73
|
+
//# sourceMappingURL=types-CzOeSYnW.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-CzOeSYnW.d.cts","names":[],"sources":["../src/signing/src/signing/types.ts"],"mappings":";;;;;;;;AAiBA;;;;;;;KAAY,iBAAA;EACN,IAAA;EAAwB,YAAA;AAAA;EACxB,IAAA;EAAyB,YAAA;AAAA;EACzB,IAAA;EAA0B,YAAA;AAAA;EAC1B,IAAA;AAAA;EAEA,IAAA;EACA,UAAA;EACA,QAAA,EAAU,0BAAA;EAGV,MAAA;EACA,WAAA;AAAA;EAEA,IAAA;EAA+B,UAAA;AAAA;EAE/B,IAAA;EACA,WAAA,EAAa,mCAAmC;AAAA;EAEhD,IAAA;AAAA;EACA,IAAA;AAAA;;;;;KAMM,uBAAA,WAAkC,iBAAA,YAA6B,IAAA,CACzE,OAAA,CAAQ,iBAAA;EAAqB,IAAA,EAAM,CAAA;AAAA;;;AAAC;AAQtC;KAAY,mBAAA,WACA,iBAAA,GAAoB,iBAAA,IAC5B,CAAA;EACF,SAAA,EAAW,GAAA;EACX,MAAA,EAAQ,GAAA;EACR,KAAA;AAAA;;;;UAMe,8BAAA,SAAuC,yBAAA;EACtD,YAAA,EAAc,uBAAA;EACd,KAAA,EAAO,iBAAA;EAZuB;;;EAgB9B,KAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { h as MobileServerNotificationPreferences, l as MobileNotificationPlatform } from "./serverModelTypes-CqnqHY5F.js";
|
|
2
|
+
import { y as MobileSignedRequestParams } from "./clientTypes-BsOps_pY.js";
|
|
3
3
|
import { WalletClientWithAccount } from "@nadohq/shared";
|
|
4
4
|
import { Hex } from "viem";
|
|
5
5
|
|
|
@@ -70,4 +70,4 @@ interface BuildSignedMobileRequestParams extends MobileSignedRequestParams {
|
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
72
|
export { MobileSignedRequest as i, MobileSignedInner as n, MobileSignedInnerParams as r, BuildSignedMobileRequestParams as t };
|
|
73
|
-
//# sourceMappingURL=types-
|
|
73
|
+
//# sourceMappingURL=types-UHjZR-js.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-UHjZR-js.d.ts","names":[],"sources":["../src/signing/src/signing/types.ts"],"mappings":";;;;;;;;AAiBA;;;;;;;KAAY,iBAAA;EACN,IAAA;EAAwB,YAAA;AAAA;EACxB,IAAA;EAAyB,YAAA;AAAA;EACzB,IAAA;EAA0B,YAAA;AAAA;EAC1B,IAAA;AAAA;EAEA,IAAA;EACA,UAAA;EACA,QAAA,EAAU,0BAAA;EAGV,MAAA;EACA,WAAA;AAAA;EAEA,IAAA;EAA+B,UAAA;AAAA;EAE/B,IAAA;EACA,WAAA,EAAa,mCAAmC;AAAA;EAEhD,IAAA;AAAA;EACA,IAAA;AAAA;;;;;KAMM,uBAAA,WAAkC,iBAAA,YAA6B,IAAA,CACzE,OAAA,CAAQ,iBAAA;EAAqB,IAAA,EAAM,CAAA;AAAA;;;AAAC;AAQtC;KAAY,mBAAA,WACA,iBAAA,GAAoB,iBAAA,IAC5B,CAAA;EACF,SAAA,EAAW,GAAA;EACX,MAAA,EAAQ,GAAA;EACR,KAAA;AAAA;;;;UAMe,8BAAA,SAAuC,yBAAA;EACtD,YAAA,EAAc,uBAAA;EACd,KAAA,EAAO,iBAAA;EAZuB;;;EAgB9B,KAAA;AAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/utils/feed.ts
|
|
3
|
+
/**
|
|
4
|
+
* Maximum feed page size the backend accepts; also the default when `limit` is omitted. Requests above this
|
|
5
|
+
* fail with `INVALID_FEED_FILTER`.
|
|
6
|
+
*/
|
|
7
|
+
const MOBILE_FEED_MAX_PAGE_SIZE = 50;
|
|
8
|
+
/**
|
|
9
|
+
* Lowest minimum notional the backend accepts, in whole dollars. Filtered requests below this fail with
|
|
10
|
+
* `INVALID_FEED_FILTER`; omitting the filter entirely returns the unfiltered feed.
|
|
11
|
+
*/
|
|
12
|
+
const MOBILE_FEED_MIN_NOTIONAL_FLOOR = 1e3;
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.MOBILE_FEED_MAX_PAGE_SIZE = MOBILE_FEED_MAX_PAGE_SIZE;
|
|
15
|
+
exports.MOBILE_FEED_MIN_NOTIONAL_FLOOR = MOBILE_FEED_MIN_NOTIONAL_FLOOR;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=feed.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed.cjs","names":[],"sources":["../../src/utils/feed.ts"],"sourcesContent":["/**\n * Maximum feed page size the backend accepts; also the default when `limit` is omitted. Requests above this\n * fail with `INVALID_FEED_FILTER`.\n */\nexport const MOBILE_FEED_MAX_PAGE_SIZE = 50;\n\n/**\n * Lowest minimum notional the backend accepts, in whole dollars. Filtered requests below this fail with\n * `INVALID_FEED_FILTER`; omitting the filter entirely returns the unfiltered feed.\n */\nexport const MOBILE_FEED_MIN_NOTIONAL_FLOOR = 1_000;\n"],"mappings":";;;;;;AAIA,MAAa,4BAA4B;;;;;AAMzC,MAAa,iCAAiC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/utils/feed.ts
|
|
2
|
+
/**
|
|
3
|
+
* Maximum feed page size the backend accepts; also the default when `limit` is omitted. Requests above this
|
|
4
|
+
* fail with `INVALID_FEED_FILTER`.
|
|
5
|
+
*/
|
|
6
|
+
const MOBILE_FEED_MAX_PAGE_SIZE = 50;
|
|
7
|
+
/**
|
|
8
|
+
* Lowest minimum notional the backend accepts, in whole dollars. Filtered requests below this fail with
|
|
9
|
+
* `INVALID_FEED_FILTER`; omitting the filter entirely returns the unfiltered feed.
|
|
10
|
+
*/
|
|
11
|
+
const MOBILE_FEED_MIN_NOTIONAL_FLOOR = 1e3;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=feed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed.js","names":[],"sources":["../../src/utils/feed.ts"],"sourcesContent":["/**\n * Maximum feed page size the backend accepts; also the default when `limit` is omitted. Requests above this\n * fail with `INVALID_FEED_FILTER`.\n */\nexport const MOBILE_FEED_MAX_PAGE_SIZE = 50;\n\n/**\n * Lowest minimum notional the backend accepts, in whole dollars. Filtered requests below this fail with\n * `INVALID_FEED_FILTER`; omitting the filter entirely returns the unfiltered feed.\n */\nexport const MOBILE_FEED_MIN_NOTIONAL_FLOOR = 1_000;\n"],"mappings":";;;;;AAIA,MAAa,4BAA4B;;;;;AAMzC,MAAa,iCAAiC"}
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_utils_serverResponseGuards = require("./serverResponseGuards.cjs");
|
|
3
|
+
const require_utils_feed = require("./feed.cjs");
|
|
3
4
|
const require_utils_patterns = require("./patterns.cjs");
|
|
4
5
|
exports.MOBILE_DISPLAY_NAME_PATTERN = require_utils_patterns.MOBILE_DISPLAY_NAME_PATTERN;
|
|
6
|
+
exports.MOBILE_FEED_MAX_PAGE_SIZE = require_utils_feed.MOBILE_FEED_MAX_PAGE_SIZE;
|
|
7
|
+
exports.MOBILE_FEED_MIN_NOTIONAL_FLOOR = require_utils_feed.MOBILE_FEED_MIN_NOTIONAL_FLOOR;
|
|
5
8
|
exports.isMobileServerFailureResponse = require_utils_serverResponseGuards.isMobileServerFailureResponse;
|
|
6
9
|
exports.isMobileServerSuccessResponse = require_utils_serverResponseGuards.isMobileServerSuccessResponse;
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { n as MOBILE_FEED_MIN_NOTIONAL_FLOOR, t as MOBILE_FEED_MAX_PAGE_SIZE } from "../feed-CBIwOhTO.cjs";
|
|
2
|
+
import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-Db6fgz8i.cjs";
|
|
3
|
+
import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-BlvfJjsa.cjs";
|
|
4
|
+
export { MOBILE_DISPLAY_NAME_PATTERN, MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR, isMobileServerFailureResponse, isMobileServerSuccessResponse };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { n as MOBILE_FEED_MIN_NOTIONAL_FLOOR, t as MOBILE_FEED_MAX_PAGE_SIZE } from "../feed-BF5k6Ryu.js";
|
|
2
|
+
import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-B5gi7OfV.js";
|
|
3
|
+
import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-gpHH8SHk.js";
|
|
4
|
+
export { MOBILE_DISPLAY_NAME_PATTERN, MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR, isMobileServerFailureResponse, isMobileServerSuccessResponse };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { isMobileServerFailureResponse, isMobileServerSuccessResponse } from "./serverResponseGuards.js";
|
|
2
|
+
import { MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR } from "./feed.js";
|
|
2
3
|
import { MOBILE_DISPLAY_NAME_PATTERN } from "./patterns.js";
|
|
3
|
-
export { MOBILE_DISPLAY_NAME_PATTERN, isMobileServerFailureResponse, isMobileServerSuccessResponse };
|
|
4
|
+
export { MOBILE_DISPLAY_NAME_PATTERN, MOBILE_FEED_MAX_PAGE_SIZE, MOBILE_FEED_MIN_NOTIONAL_FLOOR, isMobileServerFailureResponse, isMobileServerSuccessResponse };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-
|
|
1
|
+
import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-Db6fgz8i.cjs";
|
|
2
2
|
export { MOBILE_DISPLAY_NAME_PATTERN };
|
package/dist/utils/patterns.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-
|
|
1
|
+
import { t as MOBILE_DISPLAY_NAME_PATTERN } from "../patterns-B5gi7OfV.js";
|
|
2
2
|
export { MOBILE_DISPLAY_NAME_PATTERN };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-
|
|
1
|
+
import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-BlvfJjsa.cjs";
|
|
2
2
|
export { isMobileServerFailureResponse, isMobileServerSuccessResponse };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-
|
|
1
|
+
import { n as isMobileServerSuccessResponse, t as isMobileServerFailureResponse } from "../serverResponseGuards-gpHH8SHk.js";
|
|
2
2
|
export { isMobileServerFailureResponse, isMobileServerSuccessResponse };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadohq/mobile-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "HTTP client for the Nado mobile service API — username claims, profiles, privacy settings, and push notification devices & preferences",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"types": "./dist/index.d.ts",
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@msgpack/msgpack": "3.1.3",
|
|
45
|
-
"@nadohq/shared": "^0.
|
|
45
|
+
"@nadohq/shared": "^0.30.0",
|
|
46
46
|
"axios": "1.16.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"bignumber.js": "11.1.1",
|
|
55
55
|
"viem": "2.52.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "792b9deb17d69d86a8ed6f9ec4e9b3f453bcb3e8"
|
|
58
58
|
}
|
package/src/MobileClient.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
} from '@nadohq/shared';
|
|
5
5
|
import axios, { AxiosInstance, AxiosResponse } from 'axios';
|
|
6
6
|
import {
|
|
7
|
+
mapMobileFeedPage,
|
|
7
8
|
mapMobileIdentity,
|
|
8
9
|
mapMobileNotificationPreferences,
|
|
9
10
|
mapMobileNotificationPreferencesToServer,
|
|
@@ -17,12 +18,14 @@ import {
|
|
|
17
18
|
MobileSignedRequest,
|
|
18
19
|
} from './signing';
|
|
19
20
|
import {
|
|
21
|
+
GetMobileFeedParams,
|
|
20
22
|
GetMobileNotificationPreferencesParams,
|
|
21
23
|
GetMobilePublicProfileParams,
|
|
22
24
|
GetMobileRegisteredDevicesParams,
|
|
23
25
|
GetMobileSelfIdentityParams,
|
|
24
26
|
GetMobileUsernameAvailabilityParams,
|
|
25
27
|
MobileClaimUsernameParams,
|
|
28
|
+
MobileFeedPage,
|
|
26
29
|
MobileIdentity,
|
|
27
30
|
MobileNotificationPreferences,
|
|
28
31
|
MobilePublicProfile,
|
|
@@ -39,14 +42,15 @@ import { MobileServerFailureError } from './types/MobileServerFailureError';
|
|
|
39
42
|
import { MobileServerSuccessResponse } from './types/serverBaseTypes';
|
|
40
43
|
import { MobileServerExecuteResult } from './types/serverExecuteTypes';
|
|
41
44
|
import {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
MobileServerRegisteredDevicesResponse,
|
|
46
|
-
MobileServerSelfIdentityResponse,
|
|
47
|
-
MobileServerUsernameAvailabilityRequest,
|
|
48
|
-
MobileServerUsernameAvailabilityResponse,
|
|
45
|
+
MobileServerPublicQueryRequest,
|
|
46
|
+
MobileServerPublicQuerySuccessResponse,
|
|
47
|
+
MobileServerSignedQuerySuccessResponse,
|
|
49
48
|
} from './types/serverQueryTypes';
|
|
49
|
+
import {
|
|
50
|
+
MobileServerPublicQueryRequestByType,
|
|
51
|
+
MobileServerPublicQueryRequestType,
|
|
52
|
+
MobileServerSignedQueryRequestType,
|
|
53
|
+
} from './types/serverRequestTypes';
|
|
50
54
|
import {
|
|
51
55
|
isMobileServerFailureResponse,
|
|
52
56
|
isMobileServerSuccessResponse,
|
|
@@ -108,12 +112,11 @@ export class MobileClient {
|
|
|
108
112
|
async getUsernameAvailability(
|
|
109
113
|
params: GetMobileUsernameAvailabilityParams,
|
|
110
114
|
): Promise<MobileUsernameAvailability> {
|
|
111
|
-
const body:
|
|
115
|
+
const body: MobileServerPublicQueryRequest<'username_availability'> = {
|
|
112
116
|
type: 'username_availability',
|
|
113
117
|
display_name: params.displayName,
|
|
114
118
|
};
|
|
115
|
-
const data =
|
|
116
|
-
await this.publicQuery<MobileServerUsernameAvailabilityResponse>(body);
|
|
119
|
+
const data = await this.publicQuery(body);
|
|
117
120
|
return { username: data.username, available: data.available };
|
|
118
121
|
}
|
|
119
122
|
|
|
@@ -126,14 +129,36 @@ export class MobileClient {
|
|
|
126
129
|
async getPublicProfile(
|
|
127
130
|
params: GetMobilePublicProfileParams,
|
|
128
131
|
): Promise<MobilePublicProfile> {
|
|
129
|
-
const body:
|
|
132
|
+
const body: MobileServerPublicQueryRequest<'profile'> = {
|
|
130
133
|
type: 'profile',
|
|
131
134
|
username: params.username,
|
|
132
135
|
};
|
|
133
|
-
const data = await this.publicQuery
|
|
136
|
+
const data = await this.publicQuery(body);
|
|
134
137
|
return mapMobilePublicProfile(data.profile);
|
|
135
138
|
}
|
|
136
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Fetches a page of the global trade feed: public, named, perpetual trades, newest first, optionally
|
|
142
|
+
* filtered by a whole-dollar minimum notional (omitted means unfiltered). The feed is best-effort rather
|
|
143
|
+
* than authoritative history, and pagination is live (not snapshot), so deduplicate pages by
|
|
144
|
+
* {@link MobileFeedTrade.orderDigest}.
|
|
145
|
+
*
|
|
146
|
+
* @throws {MobileServerFailureError} With error code `INVALID_FEED_FILTER` if `minimumNotional` or
|
|
147
|
+
* `limit` is outside its allowed domain (fix the request; do not retry unchanged), or
|
|
148
|
+
* `INVALID_FEED_CURSOR` if the cursor is malformed or was issued for a different `minimumNotional`
|
|
149
|
+
* (discard the cursor and restart from the first page).
|
|
150
|
+
*/
|
|
151
|
+
async getFeed(params: GetMobileFeedParams = {}): Promise<MobileFeedPage> {
|
|
152
|
+
const body: MobileServerPublicQueryRequest<'feed'> = {
|
|
153
|
+
type: 'feed',
|
|
154
|
+
minimum_notional: params.minimumNotional,
|
|
155
|
+
limit: params.limit,
|
|
156
|
+
cursor: params.cursor,
|
|
157
|
+
};
|
|
158
|
+
const data = await this.publicQuery(body);
|
|
159
|
+
return mapMobileFeedPage(data);
|
|
160
|
+
}
|
|
161
|
+
|
|
137
162
|
/*
|
|
138
163
|
Signed queries
|
|
139
164
|
*/
|
|
@@ -150,8 +175,7 @@ export class MobileClient {
|
|
|
150
175
|
params,
|
|
151
176
|
{},
|
|
152
177
|
);
|
|
153
|
-
const data =
|
|
154
|
-
await this.query<MobileServerSelfIdentityResponse>(signedRequest);
|
|
178
|
+
const data = await this.query<'self_identity'>(signedRequest);
|
|
155
179
|
return data.identity ? mapMobileIdentity(data.identity) : null;
|
|
156
180
|
}
|
|
157
181
|
|
|
@@ -167,10 +191,7 @@ export class MobileClient {
|
|
|
167
191
|
params,
|
|
168
192
|
{},
|
|
169
193
|
);
|
|
170
|
-
const data =
|
|
171
|
-
await this.query<MobileServerNotificationPreferencesResponse>(
|
|
172
|
-
signedRequest,
|
|
173
|
-
);
|
|
194
|
+
const data = await this.query<'notification_preferences'>(signedRequest);
|
|
174
195
|
return mapMobileNotificationPreferences(data.preferences);
|
|
175
196
|
}
|
|
176
197
|
|
|
@@ -185,8 +206,7 @@ export class MobileClient {
|
|
|
185
206
|
params,
|
|
186
207
|
{},
|
|
187
208
|
);
|
|
188
|
-
const data =
|
|
189
|
-
await this.query<MobileServerRegisteredDevicesResponse>(signedRequest);
|
|
209
|
+
const data = await this.query<'registered_devices'>(signedRequest);
|
|
190
210
|
return data.devices.map(mapMobileRegisteredDevice);
|
|
191
211
|
}
|
|
192
212
|
|
|
@@ -318,9 +338,11 @@ export class MobileClient {
|
|
|
318
338
|
return buildSignedMobileRequest({ ...params, walletClient, inner });
|
|
319
339
|
}
|
|
320
340
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
341
|
+
// Spelled out as an intersection rather than `MobileServerPublicQueryRequest<T>`: the latter is an indexed
|
|
342
|
+
// access on a mapped type, which is not an inference site, so `T` would always widen to the full union.
|
|
343
|
+
protected async publicQuery<T extends MobileServerPublicQueryRequestType>(
|
|
344
|
+
body: { type: T } & MobileServerPublicQueryRequestByType[T],
|
|
345
|
+
): Promise<MobileServerPublicQuerySuccessResponse<T>> {
|
|
324
346
|
const response = await this.axiosInstance.post<unknown>(
|
|
325
347
|
`${this.opts.url}/mobile/public_query`,
|
|
326
348
|
body,
|
|
@@ -330,12 +352,12 @@ export class MobileClient {
|
|
|
330
352
|
this.checkServerStatus(response);
|
|
331
353
|
|
|
332
354
|
// checkServerStatus throws on failure responses so the cast to the success response is acceptable here
|
|
333
|
-
return response.data as
|
|
355
|
+
return response.data as MobileServerPublicQuerySuccessResponse<T>;
|
|
334
356
|
}
|
|
335
357
|
|
|
336
|
-
protected async query<
|
|
358
|
+
protected async query<T extends MobileServerSignedQueryRequestType>(
|
|
337
359
|
body: MobileSignedRequest,
|
|
338
|
-
): Promise<
|
|
360
|
+
): Promise<MobileServerSignedQuerySuccessResponse<T>> {
|
|
339
361
|
const response = await this.axiosInstance.post<unknown>(
|
|
340
362
|
`${this.opts.url}/mobile/query`,
|
|
341
363
|
body,
|
|
@@ -345,7 +367,7 @@ export class MobileClient {
|
|
|
345
367
|
this.checkServerStatus(response);
|
|
346
368
|
|
|
347
369
|
// checkServerStatus throws on failure responses so the cast to the success response is acceptable here
|
|
348
|
-
return response.data as
|
|
370
|
+
return response.data as MobileServerSignedQuerySuccessResponse<T>;
|
|
349
371
|
}
|
|
350
372
|
|
|
351
373
|
protected async execute(
|
package/src/dataMappers.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
+
MobileFeedPage,
|
|
3
|
+
MobileFeedTrade,
|
|
2
4
|
MobileIdentity,
|
|
3
5
|
MobileNotificationPreferenceScope,
|
|
4
6
|
MobileNotificationPreferences,
|
|
@@ -6,12 +8,14 @@ import {
|
|
|
6
8
|
MobileRegisteredDevice,
|
|
7
9
|
} from './types/clientTypes';
|
|
8
10
|
import {
|
|
11
|
+
MobileServerFeedTrade,
|
|
9
12
|
MobileServerIdentity,
|
|
10
13
|
MobileServerNotificationPreferenceScope,
|
|
11
14
|
MobileServerNotificationPreferences,
|
|
12
15
|
MobileServerProfile,
|
|
13
16
|
MobileServerRegisteredDevice,
|
|
14
17
|
} from './types/serverModelTypes';
|
|
18
|
+
import { MobileServerFeedResponse } from './types/serverQueryTypes';
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* Maps a server-side identity (snake_case) to its client-side (camelCase) representation.
|
|
@@ -90,6 +94,42 @@ function mapMobileNotificationPreferenceScopeToServer(
|
|
|
90
94
|
return { type: 'product', product_id: scope.productId };
|
|
91
95
|
}
|
|
92
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Maps a server-side feed trade (snake_case) to its client-side (camelCase) representation.
|
|
99
|
+
*/
|
|
100
|
+
function mapMobileFeedTrade(server: MobileServerFeedTrade): MobileFeedTrade {
|
|
101
|
+
return {
|
|
102
|
+
orderDigest: server.order_digest,
|
|
103
|
+
subaccount: server.subaccount,
|
|
104
|
+
username: server.username,
|
|
105
|
+
displayName: server.display_name,
|
|
106
|
+
avatarUrl: server.avatar_url,
|
|
107
|
+
productId: server.product_id,
|
|
108
|
+
quantity: server.quantity,
|
|
109
|
+
notional: server.notional,
|
|
110
|
+
averagePrice: server.average_price,
|
|
111
|
+
margin: {
|
|
112
|
+
mode: server.margin.mode,
|
|
113
|
+
estimatedLeverage: server.margin.estimated_leverage,
|
|
114
|
+
},
|
|
115
|
+
position: server.position,
|
|
116
|
+
realizedPnl: server.realized_pnl,
|
|
117
|
+
filledAt: server.filled_at_ms,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Maps a server-side feed response to a client-side {@link MobileFeedPage}.
|
|
123
|
+
*/
|
|
124
|
+
export function mapMobileFeedPage(
|
|
125
|
+
server: MobileServerFeedResponse,
|
|
126
|
+
): MobileFeedPage {
|
|
127
|
+
return {
|
|
128
|
+
trades: server.trades.map(mapMobileFeedTrade),
|
|
129
|
+
nextCursor: server.next_cursor,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
93
133
|
/**
|
|
94
134
|
* Maps a server-side registered device (snake_case) to its client-side (camelCase) representation.
|
|
95
135
|
*/
|
|
@@ -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,6 +1,8 @@
|
|
|
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';
|
|
@@ -44,6 +46,56 @@ export interface MobileUsernameAvailability {
|
|
|
44
46
|
available: boolean;
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Margin of a feed trade. Branch on `mode` — do not infer isolated state from leverage presence:
|
|
51
|
+
* `estimatedLeverage` (a rounded whole-number estimate, not exact submitted leverage) is `undefined` on
|
|
52
|
+
* `cross`, and also `undefined` inside `isolated` when no estimate is available.
|
|
53
|
+
*/
|
|
54
|
+
export interface MobileFeedMargin {
|
|
55
|
+
mode: MobileFeedMarginMode;
|
|
56
|
+
estimatedLeverage?: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A single feed trade: one row per order digest, enriched with the trader's current identity at read time
|
|
61
|
+
* (a rename can change an already-fetched trade on the next read). Amounts are display-oriented human-unit
|
|
62
|
+
* numbers — do not use them for accounting, order construction, or exact threshold decisions.
|
|
63
|
+
*/
|
|
64
|
+
export interface MobileFeedTrade {
|
|
65
|
+
/** Order digest this trade is keyed by; the stable id for reconciling live pagination. */
|
|
66
|
+
orderDigest: Hex;
|
|
67
|
+
subaccount: Hex;
|
|
68
|
+
username: string;
|
|
69
|
+
displayName: string;
|
|
70
|
+
/** Reserved for a future avatar source; `null` until one is implemented. */
|
|
71
|
+
avatarUrl: string | null;
|
|
72
|
+
productId: number;
|
|
73
|
+
/** Executed quantity in human units. */
|
|
74
|
+
quantity: number;
|
|
75
|
+
/** Trade notional in whole-dollar human units. */
|
|
76
|
+
notional: number;
|
|
77
|
+
/** Average execution price in human units. */
|
|
78
|
+
averagePrice: number;
|
|
79
|
+
margin: MobileFeedMargin;
|
|
80
|
+
/** Resulting position change. `position.direction` is NOT the execution buy/sell side. */
|
|
81
|
+
position: MobileFeedTradePosition;
|
|
82
|
+
/** Realized PnL of the trade in human units; can be negative. */
|
|
83
|
+
realizedPnl: number;
|
|
84
|
+
/** Fill time as a Unix timestamp (milliseconds). */
|
|
85
|
+
filledAt: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* A page of feed trades. `nextCursor` is `null` when there was no additional candidate at query time.
|
|
90
|
+
* Pagination is live, not snapshot, so a later fill can move a trade between pages — deduplicate by
|
|
91
|
+
* {@link MobileFeedTrade.orderDigest} and treat the merged list as a short-lived view, not an authoritative
|
|
92
|
+
* cache (removals from Private Mode or blacklists are not signaled).
|
|
93
|
+
*/
|
|
94
|
+
export interface MobileFeedPage {
|
|
95
|
+
trades: MobileFeedTrade[];
|
|
96
|
+
nextCursor: string | null;
|
|
97
|
+
}
|
|
98
|
+
|
|
47
99
|
/**
|
|
48
100
|
* Scope limiting a notification category preference. Scopes are part of the wire format but rejected by the
|
|
49
101
|
* backend for the MVP — `scopes` must be empty.
|
|
@@ -112,6 +164,24 @@ export interface GetMobilePublicProfileParams {
|
|
|
112
164
|
username: string;
|
|
113
165
|
}
|
|
114
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Params for {@link MobileClient.getFeed}.
|
|
169
|
+
*/
|
|
170
|
+
export interface GetMobileFeedParams {
|
|
171
|
+
/**
|
|
172
|
+
* Minimum notional filter as a whole-dollar safe integer, at least `MOBILE_FEED_MIN_NOTIONAL_FLOOR`
|
|
173
|
+
* ($1,000). Omit for the unfiltered feed.
|
|
174
|
+
*/
|
|
175
|
+
minimumNotional?: number;
|
|
176
|
+
/** Page size, 1–`MOBILE_FEED_MAX_PAGE_SIZE` (50); the backend defaults to 50 when omitted. */
|
|
177
|
+
limit?: number;
|
|
178
|
+
/**
|
|
179
|
+
* Opaque keyset cursor from a prior page's {@link MobileFeedPage.nextCursor}. Send it back unchanged with
|
|
180
|
+
* the exact same `minimumNotional` it was issued for.
|
|
181
|
+
*/
|
|
182
|
+
cursor?: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
115
185
|
/**
|
|
116
186
|
* Params for {@link MobileClient.getSelfIdentity}.
|
|
117
187
|
*/
|
package/src/types/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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,
|
|
@@ -17,6 +17,10 @@ export const MOBILE_ERROR_CODES = {
|
|
|
17
17
|
INVALID_EXPO_TOKEN: 6200,
|
|
18
18
|
INVALID_DEVICE_METADATA: 6201,
|
|
19
19
|
INVALID_PREFERENCES: 6202,
|
|
20
|
+
/** Feed `minimumNotional` or `limit` is outside its allowed domain. Fix the request; do not retry unchanged. */
|
|
21
|
+
INVALID_FEED_FILTER: 6300,
|
|
22
|
+
/** Feed cursor is malformed or bound to a different filter. Discard it and restart from the first page. */
|
|
23
|
+
INVALID_FEED_CURSOR: 6301,
|
|
20
24
|
} as const;
|
|
21
25
|
|
|
22
26
|
/**
|