@liberfi.io/ui-predict 0.1.124 → 0.1.126
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 +122 -16
- package/dist/index.d.ts +122 -16
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ declare global {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
declare const _default: "0.1.
|
|
16
|
+
declare const _default: "0.1.126";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* A single category entry in the static navigation model.
|
|
@@ -262,15 +262,29 @@ interface TradeFormValidation {
|
|
|
262
262
|
isValid: boolean;
|
|
263
263
|
errors: string[];
|
|
264
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
|
+
|
|
265
281
|
interface UseTradeFormParams {
|
|
266
282
|
market: PredictMarket;
|
|
267
283
|
chain?: string;
|
|
268
284
|
initialOutcome?: TradeOutcome;
|
|
269
|
-
initialSide?: TradeSide;
|
|
270
285
|
}
|
|
271
286
|
interface UseTradeFormResult {
|
|
272
287
|
outcome: TradeOutcome;
|
|
273
|
-
side: TradeSide;
|
|
274
288
|
orderType: OrderType;
|
|
275
289
|
quantity: number;
|
|
276
290
|
limitPrice: number;
|
|
@@ -279,8 +293,6 @@ interface UseTradeFormResult {
|
|
|
279
293
|
potentialPayout: number;
|
|
280
294
|
potentialProfit: number;
|
|
281
295
|
usdcBalance: number | null;
|
|
282
|
-
yesTokenBalance: number | null;
|
|
283
|
-
noTokenBalance: number | null;
|
|
284
296
|
isBalanceLoading: boolean;
|
|
285
297
|
isSubmitting: boolean;
|
|
286
298
|
validation: TradeFormValidation;
|
|
@@ -288,7 +300,6 @@ interface UseTradeFormResult {
|
|
|
288
300
|
kycRequired: boolean;
|
|
289
301
|
kycUrl: string | null;
|
|
290
302
|
setOutcome: (outcome: TradeOutcome) => void;
|
|
291
|
-
setSide: (side: TradeSide) => void;
|
|
292
303
|
setOrderType: (type: OrderType) => void;
|
|
293
304
|
expirationEnabled: boolean;
|
|
294
305
|
expirationPreset: ExpirationPreset;
|
|
@@ -302,7 +313,7 @@ interface UseTradeFormResult {
|
|
|
302
313
|
setCustomDurationUnit: (u: DurationUnit) => void;
|
|
303
314
|
submit: () => void;
|
|
304
315
|
}
|
|
305
|
-
declare function useTradeForm({ market, initialOutcome,
|
|
316
|
+
declare function useTradeForm({ market, initialOutcome, }: UseTradeFormParams): UseTradeFormResult;
|
|
306
317
|
|
|
307
318
|
interface EventDetailUIProps {
|
|
308
319
|
event: PredictEvent;
|
|
@@ -423,7 +434,6 @@ type PredictTradeModalParams = {
|
|
|
423
434
|
event: PredictEvent;
|
|
424
435
|
market: PredictMarket;
|
|
425
436
|
initialOutcome?: TradeOutcome;
|
|
426
|
-
initialSide?: TradeSide;
|
|
427
437
|
chain?: string;
|
|
428
438
|
};
|
|
429
439
|
type PredictTradeModalResult = void;
|
|
@@ -455,7 +465,6 @@ interface TradeFormUIProps {
|
|
|
455
465
|
/** "bordered" (default) renders with border + rounded container; "flat" omits border (e.g. inside a modal). */
|
|
456
466
|
variant?: "bordered" | "flat";
|
|
457
467
|
outcome: TradeOutcome;
|
|
458
|
-
side: TradeSide;
|
|
459
468
|
orderType: OrderType;
|
|
460
469
|
quantity: number;
|
|
461
470
|
limitPrice: number;
|
|
@@ -465,8 +474,6 @@ interface TradeFormUIProps {
|
|
|
465
474
|
potentialProfit: number;
|
|
466
475
|
isSubmitting: boolean;
|
|
467
476
|
usdcBalance: number | null;
|
|
468
|
-
yesTokenBalance: number | null;
|
|
469
|
-
noTokenBalance: number | null;
|
|
470
477
|
isBalanceLoading: boolean;
|
|
471
478
|
isValid: boolean;
|
|
472
479
|
validationErrors: string[];
|
|
@@ -478,7 +485,6 @@ interface TradeFormUIProps {
|
|
|
478
485
|
customDuration: number;
|
|
479
486
|
customDurationUnit: DurationUnit;
|
|
480
487
|
onOutcomeChange: (outcome: TradeOutcome) => void;
|
|
481
|
-
onSideChange: (side: TradeSide) => void;
|
|
482
488
|
onOrderTypeChange: (type: OrderType) => void;
|
|
483
489
|
onQuantityChange: (quantity: number) => void;
|
|
484
490
|
onLimitPriceChange: (price: number) => void;
|
|
@@ -488,17 +494,117 @@ interface TradeFormUIProps {
|
|
|
488
494
|
onCustomDurationUnitChange: (u: DurationUnit) => void;
|
|
489
495
|
onSubmit: () => void;
|
|
490
496
|
}
|
|
491
|
-
declare function TradeFormUI({ event, market, variant, outcome,
|
|
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;
|
|
492
498
|
|
|
493
499
|
interface TradeFormWidgetProps {
|
|
494
500
|
event?: PredictEvent;
|
|
495
501
|
market: PredictMarket;
|
|
496
502
|
variant?: "bordered" | "flat";
|
|
497
|
-
initialSide?: TradeSide;
|
|
498
503
|
initialOutcome?: TradeOutcome;
|
|
499
504
|
chain?: string;
|
|
500
505
|
}
|
|
501
|
-
declare function TradeFormWidget({ event, market, variant,
|
|
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;
|
|
502
608
|
|
|
503
609
|
interface CategoryItem {
|
|
504
610
|
category: string;
|
|
@@ -893,4 +999,4 @@ type PredictWalletProviderProps = PropsWithChildren<{
|
|
|
893
999
|
}>;
|
|
894
1000
|
declare function PredictWalletProvider({ pollingInterval, enabled, children, }: PredictWalletProviderProps): react_jsx_runtime.JSX.Element;
|
|
895
1001
|
|
|
896
|
-
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.
|
|
16
|
+
declare const _default: "0.1.126";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* A single category entry in the static navigation model.
|
|
@@ -262,15 +262,29 @@ interface TradeFormValidation {
|
|
|
262
262
|
isValid: boolean;
|
|
263
263
|
errors: string[];
|
|
264
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
|
+
|
|
265
281
|
interface UseTradeFormParams {
|
|
266
282
|
market: PredictMarket;
|
|
267
283
|
chain?: string;
|
|
268
284
|
initialOutcome?: TradeOutcome;
|
|
269
|
-
initialSide?: TradeSide;
|
|
270
285
|
}
|
|
271
286
|
interface UseTradeFormResult {
|
|
272
287
|
outcome: TradeOutcome;
|
|
273
|
-
side: TradeSide;
|
|
274
288
|
orderType: OrderType;
|
|
275
289
|
quantity: number;
|
|
276
290
|
limitPrice: number;
|
|
@@ -279,8 +293,6 @@ interface UseTradeFormResult {
|
|
|
279
293
|
potentialPayout: number;
|
|
280
294
|
potentialProfit: number;
|
|
281
295
|
usdcBalance: number | null;
|
|
282
|
-
yesTokenBalance: number | null;
|
|
283
|
-
noTokenBalance: number | null;
|
|
284
296
|
isBalanceLoading: boolean;
|
|
285
297
|
isSubmitting: boolean;
|
|
286
298
|
validation: TradeFormValidation;
|
|
@@ -288,7 +300,6 @@ interface UseTradeFormResult {
|
|
|
288
300
|
kycRequired: boolean;
|
|
289
301
|
kycUrl: string | null;
|
|
290
302
|
setOutcome: (outcome: TradeOutcome) => void;
|
|
291
|
-
setSide: (side: TradeSide) => void;
|
|
292
303
|
setOrderType: (type: OrderType) => void;
|
|
293
304
|
expirationEnabled: boolean;
|
|
294
305
|
expirationPreset: ExpirationPreset;
|
|
@@ -302,7 +313,7 @@ interface UseTradeFormResult {
|
|
|
302
313
|
setCustomDurationUnit: (u: DurationUnit) => void;
|
|
303
314
|
submit: () => void;
|
|
304
315
|
}
|
|
305
|
-
declare function useTradeForm({ market, initialOutcome,
|
|
316
|
+
declare function useTradeForm({ market, initialOutcome, }: UseTradeFormParams): UseTradeFormResult;
|
|
306
317
|
|
|
307
318
|
interface EventDetailUIProps {
|
|
308
319
|
event: PredictEvent;
|
|
@@ -423,7 +434,6 @@ type PredictTradeModalParams = {
|
|
|
423
434
|
event: PredictEvent;
|
|
424
435
|
market: PredictMarket;
|
|
425
436
|
initialOutcome?: TradeOutcome;
|
|
426
|
-
initialSide?: TradeSide;
|
|
427
437
|
chain?: string;
|
|
428
438
|
};
|
|
429
439
|
type PredictTradeModalResult = void;
|
|
@@ -455,7 +465,6 @@ interface TradeFormUIProps {
|
|
|
455
465
|
/** "bordered" (default) renders with border + rounded container; "flat" omits border (e.g. inside a modal). */
|
|
456
466
|
variant?: "bordered" | "flat";
|
|
457
467
|
outcome: TradeOutcome;
|
|
458
|
-
side: TradeSide;
|
|
459
468
|
orderType: OrderType;
|
|
460
469
|
quantity: number;
|
|
461
470
|
limitPrice: number;
|
|
@@ -465,8 +474,6 @@ interface TradeFormUIProps {
|
|
|
465
474
|
potentialProfit: number;
|
|
466
475
|
isSubmitting: boolean;
|
|
467
476
|
usdcBalance: number | null;
|
|
468
|
-
yesTokenBalance: number | null;
|
|
469
|
-
noTokenBalance: number | null;
|
|
470
477
|
isBalanceLoading: boolean;
|
|
471
478
|
isValid: boolean;
|
|
472
479
|
validationErrors: string[];
|
|
@@ -478,7 +485,6 @@ interface TradeFormUIProps {
|
|
|
478
485
|
customDuration: number;
|
|
479
486
|
customDurationUnit: DurationUnit;
|
|
480
487
|
onOutcomeChange: (outcome: TradeOutcome) => void;
|
|
481
|
-
onSideChange: (side: TradeSide) => void;
|
|
482
488
|
onOrderTypeChange: (type: OrderType) => void;
|
|
483
489
|
onQuantityChange: (quantity: number) => void;
|
|
484
490
|
onLimitPriceChange: (price: number) => void;
|
|
@@ -488,17 +494,117 @@ interface TradeFormUIProps {
|
|
|
488
494
|
onCustomDurationUnitChange: (u: DurationUnit) => void;
|
|
489
495
|
onSubmit: () => void;
|
|
490
496
|
}
|
|
491
|
-
declare function TradeFormUI({ event, market, variant, outcome,
|
|
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;
|
|
492
498
|
|
|
493
499
|
interface TradeFormWidgetProps {
|
|
494
500
|
event?: PredictEvent;
|
|
495
501
|
market: PredictMarket;
|
|
496
502
|
variant?: "bordered" | "flat";
|
|
497
|
-
initialSide?: TradeSide;
|
|
498
503
|
initialOutcome?: TradeOutcome;
|
|
499
504
|
chain?: string;
|
|
500
505
|
}
|
|
501
|
-
declare function TradeFormWidget({ event, market, variant,
|
|
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;
|
|
502
608
|
|
|
503
609
|
interface CategoryItem {
|
|
504
610
|
category: string;
|
|
@@ -893,4 +999,4 @@ type PredictWalletProviderProps = PropsWithChildren<{
|
|
|
893
999
|
}>;
|
|
894
1000
|
declare function PredictWalletProvider({ pollingInterval, enabled, children, }: PredictWalletProviderProps): react_jsx_runtime.JSX.Element;
|
|
895
1001
|
|
|
896
|
-
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 };
|