@agg-build/ui 1.2.7 → 1.2.9
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-5FXMHTVR.mjs → chunk-5MDFM2MX.mjs} +1 -1
- package/dist/{chunk-TBKDLNOE.mjs → chunk-5PSAIGOT.mjs} +29 -8
- package/dist/{chunk-WPF47BQQ.mjs → chunk-7JKGAWU5.mjs} +9 -2
- package/dist/{chunk-3RG2K7MV.mjs → chunk-K23CJ5UP.mjs} +666 -148
- package/dist/{chunk-E45WOOMN.mjs → chunk-PFOSEY46.mjs} +22 -8
- package/dist/{chunk-QMWKXDVZ.mjs → chunk-PYKD4W4T.mjs} +18 -12
- package/dist/{chunk-34L7ZKJW.mjs → chunk-QFW5NDJ6.mjs} +7 -10
- package/dist/events.js +55 -23
- package/dist/events.mjs +3 -3
- package/dist/index.js +777 -207
- package/dist/index.mjs +28 -21
- package/dist/modals.js +12 -9
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +740 -184
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +7 -10
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +669 -154
- package/dist/trading.mjs +4 -4
- package/dist/types/primitives/switch-button/switch-button.constants.d.mts +1 -1
- package/dist/types/primitives/switch-button/switch-button.constants.d.ts +1 -1
- package/dist/types/primitives/tooltip/index.d.mts +1 -1
- package/dist/types/primitives/tooltip/index.d.ts +1 -1
- package/dist/types/primitives/tooltip/tooltip.types.d.mts +2 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.ts +2 -0
- package/dist/types/trading/place-order/index.place-order.execution-debug.d.mts +183 -0
- package/dist/types/trading/place-order/index.place-order.execution-debug.d.ts +183 -0
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +72 -0
- package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +72 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1581,7 +1581,7 @@ var HourglassStartIcon = (_a) => {
|
|
|
1581
1581
|
__spreadProps(__spreadValues(__spreadValues({
|
|
1582
1582
|
width: "16",
|
|
1583
1583
|
height: "16",
|
|
1584
|
-
viewBox: "0 0
|
|
1584
|
+
viewBox: "0 0 10 10",
|
|
1585
1585
|
fill: "none",
|
|
1586
1586
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1587
1587
|
className
|
|
@@ -1591,14 +1591,10 @@ var HourglassStartIcon = (_a) => {
|
|
|
1591
1591
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1592
1592
|
"path",
|
|
1593
1593
|
{
|
|
1594
|
-
d: "
|
|
1595
|
-
|
|
1596
|
-
strokeWidth: "1.4",
|
|
1597
|
-
strokeLinecap: "round",
|
|
1598
|
-
strokeLinejoin: "round"
|
|
1594
|
+
d: "M8.7324 1.90708C8.80282 1.43542 8.66324 0.95625 8.3499 0.5925C8.03115 0.2225 7.56907 0.0108337 7.08157 0.0108337H2.91907C2.43157 0.0108337 1.96949 0.223334 1.65115 0.593334C1.3374 0.9575 1.19824 1.43667 1.26907 1.90875C1.43824 3.03333 2.05449 4.07458 3.10282 5.01042C2.05407 5.94625 1.43782 6.9875 1.26907 8.11208C1.19824 8.58417 1.33782 9.06333 1.65115 9.4275C1.96949 9.79792 2.43199 10.0096 2.91907 10.0096H7.08157C7.56907 10.0096 8.03115 9.79792 8.3499 9.42792C8.66324 9.06417 8.80282 8.585 8.7324 8.11375C8.56449 6.99292 7.9474 5.95083 6.89657 5.01C7.9474 4.06917 8.56449 3.0275 8.7324 1.90708ZM7.46949 1.83333C7.05949 2.84667 6.19824 3.67583 5.54907 4.1925L5.26157 4.42208C5.10949 4.54292 4.8949 4.54292 4.74282 4.42292L4.44949 4.19C3.80074 3.67708 2.94157 2.85167 2.53074 1.83333C2.47865 1.70458 2.49449 1.55917 2.57157 1.44417C2.64907 1.32958 2.77865 1.26083 2.91699 1.26083H7.08365C7.2224 1.26083 7.35199 1.32917 7.42907 1.44417C7.50657 1.55875 7.52157 1.705 7.46949 1.83333ZM5.0299 3.54083L5.00074 3.56417L4.96657 3.53708C4.53032 3.19208 3.9874 2.69167 3.60365 2.09458H6.39615C6.01115 2.69 5.4674 3.19292 5.03032 3.54125L5.0299 3.54083Z",
|
|
1595
|
+
fill: "currentColor"
|
|
1599
1596
|
}
|
|
1600
|
-
)
|
|
1601
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "M6.75 4.25H9.25L8 5.25L6.75 4.25Z", fill: "currentColor" })
|
|
1597
|
+
)
|
|
1602
1598
|
]
|
|
1603
1599
|
})
|
|
1604
1600
|
);
|
|
@@ -3688,7 +3684,7 @@ var SWITCH_BUTTON_ANIMATION_DURATION_MS = 350;
|
|
|
3688
3684
|
var SWITCH_BUTTON_CONTAINER_CLASS_NAME = "group/agg-switch-button min-w-fit inline-flex min-w-0 rounded-agg-full bg-agg-secondary-hover font-agg-sans cursor-pointer hover:bg-agg-tertiary";
|
|
3689
3685
|
var SWITCH_BUTTON_TRACK_CLASS_NAME = "agg-switch-button-track relative grid min-w-0 flex-1 items-center";
|
|
3690
3686
|
var SWITCH_BUTTON_TRACK_HIGHLIGHT_CLASS_NAME = "pointer-events-none absolute inset-y-0 left-0 rounded-agg-full border border-agg-primary bg-agg-secondary";
|
|
3691
|
-
var SWITCH_BUTTON_OPTION_BASE_CLASS_NAME = "agg-switch-button-option whitespace-nowrap relative z-10 min-w-0 rounded-agg-full px-5 py-1.5 font-agg-sans text-agg-base leading-agg-6 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary-hover cursor-pointer disabled:cursor-not-allowed disabled:text-agg-muted-foreground";
|
|
3687
|
+
var SWITCH_BUTTON_OPTION_BASE_CLASS_NAME = "agg-switch-button-option whitespace-nowrap relative z-10 min-w-0 rounded-agg-full px-5 py-1.5 font-agg-sans text-agg-sm leading-agg-5 md:text-agg-base md:leading-agg-6 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary-hover cursor-pointer disabled:cursor-not-allowed disabled:text-agg-muted-foreground";
|
|
3692
3688
|
|
|
3693
3689
|
// src/primitives/switch-button/switch-button.utils.ts
|
|
3694
3690
|
var resolveActiveIndex = (options, value) => {
|
|
@@ -9193,6 +9189,7 @@ var Tooltip = ({
|
|
|
9193
9189
|
side = "top",
|
|
9194
9190
|
delayDuration = 150,
|
|
9195
9191
|
collisionPadding = 12,
|
|
9192
|
+
sideOffset = 0,
|
|
9196
9193
|
classNames,
|
|
9197
9194
|
"aria-label": ariaLabel
|
|
9198
9195
|
}) => {
|
|
@@ -9220,7 +9217,7 @@ var Tooltip = ({
|
|
|
9220
9217
|
TooltipPrimitive.Content,
|
|
9221
9218
|
{
|
|
9222
9219
|
side,
|
|
9223
|
-
sideOffset
|
|
9220
|
+
sideOffset,
|
|
9224
9221
|
collisionPadding,
|
|
9225
9222
|
className: cn(
|
|
9226
9223
|
"group/agg-tooltip",
|
|
@@ -9737,7 +9734,14 @@ var AuthConnectButtonView = ({
|
|
|
9737
9734
|
ConditionalWrapper,
|
|
9738
9735
|
{
|
|
9739
9736
|
condition: isDepositBlocked,
|
|
9740
|
-
wrapper: (children) => /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
9737
|
+
wrapper: (children) => /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
9738
|
+
Tooltip,
|
|
9739
|
+
{
|
|
9740
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
9741
|
+
sideOffset: 4,
|
|
9742
|
+
children
|
|
9743
|
+
}
|
|
9744
|
+
),
|
|
9741
9745
|
children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
9742
9746
|
Button,
|
|
9743
9747
|
__spreadProps(__spreadValues({
|
|
@@ -9791,7 +9795,7 @@ var AuthConnectButtonView = ({
|
|
|
9791
9795
|
claimReadyCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
9792
9796
|
"span",
|
|
9793
9797
|
{
|
|
9794
|
-
className: "inline-flex size-4 shrink-0 items-center justify-center rounded-full bg-linear-to-r from-agg-primary to-agg-primary-hover text-
|
|
9798
|
+
className: "inline-flex size-4 shrink-0 items-center justify-center rounded-full bg-linear-to-r from-agg-primary to-agg-primary-hover text-2.5 leading-3.5 font-agg-bold text-agg-foreground uppercase",
|
|
9795
9799
|
"aria-label": resolveClaimBadgeAriaLabel(claimReadyCount),
|
|
9796
9800
|
children: claimReadyCount
|
|
9797
9801
|
}
|
|
@@ -9953,23 +9957,23 @@ var AuthConnectButtonView = ({
|
|
|
9953
9957
|
}
|
|
9954
9958
|
),
|
|
9955
9959
|
isDepositBlocked ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
9956
|
-
|
|
9960
|
+
DropdownMenu.Item,
|
|
9957
9961
|
{
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9962
|
+
className: cn(dropdownMenuItemClassName, "opacity-50 cursor-not-allowed!"),
|
|
9963
|
+
onSelect: (e) => e.preventDefault(),
|
|
9964
|
+
"aria-disabled": "true",
|
|
9965
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
9966
|
+
Tooltip,
|
|
9961
9967
|
{
|
|
9962
|
-
className:
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
),
|
|
9966
|
-
disabled: true,
|
|
9967
|
-
children: [
|
|
9968
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
9969
|
+
side: "bottom",
|
|
9970
|
+
sideOffset: 4,
|
|
9971
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("span", { className: "inline-flex items-center gap-3", children: [
|
|
9968
9972
|
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { name: "download", size: "small", className: "text-agg-foreground" }),
|
|
9969
9973
|
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { children: labels.auth.deposit })
|
|
9970
|
-
]
|
|
9974
|
+
] })
|
|
9971
9975
|
}
|
|
9972
|
-
)
|
|
9976
|
+
)
|
|
9973
9977
|
}
|
|
9974
9978
|
) : /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
9975
9979
|
DropdownMenu.Item,
|
|
@@ -10914,6 +10918,18 @@ var marketChartCandleToScaledCandlePoint = (candle, transformProbability) => {
|
|
|
10914
10918
|
v: candle.volume
|
|
10915
10919
|
};
|
|
10916
10920
|
};
|
|
10921
|
+
var venueCandlesToLinePoints = (venueData, transformProbability) => {
|
|
10922
|
+
const candles = venueData.liveCandle && !venueData.candles.some((candle) => {
|
|
10923
|
+
var _a;
|
|
10924
|
+
return candle.time === ((_a = venueData.liveCandle) == null ? void 0 : _a.time);
|
|
10925
|
+
}) ? [...venueData.candles, venueData.liveCandle] : venueData.liveCandle ? venueData.candles.map(
|
|
10926
|
+
(candle) => {
|
|
10927
|
+
var _a;
|
|
10928
|
+
return candle.time === ((_a = venueData.liveCandle) == null ? void 0 : _a.time) ? venueData.liveCandle : candle;
|
|
10929
|
+
}
|
|
10930
|
+
) : venueData.candles;
|
|
10931
|
+
return candles.map((candle) => marketChartCandleToLineChartPoint(candle, transformProbability));
|
|
10932
|
+
};
|
|
10917
10933
|
var resolveMarketChartVenueSeries = ({
|
|
10918
10934
|
chartData,
|
|
10919
10935
|
transformProbability
|
|
@@ -10921,9 +10937,7 @@ var resolveMarketChartVenueSeries = ({
|
|
|
10921
10937
|
if (!chartData) return [];
|
|
10922
10938
|
return Object.entries(chartData.venues).map(([venue, venueData]) => ({
|
|
10923
10939
|
venue,
|
|
10924
|
-
points: venueData
|
|
10925
|
-
(candle) => marketChartCandleToLineChartPoint(candle, transformProbability)
|
|
10926
|
-
)
|
|
10940
|
+
points: venueCandlesToLinePoints(venueData, transformProbability)
|
|
10927
10941
|
})).filter((item) => item.points.length > 0);
|
|
10928
10942
|
};
|
|
10929
10943
|
var resolveAggregatedCandleSource = (candles) => {
|
|
@@ -10976,13 +10990,24 @@ var resolveMarketChartDisplaySeries = ({
|
|
|
10976
10990
|
if (selectedVenue) {
|
|
10977
10991
|
return venueEntries.map(([venue, venueData]) => ({
|
|
10978
10992
|
venue,
|
|
10979
|
-
points: venueData
|
|
10980
|
-
(candle) => marketChartCandleToLineChartPoint(candle, transformProbability)
|
|
10981
|
-
)
|
|
10993
|
+
points: venueCandlesToLinePoints(venueData, transformProbability)
|
|
10982
10994
|
})).filter((item) => item.points.length > 0);
|
|
10983
10995
|
}
|
|
10984
10996
|
const aggregatedCandles = aggregateMarketChartCandles(
|
|
10985
|
-
venueEntries.flatMap(([, venueData]) =>
|
|
10997
|
+
venueEntries.flatMap(([, venueData]) => {
|
|
10998
|
+
const closed = venueData.candles;
|
|
10999
|
+
if (!venueData.liveCandle) return closed;
|
|
11000
|
+
const hasOverlap = closed.some((candle) => {
|
|
11001
|
+
var _a;
|
|
11002
|
+
return candle.time === ((_a = venueData.liveCandle) == null ? void 0 : _a.time);
|
|
11003
|
+
});
|
|
11004
|
+
return hasOverlap ? closed.map(
|
|
11005
|
+
(candle) => {
|
|
11006
|
+
var _a;
|
|
11007
|
+
return candle.time === ((_a = venueData.liveCandle) == null ? void 0 : _a.time) ? venueData.liveCandle : candle;
|
|
11008
|
+
}
|
|
11009
|
+
) : [...closed, venueData.liveCandle];
|
|
11010
|
+
})
|
|
10986
11011
|
);
|
|
10987
11012
|
if (aggregatedCandles.length === 0) return [];
|
|
10988
11013
|
return [
|
|
@@ -12861,7 +12886,9 @@ var EventListItemDetailsGraphSection = ({
|
|
|
12861
12886
|
}
|
|
12862
12887
|
),
|
|
12863
12888
|
classNames: {
|
|
12864
|
-
root: cn(
|
|
12889
|
+
root: cn(
|
|
12890
|
+
"shrink-0 border px-4 h-8 text-agg-sm leading-agg-5 md:h-9 md:text-agg-base md:leading-agg-6"
|
|
12891
|
+
)
|
|
12865
12892
|
},
|
|
12866
12893
|
isActive: isActiveVenue
|
|
12867
12894
|
}
|
|
@@ -13542,8 +13569,20 @@ var OrderbookRow = ({
|
|
|
13542
13569
|
}).map(([venue]) => venue);
|
|
13543
13570
|
const venues = entry.row.venues && entry.row.venues.length > 0 ? entry.row.venues : venuesFromBreakdown.length > 0 ? venuesFromBreakdown : [entry.row.venue];
|
|
13544
13571
|
const barPercent = Math.max(2, Number((entry.unifiedBarScale * 100).toFixed(2)));
|
|
13545
|
-
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "agg-orderbook-row relative flex h-9 items-center gap-2.5 overflow-clip
|
|
13546
|
-
/* @__PURE__ */ (0, import_jsx_runtime133.
|
|
13572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "agg-orderbook-row relative flex h-9 items-center gap-2.5 overflow-clip pl-5 pr-2.5 md:gap-10 md:pl-0 md:pr-5", children: [
|
|
13573
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
13574
|
+
"div",
|
|
13575
|
+
{
|
|
13576
|
+
"aria-hidden": "true",
|
|
13577
|
+
className: cn(
|
|
13578
|
+
"agg-orderbook-bar md:hidden absolute inset-y-0 left-0",
|
|
13579
|
+
barClassName,
|
|
13580
|
+
getMotionClassName(enableAnimations, "transition-[width] duration-200 ease-in-out")
|
|
13581
|
+
),
|
|
13582
|
+
style: { width: `${barPercent}%` }
|
|
13583
|
+
}
|
|
13584
|
+
),
|
|
13585
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "hidden md:block md:relative min-w-0 flex-1 self-stretch", children: [
|
|
13547
13586
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
13548
13587
|
"div",
|
|
13549
13588
|
{
|
|
@@ -13646,8 +13685,8 @@ var Orderbook = ({
|
|
|
13646
13685
|
spreadEntry
|
|
13647
13686
|
]);
|
|
13648
13687
|
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: cn("agg-orderbook-unified flex flex-col", className), children: [
|
|
13649
|
-
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex h-9 items-center gap-2.5 overflow-clip border-b border-agg-separator pr-5 md:gap-10", children: [
|
|
13650
|
-
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "flex min-w-0 flex-1 items-center gap-2 pl-5", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.tradeOutcome }) }),
|
|
13688
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex h-9 items-center gap-2.5 overflow-clip border-b border-agg-separator pl-5 pr-5 md:pl-0 md:gap-10", children: [
|
|
13689
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "hidden md:flex min-w-0 flex-1 items-center gap-2 pl-5", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.tradeOutcome }) }),
|
|
13651
13690
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "w-20 shrink-0 text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground md:w-[120px]", children: labels.price }),
|
|
13652
13691
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "w-20 shrink-0 text-center text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground md:w-[120px]", children: labels.shares }),
|
|
13653
13692
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "w-20 shrink-0 text-center text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground md:w-[120px]", children: labels.total })
|
|
@@ -14482,7 +14521,7 @@ var MarketDetailsContent = ({
|
|
|
14482
14521
|
"span",
|
|
14483
14522
|
{
|
|
14484
14523
|
className: cn(
|
|
14485
|
-
"min-w-35 inline-flex h-9 items-center justify-center gap-2 rounded-agg-full",
|
|
14524
|
+
"w-full md:w-auto md:min-w-35 inline-flex h-9 items-center justify-center gap-2 rounded-agg-full",
|
|
14486
14525
|
"border px-5 py-1.5 text-agg-sm font-agg-bold",
|
|
14487
14526
|
getMotionClassName(
|
|
14488
14527
|
enableAnimations,
|
|
@@ -15446,7 +15485,7 @@ EventList.displayName = "EventList";
|
|
|
15446
15485
|
|
|
15447
15486
|
// src/pages/home/index.tsx
|
|
15448
15487
|
var import_hooks55 = require("@agg-build/hooks");
|
|
15449
|
-
var
|
|
15488
|
+
var import_sdk18 = require("@agg-build/sdk");
|
|
15450
15489
|
var import_react35 = require("react");
|
|
15451
15490
|
|
|
15452
15491
|
// src/pages/event-market/index.tsx
|
|
@@ -15664,6 +15703,447 @@ var PLACE_ORDER_OUTCOME_BUTTON_CLASS_NAMES = {
|
|
|
15664
15703
|
inactive: "border-transparent bg-agg-secondary-hover font-agg-normal text-agg-foreground hover:bg-agg-tertiary"
|
|
15665
15704
|
};
|
|
15666
15705
|
|
|
15706
|
+
// src/trading/place-order/index.place-order.execution-steps.ts
|
|
15707
|
+
var import_sdk17 = require("@agg-build/sdk");
|
|
15708
|
+
var WAIT_STEP_TYPES = /* @__PURE__ */ new Set(["_wait", "wait"]);
|
|
15709
|
+
var CHECKING_BALANCE_STEP_TYPES = /* @__PURE__ */ new Set([
|
|
15710
|
+
"check-balance",
|
|
15711
|
+
"check-position",
|
|
15712
|
+
"position-reserve",
|
|
15713
|
+
"position-release"
|
|
15714
|
+
]);
|
|
15715
|
+
var VENUE_BUY_SELL_REGEX = /^(?:buy|sell)-([a-z]+)$/;
|
|
15716
|
+
var VENUE_FINALIZE_REGEX = /^([a-z]+)-finalize$/;
|
|
15717
|
+
var VENUE_NAME_MAP = {
|
|
15718
|
+
kalshi: import_sdk17.Venue.kalshi,
|
|
15719
|
+
polymarket: import_sdk17.Venue.polymarket,
|
|
15720
|
+
limitless: import_sdk17.Venue.limitless,
|
|
15721
|
+
opinion: import_sdk17.Venue.opinion,
|
|
15722
|
+
predict: import_sdk17.Venue.predict,
|
|
15723
|
+
probable: import_sdk17.Venue.probable,
|
|
15724
|
+
myriad: import_sdk17.Venue.myriad,
|
|
15725
|
+
hyperliquid: import_sdk17.Venue.hyperliquid
|
|
15726
|
+
};
|
|
15727
|
+
var parseVenueName = (raw) => VENUE_NAME_MAP[raw];
|
|
15728
|
+
var NON_VENUE_FINALIZE_PREFIXES = /* @__PURE__ */ new Set(["bridge"]);
|
|
15729
|
+
var classifyExecutionStepType = (stepType) => {
|
|
15730
|
+
if (!stepType) return null;
|
|
15731
|
+
if (WAIT_STEP_TYPES.has(stepType)) return null;
|
|
15732
|
+
if (CHECKING_BALANCE_STEP_TYPES.has(stepType)) {
|
|
15733
|
+
return { kind: "checking-balance" };
|
|
15734
|
+
}
|
|
15735
|
+
const buySellMatch = stepType.match(VENUE_BUY_SELL_REGEX);
|
|
15736
|
+
if (buySellMatch) {
|
|
15737
|
+
const venue = parseVenueName(buySellMatch[1]);
|
|
15738
|
+
if (venue) return { kind: "executing-venue", venue };
|
|
15739
|
+
}
|
|
15740
|
+
const finalizeMatch = stepType.match(VENUE_FINALIZE_REGEX);
|
|
15741
|
+
if (finalizeMatch && !NON_VENUE_FINALIZE_PREFIXES.has(finalizeMatch[1])) {
|
|
15742
|
+
const venue = parseVenueName(finalizeMatch[1]);
|
|
15743
|
+
if (venue) return { kind: "executing-venue", venue };
|
|
15744
|
+
}
|
|
15745
|
+
if (stepType === "submit-verify-order-status") {
|
|
15746
|
+
return null;
|
|
15747
|
+
}
|
|
15748
|
+
return { kind: "submitting" };
|
|
15749
|
+
};
|
|
15750
|
+
var buildPhaseTimeline = (dag) => {
|
|
15751
|
+
const timeline = [];
|
|
15752
|
+
const completed = new Set(dag.completedSequences);
|
|
15753
|
+
for (let seq = 1; seq <= dag.totalSteps; seq++) {
|
|
15754
|
+
const stepType = dag.stepTypes[seq];
|
|
15755
|
+
if (!stepType) continue;
|
|
15756
|
+
const classified = classifyExecutionStepType(stepType);
|
|
15757
|
+
if (!classified) continue;
|
|
15758
|
+
const isCompleted = completed.has(seq);
|
|
15759
|
+
const last = timeline[timeline.length - 1];
|
|
15760
|
+
if (last && last.kind === classified.kind && last.venue === classified.venue) {
|
|
15761
|
+
last.lastSeq = seq;
|
|
15762
|
+
last.allCompleted = last.allCompleted && isCompleted;
|
|
15763
|
+
continue;
|
|
15764
|
+
}
|
|
15765
|
+
timeline.push({
|
|
15766
|
+
kind: classified.kind,
|
|
15767
|
+
venue: classified.venue,
|
|
15768
|
+
firstSeq: seq,
|
|
15769
|
+
lastSeq: seq,
|
|
15770
|
+
allCompleted: isCompleted
|
|
15771
|
+
});
|
|
15772
|
+
}
|
|
15773
|
+
return timeline;
|
|
15774
|
+
};
|
|
15775
|
+
var phaseRowId = (phase) => phase.venue ? `${phase.kind}:${phase.venue}` : phase.kind;
|
|
15776
|
+
var phaseRowLabel = (phase, labels) => {
|
|
15777
|
+
switch (phase.kind) {
|
|
15778
|
+
case "finding-route":
|
|
15779
|
+
return labels.findingBestRoute;
|
|
15780
|
+
case "checking-balance":
|
|
15781
|
+
return labels.checkingBalance;
|
|
15782
|
+
case "submitting":
|
|
15783
|
+
return labels.submittingOrderProgress;
|
|
15784
|
+
case "wallet-confirm":
|
|
15785
|
+
return labels.confirmTransactionInWallet;
|
|
15786
|
+
case "executing-venue":
|
|
15787
|
+
return labels.executingOnVenue(getTradingVenueLabel(phase.venue));
|
|
15788
|
+
case "filled":
|
|
15789
|
+
return labels.executionConfirmed;
|
|
15790
|
+
case "failed":
|
|
15791
|
+
return labels.orderFailureTitle;
|
|
15792
|
+
}
|
|
15793
|
+
};
|
|
15794
|
+
var buildSubmissionDisplayRows = ({
|
|
15795
|
+
phase,
|
|
15796
|
+
dagProgress,
|
|
15797
|
+
executionVenue,
|
|
15798
|
+
isAwaitingWalletConfirmation,
|
|
15799
|
+
labels
|
|
15800
|
+
}) => {
|
|
15801
|
+
if (phase === "finding-route") {
|
|
15802
|
+
return [
|
|
15803
|
+
{
|
|
15804
|
+
id: "finding-route",
|
|
15805
|
+
label: labels.findingBestRoute,
|
|
15806
|
+
status: "pending"
|
|
15807
|
+
}
|
|
15808
|
+
];
|
|
15809
|
+
}
|
|
15810
|
+
const rows = [
|
|
15811
|
+
{
|
|
15812
|
+
id: "finding-route",
|
|
15813
|
+
label: labels.findingBestRoute,
|
|
15814
|
+
status: "complete"
|
|
15815
|
+
}
|
|
15816
|
+
];
|
|
15817
|
+
const pushPhase = (phaseEntry, status) => {
|
|
15818
|
+
const id = phaseRowId(phaseEntry);
|
|
15819
|
+
if (rows.some((row) => row.id === id)) return;
|
|
15820
|
+
rows.push({
|
|
15821
|
+
id,
|
|
15822
|
+
label: phaseRowLabel(phaseEntry, labels),
|
|
15823
|
+
status,
|
|
15824
|
+
venue: phaseEntry.venue
|
|
15825
|
+
});
|
|
15826
|
+
};
|
|
15827
|
+
if (dagProgress && dagProgress.totalSteps > 0) {
|
|
15828
|
+
const timeline = buildPhaseTimeline(dagProgress);
|
|
15829
|
+
let activeEmitted = false;
|
|
15830
|
+
for (const entry of timeline) {
|
|
15831
|
+
const id = phaseRowId(entry);
|
|
15832
|
+
const alreadyShown = rows.some((row) => row.id === id);
|
|
15833
|
+
if (entry.allCompleted) {
|
|
15834
|
+
if (alreadyShown) continue;
|
|
15835
|
+
pushPhase(entry, "complete");
|
|
15836
|
+
continue;
|
|
15837
|
+
}
|
|
15838
|
+
if (activeEmitted) break;
|
|
15839
|
+
if (alreadyShown) continue;
|
|
15840
|
+
if (isAwaitingWalletConfirmation && entry.kind === "submitting") {
|
|
15841
|
+
pushPhase({ kind: "wallet-confirm" }, "pending");
|
|
15842
|
+
} else {
|
|
15843
|
+
pushPhase(entry, "pending");
|
|
15844
|
+
}
|
|
15845
|
+
activeEmitted = true;
|
|
15846
|
+
}
|
|
15847
|
+
if (!activeEmitted) {
|
|
15848
|
+
const last = rows[rows.length - 1];
|
|
15849
|
+
if (last && last.id.startsWith("executing-venue")) {
|
|
15850
|
+
last.status = "pending";
|
|
15851
|
+
} else {
|
|
15852
|
+
const fallbackVenue = executionVenue;
|
|
15853
|
+
rows.push({
|
|
15854
|
+
id: fallbackVenue ? `executing-venue:${fallbackVenue}` : "executing-venue",
|
|
15855
|
+
label: phaseRowLabel({ kind: "executing-venue", venue: fallbackVenue }, labels),
|
|
15856
|
+
status: "pending",
|
|
15857
|
+
venue: fallbackVenue
|
|
15858
|
+
});
|
|
15859
|
+
}
|
|
15860
|
+
}
|
|
15861
|
+
return rows;
|
|
15862
|
+
}
|
|
15863
|
+
if (isAwaitingWalletConfirmation) {
|
|
15864
|
+
pushPhase({ kind: "wallet-confirm" }, "pending");
|
|
15865
|
+
return rows;
|
|
15866
|
+
}
|
|
15867
|
+
if (phase === "submitting") {
|
|
15868
|
+
pushPhase({ kind: "submitting" }, "pending");
|
|
15869
|
+
return rows;
|
|
15870
|
+
}
|
|
15871
|
+
pushPhase({ kind: "submitting" }, "complete");
|
|
15872
|
+
pushPhase({ kind: "executing-venue", venue: executionVenue }, "pending");
|
|
15873
|
+
return rows;
|
|
15874
|
+
};
|
|
15875
|
+
|
|
15876
|
+
// src/trading/place-order/index.place-order.execution-debug.ts
|
|
15877
|
+
var REDACTED = "[redacted]";
|
|
15878
|
+
var SENSITIVE_FIELD_PATTERNS = [
|
|
15879
|
+
"token",
|
|
15880
|
+
"authorization",
|
|
15881
|
+
"cookie",
|
|
15882
|
+
"secret",
|
|
15883
|
+
"signature",
|
|
15884
|
+
"privatekey",
|
|
15885
|
+
"private_key",
|
|
15886
|
+
"accesstoken",
|
|
15887
|
+
"access_token",
|
|
15888
|
+
"refreshtoken",
|
|
15889
|
+
"refresh_token",
|
|
15890
|
+
"jwt",
|
|
15891
|
+
"password",
|
|
15892
|
+
"apikey",
|
|
15893
|
+
"api_key",
|
|
15894
|
+
"email",
|
|
15895
|
+
"headers"
|
|
15896
|
+
];
|
|
15897
|
+
var isSensitiveFieldName = (name) => {
|
|
15898
|
+
const normalized = name.toLowerCase();
|
|
15899
|
+
return SENSITIVE_FIELD_PATTERNS.some((pattern) => normalized.includes(pattern));
|
|
15900
|
+
};
|
|
15901
|
+
var sanitizeExecutionDebugValue = (input) => {
|
|
15902
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
15903
|
+
const walk = (value) => {
|
|
15904
|
+
if (value === null || value === void 0) return value;
|
|
15905
|
+
if (typeof value !== "object") return value;
|
|
15906
|
+
if (ancestors.has(value)) return "[circular]";
|
|
15907
|
+
ancestors.add(value);
|
|
15908
|
+
try {
|
|
15909
|
+
if (Array.isArray(value)) {
|
|
15910
|
+
return value.map((entry) => walk(entry));
|
|
15911
|
+
}
|
|
15912
|
+
if (value instanceof Error) {
|
|
15913
|
+
return {
|
|
15914
|
+
name: value.name,
|
|
15915
|
+
message: value.message,
|
|
15916
|
+
stack: value.stack
|
|
15917
|
+
};
|
|
15918
|
+
}
|
|
15919
|
+
const out = {};
|
|
15920
|
+
for (const [key, raw] of Object.entries(value)) {
|
|
15921
|
+
if (isSensitiveFieldName(key)) {
|
|
15922
|
+
out[key] = REDACTED;
|
|
15923
|
+
continue;
|
|
15924
|
+
}
|
|
15925
|
+
out[key] = walk(raw);
|
|
15926
|
+
}
|
|
15927
|
+
return out;
|
|
15928
|
+
} finally {
|
|
15929
|
+
ancestors.delete(value);
|
|
15930
|
+
}
|
|
15931
|
+
};
|
|
15932
|
+
return walk(input);
|
|
15933
|
+
};
|
|
15934
|
+
var cloneEnvironment = (env) => __spreadProps(__spreadValues({}, env), {
|
|
15935
|
+
packageVersions: env.packageVersions ? __spreadValues({}, env.packageVersions) : void 0
|
|
15936
|
+
});
|
|
15937
|
+
var buildEnvironment = (overrides) => {
|
|
15938
|
+
var _a;
|
|
15939
|
+
const url = typeof window !== "undefined" ? (_a = window.location) == null ? void 0 : _a.href : void 0;
|
|
15940
|
+
const userAgent = typeof navigator !== "undefined" && typeof navigator.userAgent === "string" ? navigator.userAgent : void 0;
|
|
15941
|
+
return __spreadValues({
|
|
15942
|
+
url,
|
|
15943
|
+
userAgent,
|
|
15944
|
+
capturedAt: Date.now()
|
|
15945
|
+
}, overrides);
|
|
15946
|
+
};
|
|
15947
|
+
var generateAttemptId = () => {
|
|
15948
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
15949
|
+
return crypto.randomUUID();
|
|
15950
|
+
}
|
|
15951
|
+
return `attempt-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
15952
|
+
};
|
|
15953
|
+
var createExecutionDebugStore = (initial) => {
|
|
15954
|
+
let attempts = [];
|
|
15955
|
+
let environment = buildEnvironment(initial);
|
|
15956
|
+
const findAttempt = (attemptId) => attempts.find((attempt) => attempt.attemptId === attemptId);
|
|
15957
|
+
const touch = (attempt) => {
|
|
15958
|
+
attempt.updatedAt = Date.now();
|
|
15959
|
+
};
|
|
15960
|
+
return {
|
|
15961
|
+
appendAttempt(input = {}) {
|
|
15962
|
+
var _a, _b;
|
|
15963
|
+
const now = Date.now();
|
|
15964
|
+
const attempt = {
|
|
15965
|
+
attemptId: (_a = input.attemptId) != null ? _a : generateAttemptId(),
|
|
15966
|
+
startedAt: now,
|
|
15967
|
+
updatedAt: now,
|
|
15968
|
+
status: (_b = input.status) != null ? _b : "quoting",
|
|
15969
|
+
quoteId: input.quoteId,
|
|
15970
|
+
orderId: input.orderId,
|
|
15971
|
+
orderIds: input.orderIds,
|
|
15972
|
+
quote: input.quote,
|
|
15973
|
+
selectedRoute: input.selectedRoute,
|
|
15974
|
+
bridge: input.bridge,
|
|
15975
|
+
venueExecution: input.venueExecution,
|
|
15976
|
+
rawEvents: [],
|
|
15977
|
+
normalizedSteps: [],
|
|
15978
|
+
errors: []
|
|
15979
|
+
};
|
|
15980
|
+
attempts = [...attempts, attempt];
|
|
15981
|
+
return attempt;
|
|
15982
|
+
},
|
|
15983
|
+
updateAttempt(attemptId, patch) {
|
|
15984
|
+
const attempt = findAttempt(attemptId);
|
|
15985
|
+
if (!attempt) return;
|
|
15986
|
+
if (patch.status !== void 0) attempt.status = patch.status;
|
|
15987
|
+
if (patch.quoteId !== void 0) attempt.quoteId = patch.quoteId;
|
|
15988
|
+
if (patch.orderId !== void 0) attempt.orderId = patch.orderId;
|
|
15989
|
+
if (patch.orderIds !== void 0) attempt.orderIds = patch.orderIds;
|
|
15990
|
+
if (patch.quote !== void 0) attempt.quote = patch.quote;
|
|
15991
|
+
if (patch.selectedRoute !== void 0) attempt.selectedRoute = patch.selectedRoute;
|
|
15992
|
+
if (patch.bridge !== void 0) attempt.bridge = patch.bridge;
|
|
15993
|
+
if (patch.venueExecution !== void 0) attempt.venueExecution = patch.venueExecution;
|
|
15994
|
+
if (patch.finalStatus !== void 0) attempt.finalStatus = patch.finalStatus;
|
|
15995
|
+
touch(attempt);
|
|
15996
|
+
},
|
|
15997
|
+
appendEvent(attemptId, event) {
|
|
15998
|
+
var _a;
|
|
15999
|
+
const attempt = findAttempt(attemptId);
|
|
16000
|
+
if (!attempt) return;
|
|
16001
|
+
attempt.rawEvents.push({
|
|
16002
|
+
kind: event.kind,
|
|
16003
|
+
label: event.label,
|
|
16004
|
+
data: event.data,
|
|
16005
|
+
timestamp: (_a = event.timestamp) != null ? _a : Date.now()
|
|
16006
|
+
});
|
|
16007
|
+
touch(attempt);
|
|
16008
|
+
},
|
|
16009
|
+
appendError(attemptId, error) {
|
|
16010
|
+
var _a;
|
|
16011
|
+
const attempt = findAttempt(attemptId);
|
|
16012
|
+
if (!attempt) return;
|
|
16013
|
+
attempt.errors.push({
|
|
16014
|
+
message: error.message,
|
|
16015
|
+
name: error.name,
|
|
16016
|
+
code: error.code,
|
|
16017
|
+
stack: error.stack,
|
|
16018
|
+
failedStep: error.failedStep,
|
|
16019
|
+
data: error.data,
|
|
16020
|
+
timestamp: (_a = error.timestamp) != null ? _a : Date.now()
|
|
16021
|
+
});
|
|
16022
|
+
touch(attempt);
|
|
16023
|
+
},
|
|
16024
|
+
setNormalizedSteps(attemptId, steps) {
|
|
16025
|
+
const attempt = findAttempt(attemptId);
|
|
16026
|
+
if (!attempt) return;
|
|
16027
|
+
attempt.normalizedSteps = steps;
|
|
16028
|
+
touch(attempt);
|
|
16029
|
+
},
|
|
16030
|
+
getSnapshot() {
|
|
16031
|
+
return {
|
|
16032
|
+
attempts: attempts.map((attempt) => __spreadProps(__spreadValues({}, attempt), {
|
|
16033
|
+
rawEvents: [...attempt.rawEvents],
|
|
16034
|
+
normalizedSteps: [...attempt.normalizedSteps],
|
|
16035
|
+
errors: [...attempt.errors]
|
|
16036
|
+
})),
|
|
16037
|
+
environment: cloneEnvironment(environment)
|
|
16038
|
+
};
|
|
16039
|
+
},
|
|
16040
|
+
getFailedAttempts() {
|
|
16041
|
+
return attempts.filter(
|
|
16042
|
+
(attempt) => attempt.status === "failed" || attempt.finalStatus === "failed" || attempt.errors.length > 0
|
|
16043
|
+
).map((attempt) => __spreadProps(__spreadValues({}, attempt), {
|
|
16044
|
+
rawEvents: [...attempt.rawEvents],
|
|
16045
|
+
normalizedSteps: [...attempt.normalizedSteps],
|
|
16046
|
+
errors: [...attempt.errors]
|
|
16047
|
+
}));
|
|
16048
|
+
},
|
|
16049
|
+
clear() {
|
|
16050
|
+
attempts = [];
|
|
16051
|
+
environment = buildEnvironment(initial);
|
|
16052
|
+
}
|
|
16053
|
+
};
|
|
16054
|
+
};
|
|
16055
|
+
var writeClipboardLegacy = (text) => {
|
|
16056
|
+
if (typeof document === "undefined") return false;
|
|
16057
|
+
const textarea = document.createElement("textarea");
|
|
16058
|
+
textarea.value = text;
|
|
16059
|
+
textarea.setAttribute("readonly", "");
|
|
16060
|
+
textarea.style.position = "fixed";
|
|
16061
|
+
textarea.style.top = "-1000px";
|
|
16062
|
+
textarea.style.opacity = "0";
|
|
16063
|
+
document.body.appendChild(textarea);
|
|
16064
|
+
try {
|
|
16065
|
+
textarea.select();
|
|
16066
|
+
return document.execCommand("copy");
|
|
16067
|
+
} catch (e) {
|
|
16068
|
+
return false;
|
|
16069
|
+
} finally {
|
|
16070
|
+
document.body.removeChild(textarea);
|
|
16071
|
+
}
|
|
16072
|
+
};
|
|
16073
|
+
var tryWriteClipboard = (text, consoleImpl) => __async(null, null, function* () {
|
|
16074
|
+
var _a;
|
|
16075
|
+
if (typeof navigator !== "undefined" && ((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
|
|
16076
|
+
try {
|
|
16077
|
+
yield navigator.clipboard.writeText(text);
|
|
16078
|
+
consoleImpl.info("[agg-execution-debug] Copied execution data to clipboard.");
|
|
16079
|
+
return;
|
|
16080
|
+
} catch (e) {
|
|
16081
|
+
}
|
|
16082
|
+
}
|
|
16083
|
+
if (writeClipboardLegacy(text)) {
|
|
16084
|
+
consoleImpl.info("[agg-execution-debug] Copied execution data to clipboard.");
|
|
16085
|
+
return;
|
|
16086
|
+
}
|
|
16087
|
+
consoleImpl.warn(
|
|
16088
|
+
"[agg-execution-debug] Clipboard copy was blocked by the browser. The JSON is logged below \u2014 right-click the entry and copy."
|
|
16089
|
+
);
|
|
16090
|
+
consoleImpl.log(text);
|
|
16091
|
+
});
|
|
16092
|
+
var installExecutionDebugWindow = ({
|
|
16093
|
+
store,
|
|
16094
|
+
consoleImpl
|
|
16095
|
+
}) => {
|
|
16096
|
+
if (typeof window === "undefined") return () => {
|
|
16097
|
+
};
|
|
16098
|
+
const targetConsole = consoleImpl != null ? consoleImpl : console;
|
|
16099
|
+
const previous = {
|
|
16100
|
+
executionData: window.executionData,
|
|
16101
|
+
getExecutionData: window.getExecutionData,
|
|
16102
|
+
getFailedExecutionData: window.getFailedExecutionData,
|
|
16103
|
+
clearExecutionData: window.clearExecutionData,
|
|
16104
|
+
storeRef: window.__aggExecutionDebugStore
|
|
16105
|
+
};
|
|
16106
|
+
const refresh = () => {
|
|
16107
|
+
window.executionData = sanitizeExecutionDebugValue(store.getSnapshot());
|
|
16108
|
+
};
|
|
16109
|
+
refresh();
|
|
16110
|
+
window.__aggExecutionDebugStore = store;
|
|
16111
|
+
window.getExecutionData = () => {
|
|
16112
|
+
const data = sanitizeExecutionDebugValue(store.getSnapshot());
|
|
16113
|
+
window.executionData = data;
|
|
16114
|
+
void tryWriteClipboard(JSON.stringify(data, null, 2), targetConsole);
|
|
16115
|
+
return data;
|
|
16116
|
+
};
|
|
16117
|
+
window.getFailedExecutionData = () => {
|
|
16118
|
+
const failed = sanitizeExecutionDebugValue({ attempts: store.getFailedAttempts() });
|
|
16119
|
+
void tryWriteClipboard(JSON.stringify(failed, null, 2), targetConsole);
|
|
16120
|
+
return failed;
|
|
16121
|
+
};
|
|
16122
|
+
window.clearExecutionData = () => {
|
|
16123
|
+
store.clear();
|
|
16124
|
+
refresh();
|
|
16125
|
+
};
|
|
16126
|
+
targetConsole.info(
|
|
16127
|
+
"AGG execution debug enabled. Run window.getFailedExecutionData() after a failed order to copy logs."
|
|
16128
|
+
);
|
|
16129
|
+
return () => {
|
|
16130
|
+
if (typeof window === "undefined") return;
|
|
16131
|
+
window.executionData = previous.executionData;
|
|
16132
|
+
window.getExecutionData = previous.getExecutionData;
|
|
16133
|
+
window.getFailedExecutionData = previous.getFailedExecutionData;
|
|
16134
|
+
window.clearExecutionData = previous.clearExecutionData;
|
|
16135
|
+
window.__aggExecutionDebugStore = previous.storeRef;
|
|
16136
|
+
};
|
|
16137
|
+
};
|
|
16138
|
+
var enableExecutionDebugInBrowser = (initial) => {
|
|
16139
|
+
if (typeof window === "undefined") return null;
|
|
16140
|
+
const existing = window.__aggExecutionDebugStore;
|
|
16141
|
+
if (existing) return existing;
|
|
16142
|
+
const store = createExecutionDebugStore(initial);
|
|
16143
|
+
installExecutionDebugWindow({ store });
|
|
16144
|
+
return store;
|
|
16145
|
+
};
|
|
16146
|
+
|
|
15667
16147
|
// src/trading/place-order/index.place-order.utils.ts
|
|
15668
16148
|
var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
|
|
15669
16149
|
minimumFractionDigits: 0,
|
|
@@ -16851,21 +17331,6 @@ PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
|
|
|
16851
17331
|
|
|
16852
17332
|
// src/trading/place-order/index.tsx
|
|
16853
17333
|
var import_jsx_runtime142 = require("react/jsx-runtime");
|
|
16854
|
-
var DEFAULT_STEP_LABELS = {
|
|
16855
|
-
"check-balance": "Checking balance",
|
|
16856
|
-
"check-position": "Checking position",
|
|
16857
|
-
"lane-bridge": "Bridging funds",
|
|
16858
|
-
bridge: "Bridging funds",
|
|
16859
|
-
"bridge-to-user": "Transferring to wallet",
|
|
16860
|
-
"sweep-bridge": "Completing bridge",
|
|
16861
|
-
"submit-order": "Submitting order",
|
|
16862
|
-
"order-bridge-execute": "Executing order",
|
|
16863
|
-
"transfer-to-user": "Transferring to wallet"
|
|
16864
|
-
};
|
|
16865
|
-
var getDefaultStepLabel = (stepType) => {
|
|
16866
|
-
var _a;
|
|
16867
|
-
return (_a = DEFAULT_STEP_LABELS[stepType]) != null ? _a : stepType.replace(/-/g, " ").replace(/^\w/, (c) => c.toUpperCase());
|
|
16868
|
-
};
|
|
16869
17334
|
var resolveRefetchedQuoteData = (result) => {
|
|
16870
17335
|
if (!result || typeof result !== "object" || !("data" in result)) return null;
|
|
16871
17336
|
const data = result.data;
|
|
@@ -17365,7 +17830,6 @@ var renderRouteCard = ({
|
|
|
17365
17830
|
}
|
|
17366
17831
|
);
|
|
17367
17832
|
};
|
|
17368
|
-
var normalizeOrderIdLabelInput2 = (orderId) => orderId.replace(/^#+/, "");
|
|
17369
17833
|
var renderSubmissionSurface = ({
|
|
17370
17834
|
actionLabel,
|
|
17371
17835
|
className,
|
|
@@ -17377,81 +17841,12 @@ var renderSubmissionSurface = ({
|
|
|
17377
17841
|
progressState,
|
|
17378
17842
|
tradingLabels
|
|
17379
17843
|
}) => {
|
|
17380
|
-
const
|
|
17381
|
-
|
|
17382
|
-
|
|
17383
|
-
|
|
17384
|
-
|
|
17385
|
-
|
|
17386
|
-
id: "finding-route",
|
|
17387
|
-
label: tradingLabels.findingBestRoute,
|
|
17388
|
-
status: "pending"
|
|
17389
|
-
}
|
|
17390
|
-
]
|
|
17391
|
-
];
|
|
17392
|
-
}
|
|
17393
|
-
const dag = progressState.dagProgress;
|
|
17394
|
-
if (dag && dag.totalSteps > 0) {
|
|
17395
|
-
const steps = [
|
|
17396
|
-
{
|
|
17397
|
-
id: "finding-route",
|
|
17398
|
-
label: tradingLabels.findingBestRoute,
|
|
17399
|
-
status: "complete"
|
|
17400
|
-
}
|
|
17401
|
-
];
|
|
17402
|
-
for (let i = 1; i <= dag.totalSteps; i++) {
|
|
17403
|
-
const isCompleted = dag.completedSequences.includes(i);
|
|
17404
|
-
const isCurrent = i === dag.currentSequence && !isCompleted;
|
|
17405
|
-
const stepType = (_a = dag.stepTypes[i]) != null ? _a : null;
|
|
17406
|
-
const stepLabel = stepType ? getDefaultStepLabel(stepType) : `Step ${i} of ${dag.totalSteps}`;
|
|
17407
|
-
const prev = steps[steps.length - 1];
|
|
17408
|
-
if (prev && prev.label === stepLabel) {
|
|
17409
|
-
if (prev.status === "complete" && !isCompleted) {
|
|
17410
|
-
prev.status = "pending";
|
|
17411
|
-
}
|
|
17412
|
-
continue;
|
|
17413
|
-
}
|
|
17414
|
-
steps.push({
|
|
17415
|
-
id: `dag-step-${i}`,
|
|
17416
|
-
label: stepLabel,
|
|
17417
|
-
status: isCompleted ? "complete" : isCurrent ? "pending" : "pending"
|
|
17418
|
-
});
|
|
17419
|
-
}
|
|
17420
|
-
return [steps];
|
|
17421
|
-
}
|
|
17422
|
-
const baseSteps = [
|
|
17423
|
-
{
|
|
17424
|
-
id: "finding-route",
|
|
17425
|
-
label: tradingLabels.findingBestRoute,
|
|
17426
|
-
status: "complete"
|
|
17427
|
-
},
|
|
17428
|
-
{
|
|
17429
|
-
id: "submitting-order",
|
|
17430
|
-
label: tradingLabels.submittingOrderProgress,
|
|
17431
|
-
status: "complete"
|
|
17432
|
-
}
|
|
17433
|
-
];
|
|
17434
|
-
const submittedOrderId = (_c = progressState.orderId) != null ? _c : (_b = progressState.orderIds) == null ? void 0 : _b[0];
|
|
17435
|
-
if (submittedOrderId) {
|
|
17436
|
-
baseSteps.push({
|
|
17437
|
-
id: "order-submitted",
|
|
17438
|
-
label: tradingLabels.orderSubmittedProgress(normalizeOrderIdLabelInput2(submittedOrderId)),
|
|
17439
|
-
status: "complete"
|
|
17440
|
-
});
|
|
17441
|
-
}
|
|
17442
|
-
return [
|
|
17443
|
-
baseSteps,
|
|
17444
|
-
[
|
|
17445
|
-
{
|
|
17446
|
-
id: "executing-order",
|
|
17447
|
-
label: tradingLabels.executingOnVenue(getTradingVenueLabel(progressState.executionVenue)),
|
|
17448
|
-
status: "pending",
|
|
17449
|
-
venue: progressState.executionVenue
|
|
17450
|
-
}
|
|
17451
|
-
]
|
|
17452
|
-
];
|
|
17453
|
-
};
|
|
17454
|
-
const stepGroups = resolveStepGroups();
|
|
17844
|
+
const displayRows = buildSubmissionDisplayRows({
|
|
17845
|
+
phase: progressState.phase,
|
|
17846
|
+
dagProgress: progressState.dagProgress,
|
|
17847
|
+
executionVenue: progressState.executionVenue,
|
|
17848
|
+
labels: tradingLabels
|
|
17849
|
+
});
|
|
17455
17850
|
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
17456
17851
|
Card,
|
|
17457
17852
|
{
|
|
@@ -17473,51 +17868,50 @@ var renderSubmissionSurface = ({
|
|
|
17473
17868
|
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)(LoadingGlyph, { enableAnimations, className: "h-4 w-4 text-current" }),
|
|
17474
17869
|
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)("span", { children: actionLabel })
|
|
17475
17870
|
] }),
|
|
17476
|
-
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
17477
|
-
|
|
17478
|
-
|
|
17479
|
-
|
|
17480
|
-
|
|
17481
|
-
|
|
17482
|
-
|
|
17483
|
-
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
|
|
17487
|
-
|
|
17488
|
-
|
|
17489
|
-
|
|
17490
|
-
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
|
|
17494
|
-
|
|
17495
|
-
|
|
17496
|
-
|
|
17497
|
-
|
|
17498
|
-
|
|
17499
|
-
|
|
17500
|
-
|
|
17501
|
-
|
|
17502
|
-
|
|
17503
|
-
|
|
17504
|
-
|
|
17505
|
-
|
|
17506
|
-
|
|
17507
|
-
|
|
17508
|
-
|
|
17509
|
-
|
|
17510
|
-
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
|
|
17514
|
-
|
|
17515
|
-
|
|
17516
|
-
|
|
17517
|
-
}
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
}) })
|
|
17871
|
+
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
17872
|
+
"div",
|
|
17873
|
+
{
|
|
17874
|
+
className: "agg-order-submission-steps agg-order-submission-group flex flex-col gap-2",
|
|
17875
|
+
"data-testid": "agg-order-submission-steps",
|
|
17876
|
+
children: displayRows.map((step) => {
|
|
17877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
|
|
17878
|
+
"div",
|
|
17879
|
+
{
|
|
17880
|
+
className: "agg-order-submission-step flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
|
|
17881
|
+
"data-status": step.status,
|
|
17882
|
+
children: [
|
|
17883
|
+
step.status === "complete" ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
17884
|
+
Icon,
|
|
17885
|
+
{
|
|
17886
|
+
name: "check-circle",
|
|
17887
|
+
size: "small",
|
|
17888
|
+
className: "h-3 w-3 shrink-0 text-agg-primary",
|
|
17889
|
+
"aria-hidden": "true"
|
|
17890
|
+
}
|
|
17891
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
17892
|
+
LoadingGlyph,
|
|
17893
|
+
{
|
|
17894
|
+
enableAnimations,
|
|
17895
|
+
className: "h-3 w-3 shrink-0 text-agg-primary"
|
|
17896
|
+
}
|
|
17897
|
+
),
|
|
17898
|
+
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)("p", { className: "min-w-0 flex-1", children: step.label }),
|
|
17899
|
+
step.venue ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
17900
|
+
VenueLogo,
|
|
17901
|
+
{
|
|
17902
|
+
venue: step.venue,
|
|
17903
|
+
size: "small",
|
|
17904
|
+
ariaLabel: getTradingVenueLabel(step.venue),
|
|
17905
|
+
className: "h-4 w-4"
|
|
17906
|
+
}
|
|
17907
|
+
) : null
|
|
17908
|
+
]
|
|
17909
|
+
},
|
|
17910
|
+
step.id
|
|
17911
|
+
);
|
|
17912
|
+
})
|
|
17913
|
+
}
|
|
17914
|
+
)
|
|
17521
17915
|
] })
|
|
17522
17916
|
] })
|
|
17523
17917
|
}
|
|
@@ -17653,6 +18047,7 @@ var PlaceOrder = ({
|
|
|
17653
18047
|
}) => {
|
|
17654
18048
|
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;
|
|
17655
18049
|
const {
|
|
18050
|
+
enableDebug: isExecutionDebugEnabled,
|
|
17656
18051
|
features: { enableAnimations, showFeesBreakdown },
|
|
17657
18052
|
general: { locale }
|
|
17658
18053
|
} = (0, import_hooks53.useSdkUiConfig)();
|
|
@@ -17749,6 +18144,27 @@ var PlaceOrder = ({
|
|
|
17749
18144
|
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0, import_react31.useState)(false);
|
|
17750
18145
|
const [submissionFeedback, setSubmissionFeedback] = (0, import_react31.useState)(null);
|
|
17751
18146
|
const [submissionProgressState, setSubmissionProgressState] = (0, import_react31.useState)(null);
|
|
18147
|
+
const executionDebugStoreRef = (0, import_react31.useRef)(null);
|
|
18148
|
+
const executionDebugAttemptIdRef = (0, import_react31.useRef)(null);
|
|
18149
|
+
(0, import_react31.useEffect)(() => {
|
|
18150
|
+
if (!isExecutionDebugEnabled) {
|
|
18151
|
+
executionDebugStoreRef.current = null;
|
|
18152
|
+
return;
|
|
18153
|
+
}
|
|
18154
|
+
executionDebugStoreRef.current = enableExecutionDebugInBrowser();
|
|
18155
|
+
}, [isExecutionDebugEnabled]);
|
|
18156
|
+
(0, import_react31.useEffect)(() => {
|
|
18157
|
+
if (!isExecutionDebugEnabled) return;
|
|
18158
|
+
const store = executionDebugStoreRef.current;
|
|
18159
|
+
if (!store) return;
|
|
18160
|
+
store.clear();
|
|
18161
|
+
executionDebugAttemptIdRef.current = null;
|
|
18162
|
+
}, [
|
|
18163
|
+
isExecutionDebugEnabled,
|
|
18164
|
+
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id,
|
|
18165
|
+
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
18166
|
+
scopedSelectedOutcomeId
|
|
18167
|
+
]);
|
|
17752
18168
|
const debouncedAmount = (0, import_hooks53.useDebouncedValue)(internalAmount, 300);
|
|
17753
18169
|
const isSell = (0, import_react31.useMemo)(() => internalTab === "sell", [internalTab]);
|
|
17754
18170
|
const {
|
|
@@ -18008,8 +18424,39 @@ var PlaceOrder = ({
|
|
|
18008
18424
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
18009
18425
|
]);
|
|
18010
18426
|
(0, import_react31.useEffect)(() => {
|
|
18427
|
+
var _a2, _b2;
|
|
18011
18428
|
const dp = executionProgress.dagProgress;
|
|
18012
18429
|
if (!dp) return;
|
|
18430
|
+
const debugStore = executionDebugStoreRef.current;
|
|
18431
|
+
const debugAttemptId = executionDebugAttemptIdRef.current;
|
|
18432
|
+
if (debugStore && debugAttemptId) {
|
|
18433
|
+
debugStore.appendEvent(debugAttemptId, {
|
|
18434
|
+
kind: "ws_update",
|
|
18435
|
+
label: "dag_progress",
|
|
18436
|
+
data: dp
|
|
18437
|
+
});
|
|
18438
|
+
const normalizedRows = buildSubmissionDisplayRows({
|
|
18439
|
+
phase: "executing",
|
|
18440
|
+
dagProgress: dp,
|
|
18441
|
+
labels: tradingLabels
|
|
18442
|
+
});
|
|
18443
|
+
debugStore.setNormalizedSteps(debugAttemptId, normalizedRows);
|
|
18444
|
+
debugStore.appendEvent(debugAttemptId, {
|
|
18445
|
+
kind: "normalized_steps",
|
|
18446
|
+
data: normalizedRows
|
|
18447
|
+
});
|
|
18448
|
+
if (dp.status === "failed") {
|
|
18449
|
+
debugStore.appendError(debugAttemptId, {
|
|
18450
|
+
message: (_a2 = dp.errorReason) != null ? _a2 : "DAG execution failed",
|
|
18451
|
+
failedStep: (_b2 = dp.currentStepType) != null ? _b2 : void 0,
|
|
18452
|
+
data: { currentSequence: dp.currentSequence, totalSteps: dp.totalSteps }
|
|
18453
|
+
});
|
|
18454
|
+
debugStore.updateAttempt(debugAttemptId, {
|
|
18455
|
+
status: "failed",
|
|
18456
|
+
finalStatus: "failed"
|
|
18457
|
+
});
|
|
18458
|
+
}
|
|
18459
|
+
}
|
|
18013
18460
|
setSubmissionProgressState((prev) => {
|
|
18014
18461
|
if (!prev) return prev;
|
|
18015
18462
|
if (dp.status === "failed") {
|
|
@@ -18025,7 +18472,7 @@ var PlaceOrder = ({
|
|
|
18025
18472
|
}
|
|
18026
18473
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
18027
18474
|
});
|
|
18028
|
-
}, [executionProgress.dagProgress, tradingLabels
|
|
18475
|
+
}, [executionProgress.dagProgress, tradingLabels]);
|
|
18029
18476
|
(0, import_react31.useEffect)(() => {
|
|
18030
18477
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
18031
18478
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
@@ -18033,6 +18480,17 @@ var PlaceOrder = ({
|
|
|
18033
18480
|
orderIds,
|
|
18034
18481
|
executionProgress.terminalOrderEvents
|
|
18035
18482
|
);
|
|
18483
|
+
const debugStore = executionDebugStoreRef.current;
|
|
18484
|
+
const debugAttemptId = executionDebugAttemptIdRef.current;
|
|
18485
|
+
if (debugStore && debugAttemptId && executionProgress.terminalOrderEvents.length > 0) {
|
|
18486
|
+
debugStore.appendEvent(debugAttemptId, {
|
|
18487
|
+
kind: "terminal_event",
|
|
18488
|
+
data: {
|
|
18489
|
+
aggregateStatus,
|
|
18490
|
+
events: executionProgress.terminalOrderEvents
|
|
18491
|
+
}
|
|
18492
|
+
});
|
|
18493
|
+
}
|
|
18036
18494
|
if (aggregateStatus === "pending") return;
|
|
18037
18495
|
setSubmissionProgressState((prev) => {
|
|
18038
18496
|
var _a2, _b2, _c2;
|
|
@@ -18075,14 +18533,45 @@ var PlaceOrder = ({
|
|
|
18075
18533
|
tradingLabels.orderFailed
|
|
18076
18534
|
]);
|
|
18077
18535
|
(0, import_react31.useEffect)(() => {
|
|
18536
|
+
var _a2, _b2;
|
|
18078
18537
|
if (!submissionProgressState) return;
|
|
18079
18538
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
18539
|
+
const debugStore = executionDebugStoreRef.current;
|
|
18540
|
+
const debugAttemptId = executionDebugAttemptIdRef.current;
|
|
18541
|
+
if (debugStore && debugAttemptId) {
|
|
18542
|
+
debugStore.appendEvent(debugAttemptId, {
|
|
18543
|
+
kind: "state_change",
|
|
18544
|
+
label: submissionProgressState.phase,
|
|
18545
|
+
data: {
|
|
18546
|
+
phase: submissionProgressState.phase,
|
|
18547
|
+
executionVenue: submissionProgressState.executionVenue,
|
|
18548
|
+
orderIds: submissionProgressState.orderIds,
|
|
18549
|
+
errorMessage: submissionProgressState.errorMessage
|
|
18550
|
+
}
|
|
18551
|
+
});
|
|
18552
|
+
}
|
|
18080
18553
|
if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
|
|
18081
18554
|
(0, import_hooks53.invalidateBalanceQueries)(queryClient);
|
|
18082
18555
|
(0, import_hooks53.invalidatePositionQueries)(queryClient);
|
|
18556
|
+
if (debugStore && debugAttemptId) {
|
|
18557
|
+
debugStore.updateAttempt(debugAttemptId, {
|
|
18558
|
+
status: "succeeded",
|
|
18559
|
+
finalStatus: "succeeded"
|
|
18560
|
+
});
|
|
18561
|
+
}
|
|
18083
18562
|
onSuccess == null ? void 0 : onSuccess(submissionProgressState.summary);
|
|
18084
18563
|
}
|
|
18085
18564
|
if (submissionProgressState.phase === "failed" && submissionProgressState.errorMessage) {
|
|
18565
|
+
if (debugStore && debugAttemptId) {
|
|
18566
|
+
debugStore.appendError(debugAttemptId, {
|
|
18567
|
+
message: submissionProgressState.errorMessage,
|
|
18568
|
+
failedStep: (_b2 = (_a2 = submissionProgressState.dagProgress) == null ? void 0 : _a2.currentStepType) != null ? _b2 : void 0
|
|
18569
|
+
});
|
|
18570
|
+
debugStore.updateAttempt(debugAttemptId, {
|
|
18571
|
+
status: "failed",
|
|
18572
|
+
finalStatus: "failed"
|
|
18573
|
+
});
|
|
18574
|
+
}
|
|
18086
18575
|
onError == null ? void 0 : onError(new Error(submissionProgressState.errorMessage));
|
|
18087
18576
|
}
|
|
18088
18577
|
}, [submissionProgressState, onExecutionStateChange, onSuccess, onError, queryClient]);
|
|
@@ -18256,23 +18745,91 @@ var PlaceOrder = ({
|
|
|
18256
18745
|
};
|
|
18257
18746
|
const handleExecuteQuote = (0, import_react31.useCallback)(
|
|
18258
18747
|
(quoteData) => __async(null, null, function* () {
|
|
18748
|
+
var _a2, _b2, _c2;
|
|
18259
18749
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
18260
18750
|
if (!quoteId) {
|
|
18261
18751
|
throw new Error(tradingLabels.quoteUnavailable);
|
|
18262
18752
|
}
|
|
18753
|
+
const debugStore = executionDebugStoreRef.current;
|
|
18754
|
+
const venues = (_b2 = (_a2 = quoteData == null ? void 0 : quoteData.fills) == null ? void 0 : _a2.map((fill) => fill.venue).filter(Boolean)) != null ? _b2 : [];
|
|
18755
|
+
const debugAttempt = debugStore == null ? void 0 : debugStore.appendAttempt({
|
|
18756
|
+
status: "executing",
|
|
18757
|
+
quoteId,
|
|
18758
|
+
quote: {
|
|
18759
|
+
request: {
|
|
18760
|
+
venueMarketOutcomeId: scopedSelectedOutcomeId,
|
|
18761
|
+
amount: internalAmount,
|
|
18762
|
+
slippage: internalSlippage,
|
|
18763
|
+
tradeSide: isSell ? "sell" : "buy"
|
|
18764
|
+
},
|
|
18765
|
+
response: smartRoute.data,
|
|
18766
|
+
selectedRoute: quoteData,
|
|
18767
|
+
side: isSell ? "sell" : "buy",
|
|
18768
|
+
marketId: scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
18769
|
+
eventId: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id,
|
|
18770
|
+
outcomeId: scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : void 0,
|
|
18771
|
+
venues,
|
|
18772
|
+
capturedAt: Date.now()
|
|
18773
|
+
},
|
|
18774
|
+
selectedRoute: quoteData
|
|
18775
|
+
});
|
|
18776
|
+
executionDebugAttemptIdRef.current = (_c2 = debugAttempt == null ? void 0 : debugAttempt.attemptId) != null ? _c2 : null;
|
|
18263
18777
|
if (onPrimaryAction) {
|
|
18778
|
+
debugStore == null ? void 0 : debugStore.appendEvent(debugAttempt.attemptId, {
|
|
18779
|
+
kind: "execute_request",
|
|
18780
|
+
label: "delegated_to_partner",
|
|
18781
|
+
data: { quoteId }
|
|
18782
|
+
});
|
|
18264
18783
|
onPrimaryAction({ quoteId });
|
|
18265
18784
|
return;
|
|
18266
18785
|
}
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18786
|
+
try {
|
|
18787
|
+
const response = yield executeManaged.mutateAsync({ quoteId });
|
|
18788
|
+
if (debugAttempt) {
|
|
18789
|
+
debugStore == null ? void 0 : debugStore.appendEvent(debugAttempt.attemptId, {
|
|
18790
|
+
kind: "execute_response",
|
|
18791
|
+
data: { orderIds: response.orderIds }
|
|
18792
|
+
});
|
|
18793
|
+
debugStore == null ? void 0 : debugStore.updateAttempt(debugAttempt.attemptId, {
|
|
18794
|
+
orderId: response.orderIds[0],
|
|
18795
|
+
orderIds: response.orderIds
|
|
18796
|
+
});
|
|
18797
|
+
}
|
|
18798
|
+
setSubmissionProgressState({
|
|
18799
|
+
executionVenue: resolveExecutionVenueFromQuote(quoteData),
|
|
18800
|
+
orderId: response.orderIds[0],
|
|
18801
|
+
orderIds: response.orderIds,
|
|
18802
|
+
phase: "submitting"
|
|
18803
|
+
});
|
|
18804
|
+
} catch (error) {
|
|
18805
|
+
if (debugAttempt) {
|
|
18806
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
18807
|
+
debugStore == null ? void 0 : debugStore.appendError(debugAttempt.attemptId, {
|
|
18808
|
+
message: err.message,
|
|
18809
|
+
name: err.name,
|
|
18810
|
+
stack: err.stack,
|
|
18811
|
+
failedStep: "execute_request"
|
|
18812
|
+
});
|
|
18813
|
+
debugStore == null ? void 0 : debugStore.updateAttempt(debugAttempt.attemptId, {
|
|
18814
|
+
status: "failed",
|
|
18815
|
+
finalStatus: "failed"
|
|
18816
|
+
});
|
|
18817
|
+
}
|
|
18818
|
+
throw error;
|
|
18819
|
+
}
|
|
18274
18820
|
}),
|
|
18275
|
-
[
|
|
18821
|
+
[
|
|
18822
|
+
executeManaged,
|
|
18823
|
+
internalAmount,
|
|
18824
|
+
internalSlippage,
|
|
18825
|
+
isSell,
|
|
18826
|
+
onPrimaryAction,
|
|
18827
|
+
scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id,
|
|
18828
|
+
scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
|
|
18829
|
+
scopedSelectedOutcomeId,
|
|
18830
|
+
smartRoute.data,
|
|
18831
|
+
tradingLabels.quoteUnavailable
|
|
18832
|
+
]
|
|
18276
18833
|
);
|
|
18277
18834
|
const handleSkipToSuccess = (0, import_react31.useCallback)(() => {
|
|
18278
18835
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
@@ -19487,7 +20044,7 @@ var HomeSearchResults = ({
|
|
|
19487
20044
|
const eventListTabs = useEventListTabs();
|
|
19488
20045
|
const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
|
|
19489
20046
|
const visibleVenues = (0, import_react35.useMemo)(
|
|
19490
|
-
() => disabledVenues.length === 0 ? void 0 :
|
|
20047
|
+
() => disabledVenues.length === 0 ? void 0 : import_sdk18.VENUES.filter(
|
|
19491
20048
|
(v) => !disabledVenues.includes(v)
|
|
19492
20049
|
),
|
|
19493
20050
|
[disabledVenues]
|
|
@@ -19921,7 +20478,7 @@ HomePage.displayName = "HomePage";
|
|
|
19921
20478
|
|
|
19922
20479
|
// src/pages/user-profile/index.tsx
|
|
19923
20480
|
var import_hooks59 = require("@agg-build/hooks");
|
|
19924
|
-
var
|
|
20481
|
+
var import_sdk19 = require("@agg-build/sdk");
|
|
19925
20482
|
var import_react37 = require("react");
|
|
19926
20483
|
|
|
19927
20484
|
// src/pages/user-profile/chain-display.ts
|
|
@@ -20661,7 +21218,7 @@ var toneTextClassName = (tone) => {
|
|
|
20661
21218
|
if (tone === "negative") return "text-agg-error";
|
|
20662
21219
|
return "text-agg-muted-foreground";
|
|
20663
21220
|
};
|
|
20664
|
-
var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "agg-position-outcome inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label2 }) });
|
|
21221
|
+
var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "agg-position-outcome max-w-[120px] inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label2 }) });
|
|
20665
21222
|
var VenueShares = ({
|
|
20666
21223
|
model,
|
|
20667
21224
|
className,
|
|
@@ -20695,7 +21252,7 @@ var StatusBadge = ({
|
|
|
20695
21252
|
isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-foreground"
|
|
20696
21253
|
),
|
|
20697
21254
|
children: [
|
|
20698
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5" }),
|
|
21255
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5!" }),
|
|
20699
21256
|
isWon ? labels.won : labels.open
|
|
20700
21257
|
]
|
|
20701
21258
|
}
|
|
@@ -20735,7 +21292,7 @@ var TotalTradedCell = ({
|
|
|
20735
21292
|
className
|
|
20736
21293
|
}) => /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: cn("flex flex-col gap-[2px] whitespace-nowrap", className), children: [
|
|
20737
21294
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
|
|
20738
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-
|
|
21295
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
|
|
20739
21296
|
] });
|
|
20740
21297
|
var PositionValueCell = ({
|
|
20741
21298
|
value,
|
|
@@ -20844,7 +21401,7 @@ var PositionRow = ({
|
|
|
20844
21401
|
{
|
|
20845
21402
|
model,
|
|
20846
21403
|
keyPrefix: "desktop",
|
|
20847
|
-
className: "agg-position-venues flex
|
|
21404
|
+
className: "agg-position-venues flex flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2"
|
|
20848
21405
|
}
|
|
20849
21406
|
)
|
|
20850
21407
|
] })
|
|
@@ -20871,12 +21428,12 @@ var PositionRow = ({
|
|
|
20871
21428
|
"button",
|
|
20872
21429
|
{
|
|
20873
21430
|
type: "button",
|
|
20874
|
-
className: "ml-auto inline-flex h-8 items-center justify-center gap-1 rounded-agg-full px-2 font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-
|
|
21431
|
+
className: "ml-auto inline-flex h-8 cursor-pointer items-center justify-center gap-1 rounded-agg-full px-2 font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-primary hover:text-agg-primary-hover disabled:cursor-not-allowed disabled:opacity-60",
|
|
20875
21432
|
onClick: handleClaim,
|
|
20876
21433
|
disabled: isClaiming,
|
|
20877
21434
|
"aria-busy": isClaiming || void 0,
|
|
20878
21435
|
children: [
|
|
20879
|
-
isClaiming ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(LoadingIcon, { size: "small", className: "text-agg-
|
|
21436
|
+
isClaiming ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
20880
21437
|
labels.claim
|
|
20881
21438
|
]
|
|
20882
21439
|
}
|
|
@@ -20904,13 +21461,13 @@ var PositionRow = ({
|
|
|
20904
21461
|
className: "hidden w-[160px] shrink-0 md:flex"
|
|
20905
21462
|
}
|
|
20906
21463
|
),
|
|
20907
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "hidden w-[100px] shrink-0 items-center gap-
|
|
21464
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
|
|
20908
21465
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(StatusBadge, { status: model.positionStatus, labels }),
|
|
20909
21466
|
model.canClaim ? /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
20910
21467
|
"button",
|
|
20911
21468
|
{
|
|
20912
21469
|
type: "button",
|
|
20913
|
-
className: "inline-flex h-6 items-center justify-center gap-1 rounded-agg-full font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-primary disabled:cursor-not-allowed disabled:opacity-60",
|
|
21470
|
+
className: "inline-flex h-6 cursor-pointer items-center justify-center gap-1 rounded-agg-full font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-primary hover:text-agg-primary-hover disabled:cursor-not-allowed disabled:opacity-60",
|
|
20914
21471
|
onClick: handleClaim,
|
|
20915
21472
|
disabled: isClaiming,
|
|
20916
21473
|
"aria-busy": isClaiming || void 0,
|
|
@@ -21541,6 +22098,7 @@ var UserInfoCard = ({
|
|
|
21541
22098
|
content: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
21542
22099
|
size: "small",
|
|
21543
22100
|
side: "bottom",
|
|
22101
|
+
sideOffset: 4,
|
|
21544
22102
|
children
|
|
21545
22103
|
}
|
|
21546
22104
|
),
|
|
@@ -21862,10 +22420,10 @@ var toTokenAmountLabel = ({
|
|
|
21862
22420
|
return `${prefix}${formatTokenAmountTwoDecimals(amountRaw, tokenSymbol, chainId)} ${tokenSymbol}`;
|
|
21863
22421
|
};
|
|
21864
22422
|
var POSITION_ROW_VENUE_ORDER = [
|
|
21865
|
-
|
|
21866
|
-
|
|
21867
|
-
|
|
21868
|
-
|
|
22423
|
+
import_sdk19.Venue.polymarket,
|
|
22424
|
+
import_sdk19.Venue.kalshi,
|
|
22425
|
+
import_sdk19.Venue.opinion,
|
|
22426
|
+
import_sdk19.Venue.limitless
|
|
21869
22427
|
];
|
|
21870
22428
|
function venueBreakdownSortKey(venue) {
|
|
21871
22429
|
const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
|
|
@@ -22021,6 +22579,8 @@ var UserProfilePage = ({
|
|
|
22021
22579
|
try {
|
|
22022
22580
|
yield redeemMutation.mutateAsync({ venueMarketOutcomeIds });
|
|
22023
22581
|
yield queryClient.invalidateQueries({ queryKey: ["current-user"] });
|
|
22582
|
+
} catch (err) {
|
|
22583
|
+
console.error("[UserProfilePage] redeem failed", err);
|
|
22024
22584
|
} finally {
|
|
22025
22585
|
setInternalClaimingIds((prev) => {
|
|
22026
22586
|
const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
|
|
@@ -22403,7 +22963,10 @@ var UserProfilePage = ({
|
|
|
22403
22963
|
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
|
|
22404
22964
|
"div",
|
|
22405
22965
|
{
|
|
22406
|
-
className: cn(
|
|
22966
|
+
className: cn(
|
|
22967
|
+
"agg-profile-side-panels flex flex-col-reverse md:flex-col gap-4",
|
|
22968
|
+
classNames == null ? void 0 : classNames.rightColumn
|
|
22969
|
+
),
|
|
22407
22970
|
children: [
|
|
22408
22971
|
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(PositionsValueCard, { valueLabel: positionsValueLabel }),
|
|
22409
22972
|
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
@@ -24694,7 +25257,7 @@ var import_hooks78 = require("@agg-build/hooks");
|
|
|
24694
25257
|
var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
|
|
24695
25258
|
|
|
24696
25259
|
// src/onboarding/onboarding-modal.constants.ts
|
|
24697
|
-
var
|
|
25260
|
+
var import_sdk20 = require("@agg-build/sdk");
|
|
24698
25261
|
var HOW_IT_WORKS_FEATURE_KEYS = [
|
|
24699
25262
|
"createAccount",
|
|
24700
25263
|
"linkAccounts",
|
|
@@ -24706,7 +25269,7 @@ var ONBOARDING_STEPS = {
|
|
|
24706
25269
|
PROFILE_SETUP: 1,
|
|
24707
25270
|
CONNECT_ACCOUNTS: 2
|
|
24708
25271
|
};
|
|
24709
|
-
var ONCHAIN_VENUES = [
|
|
25272
|
+
var ONCHAIN_VENUES = [import_sdk20.Venue.polymarket, import_sdk20.Venue.opinion, import_sdk20.Venue.predict];
|
|
24710
25273
|
|
|
24711
25274
|
// src/onboarding/steps/how-it-works.tsx
|
|
24712
25275
|
var import_react43 = require("react");
|
|
@@ -24926,7 +25489,7 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
24926
25489
|
ProfileSetupStep.displayName = "ProfileSetupStep";
|
|
24927
25490
|
|
|
24928
25491
|
// src/onboarding/steps/connect-accounts.tsx
|
|
24929
|
-
var
|
|
25492
|
+
var import_sdk21 = require("@agg-build/sdk");
|
|
24930
25493
|
var import_hooks75 = require("@agg-build/hooks");
|
|
24931
25494
|
var import_jsx_runtime170 = require("react/jsx-runtime");
|
|
24932
25495
|
var OnchainVenueLogos = () => {
|
|
@@ -25027,7 +25590,7 @@ var ConnectAccountsStep = ({
|
|
|
25027
25590
|
logos: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("div", { className: "sm:flex sm:w-14 sm:items-center sm:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
25028
25591
|
VenueLogo,
|
|
25029
25592
|
{
|
|
25030
|
-
venue:
|
|
25593
|
+
venue: import_sdk21.Venue.kalshi,
|
|
25031
25594
|
variant: "logo",
|
|
25032
25595
|
size: "large",
|
|
25033
25596
|
className: "h-6 w-6 sm:h-9 sm:w-9"
|
|
@@ -25058,7 +25621,7 @@ var ConnectAccountsStep = ({
|
|
|
25058
25621
|
ConnectAccountsStep.displayName = "ConnectAccountsStep";
|
|
25059
25622
|
|
|
25060
25623
|
// src/onboarding/steps/connect-kalshi-modal.tsx
|
|
25061
|
-
var
|
|
25624
|
+
var import_sdk22 = require("@agg-build/sdk");
|
|
25062
25625
|
var import_react45 = require("react");
|
|
25063
25626
|
var import_hooks76 = require("@agg-build/hooks");
|
|
25064
25627
|
var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
|
|
@@ -25141,7 +25704,7 @@ var ConnectKalshiModal = ({
|
|
|
25141
25704
|
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
25142
25705
|
VenueLogo,
|
|
25143
25706
|
{
|
|
25144
|
-
venue:
|
|
25707
|
+
venue: import_sdk22.Venue.kalshi,
|
|
25145
25708
|
variant: "logo",
|
|
25146
25709
|
size: "large",
|
|
25147
25710
|
className: "h-[60px] w-[60px]"
|
|
@@ -25526,7 +26089,7 @@ var OnboardingModal = ({
|
|
|
25526
26089
|
OnboardingModal.displayName = "OnboardingModal";
|
|
25527
26090
|
|
|
25528
26091
|
// src/profile/index.tsx
|
|
25529
|
-
var
|
|
26092
|
+
var import_sdk23 = require("@agg-build/sdk");
|
|
25530
26093
|
var import_react50 = require("react");
|
|
25531
26094
|
var import_hooks81 = require("@agg-build/hooks");
|
|
25532
26095
|
|
|
@@ -25876,7 +26439,7 @@ AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
|
25876
26439
|
|
|
25877
26440
|
// src/profile/index.tsx
|
|
25878
26441
|
var import_jsx_runtime176 = require("react/jsx-runtime");
|
|
25879
|
-
var EVM_WALLET_VENUES = [
|
|
26442
|
+
var EVM_WALLET_VENUES = [import_sdk23.Venue.polymarket, import_sdk23.Venue.predict, import_sdk23.Venue.opinion];
|
|
25880
26443
|
var ProfileModal = ({
|
|
25881
26444
|
open,
|
|
25882
26445
|
onOpenChange,
|
|
@@ -26358,7 +26921,14 @@ var GeoBlockModal = ({
|
|
|
26358
26921
|
maxWidth: "480px",
|
|
26359
26922
|
classNames: { container: cn("!rounded-agg-2xl", classNames == null ? void 0 : classNames.container) },
|
|
26360
26923
|
children: [
|
|
26361
|
-
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
26924
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
26925
|
+
Modal.Header,
|
|
26926
|
+
{
|
|
26927
|
+
title: "",
|
|
26928
|
+
hideBorder: true,
|
|
26929
|
+
classNames: { root: "min-h-0", container: "px-8 pt-6! pb-0!" }
|
|
26930
|
+
}
|
|
26931
|
+
),
|
|
26362
26932
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Modal.Body, { classNames: { root: cn("!px-10 !pb-12 !pt-0", classNames == null ? void 0 : classNames.body) }, children: /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
|
|
26363
26933
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
26364
26934
|
Icon,
|