@nadohq/mobile-client 0.53.0 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +12 -4
  2. package/dist/{MobileClient-CEVEYnV1.cjs → MobileClient-BbTaqTzi.cjs} +141 -3
  3. package/dist/MobileClient-BbTaqTzi.cjs.map +1 -0
  4. package/dist/MobileClient.cjs +1 -1
  5. package/dist/MobileClient.d.cts +75 -8
  6. package/dist/MobileClient.d.cts.map +1 -1
  7. package/dist/MobileClient.d.ts +75 -8
  8. package/dist/MobileClient.d.ts.map +1 -1
  9. package/dist/MobileClient.js +141 -3
  10. package/dist/MobileClient.js.map +1 -1
  11. package/dist/{MobileServerFailureError-GsGrBgO0.d.ts → MobileServerFailureError-B2og8e5O.d.ts} +3 -3
  12. package/dist/{MobileServerFailureError-GsGrBgO0.d.ts.map → MobileServerFailureError-B2og8e5O.d.ts.map} +1 -1
  13. package/dist/{MobileServerFailureError-D4ina2b2.d.cts → MobileServerFailureError-BrLtaHnU.d.cts} +3 -3
  14. package/dist/{MobileServerFailureError-D4ina2b2.d.cts.map → MobileServerFailureError-BrLtaHnU.d.cts.map} +1 -1
  15. package/dist/{buildSignedMobileRequest-D9XzRTyq.d.cts → buildSignedMobileRequest-CZ-EdxYI.d.cts} +2 -2
  16. package/dist/{buildSignedMobileRequest-D9XzRTyq.d.cts.map → buildSignedMobileRequest-CZ-EdxYI.d.cts.map} +1 -1
  17. package/dist/{buildSignedMobileRequest-7Iwi5k6h.d.ts → buildSignedMobileRequest-CoAVSDPx.d.ts} +2 -2
  18. package/dist/{buildSignedMobileRequest-7Iwi5k6h.d.ts.map → buildSignedMobileRequest-CoAVSDPx.d.ts.map} +1 -1
  19. package/dist/{canonicalize-OYR35XMP.d.cts → canonicalize-0_B6UOxO.d.cts} +2 -2
  20. package/dist/canonicalize-0_B6UOxO.d.cts.map +1 -0
  21. package/dist/{canonicalize-T4ShepBu.d.ts → canonicalize-BC-JICjp.d.ts} +2 -2
  22. package/dist/canonicalize-BC-JICjp.d.ts.map +1 -0
  23. package/dist/clientTypes-P4LAjreY.d.ts +731 -0
  24. package/dist/clientTypes-P4LAjreY.d.ts.map +1 -0
  25. package/dist/clientTypes-YF5d8bvg.d.cts +731 -0
  26. package/dist/clientTypes-YF5d8bvg.d.cts.map +1 -0
  27. package/dist/dataMappers.cjs +358 -0
  28. package/dist/dataMappers.cjs.map +1 -1
  29. package/dist/dataMappers.d.cts +132 -6
  30. package/dist/dataMappers.d.cts.map +1 -1
  31. package/dist/dataMappers.d.ts +132 -6
  32. package/dist/dataMappers.d.ts.map +1 -1
  33. package/dist/dataMappers.js +339 -2
  34. package/dist/dataMappers.js.map +1 -1
  35. package/dist/{eip712MethodByType-D6edRSIs.d.ts → eip712MethodByType-DWtLyPY7.d.ts} +2 -2
  36. package/dist/eip712MethodByType-DWtLyPY7.d.ts.map +1 -0
  37. package/dist/{eip712MethodByType-BAqld4fP.d.cts → eip712MethodByType-sHQ-VTHd.d.cts} +2 -2
  38. package/dist/eip712MethodByType-sHQ-VTHd.d.cts.map +1 -0
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.d.cts +15 -15
  41. package/dist/index.d.ts +15 -15
  42. package/dist/{mobileErrorCodes-CGYR3_Io.d.ts → mobileErrorCodes-DccrM4NI.d.cts} +8 -2
  43. package/dist/{mobileErrorCodes-CGYR3_Io.d.cts.map → mobileErrorCodes-DccrM4NI.d.cts.map} +1 -1
  44. package/dist/{mobileErrorCodes-CGYR3_Io.d.cts → mobileErrorCodes-DccrM4NI.d.ts} +8 -2
  45. package/dist/{mobileErrorCodes-CGYR3_Io.d.ts.map → mobileErrorCodes-DccrM4NI.d.ts.map} +1 -1
  46. package/dist/{payloadHash-B7Nmf64N.d.cts → payloadHash-CSgTglN4.d.cts} +2 -2
  47. package/dist/payloadHash-CSgTglN4.d.cts.map +1 -0
  48. package/dist/{payloadHash-RxkbwgTH.d.ts → payloadHash-qsU1DEF0.d.ts} +2 -2
  49. package/dist/payloadHash-qsU1DEF0.d.ts.map +1 -0
  50. package/dist/{serverBaseTypes-BOuAdmuQ.d.cts → serverBaseTypes-CuMsGXgc.d.cts} +2 -2
  51. package/dist/{serverBaseTypes-BOuAdmuQ.d.cts.map → serverBaseTypes-CuMsGXgc.d.cts.map} +1 -1
  52. package/dist/{serverBaseTypes-DDzfBA1a.d.ts → serverBaseTypes-DKCLDn3x.d.ts} +2 -2
  53. package/dist/{serverBaseTypes-DDzfBA1a.d.ts.map → serverBaseTypes-DKCLDn3x.d.ts.map} +1 -1
  54. package/dist/{serverExecuteTypes-DrxK2r7m.d.ts → serverExecuteTypes-DKG1mqy1.d.ts} +3 -3
  55. package/dist/{serverExecuteTypes-DrxK2r7m.d.ts.map → serverExecuteTypes-DKG1mqy1.d.ts.map} +1 -1
  56. package/dist/{serverExecuteTypes-DamHfu25.d.cts → serverExecuteTypes-TPX0GCgv.d.cts} +3 -3
  57. package/dist/{serverExecuteTypes-DamHfu25.d.cts.map → serverExecuteTypes-TPX0GCgv.d.cts.map} +1 -1
  58. package/dist/serverModelTypes-MlqdaMRd.d.cts +490 -0
  59. package/dist/serverModelTypes-MlqdaMRd.d.cts.map +1 -0
  60. package/dist/serverModelTypes-MlqdaMRd.d.ts +490 -0
  61. package/dist/serverModelTypes-MlqdaMRd.d.ts.map +1 -0
  62. package/dist/serverQueryTypes-BLUe10AI.d.ts +152 -0
  63. package/dist/serverQueryTypes-BLUe10AI.d.ts.map +1 -0
  64. package/dist/serverQueryTypes-BZOoJBpb.d.cts +152 -0
  65. package/dist/serverQueryTypes-BZOoJBpb.d.cts.map +1 -0
  66. package/dist/{serverRequestTypes-BylecTUn.d.cts → serverRequestTypes-BULjZnnz.d.ts} +69 -4
  67. package/dist/serverRequestTypes-BULjZnnz.d.ts.map +1 -0
  68. package/dist/{serverRequestTypes-DcdmGfTu.d.ts → serverRequestTypes-XbnLUsXT.d.cts} +69 -4
  69. package/dist/serverRequestTypes-XbnLUsXT.d.cts.map +1 -0
  70. package/dist/{serverResponseGuards-CjR1tv7G.d.cts → serverResponseGuards-DIj9MIrJ.d.cts} +2 -2
  71. package/dist/{serverResponseGuards-CjR1tv7G.d.cts.map → serverResponseGuards-DIj9MIrJ.d.cts.map} +1 -1
  72. package/dist/{serverResponseGuards-BspbRjOM.d.ts → serverResponseGuards-DY_8lAo7.d.ts} +2 -2
  73. package/dist/{serverResponseGuards-BspbRjOM.d.ts.map → serverResponseGuards-DY_8lAo7.d.ts.map} +1 -1
  74. package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
  75. package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
  76. package/dist/signing/canonicalize.d.cts +1 -1
  77. package/dist/signing/canonicalize.d.ts +1 -1
  78. package/dist/signing/eip712MethodByType.d.cts +1 -1
  79. package/dist/signing/eip712MethodByType.d.ts +1 -1
  80. package/dist/signing/index.d.cts +5 -5
  81. package/dist/signing/index.d.ts +5 -5
  82. package/dist/signing/payloadHash.d.cts +1 -1
  83. package/dist/signing/payloadHash.d.ts +1 -1
  84. package/dist/signing/types.d.cts +1 -1
  85. package/dist/signing/types.d.ts +1 -1
  86. package/dist/types/MobileServerFailureError.d.cts +1 -1
  87. package/dist/types/MobileServerFailureError.d.ts +1 -1
  88. package/dist/types/clientTypes.d.cts +2 -2
  89. package/dist/types/clientTypes.d.ts +2 -2
  90. package/dist/types/index.d.cts +9 -9
  91. package/dist/types/index.d.ts +9 -9
  92. package/dist/types/mobileErrorCodes.cjs +13 -1
  93. package/dist/types/mobileErrorCodes.cjs.map +1 -1
  94. package/dist/types/mobileErrorCodes.d.cts +1 -1
  95. package/dist/types/mobileErrorCodes.d.ts +1 -1
  96. package/dist/types/mobileErrorCodes.js +13 -1
  97. package/dist/types/mobileErrorCodes.js.map +1 -1
  98. package/dist/types/serverBaseTypes.d.cts +1 -1
  99. package/dist/types/serverBaseTypes.d.ts +1 -1
  100. package/dist/types/serverExecuteTypes.d.cts +1 -1
  101. package/dist/types/serverExecuteTypes.d.ts +1 -1
  102. package/dist/types/serverModelTypes.cjs.map +1 -1
  103. package/dist/types/serverModelTypes.d.cts +2 -2
  104. package/dist/types/serverModelTypes.d.ts +2 -2
  105. package/dist/types/serverModelTypes.js.map +1 -1
  106. package/dist/types/serverQueryTypes.d.cts +2 -2
  107. package/dist/types/serverQueryTypes.d.ts +2 -2
  108. package/dist/types/serverRequestTypes.d.cts +2 -2
  109. package/dist/types/serverRequestTypes.d.ts +2 -2
  110. package/dist/{types-BG321aOe.d.ts → types-B_4veFLc.d.ts} +3 -3
  111. package/dist/{types-BG321aOe.d.ts.map → types-B_4veFLc.d.ts.map} +1 -1
  112. package/dist/{types-D30luCKT.d.cts → types-CwpXP7xM.d.cts} +3 -3
  113. package/dist/{types-D30luCKT.d.cts.map → types-CwpXP7xM.d.cts.map} +1 -1
  114. package/dist/utils/index.d.cts +1 -1
  115. package/dist/utils/index.d.ts +1 -1
  116. package/dist/utils/serverResponseGuards.d.cts +1 -1
  117. package/dist/utils/serverResponseGuards.d.ts +1 -1
  118. package/package.json +3 -3
  119. package/src/MobileClient.ts +192 -2
  120. package/src/dataMappers.ts +503 -1
  121. package/src/socialFeed.test.ts +723 -0
  122. package/src/types/clientTypes.ts +467 -0
  123. package/src/types/mobileErrorCodes.ts +12 -0
  124. package/src/types/serverModelTypes.ts +388 -0
  125. package/src/types/serverQueryTypes.ts +74 -0
  126. package/src/types/serverRequestTypes.ts +94 -1
  127. package/dist/MobileClient-CEVEYnV1.cjs.map +0 -1
  128. package/dist/canonicalize-OYR35XMP.d.cts.map +0 -1
  129. package/dist/canonicalize-T4ShepBu.d.ts.map +0 -1
  130. package/dist/clientTypes-FQTkDfq3.d.cts +0 -349
  131. package/dist/clientTypes-FQTkDfq3.d.cts.map +0 -1
  132. package/dist/clientTypes-FaHdWkNu.d.ts +0 -349
  133. package/dist/clientTypes-FaHdWkNu.d.ts.map +0 -1
  134. package/dist/eip712MethodByType-BAqld4fP.d.cts.map +0 -1
  135. package/dist/eip712MethodByType-D6edRSIs.d.ts.map +0 -1
  136. package/dist/payloadHash-B7Nmf64N.d.cts.map +0 -1
  137. package/dist/payloadHash-RxkbwgTH.d.ts.map +0 -1
  138. package/dist/serverModelTypes-YmHqfxc8.d.cts +0 -173
  139. package/dist/serverModelTypes-YmHqfxc8.d.cts.map +0 -1
  140. package/dist/serverModelTypes-YmHqfxc8.d.ts +0 -173
  141. package/dist/serverModelTypes-YmHqfxc8.d.ts.map +0 -1
  142. package/dist/serverQueryTypes-C-_h9awN.d.ts +0 -89
  143. package/dist/serverQueryTypes-C-_h9awN.d.ts.map +0 -1
  144. package/dist/serverQueryTypes-CuVsrzGV.d.cts +0 -89
  145. package/dist/serverQueryTypes-CuVsrzGV.d.cts.map +0 -1
  146. package/dist/serverRequestTypes-BylecTUn.d.cts.map +0 -1
  147. package/dist/serverRequestTypes-DcdmGfTu.d.ts.map +0 -1
