@agg-build/ui 4.24.0 → 4.26.0
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/{chunk-Q5NJCH5O.mjs → chunk-4X7OLBO6.mjs} +1 -1
- package/dist/{chunk-HZXHDH6G.mjs → chunk-KN7JN7F5.mjs} +148 -66
- package/dist/{chunk-G4KXZ5XX.mjs → chunk-PHT5VLGB.mjs} +3 -3
- package/dist/{event-market-YBWA2HRJ.mjs → event-market-Q2LBJJ5E.mjs} +2 -2
- package/dist/index.js +149 -68
- package/dist/index.mjs +3 -3
- package/dist/pages.js +149 -68
- package/dist/pages.mjs +3 -3
- package/dist/trading.js +147 -66
- package/dist/trading.mjs +1 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +20 -4
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +20 -4
- package/package.json +3 -3
package/dist/pages.js
CHANGED
|
@@ -23440,7 +23440,7 @@ function lookupRevertSelectorMessage(message) {
|
|
|
23440
23440
|
if (!selector) return null;
|
|
23441
23441
|
return (_b = REVERT_SELECTOR_MESSAGES[selector]) != null ? _b : null;
|
|
23442
23442
|
}
|
|
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;
|
|
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, ceilDiv, toRaw6, parseSizeStepRaw, toLimitSizeRaw, isLimitSizeBelowMinimum;
|
|
23444
23444
|
var init_index_place_order_utils = __esm({
|
|
23445
23445
|
"src/trading/place-order/index.place-order.utils.ts"() {
|
|
23446
23446
|
"use strict";
|
|
@@ -23767,13 +23767,16 @@ var init_index_place_order_utils = __esm({
|
|
|
23767
23767
|
var _a;
|
|
23768
23768
|
return (_a = quoteData.estimatedPayout) != null ? _a : quoteData.totalFilled;
|
|
23769
23769
|
};
|
|
23770
|
-
getPlaceOrderSellProceeds = (quoteData) =>
|
|
23771
|
-
|
|
23772
|
-
|
|
23773
|
-
|
|
23774
|
-
|
|
23775
|
-
|
|
23776
|
-
|
|
23770
|
+
getPlaceOrderSellProceeds = (quoteData) => {
|
|
23771
|
+
var _a;
|
|
23772
|
+
return (_a = quoteData.estimatedNetProceeds) != null ? _a : Math.max(
|
|
23773
|
+
0,
|
|
23774
|
+
quoteData.rawExecCost - quoteData.fills.reduce((sum, fill) => {
|
|
23775
|
+
var _a2, _b;
|
|
23776
|
+
return sum + ((_a2 = fill.venueFee) != null ? _a2 : 0) + ((_b = fill.builderFee) != null ? _b : 0);
|
|
23777
|
+
}, 0)
|
|
23778
|
+
);
|
|
23779
|
+
};
|
|
23777
23780
|
getPlaceOrderQuoteValue = (quoteData, tradeSide) => tradeSide === "sell" ? getPlaceOrderSellProceeds(quoteData) : getPlaceOrderBuyPayout(quoteData);
|
|
23778
23781
|
resolvePlaceOrderNetResult = ({
|
|
23779
23782
|
quoteData,
|
|
@@ -25121,6 +25124,38 @@ var init_index_place_order_utils = __esm({
|
|
|
25121
25124
|
if (parsedValue === null) return false;
|
|
25122
25125
|
return parsedValue < minimumValue;
|
|
25123
25126
|
};
|
|
25127
|
+
ceilDiv = (numerator, denominator) => {
|
|
25128
|
+
return (numerator + denominator - BigInt(1)) / denominator;
|
|
25129
|
+
};
|
|
25130
|
+
toRaw6 = (value) => {
|
|
25131
|
+
const normalizedValue = Number.isFinite(value) ? Math.max(0, value) : 0;
|
|
25132
|
+
return Math.ceil(normalizedValue * Number(import_sdk27.LIMIT_PRICE_RAW_SCALE)).toString();
|
|
25133
|
+
};
|
|
25134
|
+
parseSizeStepRaw = (sizeStepRaw) => {
|
|
25135
|
+
if (!sizeStepRaw || !/^[1-9]\d*$/.test(sizeStepRaw)) return BigInt(1);
|
|
25136
|
+
return BigInt(sizeStepRaw);
|
|
25137
|
+
};
|
|
25138
|
+
toLimitSizeRaw = ({
|
|
25139
|
+
amount: amount2,
|
|
25140
|
+
limitPriceRaw,
|
|
25141
|
+
side,
|
|
25142
|
+
sizeStepRaw
|
|
25143
|
+
}) => {
|
|
25144
|
+
const step = parseSizeStepRaw(sizeStepRaw);
|
|
25145
|
+
if (step <= BigInt(1)) {
|
|
25146
|
+
if (side === "sell") return toRaw6(amount2);
|
|
25147
|
+
const spendRaw = BigInt(toRaw6(amount2));
|
|
25148
|
+
const priceRaw = BigInt(limitPriceRaw);
|
|
25149
|
+
return ceilDiv(spendRaw * import_sdk27.LIMIT_PRICE_RAW_SCALE, priceRaw).toString();
|
|
25150
|
+
}
|
|
25151
|
+
const rawSize = side === "sell" ? BigInt(toRaw6(amount2)) : BigInt(toRaw6(amount2)) * import_sdk27.LIMIT_PRICE_RAW_SCALE / BigInt(limitPriceRaw);
|
|
25152
|
+
return (rawSize / step * step).toString();
|
|
25153
|
+
};
|
|
25154
|
+
isLimitSizeBelowMinimum = (sizeRaw, minSizeRaw) => {
|
|
25155
|
+
const size = BigInt(sizeRaw);
|
|
25156
|
+
if (size <= BigInt(0)) return true;
|
|
25157
|
+
return !!minSizeRaw && /^\d+$/.test(minSizeRaw) && size < BigInt(minSizeRaw);
|
|
25158
|
+
};
|
|
25124
25159
|
}
|
|
25125
25160
|
});
|
|
25126
25161
|
|
|
@@ -26215,7 +26250,7 @@ var init_index_place_order_success = __esm({
|
|
|
26215
26250
|
});
|
|
26216
26251
|
|
|
26217
26252
|
// 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,
|
|
26253
|
+
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
26254
|
var init_place_order = __esm({
|
|
26220
26255
|
"src/trading/place-order/index.tsx"() {
|
|
26221
26256
|
"use strict";
|
|
@@ -26270,32 +26305,21 @@ var init_place_order = __esm({
|
|
|
26270
26305
|
return (_a = triggerElement == null ? void 0 : triggerElement.closest(".agg-modal-center")) != null ? _a : void 0;
|
|
26271
26306
|
};
|
|
26272
26307
|
LIMIT_EXPIRATION_OPTION_COUNT = 5;
|
|
26308
|
+
LIMIT_SIZE_STEP_VENUES = /* @__PURE__ */ new Set([
|
|
26309
|
+
import_sdk28.Venue.tiprun,
|
|
26310
|
+
import_sdk28.Venue.hyperliquid,
|
|
26311
|
+
import_sdk28.Venue.pred,
|
|
26312
|
+
import_sdk28.Venue.polymarket
|
|
26313
|
+
]);
|
|
26273
26314
|
import_dayjs8.default.extend(import_utc2.default);
|
|
26274
26315
|
import_dayjs8.default.extend(import_timezone2.default);
|
|
26275
26316
|
LIMIT_PRICE_STEP = 1e-3;
|
|
26276
26317
|
LIMIT_PRICE_MIN = 1e-3;
|
|
26277
26318
|
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
26319
|
toLimitPriceRaw = (value) => {
|
|
26286
26320
|
const clampedValue = Math.min(LIMIT_PRICE_MAX, Math.max(LIMIT_PRICE_MIN, value));
|
|
26287
26321
|
return Math.round(clampedValue * Number(import_sdk28.LIMIT_PRICE_RAW_SCALE)).toString();
|
|
26288
26322
|
};
|
|
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
26323
|
formatLimitPriceLabel = (value) => {
|
|
26300
26324
|
return `${(value * 100).toLocaleString("en-US", {
|
|
26301
26325
|
minimumFractionDigits: 0,
|
|
@@ -26335,11 +26359,12 @@ var init_place_order = __esm({
|
|
|
26335
26359
|
getLimitOrderToWinValue = ({
|
|
26336
26360
|
amount: amount2,
|
|
26337
26361
|
limitPriceRaw,
|
|
26338
|
-
side
|
|
26362
|
+
side,
|
|
26363
|
+
sizeStepRaw
|
|
26339
26364
|
}) => {
|
|
26340
26365
|
const priceRaw = BigInt(limitPriceRaw);
|
|
26341
26366
|
if (priceRaw <= BigInt(0) || priceRaw >= import_sdk28.LIMIT_PRICE_RAW_SCALE) return 0;
|
|
26342
|
-
const sizeRaw = BigInt(toLimitSizeRaw({ amount: amount2, limitPriceRaw, side }));
|
|
26367
|
+
const sizeRaw = BigInt(toLimitSizeRaw({ amount: amount2, limitPriceRaw, side, sizeStepRaw }));
|
|
26343
26368
|
if (side === "buy") return Number(sizeRaw) / Number(import_sdk28.LIMIT_PRICE_RAW_SCALE);
|
|
26344
26369
|
return Number(ceilDiv(priceRaw * sizeRaw, import_sdk28.LIMIT_PRICE_RAW_SCALE)) / Number(import_sdk28.LIMIT_PRICE_RAW_SCALE);
|
|
26345
26370
|
};
|
|
@@ -27291,7 +27316,8 @@ var init_place_order = __esm({
|
|
|
27291
27316
|
const limitVenueQuoteRequests = (0, import_react59.useMemo)(
|
|
27292
27317
|
() => visibleLimitVenueOptions.map((option) => ({
|
|
27293
27318
|
venue: option.venue,
|
|
27294
|
-
venueMarketOutcomeId: option.venueMarketOutcomeId
|
|
27319
|
+
venueMarketOutcomeId: option.venueMarketOutcomeId,
|
|
27320
|
+
venueMarketId: option.venueMarketId
|
|
27295
27321
|
})),
|
|
27296
27322
|
[visibleLimitVenueOptions]
|
|
27297
27323
|
);
|
|
@@ -27323,10 +27349,83 @@ var init_place_order = __esm({
|
|
|
27323
27349
|
}
|
|
27324
27350
|
return venues;
|
|
27325
27351
|
}, [limitVenueQuotes.quotes]);
|
|
27352
|
+
const originalLimitPriceRaw = (0, import_react59.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
|
|
27353
|
+
const limitPriceAdjustmentByVenue = (0, import_react59.useMemo)(() => {
|
|
27354
|
+
var _a2;
|
|
27355
|
+
const adjustments = /* @__PURE__ */ new Map();
|
|
27356
|
+
for (const option of visibleLimitVenueOptions) {
|
|
27357
|
+
try {
|
|
27358
|
+
adjustments.set(
|
|
27359
|
+
option.venue,
|
|
27360
|
+
(0, import_sdk28.adjustLimitPriceRawToTick)({
|
|
27361
|
+
limitPriceRaw: originalLimitPriceRaw,
|
|
27362
|
+
side: internalTab,
|
|
27363
|
+
tickSize: (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.tickSize
|
|
27364
|
+
})
|
|
27365
|
+
);
|
|
27366
|
+
} catch (e) {
|
|
27367
|
+
adjustments.set(
|
|
27368
|
+
option.venue,
|
|
27369
|
+
(0, import_sdk28.adjustLimitPriceRawToTick)({
|
|
27370
|
+
limitPriceRaw: originalLimitPriceRaw,
|
|
27371
|
+
side: internalTab,
|
|
27372
|
+
tickSize: null
|
|
27373
|
+
})
|
|
27374
|
+
);
|
|
27375
|
+
}
|
|
27376
|
+
}
|
|
27377
|
+
return adjustments;
|
|
27378
|
+
}, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
|
|
27379
|
+
const limitSizeRulesByVenue = (0, import_react59.useMemo)(() => {
|
|
27380
|
+
var _a2, _b2;
|
|
27381
|
+
const rulesByVenue = /* @__PURE__ */ new Map();
|
|
27382
|
+
for (const quote of limitVenueQuotes.quotes) {
|
|
27383
|
+
if (!quote.sizeStepRaw && !quote.minSizeRaw) continue;
|
|
27384
|
+
rulesByVenue.set(quote.request.venue, {
|
|
27385
|
+
sizeStepRaw: (_a2 = quote.sizeStepRaw) != null ? _a2 : void 0,
|
|
27386
|
+
minSizeRaw: (_b2 = quote.minSizeRaw) != null ? _b2 : void 0
|
|
27387
|
+
});
|
|
27388
|
+
}
|
|
27389
|
+
return rulesByVenue;
|
|
27390
|
+
}, [limitVenueQuotes.quotes]);
|
|
27391
|
+
const belowMinimumLimitVenues = (0, import_react59.useMemo)(() => {
|
|
27392
|
+
var _a2, _b2;
|
|
27393
|
+
const venues = /* @__PURE__ */ new Set();
|
|
27394
|
+
if (!isLimitOrder || internalAmount <= 0) return venues;
|
|
27395
|
+
for (const option of visibleLimitVenueOptions) {
|
|
27396
|
+
if (geoBlockedLimitVenues.has(option.venue) || (0, import_hooks86.getVenueAvailabilityState)({
|
|
27397
|
+
venueId: option.venue,
|
|
27398
|
+
disabledVenues,
|
|
27399
|
+
isConfigLoading: isAppConfigLoading
|
|
27400
|
+
}) !== "available")
|
|
27401
|
+
continue;
|
|
27402
|
+
const rules = limitSizeRulesByVenue.get(option.venue);
|
|
27403
|
+
if (!(rules == null ? void 0 : rules.sizeStepRaw) && !(rules == null ? void 0 : rules.minSizeRaw)) continue;
|
|
27404
|
+
const sizeRaw = toLimitSizeRaw({
|
|
27405
|
+
amount: internalAmount,
|
|
27406
|
+
limitPriceRaw: (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw,
|
|
27407
|
+
side: internalTab,
|
|
27408
|
+
sizeStepRaw: rules.sizeStepRaw
|
|
27409
|
+
});
|
|
27410
|
+
if (isLimitSizeBelowMinimum(sizeRaw, rules.minSizeRaw)) venues.add(option.venue);
|
|
27411
|
+
}
|
|
27412
|
+
return venues;
|
|
27413
|
+
}, [
|
|
27414
|
+
disabledVenues,
|
|
27415
|
+
geoBlockedLimitVenues,
|
|
27416
|
+
internalAmount,
|
|
27417
|
+
internalTab,
|
|
27418
|
+
isAppConfigLoading,
|
|
27419
|
+
isLimitOrder,
|
|
27420
|
+
limitPriceAdjustmentByVenue,
|
|
27421
|
+
limitSizeRulesByVenue,
|
|
27422
|
+
originalLimitPriceRaw,
|
|
27423
|
+
visibleLimitVenueOptions
|
|
27424
|
+
]);
|
|
27326
27425
|
const availableLimitVenueOptions = (0, import_react59.useMemo)(() => {
|
|
27327
27426
|
return visibleLimitVenueOptions.filter((option) => {
|
|
27328
27427
|
var _a2;
|
|
27329
|
-
return !geoBlockedLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
|
|
27428
|
+
return !geoBlockedLimitVenues.has(option.venue) && !belowMinimumLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
|
|
27330
27429
|
// venue the user has no position on is a guaranteed 409 from the
|
|
27331
27430
|
// server's reservation check — and the automatic pick, which sorts on
|
|
27332
27431
|
// price alone, would happily choose one. Only narrow once we know
|
|
@@ -27338,6 +27437,7 @@ var init_place_order = __esm({
|
|
|
27338
27437
|
}) === "available";
|
|
27339
27438
|
});
|
|
27340
27439
|
}, [
|
|
27440
|
+
belowMinimumLimitVenues,
|
|
27341
27441
|
disabledVenues,
|
|
27342
27442
|
geoBlockedLimitVenues,
|
|
27343
27443
|
isAppConfigLoading,
|
|
@@ -28195,8 +28295,6 @@ var init_place_order = __esm({
|
|
|
28195
28295
|
const isSelectedVenueInventoryInsufficient = isSell && (selectedRouteCard == null ? void 0 : selectedRouteCard.kind) === "venue" && selectedRouteCard.insufficientInventory === true;
|
|
28196
28296
|
const isBelowClientMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
|
|
28197
28297
|
const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
|
|
28198
|
-
const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
|
|
28199
|
-
const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
|
|
28200
28298
|
const quoteStatus = (0, import_react59.useMemo)(() => {
|
|
28201
28299
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
28202
28300
|
return resolvePlaceOrderQuoteStatus({
|
|
@@ -28323,33 +28421,6 @@ var init_place_order = __esm({
|
|
|
28323
28421
|
return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
|
|
28324
28422
|
}, [selectedRouteCard, tradingLabels]);
|
|
28325
28423
|
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
28424
|
const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
|
|
28354
28425
|
const selectedLimitPriceRaw = (_fa = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _fa : originalLimitPriceRaw;
|
|
28355
28426
|
const limitPriceAdjustmentMessage = (0, import_react59.useMemo)(() => {
|
|
@@ -28370,6 +28441,8 @@ var init_place_order = __esm({
|
|
|
28370
28441
|
selectedLimitVenueOption,
|
|
28371
28442
|
tradingLabels
|
|
28372
28443
|
]);
|
|
28444
|
+
const selectedLimitSizeRules = selectedLimitVenueOption ? limitSizeRulesByVenue.get(selectedLimitVenueOption.venue) : void 0;
|
|
28445
|
+
const isLimitSizeRulesPending = isLimitOrder && selectedLimitVenueOption != null && LIMIT_SIZE_STEP_VENUES.has(selectedLimitVenueOption.venue) && limitVenueQuotes.isMetadataPending;
|
|
28373
28446
|
const limitOrderPayload = (0, import_react59.useMemo)(() => {
|
|
28374
28447
|
if (!selectedLimitVenueOption || internalAmount <= 0) return null;
|
|
28375
28448
|
if (limitPriceInputError) return null;
|
|
@@ -28385,7 +28458,8 @@ var init_place_order = __esm({
|
|
|
28385
28458
|
const sizeRaw = toLimitSizeRaw({
|
|
28386
28459
|
amount: internalAmount,
|
|
28387
28460
|
limitPriceRaw,
|
|
28388
|
-
side: internalTab
|
|
28461
|
+
side: internalTab,
|
|
28462
|
+
sizeStepRaw: selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.sizeStepRaw
|
|
28389
28463
|
});
|
|
28390
28464
|
const expiresAt = expirationDate ? serializeLimitOrderExpiration(expirationDate) : void 0;
|
|
28391
28465
|
return __spreadValues({
|
|
@@ -28404,8 +28478,12 @@ var init_place_order = __esm({
|
|
|
28404
28478
|
limitExpirationType,
|
|
28405
28479
|
limitPriceInputError,
|
|
28406
28480
|
selectedLimitVenueOption,
|
|
28407
|
-
selectedLimitPriceRaw
|
|
28481
|
+
selectedLimitPriceRaw,
|
|
28482
|
+
selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.sizeStepRaw
|
|
28408
28483
|
]);
|
|
28484
|
+
const isLimitSizeBelowVenueMinimum = isLimitOrder && (limitOrderPayload != null && isLimitSizeBelowMinimum(limitOrderPayload.sizeRaw, selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.minSizeRaw) || selectedLimitVenueOption == null && belowMinimumLimitVenues.size > 0);
|
|
28485
|
+
const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote || isLimitSizeBelowVenueMinimum;
|
|
28486
|
+
const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : isSell ? tradingLabels.venueMinOrderSize : tradingLabels.minOrderSizeViolated;
|
|
28409
28487
|
const resolvedLimitExpirationDraftDate = (0, import_react59.useMemo)(() => {
|
|
28410
28488
|
return resolveLimitExpirationDate({
|
|
28411
28489
|
expirationType: "CUSTOM",
|
|
@@ -28449,12 +28527,13 @@ var init_place_order = __esm({
|
|
|
28449
28527
|
}, [internalTab, limitOrderPayload]);
|
|
28450
28528
|
const limitRouteCards = (0, import_react59.useMemo)(() => {
|
|
28451
28529
|
return visibleLimitVenueOptions.map((option) => {
|
|
28452
|
-
var _a2, _b2, _c2, _d2;
|
|
28530
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
28453
28531
|
const effectiveLimitPriceRaw = (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw;
|
|
28454
28532
|
const venueToWinValue = getLimitOrderToWinValue({
|
|
28455
28533
|
amount: internalAmount,
|
|
28456
28534
|
limitPriceRaw: effectiveLimitPriceRaw,
|
|
28457
|
-
side: internalTab
|
|
28535
|
+
side: internalTab,
|
|
28536
|
+
sizeStepRaw: (_c2 = limitSizeRulesByVenue.get(option.venue)) == null ? void 0 : _c2.sizeStepRaw
|
|
28458
28537
|
});
|
|
28459
28538
|
const availabilityState = (0, import_hooks86.getVenueAvailabilityState)({
|
|
28460
28539
|
venueId: option.venue,
|
|
@@ -28462,10 +28541,10 @@ var init_place_order = __esm({
|
|
|
28462
28541
|
isConfigLoading: isAppConfigLoading
|
|
28463
28542
|
});
|
|
28464
28543
|
const isGeoBlocked = geoBlockedLimitVenues.has(option.venue);
|
|
28465
|
-
const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
|
|
28544
|
+
const isUnavailable = isTradingBlocked || isGeoBlocked || belowMinimumLimitVenues.has(option.venue) || availabilityState !== "available";
|
|
28466
28545
|
const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
|
|
28467
28546
|
const totalFees = getSmartRouteTotalFees(
|
|
28468
|
-
(
|
|
28547
|
+
(_e2 = (_d2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _d2.data) == null ? void 0 : _e2.feeBreakdown
|
|
28469
28548
|
);
|
|
28470
28549
|
const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
28471
28550
|
return {
|
|
@@ -28484,6 +28563,7 @@ var init_place_order = __esm({
|
|
|
28484
28563
|
};
|
|
28485
28564
|
});
|
|
28486
28565
|
}, [
|
|
28566
|
+
belowMinimumLimitVenues,
|
|
28487
28567
|
disabledVenues,
|
|
28488
28568
|
formatPrice,
|
|
28489
28569
|
geoBlockedLimitVenues,
|
|
@@ -28492,6 +28572,7 @@ var init_place_order = __esm({
|
|
|
28492
28572
|
isAppConfigLoading,
|
|
28493
28573
|
isTradingBlocked,
|
|
28494
28574
|
limitPriceAdjustmentByVenue,
|
|
28575
|
+
limitSizeRulesByVenue,
|
|
28495
28576
|
limitVenueQuoteByVenue,
|
|
28496
28577
|
originalLimitPriceRaw,
|
|
28497
28578
|
tradingLabels,
|
|
@@ -28590,10 +28671,10 @@ var init_place_order = __esm({
|
|
|
28590
28671
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
28591
28672
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
28592
28673
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
28593
|
-
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
|
|
28674
|
+
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable) && limitRouteCards.some((card) => !card.venue || !belowMinimumLimitVenues.has(card.venue));
|
|
28594
28675
|
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 && !
|
|
28676
|
+
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;
|
|
28677
|
+
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowClientMinimum && !isBelowVenueMinimumFromQuote && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
28597
28678
|
const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
28598
28679
|
const handleReturnToOrderForm = (0, import_react59.useCallback)(() => {
|
|
28599
28680
|
const submittedSelection = submittedSelectionRef.current;
|
package/dist/pages.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
buildAggTxExplorerHref,
|
|
14
14
|
formatShareAmount,
|
|
15
15
|
useHomePageModals
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PHT5VLGB.mjs";
|
|
17
17
|
import "./chunk-MDCFCGA3.mjs";
|
|
18
18
|
import {
|
|
19
19
|
EventMarketPage,
|
|
@@ -21,14 +21,14 @@ import {
|
|
|
21
21
|
EventOpenOrdersCard,
|
|
22
22
|
formatRecurringCountdown,
|
|
23
23
|
useEventOpenOrders
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-4X7OLBO6.mjs";
|
|
25
25
|
import "./chunk-YYGS6S7N.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-
|
|
31
|
+
} from "./chunk-KN7JN7F5.mjs";
|
|
32
32
|
import "./chunk-WOCZ4TVT.mjs";
|
|
33
33
|
import "./chunk-7ORC3TUJ.mjs";
|
|
34
34
|
import "./chunk-XZVGHKMW.mjs";
|