@liberfi.io/ui-predict 0.1.123 → 0.1.125

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/index.d.mts CHANGED
@@ -13,7 +13,7 @@ declare global {
13
13
  };
14
14
  }
15
15
  }
16
- declare const _default: "0.1.123";
16
+ declare const _default: "0.1.125";
17
17
 
18
18
  /**
19
19
  * A single category entry in the static navigation model.
@@ -159,6 +159,8 @@ interface EventsWidgetProps {
159
159
  minVolume?: string;
160
160
  /** Client-side minimum liquidity filter (USD string, e.g. "10000"). */
161
161
  minLiquidity?: string;
162
+ /** Max markets per event (sorted by volume DESC). Default: 3. */
163
+ markets_limit?: number;
162
164
  /** Callback when an event card is selected */
163
165
  onSelect?: (event: PredictEvent) => void;
164
166
  /** Callback when an outcome button (yes/no) is pressed */
@@ -170,7 +172,7 @@ interface EventsWidgetProps {
170
172
  /** Called when a card is hovered (for data prefetching). */
171
173
  onHover?: (event: PredictEvent) => void;
172
174
  }
173
- declare function EventsWidget({ tagSlugSelection, limit, status, sort_by, sort_asc, source, with_markets, timeRemaining, minVolume, minLiquidity, onSelect, onSelectOutcome, getEventHref, LinkComponent, onHover, }: EventsWidgetProps): react_jsx_runtime.JSX.Element;
175
+ declare function EventsWidget({ tagSlugSelection, limit, status, sort_by, sort_asc, source, with_markets, timeRemaining, minVolume, minLiquidity, markets_limit, onSelect, onSelectOutcome, getEventHref, LinkComponent, onHover, }: EventsWidgetProps): react_jsx_runtime.JSX.Element;
174
176
 
175
177
  /** Parameters for useEventsInfinite */
176
178
  type UseEventsInfiniteParams = ResolveEventsParamsInput;
@@ -260,15 +262,29 @@ interface TradeFormValidation {
260
262
  isValid: boolean;
261
263
  errors: string[];
262
264
  }
265
+ declare function resolveExpiration(preset: ExpirationPreset, customDuration: number, customDurationUnit: DurationUnit): number;
266
+ /**
267
+ * Round a price to the nearest tick-size boundary (e.g. 0.01, 0.1).
268
+ */
269
+ declare function roundToTickSize(price: number, tickSize: string): number;
270
+ /**
271
+ * Floor a number to the given number of decimal places (never rounds up).
272
+ */
273
+ declare function floorToDecimals(value: number, decimals: number): number;
274
+ /**
275
+ * Parse a Polymarket CLOB API error message into a user-friendly string.
276
+ * Falls back to the raw message (with order-hash stripped) if no pattern matches.
277
+ */
278
+ declare function parsePolymarketError(raw: string, t: (...args: any[]) => string): string;
279
+ declare function fireCelebration(): void;
280
+
263
281
  interface UseTradeFormParams {
264
282
  market: PredictMarket;
265
283
  chain?: string;
266
284
  initialOutcome?: TradeOutcome;
267
- initialSide?: TradeSide;
268
285
  }