@@ -1,10 +1,29 @@
1
1
  import { SignatureParams, Subaccount } from '@nadohq/shared';
2
+ import BigNumber from 'bignumber.js';
2
3
  import { Hex } from 'viem';
3
4
  import {
4
5
  MobileFeedMarginMode,
5
6
  MobileFeedTradePosition,
7
+ MobileFeedTradePositionDirection,
6
8
  MobileNotificationCategory,
7
9
  MobileNotificationPlatform,
10
+ MobileSocialFeedCohortStatus,
11
+ MobileSocialFeedHistoryQuality,
12
+ MobileSocialFeedLeverage,
13
+ MobileSocialFeedMarketCategory,
14
+ MobileSocialFeedPnlBasis,
15
+ MobileSocialFeedPnlMode,
16
+ MobileSocialFeedPnlQuality,
17
+ MobileSocialFeedPositionDisplayBasis,
18
+ MobileSocialFeedPositionState,
19
+ MobileSocialFeedReadSessionMode,
20
+ MobileSocialFeedSourceCategory,
21
+ MobileSocialFeedTradeCardAction,
22
+ MobileSocialFeedTradeSizeChangeAction,
23
+ MobileSocialFeedTraderBadgeCode,
24
+ MobileSocialFeedTraderDataStatus,
25
+ MobileSocialFeedType,
26
+ MobileSocialFeedUnavailableTarget,
8
27
  } from './serverModelTypes';
