@agg-build/ui 4.11.0 → 4.11.3
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-CHM6SCOY.mjs → chunk-5D36HPOG.mjs} +1 -1
- package/dist/{chunk-NCWBKC5C.mjs → chunk-VHKGW4DB.mjs} +136 -46
- package/dist/index.js +136 -46
- package/dist/index.mjs +2 -2
- package/dist/pages.js +136 -46
- package/dist/pages.mjs +2 -2
- package/dist/trading.js +136 -46
- package/dist/trading.mjs +1 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +28 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +28 -0
- package/package.json +2 -2
package/dist/trading.js
CHANGED
|
@@ -9214,13 +9214,13 @@ var extractGeoBlockedVenues = (warnings) => {
|
|
|
9214
9214
|
);
|
|
9215
9215
|
};
|
|
9216
9216
|
var getSmartRouteTotalFees = (feeBreakdown) => {
|
|
9217
|
-
var _a;
|
|
9217
|
+
var _a, _b;
|
|
9218
9218
|
if (!feeBreakdown) return null;
|
|
9219
9219
|
const feeParts = [
|
|
9220
|
-
feeBreakdown.venueFees,
|
|
9221
|
-
(_a = feeBreakdown.builderFee) != null ? _a : 0,
|
|
9220
|
+
feeBreakdown.venueFees + ((_a = feeBreakdown.builderFee) != null ? _a : 0),
|
|
9222
9221
|
feeBreakdown.bridgeFees,
|
|
9223
|
-
feeBreakdown.executionGas
|
|
9222
|
+
feeBreakdown.executionGas,
|
|
9223
|
+
(_b = feeBreakdown.appFee) != null ? _b : 0
|
|
9224
9224
|
];
|
|
9225
9225
|
if (!feeParts.every(Number.isFinite)) return null;
|
|
9226
9226
|
return feeParts.reduce((total, fee) => total + Math.round(fee * 100) / 100, 0);
|
|
@@ -9315,6 +9315,72 @@ var parseDecimalString = (value) => {
|
|
|
9315
9315
|
if (!Number.isFinite(parsed) || parsed <= 0) return null;
|
|
9316
9316
|
return parsed;
|
|
9317
9317
|
};
|
|
9318
|
+
var getPlaceOrderBuyPayout = (quoteData) => {
|
|
9319
|
+
var _a;
|
|
9320
|
+
return (_a = quoteData.estimatedPayout) != null ? _a : quoteData.totalFilled;
|
|
9321
|
+
};
|
|
9322
|
+
var getPlaceOrderSellProceeds = (quoteData) => Math.max(
|
|
9323
|
+
0,
|
|
9324
|
+
quoteData.rawExecCost - quoteData.fills.reduce((sum, fill) => {
|
|
9325
|
+
var _a, _b;
|
|
9326
|
+
return sum + ((_a = fill.venueFee) != null ? _a : 0) + ((_b = fill.builderFee) != null ? _b : 0);
|
|
9327
|
+
}, 0)
|
|
9328
|
+
);
|
|
9329
|
+
var getPlaceOrderQuoteValue = (quoteData, tradeSide) => tradeSide === "sell" ? getPlaceOrderSellProceeds(quoteData) : getPlaceOrderBuyPayout(quoteData);
|
|
9330
|
+
var resolvePlaceOrderNetResult = ({
|
|
9331
|
+
quoteData,
|
|
9332
|
+
tradeSide,
|
|
9333
|
+
shares,
|
|
9334
|
+
usd,
|
|
9335
|
+
terminalOrderEvents,
|
|
9336
|
+
submittedOrders
|
|
9337
|
+
}) => {
|
|
9338
|
+
if (!quoteData) return tradeSide === "sell" ? usd : shares;
|
|
9339
|
+
const actualEvents = (terminalOrderEvents != null ? terminalOrderEvents : []).filter(
|
|
9340
|
+
(event) => (event.event === "filled" || event.event === "partial_fill") && (tradeSide === "buy" ? event.filledAmountRaw != null : event.actualSharesRaw != null)
|
|
9341
|
+
);
|
|
9342
|
+
if (actualEvents.length) {
|
|
9343
|
+
return actualEvents.reduce((sum, event) => {
|
|
9344
|
+
var _a;
|
|
9345
|
+
const outcomeId = (_a = submittedOrders == null ? void 0 : submittedOrders.find(
|
|
9346
|
+
(order) => order.orderId === event.orderId
|
|
9347
|
+
)) == null ? void 0 : _a.outcomeId;
|
|
9348
|
+
const venueFills = quoteData.fills.filter((fill) => fill.venue === event.venue);
|
|
9349
|
+
const exactFill = venueFills.find((fill) => fill.venueMarketOutcomeId === outcomeId);
|
|
9350
|
+
const fills = exactFill ? [exactFill] : venueFills;
|
|
9351
|
+
const legQuote = fills.length ? __spreadProps(__spreadValues({}, quoteData), {
|
|
9352
|
+
fills,
|
|
9353
|
+
totalFilled: fills.reduce((total, fill) => total + fill.venueQty, 0),
|
|
9354
|
+
rawExecCost: fills.reduce((total, fill) => total + fill.avgPrice * fill.venueQty, 0),
|
|
9355
|
+
estimatedPayout: fills.reduce(
|
|
9356
|
+
(total, fill) => {
|
|
9357
|
+
var _a2;
|
|
9358
|
+
return total + fill.venueQty - ((_a2 = fill.settlementFee) != null ? _a2 : 0);
|
|
9359
|
+
},
|
|
9360
|
+
0
|
|
9361
|
+
)
|
|
9362
|
+
}) : quoteData;
|
|
9363
|
+
const actual = resolveActualExecutionEconomics({
|
|
9364
|
+
quoteData: legQuote,
|
|
9365
|
+
tradeSide,
|
|
9366
|
+
terminalOrderEvents: [event],
|
|
9367
|
+
submittedOrders
|
|
9368
|
+
});
|
|
9369
|
+
return sum + resolvePlaceOrderNetResult({
|
|
9370
|
+
quoteData: legQuote,
|
|
9371
|
+
tradeSide,
|
|
9372
|
+
shares: actual.actualTotalFilled,
|
|
9373
|
+
usd: actual.actualRawExecCost
|
|
9374
|
+
});
|
|
9375
|
+
}, 0);
|
|
9376
|
+
}
|
|
9377
|
+
if (tradeSide === "sell") {
|
|
9378
|
+
const gross = quoteData.rawExecCost;
|
|
9379
|
+
return gross > 0 ? usd * (getPlaceOrderSellProceeds(quoteData) / gross) : usd;
|
|
9380
|
+
}
|
|
9381
|
+
const filled = quoteData.totalFilled;
|
|
9382
|
+
return filled > 0 ? shares * (getPlaceOrderBuyPayout(quoteData) / filled) : shares;
|
|
9383
|
+
};
|
|
9318
9384
|
var resolvePlaceOrderQuoteResult = ({
|
|
9319
9385
|
labels,
|
|
9320
9386
|
quoteData,
|
|
@@ -9323,7 +9389,7 @@ var resolvePlaceOrderQuoteResult = ({
|
|
|
9323
9389
|
if (!quoteData || quoteData.totalFilled <= 0) return null;
|
|
9324
9390
|
const avgPrice = getPlaceOrderAverageExecutionPrice(quoteData);
|
|
9325
9391
|
if (avgPrice == null) return null;
|
|
9326
|
-
const quoteValue =
|
|
9392
|
+
const quoteValue = getPlaceOrderQuoteValue(quoteData, tradeSide);
|
|
9327
9393
|
return {
|
|
9328
9394
|
hint: labels.averagePrice(avgPrice),
|
|
9329
9395
|
value: getTradingValueLabel({
|
|
@@ -9441,7 +9507,7 @@ var buildLiveRouteCards = ({
|
|
|
9441
9507
|
eventVenues = [],
|
|
9442
9508
|
geoBlockedVenues: inheritedGeoBlockedVenues
|
|
9443
9509
|
}) => {
|
|
9444
|
-
var _a, _b, _c, _d;
|
|
9510
|
+
var _a, _b, _c, _d, _e;
|
|
9445
9511
|
const geoBlockedVenues = extractGeoBlockedVenues(quoteData.warnings);
|
|
9446
9512
|
for (const venue of inheritedGeoBlockedVenues != null ? inheritedGeoBlockedVenues : []) {
|
|
9447
9513
|
geoBlockedVenues.add(venue);
|
|
@@ -9456,6 +9522,7 @@ var buildLiveRouteCards = ({
|
|
|
9456
9522
|
);
|
|
9457
9523
|
const averageExecutionPrice = (_b = getPlaceOrderAverageExecutionPrice(quoteData)) != null ? _b : void 0;
|
|
9458
9524
|
const primaryWinnerVenue = quoteData.fills.length === 1 ? primaryVenue : void 0;
|
|
9525
|
+
const primaryWinnerOutcomeId = quoteData.fills.length === 1 ? (_c = quoteData.fills[0]) == null ? void 0 : _c.venueMarketOutcomeId : void 0;
|
|
9459
9526
|
const isPrimaryRouteGeoBlocked = quoteData.fills.length > 0 && quoteData.fills.some((f) => geoBlockedVenues.has(f.venue));
|
|
9460
9527
|
const primaryCard = primaryResult ? isPrimaryRouteGeoBlocked ? isSplit ? null : {
|
|
9461
9528
|
id: "live-route",
|
|
@@ -9465,7 +9532,7 @@ var buildLiveRouteCards = ({
|
|
|
9465
9532
|
parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0
|
|
9466
9533
|
),
|
|
9467
9534
|
executionPrice: averageExecutionPrice,
|
|
9468
|
-
numericValue:
|
|
9535
|
+
numericValue: getPlaceOrderQuoteValue(quoteData, tradeSide),
|
|
9469
9536
|
quoteData,
|
|
9470
9537
|
value: primaryResult.value,
|
|
9471
9538
|
venue: parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0,
|
|
@@ -9478,7 +9545,7 @@ var buildLiveRouteCards = ({
|
|
|
9478
9545
|
label: isSplit ? labels.orderSplitting : getTradingVenueLabel(
|
|
9479
9546
|
parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0
|
|
9480
9547
|
),
|
|
9481
|
-
numericValue:
|
|
9548
|
+
numericValue: getPlaceOrderQuoteValue(quoteData, tradeSide),
|
|
9482
9549
|
quoteData,
|
|
9483
9550
|
rows: mapQuoteDataToRoutingRows(quoteData, tradeSide),
|
|
9484
9551
|
description: labels.splitOrderDescription,
|
|
@@ -9488,7 +9555,7 @@ var buildLiveRouteCards = ({
|
|
|
9488
9555
|
requiresSharedKyc: primaryRequiresSharedKyc
|
|
9489
9556
|
} : null;
|
|
9490
9557
|
const soloCardId = (prefix, sq) => `${prefix}-${sq.venue}${sq.venueMarketOutcomeId ? `-${sq.venueMarketOutcomeId}` : ""}`;
|
|
9491
|
-
const soloCards = ((
|
|
9558
|
+
const soloCards = ((_d = quoteData.venueSoloQuotes) != null ? _d : []).filter(
|
|
9492
9559
|
(sq) => sq.status === "ok" && sq.unavailableReason !== "venue_unavailable" && sq.avgPrice !== null && sq.filledQty > 0 && // No `sq.quoteId` requirement: a solo is preview-only whenever its own
|
|
9493
9560
|
// funding lane is short (API nulls the quoteId), which is NOT always the
|
|
9494
9561
|
// whole-quote `insufficient_balance` case — an off-chain winner (Kalshi
|
|
@@ -9496,9 +9563,9 @@ var buildLiveRouteCards = ({
|
|
|
9496
9563
|
// stays unfunded. Gating on the quoteId silently hid that venue from the
|
|
9497
9564
|
// comparison list entirely. The panel's Deposit CTA fires off the same
|
|
9498
9565
|
// balance condition, and `handleExecuteQuote` rejects an empty quoteId.
|
|
9499
|
-
sq.venue !== primaryWinnerVenue
|
|
9566
|
+
(primaryWinnerOutcomeId && sq.venueMarketOutcomeId ? sq.venueMarketOutcomeId !== primaryWinnerOutcomeId : sq.venue !== primaryWinnerVenue)
|
|
9500
9567
|
).map((sq) => {
|
|
9501
|
-
var _a2, _b2;
|
|
9568
|
+
var _a2, _b2, _c2, _d2, _e2, _f;
|
|
9502
9569
|
const parsedVenue = parseVenue(sq.venue);
|
|
9503
9570
|
const venue = parsedVenue.success ? parsedVenue.data : void 0;
|
|
9504
9571
|
if (geoBlockedVenues.has(sq.venue)) {
|
|
@@ -9508,10 +9575,10 @@ var buildLiveRouteCards = ({
|
|
|
9508
9575
|
hint: labels.venueUnavailableInRegion,
|
|
9509
9576
|
kind: "venue",
|
|
9510
9577
|
label: getTradingVenueLabel(venue),
|
|
9511
|
-
numericValue: sq.filledQty,
|
|
9578
|
+
numericValue: (_a2 = sq.estimatedPayout) != null ? _a2 : sq.filledQty,
|
|
9512
9579
|
quoteData,
|
|
9513
9580
|
value: getTradingValueLabel({
|
|
9514
|
-
amount: sq.filledQty,
|
|
9581
|
+
amount: (_b2 = sq.estimatedPayout) != null ? _b2 : sq.filledQty,
|
|
9515
9582
|
minimumFractionDigits: 2,
|
|
9516
9583
|
maximumFractionDigits: 2
|
|
9517
9584
|
}),
|
|
@@ -9525,7 +9592,7 @@ var buildLiveRouteCards = ({
|
|
|
9525
9592
|
// Preview-only solos intentionally carry no executable quoteId; the card
|
|
9526
9593
|
// should still render for comparison, while the CTA stays disabled until
|
|
9527
9594
|
// the user is funded and requotes.
|
|
9528
|
-
quoteId: (
|
|
9595
|
+
quoteId: (_c2 = sq.quoteId) != null ? _c2 : "",
|
|
9529
9596
|
fills: sq.fills.map((f) => __spreadValues({}, f)),
|
|
9530
9597
|
totalFilled: sq.filledQty,
|
|
9531
9598
|
rawExecCost: sq.rawExecCost,
|
|
@@ -9538,7 +9605,7 @@ var buildLiveRouteCards = ({
|
|
|
9538
9605
|
// primary route's breakdown in place, so selecting a bridge-free venue
|
|
9539
9606
|
// still showed the primary's bridging charge. Falls back to the
|
|
9540
9607
|
// primary only when the router omitted one (non-"ok" solos).
|
|
9541
|
-
feeBreakdown: (
|
|
9608
|
+
feeBreakdown: (_d2 = sq.feeBreakdown) != null ? _d2 : quoteData.feeBreakdown
|
|
9542
9609
|
}), sq.quoteId ? { status: "ok", error: void 0 } : null);
|
|
9543
9610
|
return {
|
|
9544
9611
|
id: soloCardId("live-solo", sq),
|
|
@@ -9547,10 +9614,10 @@ var buildLiveRouteCards = ({
|
|
|
9547
9614
|
kind: "venue",
|
|
9548
9615
|
label: getTradingVenueLabel(venue),
|
|
9549
9616
|
executionPrice: avgPrice,
|
|
9550
|
-
numericValue: sq.filledQty,
|
|
9617
|
+
numericValue: (_e2 = sq.estimatedPayout) != null ? _e2 : sq.filledQty,
|
|
9551
9618
|
quoteData: soloQuoteData,
|
|
9552
9619
|
value: getTradingValueLabel({
|
|
9553
|
-
amount: sq.filledQty,
|
|
9620
|
+
amount: (_f = sq.estimatedPayout) != null ? _f : sq.filledQty,
|
|
9554
9621
|
minimumFractionDigits: 2,
|
|
9555
9622
|
maximumFractionDigits: 2
|
|
9556
9623
|
}),
|
|
@@ -9558,7 +9625,8 @@ var buildLiveRouteCards = ({
|
|
|
9558
9625
|
requiresSharedKyc: venueRequiresSharedKyc({ venue: sq.venue })
|
|
9559
9626
|
};
|
|
9560
9627
|
});
|
|
9561
|
-
const unavailableCards = ((
|
|
9628
|
+
const unavailableCards = ((_e = quoteData.venueSoloQuotes) != null ? _e : []).filter((sq) => sq.status === "unavailable" || sq.unavailableReason === "venue_unavailable").map((sq) => {
|
|
9629
|
+
var _a2, _b2;
|
|
9562
9630
|
const parsedVenue = parseVenue(sq.venue);
|
|
9563
9631
|
const venue = parsedVenue.success ? parsedVenue.data : void 0;
|
|
9564
9632
|
const temporarilyUnavailable = sq.unavailableReason === "venue_unavailable";
|
|
@@ -9569,10 +9637,10 @@ var buildLiveRouteCards = ({
|
|
|
9569
9637
|
hint: temporarilyUnavailable ? labels.venueTemporarilyUnavailable : labels.venueUnavailableInRegion,
|
|
9570
9638
|
kind: "venue",
|
|
9571
9639
|
label: getTradingVenueLabel(venue),
|
|
9572
|
-
numericValue: hasPreview ? sq.filledQty : 0,
|
|
9640
|
+
numericValue: hasPreview ? (_a2 = sq.estimatedPayout) != null ? _a2 : sq.filledQty : 0,
|
|
9573
9641
|
quoteData: __spreadProps(__spreadValues({}, quoteData), { quoteId: "" }),
|
|
9574
9642
|
value: hasPreview ? getTradingValueLabel({
|
|
9575
|
-
amount: sq.filledQty,
|
|
9643
|
+
amount: (_b2 = sq.estimatedPayout) != null ? _b2 : sq.filledQty,
|
|
9576
9644
|
minimumFractionDigits: 2,
|
|
9577
9645
|
maximumFractionDigits: 2
|
|
9578
9646
|
}) : ""
|
|
@@ -9786,10 +9854,13 @@ var getPlaceOrderPotentialReturn = (quoteData) => {
|
|
|
9786
9854
|
if (!((_a = quoteData == null ? void 0 : quoteData.fills) == null ? void 0 : _a.length) || quoteData.fills.length < 2) return 0;
|
|
9787
9855
|
const bestSoloVenueFill = Math.max(
|
|
9788
9856
|
0,
|
|
9789
|
-
...((_b = quoteData.venueSoloQuotes) != null ? _b : []).filter((quote) => quote.status === "ok" && quote.filledQty > 0).map((quote) =>
|
|
9857
|
+
...((_b = quoteData.venueSoloQuotes) != null ? _b : []).filter((quote) => quote.status === "ok" && quote.filledQty > 0).map((quote) => {
|
|
9858
|
+
var _a2;
|
|
9859
|
+
return (_a2 = quote.estimatedPayout) != null ? _a2 : quote.filledQty;
|
|
9860
|
+
})
|
|
9790
9861
|
);
|
|
9791
9862
|
if (bestSoloVenueFill <= 0) return 0;
|
|
9792
|
-
return Math.max(0, quoteData
|
|
9863
|
+
return Math.max(0, getPlaceOrderBuyPayout(quoteData) - bestSoloVenueFill);
|
|
9793
9864
|
};
|
|
9794
9865
|
var resolvePrimarySubmittedOrderId = ({
|
|
9795
9866
|
allowOrderIdFallback = true,
|
|
@@ -12194,7 +12265,7 @@ var PlaceOrder = ({
|
|
|
12194
12265
|
showResolvingState = false,
|
|
12195
12266
|
midpointsResult
|
|
12196
12267
|
}) => {
|
|
12197
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca;
|
|
12268
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da;
|
|
12198
12269
|
const {
|
|
12199
12270
|
enableDebug: isExecutionDebugEnabled,
|
|
12200
12271
|
features: { enableAnimations, showFeesBreakdown, showLimitOrders: limitOrdersFeature },
|
|
@@ -12975,7 +13046,16 @@ var PlaceOrder = ({
|
|
|
12975
13046
|
});
|
|
12976
13047
|
const payoutLabel = formatUsd(usdSide);
|
|
12977
13048
|
const amountLabel = internalTab === "sell" ? sharesLabel : payoutLabel;
|
|
12978
|
-
const toWinLabel =
|
|
13049
|
+
const toWinLabel = formatUsd(
|
|
13050
|
+
resolvePlaceOrderNetResult({
|
|
13051
|
+
quoteData,
|
|
13052
|
+
tradeSide: internalTab,
|
|
13053
|
+
shares: sharesSide,
|
|
13054
|
+
usd: usdSide,
|
|
13055
|
+
terminalOrderEvents: executionProgress.terminalOrderEvents,
|
|
13056
|
+
submittedOrders: executionProgress.submittedOrders
|
|
13057
|
+
})
|
|
13058
|
+
);
|
|
12979
13059
|
const potentialReturnValue = getPlaceOrderPotentialReturn(quoteData);
|
|
12980
13060
|
const potentialReturnLabel = potentialReturnValue > 0 ? formatUsd(potentialReturnValue) : void 0;
|
|
12981
13061
|
const eventTitle = (_f2 = (_e2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _e2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _f2 : "";
|
|
@@ -13379,7 +13459,16 @@ var PlaceOrder = ({
|
|
|
13379
13459
|
maximumFractionDigits: 2
|
|
13380
13460
|
})
|
|
13381
13461
|
) : formatUsd(actualEconomics.actualRawExecCost);
|
|
13382
|
-
const payoutLabel =
|
|
13462
|
+
const payoutLabel = formatUsd(
|
|
13463
|
+
resolvePlaceOrderNetResult({
|
|
13464
|
+
quoteData,
|
|
13465
|
+
tradeSide: internalTab,
|
|
13466
|
+
shares: actualEconomics.actualTotalFilled,
|
|
13467
|
+
usd: actualEconomics.actualRawExecCost,
|
|
13468
|
+
terminalOrderEvents: executionProgress.terminalOrderEvents,
|
|
13469
|
+
submittedOrders: executionProgress.submittedOrders
|
|
13470
|
+
})
|
|
13471
|
+
);
|
|
13383
13472
|
return __spreadProps(__spreadValues({}, summaryWithGroups), {
|
|
13384
13473
|
actions: summaryWithGroups.actions.map(
|
|
13385
13474
|
(action) => action.variant === "retry" ? __spreadProps(__spreadValues({}, action), { label: tradingLabels.orderTryRemaining(remainingLabel) }) : action
|
|
@@ -13615,30 +13704,21 @@ var PlaceOrder = ({
|
|
|
13615
13704
|
if (totalFees == null) return null;
|
|
13616
13705
|
return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
13617
13706
|
}, [activeFeeBreakdown]);
|
|
13707
|
+
const appFeeValue = (__ = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.appFee) != null ? __ : 0;
|
|
13618
13708
|
const feeBreakdownRows = (0, import_react17.useMemo)(() => {
|
|
13619
|
-
var _a2
|
|
13709
|
+
var _a2;
|
|
13620
13710
|
if (!activeFeeBreakdown) return [];
|
|
13621
13711
|
return [
|
|
13622
13712
|
{
|
|
13713
|
+
// The builder slice (Hyperliquid only today) is a separate field on the
|
|
13714
|
+
// wire but reads as one cost to the user, so it renders inside "Venue".
|
|
13623
13715
|
kind: "amount",
|
|
13624
13716
|
label: tradingLabels.feeBreakdownVenueFees,
|
|
13625
|
-
value: formatUsd(activeFeeBreakdown.venueFees, {
|
|
13717
|
+
value: formatUsd(activeFeeBreakdown.venueFees + ((_a2 = activeFeeBreakdown.builderFee) != null ? _a2 : 0), {
|
|
13626
13718
|
minimumFractionDigits: 2,
|
|
13627
13719
|
maximumFractionDigits: 2
|
|
13628
13720
|
})
|
|
13629
13721
|
},
|
|
13630
|
-
// Only Hyperliquid charges a builder slice today; every other route
|
|
13631
|
-
// would show a bare "$0.00" line.
|
|
13632
|
-
...((_a2 = activeFeeBreakdown.builderFee) != null ? _a2 : 0) > 0 ? [
|
|
13633
|
-
{
|
|
13634
|
-
kind: "amount",
|
|
13635
|
-
label: tradingLabels.feeBreakdownBuilderFee,
|
|
13636
|
-
value: formatUsd((_b2 = activeFeeBreakdown.builderFee) != null ? _b2 : 0, {
|
|
13637
|
-
minimumFractionDigits: 2,
|
|
13638
|
-
maximumFractionDigits: 2
|
|
13639
|
-
})
|
|
13640
|
-
}
|
|
13641
|
-
] : [],
|
|
13642
13722
|
{
|
|
13643
13723
|
kind: "amount",
|
|
13644
13724
|
label: tradingLabels.feeBreakdownExecutionGas,
|
|
@@ -13655,23 +13735,33 @@ var PlaceOrder = ({
|
|
|
13655
13735
|
maximumFractionDigits: 2
|
|
13656
13736
|
})
|
|
13657
13737
|
},
|
|
13658
|
-
|
|
13738
|
+
// A partner charging a non-zero app fee gets a plain dollar row like every
|
|
13739
|
+
// other cost above it — the "0% fee" badge is only true, and only worth
|
|
13740
|
+
// highlighting, when the fee really is zero.
|
|
13741
|
+
appFeeValue > 0 ? {
|
|
13742
|
+
kind: "amount",
|
|
13743
|
+
label: tradingLabels.feeBreakdownAggMarket,
|
|
13744
|
+
value: formatUsd(appFeeValue, {
|
|
13745
|
+
minimumFractionDigits: 2,
|
|
13746
|
+
maximumFractionDigits: 2
|
|
13747
|
+
})
|
|
13748
|
+
} : {
|
|
13659
13749
|
kind: "badge",
|
|
13660
13750
|
label: tradingLabels.feeBreakdownAggMarket,
|
|
13661
13751
|
badgeLabel: tradingLabels.feeBreakdownPlatformFeeBadge
|
|
13662
13752
|
}
|
|
13663
13753
|
];
|
|
13664
|
-
}, [activeFeeBreakdown, tradingLabels]);
|
|
13754
|
+
}, [activeFeeBreakdown, appFeeValue, tradingLabels]);
|
|
13665
13755
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
|
|
13666
13756
|
const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
|
|
13667
|
-
const selectedLimitRouteCard = selectedLimitRouteCardId ? (
|
|
13668
|
-
const selectedRouteGeoBlocked = isLimitOrder ? (
|
|
13757
|
+
const selectedLimitRouteCard = selectedLimitRouteCardId ? (_$ = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _$ : null : null;
|
|
13758
|
+
const selectedRouteGeoBlocked = isLimitOrder ? (_aa = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _aa : false : (_ba = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _ba : false;
|
|
13669
13759
|
const geoBlockedVenuesFromWarnings = (0, import_react17.useMemo)(
|
|
13670
13760
|
() => {
|
|
13671
13761
|
var _a2;
|
|
13672
13762
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
13673
13763
|
},
|
|
13674
|
-
[(
|
|
13764
|
+
[(_ca = smartRoute.data) == null ? void 0 : _ca.warnings]
|
|
13675
13765
|
);
|
|
13676
13766
|
const isPrimaryVenueGeoBlocked = (0, import_react17.useMemo)(() => {
|
|
13677
13767
|
var _a2, _b2;
|
|
@@ -14356,7 +14446,7 @@ var PlaceOrder = ({
|
|
|
14356
14446
|
PlaceOrderResolvedView,
|
|
14357
14447
|
{
|
|
14358
14448
|
tradingState: resolvedReadOnlyTradingState,
|
|
14359
|
-
resolutionTimestamp: (
|
|
14449
|
+
resolutionTimestamp: (_da = resolvedEventTradingState.resolvesAt) != null ? _da : resolvedReadOnlyTradingState.resolvesAt,
|
|
14360
14450
|
resolvedClaim,
|
|
14361
14451
|
classNames,
|
|
14362
14452
|
className,
|
|
@@ -15117,7 +15207,7 @@ var PlaceOrder = ({
|
|
|
15117
15207
|
message: internalTab === "buy" ? tradingLabels.lowLiquidityWarning : tradingLabels.lowLiquiditySellWarning
|
|
15118
15208
|
}
|
|
15119
15209
|
) : null,
|
|
15120
|
-
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
15210
|
+
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown && appFeeValue === 0 ? /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
15121
15211
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
15122
15212
|
Icon,
|
|
15123
15213
|
{
|
package/dist/trading.mjs
CHANGED
|
@@ -73,6 +73,34 @@ export type PlaceOrderAggregateOrderStatus = "pending" | "full_success" | "parti
|
|
|
73
73
|
* corresponding terminal event so the UI never transitions prematurely.
|
|
74
74
|
*/
|
|
75
75
|
export declare const deriveAggregateOrderStatus: (orderIds: string[], terminalEvents: PlaceOrderTerminalOrderEvent[]) => PlaceOrderAggregateOrderStatus;
|
|
76
|
+
/**
|
|
77
|
+
* Dollars a BUY quote pays if the outcome wins. One dollar per share, less what
|
|
78
|
+
* the venue takes from that payout (Hyperliquid HIP-4's close fee), which the
|
|
79
|
+
* API reports as `estimatedPayout`. Older responses omit it — fall back to
|
|
80
|
+
* shares, which is exactly right for every venue that charges nothing at win.
|
|
81
|
+
*/
|
|
82
|
+
export declare const getPlaceOrderBuyPayout: (quoteData: Pick<SmartRouteResponse, "estimatedPayout" | "totalFilled">) => number;
|
|
83
|
+
/**
|
|
84
|
+
* Dollars a SELL quote returns after the fees charged at fill. `rawExecCost` is
|
|
85
|
+
* gross proceeds on a sell (redeem legs at $1 plus router revenue), so subtract
|
|
86
|
+
* each fill's venue and builder fee. Sell fills carry no execution reserve.
|
|
87
|
+
*/
|
|
88
|
+
export declare const getPlaceOrderSellProceeds: (quoteData: Pick<SmartRouteResponse, "rawExecCost" | "fills">) => number;
|
|
89
|
+
/** The dollar figure a route card shows and is ranked by. */
|
|
90
|
+
export declare const getPlaceOrderQuoteValue: (quoteData: SmartRouteResponse, tradeSide: PlaceOrderTab) => number;
|
|
91
|
+
/**
|
|
92
|
+
* The same net figure for realized fills: scale the actual shares (buy) or
|
|
93
|
+
* actual gross proceeds (sell) by each executed leg's quoted net-to-gross
|
|
94
|
+
* ratio. Without execution events, use the overall quote ratio.
|
|
95
|
+
*/
|
|
96
|
+
export declare const resolvePlaceOrderNetResult: ({ quoteData, tradeSide, shares, usd, terminalOrderEvents, submittedOrders, }: {
|
|
97
|
+
quoteData: SmartRouteResponse | null | undefined;
|
|
98
|
+
tradeSide: PlaceOrderTab;
|
|
99
|
+
shares: number;
|
|
100
|
+
usd: number;
|
|
101
|
+
terminalOrderEvents?: PlaceOrderTerminalOrderEvent[];
|
|
102
|
+
submittedOrders?: WsOrderSubmitted[];
|
|
103
|
+
}) => number;
|
|
76
104
|
export declare const resolvePlaceOrderQuoteResult: ({ labels, quoteData, tradeSide, }: ResolvePlaceOrderQuoteResultParams) => PlaceOrderQuoteResult | null;
|
|
77
105
|
export declare const sanitizePlaceOrderAmount: (value: number) => number;
|
|
78
106
|
export declare const getTradingRoutePriceLabel: (value: number) => string;
|
|
@@ -73,6 +73,34 @@ export type PlaceOrderAggregateOrderStatus = "pending" | "full_success" | "parti
|
|
|
73
73
|
* corresponding terminal event so the UI never transitions prematurely.
|
|
74
74
|
*/
|
|
75
75
|
export declare const deriveAggregateOrderStatus: (orderIds: string[], terminalEvents: PlaceOrderTerminalOrderEvent[]) => PlaceOrderAggregateOrderStatus;
|
|
76
|
+
/**
|
|
77
|
+
* Dollars a BUY quote pays if the outcome wins. One dollar per share, less what
|
|
78
|
+
* the venue takes from that payout (Hyperliquid HIP-4's close fee), which the
|
|
79
|
+
* API reports as `estimatedPayout`. Older responses omit it — fall back to
|
|
80
|
+
* shares, which is exactly right for every venue that charges nothing at win.
|
|
81
|
+
*/
|
|
82
|
+
export declare const getPlaceOrderBuyPayout: (quoteData: Pick<SmartRouteResponse, "estimatedPayout" | "totalFilled">) => number;
|
|
83
|
+
/**
|
|
84
|
+
* Dollars a SELL quote returns after the fees charged at fill. `rawExecCost` is
|
|
85
|
+
* gross proceeds on a sell (redeem legs at $1 plus router revenue), so subtract
|
|
86
|
+
* each fill's venue and builder fee. Sell fills carry no execution reserve.
|
|
87
|
+
*/
|
|
88
|
+
export declare const getPlaceOrderSellProceeds: (quoteData: Pick<SmartRouteResponse, "rawExecCost" | "fills">) => number;
|
|
89
|
+
/** The dollar figure a route card shows and is ranked by. */
|
|
90
|
+
export declare const getPlaceOrderQuoteValue: (quoteData: SmartRouteResponse, tradeSide: PlaceOrderTab) => number;
|
|
91
|
+
/**
|
|
92
|
+
* The same net figure for realized fills: scale the actual shares (buy) or
|
|
93
|
+
* actual gross proceeds (sell) by each executed leg's quoted net-to-gross
|
|
94
|
+
* ratio. Without execution events, use the overall quote ratio.
|
|
95
|
+
*/
|
|
96
|
+
export declare const resolvePlaceOrderNetResult: ({ quoteData, tradeSide, shares, usd, terminalOrderEvents, submittedOrders, }: {
|
|
97
|
+
quoteData: SmartRouteResponse | null | undefined;
|
|
98
|
+
tradeSide: PlaceOrderTab;
|
|
99
|
+
shares: number;
|
|
100
|
+
usd: number;
|
|
101
|
+
terminalOrderEvents?: PlaceOrderTerminalOrderEvent[];
|
|
102
|
+
submittedOrders?: WsOrderSubmitted[];
|
|
103
|
+
}) => number;
|
|
76
104
|
export declare const resolvePlaceOrderQuoteResult: ({ labels, quoteData, tradeSide, }: ResolvePlaceOrderQuoteResultParams) => PlaceOrderQuoteResult | null;
|
|
77
105
|
export declare const sanitizePlaceOrderAmount: (value: number) => number;
|
|
78
106
|
export declare const getTradingRoutePriceLabel: (value: number) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/ui",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.3",
|
|
4
4
|
"description": "Pre-built React component library for the AGG prediction market aggregator. Tailwind-based, themeable, with primitives, event surfaces, trading flows, full pages, and modals.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"react": "^18.0.0 || ^19.0.0",
|
|
102
102
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
103
103
|
"@agg-build/hooks": "^4.11.0",
|
|
104
|
-
"@agg-build/sdk": "^4.11.
|
|
104
|
+
"@agg-build/sdk": "^4.11.3"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"@number-flow/react": "^0.6.0",
|