@@ -42,29 +42,34 @@ export type PerpsClosePositionModalsNavigationParamList = {
4242 PerpsTooltip : PerpsTooltipViewRouteParams ;
4343} ;
4444
45+ /** Shared order / redesigned-confirmation params for the Perps trade flow. */
46+ // Object-literal type (not interface) so it retains an implicit index signature
47+ // and stays assignable to `Record<string, unknown>` (e.g. redirect params).
48+ export interface PerpsOrderRouteParams {
49+ direction : 'long' | 'short' ;
50+ asset : string ;
51+ defaultSzDecimals ?: number ;
52+ defaultMaxLeverage ?: number ;
53+ leverage ?: number ;
54+ amount ?: string ;
55+ price ?: string ;
56+ orderType ?: OrderType ;
57+ existingPosition ?: Position ; // Pass existing position for leverage consistency when adding to position
58+ hideTPSL ?: boolean ; // Hide TP/SL row when modifying existing position
59+ /** When false, confirmation screen uses header: () => null; when true/undefined uses headerLeft/title options */
60+ showPerpsHeader ?: boolean ;
61+ /** Analytics: how the user got to the order screen (e.g. trade_action, order_book_long_button, asset_detail_screen) */
62+ source ?: string ;
63+ /** Analytics: chart library active when the order flow started */
64+ chartLibrary ?: string ;
65+ transactionActiveAbTests ?: TransactionActiveAbTestEntry [ ] ;
66+ }
67+
4568// ParamListBase requires `type`; `interface` cannot satisfy it.
4669// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
4770export type PerpsStackParamList = {
4871 // Order flow routes
49- PerpsOrder : {
50- direction : 'long' | 'short' ;
51- asset : string ;
52- defaultSzDecimals ?: number ;
53- defaultMaxLeverage ?: number ;
54- leverage ?: number ;
55- amount ?: string ;
56- price ?: string ;
57- orderType ?: OrderType ;
58- existingPosition ?: Position ; // Pass existing position for leverage consistency when adding to position
59- hideTPSL ?: boolean ; // Hide TP/SL row when modifying existing position
60- /** When false, confirmation screen uses header: () => null; when true/undefined uses headerLeft/title options */
61- showPerpsHeader ?: boolean ;
62- /** Analytics: how the user got to the order screen (e.g. trade_action, order_book_long_button, asset_detail_screen) */
63- source ?: string ;
64- /** Analytics: chart library active when the order flow started */
65- chartLibrary ?: string ;
66- transactionActiveAbTests ?: TransactionActiveAbTestEntry [ ] ;
67- } ;
72+ PerpsOrder : PerpsOrderRouteParams ;
6873
6974 PerpsOrderSuccess : {
7075 orderId : string ;
@@ -108,24 +113,27 @@ export type PerpsStackParamList = {
108113 // Market and position management routes
109114 PerpsMarketList : undefined ;
110115
111- PerpsMarketListView : {
112- source ?: string ;
113- variant ?: 'full' | 'minimal' ;
114- title ?: string ;
115- showBalanceActions ?: boolean ;
116- showBottomNav ?: boolean ;
117- showWatchlistOnly ?: boolean ;
118- defaultMarketTypeFilter ?: MarketTypeFilter ;
119- defaultSortOptionId ?: SortOptionId ;
120- defaultSortDirection ?: SortDirection ;
121- fromHome ?: boolean ;
122- button_clicked ?: string ;
123- button_location ?: string ;
124- transactionActiveAbTests ?: TransactionActiveAbTestEntry [ ] ;
125- } ;
116+ PerpsMarketListView :
117+ | {
118+ source ?: string ;
119+ variant ?: 'full' | 'minimal' ;
120+ title ?: string ;
121+ showBalanceActions ?: boolean ;
122+ showBottomNav ?: boolean ;
123+ showWatchlistOnly ?: boolean ;
124+ defaultMarketTypeFilter ?: MarketTypeFilter ;
125+ defaultSortOptionId ?: SortOptionId ;
126+ defaultSortDirection ?: SortDirection ;
127+ fromHome ?: boolean ;
128+ button_clicked ?: string ;
129+ button_location ?: string ;
130+ transactionActiveAbTests ?: TransactionActiveAbTestEntry [ ] ;
131+ }
132+ | undefined ;
126133
127134 PerpsMarketDetails : {
128- market : PerpsMarketData ;
135+ /** Full market when available; Partial is accepted for trade-details deep entries. */
136+ market : PerpsMarketData | Partial < PerpsMarketData > ;
129137 initialTab ?: 'position' | 'orders' | 'info' ;
130138 monitoringIntent ?: Partial < DataMonitorParams > ;
131139 source ?: string ;
@@ -190,16 +198,18 @@ export type PerpsStackParamList = {
190198 transaction : PerpsTransaction ;
191199 } ;
192200
193- PerpsTutorial : {
194- isFromDeeplink ?: boolean ;
195- isFromGTMModal ?: boolean ;
196- /** Analytics: how the user got to the tutorial (e.g. homescreen_tab, main_action_button) */
197- source ?: string ;
198- /** Screen to navigate to after tutorial completion instead of the default PerpsHome */
199- redirectScreen ?: string ;
200- /** Params to pass to the redirect screen */
201- redirectParams ?: Record < string , unknown > ;
202- } ;
201+ PerpsTutorial :
202+ | {
203+ isFromDeeplink ?: boolean ;
204+ isFromGTMModal ?: boolean ;
205+ /** Analytics: how the user got to the tutorial (e.g. homescreen_tab, main_action_button) */
206+ source ?: string ;
207+ /** Screen to navigate to after tutorial completion instead of the default PerpsHome */
208+ redirectScreen ?: string ;
209+ /** Params to pass to the redirect screen */
210+ redirectParams ?: Record < string , unknown > ;
211+ }
212+ | undefined ;
203213
204214 // TP/SL screen
205215 PerpsTPSL : {
@@ -230,6 +240,7 @@ export type PerpsStackParamList = {
230240 PerpsPnlHeroCard : {
231241 position : Position ;
232242 marketPrice ?: string ;
243+ source ?: string ;
233244 } ;
234245
235246 // Order Book view - Full depth order book display
@@ -255,10 +266,11 @@ export type PerpsStackParamList = {
255266 showBackButton ?: boolean ;
256267 } ;
257268
258- /** Params for RedesignedConfirmations when shown in Perps stack (header options) */
259- RedesignedConfirmations : {
260- showPerpsHeader ?: boolean ;
261- } ;
269+ /**
270+ * Params for RedesignedConfirmations when opened from Perps order flow.
271+ * Partial so header-option helpers can take only `showPerpsHeader`.
272+ */
273+ RedesignedConfirmations : Partial < PerpsOrderRouteParams > | undefined ;
262274
263275 /** Params for PerpsOrderRedirect - handles one-click trade from token details */
264276 PerpsOrderRedirect : {
@@ -270,21 +282,23 @@ export type PerpsStackParamList = {
270282 } ;
271283
272284 // Screen names registered in the Perps stack (may differ from legacy aliases above)
273- PerpsTrendingView : {
274- source ?: string ;
275- variant ?: 'full' | 'minimal' ;
276- title ?: string ;
277- showBalanceActions ?: boolean ;
278- showBottomNav ?: boolean ;
279- showWatchlistOnly ?: boolean ;
280- defaultMarketTypeFilter ?: MarketTypeFilter ;
281- defaultSortOptionId ?: SortOptionId ;
282- defaultSortDirection ?: SortDirection ;
283- fromHome ?: boolean ;
284- button_clicked ?: string ;
285- button_location ?: string ;
286- transactionActiveAbTests ?: TransactionActiveAbTestEntry [ ] ;
287- } ;
285+ PerpsTrendingView :
286+ | {
287+ source ?: string ;
288+ variant ?: 'full' | 'minimal' ;
289+ title ?: string ;
290+ showBalanceActions ?: boolean ;
291+ showBottomNav ?: boolean ;
292+ showWatchlistOnly ?: boolean ;
293+ defaultMarketTypeFilter ?: MarketTypeFilter ;
294+ defaultSortOptionId ?: SortOptionId ;
295+ defaultSortDirection ?: SortDirection ;
296+ fromHome ?: boolean ;
297+ button_clicked ?: string ;
298+ button_location ?: string ;
299+ transactionActiveAbTests ?: TransactionActiveAbTestEntry [ ] ;
300+ }
301+ | undefined ;
288302 PerpsOrderDetailsView : {
289303 order : Order ;
290304 action ?: 'view' | 'edit' | 'cancel' ;
0 commit comments