@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/index.js
CHANGED
|
@@ -24162,7 +24162,7 @@ function lookupRevertSelectorMessage(message) {
|
|
|
24162
24162
|
if (!selector) return null;
|
|
24163
24163
|
return (_b = REVERT_SELECTOR_MESSAGES[selector]) != null ? _b : null;
|
|
24164
24164
|
}
|
|
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;
|
|
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, ceilDiv, toRaw6, parseSizeStepRaw, toLimitSizeRaw, isLimitSizeBelowMinimum;
|
|
24166
24166
|
var init_index_place_order_utils = __esm({
|
|
24167
24167
|
"src/trading/place-order/index.place-order.utils.ts"() {
|
|
24168
24168
|
"use strict";
|
|
@@ -24489,13 +24489,16 @@ var init_index_place_order_utils = __esm({
|
|
|
24489
24489
|
var _a;
|
|
24490
24490
|
return (_a = quoteData.estimatedPayout) != null ? _a : quoteData.totalFilled;
|
|
24491
24491
|
};
|
|
24492
|
-
getPlaceOrderSellProceeds = (quoteData) =>
|
|
24493
|
-
|
|
24494
|
-
|
|
24495
|
-
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
|
|
24492
|
+
getPlaceOrderSellProceeds = (quoteData) => {
|
|
24493
|
+
var _a;
|
|
24494
|
+
return (_a = quoteData.estimatedNetProceeds) != null ? _a : Math.max(
|
|
24495
|
+
0,
|
|
24496
|
+
quoteData.rawExecCost - quoteData.fills.reduce((sum, fill) => {
|
|
24497
|
+
var _a2, _b;
|
|
24498
|
+
return sum + ((_a2 = fill.venueFee) != null ? _a2 : 0) + ((_b = fill.builderFee) != null ? _b : 0);
|
|
24499
|
+
}, 0)
|
|
24500
|
+
);
|
|
24501
|
+
};
|
|
24499
24502
|
getPlaceOrderQuoteValue = (quoteData, tradeSide) => tradeSide === "sell" ? getPlaceOrderSellProceeds(quoteData) : getPlaceOrderBuyPayout(quoteData);
|
|
24500
24503
|
resolvePlaceOrderNetResult = ({
|
|
24501
24504
|
quoteData,
|
|
@@ -25843,6 +25846,38 @@ var init_index_place_order_utils = __esm({
|
|
|
25843
25846
|
if (parsedValue === null) return false;
|
|
25844
25847
|
return parsedValue < minimumValue;
|
|
25845
25848
|
};
|
|
25849
|
+
ceilDiv = (numerator, denominator) => {
|
|
25850
|
+
return (numerator + denominator - BigInt(1)) / denominator;
|
|
25851
|
+
};
|
|
25852
|
+
toRaw6 = (value) => {
|
|
25853
|
+
const normalizedValue = Number.isFinite(value) ? Math.max(0, value) : 0;
|
|
25854
|
+
return Math.ceil(normalizedValue * Number(import_sdk27.LIMIT_PRICE_RAW_SCALE)).toString();
|
|
25855
|
+
};
|
|
25856
|
+
parseSizeStepRaw = (sizeStepRaw) => {
|
|
25857
|
+
if (!sizeStepRaw || !/^[1-9]\d*$/.test(sizeStepRaw)) return BigInt(1);
|
|
25858
|
+
return BigInt(sizeStepRaw);
|
|
25859
|
+
};
|
|
25860
|
+
toLimitSizeRaw = ({
|
|
25861
|
+
amount: amount2,
|
|
25862
|
+
limitPriceRaw,
|
|
25863
|
+
side,
|
|
25864
|
+
sizeStepRaw
|
|
25865
|
+
}) => {
|
|
25866
|
+
const step = parseSizeStepRaw(sizeStepRaw);
|
|
25867
|
+
if (step <= BigInt(1)) {
|
|
25868
|
+
if (side === "sell") return toRaw6(amount2);
|
|
25869
|
+
const spendRaw = BigInt(toRaw6(amount2));
|
|
25870
|
+
const priceRaw = BigInt(limitPriceRaw);
|
|
25871
|
+
return ceilDiv(spendRaw * import_sdk27.LIMIT_PRICE_RAW_SCALE, priceRaw).toString();
|
|
25872
|
+
}
|
|
25873
|
+
const rawSize = side === "sell" ? BigInt(toRaw6(amount2)) : BigInt(toRaw6(amount2)) * import_sdk27.LIMIT_PRICE_RAW_SCALE / BigInt(limitPriceRaw);
|
|
25874
|
+
return (rawSize / step * step).toString();
|
|
25875
|
+
};
|
|
25876
|
+
isLimitSizeBelowMinimum = (sizeRaw, minSizeRaw) => {
|
|
25877
|
+
const size = BigInt(sizeRaw);
|
|
25878
|
+
if (size <= BigInt(0)) return true;
|
|
25879
|
+
return !!minSizeRaw && /^\d+$/.test(minSizeRaw) && size < BigInt(minSizeRaw);
|
|
25880
|
+
};
|
|
25846
25881
|
}
|
|
25847
25882
|
});
|
|
25848
25883
|
|
|
@@ -26937,7 +26972,7 @@ var init_index_place_order_success = __esm({
|
|
|
26937
26972
|
});
|
|
26938
26973
|
|
|
26939
26974
|
// 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,
|
|
26975
|
+
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
26976
|
var init_place_order = __esm({
|
|
26942
26977
|
"src/trading/place-order/index.tsx"() {
|
|
26943
26978
|
"use strict";
|
|
@@ -26995,32 +27030,21 @@ var init_place_order = __esm({
|
|
|
26995
27030
|
return (_a = triggerElement == null ? void 0 : triggerElement.closest(".agg-modal-center")) != null ? _a : void 0;
|
|
26996
27031
|
};
|
|
26997
27032
|
LIMIT_EXPIRATION_OPTION_COUNT = 5;
|
|
27033
|
+
LIMIT_SIZE_STEP_VENUES = /* @__PURE__ */ new Set([
|
|
27034
|
+
import_sdk28.Venue.tiprun,
|
|
27035
|
+
import_sdk28.Venue.hyperliquid,
|
|
27036
|
+
import_sdk28.Venue.pred,
|
|
27037
|
+
import_sdk28.Venue.polymarket
|
|
27038
|
+
]);
|
|
26998
27039
|
import_dayjs8.default.extend(import_utc2.default);
|
|
26999
27040
|
import_dayjs8.default.extend(import_timezone2.default);
|
|
27000
27041
|
LIMIT_PRICE_STEP = 1e-3;
|
|
27001
27042
|
LIMIT_PRICE_MIN = 1e-3;
|
|
27002
27043
|
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
27044
|
toLimitPriceRaw = (value) => {
|
|
27011
27045
|
const clampedValue = Math.min(LIMIT_PRICE_MAX, Math.max(LIMIT_PRICE_MIN, value));
|
|
27012
27046
|
return Math.round(clampedValue * Number(import_sdk28.LIMIT_PRICE_RAW_SCALE)).toString();
|
|
27013
27047
|
};
|
|
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
27048
|
formatLimitPriceLabel = (value) => {
|
|
27025
27049
|
return `${(value * 100).toLocaleString("en-US", {
|
|
27026
27050
|
minimumFractionDigits: 0,
|
|
@@ -27060,11 +27084,12 @@ var init_place_order = __esm({
|
|
|
27060
27084
|
getLimitOrderToWinValue = ({
|
|
27061
27085
|
amount: amount2,
|
|
27062
27086
|
limitPriceRaw,
|
|
27063
|
-
side
|
|
27087
|
+
side,
|
|
27088
|
+
sizeStepRaw
|
|
27064
27089
|
}) => {
|
|
27065
27090
|
const priceRaw = BigInt(limitPriceRaw);
|
|
27066
27091
|
if (priceRaw <= BigInt(0) || priceRaw >= import_sdk28.LIMIT_PRICE_RAW_SCALE) return 0;
|
|
27067
|
-
const sizeRaw = BigInt(toLimitSizeRaw({ amount: amount2, limitPriceRaw, side }));
|
|
27092
|
+
const sizeRaw = BigInt(toLimitSizeRaw({ amount: amount2, limitPriceRaw, side, sizeStepRaw }));
|
|
27068
27093
|
if (side === "buy") return Number(sizeRaw) / Number(import_sdk28.LIMIT_PRICE_RAW_SCALE);
|
|
27069
27094
|
return Number(ceilDiv(priceRaw * sizeRaw, import_sdk28.LIMIT_PRICE_RAW_SCALE)) / Number(import_sdk28.LIMIT_PRICE_RAW_SCALE);
|
|
27070
27095
|
};
|
|
@@ -28016,7 +28041,8 @@ var init_place_order = __esm({
|
|
|
28016
28041
|
const limitVenueQuoteRequests = (0, import_react59.useMemo)(
|
|
28017
28042
|
() => visibleLimitVenueOptions.map((option) => ({
|
|
28018
28043
|
venue: option.venue,
|
|
28019
|
-
venueMarketOutcomeId: option.venueMarketOutcomeId
|
|
28044
|
+
venueMarketOutcomeId: option.venueMarketOutcomeId,
|
|
28045
|
+
venueMarketId: option.venueMarketId
|
|
28020
28046
|
})),
|
|
28021
28047
|
[visibleLimitVenueOptions]
|
|
28022
28048
|
);
|
|
@@ -28048,10 +28074,83 @@ var init_place_order = __esm({
|
|
|
28048
28074
|
}
|
|
28049
28075
|
return venues;
|
|
28050
28076
|
}, [limitVenueQuotes.quotes]);
|
|
28077
|
+
const originalLimitPriceRaw = (0, import_react59.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
|
|
28078
|
+
const limitPriceAdjustmentByVenue = (0, import_react59.useMemo)(() => {
|
|
28079
|
+
var _a2;
|
|
28080
|
+
const adjustments = /* @__PURE__ */ new Map();
|
|
28081
|
+
for (const option of visibleLimitVenueOptions) {
|
|
28082
|
+
try {
|
|
28083
|
+
adjustments.set(
|
|
28084
|
+
option.venue,
|
|
28085
|
+
(0, import_sdk28.adjustLimitPriceRawToTick)({
|
|
28086
|
+
limitPriceRaw: originalLimitPriceRaw,
|
|
28087
|
+
side: internalTab,
|
|
28088
|
+
tickSize: (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.tickSize
|
|
28089
|
+
})
|
|
28090
|
+
);
|
|
28091
|
+
} catch (e) {
|
|
28092
|
+
adjustments.set(
|
|
28093
|
+
option.venue,
|
|
28094
|
+
(0, import_sdk28.adjustLimitPriceRawToTick)({
|
|
28095
|
+
limitPriceRaw: originalLimitPriceRaw,
|
|
28096
|
+
side: internalTab,
|
|
28097
|
+
tickSize: null
|
|
28098
|
+
})
|
|
28099
|
+
);
|
|
28100
|
+
}
|
|
28101
|
+
}
|
|
28102
|
+
return adjustments;
|
|
28103
|
+
}, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
|
|
28104
|
+
const limitSizeRulesByVenue = (0, import_react59.useMemo)(() => {
|
|
28105
|
+
var _a2, _b2;
|
|
28106
|
+
const rulesByVenue = /* @__PURE__ */ new Map();
|
|
28107
|
+
for (const quote of limitVenueQuotes.quotes) {
|
|
28108
|
+
if (!quote.sizeStepRaw && !quote.minSizeRaw) continue;
|
|
28109
|
+
rulesByVenue.set(quote.request.venue, {
|
|
28110
|
+
sizeStepRaw: (_a2 = quote.sizeStepRaw) != null ? _a2 : void 0,
|
|
28111
|
+
minSizeRaw: (_b2 = quote.minSizeRaw) != null ? _b2 : void 0
|
|
28112
|
+
});
|
|
28113
|
+
}
|
|
28114
|
+
return rulesByVenue;
|
|
28115
|
+
}, [limitVenueQuotes.quotes]);
|
|
28116
|
+
const belowMinimumLimitVenues = (0, import_react59.useMemo)(() => {
|
|
28117
|
+
var _a2, _b2;
|
|
28118
|
+
const venues = /* @__PURE__ */ new Set();
|
|
28119
|
+
if (!isLimitOrder || internalAmount <= 0) return venues;
|
|
28120
|
+
for (const option of visibleLimitVenueOptions) {
|
|
28121
|
+
if (geoBlockedLimitVenues.has(option.venue) || (0, import_hooks89.getVenueAvailabilityState)({
|
|
28122
|
+
venueId: option.venue,
|
|
28123
|
+
disabledVenues,
|
|
28124
|
+
isConfigLoading: isAppConfigLoading
|
|
28125
|
+
}) !== "available")
|
|
28126
|
+
continue;
|
|
28127
|
+
const rules = limitSizeRulesByVenue.get(option.venue);
|
|
28128
|
+
if (!(rules == null ? void 0 : rules.sizeStepRaw) && !(rules == null ? void 0 : rules.minSizeRaw)) continue;
|
|
28129
|
+
const sizeRaw = toLimitSizeRaw({
|
|
28130
|
+
amount: internalAmount,
|
|
28131
|
+
limitPriceRaw: (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw,
|
|
28132
|
+
side: internalTab,
|
|
28133
|
+
sizeStepRaw: rules.sizeStepRaw
|
|
28134
|
+
});
|
|
28135
|
+
if (isLimitSizeBelowMinimum(sizeRaw, rules.minSizeRaw)) venues.add(option.venue);
|
|
28136
|
+
}
|
|
28137
|
+
return venues;
|
|
28138
|
+
}, [
|
|
28139
|
+
disabledVenues,
|
|
28140
|
+
geoBlockedLimitVenues,
|
|
28141
|
+
internalAmount,
|
|
28142
|
+
internalTab,
|
|
28143
|
+
isAppConfigLoading,
|
|
28144
|
+
isLimitOrder,
|
|
28145
|
+
limitPriceAdjustmentByVenue,
|
|
28146
|
+
limitSizeRulesByVenue,
|
|
28147
|
+
originalLimitPriceRaw,
|
|
28148
|
+
visibleLimitVenueOptions
|
|
28149
|
+
]);
|
|
28051
28150
|
const availableLimitVenueOptions = (0, import_react59.useMemo)(() => {
|
|
28052
28151
|
return visibleLimitVenueOptions.filter((option) => {
|
|
28053
28152
|
var _a2;
|
|
28054
|
-
return !geoBlockedLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
|
|
28153
|
+
return !geoBlockedLimitVenues.has(option.venue) && !belowMinimumLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
|
|
28055
28154
|
// venue the user has no position on is a guaranteed 409 from the
|
|
28056
28155
|
// server's reservation check — and the automatic pick, which sorts on
|
|
28057
28156
|
// price alone, would happily choose one. Only narrow once we know
|
|
@@ -28063,6 +28162,7 @@ var init_place_order = __esm({
|
|
|
28063
28162
|
}) === "available";
|
|
28064
28163
|
});
|
|
28065
28164
|
}, [
|
|
28165
|
+
belowMinimumLimitVenues,
|
|
28066
28166
|
disabledVenues,
|
|
28067
28167
|
geoBlockedLimitVenues,
|
|
28068
28168
|
isAppConfigLoading,
|
|
@@ -28920,8 +29020,6 @@ var init_place_order = __esm({
|
|
|
28920
29020
|
const isSelectedVenueInventoryInsufficient = isSell && (selectedRouteCard == null ? void 0 : selectedRouteCard.kind) === "venue" && selectedRouteCard.insufficientInventory === true;
|
|
28921
29021
|
const isBelowClientMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
|
|
28922
29022
|
const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
|
|
28923
|
-
const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
|
|
28924
|
-
const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
|
|
28925
29023
|
const quoteStatus = (0, import_react59.useMemo)(() => {
|
|
28926
29024
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
28927
29025
|
return resolvePlaceOrderQuoteStatus({
|
|
@@ -29048,33 +29146,6 @@ var init_place_order = __esm({
|
|
|
29048
29146
|
return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
|
|
29049
29147
|
}, [selectedRouteCard, tradingLabels]);
|
|
29050
29148
|
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
29149
|
const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
|
|
29079
29150
|
const selectedLimitPriceRaw = (_fa = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _fa : originalLimitPriceRaw;
|
|
29080
29151
|
const limitPriceAdjustmentMessage = (0, import_react59.useMemo)(() => {
|
|
@@ -29095,6 +29166,8 @@ var init_place_order = __esm({
|
|
|
29095
29166
|
selectedLimitVenueOption,
|
|
29096
29167
|
tradingLabels
|
|
29097
29168
|
]);
|
|
29169
|
+
const selectedLimitSizeRules = selectedLimitVenueOption ? limitSizeRulesByVenue.get(selectedLimitVenueOption.venue) : void 0;
|
|
29170
|
+
const isLimitSizeRulesPending = isLimitOrder && selectedLimitVenueOption != null && LIMIT_SIZE_STEP_VENUES.has(selectedLimitVenueOption.venue) && limitVenueQuotes.isMetadataPending;
|
|
29098
29171
|
const limitOrderPayload = (0, import_react59.useMemo)(() => {
|
|
29099
29172
|
if (!selectedLimitVenueOption || internalAmount <= 0) return null;
|
|
29100
29173
|
if (limitPriceInputError) return null;
|
|
@@ -29110,7 +29183,8 @@ var init_place_order = __esm({
|
|
|
29110
29183
|
const sizeRaw = toLimitSizeRaw({
|
|
29111
29184
|
amount: internalAmount,
|
|
29112
29185
|
limitPriceRaw,
|
|
29113
|
-
side: internalTab
|
|
29186
|
+
side: internalTab,
|
|
29187
|
+
sizeStepRaw: selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.sizeStepRaw
|
|
29114
29188
|
});
|
|
29115
29189
|
const expiresAt = expirationDate ? serializeLimitOrderExpiration(expirationDate) : void 0;
|
|
29116
29190
|
return __spreadValues({
|
|
@@ -29129,8 +29203,12 @@ var init_place_order = __esm({
|
|
|
29129
29203
|
limitExpirationType,
|
|
29130
29204
|
limitPriceInputError,
|
|
29131
29205
|
selectedLimitVenueOption,
|
|
29132
|
-
selectedLimitPriceRaw
|
|
29206
|
+
selectedLimitPriceRaw,
|
|
29207
|
+
selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.sizeStepRaw
|
|
29133
29208
|
]);
|
|
29209
|
+
const isLimitSizeBelowVenueMinimum = isLimitOrder && (limitOrderPayload != null && isLimitSizeBelowMinimum(limitOrderPayload.sizeRaw, selectedLimitSizeRules == null ? void 0 : selectedLimitSizeRules.minSizeRaw) || selectedLimitVenueOption == null && belowMinimumLimitVenues.size > 0);
|
|
29210
|
+
const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote || isLimitSizeBelowVenueMinimum;
|
|
29211
|
+
const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : isSell ? tradingLabels.venueMinOrderSize : tradingLabels.minOrderSizeViolated;
|
|
29134
29212
|
const resolvedLimitExpirationDraftDate = (0, import_react59.useMemo)(() => {
|
|
29135
29213
|
return resolveLimitExpirationDate({
|
|
29136
29214
|
expirationType: "CUSTOM",
|
|
@@ -29174,12 +29252,13 @@ var init_place_order = __esm({
|
|
|
29174
29252
|
}, [internalTab, limitOrderPayload]);
|
|
29175
29253
|
const limitRouteCards = (0, import_react59.useMemo)(() => {
|
|
29176
29254
|
return visibleLimitVenueOptions.map((option) => {
|
|
29177
|
-
var _a2, _b2, _c2, _d2;
|
|
29255
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
29178
29256
|
const effectiveLimitPriceRaw = (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw;
|
|
29179
29257
|
const venueToWinValue = getLimitOrderToWinValue({
|
|
29180
29258
|
amount: internalAmount,
|
|
29181
29259
|
limitPriceRaw: effectiveLimitPriceRaw,
|
|
29182
|
-
side: internalTab
|
|
29260
|
+
side: internalTab,
|
|
29261
|
+
sizeStepRaw: (_c2 = limitSizeRulesByVenue.get(option.venue)) == null ? void 0 : _c2.sizeStepRaw
|
|
29183
29262
|
});
|
|
29184
29263
|
const availabilityState = (0, import_hooks89.getVenueAvailabilityState)({
|
|
29185
29264
|
venueId: option.venue,
|
|
@@ -29187,10 +29266,10 @@ var init_place_order = __esm({
|
|
|
29187
29266
|
isConfigLoading: isAppConfigLoading
|
|
29188
29267
|
});
|
|
29189
29268
|
const isGeoBlocked = geoBlockedLimitVenues.has(option.venue);
|
|
29190
|
-
const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
|
|
29269
|
+
const isUnavailable = isTradingBlocked || isGeoBlocked || belowMinimumLimitVenues.has(option.venue) || availabilityState !== "available";
|
|
29191
29270
|
const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
|
|
29192
29271
|
const totalFees = getSmartRouteTotalFees(
|
|
29193
|
-
(
|
|
29272
|
+
(_e2 = (_d2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _d2.data) == null ? void 0 : _e2.feeBreakdown
|
|
29194
29273
|
);
|
|
29195
29274
|
const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
29196
29275
|
return {
|
|
@@ -29209,6 +29288,7 @@ var init_place_order = __esm({
|
|
|
29209
29288
|
};
|
|
29210
29289
|
});
|
|
29211
29290
|
}, [
|
|
29291
|
+
belowMinimumLimitVenues,
|
|
29212
29292
|
disabledVenues,
|
|
29213
29293
|
formatPrice,
|
|
29214
29294
|
geoBlockedLimitVenues,
|
|
@@ -29217,6 +29297,7 @@ var init_place_order = __esm({
|
|
|
29217
29297
|
isAppConfigLoading,
|
|
29218
29298
|
isTradingBlocked,
|
|
29219
29299
|
limitPriceAdjustmentByVenue,
|
|
29300
|
+
limitSizeRulesByVenue,
|
|
29220
29301
|
limitVenueQuoteByVenue,
|
|
29221
29302
|
originalLimitPriceRaw,
|
|
29222
29303
|
tradingLabels,
|
|
@@ -29315,10 +29396,10 @@ var init_place_order = __esm({
|
|
|
29315
29396
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
29316
29397
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
29317
29398
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
29318
|
-
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
|
|
29399
|
+
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable) && limitRouteCards.some((card) => !card.venue || !belowMinimumLimitVenues.has(card.venue));
|
|
29319
29400
|
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 && !
|
|
29401
|
+
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;
|
|
29402
|
+
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowClientMinimum && !isBelowVenueMinimumFromQuote && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
29322
29403
|
const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
29323
29404
|
const handleReturnToOrderForm = (0, import_react59.useCallback)(() => {
|
|
29324
29405
|
const submittedSelection = submittedSelectionRef.current;
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
buildAggTxExplorerHref,
|
|
17
17
|
formatShareAmount,
|
|
18
18
|
useHomePageModals
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-PHT5VLGB.mjs";
|
|
20
20
|
import {
|
|
21
21
|
EventList,
|
|
22
22
|
EventListItem,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
EventOpenOrdersCard,
|
|
41
41
|
formatRecurringCountdown,
|
|
42
42
|
useEventOpenOrders
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-4X7OLBO6.mjs";
|
|
44
44
|
import {
|
|
45
45
|
EventListItemDetails,
|
|
46
46
|
MarketDetails,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
useResolvedMarketClaim,
|
|
78
78
|
useSharedKycFlow,
|
|
79
79
|
venueRequiresSharedKyc
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-KN7JN7F5.mjs";
|
|
81
81
|
import {
|
|
82
82
|
SETTLEMENT_SECTION_ID,
|
|
83
83
|
Settlement,
|