@agg-build/ui 4.24.0 → 4.26.1

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.js CHANGED
@@ -17356,7 +17356,7 @@ var init_item_details = __esm({
17356
17356
  recurringMarkets,
17357
17357
  sportsLiveState
17358
17358
  }) => {
17359
- var _a, _b, _c, _d, _e, _f;
17359
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
17360
17360
  const [selectedChartType, setSelectedChartType] = (0, import_react31.useState)("line");
17361
17361
  const [chartView, setChartView] = (0, import_react31.useState)(defaultChartView);
17362
17362
  const lastAppliedEventSyncKeyRef = (0, import_react31.useRef)(null);
@@ -17368,10 +17368,18 @@ var init_item_details = __esm({
17368
17368
  const labels = (0, import_hooks59.useLabels)();
17369
17369
  const tradingContext = (0, import_hooks46.useEventTradingContext)();
17370
17370
  const eventSyncKey = (0, import_react31.useMemo)(() => resolveEventDetailsSyncKey(event), [event]);
17371
+ const { eventQuery: deferredDetailsQuery } = (0, import_hooks59.useSettlementDetailsData)({
17372
+ eventId: event.id,
17373
+ enabled: true,
17374
+ needsEvent: event.detailsDeferred === true,
17375
+ needsMarket: false
17376
+ });
17377
+ const summaryDescription = (_b = (_a = deferredDetailsQuery.data) == null ? void 0 : _a.description) != null ? _b : event.description;
17378
+ const summarySettlementDiff = (_d = (_c = deferredDetailsQuery.data) == null ? void 0 : _c.settlementDiff) != null ? _d : event.settlementDiff;
17371
17379
  const resolvedEventTradingState = (0, import_react31.useMemo)(() => {
17372
17380
  return eventTradingState != null ? eventTradingState : (0, import_hooks59.resolveEventTradingState)(event);
17373
17381
  }, [event, eventTradingState]);
17374
- const scopedSelectedMarket = (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? (_a = tradingContext.selectedMarket) != null ? _a : resolvedEventTradingState.primaryMarket : resolvedEventTradingState.primaryMarket;
17382
+ const scopedSelectedMarket = (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? (_e = tradingContext.selectedMarket) != null ? _e : resolvedEventTradingState.primaryMarket : resolvedEventTradingState.primaryMarket;
17375
17383
  const venueMarkets = (0, import_react31.useMemo)(
17376
17384
  () => resolvedEventTradingState.displayMarkets,
17377
17385
  [resolvedEventTradingState.displayMarkets]
@@ -17410,7 +17418,7 @@ var init_item_details = __esm({
17410
17418
  bestMidpoint: void 0,
17411
17419
  bestMidpointVenue: void 0
17412
17420
  };
17413
- const restMidpoints = (_b = resolvedMidpointsResult.bestMidpointsByOutcomeId) != null ? _b : resolvedMidpointsResult.prices;
17421
+ const restMidpoints = (_f = resolvedMidpointsResult.bestMidpointsByOutcomeId) != null ? _f : resolvedMidpointsResult.prices;
17414
17422
  const bestMidpoint = resolvedMidpointsResult.bestMidpoint;
17415
17423
  const restBestPrices = resolvedMidpointsResult.bestPrices;
17416
17424
  const bestPrices = (0, import_react31.useMemo)(
@@ -17515,7 +17523,7 @@ var init_item_details = __esm({
17515
17523
  Card,
17516
17524
  {
17517
17525
  className: cn("group/agg-event-details", detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
17518
- "aria-label": ariaLabel != null ? ariaLabel : [resolvedTitle.title, (_c = recurringMarkets == null ? void 0 : recurringMarkets.windowLabel) != null ? _c : resolvedTitle.timestampLabel].filter(Boolean).join(" "),
17526
+ "aria-label": ariaLabel != null ? ariaLabel : [resolvedTitle.title, (_g = recurringMarkets == null ? void 0 : recurringMarkets.windowLabel) != null ? _g : resolvedTitle.timestampLabel].filter(Boolean).join(" "),
17519
17527
  onClick: onClick ? () => onClick(event) : void 0,
17520
17528
  children: [
17521
17529
  /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(
@@ -17612,7 +17620,7 @@ var init_item_details = __esm({
17612
17620
  {
17613
17621
  role: "timer",
17614
17622
  "aria-live": "off",
17615
- "aria-label": (_d = recurringMarkets.countdownAriaLabel) != null ? _d : void 0,
17623
+ "aria-label": (_h = recurringMarkets.countdownAriaLabel) != null ? _h : void 0,
17616
17624
  className: "flex shrink-0 items-center gap-1.5 text-agg-foreground",
17617
17625
  children: [
17618
17626
  /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
@@ -17633,7 +17641,7 @@ var init_item_details = __esm({
17633
17641
  {
17634
17642
  className: classNames == null ? void 0 : classNames.headerPills,
17635
17643
  options: marketOptions,
17636
- selectedValue: (_e = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _e : "",
17644
+ selectedValue: (_i = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _i : "",
17637
17645
  onChange: (marketId) => {
17638
17646
  tradingContext == null ? void 0 : tradingContext.selectMarket(marketId);
17639
17647
  setChartView("selected");
@@ -17698,7 +17706,7 @@ var init_item_details = __esm({
17698
17706
  selectedChartType,
17699
17707
  venueInfo,
17700
17708
  venueMarkets,
17701
- selectedMarketId: (_f = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _f : null,
17709
+ selectedMarketId: (_j = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _j : null,
17702
17710
  livePrices,
17703
17711
  restMidpoints,
17704
17712
  bestMidpoint,
@@ -17770,7 +17778,7 @@ var init_item_details = __esm({
17770
17778
  }
17771
17779
  )
17772
17780
  ] }),
17773
- event.description || event.settlementDiff ? /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(SettlementSummary, { content: event.description, settlementDiff: event.settlementDiff }) : null
17781
+ summaryDescription || summarySettlementDiff ? /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(SettlementSummary, { content: summaryDescription, settlementDiff: summarySettlementDiff }) : null
17774
17782
  ]
17775
17783
  }
17776
17784
  );
@@ -24162,7 +24170,7 @@ function lookupRevertSelectorMessage(message) {
24162
24170
  if (!selector) return null;
24163
24171
  return (_b = REVERT_SELECTOR_MESSAGES[selector]) != null ? _b : null;
24164
24172
  }
24165
- var import_sdk27, ATOMIC_UNITS, ATOMIC_UNITS_BIGINT, getPlaceOrderBalanceCacheKey, routePriceLabelFormatter, GEO_BLOCK_WARNING_PREFIX, isFiniteNonNegativePrice, getPlaceOrderAverageExecutionPrice, floorToDecimals, formatFlooredShareAmount, normalizeOutcomeName, findMatchingVenueOutcome, resolveSellableSharesByVenue, buildLimitOrderVenueOptions, resolveAutomaticLimitOrderVenueOption, isGeoBlockWarningReason, extractGeoBlockedVenues, getSmartRouteTotalFees, getPlaceOrderContainerClassName, resolveIsPositiveOutcome, getOutcomeButtonClassName, sortOutcomesYesFirst, mapVenueMarketOutcomesToPlaceOrderOutcomes, mapQuoteDataToRoutingRows, deriveAggregateOrderStatus, parseFilledAmountRawDollars, parseDecimalString, getPlaceOrderBuyPayout, getPlaceOrderSellProceeds, getPlaceOrderQuoteValue, resolvePlaceOrderNetResult, resolvePlaceOrderQuoteResult, getTradingRoutePriceLabel, isQuoteBelowVenueMinimum, resolvePlaceOrderQuoteStatus, buildLiveRouteCards, routeCardRequiresKalshi, resolveDefaultRouteCardId, getPlaceOrderRouteCardIdentity, sellSharesToAtomicUnits, atomicUnitsToSellShares, clampSellSharesToAvailability, hasInsufficientVenueInventory, getRemainingVenueSellShares, buildVenueSellQuoteRequests, buildLiveSellRouteCards, resolveExecutionVenueFromQuote, routeCardsHaveSameVenueIdentity, getPlaceOrderPotentialReturn, resolvePrimarySubmittedOrderId, normalizeOrderIdLabelInput, buildPlaceOrderExecutionStepGroups, groupPlaceOrderFailureSteps, buildPlaceOrderExecutionStepGroupsFromFailureSummary, MARKET_RESOLVED_ERROR_PATTERN, VENUE_UNAVAILABLE_ERROR_PATTERN, ALCHEMY_SPONSORSHIP_ERROR_PATTERN, ALCHEMY_PREPARE_CALLS_ERROR_PATTERN, DAG_CHECK_BALANCE_SHORTFALL_PATTERN, VENUE_CONNECTOR_UNREACHABLE_PATTERN, POLYMARKET_DEADLINE_TOO_SOON_PATTERN, SELL_NO_ONCHAIN_POSITION_PATTERN, VENUE_QUOTE_UNFILLABLE_PATTERN, QUOTED_PRICE_UNAVAILABLE_PATTERN, VENUE_MIN_ORDER_SIZE_PATTERN, SOURCE_BALANCE_CHANGED_PATTERN, VENUE_MARKET_RESOLVED_PATTERN, DFLOW_WALLET_UNVERIFIED_PATTERN, VENUE_NO_QUOTE_PATH_PATTERN, SOLANA_BLOCKHASH_EXPIRED_PATTERN, VENUE_RATE_LIMITED_PATTERN, SERVICE_BLOCKED_ORDER_PATTERN, ALCHEMY_BALANCE_REVERT_PATTERN, ALCHEMY_REVERT_DATA_SELECTOR_PATTERN, REVERT_SELECTOR_MESSAGES, ALCHEMY_SPONSORSHIP_POLICY_PATTERN, ALCHEMY_POLICY_MAX_COUNT_PATTERN, ORDER_FAILED_PREFIX_PATTERN, VENUE_TERMINATED_STATUS_PATTERN, friendlyTerminatedStatusMessage, tryParseJsonErrorValue, extractPlaceOrderErrorMessage, normalizePlaceOrderErrorMessage, resolvePlaceOrderFailureKind, resolveFailedVenueStep, resolvePlaceOrderFailureActions, resolveEventExecutionPrice, resolveActualExecutionEconomics, getPlaceOrderUnfilledRemaining, getCanonicalPlaceOrderUnfilledRemaining, buildPlaceOrderFailureSummary, buildPlaceOrderShareText, resolveNextTabFromKey, sanitizePercentageInput, finalizePercentageValue, parsePercentageValue, formatPercentageValue, isPercentageBelowMinimum;
24173
+ var import_sdk27, ATOMIC_UNITS, ATOMIC_UNITS_BIGINT, getPlaceOrderBalanceCacheKey, routePriceLabelFormatter, GEO_BLOCK_WARNING_PREFIX, isFiniteNonNegativePrice, getPlaceOrderAverageExecutionPrice, floorToDecimals, formatFlooredShareAmount, normalizeOutcomeName, findMatchingVenueOutcome, resolveSellableSharesByVenue, buildLimitOrderVenueOptions, resolveAutomaticLimitOrderVenueOption, isGeoBlockWarningReason, extractGeoBlockedVenues, getSmartRouteTotalFees, getPlaceOrderContainerClassName, resolveIsPositiveOutcome, getOutcomeButtonClassName, sortOutcomesYesFirst, mapVenueMarketOutcomesToPlaceOrderOutcomes, mapQuoteDataToRoutingRows, deriveAggregateOrderStatus, parseFilledAmountRawDollars, parseDecimalString, getPlaceOrderBuyPayout, getPlaceOrderSellProceeds, getPlaceOrderQuoteValue, resolvePlaceOrderNetResult, resolvePlaceOrderQuoteResult, getTradingRoutePriceLabel, isQuoteBelowVenueMinimum, resolvePlaceOrderQuoteStatus, buildLiveRouteCards, routeCardRequiresKalshi, resolveDefaultRouteCardId, getPlaceOrderRouteCardIdentity, sellSharesToAtomicUnits, atomicUnitsToSellShares, clampSellSharesToAvailability, hasInsufficientVenueInventory, getRemainingVenueSellShares, buildVenueSellQuoteRequests, buildLiveSellRouteCards, resolveExecutionVenueFromQuote, routeCardsHaveSameVenueIdentity, getPlaceOrderPotentialReturn, resolvePrimarySubmittedOrderId, normalizeOrderIdLabelInput, buildPlaceOrderExecutionStepGroups, groupPlaceOrderFailureSteps, buildPlaceOrderExecutionStepGroupsFromFailureSummary, MARKET_RESOLVED_ERROR_PATTERN, VENUE_UNAVAILABLE_ERROR_PATTERN, ALCHEMY_SPONSORSHIP_ERROR_PATTERN, ALCHEMY_PREPARE_CALLS_ERROR_PATTERN, DAG_CHECK_BALANCE_SHORTFALL_PATTERN, VENUE_CONNECTOR_UNREACHABLE_PATTERN, POLYMARKET_DEADLINE_TOO_SOON_PATTERN, SELL_NO_ONCHAIN_POSITION_PATTERN, VENUE_QUOTE_UNFILLABLE_PATTERN, QUOTED_PRICE_UNAVAILABLE_PATTERN, VENUE_MIN_ORDER_SIZE_PATTERN, SOURCE_BALANCE_CHANGED_PATTERN, VENUE_MARKET_RESOLVED_PATTERN, DFLOW_WALLET_UNVERIFIED_PATTERN, VENUE_NO_QUOTE_PATH_PATTERN, SOLANA_BLOCKHASH_EXPIRED_PATTERN, VENUE_RATE_LIMITED_PATTERN, SERVICE_BLOCKED_ORDER_PATTERN, ALCHEMY_BALANCE_REVERT_PATTERN, ALCHEMY_REVERT_DATA_SELECTOR_PATTERN, REVERT_SELECTOR_MESSAGES, ALCHEMY_SPONSORSHIP_POLICY_PATTERN, ALCHEMY_POLICY_MAX_COUNT_PATTERN, ORDER_FAILED_PREFIX_PATTERN, VENUE_TERMINATED_STATUS_PATTERN, friendlyTerminatedStatusMessage, tryParseJsonErrorValue, extractPlaceOrderErrorMessage, normalizePlaceOrderErrorMessage, resolvePlaceOrderFailureKind, resolveFailedVenueStep, resolvePlaceOrderFailureActions, resolveEventExecutionPrice, resolveActualExecutionEconomics, getPlaceOrderUnfilledRemaining, getCanonicalPlaceOrderUnfilledRemaining, buildPlaceOrderFailureSummary, buildPlaceOrderShareText, resolveNextTabFromKey, sanitizePercentageInput, finalizePercentageValue, parsePercentageValue, formatPercentageValue, isPercentageBelowMinimum, ceilDiv, toRaw6, parseSizeStepRaw, toLimitSizeRaw, isLimitSizeBelowMinimum;
24166
24174
  var init_index_place_order_utils = __esm({
24167
24175
  "src/trading/place-order/index.place-order.utils.ts"() {
24168
24176
  "use strict";
@@ -24489,13 +24497,16 @@ var init_index_place_order_utils = __esm({
24489
24497
  var _a;
24490
24498
  return (_a = quoteData.estimatedPayout) != null ? _a : quoteData.totalFilled;
24491
24499
  };
24492
- getPlaceOrderSellProceeds = (quoteData) => Math.max(
24493
- 0,
24494
- quoteData.rawExecCost - quoteData.fills.reduce((sum, fill) => {
24495
- var _a, _b;
24496
- return sum + ((_a = fill.venueFee) != null ? _a : 0) + ((_b = fill.builderFee) != null ? _b : 0);
24497
- }, 0)
24498
- );
24500
+ getPlaceOrderSellProceeds = (quoteData) => {
24501
+ var _a;
24502
+ return (_a = quoteData.estimatedNetProceeds) != null ? _a : Math.max(
24503
+ 0,
24504
+ quoteData.rawExecCost - quoteData.fills.reduce((sum, fill) => {
24505
+ var _a2, _b;
24506
+ return sum + ((_a2 = fill.venueFee) != null ? _a2 : 0) + ((_b = fill.builderFee) != null ? _b : 0);
24507
+ }, 0)
24508
+ );
24509
+ };
24499
24510
  getPlaceOrderQuoteValue = (quoteData, tradeSide) => tradeSide === "sell" ? getPlaceOrderSellProceeds(quoteData) : getPlaceOrderBuyPayout(quoteData);
24500
24511
  resolvePlaceOrderNetResult = ({
24501
24512
  quoteData,
@@ -25843,6 +25854,38 @@ var init_index_place_order_utils = __esm({
25843
25854
  if (parsedValue === null) return false;
25844
25855
  return parsedValue < minimumValue;
25845
25856
  };
25857
+ ceilDiv = (numerator, denominator) => {
25858
+ return (numerator + denominator - BigInt(1)) / denominator;
25859
+ };
25860
+ toRaw6 = (value) => {
25861
+ const normalizedValue = Number.isFinite(value) ? Math.max(0, value) : 0;
25862
+ return Math.ceil(normalizedValue * Number(import_sdk27.LIMIT_PRICE_RAW_SCALE)).toString();
25863
+ };
25864
+ parseSizeStepRaw = (sizeStepRaw) => {
25865
+ if (!sizeStepRaw || !/^[1-9]\d*$/.test(sizeStepRaw)) return BigInt(1);
25866
+ return BigInt(sizeStepRaw);
25867
+ };
25868
+ toLimitSizeRaw = ({
25869
+ amount: amount2,
25870
+ limitPriceRaw,
25871
+ side,
25872
+ sizeStepRaw
25873
+ }) => {
25874
+ const step = parseSizeStepRaw(sizeStepRaw);
25875
+ if (step <= BigInt(1)) {
25876
+ if (side === "sell") return toRaw6(amount2);
25877
+ const spendRaw = BigInt(toRaw6(amount2));
25878
+ const priceRaw = BigInt(limitPriceRaw);
25879
+ return ceilDiv(spendRaw * import_sdk27.LIMIT_PRICE_RAW_SCALE, priceRaw).toString();
25880
+ }
25881
+ const rawSize = side === "sell" ? BigInt(toRaw6(amount2)) : BigInt(toRaw6(amount2)) * import_sdk27.LIMIT_PRICE_RAW_SCALE / BigInt(limitPriceRaw);
25882
+ return (rawSize / step * step).toString();
25883
+ };
25884
+ isLimitSizeBelowMinimum = (sizeRaw, minSizeRaw) => {
25885
+ const size = BigInt(sizeRaw);
25886
+ if (size <= BigInt(0)) return true;
25887
+ return !!minSizeRaw && /^\d+$/.test(minSizeRaw) && size < BigInt(minSizeRaw);
25888
+ };
25846
25889
  }
25847
25890
  });
25848
25891
 
@@ -26937,7 +26980,7 @@ var init_index_place_order_success = __esm({
26937
26980
  });
26938
26981
 
26939
26982
  // src/trading/place-order/index.tsx
26940
- var import_hooks89, import_sdk28, import_react58, Popover, import_dayjs8, import_timezone2, import_utc2, import_react59, import_jsx_runtime197, SELL_SHARE_INPUT_DECIMALS, SELL_SHARE_DISPLAY_DECIMALS, resolvePlaceOrderPortalContainer, LIMIT_EXPIRATION_OPTION_COUNT, LIMIT_PRICE_STEP, LIMIT_PRICE_MIN, LIMIT_PRICE_MAX, ceilDiv, toRaw6, toLimitPriceRaw, toLimitSizeRaw, formatLimitPriceLabel, formatLimitPriceRawLabel, LIMIT_ORDER_SUBMITTING_PROGRESS, buildLimitOrderExecutionGroup, getLimitOrderToWinValue, normalizeLimitPrice, formatLimitPriceInputValue, parseLimitPriceInputValue, resolveEndOfDayEastern, resolveLimitExpirationDate, serializeLimitOrderExpiration, isFutureLimitExpiration, resolveRefetchedQuoteData, isFillRejection400, PlaceOrderSlippageControl, renderCardHeader, PlaceOrderResolvedView, renderRouteBreakdownRow, SIDE_NAMED_MONEYLINE_QUESTION_RE, shouldUseRawResolvedPlaceOrderOutcomeLabel, renderRouteCard, PlaceOrder;
26983
+ var import_hooks89, import_sdk28, import_react58, Popover, import_dayjs8, import_timezone2, import_utc2, import_react59, import_jsx_runtime197, SELL_SHARE_INPUT_DECIMALS, SELL_SHARE_DISPLAY_DECIMALS, resolvePlaceOrderPortalContainer, LIMIT_EXPIRATION_OPTION_COUNT, LIMIT_SIZE_STEP_VENUES, LIMIT_PRICE_STEP, LIMIT_PRICE_MIN, LIMIT_PRICE_MAX, toLimitPriceRaw, formatLimitPriceLabel, formatLimitPriceRawLabel, LIMIT_ORDER_SUBMITTING_PROGRESS, buildLimitOrderExecutionGroup, getLimitOrderToWinValue, normalizeLimitPrice, formatLimitPriceInputValue, parseLimitPriceInputValue, resolveEndOfDayEastern, resolveLimitExpirationDate, serializeLimitOrderExpiration, isFutureLimitExpiration, resolveRefetchedQuoteData, isFillRejection400, PlaceOrderSlippageControl, renderCardHeader, PlaceOrderResolvedView, renderRouteBreakdownRow, SIDE_NAMED_MONEYLINE_QUESTION_RE, shouldUseRawResolvedPlaceOrderOutcomeLabel, renderRouteCard, PlaceOrder;
26941
26984
  var init_place_order = __esm({
26942
26985
  "src/trading/place-order/index.tsx"() {
26943
26986
  "use strict";
@@ -26995,32 +27038,21 @@ var init_place_order = __esm({
26995
27038
  return (_a = triggerElement == null ? void 0 : triggerElement.closest(".agg-modal-center")) != null ? _a : void 0;
26996
27039
  };
26997
27040
  LIMIT_EXPIRATION_OPTION_COUNT = 5;
27041
+ LIMIT_SIZE_STEP_VENUES = /* @__PURE__ */ new Set([
27042
+ import_sdk28.Venue.tiprun,
27043
+ import_sdk28.Venue.hyperliquid,
27044
+ import_sdk28.Venue.pred,
27045
+ import_sdk28.Venue.polymarket
27046
+ ]);
26998
27047
  import_dayjs8.default.extend(import_utc2.default);
26999
27048
  import_dayjs8.default.extend(import_timezone2.default);
27000
27049
  LIMIT_PRICE_STEP = 1e-3;
27001
27050
  LIMIT_PRICE_MIN = 1e-3;
27002
27051
  LIMIT_PRICE_MAX = 0.999;
27003
- ceilDiv = (numerator, denominator) => {
27004
- return (numerator + denominator - BigInt(1)) / denominator;
27005
- };
27006
- toRaw6 = (value) => {
27007
- const normalizedValue = Number.isFinite(value) ? Math.max(0, value) : 0;
27008
- return Math.ceil(normalizedValue * Number(import_sdk28.LIMIT_PRICE_RAW_SCALE)).toString();
27009
- };
27010
27052
  toLimitPriceRaw = (value) => {
27011
27053
  const clampedValue = Math.min(LIMIT_PRICE_MAX, Math.max(LIMIT_PRICE_MIN, value));
27012
27054
  return Math.round(clampedValue * Number(import_sdk28.LIMIT_PRICE_RAW_SCALE)).toString();
27013
27055
  };
27014
- toLimitSizeRaw = ({
27015
- amount: amount2,
27016
- limitPriceRaw,
27017
- side
27018
- }) => {
27019
- if (side === "sell") return toRaw6(amount2);
27020
- const spendRaw = BigInt(toRaw6(amount2));
27021
- const priceRaw = BigInt(limitPriceRaw);
27022
- return ceilDiv(spendRaw * import_sdk28.LIMIT_PRICE_RAW_SCALE, priceRaw).toString();
27023
- };
27024
27056
  formatLimitPriceLabel = (value) => {
27025
27057
  return `${(value * 100).toLocaleString("en-US", {
27026
27058
  minimumFractionDigits: 0,
@@ -27060,11 +27092,12 @@ var init_place_order = __esm({
27060
27092
  getLimitOrderToWinValue = ({
27061
27093
  amount: amount2,
27062
27094
  limitPriceRaw,
27063
- side
27095
+ side,
27096
+ sizeStepRaw
27064
27097
  }) => {
27065
27098
  const priceRaw = BigInt(limitPriceRaw);
27066
27099
  if (priceRaw <= BigInt(0) || priceRaw >= import_sdk28.LIMIT_PRICE_RAW_SCALE) return 0;
27067
- const sizeRaw = BigInt(toLimitSizeRaw({ amount: amount2, limitPriceRaw, side }));
27100
+ const sizeRaw = BigInt(toLimitSizeRaw({ amount: amount2, limitPriceRaw, side, sizeStepRaw }));
27068
27101
  if (side === "buy") return Number(sizeRaw) / Number(import_sdk28.LIMIT_PRICE_RAW_SCALE);
27069
27102
  return Number(ceilDiv(priceRaw * sizeRaw, import_sdk28.LIMIT_PRICE_RAW_SCALE)) / Number(import_sdk28.LIMIT_PRICE_RAW_SCALE);
27070
27103
  };
@@ -28016,7 +28049,8 @@ var init_place_order = __esm({
28016
28049
  const limitVenueQuoteRequests = (0, import_react59.useMemo)(
28017
28050
  () => visibleLimitVenueOptions.map((option) => ({
28018
28051
  venue: option.venue,
28019
- venueMarketOutcomeId: option.venueMarketOutcomeId
28052
+ venueMarketOutcomeId: option.venueMarketOutcomeId,
28053
+ venueMarketId: option.venueMarketId
28020
28054
  })),
28021
28055
  [visibleLimitVenueOptions]
28022
28056
  );
@@ -28048,10 +28082,83 @@ var init_place_order = __esm({
28048
28082
  }
28049
28083
  return venues;
28050
28084
  }, [limitVenueQuotes.quotes]);
28085
+ const originalLimitPriceRaw = (0, import_react59.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
28086
+ const limitPriceAdjustmentByVenue = (0, import_react59.useMemo)(() => {
28087
+ var _a2;
28088
+ const adjustments = /* @__PURE__ */ new Map();
28089
+ for (const option of visibleLimitVenueOptions) {
28090
+ try {
28091
+ adjustments.set(
28092
+ option.venue,
28093
+ (0, import_sdk28.adjustLimitPriceRawToTick)({
28094
+ limitPriceRaw: originalLimitPriceRaw,
28095
+ side: internalTab,
28096
+ tickSize: (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.tickSize
28097
+ })
28098
+ );
28099
+ } catch (e) {
28100
+ adjustments.set(
28101
+ option.venue,
28102
+ (0, import_sdk28.adjustLimitPriceRawToTick)({
28103
+ limitPriceRaw: originalLimitPriceRaw,
28104
+ side: internalTab,
28105
+ tickSize: null
28106
+ })
28107
+ );
28108
+ }
28109
+ }
28110
+ return adjustments;
28111
+ }, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
28112
+ const limitSizeRulesByVenue = (0, import_react59.useMemo)(() => {
28113
+ var _a2, _b2;
28114
+ const rulesByVenue = /* @__PURE__ */ new Map();
28115
+ for (const quote of limitVenueQuotes.quotes) {
28116
+ if (!quote.sizeStepRaw && !quote.minSizeRaw) continue;
28117
+ rulesByVenue.set(quote.request.venue, {
28118
+ sizeStepRaw: (_a2 = quote.sizeStepRaw) != null ? _a2 : void 0,
28119
+ minSizeRaw: (_b2 = quote.minSizeRaw) != null ? _b2 : void 0
28120
+ });
28121
+ }
28122
+ return rulesByVenue;
28123
+ }, [limitVenueQuotes.quotes]);
28124
+ const belowMinimumLimitVenues = (0, import_react59.useMemo)(() => {
28125
+ var _a2, _b2;
28126
+ const venues = /* @__PURE__ */ new Set();
28127
+ if (!isLimitOrder || internalAmount <= 0) return venues;
28128
+ for (const option of visibleLimitVenueOptions) {
28129
+ if (geoBlockedLimitVenues.has(option.venue) || (0, import_hooks89.getVenueAvailabilityState)({
28130
+ venueId: option.venue,
28131
+ disabledVenues,
28132
+ isConfigLoading: isAppConfigLoading
28133
+ }) !== "available")
28134
+ continue;
28135
+ const rules = limitSizeRulesByVenue.get(option.venue);
28136
+ if (!(rules == null ? void 0 : rules.sizeStepRaw) && !(rules == null ? void 0 : rules.minSizeRaw)) continue;
28137
+ const sizeRaw = toLimitSizeRaw({
28138
+ amount: internalAmount,
28139
+ limitPriceRaw: (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw,
28140
+ side: internalTab,
28141
+ sizeStepRaw: rules.sizeStepRaw
28142
+ });
28143
+ if (isLimitSizeBelowMinimum(sizeRaw, rules.minSizeRaw)) venues.add(option.venue);
28144
+ }
28145
+ return venues;
28146
+ }, [
28147
+ disabledVenues,
28148
+ geoBlockedLimitVenues,
28149
+ internalAmount,
28150
+ internalTab,
28151
+ isAppConfigLoading,
28152
+ isLimitOrder,
28153
+ limitPriceAdjustmentByVenue,
28154
+ limitSizeRulesByVenue,
28155
+ originalLimitPriceRaw,
28156
+ visibleLimitVenueOptions
28157
+ ]);
28051
28158
  const availableLimitVenueOptions = (0, import_react59.useMemo)(() => {
28052
28159
  return visibleLimitVenueOptions.filter((option) => {
28053
28160
  var _a2;
28054
- return !geoBlockedLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
28161
+ return !geoBlockedLimitVenues.has(option.venue) && !belowMinimumLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
28055
28162
  // venue the user has no position on is a guaranteed 409 from the
28056
28163
  // server's reservation check — and the automatic pick, which sorts on
28057
28164
  // price alone, would happily choose one. Only narrow once we know
@@ -28063,6 +28170,7 @@ var init_place_order = __esm({
28063
28170
  }) === "available";
28064
28171
  });
28065
28172
  }, [
28173
+ belowMinimumLimitVenues,
28066
28174
  disabledVenues,
28067
28175
  geoBlockedLimitVenues,
28068
28176
  isAppConfigLoading,
@@ -28920,8 +29028,6 @@ var init_place_order = __esm({
28920
29028
  const isSelectedVenueInventoryInsufficient = isSell && (selectedRouteCard == null ? void 0 : selectedRouteCard.kind) === "venue" && selectedRouteCard.insufficientInventory === true;
28921
29029
  const isBelowClientMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
28922
29030
  const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
28923
- const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
28924
- const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
28925
29031
  const quoteStatus = (0, import_react59.useMemo)(() => {
28926
29032
  if (!orderEligibility.canPlaceOrder) return void 0;
28927
29033
  return resolvePlaceOrderQuoteStatus({
@@ -29048,33 +29154,6 @@ var init_place_order = __esm({
29048
29154
  return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
29049
29155
  }, [selectedRouteCard, tradingLabels]);
29050
29156
  const displayedToWinValue = (_ea = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _ea : 0;
29051
- const originalLimitPriceRaw = (0, import_react59.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
29052
- const limitPriceAdjustmentByVenue = (0, import_react59.useMemo)(() => {
29053
- var _a2;
29054
- const adjustments = /* @__PURE__ */ new Map();
29055
- for (const option of visibleLimitVenueOptions) {
29056
- try {
29057
- adjustments.set(
29058
- option.venue,
29059
- (0, import_sdk28.adjustLimitPriceRawToTick)({
29060
- limitPriceRaw: originalLimitPriceRaw,
29061
- side: internalTab,
29062
- tickSize: (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.tickSize
29063
- })
29064
- );
29065
- } catch (e) {
29066
- adjustments.set(
29067
- option.venue,
29068
- (0, import_sdk28.adjustLimitPriceRawToTick)({
29069
- limitPriceRaw: originalLimitPriceRaw,
29070
- side: internalTab,
29071
- tickSize: null
29072
- })
29073
- );
29074
- }
29075
- }
29076
- return adjustments;
29077
- }, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
29078
29157
  const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
29079
29158
  const selectedLimitPriceRaw = (_fa = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _fa : originalLimitPriceRaw;
29080
29159
  const limitPriceAdjustmentMessage = (0, import_react59.useMemo)(() => {
@@ -29095,6 +29174,8 @@ var init_place_order = __esm({
29095
29174
  selectedLimitVenueOption,
29096
29175
  tradingLabels
29097
29176
  ]);
29177
+ const selectedLimitSizeRules = selectedLimitVenueOption ? limitSizeRulesByVenue.get(selectedLimitVenueOption.venue) : void 0;
29178
+ const isLimitSizeRulesPending = isLimitOrder && selectedLimitVenueOption != null && LIMIT_SIZE_STEP_VENUES.has(selectedLimitVenueOption.venue) && limitVenueQuotes.isMetadataPending;
29098
29179
  const limitOrderPayload = (0, import_react59.useMemo)(() => {
29099
29180
  if (!selectedLimitVenueOption || internalAmount <= 0) return null;
29100
29181
  if (limitPriceInputError) return null;
@@ -29110,7 +29191,8 @@ var init_place_order = __esm({
29110
29191
  const sizeRaw = toLimitSizeRaw({
29111
29192
  amount: internalAmount,
29112
29193
  limitPriceRaw,
29113
- side: internalTab
29194
+ side: internalTab,
29195
+ sizeStepRaw: selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.sizeStepRaw
29114
29196
  });
29115
29197
  const expiresAt = expirationDate ? serializeLimitOrderExpiration(expirationDate) : void 0;
29116
29198
  return __spreadValues({
@@ -29129,8 +29211,12 @@ var init_place_order = __esm({
29129
29211
  limitExpirationType,
29130
29212
  limitPriceInputError,
29131
29213
  selectedLimitVenueOption,
29132
- selectedLimitPriceRaw
29214
+ selectedLimitPriceRaw,
29215
+ selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.sizeStepRaw
29133
29216
  ]);
29217
+ const isLimitSizeBelowVenueMinimum = isLimitOrder && (limitOrderPayload != null && isLimitSizeBelowMinimum(limitOrderPayload.sizeRaw, selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.minSizeRaw) || selectedLimitVenueOption == null && belowMinimumLimitVenues.size > 0);
29218
+ const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote || isLimitSizeBelowVenueMinimum;
29219
+ const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : isSell ? tradingLabels.venueMinOrderSize : tradingLabels.minOrderSizeViolated;
29134
29220
  const resolvedLimitExpirationDraftDate = (0, import_react59.useMemo)(() => {
29135
29221
  return resolveLimitExpirationDate({
29136
29222
  expirationType: "CUSTOM",
@@ -29174,12 +29260,13 @@ var init_place_order = __esm({
29174
29260
  }, [internalTab, limitOrderPayload]);
29175
29261
  const limitRouteCards = (0, import_react59.useMemo)(() => {
29176
29262
  return visibleLimitVenueOptions.map((option) => {
29177
- var _a2, _b2, _c2, _d2;
29263
+ var _a2, _b2, _c2, _d2, _e2;
29178
29264
  const effectiveLimitPriceRaw = (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw;
29179
29265
  const venueToWinValue = getLimitOrderToWinValue({
29180
29266
  amount: internalAmount,
29181
29267
  limitPriceRaw: effectiveLimitPriceRaw,
29182
- side: internalTab
29268
+ side: internalTab,
29269
+ sizeStepRaw: (_c2 = limitSizeRulesByVenue.get(option.venue)) == null ? void 0 : _c2.sizeStepRaw
29183
29270
  });
29184
29271
  const availabilityState = (0, import_hooks89.getVenueAvailabilityState)({
29185
29272
  venueId: option.venue,
@@ -29187,10 +29274,10 @@ var init_place_order = __esm({
29187
29274
  isConfigLoading: isAppConfigLoading
29188
29275
  });
29189
29276
  const isGeoBlocked = geoBlockedLimitVenues.has(option.venue);
29190
- const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
29277
+ const isUnavailable = isTradingBlocked || isGeoBlocked || belowMinimumLimitVenues.has(option.venue) || availabilityState !== "available";
29191
29278
  const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
29192
29279
  const totalFees = getSmartRouteTotalFees(
29193
- (_d2 = (_c2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _c2.data) == null ? void 0 : _d2.feeBreakdown
29280
+ (_e2 = (_d2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _d2.data) == null ? void 0 : _e2.feeBreakdown
29194
29281
  );
29195
29282
  const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
29196
29283
  return {
@@ -29209,6 +29296,7 @@ var init_place_order = __esm({
29209
29296
  };
29210
29297
  });
29211
29298
  }, [
29299
+ belowMinimumLimitVenues,
29212
29300
  disabledVenues,
29213
29301
  formatPrice,
29214
29302
  geoBlockedLimitVenues,
@@ -29217,6 +29305,7 @@ var init_place_order = __esm({
29217
29305
  isAppConfigLoading,
29218
29306
  isTradingBlocked,
29219
29307
  limitPriceAdjustmentByVenue,
29308
+ limitSizeRulesByVenue,
29220
29309
  limitVenueQuoteByVenue,
29221
29310
  originalLimitPriceRaw,
29222
29311
  tradingLabels,
@@ -29315,10 +29404,10 @@ var init_place_order = __esm({
29315
29404
  const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
29316
29405
  return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
29317
29406
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
29318
- const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
29407
+ const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable) && limitRouteCards.some((card) => !card.venue || !belowMinimumLimitVenues.has(card.venue));
29319
29408
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
29320
- const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isBetdexBalanceUnavailable && !canExecuteBetdexQuote || isQuoteInsufficientBalance && !canExecuteBetdexQuote || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || isSelectedVenueInventoryInsufficient || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId && !canExecuteBetdexQuote) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0 && !canExecuteBetdexQuote;
29321
- const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
29409
+ const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isBetdexBalanceUnavailable && !canExecuteBetdexQuote || isQuoteInsufficientBalance && !canExecuteBetdexQuote || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || isLimitSizeRulesPending || !isLimitOrder && isQuoteLoading || isSelectedVenueInventoryInsufficient || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId && !canExecuteBetdexQuote) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0 && !canExecuteBetdexQuote;
29410
+ const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowClientMinimum && !isBelowVenueMinimumFromQuote && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
29322
29411
  const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
29323
29412
  const handleReturnToOrderForm = (0, import_react59.useCallback)(() => {
29324
29413
  const submittedSelection = submittedSelectionRef.current;
package/dist/index.mjs CHANGED
@@ -16,13 +16,13 @@ import {
16
16
  buildAggTxExplorerHref,
17
17
  formatShareAmount,
18
18
  useHomePageModals
19
- } from "./chunk-G4KXZ5XX.mjs";
19
+ } from "./chunk-PN5HEBFC.mjs";
20
20
  import {
21
21
  EventList,
22
22
  EventListItem,
23
23
  EventListItemV2,
24
24
  EventListVenueStrip
25
- } from "./chunk-MDCFCGA3.mjs";
25
+ } from "./chunk-EJXA32MG.mjs";
26
26
  import {
27
27
  CARD_NETWORK_OPTIONS,
28
28
  DepositModal,
@@ -40,7 +40,7 @@ import {
40
40
  EventOpenOrdersCard,
41
41
  formatRecurringCountdown,
42
42
  useEventOpenOrders
43
- } from "./chunk-Q5NJCH5O.mjs";
43
+ } from "./chunk-6CZNJSRL.mjs";
44
44
  import {
45
45
  EventListItemDetails,
46
46
  MarketDetails,
@@ -55,7 +55,7 @@ import {
55
55
  orderbookRowLimitDefault,
56
56
  resolveEventDetailsSyncKey,
57
57
  useCenterOrderbookSpread
58
- } from "./chunk-YYGS6S7N.mjs";
58
+ } from "./chunk-7G2GTWAS.mjs";
59
59
  import {
60
60
  AggNotificationEventsProvider,
61
61
  DEPOSIT_MODAL_OPEN_EVENT,
@@ -77,7 +77,7 @@ import {
77
77
  useResolvedMarketClaim,
78
78
  useSharedKycFlow,
79
79
  venueRequiresSharedKyc
80
- } from "./chunk-HZXHDH6G.mjs";
80
+ } from "./chunk-KN7JN7F5.mjs";
81
81
  import {
82
82
  SETTLEMENT_SECTION_ID,
83
83
  Settlement,