@liberfi.io/ui-predict 1.0.7 → 1.0.9

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: "1.0.7";
16
+ declare const _default: "1.0.9";
17
17
 
18
18
  /**
19
19
  * A single category entry in the static navigation model.
@@ -271,8 +271,13 @@ interface EventDetailPageProps {
271
271
  * Wallet / deposit flow.
272
272
  */
273
273
  onInsufficientBalance?: (source: ProviderSource) => void;
274
+ /**
275
+ * Maximum tolerated slippage for market orders, in basis points
276
+ * (100 = 1%). Forwarded to both buy and sell forms. Defaults to 100 bps.
277
+ */
278
+ slippageBps?: number;
274
279
  }
275
- declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, onInsufficientBalance, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
280
+ declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, onInsufficientBalance, slippageBps, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
276
281
 
277
282
  type TradeOutcome = "yes" | "no";
278
283
  type TradeSide = "buy" | "sell";
@@ -314,6 +319,12 @@ interface UseTradeFormParams {
314
319
  market: PredictMarket;
315
320
  chain?: string;
316
321
  initialOutcome?: TradeOutcome;
322
+ /**
323
+ * Maximum tolerated slippage between best-of-book and the worst price
324
+ * walked into when filling a market order, in basis points (100 = 1%).
325
+ * Defaults to 100 bps. Use `0` to disable the check (not recommended).
326
+ */
327
+ slippageBps?: number;
317
328
  /**
318
329
  * Callback fired when the user attempts to submit a buy with an amount
319
330
  * larger than the available USDC balance for the market's source. The
@@ -332,6 +343,11 @@ interface UseTradeFormResult {
332
343
  estimatedCost: number;
333
344
  potentialPayout: number;
334
345
  potentialProfit: number;
346
+ /**
347
+ * Live best-ask price for the selected outcome (per-share, 0–1). Sourced
348
+ * from the WS/REST orderbook with a fallback to the static event payload.
349
+ */
350
+ pricePerShare: number;
335
351
  usdcBalance: number | null;
336
352
  isBalanceLoading: boolean;
337
353
  isMarketDataLoading: boolean;
@@ -364,7 +380,7 @@ interface UseTradeFormResult {
364
380
  */
365
381
  notifyInsufficientBalance: () => void;
366
382
  }
367
- declare function useTradeForm({ market, initialOutcome, onInsufficientBalance, }: UseTradeFormParams): UseTradeFormResult;
383
+ declare function useTradeForm({ market, initialOutcome, slippageBps, onInsufficientBalance, }: UseTradeFormParams): UseTradeFormResult;
368
384
 
369
385
  interface EventDetailUIProps {
370
386
  event: PredictEvent;
@@ -486,6 +502,8 @@ type PredictTradeModalParams = {
486
502
  market: PredictMarket;
487
503
  initialOutcome?: TradeOutcome;
488
504
  chain?: string;
505
+ /** Forwarded slippage tolerance (basis points). */
506
+ slippageBps?: number;
489
507
  /**
490
508
  * Called when the user presses Buy with insufficient USDC balance for the
491
509
  * market's source. Allows the consumer to open a Fund Wallet flow.
@@ -563,6 +581,11 @@ interface TradeFormWidgetProps {
563
581
  variant?: "bordered" | "flat";
564
582
  initialOutcome?: TradeOutcome;
565
583
  chain?: string;
584
+ /**
585
+ * Maximum tolerated slippage (basis points) when filling a market buy.
586
+ * Defaults to 100 bps (1%). Forwarded to {@link useTradeForm}.
587
+ */
588
+ slippageBps?: number;
566
589
  /**
567
590
  * Called when the user presses Buy with an amount larger than the available
568
591
  * USDC balance for the market's source. Use this to show a top-up flow
@@ -570,13 +593,15 @@ interface TradeFormWidgetProps {
570
593
  */
571
594
  onInsufficientBalance?: (source: ProviderSource) => void;
572
595
  }
573
- declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, onInsufficientBalance, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
596
+ declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, onInsufficientBalance, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
574
597
 
575
598
  type PredictSellModalParams = {
576
599
  event: PredictEvent;
577
600
  market: PredictMarket;
578
601
  initialOutcome?: TradeOutcome;
579
602
  chain?: string;
603
+ /** Forwarded slippage tolerance (basis points). */
604
+ slippageBps?: number;
580
605
  };
581
606
  type PredictSellModalResult = void;
582
607
  declare const PREDICT_SELL_MODAL_ID = "predict-sell";
@@ -589,6 +614,12 @@ interface UseSellFormParams {
589
614
  chain?: string;
590
615
  /** Fixed outcome — the sell form doesn't offer a YES/NO toggle. */
591
616
  initialOutcome?: TradeOutcome;
617
+ /**
618
+ * Maximum tolerated slippage between best-of-book and the worst price
619
+ * walked into when filling a market sell, in basis points (100 = 1%).
620
+ * Defaults to 100 bps. Use `0` to disable the check (not recommended).
621
+ */
622
+ slippageBps?: number;
592
623
  }
593
624
  interface UseSellFormResult {
594
625
  outcome: TradeOutcome;
@@ -597,6 +628,11 @@ interface UseSellFormResult {
597
628
  limitPrice: number;
598
629
  shares: number;
599
630
  estimatedReturn: number;
631
+ /**
632
+ * Live best-bid price for the selected outcome (per-share, 0–1). Sourced
633
+ * from the WS/REST orderbook with a fallback to the static event payload.
634
+ */
635
+ pricePerShare: number;
600
636
  isMarketDataLoading: boolean;
601
637
  isSubmitting: boolean;
602
638
  validation: TradeFormValidation;
@@ -625,7 +661,7 @@ interface UseSellFormResult {
625
661
  setCustomDurationUnit: (u: DurationUnit) => void;
626
662
  submit: () => void;
627
663
  }
628
- declare function useSellForm({ market, initialOutcome, }: UseSellFormParams): UseSellFormResult;
664
+ declare function useSellForm({ market, initialOutcome, slippageBps, }: UseSellFormParams): UseSellFormResult;
629
665
 
630
666
  interface SellFormUIProps {
631
667
  event?: StandardEvent;
@@ -672,8 +708,13 @@ interface SellFormWidgetProps {
672
708
  variant?: "bordered" | "flat";
673
709
  initialOutcome?: TradeOutcome;
674
710
  chain?: string;
711
+ /**
712
+ * Maximum tolerated slippage (basis points) when filling a market sell.
713
+ * Defaults to 100 bps (1%). Forwarded to {@link useSellForm}.
714
+ */
715
+ slippageBps?: number;
675
716
  }
676
- declare function SellFormWidget({ event, market, variant, initialOutcome, chain, }: SellFormWidgetProps): react_jsx_runtime.JSX.Element;
717
+ declare function SellFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, }: SellFormWidgetProps): react_jsx_runtime.JSX.Element;
677
718
 
678
719
  type PredictRedeemModalParams = {
679
720
  event: PredictEvent;
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ declare global {
13
13
  };
14
14
  }
15
15
  }
16
- declare const _default: "1.0.7";
16
+ declare const _default: "1.0.9";
17
17
 
18
18
  /**
19
19
  * A single category entry in the static navigation model.
@@ -271,8 +271,13 @@ interface EventDetailPageProps {
271
271
  * Wallet / deposit flow.
272
272
  */
273
273
  onInsufficientBalance?: (source: ProviderSource) => void;
274
+ /**
275
+ * Maximum tolerated slippage for market orders, in basis points
276
+ * (100 = 1%). Forwarded to both buy and sell forms. Defaults to 100 bps.
277
+ */
278
+ slippageBps?: number;
274
279
  }
275
- declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, onInsufficientBalance, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
280
+ declare function EventDetailPage({ eventSlug, source, chain, walletAddress, onSimilarEventClick, onSimilarEventHover, onBack, renderActivitySection, onInsufficientBalance, slippageBps, }: EventDetailPageProps): react_jsx_runtime.JSX.Element;
276
281
 
277
282
  type TradeOutcome = "yes" | "no";
278
283
  type TradeSide = "buy" | "sell";
@@ -314,6 +319,12 @@ interface UseTradeFormParams {
314
319
  market: PredictMarket;
315
320
  chain?: string;
316
321
  initialOutcome?: TradeOutcome;
322
+ /**
323
+ * Maximum tolerated slippage between best-of-book and the worst price
324
+ * walked into when filling a market order, in basis points (100 = 1%).
325
+ * Defaults to 100 bps. Use `0` to disable the check (not recommended).
326
+ */
327
+ slippageBps?: number;
317
328
  /**
318
329
  * Callback fired when the user attempts to submit a buy with an amount
319
330
  * larger than the available USDC balance for the market's source. The
@@ -332,6 +343,11 @@ interface UseTradeFormResult {
332
343
  estimatedCost: number;
333
344
  potentialPayout: number;
334
345
  potentialProfit: number;
346
+ /**
347
+ * Live best-ask price for the selected outcome (per-share, 0–1). Sourced
348
+ * from the WS/REST orderbook with a fallback to the static event payload.
349
+ */
350
+ pricePerShare: number;
335
351
  usdcBalance: number | null;
336
352
  isBalanceLoading: boolean;
337
353
  isMarketDataLoading: boolean;
@@ -364,7 +380,7 @@ interface UseTradeFormResult {
364
380
  */
365
381
  notifyInsufficientBalance: () => void;
366
382
  }
367
- declare function useTradeForm({ market, initialOutcome, onInsufficientBalance, }: UseTradeFormParams): UseTradeFormResult;
383
+ declare function useTradeForm({ market, initialOutcome, slippageBps, onInsufficientBalance, }: UseTradeFormParams): UseTradeFormResult;
368
384
 
369
385
  interface EventDetailUIProps {
370
386
  event: PredictEvent;
@@ -486,6 +502,8 @@ type PredictTradeModalParams = {
486
502
  market: PredictMarket;
487
503
  initialOutcome?: TradeOutcome;
488
504
  chain?: string;
505
+ /** Forwarded slippage tolerance (basis points). */
506
+ slippageBps?: number;
489
507
  /**
490
508
  * Called when the user presses Buy with insufficient USDC balance for the
491
509
  * market's source. Allows the consumer to open a Fund Wallet flow.
@@ -563,6 +581,11 @@ interface TradeFormWidgetProps {
563
581
  variant?: "bordered" | "flat";
564
582
  initialOutcome?: TradeOutcome;
565
583
  chain?: string;
584
+ /**
585
+ * Maximum tolerated slippage (basis points) when filling a market buy.
586
+ * Defaults to 100 bps (1%). Forwarded to {@link useTradeForm}.
587
+ */
588
+ slippageBps?: number;
566
589
  /**
567
590
  * Called when the user presses Buy with an amount larger than the available
568
591
  * USDC balance for the market's source. Use this to show a top-up flow
@@ -570,13 +593,15 @@ interface TradeFormWidgetProps {
570
593
  */
571
594
  onInsufficientBalance?: (source: ProviderSource) => void;
572
595
  }
573
- declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, onInsufficientBalance, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
596
+ declare function TradeFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, onInsufficientBalance, }: TradeFormWidgetProps): react_jsx_runtime.JSX.Element;
574
597
 
575
598
  type PredictSellModalParams = {
576
599
  event: PredictEvent;
577
600
  market: PredictMarket;
578
601
  initialOutcome?: TradeOutcome;
579
602
  chain?: string;
603
+ /** Forwarded slippage tolerance (basis points). */
604
+ slippageBps?: number;
580
605
  };
581
606
  type PredictSellModalResult = void;
582
607
  declare const PREDICT_SELL_MODAL_ID = "predict-sell";
@@ -589,6 +614,12 @@ interface UseSellFormParams {
589
614
  chain?: string;
590
615
  /** Fixed outcome — the sell form doesn't offer a YES/NO toggle. */
591
616
  initialOutcome?: TradeOutcome;
617
+ /**
618
+ * Maximum tolerated slippage between best-of-book and the worst price
619
+ * walked into when filling a market sell, in basis points (100 = 1%).
620
+ * Defaults to 100 bps. Use `0` to disable the check (not recommended).
621
+ */
622
+ slippageBps?: number;
592
623
  }
593
624
  interface UseSellFormResult {
594
625
  outcome: TradeOutcome;
@@ -597,6 +628,11 @@ interface UseSellFormResult {
597
628
  limitPrice: number;
598
629
  shares: number;
599
630
  estimatedReturn: number;
631
+ /**
632
+ * Live best-bid price for the selected outcome (per-share, 0–1). Sourced
633
+ * from the WS/REST orderbook with a fallback to the static event payload.
634
+ */
635
+ pricePerShare: number;
600
636
  isMarketDataLoading: boolean;
601
637
  isSubmitting: boolean;
602
638
  validation: TradeFormValidation;
@@ -625,7 +661,7 @@ interface UseSellFormResult {
625
661
  setCustomDurationUnit: (u: DurationUnit) => void;
626
662
  submit: () => void;
627
663
  }
628
- declare function useSellForm({ market, initialOutcome, }: UseSellFormParams): UseSellFormResult;
664
+ declare function useSellForm({ market, initialOutcome, slippageBps, }: UseSellFormParams): UseSellFormResult;
629
665
 
630
666
  interface SellFormUIProps {
631
667
  event?: StandardEvent;
@@ -672,8 +708,13 @@ interface SellFormWidgetProps {
672
708
  variant?: "bordered" | "flat";
673
709
  initialOutcome?: TradeOutcome;
674
710
  chain?: string;
711
+ /**
712
+ * Maximum tolerated slippage (basis points) when filling a market sell.
713
+ * Defaults to 100 bps (1%). Forwarded to {@link useSellForm}.
714
+ */
715
+ slippageBps?: number;
675
716
  }
676
- declare function SellFormWidget({ event, market, variant, initialOutcome, chain, }: SellFormWidgetProps): react_jsx_runtime.JSX.Element;
717
+ declare function SellFormWidget({ event, market, variant, initialOutcome, chain, slippageBps, }: SellFormWidgetProps): react_jsx_runtime.JSX.Element;
677
718
 
678
719
  type PredictRedeemModalParams = {
679
720
  event: PredictEvent;