@liberfi.io/ui-predict 4.0.37 → 4.0.39
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 +72 -7
- package/dist/index.d.ts +72 -7
- 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
|
@@ -279,13 +279,19 @@ interface EventDetailPageProps {
|
|
|
279
279
|
* Wallet / deposit flow.
|
|
280
280
|
*/
|
|
281
281
|
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
282
|
+
/**
|
|
283
|
+
* Forwarded to the inline SellFormWidget and the mobile sell modal: invoked
|
|
284
|
+
* when the user attempts to sell while the Polymarket account still needs
|
|
285
|
+
* setup (deploy + approve). Use this to open the account setup modal.
|
|
286
|
+
*/
|
|
287
|
+
onSetupRequired?: () => void;
|
|
282
288
|
/**
|
|
283
289
|
* Maximum tolerated slippage for market orders, in basis points
|
|
284
290
|
* (100 = 1%). Forwarded to both buy and sell forms. Defaults to 100 bps.
|
|
285
291
|
*/
|
|
286
292
|
slippageBps?: number;
|
|
287
293
|
}
|
|
288
|
-
declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, onInsufficientBalance, slippageBps, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
|
|
294
|
+
declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, onInsufficientBalance, onSetupRequired, slippageBps, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
|
|
289
295
|
|
|
290
296
|
type TradeOutcome = "yes" | "no";
|
|
291
297
|
type TradeSide = "buy" | "sell";
|
|
@@ -360,6 +366,8 @@ interface UseTradeFormResult {
|
|
|
360
366
|
isBalanceLoading: boolean;
|
|
361
367
|
isMarketDataLoading: boolean;
|
|
362
368
|
isSubmitting: boolean;
|
|
369
|
+
/** Current authentication status, used to drive the submit-button states. */
|
|
370
|
+
authStatus: "unauthenticated" | "authenticating" | "authenticated" | "deauthenticating";
|
|
363
371
|
validation: TradeFormValidation;
|
|
364
372
|
/** True when the user has entered an amount that exceeds the available USDC balance. */
|
|
365
373
|
isInsufficientBalance: boolean;
|
|
@@ -367,6 +375,17 @@ interface UseTradeFormResult {
|
|
|
367
375
|
source: ProviderSource;
|
|
368
376
|
supportsLimitOrder: boolean;
|
|
369
377
|
kycRequired: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* True when the market's source requires identity verification (KYC) and the
|
|
380
|
+
* user has not completed it yet. Used to gate the deposit flow behind KYC.
|
|
381
|
+
*/
|
|
382
|
+
needsKyc: boolean;
|
|
383
|
+
/**
|
|
384
|
+
* True when the market's source requires an on-chain account setup (e.g.
|
|
385
|
+
* Polymarket deposit/Safe wallet deployment + token approval) that the user
|
|
386
|
+
* has not completed yet. Used to gate trading behind account setup.
|
|
387
|
+
*/
|
|
388
|
+
needsSetup: boolean;
|
|
370
389
|
kycUrl: string | null;
|
|
371
390
|
setOutcome: (outcome: TradeOutcome) => void;
|
|
372
391
|
setOrderType: (type: OrderType) => void;
|
|
@@ -673,6 +692,8 @@ interface TradeFormUIProps {
|
|
|
673
692
|
potentialProfit: number;
|
|
674
693
|
isMarketDataLoading: boolean;
|
|
675
694
|
isSubmitting: boolean;
|
|
695
|
+
/** Auth status driving the login/checking/normal submit-button states. */
|
|
696
|
+
authStatus: "unauthenticated" | "authenticating" | "authenticated" | "deauthenticating";
|
|
676
697
|
usdcBalance: number | null;
|
|
677
698
|
isBalanceLoading: boolean;
|
|
678
699
|
isValid: boolean;
|
|
@@ -683,6 +704,10 @@ interface TradeFormUIProps {
|
|
|
683
704
|
onInsufficientBalance?: () => void;
|
|
684
705
|
supportsLimitOrder: boolean;
|
|
685
706
|
kycRequired: boolean;
|
|
707
|
+
/** True when the user must complete KYC before the deposit flow is allowed. */
|
|
708
|
+
needsKyc: boolean;
|
|
709
|
+
/** True when the user must set up (deploy) their Polymarket account first. */
|
|
710
|
+
needsSetup: boolean;
|
|
686
711
|
kycUrl: string | null;
|
|
687
712
|
expirationEnabled: boolean;
|
|
688
713
|
expirationPreset: ExpirationPreset;
|
|
@@ -698,7 +723,7 @@ interface TradeFormUIProps {
|
|
|
698
723
|
onCustomDurationUnitChange: (u: DurationUnit) => void;
|
|
699
724
|
onSubmit: () => void;
|
|
700
725
|
}
|
|
701
|
-
declare function TradeFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, isBalanceLoading, isMarketDataLoading, isSubmitting, isValid, validationErrors, isInsufficientBalance, onInsufficientBalance, supportsLimitOrder, kycRequired, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
|
|
726
|
+
declare function TradeFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, isBalanceLoading, isMarketDataLoading, isSubmitting, authStatus, isValid, validationErrors, isInsufficientBalance, onInsufficientBalance, supportsLimitOrder, kycRequired, needsKyc, needsSetup, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
|
|
702
727
|
|
|
703
728
|
interface TradeFormWidgetProps {
|
|
704
729
|
event?: PredictEvent;
|
|
@@ -717,8 +742,10 @@ interface TradeFormWidgetProps {
|
|
|
717
742
|
* (e.g. open a Fund Wallet modal pre-selected for the right chain).
|
|
718
743
|
*/
|
|
719
744
|
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
745
|
+
/** Called whenever the user switches between YES and NO. */
|
|
746
|
+
onOutcomeChange?: (outcome: TradeOutcome) => void;
|
|
720
747
|
}
|
|
721
|
-
declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, onInsufficientBalance, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
748
|
+
declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, onInsufficientBalance, onOutcomeChange, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
722
749
|
|
|
723
750
|
type PredictSellModalParams = {
|
|
724
751
|
event: PredictEvent;
|
|
@@ -727,6 +754,11 @@ type PredictSellModalParams = {
|
|
|
727
754
|
chain?: string;
|
|
728
755
|
/** Forwarded slippage tolerance (basis points). */
|
|
729
756
|
slippageBps?: number;
|
|
757
|
+
/**
|
|
758
|
+
* Invoked when the Polymarket account still needs setup (deploy + approve).
|
|
759
|
+
* The consumer should open the account setup modal.
|
|
760
|
+
*/
|
|
761
|
+
onSetupRequired?: () => void;
|
|
730
762
|
};
|
|
731
763
|
type PredictSellModalResult = void;
|
|
732
764
|
declare const PREDICT_SELL_MODAL_ID = "predict-sell";
|
|
@@ -745,6 +777,8 @@ interface UseSellFormParams {
|
|
|
745
777
|
* Defaults to 100 bps. Use `0` to disable the check (not recommended).
|
|
746
778
|
*/
|
|
747
779
|
slippageBps?: number;
|
|
780
|
+
/** Called after a sell order completes successfully (e.g. to close a modal). */
|
|
781
|
+
onSuccess?: () => void;
|
|
748
782
|
}
|
|
749
783
|
interface UseSellFormResult {
|
|
750
784
|
outcome: TradeOutcome;
|
|
@@ -760,9 +794,15 @@ interface UseSellFormResult {
|
|
|
760
794
|
pricePerShare: number;
|
|
761
795
|
isMarketDataLoading: boolean;
|
|
762
796
|
isSubmitting: boolean;
|
|
797
|
+
/** Current authentication status, used to drive the submit-button states. */
|
|
798
|
+
authStatus: "unauthenticated" | "authenticating" | "authenticated" | "deauthenticating";
|
|
763
799
|
validation: TradeFormValidation;
|
|
764
800
|
supportsLimitOrder: boolean;
|
|
765
801
|
kycRequired: boolean;
|
|
802
|
+
/** True when the market requires KYC the user has not completed (Kalshi). */
|
|
803
|
+
needsKyc: boolean;
|
|
804
|
+
/** True when the Polymarket account is not yet set up (deployed + approved). */
|
|
805
|
+
needsSetup: boolean;
|
|
766
806
|
kycUrl: string | null;
|
|
767
807
|
totalShares: number;
|
|
768
808
|
activeOrderShares: number;
|
|
@@ -786,7 +826,7 @@ interface UseSellFormResult {
|
|
|
786
826
|
setCustomDurationUnit: (u: DurationUnit) => void;
|
|
787
827
|
submit: () => void;
|
|
788
828
|
}
|
|
789
|
-
declare function useSellForm({ market, initialOutcome, slippageBps, }: UseSellFormParams): UseSellFormResult;
|
|
829
|
+
declare function useSellForm({ market, initialOutcome, slippageBps, onSuccess, }: UseSellFormParams): UseSellFormResult;
|
|
790
830
|
|
|
791
831
|
interface SellFormUIProps {
|
|
792
832
|
event?: StandardEvent;
|
|
@@ -799,10 +839,18 @@ interface SellFormUIProps {
|
|
|
799
839
|
estimatedReturn: number;
|
|
800
840
|
isMarketDataLoading: boolean;
|
|
801
841
|
isSubmitting: boolean;
|
|
842
|
+
/** Auth status driving the login/checking/normal submit-button states. */
|
|
843
|
+
authStatus: "unauthenticated" | "authenticating" | "authenticated" | "deauthenticating";
|
|
802
844
|
isValid: boolean;
|
|
803
845
|
validationErrors: string[];
|
|
804
846
|
supportsLimitOrder: boolean;
|
|
805
847
|
kycRequired: boolean;
|
|
848
|
+
/** True when the user must complete KYC before trading (Kalshi). */
|
|
849
|
+
needsKyc: boolean;
|
|
850
|
+
/** True when the Polymarket account must be set up (deployed) first. */
|
|
851
|
+
needsSetup: boolean;
|
|
852
|
+
/** Opens the account setup modal when the Polymarket account isn't ready. */
|
|
853
|
+
onSetupRequired?: () => void;
|
|
806
854
|
kycUrl: string | null;
|
|
807
855
|
totalShares: number;
|
|
808
856
|
activeOrderShares: number;
|
|
@@ -825,7 +873,7 @@ interface SellFormUIProps {
|
|
|
825
873
|
onCustomDurationUnitChange: (u: DurationUnit) => void;
|
|
826
874
|
onSubmit: () => void;
|
|
827
875
|
}
|
|
828
|
-
declare function SellFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, estimatedReturn, isMarketDataLoading, 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;
|
|
876
|
+
declare function SellFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, estimatedReturn, isMarketDataLoading, isSubmitting, authStatus, isValid, validationErrors, supportsLimitOrder, kycRequired, needsKyc, needsSetup, onSetupRequired, 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;
|
|
829
877
|
|
|
830
878
|
interface SellFormWidgetProps {
|
|
831
879
|
event?: PredictEvent;
|
|
@@ -838,8 +886,18 @@ interface SellFormWidgetProps {
|
|
|
838
886
|
* Defaults to 100 bps (1%). Forwarded to {@link useSellForm}.
|
|
839
887
|
*/
|
|
840
888
|
slippageBps?: number;
|
|
889
|
+
/** Called whenever the user switches between YES and NO. */
|
|
890
|
+
onOutcomeChange?: (outcome: TradeOutcome) => void;
|
|
891
|
+
/**
|
|
892
|
+
* Called when the user presses the submit button while the Polymarket
|
|
893
|
+
* account still needs setup (deploy + approve). The consumer should open the
|
|
894
|
+
* account setup modal.
|
|
895
|
+
*/
|
|
896
|
+
onSetupRequired?: () => void;
|
|
897
|
+
/** Called after a sell order completes successfully (e.g. to close a modal). */
|
|
898
|
+
onSuccess?: () => void;
|
|
841
899
|
}
|
|
842
|
-
declare function SellFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, }: SellFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
900
|
+
declare function SellFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, onOutcomeChange, onSetupRequired, onSuccess, }: SellFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
843
901
|
|
|
844
902
|
type PredictRedeemModalParams = {
|
|
845
903
|
event: PredictEvent;
|
|
@@ -1298,7 +1356,14 @@ declare function usePredictWallet(): PredictWalletContextValue;
|
|
|
1298
1356
|
type PredictWalletProviderProps = PropsWithChildren<{
|
|
1299
1357
|
pollingInterval?: number;
|
|
1300
1358
|
enabled?: boolean;
|
|
1359
|
+
/**
|
|
1360
|
+
* Whether the Kalshi (Solana / DFlow) venue is active. When `false`, the
|
|
1361
|
+
* Kalshi USDC balance and DFlow KYC status queries are disabled so no
|
|
1362
|
+
* polling happens for a venue the app does not surface. Defaults to `true`
|
|
1363
|
+
* for backward compatibility.
|
|
1364
|
+
*/
|
|
1365
|
+
enableKalshi?: boolean;
|
|
1301
1366
|
}>;
|
|
1302
|
-
declare function PredictWalletProvider({ pollingInterval, enabled, children, }: PredictWalletProviderProps): react_jsx_runtime.JSX.Element;
|
|
1367
|
+
declare function PredictWalletProvider({ pollingInterval, enabled, enableKalshi, children, }: PredictWalletProviderProps): react_jsx_runtime.JSX.Element;
|
|
1303
1368
|
|
|
1304
1369
|
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, CommentItemUI, type CommentItemUIProps, DEFAULT_CHART_RANGE, DEFAULT_FILTER_STATE, DEFAULT_PAGE_SIZE, DEFAULT_PRICE_HISTORY_INTERVAL, type DepthLevel, type DepthSlot, type DurationUnit, EventCommentsWidget, type EventCommentsWidgetProps, 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_REDEEM_MODAL_ID, PREDICT_SEARCH_MODAL_ID, PREDICT_SELL_MODAL_ID, PREDICT_TRADE_MODAL_ID, PRICE_HISTORY_SAMPLE_INTERVAL, PredictRedeemModal, type PredictRedeemModalParams, type PredictRedeemModalResult, 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, RedeemFormWidget, type RedeemFormWidgetProps, 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, formatShares, getSourceMeta, parsePolymarketError, resolveExpiration, roundToTickSize, useEventDetail, useEventsInfinite, usePredictSearchHistory, usePredictWallet, useSearchResultListScript, useSearchScript, useSellForm, useTradeForm };
|
package/dist/index.d.ts
CHANGED
|
@@ -279,13 +279,19 @@ interface EventDetailPageProps {
|
|
|
279
279
|
* Wallet / deposit flow.
|
|
280
280
|
*/
|
|
281
281
|
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
282
|
+
/**
|
|
283
|
+
* Forwarded to the inline SellFormWidget and the mobile sell modal: invoked
|
|
284
|
+
* when the user attempts to sell while the Polymarket account still needs
|
|
285
|
+
* setup (deploy + approve). Use this to open the account setup modal.
|
|
286
|
+
*/
|
|
287
|
+
onSetupRequired?: () => void;
|
|
282
288
|
/**
|
|
283
289
|
* Maximum tolerated slippage for market orders, in basis points
|
|
284
290
|
* (100 = 1%). Forwarded to both buy and sell forms. Defaults to 100 bps.
|
|
285
291
|
*/
|
|
286
292
|
slippageBps?: number;
|
|
287
293
|
}
|
|
288
|
-
declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, onInsufficientBalance, slippageBps, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
|
|
294
|
+
declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, onInsufficientBalance, onSetupRequired, slippageBps, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
|
|
289
295
|
|
|
290
296
|
type TradeOutcome = "yes" | "no";
|
|
291
297
|
type TradeSide = "buy" | "sell";
|
|
@@ -360,6 +366,8 @@ interface UseTradeFormResult {
|
|
|
360
366
|
isBalanceLoading: boolean;
|
|
361
367
|
isMarketDataLoading: boolean;
|
|
362
368
|
isSubmitting: boolean;
|
|
369
|
+
/** Current authentication status, used to drive the submit-button states. */
|
|
370
|
+
authStatus: "unauthenticated" | "authenticating" | "authenticated" | "deauthenticating";
|
|
363
371
|
validation: TradeFormValidation;
|
|
364
372
|
/** True when the user has entered an amount that exceeds the available USDC balance. */
|
|
365
373
|
isInsufficientBalance: boolean;
|
|
@@ -367,6 +375,17 @@ interface UseTradeFormResult {
|
|
|
367
375
|
source: ProviderSource;
|
|
368
376
|
supportsLimitOrder: boolean;
|
|
369
377
|
kycRequired: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* True when the market's source requires identity verification (KYC) and the
|
|
380
|
+
* user has not completed it yet. Used to gate the deposit flow behind KYC.
|
|
381
|
+
*/
|
|
382
|
+
needsKyc: boolean;
|
|
383
|
+
/**
|
|
384
|
+
* True when the market's source requires an on-chain account setup (e.g.
|
|
385
|
+
* Polymarket deposit/Safe wallet deployment + token approval) that the user
|
|
386
|
+
* has not completed yet. Used to gate trading behind account setup.
|
|
387
|
+
*/
|
|
388
|
+
needsSetup: boolean;
|
|
370
389
|
kycUrl: string | null;
|
|
371
390
|
setOutcome: (outcome: TradeOutcome) => void;
|
|
372
391
|
setOrderType: (type: OrderType) => void;
|
|
@@ -673,6 +692,8 @@ interface TradeFormUIProps {
|
|
|
673
692
|
potentialProfit: number;
|
|
674
693
|
isMarketDataLoading: boolean;
|
|
675
694
|
isSubmitting: boolean;
|
|
695
|
+
/** Auth status driving the login/checking/normal submit-button states. */
|
|
696
|
+
authStatus: "unauthenticated" | "authenticating" | "authenticated" | "deauthenticating";
|
|
676
697
|
usdcBalance: number | null;
|
|
677
698
|
isBalanceLoading: boolean;
|
|
678
699
|
isValid: boolean;
|
|
@@ -683,6 +704,10 @@ interface TradeFormUIProps {
|
|
|
683
704
|
onInsufficientBalance?: () => void;
|
|
684
705
|
supportsLimitOrder: boolean;
|
|
685
706
|
kycRequired: boolean;
|
|
707
|
+
/** True when the user must complete KYC before the deposit flow is allowed. */
|
|
708
|
+
needsKyc: boolean;
|
|
709
|
+
/** True when the user must set up (deploy) their Polymarket account first. */
|
|
710
|
+
needsSetup: boolean;
|
|
686
711
|
kycUrl: string | null;
|
|
687
712
|
expirationEnabled: boolean;
|
|
688
713
|
expirationPreset: ExpirationPreset;
|
|
@@ -698,7 +723,7 @@ interface TradeFormUIProps {
|
|
|
698
723
|
onCustomDurationUnitChange: (u: DurationUnit) => void;
|
|
699
724
|
onSubmit: () => void;
|
|
700
725
|
}
|
|
701
|
-
declare function TradeFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, isBalanceLoading, isMarketDataLoading, isSubmitting, isValid, validationErrors, isInsufficientBalance, onInsufficientBalance, supportsLimitOrder, kycRequired, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
|
|
726
|
+
declare function TradeFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, shares, potentialProfit, potentialPayout, estimatedCost, usdcBalance, isBalanceLoading, isMarketDataLoading, isSubmitting, authStatus, isValid, validationErrors, isInsufficientBalance, onInsufficientBalance, supportsLimitOrder, kycRequired, needsKyc, needsSetup, kycUrl, expirationEnabled, expirationPreset, customDuration, customDurationUnit, onOutcomeChange, onOrderTypeChange, onQuantityChange, onLimitPriceChange, onExpirationEnabledChange, onExpirationPresetChange, onCustomDurationChange, onCustomDurationUnitChange, onSubmit, }: TradeFormUIProps): react_jsx_runtime.JSX.Element;
|
|
702
727
|
|
|
703
728
|
interface TradeFormWidgetProps {
|
|
704
729
|
event?: PredictEvent;
|
|
@@ -717,8 +742,10 @@ interface TradeFormWidgetProps {
|
|
|
717
742
|
* (e.g. open a Fund Wallet modal pre-selected for the right chain).
|
|
718
743
|
*/
|
|
719
744
|
onInsufficientBalance?: (source: ProviderSource) => void;
|
|
745
|
+
/** Called whenever the user switches between YES and NO. */
|
|
746
|
+
onOutcomeChange?: (outcome: TradeOutcome) => void;
|
|
720
747
|
}
|
|
721
|
-
declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, onInsufficientBalance, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
748
|
+
declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, onInsufficientBalance, onOutcomeChange, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
722
749
|
|
|
723
750
|
type PredictSellModalParams = {
|
|
724
751
|
event: PredictEvent;
|
|
@@ -727,6 +754,11 @@ type PredictSellModalParams = {
|
|
|
727
754
|
chain?: string;
|
|
728
755
|
/** Forwarded slippage tolerance (basis points). */
|
|
729
756
|
slippageBps?: number;
|
|
757
|
+
/**
|
|
758
|
+
* Invoked when the Polymarket account still needs setup (deploy + approve).
|
|
759
|
+
* The consumer should open the account setup modal.
|
|
760
|
+
*/
|
|
761
|
+
onSetupRequired?: () => void;
|
|
730
762
|
};
|
|
731
763
|
type PredictSellModalResult = void;
|
|
732
764
|
declare const PREDICT_SELL_MODAL_ID = "predict-sell";
|
|
@@ -745,6 +777,8 @@ interface UseSellFormParams {
|
|
|
745
777
|
* Defaults to 100 bps. Use `0` to disable the check (not recommended).
|
|
746
778
|
*/
|
|
747
779
|
slippageBps?: number;
|
|
780
|
+
/** Called after a sell order completes successfully (e.g. to close a modal). */
|
|
781
|
+
onSuccess?: () => void;
|
|
748
782
|
}
|
|
749
783
|
interface UseSellFormResult {
|
|
750
784
|
outcome: TradeOutcome;
|
|
@@ -760,9 +794,15 @@ interface UseSellFormResult {
|
|
|
760
794
|
pricePerShare: number;
|
|
761
795
|
isMarketDataLoading: boolean;
|
|
762
796
|
isSubmitting: boolean;
|
|
797
|
+
/** Current authentication status, used to drive the submit-button states. */
|
|
798
|
+
authStatus: "unauthenticated" | "authenticating" | "authenticated" | "deauthenticating";
|
|
763
799
|
validation: TradeFormValidation;
|
|
764
800
|
supportsLimitOrder: boolean;
|
|
765
801
|
kycRequired: boolean;
|
|
802
|
+
/** True when the market requires KYC the user has not completed (Kalshi). */
|
|
803
|
+
needsKyc: boolean;
|
|
804
|
+
/** True when the Polymarket account is not yet set up (deployed + approved). */
|
|
805
|
+
needsSetup: boolean;
|
|
766
806
|
kycUrl: string | null;
|
|
767
807
|
totalShares: number;
|
|
768
808
|
activeOrderShares: number;
|
|
@@ -786,7 +826,7 @@ interface UseSellFormResult {
|
|
|
786
826
|
setCustomDurationUnit: (u: DurationUnit) => void;
|
|
787
827
|
submit: () => void;
|
|
788
828
|
}
|
|
789
|
-
declare function useSellForm({ market, initialOutcome, slippageBps, }: UseSellFormParams): UseSellFormResult;
|
|
829
|
+
declare function useSellForm({ market, initialOutcome, slippageBps, onSuccess, }: UseSellFormParams): UseSellFormResult;
|
|
790
830
|
|
|
791
831
|
interface SellFormUIProps {
|
|
792
832
|
event?: StandardEvent;
|
|
@@ -799,10 +839,18 @@ interface SellFormUIProps {
|
|
|
799
839
|
estimatedReturn: number;
|
|
800
840
|
isMarketDataLoading: boolean;
|
|
801
841
|
isSubmitting: boolean;
|
|
842
|
+
/** Auth status driving the login/checking/normal submit-button states. */
|
|
843
|
+
authStatus: "unauthenticated" | "authenticating" | "authenticated" | "deauthenticating";
|
|
802
844
|
isValid: boolean;
|
|
803
845
|
validationErrors: string[];
|
|
804
846
|
supportsLimitOrder: boolean;
|
|
805
847
|
kycRequired: boolean;
|
|
848
|
+
/** True when the user must complete KYC before trading (Kalshi). */
|
|
849
|
+
needsKyc: boolean;
|
|
850
|
+
/** True when the Polymarket account must be set up (deployed) first. */
|
|
851
|
+
needsSetup: boolean;
|
|
852
|
+
/** Opens the account setup modal when the Polymarket account isn't ready. */
|
|
853
|
+
onSetupRequired?: () => void;
|
|
806
854
|
kycUrl: string | null;
|
|
807
855
|
totalShares: number;
|
|
808
856
|
activeOrderShares: number;
|
|
@@ -825,7 +873,7 @@ interface SellFormUIProps {
|
|
|
825
873
|
onCustomDurationUnitChange: (u: DurationUnit) => void;
|
|
826
874
|
onSubmit: () => void;
|
|
827
875
|
}
|
|
828
|
-
declare function SellFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, estimatedReturn, isMarketDataLoading, 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;
|
|
876
|
+
declare function SellFormUI({ event, market, variant, outcome, orderType, quantity, limitPrice, estimatedReturn, isMarketDataLoading, isSubmitting, authStatus, isValid, validationErrors, supportsLimitOrder, kycRequired, needsKyc, needsSetup, onSetupRequired, 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;
|
|
829
877
|
|
|
830
878
|
interface SellFormWidgetProps {
|
|
831
879
|
event?: PredictEvent;
|
|
@@ -838,8 +886,18 @@ interface SellFormWidgetProps {
|
|
|
838
886
|
* Defaults to 100 bps (1%). Forwarded to {@link useSellForm}.
|
|
839
887
|
*/
|
|
840
888
|
slippageBps?: number;
|
|
889
|
+
/** Called whenever the user switches between YES and NO. */
|
|
890
|
+
onOutcomeChange?: (outcome: TradeOutcome) => void;
|
|
891
|
+
/**
|
|
892
|
+
* Called when the user presses the submit button while the Polymarket
|
|
893
|
+
* account still needs setup (deploy + approve). The consumer should open the
|
|
894
|
+
* account setup modal.
|
|
895
|
+
*/
|
|
896
|
+
onSetupRequired?: () => void;
|
|
897
|
+
/** Called after a sell order completes successfully (e.g. to close a modal). */
|
|
898
|
+
onSuccess?: () => void;
|
|
841
899
|
}
|
|
842
|
-
declare function SellFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, }: SellFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
900
|
+
declare function SellFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, onOutcomeChange, onSetupRequired, onSuccess, }: SellFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
843
901
|
|
|
844
902
|
type PredictRedeemModalParams = {
|
|
845
903
|
event: PredictEvent;
|
|
@@ -1298,7 +1356,14 @@ declare function usePredictWallet(): PredictWalletContextValue;
|
|
|
1298
1356
|
type PredictWalletProviderProps = PropsWithChildren<{
|
|
1299
1357
|
pollingInterval?: number;
|
|
1300
1358
|
enabled?: boolean;
|
|
1359
|
+
/**
|
|
1360
|
+
* Whether the Kalshi (Solana / DFlow) venue is active. When `false`, the
|
|
1361
|
+
* Kalshi USDC balance and DFlow KYC status queries are disabled so no
|
|
1362
|
+
* polling happens for a venue the app does not surface. Defaults to `true`
|
|
1363
|
+
* for backward compatibility.
|
|
1364
|
+
*/
|
|
1365
|
+
enableKalshi?: boolean;
|
|
1301
1366
|
}>;
|
|
1302
|
-
declare function PredictWalletProvider({ pollingInterval, enabled, children, }: PredictWalletProviderProps): react_jsx_runtime.JSX.Element;
|
|
1367
|
+
declare function PredictWalletProvider({ pollingInterval, enabled, enableKalshi, children, }: PredictWalletProviderProps): react_jsx_runtime.JSX.Element;
|
|
1303
1368
|
|
|
1304
1369
|
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, CommentItemUI, type CommentItemUIProps, DEFAULT_CHART_RANGE, DEFAULT_FILTER_STATE, DEFAULT_PAGE_SIZE, DEFAULT_PRICE_HISTORY_INTERVAL, type DepthLevel, type DepthSlot, type DurationUnit, EventCommentsWidget, type EventCommentsWidgetProps, 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_REDEEM_MODAL_ID, PREDICT_SEARCH_MODAL_ID, PREDICT_SELL_MODAL_ID, PREDICT_TRADE_MODAL_ID, PRICE_HISTORY_SAMPLE_INTERVAL, PredictRedeemModal, type PredictRedeemModalParams, type PredictRedeemModalResult, 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, RedeemFormWidget, type RedeemFormWidgetProps, 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, formatShares, getSourceMeta, parsePolymarketError, resolveExpiration, roundToTickSize, useEventDetail, useEventsInfinite, usePredictSearchHistory, usePredictWallet, useSearchResultListScript, useSearchScript, useSellForm, useTradeForm };
|