@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/pages.js CHANGED
@@ -16589,7 +16589,7 @@ var init_item_details = __esm({
16589
16589
  recurringMarkets,
16590
16590
  sportsLiveState
16591
16591
  }) => {
16592
- var _a, _b, _c, _d, _e, _f;
16592
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
16593
16593
  const [selectedChartType, setSelectedChartType] = (0, import_react36.useState)("line");
16594
16594
  const [chartView, setChartView] = (0, import_react36.useState)(defaultChartView);
16595
16595
  const lastAppliedEventSyncKeyRef = (0, import_react36.useRef)(null);
@@ -16601,10 +16601,18 @@ var init_item_details = __esm({
16601
16601
  const labels = (0, import_hooks59.useLabels)();
16602
16602
  const tradingContext = (0, import_hooks46.useEventTradingContext)();
16603
16603
  const eventSyncKey = (0, import_react36.useMemo)(() => resolveEventDetailsSyncKey(event), [event]);
16604
+ const { eventQuery: deferredDetailsQuery } = (0, import_hooks59.useSettlementDetailsData)({
16605
+ eventId: event.id,
16606
+ enabled: true,
16607
+ needsEvent: event.detailsDeferred === true,
16608
+ needsMarket: false
16609
+ });
16610
+ const summaryDescription = (_b = (_a = deferredDetailsQuery.data) == null ? void 0 : _a.description) != null ? _b : event.description;
16611
+ const summarySettlementDiff = (_d = (_c = deferredDetailsQuery.data) == null ? void 0 : _c.settlementDiff) != null ? _d : event.settlementDiff;
16604
16612
  const resolvedEventTradingState = (0, import_react36.useMemo)(() => {
16605
16613
  return eventTradingState != null ? eventTradingState : (0, import_hooks59.resolveEventTradingState)(event);
16606
16614
  }, [event, eventTradingState]);
16607
- const scopedSelectedMarket = (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? (_a = tradingContext.selectedMarket) != null ? _a : resolvedEventTradingState.primaryMarket : resolvedEventTradingState.primaryMarket;
16615
+ const scopedSelectedMarket = (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? (_e = tradingContext.selectedMarket) != null ? _e : resolvedEventTradingState.primaryMarket : resolvedEventTradingState.primaryMarket;
16608
16616
  const venueMarkets = (0, import_react36.useMemo)(
16609
16617
  () => resolvedEventTradingState.displayMarkets,
16610
16618
  [resolvedEventTradingState.displayMarkets]
@@ -16643,7 +16651,7 @@ var init_item_details = __esm({
16643
16651
  bestMidpoint: void 0,
16644
16652
  bestMidpointVenue: void 0
16645
16653
  };
16646
- const restMidpoints = (_b = resolvedMidpointsResult.bestMidpointsByOutcomeId) != null ? _b : resolvedMidpointsResult.prices;
16654
+ const restMidpoints = (_f = resolvedMidpointsResult.bestMidpointsByOutcomeId) != null ? _f : resolvedMidpointsResult.prices;
16647
16655
  const bestMidpoint = resolvedMidpointsResult.bestMidpoint;
16648
16656
  const restBestPrices = resolvedMidpointsResult.bestPrices;
16649
16657
  const bestPrices = (0, import_react36.useMemo)(
@@ -16748,7 +16756,7 @@ var init_item_details = __esm({
16748
16756
  Card,
16749
16757
  {
16750
16758
  className: cn("group/agg-event-details", detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
16751
- "aria-label": ariaLabel != null ? ariaLabel : [resolvedTitle.title, (_c = recurringMarkets == null ? void 0 : recurringMarkets.windowLabel) != null ? _c : resolvedTitle.timestampLabel].filter(Boolean).join(" "),
16759
+ "aria-label": ariaLabel != null ? ariaLabel : [resolvedTitle.title, (_g = recurringMarkets == null ? void 0 : recurringMarkets.windowLabel) != null ? _g : resolvedTitle.timestampLabel].filter(Boolean).join(" "),
16752
16760
  onClick: onClick ? () => onClick(event) : void 0,
16753
16761
  children: [
16754
16762
  /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(
@@ -16845,7 +16853,7 @@ var init_item_details = __esm({
16845
16853
  {
16846
16854
  role: "timer",
16847
16855
  "aria-live": "off",
16848
- "aria-label": (_d = recurringMarkets.countdownAriaLabel) != null ? _d : void 0,
16856
+ "aria-label": (_h = recurringMarkets.countdownAriaLabel) != null ? _h : void 0,
16849
16857
  className: "flex shrink-0 items-center gap-1.5 text-agg-foreground",
16850
16858
  children: [
16851
16859
  /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
@@ -16866,7 +16874,7 @@ var init_item_details = __esm({
16866
16874
  {
16867
16875
  className: classNames == null ? void 0 : classNames.headerPills,
16868
16876
  options: marketOptions,
16869
- selectedValue: (_e = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _e : "",
16877
+ selectedValue: (_i = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _i : "",
16870
16878
  onChange: (marketId) => {
16871
16879
  tradingContext == null ? void 0 : tradingContext.selectMarket(marketId);
16872
16880
  setChartView("selected");
@@ -16931,7 +16939,7 @@ var init_item_details = __esm({
16931
16939
  selectedChartType,
16932
16940
  venueInfo,
16933
16941
  venueMarkets,
16934
- selectedMarketId: (_f = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _f : null,
16942
+ selectedMarketId: (_j = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _j : null,
16935
16943
  livePrices,
16936
16944
  restMidpoints,
16937
16945
  bestMidpoint,
@@ -17003,7 +17011,7 @@ var init_item_details = __esm({
17003
17011
  }
17004
17012
  )
17005
17013
  ] }),
17006
- event.description || event.settlementDiff ? /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(SettlementSummary, { content: event.description, settlementDiff: event.settlementDiff }) : null
17014
+ summaryDescription || summarySettlementDiff ? /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(SettlementSummary, { content: summaryDescription, settlementDiff: summarySettlementDiff }) : null
17007
17015
  ]
17008
17016
  }
17009
17017
  );
@@ -23440,7 +23448,7 @@ function lookupRevertSelectorMessage(message) {
23440
23448
  if (!selector) return null;
23441
23449
  return (_b = REVERT_SELECTOR_MESSAGES[selector]) != null ? _b : null;
23442
23450
  }
23443
- 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;
23451
+ 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;
23444
23452
  var init_index_place_order_utils = __esm({
23445
23453
  "src/trading/place-order/index.place-order.utils.ts"() {
23446
23454
  "use strict";
@@ -23767,13 +23775,16 @@ var init_index_place_order_utils = __esm({
23767
23775
  var _a;
23768
23776
  return (_a = quoteData.estimatedPayout) != null ? _a : quoteData.totalFilled;
23769
23777
  };
23770
- getPlaceOrderSellProceeds = (quoteData) => Math.max(
23771
- 0,
23772
- quoteData.rawExecCost - quoteData.fills.reduce((sum, fill) => {
23773
- var _a, _b;
23774
- return sum + ((_a = fill.venueFee) != null ? _a : 0) + ((_b = fill.builderFee) != null ? _b : 0);
23775
- }, 0)
23776
- );
23778
+ getPlaceOrderSellProceeds = (quoteData) => {
23779
+ var _a;
23780
+ return (_a = quoteData.estimatedNetProceeds) != null ? _a : Math.max(
23781
+ 0,
23782
+ quoteData.rawExecCost - quoteData.fills.reduce((sum, fill) => {
23783
+ var _a2, _b;
23784
+ return sum + ((_a2 = fill.venueFee) != null ? _a2 : 0) + ((_b = fill.builderFee) != null ? _b : 0);
23785
+ }, 0)
23786
+ );
23787
+ };
23777
23788
  getPlaceOrderQuoteValue = (quoteData, tradeSide) => tradeSide === "sell" ? getPlaceOrderSellProceeds(quoteData) : getPlaceOrderBuyPayout(quoteData);
23778
23789
  resolvePlaceOrderNetResult = ({
23779
23790
  quoteData,
@@ -25121,6 +25132,38 @@ var init_index_place_order_utils = __esm({
25121
25132
  if (parsedValue === null) return false;
25122
25133
  return parsedValue < minimumValue;
25123
25134
  };
25135
+ ceilDiv = (numerator, denominator) => {
25136
+ return (numerator + denominator - BigInt(1)) / denominator;
25137
+ };
25138
+ toRaw6 = (value) => {
25139
+ const normalizedValue = Number.isFinite(value) ? Math.max(0, value) : 0;
25140
+ return Math.ceil(normalizedValue * Number(import_sdk27.LIMIT_PRICE_RAW_SCALE)).toString();
25141
+ };
25142
+ parseSizeStepRaw = (sizeStepRaw) => {
25143
+ if (!sizeStepRaw || !/^[1-9]\d*$/.test(sizeStepRaw)) return BigInt(1);
25144
+ return BigInt(sizeStepRaw);
25145
+ };
25146
+ toLimitSizeRaw = ({
25147
+ amount: amount2,
25148
+ limitPriceRaw,
25149
+ side,
25150
+ sizeStepRaw
25151
+ }) => {
25152
+ const step = parseSizeStepRaw(sizeStepRaw);
25153
+ if (step <= BigInt(1)) {
25154
+ if (side === "sell") return toRaw6(amount2);
25155
+ const spendRaw = BigInt(toRaw6(amount2));
25156
+ const priceRaw = BigInt(limitPriceRaw);
25157
+ return ceilDiv(spendRaw * import_sdk27.LIMIT_PRICE_RAW_SCALE, priceRaw).toString();
25158
+ }
25159
+ const rawSize = side === "sell" ? BigInt(toRaw6(amount2)) : BigInt(toRaw6(amount2)) * import_sdk27.LIMIT_PRICE_RAW_SCALE / BigInt(limitPriceRaw);
25160
+ return (rawSize / step * step).toString();
25161
+ };
25162
+ isLimitSizeBelowMinimum = (sizeRaw, minSizeRaw) => {
25163
+ const size = BigInt(sizeRaw);
25164
+ if (size <= BigInt(0)) return true;
25165
+ return !!minSizeRaw && /^\d+$/.test(minSizeRaw) && size < BigInt(minSizeRaw);
25166
+ };
25124
25167
  }
25125
25168
  });
25126
25169
 
@@ -26215,7 +26258,7 @@ var init_index_place_order_success = __esm({
26215
26258
  });
26216
26259
 
26217
26260
  // src/trading/place-order/index.tsx
26218
- var import_hooks86, import_sdk28, import_react58, Popover, import_dayjs8, import_timezone2, import_utc2, import_react59, import_jsx_runtime192, 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;
26261
+ var import_hooks86, import_sdk28, import_react58, Popover, import_dayjs8, import_timezone2, import_utc2, import_react59, import_jsx_runtime192, 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;
26219
26262
  var init_place_order = __esm({
26220
26263
  "src/trading/place-order/index.tsx"() {
26221
26264
  "use strict";
@@ -26270,32 +26313,21 @@ var init_place_order = __esm({
26270
26313
  return (_a = triggerElement == null ? void 0 : triggerElement.closest(".agg-modal-center")) != null ? _a : void 0;
26271
26314
  };
26272
26315
  LIMIT_EXPIRATION_OPTION_COUNT = 5;
26316
+ LIMIT_SIZE_STEP_VENUES = /* @__PURE__ */ new Set([
26317
+ import_sdk28.Venue.tiprun,
26318
+ import_sdk28.Venue.hyperliquid,
26319
+ import_sdk28.Venue.pred,
26320
+ import_sdk28.Venue.polymarket
26321
+ ]);
26273
26322
  import_dayjs8.default.extend(import_utc2.default);
26274
26323
  import_dayjs8.default.extend(import_timezone2.default);
26275
26324
  LIMIT_PRICE_STEP = 1e-3;
26276
26325
  LIMIT_PRICE_MIN = 1e-3;
26277
26326
  LIMIT_PRICE_MAX = 0.999;
26278
- ceilDiv = (numerator, denominator) => {
26279
- return (numerator + denominator - BigInt(1)) / denominator;
26280
- };
26281
- toRaw6 = (value) => {
26282
- const normalizedValue = Number.isFinite(value) ? Math.max(0, value) : 0;
26283
- return Math.ceil(normalizedValue * Number(import_sdk28.LIMIT_PRICE_RAW_SCALE)).toString();
26284
- };
26285
26327
  toLimitPriceRaw = (value) => {
26286
26328
  const clampedValue = Math.min(LIMIT_PRICE_MAX, Math.max(LIMIT_PRICE_MIN, value));
26287
26329
  return Math.round(clampedValue * Number(import_sdk28.LIMIT_PRICE_RAW_SCALE)).toString();
26288
26330
  };
26289
- toLimitSizeRaw = ({
26290
- amount: amount2,
26291
- limitPriceRaw,
26292
- side
26293
- }) => {
26294
- if (side === "sell") return toRaw6(amount2);
26295
- const spendRaw = BigInt(toRaw6(amount2));
26296
- const priceRaw = BigInt(limitPriceRaw);
26297
- return ceilDiv(spendRaw * import_sdk28.LIMIT_PRICE_RAW_SCALE, priceRaw).toString();
26298
- };
26299
26331
  formatLimitPriceLabel = (value) => {
26300
26332
  return `${(value * 100).toLocaleString("en-US", {
26301
26333
  minimumFractionDigits: 0,
@@ -26335,11 +26367,12 @@ var init_place_order = __esm({
26335
26367
  getLimitOrderToWinValue = ({
26336
26368
  amount: amount2,
26337
26369
  limitPriceRaw,
26338
- side
26370
+ side,
26371
+ sizeStepRaw
26339
26372
  }) => {
26340
26373
  const priceRaw = BigInt(limitPriceRaw);
26341
26374
  if (priceRaw <= BigInt(0) || priceRaw >= import_sdk28.LIMIT_PRICE_RAW_SCALE) return 0;
26342
- const sizeRaw = BigInt(toLimitSizeRaw({ amount: amount2, limitPriceRaw, side }));
26375
+ const sizeRaw = BigInt(toLimitSizeRaw({ amount: amount2, limitPriceRaw, side, sizeStepRaw }));
26343
26376
  if (side === "buy") return Number(sizeRaw) / Number(import_sdk28.LIMIT_PRICE_RAW_SCALE);
26344
26377
  return Number(ceilDiv(priceRaw * sizeRaw, import_sdk28.LIMIT_PRICE_RAW_SCALE)) / Number(import_sdk28.LIMIT_PRICE_RAW_SCALE);
26345
26378
  };
@@ -27291,7 +27324,8 @@ var init_place_order = __esm({
27291
27324
  const limitVenueQuoteRequests = (0, import_react59.useMemo)(
27292
27325
  () => visibleLimitVenueOptions.map((option) => ({
27293
27326
  venue: option.venue,
27294
- venueMarketOutcomeId: option.venueMarketOutcomeId
27327
+ venueMarketOutcomeId: option.venueMarketOutcomeId,
27328
+ venueMarketId: option.venueMarketId
27295
27329
  })),
27296
27330
  [visibleLimitVenueOptions]
27297
27331
  );
@@ -27323,10 +27357,83 @@ var init_place_order = __esm({
27323
27357
  }
27324
27358
  return venues;
27325
27359
  }, [limitVenueQuotes.quotes]);
27360
+ const originalLimitPriceRaw = (0, import_react59.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
27361
+ const limitPriceAdjustmentByVenue = (0, import_react59.useMemo)(() => {
27362
+ var _a2;
27363
+ const adjustments = /* @__PURE__ */ new Map();
27364
+ for (const option of visibleLimitVenueOptions) {
27365
+ try {
27366
+ adjustments.set(
27367
+ option.venue,
27368
+ (0, import_sdk28.adjustLimitPriceRawToTick)({
27369
+ limitPriceRaw: originalLimitPriceRaw,
27370
+ side: internalTab,
27371
+ tickSize: (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.tickSize
27372
+ })
27373
+ );
27374
+ } catch (e) {
27375
+ adjustments.set(
27376
+ option.venue,
27377
+ (0, import_sdk28.adjustLimitPriceRawToTick)({
27378
+ limitPriceRaw: originalLimitPriceRaw,
27379
+ side: internalTab,
27380
+ tickSize: null
27381
+ })
27382
+ );
27383
+ }
27384
+ }
27385
+ return adjustments;
27386
+ }, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
27387
+ const limitSizeRulesByVenue = (0, import_react59.useMemo)(() => {
27388
+ var _a2, _b2;
27389
+ const rulesByVenue = /* @__PURE__ */ new Map();
27390
+ for (const quote of limitVenueQuotes.quotes) {
27391
+ if (!quote.sizeStepRaw && !quote.minSizeRaw) continue;
27392
+ rulesByVenue.set(quote.request.venue, {
27393
+ sizeStepRaw: (_a2 = quote.sizeStepRaw) != null ? _a2 : void 0,
27394
+ minSizeRaw: (_b2 = quote.minSizeRaw) != null ? _b2 : void 0
27395
+ });
27396
+ }
27397
+ return rulesByVenue;
27398
+ }, [limitVenueQuotes.quotes]);
27399
+ const belowMinimumLimitVenues = (0, import_react59.useMemo)(() => {
27400
+ var _a2, _b2;
27401
+ const venues = /* @__PURE__ */ new Set();
27402
+ if (!isLimitOrder || internalAmount <= 0) return venues;
27403
+ for (const option of visibleLimitVenueOptions) {
27404
+ if (geoBlockedLimitVenues.has(option.venue) || (0, import_hooks86.getVenueAvailabilityState)({
27405
+ venueId: option.venue,
27406
+ disabledVenues,
27407
+ isConfigLoading: isAppConfigLoading
27408
+ }) !== "available")
27409
+ continue;
27410
+ const rules = limitSizeRulesByVenue.get(option.venue);
27411
+ if (!(rules == null ? void 0 : rules.sizeStepRaw) && !(rules == null ? void 0 : rules.minSizeRaw)) continue;
27412
+ const sizeRaw = toLimitSizeRaw({
27413
+ amount: internalAmount,
27414
+ limitPriceRaw: (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw,
27415
+ side: internalTab,
27416
+ sizeStepRaw: rules.sizeStepRaw
27417
+ });
27418
+ if (isLimitSizeBelowMinimum(sizeRaw, rules.minSizeRaw)) venues.add(option.venue);
27419
+ }
27420
+ return venues;
27421
+ }, [
27422
+ disabledVenues,
27423
+ geoBlockedLimitVenues,
27424
+ internalAmount,
27425
+ internalTab,
27426
+ isAppConfigLoading,
27427
+ isLimitOrder,
27428
+ limitPriceAdjustmentByVenue,
27429
+ limitSizeRulesByVenue,
27430
+ originalLimitPriceRaw,
27431
+ visibleLimitVenueOptions
27432
+ ]);
27326
27433
  const availableLimitVenueOptions = (0, import_react59.useMemo)(() => {
27327
27434
  return visibleLimitVenueOptions.filter((option) => {
27328
27435
  var _a2;
27329
- return !geoBlockedLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
27436
+ return !geoBlockedLimitVenues.has(option.venue) && !belowMinimumLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
27330
27437
  // venue the user has no position on is a guaranteed 409 from the
27331
27438
  // server's reservation check — and the automatic pick, which sorts on
27332
27439
  // price alone, would happily choose one. Only narrow once we know
@@ -27338,6 +27445,7 @@ var init_place_order = __esm({
27338
27445
  }) === "available";
27339
27446
  });
27340
27447
  }, [
27448
+ belowMinimumLimitVenues,
27341
27449
  disabledVenues,
27342
27450
  geoBlockedLimitVenues,
27343
27451
  isAppConfigLoading,
@@ -28195,8 +28303,6 @@ var init_place_order = __esm({
28195
28303
  const isSelectedVenueInventoryInsufficient = isSell && (selectedRouteCard == null ? void 0 : selectedRouteCard.kind) === "venue" && selectedRouteCard.insufficientInventory === true;
28196
28304
  const isBelowClientMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
28197
28305
  const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
28198
- const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
28199
- const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
28200
28306
  const quoteStatus = (0, import_react59.useMemo)(() => {
28201
28307
  if (!orderEligibility.canPlaceOrder) return void 0;
28202
28308
  return resolvePlaceOrderQuoteStatus({
@@ -28323,33 +28429,6 @@ var init_place_order = __esm({
28323
28429
  return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
28324
28430
  }, [selectedRouteCard, tradingLabels]);
28325
28431
  const displayedToWinValue = (_ea = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _ea : 0;
28326
- const originalLimitPriceRaw = (0, import_react59.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
28327
- const limitPriceAdjustmentByVenue = (0, import_react59.useMemo)(() => {
28328
- var _a2;
28329
- const adjustments = /* @__PURE__ */ new Map();
28330
- for (const option of visibleLimitVenueOptions) {
28331
- try {
28332
- adjustments.set(
28333
- option.venue,
28334
- (0, import_sdk28.adjustLimitPriceRawToTick)({
28335
- limitPriceRaw: originalLimitPriceRaw,
28336
- side: internalTab,
28337
- tickSize: (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.tickSize
28338
- })
28339
- );
28340
- } catch (e) {
28341
- adjustments.set(
28342
- option.venue,
28343
- (0, import_sdk28.adjustLimitPriceRawToTick)({
28344
- limitPriceRaw: originalLimitPriceRaw,
28345
- side: internalTab,
28346
- tickSize: null
28347
- })
28348
- );
28349
- }
28350
- }
28351
- return adjustments;
28352
- }, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
28353
28432
  const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
28354
28433
  const selectedLimitPriceRaw = (_fa = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _fa : originalLimitPriceRaw;
28355
28434
  const limitPriceAdjustmentMessage = (0, import_react59.useMemo)(() => {
@@ -28370,6 +28449,8 @@ var init_place_order = __esm({
28370
28449
  selectedLimitVenueOption,
28371
28450
  tradingLabels
28372
28451
  ]);
28452
+ const selectedLimitSizeRules = selectedLimitVenueOption ? limitSizeRulesByVenue.get(selectedLimitVenueOption.venue) : void 0;
28453
+ const isLimitSizeRulesPending = isLimitOrder && selectedLimitVenueOption != null && LIMIT_SIZE_STEP_VENUES.has(selectedLimitVenueOption.venue) && limitVenueQuotes.isMetadataPending;
28373
28454
  const limitOrderPayload = (0, import_react59.useMemo)(() => {
28374
28455
  if (!selectedLimitVenueOption || internalAmount <= 0) return null;
28375
28456
  if (limitPriceInputError) return null;
@@ -28385,7 +28466,8 @@ var init_place_order = __esm({
28385
28466
  const sizeRaw = toLimitSizeRaw({
28386
28467
  amount: internalAmount,
28387
28468
  limitPriceRaw,
28388
- side: internalTab
28469
+ side: internalTab,
28470
+ sizeStepRaw: selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.sizeStepRaw
28389
28471
  });
28390
28472
  const expiresAt = expirationDate ? serializeLimitOrderExpiration(expirationDate) : void 0;
28391
28473
  return __spreadValues({
@@ -28404,8 +28486,12 @@ var init_place_order = __esm({
28404
28486
  limitExpirationType,
28405
28487
  limitPriceInputError,
28406
28488
  selectedLimitVenueOption,
28407
- selectedLimitPriceRaw
28489
+ selectedLimitPriceRaw,
28490
+ selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.sizeStepRaw
28408
28491
  ]);
28492
+ const isLimitSizeBelowVenueMinimum = isLimitOrder && (limitOrderPayload != null && isLimitSizeBelowMinimum(limitOrderPayload.sizeRaw, selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.minSizeRaw) || selectedLimitVenueOption == null && belowMinimumLimitVenues.size > 0);
28493
+ const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote || isLimitSizeBelowVenueMinimum;
28494
+ const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : isSell ? tradingLabels.venueMinOrderSize : tradingLabels.minOrderSizeViolated;
28409
28495
  const resolvedLimitExpirationDraftDate = (0, import_react59.useMemo)(() => {
28410
28496
  return resolveLimitExpirationDate({
28411
28497
  expirationType: "CUSTOM",
@@ -28449,12 +28535,13 @@ var init_place_order = __esm({
28449
28535
  }, [internalTab, limitOrderPayload]);
28450
28536
  const limitRouteCards = (0, import_react59.useMemo)(() => {
28451
28537
  return visibleLimitVenueOptions.map((option) => {
28452
- var _a2, _b2, _c2, _d2;
28538
+ var _a2, _b2, _c2, _d2, _e2;
28453
28539
  const effectiveLimitPriceRaw = (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw;
28454
28540
  const venueToWinValue = getLimitOrderToWinValue({
28455
28541
  amount: internalAmount,
28456
28542
  limitPriceRaw: effectiveLimitPriceRaw,
28457
- side: internalTab
28543
+ side: internalTab,
28544
+ sizeStepRaw: (_c2 = limitSizeRulesByVenue.get(option.venue)) == null ? void 0 : _c2.sizeStepRaw
28458
28545
  });
28459
28546
  const availabilityState = (0, import_hooks86.getVenueAvailabilityState)({
28460
28547
  venueId: option.venue,
@@ -28462,10 +28549,10 @@ var init_place_order = __esm({
28462
28549
  isConfigLoading: isAppConfigLoading
28463
28550
  });
28464
28551
  const isGeoBlocked = geoBlockedLimitVenues.has(option.venue);
28465
- const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
28552
+ const isUnavailable = isTradingBlocked || isGeoBlocked || belowMinimumLimitVenues.has(option.venue) || availabilityState !== "available";
28466
28553
  const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
28467
28554
  const totalFees = getSmartRouteTotalFees(
28468
- (_d2 = (_c2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _c2.data) == null ? void 0 : _d2.feeBreakdown
28555
+ (_e2 = (_d2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _d2.data) == null ? void 0 : _e2.feeBreakdown
28469
28556
  );
28470
28557
  const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
28471
28558
  return {
@@ -28484,6 +28571,7 @@ var init_place_order = __esm({
28484
28571
  };
28485
28572
  });
28486
28573
  }, [
28574
+ belowMinimumLimitVenues,
28487
28575
  disabledVenues,
28488
28576
  formatPrice,
28489
28577
  geoBlockedLimitVenues,
@@ -28492,6 +28580,7 @@ var init_place_order = __esm({
28492
28580
  isAppConfigLoading,
28493
28581
  isTradingBlocked,
28494
28582
  limitPriceAdjustmentByVenue,
28583
+ limitSizeRulesByVenue,
28495
28584
  limitVenueQuoteByVenue,
28496
28585
  originalLimitPriceRaw,
28497
28586
  tradingLabels,
@@ -28590,10 +28679,10 @@ var init_place_order = __esm({
28590
28679
  const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
28591
28680
  return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
28592
28681
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
28593
- const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
28682
+ const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable) && limitRouteCards.some((card) => !card.venue || !belowMinimumLimitVenues.has(card.venue));
28594
28683
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
28595
- 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;
28596
- const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
28684
+ 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;
28685
+ const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowClientMinimum && !isBelowVenueMinimumFromQuote && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
28597
28686
  const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
28598
28687
  const handleReturnToOrderForm = (0, import_react59.useCallback)(() => {
28599
28688
  const submittedSelection = submittedSelectionRef.current;
package/dist/pages.mjs CHANGED
@@ -13,22 +13,22 @@ import {
13
13
  buildAggTxExplorerHref,
14
14
  formatShareAmount,
15
15
  useHomePageModals
16
- } from "./chunk-G4KXZ5XX.mjs";
17
- import "./chunk-MDCFCGA3.mjs";
16
+ } from "./chunk-PN5HEBFC.mjs";
17
+ import "./chunk-EJXA32MG.mjs";
18
18
  import {
19
19
  EventMarketPage,
20
20
  EventOpenOrders,
21
21
  EventOpenOrdersCard,
22
22
  formatRecurringCountdown,
23
23
  useEventOpenOrders
24
- } from "./chunk-Q5NJCH5O.mjs";
25
- import "./chunk-YYGS6S7N.mjs";
24
+ } from "./chunk-6CZNJSRL.mjs";
25
+ import "./chunk-7G2GTWAS.mjs";
26
26
  import {
27
27
  DEPOSIT_MODAL_OPEN_EVENT,
28
28
  WITHDRAW_MODAL_OPEN_EVENT,
29
29
  requestAggDepositModalOpen,
30
30
  requestAggWithdrawModalOpen
31
- } from "./chunk-HZXHDH6G.mjs";
31
+ } from "./chunk-KN7JN7F5.mjs";
32
32
  import "./chunk-WOCZ4TVT.mjs";
33
33
  import "./chunk-7ORC3TUJ.mjs";
34
34
  import "./chunk-XZVGHKMW.mjs";