9
28
 
10
29
  /**
@@ -373,3 +392,451 @@ export type GetMobileNotificationPreferencesParams = MobileWithExpoTokenParams;
373
392
  * Params for {@link MobileClient.getRegisteredWallet}.
374
393
  */
375
394
  export type GetMobileRegisteredWalletParams = MobileWithExpoTokenParams;
395
+
396
+ /** Official account-level 30-day PnL badge, independent of position PnL. */
397
+ export interface MobileSocialFeedTraderBadge {
398
+ /** Qualification tier. */
399
+ code: MobileSocialFeedTraderBadgeCode;
400
+ /** Signed integer in x18 units. */
401
+ pnl: BigNumber;
402
+ /** Stable compatibility identifier for the official Portfolio month result. */
403
+ metricKey: 'account_pnl_30d_equity';
404
+ /** PnL window label. */
405
+ window: '30d';
406
+ /** Official source timestamp in Unix milliseconds. */
407
+ sourceAsOfMs: number;
408
+ /** Fetch completion timestamp in Unix milliseconds. */
409
+ fetchedAtMs: number;
410
+ /** Qualification snapshot UUID. */
411
+ snapshotId: string;
412
+ }
413
+
414
+ /** Public author identity and the selected viewing account's follow state. */
415
+ export interface MobileSocialFeedAuthor extends MobileIdentitySummary {
416
+ /** Selected viewAs account's follow state; null without a viewing account. */
417
+ isFollowing: boolean | null;
418
+ /** Null when no qualifying badge is available. */
419
+ traderBadge: MobileSocialFeedTraderBadge | null;
420
+ /** Stale means the last successful cohort is used after a refresh failure. */
421
+ traderDataStatus: MobileSocialFeedTraderDataStatus;
422
+ }
423
+
424
+ /** Market metadata from the service's authoritative market source. */
425
+ export interface MobileSocialFeedMarket {
426
+ /** Market product ID. */
427
+ productId: number;
428
+ /** Market symbol. */
429
+ symbol: string;
430
+ /** Logo URL when available. */
431
+ logoUrl: string | null;
432
+ /** Social feed category when known. */
433
+ category: MobileSocialFeedMarketCategory | null;
434
+ /** Original market categories. */
435
+ sourceCategories: MobileSocialFeedSourceCategory[];
436
+ }
437
+
438
+ /** Position PnL with explicit accounting basis and data quality. */
439
+ export interface MobileSocialFeedPnl {
440
+ /** Signed x18 integer; null means unknown, not zero. */
441
+ amount: BigNumber | null;
442
+ /** Open positions exclude fees/funding; closed results include them. */
443
+ basis: MobileSocialFeedPnlBasis;
444
+ /** Closed positions use frozen results. */
445
+ mode: MobileSocialFeedPnlMode;
446
+ /** Source timestamp in Unix milliseconds. */
447
+ asOfMs: number;
448
+ /** Whether accounting is complete, pending, or unavailable. */
449
+ quality: MobileSocialFeedPnlQuality;
450
+ }
451
+
452
+ /** Complete mutable position fields delivered together at one version. */
453
+ export interface MobileSocialFeedPositionPatch {
454
+ /** Position lifecycle UUID. */
455
+ positionId: string;
456
+ /** Positive integer string; compare as integers without Number conversion. */
457
+ positionVersion: string;
458
+ /** Position state timestamp in Unix milliseconds. */
459
+ stateAsOfMs: number;
460
+ /** Remaining average entry price in decimal units, frozen on close; null if unknown. */
461
+ entryPrice: BigNumber | null;
462
+ /** Basis of the displayed size and entry price. */
463
+ displayBasis: MobileSocialFeedPositionDisplayBasis;
464
+ /** Closing snapshot reference time, or null. */
465
+ snapshotAtMs: number | null;
466
+ /** Absolute quantity in x18 units. */
467
+ quantity: BigNumber;
468
+ /** Notional value in x18 units. */
469
+ notional: BigNumber;
470
+ /** Current lifecycle state. */
471
+ state: MobileSocialFeedPositionState;
472
+ /** Completeness of the available historical facts. */
473
+ historyQuality: MobileSocialFeedHistoryQuality;
474
+ /** Margin mode. */
475
+ marginMode: MobileFeedMarginMode;
476
+ /** Current or closing leverage. */
477
+ leverage: MobileSocialFeedLeverage;
478
+ /** Leverage reference time; null when unknown or inapplicable. */
479
+ leverageAtMs: number | null;
480
+ /** Current remaining PnL or the closed lifecycle's net result. */
481
+ pnl: MobileSocialFeedPnl;
482
+ }
483
+
484
+ /** Position displayed inside an automatic trade card. */
485
+ export interface MobileSocialFeedPositionCard extends MobileSocialFeedPositionPatch {
486
+ /** Market product ID. */
487
+ productId: number;
488
+ /** Market display metadata. */
489
+ market: MobileSocialFeedMarket;
490
+ /** Position direction. */
491
+ direction: MobileFeedTradePositionDirection;
492
+ }
493
+
494
+ /** Interaction counters; interaction writes are not currently available. */
495
+ export interface MobileSocialFeedInteraction {
496
+ /** Number of likes. */
497
+ likeCount: number;
498
+ /** Number of comments. */
499
+ commentCount: number;
500
+ /** Number of recorded views. */
501
+ viewCount: number;
502
+ /** Null while likes are unavailable, including with a viewing account. */
503
+ likedByMe: boolean | null;
504
+ }
505
+
506
+ /** Capability flags for a social feed item. */
507
+ export interface MobileSocialFeedCapabilities {
508
+ /** Whether liking is available. */
509
+ canLike: boolean;
510
+ /** Whether commenting is available. */
511
+ canComment: boolean;
512
+ /** Whether exposure recording is available. */
513
+ canRecordView: boolean;
514
+ }
515
+
516
+ /** Comment preview metadata for a social trade card. */
517
+ export interface MobileSocialFeedCommentPreview {
518
+ /** Currently empty. */
519
+ items: never[];
520
+ /** Comment count. */
521
+ totalCount: number;
522
+ /** Comment cursor, if available. */
523
+ nextCursor: string | null;
524
+ }
525
+
526
+ /** Exposure requirements associated with a reading session. */
527
+ export interface MobileSocialFeedViewTracking {
528
+ /** Required visible fraction. */
529
+ minVisibleRatio: number;
530
+ /** Required visible duration in milliseconds. */
531
+ minDurationMs: number;
532
+ }
533
+
534
+ /** Coverage of the candidate authors in a qualification snapshot. */
535
+ export interface MobileSocialFeedCohortCoverage {
536
+ /** Coverage domain. */
537
+ scope: 'eligible_content_candidates';
538
+ /** Candidate author count. */
539
+ totalAuthors: number;
540
+ /** Authors queried for this snapshot. */
541
+ queriedAuthors: number;
542
+ /** A successful response requires complete coverage. */
543
+ complete: true;
544
+ }
545
+
546
+ /** Shared qualification snapshot used for Top Traders eligibility and badges. */
547
+ export interface MobileSocialFeedCohort {
548
+ /** Cohort UUID. */
549
+ snapshotId: string;
550
+ /** Ready or the previous successful snapshot after a refresh failure. */
551
+ status: MobileSocialFeedCohortStatus;
552
+ /** Coverage of all eligible candidate authors. */
553
+ coverage: MobileSocialFeedCohortCoverage;
554
+ }
555
+
556
+ /** Metadata shared by the automatic trade cards and rows available from the social feed. */
557
+ export interface MobileSocialFeedItemBase {
558
+ /** Item UUID. */
559
+ id: string;
560
+ /** Whether authored analysis exists. */
561
+ hasAnalysis: boolean;
562
+ /** Drawings are not currently available. */
563
+ drawing: null;
564
+ /** Author identity, badge, and follow perspective. */
565
+ author: MobileSocialFeedAuthor;
566
+ /** Creation time in Unix milliseconds. */
567
+ createdAtMs: number;
568
+ /** Sorting time in Unix milliseconds. */
569
+ displayAtMs: number;
570
+ /** Positive integer version string. */
571
+ version: string;
572
+ /** Market metadata. */
573
+ market: MobileSocialFeedMarket;
574
+ /** Server capability flags; currently all false. */
575
+ capabilities: MobileSocialFeedCapabilities;
576
+ }
577
+
578
+ /** Automatic trade card returned by the social feed. */
579
+ export interface MobileSocialFeedTradeCard extends MobileSocialFeedItemBase {
580
+ /** Card discriminant. */
581
+ kind: 'trade_card';
582
+ /** Trading action. */
583
+ action: MobileSocialFeedTradeCardAction;
584
+ /** Card text, empty for automatic cards. */
585
+ text: string;
586
+ /** Automatic cards have no mentions. */
587
+ mentions: never[];
588
+ /** Current or frozen position display. */
589
+ position: MobileSocialFeedPositionCard;
590
+ /** Interaction counters. */
591
+ interaction: MobileSocialFeedInteraction;
592
+ /** Comment content is not currently available. */
593
+ commentPreview: MobileSocialFeedCommentPreview;
594
+ }
595
+
596
+ /** Fields shared by size-change and liquidation trade rows. */
597
+ export interface MobileSocialFeedTradeRowBase extends MobileSocialFeedItemBase {
598
+ /** Row discriminant. */
599
+ kind: 'trade_row';
600
+ /** Associated lifecycle UUID. */
601
+ positionId: string;
602
+ /** Position direction. */
603
+ direction: MobileFeedTradePositionDirection;
604
+ /** Historical margin mode. */
605
+ marginMode: MobileFeedMarginMode;
606
+ /** Historical action leverage, not the position's current leverage. */
607
+ leverage: MobileSocialFeedLeverage;
608
+ /** Historical leverage reference time. */
609
+ leverageAtMs: number | null;
610
+ /** Number of aggregated trades. */
611
+ tradeCount: number;
612
+ /** Absolute traded quantity in x18 units. */
613
+ quantity: BigNumber;
614
+ /** Actual execution price in decimal units, never an Oracle substitution. */
615
+ averagePrice: BigNumber | null;
616
+ }
617
+
618
+ /** A size-change row or liquidation row with independently nullable financial facts. */
619
+ export type MobileSocialFeedTradeRow = MobileSocialFeedTradeRowBase &
620
+ (
621
+ | {
622
+ /** Ordinary size-change action. */
623
+ action: MobileSocialFeedTradeSizeChangeAction;
624
+ /** Executed notional in x18 units. */
625
+ notional: BigNumber;
626
+ }
627
+ | {
628
+ /** Liquidation discriminant. */
629
+ action: 'liquidated';
630
+ /** Quantity times event Oracle; null if that Oracle is unknown. */
631
+ notional: BigNumber | null;
632
+ /** Entry price immediately before the event, in decimal units. */
633
+ entryPrice: BigNumber | null;
634
+ /** Event Oracle price in decimal units, used for display and size filtering. */
635
+ liquidationOraclePrice: BigNumber | null;
636
+ /** Actual execution price in decimal units, independent of Oracle. */
637
+ liquidationExecutionPrice: BigNumber | null;
638
+ /** Signed action PnL excluding ordinary fees/funding, or null. */
639
+ realizedPnlDelta: BigNumber | null;
640
+ }
641
+ );
642
+
643
+ /** Automatic feed content; excludes posts, replies, drawings, and interaction writes. */
644
+ export type MobileSocialFeedItem =
645
+ | MobileSocialFeedTradeCard
646
+ | MobileSocialFeedTradeRow;
647
+
648
+ /** Fixed-duration social feed reading session. Credentials and cursors must be returned unchanged. */
649
+ export interface MobileSocialFeedReadSession {
650
+ /** Session identifier. */
651
+ sessionId: string;
652
+ /** Feed or direct item session. */
653
+ mode: MobileSocialFeedReadSessionMode;
654
+ /** Fixed expiration time in Unix milliseconds; pagination does not extend it. */
655
+ expiresAtMs: number;
656
+ /** Exposure metadata only; recording is not available from the social feed. */
657
+ viewTracking: MobileSocialFeedViewTracking;
658
+ /** Initial update baseline, distinct from the page cursor. */
659
+ updateCursor: string | null;
660
+ /** Credential for this reading session. Do not log or cache publicly. */
661
+ viewerToken: string;
662
+ }
663
+
664
+ /** Fixed-window list response; an empty page can still have a next cursor. */
665
+ export interface MobileSocialFeedPage {
666
+ /** Reading session and its browser credential. */
667
+ readSession: MobileSocialFeedReadSession;
668
+ /** Visible items in server order; deduplicate by ID without local reordering. */
669
+ items: MobileSocialFeedItem[];
670
+ /** Opaque cursor; null only when pagination is complete. */
671
+ nextCursor: string | null;
672
+ /** New-content baseline, not a pagination or update cursor. */
673
+ watermark: string;
674
+ }
675
+
676
+ /** Main-feed page with its ordering version. */
677
+ export interface MobileSocialFeedRankedPage extends MobileSocialFeedPage {
678
+ /** Current ordering contract: chronological-v1. */
679
+ rankingVersion: string;
680
+ }
681
+
682
+ /** Top Traders page, with one shared qualification snapshot for eligibility and badges. */
683
+ export interface MobileSocialFeedTopTradersPage extends MobileSocialFeedRankedPage {
684
+ /** Author eligibility snapshot. */
685
+ cohort: MobileSocialFeedCohort;
686
+ }
687
+
688
+ /** Item details with either a new item session or the reused authorized session. */
689
+ export interface MobileSocialFeedItemResponse {
690
+ /** Full visible item. */
691
+ item: MobileSocialFeedItem;
692
+ /** Session authorized for subsequent updates. */
693
+ readSession: MobileSocialFeedReadSession;
694
+ }
695
+
696
+ /** Item delta: omitted means unchanged; explicit null clears a prior value. */
697
+ export interface MobileSocialFeedItemPatch {
698
+ /** Current author identity, follow state, and qualification badge. */
699
+ author: MobileSocialFeedAuthor;
700
+ /** Target item UUID. */
701
+ itemId: string;
702
+ /** Positive integer version string. */
703
+ version: string;
704
+ /** Updated interaction counters. */
705
+ interaction?: MobileSocialFeedInteraction;
706
+ /** Updated display timestamp; does not reorder the current list. */
707
+ displayAtMs: number;
708
+ /** Updated aggregate count. */
709
+ tradeCount?: number;
710
+ /** Updated quantity in x18 units. */
711
+ quantity?: BigNumber;
712
+ /** Updated notional; liquidation Oracle may be unknown. */
713
+ notional?: BigNumber | null;
714
+ /** Updated actual execution price in decimal units. */
715
+ averagePrice?: BigNumber | null;
716
+ /** Historical liquidation entry price in decimal units. */
717
+ entryPrice?: BigNumber | null;
718
+ /** Updated liquidation Oracle price in decimal units. */
719
+ liquidationOraclePrice?: BigNumber | null;
720
+ /** Updated actual liquidation execution price in decimal units. */
721
+ liquidationExecutionPrice?: BigNumber | null;
722
+ /** Updated signed action PnL. */
723
+ realizedPnlDelta?: BigNumber | null;
724
+ /** Updated historical row leverage. */
725
+ leverage?: MobileSocialFeedLeverage;
726
+ /** Updated historical leverage reference time. */
727
+ leverageAtMs?: number | null;
728
+ }
729
+
730
+ /** Batched viewport updates; apply only the current viewport's latest request sequence. */
731
+ export interface MobileSocialFeedUpdates {
732
+ /** Item deltas, independent of current-position patches. */
733
+ itemPatches: MobileSocialFeedItemPatch[];
734
+ /** Complete mutable position facts at one version. */
735
+ positionPatches: MobileSocialFeedPositionPatch[];
736
+ /** Previously authorized targets that can no longer be read. */
737
+ unavailableTargets: MobileSocialFeedUnavailableTarget[];
738
+ /** New-content hint; always zero for directly created item sessions. */
739
+ newItemsCount: number;
740
+ /** Baseline to use for the next update call with the same viewport. */
741
+ updateCursor: string;
742
+ /** Full snapshot of applicable mutable fields; currently always true. Apply author updates even when the item version is unchanged. */
743
+ reset: boolean;
744
+ /** Echoed viewport revision. */
745
+ viewportRevision: number;
746
+ /** Echoed request sequence. */
747
+ requestSeq: number;
748
+ }
749
+
750
+ /** Public browsing requires no wallet, identity registration, or one-click trading setup. */
751
+ export interface MobileSocialFeedReadParams {
752
+ /**
753
+ * Non-isolated viewing account used for relationship state. Profile, position, and item reads also
754
+ * include that account's own hidden content under the account_view policy; this does not prove ownership.
755
+ */
756
+ viewAs?: Subaccount;
757
+ /** Reuse the original browser credential for pagination and existing sessions. */
758
+ viewerToken?: string;
759
+ }
760
+
761
+ /** Filters and fixed-session pagination common to all six social feed lists. */
762
+ export interface MobileSocialFeedListParams {
763
+ /** OR-ed content filters; empty or omitted means all. */
764
+ feedTypes?: MobileSocialFeedType[];
765
+ /** Strict minimum in whole dollars, including 500; omit for all sizes. */
766
+ minimumNotional?: number;
767
+ /** Page size, 1–50; server default is 20. */
768
+ limit?: number;
769
+ /** Required with cursor; reuse the original filters, target, viewAs, credential, and limit. */
770
+ sessionId?: string;
771
+ /** Opaque cursor returned by nextCursor. Never substitute an update cursor. */
772
+ cursor?: string;
773
+ }
774
+
775
+ /** Common filters and viewing context for main feeds and author feeds. */
776
+ export interface MobileSocialFeedCategorizedParams
777
+ extends MobileSocialFeedListParams, MobileSocialFeedReadParams {
778
+ /** Omit to include all market categories. */
779
+ marketCategory?: MobileSocialFeedMarketCategory;
780
+ }
781
+
782
+ /** For You request with optional market category and viewing account. */
783
+ export type GetMobileForYouFeedParams = MobileSocialFeedCategorizedParams;
784
+
785
+ /** Top Traders request; eligibility uses account PnL and results remain chronological. */
786
+ export type GetMobileTopTradersFeedParams = MobileSocialFeedCategorizedParams;
787
+
788
+ /** Public content from the selected account's follow graph; no signature is required. */
789
+ export type GetMobileFriendsFeedParams = MobileSocialFeedCategorizedParams & {
790
+ /** Required on every request, including pagination; no existing identity row is needed. */
791
+ viewAs: Subaccount;
792
+ };
793
+
794
+ /** Author list request; the target is distinct from the viewing account. */
795
+ export type GetMobileProfileFeedParams = MobileSocialFeedCategorizedParams & {
796
+ /** Target author, independent of the viewAs account. */
797
+ subaccount: Subaccount;
798
+ };
799
+
800
+ /** Market list request; marketCategory is not accepted. */
801
+ export type GetMobileMarketFeedParams = MobileSocialFeedListParams &
802
+ MobileSocialFeedReadParams & {
803
+ /** Non-negative target product ID. */
804
+ productId: number;
805
+ };
806
+
807
+ /** Published content in a lifecycle, not the complete position history. */
808
+ export type GetMobilePositionFeedParams = MobileSocialFeedListParams &
809
+ MobileSocialFeedReadParams & {
810
+ /** Target position UUID. */
811
+ positionId: string;
812
+ };
813
+
814
+ /** Item request; omit sessionId to create an item reading session directly. */
815
+ export type GetMobileFeedItemParams = MobileSocialFeedReadParams & {
816
+ /** Target item UUID. */
817
+ itemId: string;
818
+ /** Preview size, 0–3. */
819
+ commentPreviewLimit?: number;
820
+ /** Existing session authorized for the item. */
821
+ sessionId?: string;
822
+ };
823
+
824
+ /** Viewport update request; requires the original viewerToken. */
825
+ export type GetMobileFeedUpdatesParams = {
826
+ /** Inherited from the original session; updates cannot select a different viewing account. */
827
+ viewAs?: never;
828
+ /** Current reading session. */
829
+ sessionId: string;
830
+ /** Up to 50 distinct, already delivered item UUIDs. */
831
+ visibleItemIds: string[];
832
+ /** Up to 20 distinct, authorized position UUIDs. */
833
+ visiblePositionIds: string[];
834
+ /** Baseline from the last accepted update; omit for a changed viewport. */
835
+ updateCursor?: string | null;
836
+ /** Increment whenever the visible set changes. */
837
+ viewportRevision: number;
838
+ /** Increment on every request within the session, including after viewport changes; never reset for a new viewport. */
839
+ requestSeq: number;
840
+ /** Credential belonging to the original public session. */
841
+ viewerToken: string;
842
+ };
@@ -32,6 +32,18 @@ export const MOBILE_ERROR_CODES = {
32
32
  INVALID_FEED_FILTER: 6300,
33
33
  /** Feed cursor is malformed or bound to a different filter. Discard it and restart from the first page. */
34
34
  INVALID_FEED_CURSOR: 6301,
35
+ /** Invalid social feed parameters, including missing fields, invalid types/formats, filters, or Content-Type. */
36
+ INVALID_SOCIAL_FEED_PARAMS: 6310,
37
+ /** Session, credential, viewing account, cursor, source, or viewport mismatch; also a request sequence or viewport revision rollback. */
38
+ SOCIAL_FEED_SESSION_MISMATCH: 6311,
39
+ /** Reading session or browsing credential is expired, missing, or incompatible; create a new session. */
40
+ SOCIAL_FEED_SESSION_EXPIRED: 6312,
41
+ /** Content does not exist or is not currently accessible. */
42
+ SOCIAL_FEED_CONTENT_UNAVAILABLE: 6313,
43
+ /** Required authoritative position, action, cohort, or market data is unavailable. */
44
+ SOCIAL_FEED_DATA_UNAVAILABLE: 6320,
45
+ /** Feed reads are only available through public_query. */
46
+ SOCIAL_FEED_QUERY_REMOVED: 6325,
35
47
  } as const;
36
48
 
37
49
  /**