269
286
  interface UseTradeFormResult {
270
287
  outcome: TradeOutcome;
271
- side: TradeSide;
272
288
  orderType: OrderType;
273
289
  quantity: number;
274
290
  limitPrice: number;
@@ -277,8 +293,6 @@ interface UseTradeFormResult {
277
293
  potentialPayout: number;
278
294
  potentialProfit: number;
279
295
  usdcBalance: number | null;
280
- yesTokenBalance: number | null;
281
- noTokenBalance: number | null;
282
296
  isBalanceLoading: boolean;
283
297
  isSubmitting: boolean;
284
298
  validation: TradeFormValidation;
@@ -286,7 +300,6 @@ interface UseTradeFormResult {
286
300
  kycRequired: boolean;
287
301
  kycUrl: string | null;
288
302
  setOutcome: (outcome: TradeOutcome) => void;
289
- setSide: (side: TradeSide) => void;
290
303
  setOrderType: (type: OrderType) => void;
291
304
  expirationEnabled: boolean;
292
305
  expirationPreset: ExpirationPreset;
@@ -300,7 +313,7 @@ interface UseTradeFormResult {
300
313
  setCustomDurationUnit: (u: DurationUnit) => void;
301
314
  submit: () => void;
302
315
  }
303
- declare function useTradeForm({ market, initialOutcome, initialSide, }: UseTradeFormParams): UseTradeFormResult;
316
+ declare function useTradeForm({ market, initialOutcome, }: UseTradeFormParams): UseTradeFormResult;
304
317
 
305
318
  interface EventDetailUIProps {
306
319
  event: PredictEvent;
@@ -421,7 +434,6 @@ type PredictTradeModalParams = {
421
434
  event: PredictEvent;
422
435
  market: PredictMarket;
423
436
  initialOutcome?: TradeOutcome;
424
- initialSide?: TradeSide;
425
437
  chain?: string;
426
438
  };
427
439
  type PredictTradeModalResult = void;
@@ -453,7 +465,6 @@ interface TradeFormUIProps {
453
465
  /** "bordered" (default) renders with border + rounded container; "flat" omits border (e.g. inside a modal). */
454
466
  variant?: "bordered" | "flat";
455
467
  outcome: TradeOutcome;
456
- side: TradeSide;
457
468
  orderType: OrderType;
458
469
  quantity: number;
459
470
  limitPrice: number;
@@ -463,8 +474,6 @@ interface TradeFormUIProps {
463
474
  potentialProfit: number;
464
475
  isSubmitting: boolean;
465
476
  usdcBalance: number | null;
466
- yesTokenBalance: number | null;
467
- noTokenBalance: number | null;
468
477
  isBalanceLoading: boolean;
469
478
  isValid: boolean;
470
479
  validationErrors: string[];
@@ -476,7 +485,6 @@ interface TradeFormUIProps {
476
485
  customDuration: number;
477
486
  customDurationUnit: DurationUnit;
478
487
  onOutcomeChange: (outcome: TradeOutcome) => void;
479
- onSideChange: (side: TradeSide) => void;
480
488
  onOrderTypeChange: (type: OrderType) => void;
481
489
  onQuantityChange: (quantity: number) => void;
482
490
  onLimitPriceChange: (price: number) => void;
@@ -486,17 +494,117 @@ interface TradeFormUIProps {
486
494
  onCustomDurationUnitChange: (u: DurationUnit) => void;
487
495
  onSubmit: () => void;
488
496
  }
489
- declare function TradeFormUI({ event, market, variant, outcome, side, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, yesTokenBalance, noTokenBalance, isBalanceLoading, isSubmitting, isValid, validationErrors, supportsLimitOrder, kycRequired, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onSideChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
497
+ declare function TradeFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, isBalanceLoading, isSubmitting, isValid, validationErrors, supportsLimitOrder, kycRequired, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
490
498
 
491
499
  interface TradeFormWidgetProps {
492
500
  event?: PredictEvent;
493
501
  market: PredictMarket;
494
502
  variant?: "bordered" | "flat";
495
- initialSide?: TradeSide;
496
503
  initialOutcome?: TradeOutcome;
497
504
  chain?: string;
498
505
  }
499
- declare function TradeFormWidget({ event, market, variant, initialSide, initialOutcome, chain, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
506
+ declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
507
+
508
+ type PredictSellModalParams = {
509
+ event: PredictEvent;
510
+ market: PredictMarket;
511
+ initialOutcome?: TradeOutcome;
512
+ chain?: string;
513
+ };
514
+ type PredictSellModalResult = void;
515
+ declare const PREDICT_SELL_MODAL_ID = "predict-sell";
516
+ declare function PredictSellModal({ id, }: {
517
+ id?: string;
518
+ }): react_jsx_runtime.JSX.Element;
519
+
520
+ interface UseSellFormParams {
521
+ market: PredictMarket;
522
+ chain?: string;
523
+ /** Fixed outcome — the sell form doesn't offer a YES/NO toggle. */
524
+ initialOutcome?: TradeOutcome;
525
+ }
526
+ interface UseSellFormResult {
527
+ outcome: TradeOutcome;
528
+ orderType: OrderType;
529
+ quantity: number;
530
+ limitPrice: number;
531
+ shares: number;
532
+ estimatedReturn: number;
533
+ isSubmitting: boolean;
534
+ validation: TradeFormValidation;
535
+ supportsLimitOrder: boolean;
536
+ kycRequired: boolean;
537
+ kycUrl: string | null;
538
+ totalShares: number;
539
+ activeOrderShares: number;
540
+ availableShares: number;
541
+ isAvailableLoading: boolean;
542
+ isSellAll: boolean;
543
+ /** Decimal precision for share quantities (e.g. 4 for Polymarket, 6 for DFlow). */
544
+ precision: number;
545
+ expirationEnabled: boolean;
546
+ expirationPreset: ExpirationPreset;
547
+ customDuration: number;
548
+ customDurationUnit: DurationUnit;
549
+ setOutcome: (outcome: TradeOutcome) => void;
550
+ setOrderType: (type: OrderType) => void;
551
+ setQuantity: (quantity: number) => void;
552
+ setLimitPrice: (price: number) => void;
553
+ setSellAll: () => void;
554
+ setExpirationEnabled: (enabled: boolean) => void;
555
+ setExpirationPreset: (preset: ExpirationPreset) => void;
556
+ setCustomDuration: (v: number) => void;
557
+ setCustomDurationUnit: (u: DurationUnit) => void;
558
+ submit: () => void;
559
+ }
560
+ declare function useSellForm({ market, initialOutcome, }: UseSellFormParams): UseSellFormResult;
561
+
562
+ interface SellFormUIProps {
563
+ event?: StandardEvent;
564
+ market: StandardMarket;
565
+ variant?: "bordered" | "flat";
566
+ outcome: TradeOutcome;
567
+ orderType: OrderType;
568
+ quantity: number;
569
+ limitPrice: number;
570
+ estimatedReturn: number;
571
+ isSubmitting: boolean;
572
+ isValid: boolean;
573
+ validationErrors: string[];
574
+ supportsLimitOrder: boolean;
575
+ kycRequired: boolean;
576
+ kycUrl: string | null;
577
+ totalShares: number;
578
+ activeOrderShares: number;
579
+ availableShares: number;
580
+ isAvailableLoading: boolean;
581
+ /** Decimal precision for share quantities (e.g. 4 for Polymarket, 6 for DFlow). */
582
+ precision: number;
583
+ expirationEnabled: boolean;
584
+ expirationPreset: ExpirationPreset;
585
+ customDuration: number;
586
+ customDurationUnit: DurationUnit;
587
+ onOutcomeChange: (outcome: TradeOutcome) => void;
588
+ onOrderTypeChange: (type: OrderType) => void;
589
+ onQuantityChange: (quantity: number) => void;
590
+ onLimitPriceChange: (price: number) => void;
591
+ onSellAll: () => void;
592
+ onExpirationEnabledChange: (enabled: boolean) => void;
593
+ onExpirationPresetChange: (preset: ExpirationPreset) => void;
594
+ onCustomDurationChange: (v: number) => void;
595
+ onCustomDurationUnitChange: (u: DurationUnit) => void;
596
+ onSubmit: () => void;
597
+ }
598
+ declare function SellFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, estimatedReturn, isSubmitting, isValid, validationErrors, supportsLimitOrder, kycRequired, kycUrl, totalShares, activeOrderShares, availableShares, isAvailableLoading, precision, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onSellAll, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: SellFormUIProps): react_jsx_runtime.JSX.Element;
599
+
600
+ interface SellFormWidgetProps {
601
+ event?: PredictEvent;
602
+ market: PredictMarket;
603
+ variant?: "bordered" | "flat";
604
+ initialOutcome?: TradeOutcome;
605
+ chain?: string;
606
+ }
607
+ declare function SellFormWidget({ event, market, variant, initialOutcome, chain, }: SellFormWidgetProps): react_jsx_runtime.JSX.Element;
500
608
 
501
609
  interface CategoryItem {
502
610
  category: string;
@@ -891,4 +999,4 @@ type PredictWalletProviderProps = PropsWithChildren<{
891
999
  }>;
892
1000
  declare function PredictWalletProvider({ pollingInterval, enabled, children, }: PredictWalletProviderProps): react_jsx_runtime.JSX.Element;
893
1001
 
894
- export { CHART_RANGE_DURATION, CHART_RANGE_PERIOD, CHART_RANGE_SAMPLE_INTERVAL, CandlestickPeriod, type CandlestickPeriodType, CategoriesSkeleton, CategoriesUI, type CategoriesUIProps, CategoriesWidget, type CategoriesWidgetProps, type CategoryItem, type CategoryListItem, type CategoryTagItem, ChartRange, type ChartRangeType, DEFAULT_CHART_RANGE, DEFAULT_FILTER_STATE, DEFAULT_PAGE_SIZE, DEFAULT_PRICE_HISTORY_INTERVAL, type DepthLevel, type DepthSlot, type DurationUnit, EventDetailPage, type EventDetailPageProps, EventDetailSkeleton, type EventDetailSkeletonProps, EventDetailUI, type EventDetailUIProps, EventDetailWidget, type EventDetailWidgetProps, EventItem, type EventItemProps, EventMarketDepthChartUI, type EventMarketDepthChartUIProps, EventMarketDetailWidget, type EventMarketDetailWidgetProps, EventPriceChart, type EventPriceChartProps, type EventsFilterState, EventsFilterUI, type EventsFilterUIProps, EventsHero, type EventsHeroProps, EventsPage, type EventsPageProps, EventsPageSkeleton, type EventsPageSkeletonProps, EventsSkeleton, type EventsSkeletonProps, EventsToolbarUI, type EventsToolbarUIProps, EventsUI, type EventsUIProps, EventsWidget, type EventsWidgetProps, type ExpirationPreset, KycModal, type KycModalProps, MAX_PRICE_HISTORY_MARKETS, MatchGroupCard, type MatchGroupCardProps, MatchMarketCard, type MatchMarketCardProps, MatchesFilterBar, type MatchesFilterBarProps, MatchesHero, type MatchesHeroProps, type MatchesHeroStats, MatchesPage, type MatchesPageProps, MatchesStatsBar, type MatchesStatsBarProps, MatchesWidget, type MatchesWidgetProps, type MatchesWidgetRef, ORDER_MAX_PRICE, ORDER_MIN_PRICE, ORDER_MIN_QUANTITY, ORDER_MIN_USDC, ORDER_PRICE_STEP, type OrderType, PREDICT_SEARCH_MODAL_ID, PREDICT_TRADE_MODAL_ID, PRICE_HISTORY_SAMPLE_INTERVAL, PredictSearchModal, type PredictSearchModalParams, type PredictSearchModalResult, PredictTradeModal, type PredictTradeModalParams, type PredictTradeModalResult, type PredictWalletContextValue, PredictWalletProvider, type PredictWalletProviderProps, PriceHistoryInterval, type PriceHistoryIntervalType, ProfilePage, type ProfilePageProps, SORT_PRESETS, STATIC_CATEGORIES, SearchEventsButton, type SearchEventsButtonProps, SearchHistoryUI, type SearchHistoryUIProps, SearchHistoryWidget, type SearchHistoryWidgetProps, SearchInputUI, type SearchInputUIProps, SearchResultItemUI, type SearchResultItemUIProps, SearchResultListWidget, type SearchResultListWidgetProps, SearchWidget, type SearchWidgetProps, SetupModal, type SetupModalProps, SimilarEventCard, type SimilarEventCardProps, SimilarEventsSection, type SimilarEventsSectionProps, type SortPreset, SourceBadge, type SourceBadgeProps, SpreadIndicator, type SpreadIndicatorProps, type TagItem, type TagSlugSelection, TradeFormSkeleton, TradeFormUI, type TradeFormUIProps, type TradeFormValidation, TradeFormWidget, type TradeFormWidgetProps, type TradeOutcome, type TradeSide, type UseEventDetailParams, type UseEventsInfiniteParams, type UseEventsInfiniteResult, type UseSearchResultListScriptParams, type UseSearchScriptParams, type UseTradeFormParams, type UseTradeFormResult, UserActivitySection, type UserActivitySectionProps, countActiveFilters, formatKMB, getSourceMeta, useEventDetail, useEventsInfinite, usePredictSearchHistory, usePredictWallet, useSearchResultListScript, useSearchScript, useTradeForm, _default as version };
1002
+ export { CHART_RANGE_DURATION, CHART_RANGE_PERIOD, CHART_RANGE_SAMPLE_INTERVAL, CandlestickPeriod, type CandlestickPeriodType, CategoriesSkeleton, CategoriesUI, type CategoriesUIProps, CategoriesWidget, type CategoriesWidgetProps, type CategoryItem, type CategoryListItem, type CategoryTagItem, ChartRange, type ChartRangeType, DEFAULT_CHART_RANGE, DEFAULT_FILTER_STATE, DEFAULT_PAGE_SIZE, DEFAULT_PRICE_HISTORY_INTERVAL, type DepthLevel, type DepthSlot, type DurationUnit, EventDetailPage, type EventDetailPageProps, EventDetailSkeleton, type EventDetailSkeletonProps, EventDetailUI, type EventDetailUIProps, EventDetailWidget, type EventDetailWidgetProps, EventItem, type EventItemProps, EventMarketDepthChartUI, type EventMarketDepthChartUIProps, EventMarketDetailWidget, type EventMarketDetailWidgetProps, EventPriceChart, type EventPriceChartProps, type EventsFilterState, EventsFilterUI, type EventsFilterUIProps, EventsHero, type EventsHeroProps, EventsPage, type EventsPageProps, EventsPageSkeleton, type EventsPageSkeletonProps, EventsSkeleton, type EventsSkeletonProps, EventsToolbarUI, type EventsToolbarUIProps, EventsUI, type EventsUIProps, EventsWidget, type EventsWidgetProps, type ExpirationPreset, KycModal, type KycModalProps, MAX_PRICE_HISTORY_MARKETS, MatchGroupCard, type MatchGroupCardProps, MatchMarketCard, type MatchMarketCardProps, MatchesFilterBar, type MatchesFilterBarProps, MatchesHero, type MatchesHeroProps, type MatchesHeroStats, MatchesPage, type MatchesPageProps, MatchesStatsBar, type MatchesStatsBarProps, MatchesWidget, type MatchesWidgetProps, type MatchesWidgetRef, ORDER_MAX_PRICE, ORDER_MIN_PRICE, ORDER_MIN_QUANTITY, ORDER_MIN_USDC, ORDER_PRICE_STEP, type OrderType, PREDICT_SEARCH_MODAL_ID, PREDICT_SELL_MODAL_ID, PREDICT_TRADE_MODAL_ID, PRICE_HISTORY_SAMPLE_INTERVAL, PredictSearchModal, type PredictSearchModalParams, type PredictSearchModalResult, PredictSellModal, type PredictSellModalParams, type PredictSellModalResult, PredictTradeModal, type PredictTradeModalParams, type PredictTradeModalResult, type PredictWalletContextValue, PredictWalletProvider, type PredictWalletProviderProps, PriceHistoryInterval, type PriceHistoryIntervalType, ProfilePage, type ProfilePageProps, SORT_PRESETS, STATIC_CATEGORIES, SearchEventsButton, type SearchEventsButtonProps, SearchHistoryUI, type SearchHistoryUIProps, SearchHistoryWidget, type SearchHistoryWidgetProps, SearchInputUI, type SearchInputUIProps, SearchResultItemUI, type SearchResultItemUIProps, SearchResultListWidget, type SearchResultListWidgetProps, SearchWidget, type SearchWidgetProps, SellFormUI, type SellFormUIProps, SellFormWidget, type SellFormWidgetProps, SetupModal, type SetupModalProps, SimilarEventCard, type SimilarEventCardProps, SimilarEventsSection, type SimilarEventsSectionProps, type SortPreset, SourceBadge, type SourceBadgeProps, SpreadIndicator, type SpreadIndicatorProps, type TagItem, type TagSlugSelection, TradeFormSkeleton, TradeFormUI, type TradeFormUIProps, type TradeFormValidation, TradeFormWidget, type TradeFormWidgetProps, type TradeOutcome, type TradeSide, type UseEventDetailParams, type UseEventsInfiniteParams, type UseEventsInfiniteResult, type UseSearchResultListScriptParams, type UseSearchScriptParams, type UseSellFormParams, type UseSellFormResult, type UseTradeFormParams, type UseTradeFormResult, UserActivitySection, type UserActivitySectionProps, countActiveFilters, fireCelebration, floorToDecimals, formatKMB, getSourceMeta, parsePolymarketError, resolveExpiration, roundToTickSize, useEventDetail, useEventsInfinite, usePredictSearchHistory, usePredictWallet, useSearchResultListScript, useSearchScript, useSellForm, useTradeForm, _default as version };
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ declare global {
13
13
  };
14
14
  }
15
15
  }
16
- declare const _default: "0.1.123";
16
+ declare const _default: "0.1.125";
17
17
 
18
18
  /**
19
19
  * A single category entry in the static navigation model.
@@ -159,6 +159,8 @@ interface EventsWidgetProps {
159
159
  minVolume?: string;
160
160
  /** Client-side minimum liquidity filter (USD string, e.g. "10000"). */
161
161
  minLiquidity?: string;
162
+ /** Max markets per event (sorted by volume DESC). Default: 3. */
163
+ markets_limit?: number;
162
164
  /** Callback when an event card is selected */
163
165
  onSelect?: (event: PredictEvent) => void;
164
166
  /** Callback when an outcome button (yes/no) is pressed */
@@ -170,7 +172,7 @@ interface EventsWidgetProps {
170
172
  /** Called when a card is hovered (for data prefetching). */
171
173
  onHover?: (event: PredictEvent) => void;
172
174
  }
173
- declare function EventsWidget({ tagSlugSelection, limit, status, sort_by, sort_asc, source, with_markets, timeRemaining, minVolume, minLiquidity, onSelect, onSelectOutcome, getEventHref, LinkComponent, onHover, }: EventsWidgetProps): react_jsx_runtime.JSX.Element;
175
+ declare function EventsWidget({ tagSlugSelection, limit, status, sort_by, sort_asc, source, with_markets, timeRemaining, minVolume, minLiquidity, markets_limit, onSelect, onSelectOutcome, getEventHref, LinkComponent, onHover, }: EventsWidgetProps): react_jsx_runtime.JSX.Element;
174
176
 
175
177
  /** Parameters for useEventsInfinite */
176
178
  type UseEventsInfiniteParams = ResolveEventsParamsInput;
@@ -260,15 +262,29 @@ interface TradeFormValidation {
260
262
  isValid: boolean;
261
263
  errors: string[];
262
264
  }
265
+ declare function resolveExpiration(preset: ExpirationPreset, customDuration: number, customDurationUnit: DurationUnit): number;
266
+ /**
267
+ * Round a price to the nearest tick-size boundary (e.g. 0.01, 0.1).
268
+ */
269
+ declare function roundToTickSize(price: number, tickSize: string): number;
270
+ /**
271
+ * Floor a number to the given number of decimal places (never rounds up).
272
+ */
273
+ declare function floorToDecimals(value: number, decimals: number): number;
274
+ /**
275
+ * Parse a Polymarket CLOB API error message into a user-friendly string.
276
+ * Falls back to the raw message (with order-hash stripped) if no pattern matches.
277
+ */
278
+ declare function parsePolymarketError(raw: string, t: (...args: any[]) => string): string;
279
+ declare function fireCelebration(): void;
280
+
263
281
  interface UseTradeFormParams {
264
282
  market: PredictMarket;
265
283
  chain?: string;
266
284
  initialOutcome?: TradeOutcome;
267
- initialSide?: TradeSide;
268
285
  }
269
286
  interface UseTradeFormResult {
270
287
  outcome: TradeOutcome;
271
- side: TradeSide;
272
288
  orderType: OrderType;
273
289
  quantity: number;
274
290
  limitPrice: number;
@@ -277,8 +293,6 @@ interface UseTradeFormResult {
277
293
  potentialPayout: number;
278
294
  potentialProfit: number;
279
295
  usdcBalance: number | null;
280
- yesTokenBalance: number | null;
281
- noTokenBalance: number | null;
282
296
  isBalanceLoading: boolean;
283
297
  isSubmitting: boolean;
284
298
  validation: TradeFormValidation;
@@ -286,7 +300,6 @@ interface UseTradeFormResult {
286
300
  kycRequired: boolean;
287
301
  kycUrl: string | null;
288
302
  setOutcome: (outcome: TradeOutcome) => void;
289
- setSide: (side: TradeSide) => void;
290
303
  setOrderType: (type: OrderType) => void;
291
304
  expirationEnabled: boolean;
292
305
  expirationPreset: ExpirationPreset;
@@ -300,7 +313,7 @@ interface UseTradeFormResult {
300
313
  setCustomDurationUnit: (u: DurationUnit) => void;
301
314
  submit: () => void;
302
315
  }
303
- declare function useTradeForm({ market, initialOutcome, initialSide, }: UseTradeFormParams): UseTradeFormResult;
316
+ declare function useTradeForm({ market, initialOutcome, }: UseTradeFormParams): UseTradeFormResult;
304
317
 
305
318
  interface EventDetailUIProps {
306
319
  event: PredictEvent;
@@ -421,7 +434,6 @@ type PredictTradeModalParams = {
421
434
  event: PredictEvent;
422
435
  market: PredictMarket;
423
436
  initialOutcome?: TradeOutcome;
424
- initialSide?: TradeSide;
425
437
  chain?: string;
426
438
  };
427
439
  type PredictTradeModalResult = void;
@@ -453,7 +465,6 @@ interface TradeFormUIProps {
453
465
  /** "bordered" (default) renders with border + rounded container; "flat" omits border (e.g. inside a modal). */
454
466
  variant?: "bordered" | "flat";
455
467
  outcome: TradeOutcome;
456
- side: TradeSide;
457
468
  orderType: OrderType;
458
469
  quantity: number;
459
470
  limitPrice: number;
@@ -463,8 +474,6 @@ interface TradeFormUIProps {
463
474
  potentialProfit: number;
464
475
  isSubmitting: boolean;
465
476
  usdcBalance: number | null;
466
- yesTokenBalance: number | null;
467
- noTokenBalance: number | null;
468
477
  isBalanceLoading: boolean;
469
478
  isValid: boolean;
470
479
  validationErrors: string[];
@@ -476,7 +485,6 @@ interface TradeFormUIProps {
476
485
  customDuration: number;
477
486
  customDurationUnit: DurationUnit;
478
487
  onOutcomeChange: (outcome: TradeOutcome) => void;
479
- onSideChange: (side: TradeSide) => void;
480
488
  onOrderTypeChange: (type: OrderType) => void;
481
489
  onQuantityChange: (quantity: number) => void;
482
490
  onLimitPriceChange: (price: number) => void;
@@ -486,17 +494,117 @@ interface TradeFormUIProps {
486
494
  onCustomDurationUnitChange: (u: DurationUnit) => void;
487
495
  onSubmit: () => void;
488
496
  }
489
- declare function TradeFormUI({ event, market, variant, outcome, side, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, yesTokenBalance, noTokenBalance, isBalanceLoading, isSubmitting, isValid, validationErrors, supportsLimitOrder, kycRequired, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onSideChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
497
+ declare function TradeFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, isBalanceLoading, isSubmitting, isValid, validationErrors, supportsLimitOrder, kycRequired, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
490
498
 
491
499
  interface TradeFormWidgetProps {
492
500
  event?: PredictEvent;
493
501
  market: PredictMarket;
494
502
  variant?: "bordered" | "flat";
495
- initialSide?: TradeSide;
496
503
  initialOutcome?: TradeOutcome;
497
504
  chain?: string;
498
505
  }
499
- declare function TradeFormWidget({ event, market, variant, initialSide, initialOutcome, chain, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
506
+ declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
507
+
508
+ type PredictSellModalParams = {
509
+ event: PredictEvent;
510
+ market: PredictMarket;
511
+ initialOutcome?: TradeOutcome;
512
+ chain?: string;
513
+ };
514
+ type PredictSellModalResult = void;
515
+ declare const PREDICT_SELL_MODAL_ID = "predict-sell";
516
+ declare function PredictSellModal({ id, }: {
517
+ id?: string;
518
+ }): react_jsx_runtime.JSX.Element;
519
+
520
+ interface UseSellFormParams {
521
+ market: PredictMarket;
522
+ chain?: string;
523
+ /** Fixed outcome — the sell form doesn't offer a YES/NO toggle. */
524
+ initialOutcome?: TradeOutcome;
525
+ }
526
+ interface UseSellFormResult {
527
+ outcome: TradeOutcome;
528
+ orderType: OrderType;
529
+ quantity: number;
530
+ limitPrice: number;
531
+ shares: number;
532
+ estimatedReturn: number;
533
+ isSubmitting: boolean;
534
+ validation: TradeFormValidation;
535
+ supportsLimitOrder: boolean;
536
+ kycRequired: boolean;
537
+ kycUrl: string | null;
538
+ totalShares: number;
539
+ activeOrderShares: number;
540
+ availableShares: number;
541
+ isAvailableLoading: boolean;
542
+ isSellAll: boolean;
543
+ /** Decimal precision for share quantities (e.g. 4 for Polymarket, 6 for DFlow). */
544
+ precision: number;
545
+ expirationEnabled: boolean;
546
+ expirationPreset: ExpirationPreset;
547
+ customDuration: number;
548
+ customDurationUnit: DurationUnit;
549
+ setOutcome: (outcome: TradeOutcome) => void;
550
+ setOrderType: (type: OrderType) => void;
551
+ setQuantity: (quantity: number) => void;
552
+ setLimitPrice: (price: number) => void;
553
+ setSellAll: () => void;
554
+ setExpirationEnabled: (enabled: boolean) => void;
555
+ setExpirationPreset: (preset: ExpirationPreset) => void;
556
+ setCustomDuration: (v: number) => void;
557
+ setCustomDurationUnit: (u: DurationUnit) => void;
558
+ submit: () => void;
559
+ }
560
+ declare function useSellForm({ market, initialOutcome, }: UseSellFormParams): UseSellFormResult;
561
+
562
+ interface SellFormUIProps {
563
+ event?: StandardEvent;
564
+ market: StandardMarket;
565
+ variant?: "bordered" | "flat";
566
+ outcome: TradeOutcome;
567
+ orderType: OrderType;
568
+ quantity: number;
569
+ limitPrice: number;
570
+ estimatedReturn: number;
571
+ isSubmitting: boolean;
572
+ isValid: boolean;
573
+ validationErrors: string[];
574
+ supportsLimitOrder: boolean;
575
+ kycRequired: boolean;
576
+ kycUrl: string | null;
577
+ totalShares: number;
578
+ activeOrderShares: number;
579
+ availableShares: number;
580
+ isAvailableLoading: boolean;
581
+ /** Decimal precision for share quantities (e.g. 4 for Polymarket, 6 for DFlow). */
582
+ precision: number;
583
+ expirationEnabled: boolean;
584
+ expirationPreset: ExpirationPreset;
585
+ customDuration: number;
586
+ customDurationUnit: DurationUnit;
587
+ onOutcomeChange: (outcome: TradeOutcome) => void;
588
+ onOrderTypeChange: (type: OrderType) => void;
589
+ onQuantityChange: (quantity: number) => void;
590
+ onLimitPriceChange: (price: number) => void;
591
+ onSellAll: () => void;
592
+ onExpirationEnabledChange: (enabled: boolean) => void;
593
+ onExpirationPresetChange: (preset: ExpirationPreset) => void;
594
+ onCustomDurationChange: (v: number) => void;
595
+ onCustomDurationUnitChange: (u: DurationUnit) => void;
596
+ onSubmit: () => void;
597
+ }
598
+ declare function SellFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, estimatedReturn, isSubmitting, isValid, validationErrors, supportsLimitOrder, kycRequired, kycUrl, totalShares, activeOrderShares, availableShares, isAvailableLoading, precision, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onSellAll, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: SellFormUIProps): react_jsx_runtime.JSX.Element;
599
+
600
+ interface SellFormWidgetProps {
601
+ event?: PredictEvent;
602
+ market: PredictMarket;
603
+ variant?: "bordered" | "flat";
604
+ initialOutcome?: TradeOutcome;
605
+ chain?: string;
606
+ }
607
+ declare function SellFormWidget({ event, market, variant, initialOutcome, chain, }: SellFormWidgetProps): react_jsx_runtime.JSX.Element;
500
608
 
501
609
  interface CategoryItem {
502
610
  category: string;
@@ -891,4 +999,4 @@ type PredictWalletProviderProps = PropsWithChildren<{
891
999
  }>;
892
1000
  declare function PredictWalletProvider({ pollingInterval, enabled, children, }: PredictWalletProviderProps): react_jsx_runtime.JSX.Element;
893
1001
 
894
- export { CHART_RANGE_DURATION, CHART_RANGE_PERIOD, CHART_RANGE_SAMPLE_INTERVAL, CandlestickPeriod, type CandlestickPeriodType, CategoriesSkeleton, CategoriesUI, type CategoriesUIProps, CategoriesWidget, type CategoriesWidgetProps, type CategoryItem, type CategoryListItem, type CategoryTagItem, ChartRange, type ChartRangeType, DEFAULT_CHART_RANGE, DEFAULT_FILTER_STATE, DEFAULT_PAGE_SIZE, DEFAULT_PRICE_HISTORY_INTERVAL, type DepthLevel, type DepthSlot, type DurationUnit, EventDetailPage, type EventDetailPageProps, EventDetailSkeleton, type EventDetailSkeletonProps, EventDetailUI, type EventDetailUIProps, EventDetailWidget, type EventDetailWidgetProps, EventItem, type EventItemProps, EventMarketDepthChartUI, type EventMarketDepthChartUIProps, EventMarketDetailWidget, type EventMarketDetailWidgetProps, EventPriceChart, type EventPriceChartProps, type EventsFilterState, EventsFilterUI, type EventsFilterUIProps, EventsHero, type EventsHeroProps, EventsPage, type EventsPageProps, EventsPageSkeleton, type EventsPageSkeletonProps, EventsSkeleton, type EventsSkeletonProps, EventsToolbarUI, type EventsToolbarUIProps, EventsUI, type EventsUIProps, EventsWidget, type EventsWidgetProps, type ExpirationPreset, KycModal, type KycModalProps, MAX_PRICE_HISTORY_MARKETS, MatchGroupCard, type MatchGroupCardProps, MatchMarketCard, type MatchMarketCardProps, MatchesFilterBar, type MatchesFilterBarProps, MatchesHero, type MatchesHeroProps, type MatchesHeroStats, MatchesPage, type MatchesPageProps, MatchesStatsBar, type MatchesStatsBarProps, MatchesWidget, type MatchesWidgetProps, type MatchesWidgetRef, ORDER_MAX_PRICE, ORDER_MIN_PRICE, ORDER_MIN_QUANTITY, ORDER_MIN_USDC, ORDER_PRICE_STEP, type OrderType, PREDICT_SEARCH_MODAL_ID, PREDICT_TRADE_MODAL_ID, PRICE_HISTORY_SAMPLE_INTERVAL, PredictSearchModal, type PredictSearchModalParams, type PredictSearchModalResult, PredictTradeModal, type PredictTradeModalParams, type PredictTradeModalResult, type PredictWalletContextValue, PredictWalletProvider, type PredictWalletProviderProps, PriceHistoryInterval, type PriceHistoryIntervalType, ProfilePage, type ProfilePageProps, SORT_PRESETS, STATIC_CATEGORIES, SearchEventsButton, type SearchEventsButtonProps, SearchHistoryUI, type SearchHistoryUIProps, SearchHistoryWidget, type SearchHistoryWidgetProps, SearchInputUI, type SearchInputUIProps, SearchResultItemUI, type SearchResultItemUIProps, SearchResultListWidget, type SearchResultListWidgetProps, SearchWidget, type SearchWidgetProps, SetupModal, type SetupModalProps, SimilarEventCard, type SimilarEventCardProps, SimilarEventsSection, type SimilarEventsSectionProps, type SortPreset, SourceBadge, type SourceBadgeProps, SpreadIndicator, type SpreadIndicatorProps, type TagItem, type TagSlugSelection, TradeFormSkeleton, TradeFormUI, type TradeFormUIProps, type TradeFormValidation, TradeFormWidget, type TradeFormWidgetProps, type TradeOutcome, type TradeSide, type UseEventDetailParams, type UseEventsInfiniteParams, type UseEventsInfiniteResult, type UseSearchResultListScriptParams, type UseSearchScriptParams, type UseTradeFormParams, type UseTradeFormResult, UserActivitySection, type UserActivitySectionProps, countActiveFilters, formatKMB, getSourceMeta, useEventDetail, useEventsInfinite, usePredictSearchHistory, usePredictWallet, useSearchResultListScript, useSearchScript, useTradeForm, _default as version };
1002
+ export { CHART_RANGE_DURATION, CHART_RANGE_PERIOD, CHART_RANGE_SAMPLE_INTERVAL, CandlestickPeriod, type CandlestickPeriodType, CategoriesSkeleton, CategoriesUI, type CategoriesUIProps, CategoriesWidget, type CategoriesWidgetProps, type CategoryItem, type CategoryListItem, type CategoryTagItem, ChartRange, type ChartRangeType, DEFAULT_CHART_RANGE, DEFAULT_FILTER_STATE, DEFAULT_PAGE_SIZE, DEFAULT_PRICE_HISTORY_INTERVAL, type DepthLevel, type DepthSlot, type DurationUnit, EventDetailPage, type EventDetailPageProps, EventDetailSkeleton, type EventDetailSkeletonProps, EventDetailUI, type EventDetailUIProps, EventDetailWidget, type EventDetailWidgetProps, EventItem, type EventItemProps, EventMarketDepthChartUI, type EventMarketDepthChartUIProps, EventMarketDetailWidget, type EventMarketDetailWidgetProps, EventPriceChart, type EventPriceChartProps, type EventsFilterState, EventsFilterUI, type EventsFilterUIProps, EventsHero, type EventsHeroProps, EventsPage, type EventsPageProps, EventsPageSkeleton, type EventsPageSkeletonProps, EventsSkeleton, type EventsSkeletonProps, EventsToolbarUI, type EventsToolbarUIProps, EventsUI, type EventsUIProps, EventsWidget, type EventsWidgetProps, type ExpirationPreset, KycModal, type KycModalProps, MAX_PRICE_HISTORY_MARKETS, MatchGroupCard, type MatchGroupCardProps, MatchMarketCard, type MatchMarketCardProps, MatchesFilterBar, type MatchesFilterBarProps, MatchesHero, type MatchesHeroProps, type MatchesHeroStats, MatchesPage, type MatchesPageProps, MatchesStatsBar, type MatchesStatsBarProps, MatchesWidget, type MatchesWidgetProps, type MatchesWidgetRef, ORDER_MAX_PRICE, ORDER_MIN_PRICE, ORDER_MIN_QUANTITY, ORDER_MIN_USDC, ORDER_PRICE_STEP, type OrderType, PREDICT_SEARCH_MODAL_ID, PREDICT_SELL_MODAL_ID, PREDICT_TRADE_MODAL_ID, PRICE_HISTORY_SAMPLE_INTERVAL, PredictSearchModal, type PredictSearchModalParams, type PredictSearchModalResult, PredictSellModal, type PredictSellModalParams, type PredictSellModalResult, PredictTradeModal, type PredictTradeModalParams, type PredictTradeModalResult, type PredictWalletContextValue, PredictWalletProvider, type PredictWalletProviderProps, PriceHistoryInterval, type PriceHistoryIntervalType, ProfilePage, type ProfilePageProps, SORT_PRESETS, STATIC_CATEGORIES, SearchEventsButton, type SearchEventsButtonProps, SearchHistoryUI, type SearchHistoryUIProps, SearchHistoryWidget, type SearchHistoryWidgetProps, SearchInputUI, type SearchInputUIProps, SearchResultItemUI, type SearchResultItemUIProps, SearchResultListWidget, type SearchResultListWidgetProps, SearchWidget, type SearchWidgetProps, SellFormUI, type SellFormUIProps, SellFormWidget, type SellFormWidgetProps, SetupModal, type SetupModalProps, SimilarEventCard, type SimilarEventCardProps, SimilarEventsSection, type SimilarEventsSectionProps, type SortPreset, SourceBadge, type SourceBadgeProps, SpreadIndicator, type SpreadIndicatorProps, type TagItem, type TagSlugSelection, TradeFormSkeleton, TradeFormUI, type TradeFormUIProps, type TradeFormValidation, TradeFormWidget, type TradeFormWidgetProps, type TradeOutcome, type TradeSide, type UseEventDetailParams, type UseEventsInfiniteParams, type UseEventsInfiniteResult, type UseSearchResultListScriptParams, type UseSearchScriptParams, type UseSellFormParams, type UseSellFormResult, type UseTradeFormParams, type UseTradeFormResult, UserActivitySection, type UserActivitySectionProps, countActiveFilters, fireCelebration, floorToDecimals, formatKMB, getSourceMeta, parsePolymarketError, resolveExpiration, roundToTickSize, useEventDetail, useEventsInfinite, usePredictSearchHistory, usePredictWallet, useSearchResultListScript, useSearchScript, useSellForm, useTradeForm, _default as version };