@agg-build/ui 2.1.0 → 2.1.2
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-C5M2OOM3.mjs → chunk-5RBHMMY3.mjs} +1 -1
- package/dist/{chunk-YMVD6Q2A.mjs → chunk-75AMJAWR.mjs} +1 -1
- package/dist/{chunk-Y6PVXAUQ.mjs → chunk-7ZR5JYB3.mjs} +423 -488
- package/dist/{chunk-R6FBYAY5.mjs → chunk-JJDYOBVG.mjs} +117 -48
- package/dist/{chunk-3OI2ZLLT.mjs → chunk-NRNBJPYK.mjs} +1 -1
- package/dist/{chunk-DXF2LMNN.mjs → chunk-TBD3N4T4.mjs} +849 -759
- package/dist/{chunk-YAEA6EDG.mjs → chunk-ZOECARZW.mjs} +364 -17
- package/dist/events.js +1115 -972
- package/dist/events.mjs +3 -3
- package/dist/index.js +3705 -3278
- package/dist/index.mjs +16 -8
- package/dist/modals.js +851 -824
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +2778 -2357
- package/dist/pages.mjs +8 -6
- package/dist/primitives.js +849 -759
- package/dist/primitives.mjs +3 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +970 -599
- package/dist/trading.mjs +10 -6
- package/dist/types/events/shared/format-event-title.d.mts +25 -0
- package/dist/types/events/shared/format-event-title.d.ts +25 -0
- package/dist/types/events/shared/select-best-outcome.d.mts +88 -0
- package/dist/types/events/shared/select-best-outcome.d.ts +88 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +7 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +7 -0
- package/dist/types/pages/user-profile/index.d.mts +1 -0
- package/dist/types/pages/user-profile/index.d.ts +1 -0
- package/dist/types/pages/user-profile/transaction-explorer.d.mts +1 -0
- package/dist/types/pages/user-profile/transaction-explorer.d.ts +1 -0
- package/dist/types/pages/user-profile/user-profile.types.d.mts +8 -2
- package/dist/types/pages/user-profile/user-profile.types.d.ts +8 -2
- package/dist/types/primitives/icon/index.d.mts +2 -1
- package/dist/types/primitives/icon/index.d.ts +2 -1
- package/dist/types/primitives/icon/registry.d.mts +4 -0
- package/dist/types/primitives/icon/registry.d.ts +4 -0
- package/dist/types/primitives/icon/svg/paper-mode.d.mts +5 -0
- package/dist/types/primitives/icon/svg/paper-mode.d.ts +5 -0
- package/dist/types/primitives/search/search.utils.d.mts +3 -1
- package/dist/types/primitives/search/search.utils.d.ts +3 -1
- package/dist/types/trading/index.d.mts +2 -0
- package/dist/types/trading/index.d.ts +2 -0
- package/dist/types/trading/place-order/index.d.mts +1 -1
- package/dist/types/trading/place-order/index.d.ts +1 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +23 -1
- package/dist/types/trading/place-order/index.place-order.types.d.ts +23 -1
- package/dist/types/trading/use-claim-winnings.d.mts +84 -0
- package/dist/types/trading/use-claim-winnings.d.ts +84 -0
- package/dist/types/trading/use-resolved-market-claim.d.mts +26 -0
- package/dist/types/trading/use-resolved-market-claim.d.ts +26 -0
- package/package.json +3 -3
|
@@ -10,13 +10,15 @@ import {
|
|
|
10
10
|
isErrorWithStatus,
|
|
11
11
|
useEventListTabs,
|
|
12
12
|
useEventListTabsHeaderOverflow
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JJDYOBVG.mjs";
|
|
14
14
|
import {
|
|
15
15
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
16
16
|
PlaceOrder,
|
|
17
17
|
SettlementDetails,
|
|
18
|
-
WITHDRAW_MODAL_OPEN_EVENT
|
|
19
|
-
|
|
18
|
+
WITHDRAW_MODAL_OPEN_EVENT,
|
|
19
|
+
useClaimWinnings,
|
|
20
|
+
useResolvedMarketClaim
|
|
21
|
+
} from "./chunk-ZOECARZW.mjs";
|
|
20
22
|
import {
|
|
21
23
|
AggErrorBoundary,
|
|
22
24
|
Button,
|
|
@@ -45,9 +47,8 @@ import {
|
|
|
45
47
|
filterOpenEvents,
|
|
46
48
|
resolveTabVenus,
|
|
47
49
|
shortenAddress,
|
|
48
|
-
sortCategoriesForNavigation
|
|
49
|
-
|
|
50
|
-
} from "./chunk-DXF2LMNN.mjs";
|
|
50
|
+
sortCategoriesForNavigation
|
|
51
|
+
} from "./chunk-TBD3N4T4.mjs";
|
|
51
52
|
|
|
52
53
|
// src/pages/home/index.tsx
|
|
53
54
|
import {
|
|
@@ -56,7 +57,7 @@ import {
|
|
|
56
57
|
useCategories,
|
|
57
58
|
useEventListState,
|
|
58
59
|
useLabels as useLabels2,
|
|
59
|
-
useSdkUiConfig,
|
|
60
|
+
useSdkUiConfig as useSdkUiConfig2,
|
|
60
61
|
useSearch
|
|
61
62
|
} from "@agg-build/hooks";
|
|
62
63
|
import { VENUES } from "@agg-build/sdk";
|
|
@@ -69,7 +70,8 @@ import {
|
|
|
69
70
|
useEnrichedVenueEvent,
|
|
70
71
|
useEventTradingContext,
|
|
71
72
|
useLabels,
|
|
72
|
-
useMidpoints
|
|
73
|
+
useMidpoints,
|
|
74
|
+
useSdkUiConfig
|
|
73
75
|
} from "@agg-build/hooks";
|
|
74
76
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
75
77
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -189,7 +191,8 @@ var EventMarketPageMobileTrade = ({
|
|
|
189
191
|
showPlaceOrder = true,
|
|
190
192
|
isOpen,
|
|
191
193
|
onOpenChange,
|
|
192
|
-
midpointsResult
|
|
194
|
+
midpointsResult,
|
|
195
|
+
onBeforePrimaryAction
|
|
193
196
|
}) => {
|
|
194
197
|
const labels = useLabels();
|
|
195
198
|
if (!showPlaceOrder) return null;
|
|
@@ -229,6 +232,7 @@ var EventMarketPageMobileTrade = ({
|
|
|
229
232
|
eventTradingState,
|
|
230
233
|
executionMode,
|
|
231
234
|
midpointsResult,
|
|
235
|
+
onBeforePrimaryAction,
|
|
232
236
|
className: cn(
|
|
233
237
|
"agg-mobile-trade-panel w-full overflow-hidden rounded-t-agg-2xl sm:rounded-agg-xl",
|
|
234
238
|
classNames == null ? void 0 : classNames.mobileTrade
|
|
@@ -357,16 +361,27 @@ var EventMarketPageContent = ({
|
|
|
357
361
|
showPlaceOrder,
|
|
358
362
|
executionMode,
|
|
359
363
|
stickyOrderPanel,
|
|
360
|
-
resolvedClaim
|
|
364
|
+
resolvedClaim,
|
|
365
|
+
onBeforePrimaryAction
|
|
361
366
|
}) => {
|
|
362
367
|
const eventTradingState = useMemo(() => resolveEventTradingState(event), [event]);
|
|
363
368
|
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
364
369
|
stickyOrderPanel
|
|
365
370
|
});
|
|
371
|
+
const {
|
|
372
|
+
trading: { executionMode: configuredExecutionMode }
|
|
373
|
+
} = useSdkUiConfig();
|
|
374
|
+
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
366
375
|
const [isMobileTradeOpen, setIsMobileTradeOpen] = useState(false);
|
|
367
376
|
const isMobileViewport = useIsMobileEventMarketViewport();
|
|
368
377
|
const tradingContext = useEventTradingContext();
|
|
369
378
|
const midpointsResult = useMidpoints(event.venueMarkets);
|
|
379
|
+
const internalResolvedClaim = useResolvedMarketClaim({
|
|
380
|
+
market: eventTradingState.primaryMarket,
|
|
381
|
+
enabled: eventTradingState.kind === "resolved",
|
|
382
|
+
executionMode: resolvedExecutionMode
|
|
383
|
+
});
|
|
384
|
+
const effectiveResolvedClaim = resolvedClaim != null ? resolvedClaim : internalResolvedClaim;
|
|
370
385
|
const setTradeSideRef = useRef(tradingContext == null ? void 0 : tradingContext.setTradeSide);
|
|
371
386
|
setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
|
|
372
387
|
useEffect(() => {
|
|
@@ -443,9 +458,10 @@ var EventMarketPageContent = ({
|
|
|
443
458
|
PlaceOrder,
|
|
444
459
|
{
|
|
445
460
|
eventTradingState,
|
|
446
|
-
executionMode,
|
|
447
|
-
resolvedClaim,
|
|
461
|
+
executionMode: resolvedExecutionMode,
|
|
462
|
+
resolvedClaim: effectiveResolvedClaim,
|
|
448
463
|
midpointsResult,
|
|
464
|
+
onBeforePrimaryAction,
|
|
449
465
|
className: cn(
|
|
450
466
|
"agg-mobile-trade-panel w-full overflow-hidden",
|
|
451
467
|
classNames == null ? void 0 : classNames.mobileTrade
|
|
@@ -469,9 +485,10 @@ var EventMarketPageContent = ({
|
|
|
469
485
|
PlaceOrder,
|
|
470
486
|
{
|
|
471
487
|
eventTradingState,
|
|
472
|
-
executionMode,
|
|
473
|
-
resolvedClaim,
|
|
488
|
+
executionMode: resolvedExecutionMode,
|
|
489
|
+
resolvedClaim: effectiveResolvedClaim,
|
|
474
490
|
midpointsResult,
|
|
491
|
+
onBeforePrimaryAction,
|
|
475
492
|
className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
|
|
476
493
|
classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
|
|
477
494
|
}
|
|
@@ -486,11 +503,12 @@ var EventMarketPageContent = ({
|
|
|
486
503
|
{
|
|
487
504
|
classNames,
|
|
488
505
|
eventTradingState,
|
|
489
|
-
executionMode,
|
|
506
|
+
executionMode: resolvedExecutionMode,
|
|
490
507
|
showPlaceOrder,
|
|
491
508
|
isOpen: isMobileTradeOpen,
|
|
492
509
|
onOpenChange: setIsMobileTradeOpen,
|
|
493
|
-
midpointsResult
|
|
510
|
+
midpointsResult,
|
|
511
|
+
onBeforePrimaryAction
|
|
494
512
|
}
|
|
495
513
|
) : null
|
|
496
514
|
]
|
|
@@ -670,7 +688,7 @@ var HomeSearchResults = ({
|
|
|
670
688
|
onMarketClick
|
|
671
689
|
}) => {
|
|
672
690
|
const labels = useLabels2();
|
|
673
|
-
const { search: searchConfig } =
|
|
691
|
+
const { search: searchConfig } = useSdkUiConfig2();
|
|
674
692
|
const { disabledVenues } = useAppConfig();
|
|
675
693
|
const [activeVenueTabValue, setActiveVenueTabValue] = useState4("matched");
|
|
676
694
|
const eventListTabs = useEventListTabs();
|
|
@@ -864,8 +882,9 @@ var HomePage = ({
|
|
|
864
882
|
isShowingAllResults,
|
|
865
883
|
onChange: onSearchChange,
|
|
866
884
|
onSelect: onSelectEventInternal
|
|
867
|
-
}
|
|
868
|
-
|
|
885
|
+
},
|
|
886
|
+
trading: { executionMode }
|
|
887
|
+
} = useSdkUiConfig2();
|
|
869
888
|
const { capture, consume } = useEventListState();
|
|
870
889
|
const [snapshot] = useState4(() => consume());
|
|
871
890
|
const eventListStateRef = useRef3(null);
|
|
@@ -1063,7 +1082,14 @@ var HomePage = ({
|
|
|
1063
1082
|
) })
|
|
1064
1083
|
}
|
|
1065
1084
|
) : null,
|
|
1066
|
-
resolvedSelectedEvent ? /* @__PURE__ */ jsx2(
|
|
1085
|
+
resolvedSelectedEvent ? /* @__PURE__ */ jsx2(
|
|
1086
|
+
EventMarketPage,
|
|
1087
|
+
{
|
|
1088
|
+
eventId: resolvedSelectedEvent.id,
|
|
1089
|
+
executionMode,
|
|
1090
|
+
stickyOrderPanel
|
|
1091
|
+
}
|
|
1092
|
+
) : /* @__PURE__ */ jsxs2(
|
|
1067
1093
|
"div",
|
|
1068
1094
|
{
|
|
1069
1095
|
className: cn(
|
|
@@ -1141,25 +1167,20 @@ HomePage.displayName = "HomePage";
|
|
|
1141
1167
|
// src/pages/user-profile/index.tsx
|
|
1142
1168
|
import {
|
|
1143
1169
|
computeClosedPositionTotals,
|
|
1144
|
-
executionKeys,
|
|
1145
1170
|
getWalletAddressFromUserProfile,
|
|
1146
|
-
invalidateBalanceQueries,
|
|
1147
|
-
invalidatePositionQueries,
|
|
1148
|
-
invalidateUserActivityQueries,
|
|
1149
1171
|
useAggAuthState,
|
|
1150
1172
|
useAggBalance,
|
|
1151
1173
|
useAggClient,
|
|
1152
1174
|
useExecutionOrders,
|
|
1153
1175
|
useExecutionPositions,
|
|
1154
1176
|
useGeoBlock,
|
|
1155
|
-
useLabels as
|
|
1177
|
+
useLabels as useLabels7,
|
|
1156
1178
|
useQueryClient,
|
|
1157
|
-
|
|
1158
|
-
useRedeemLifecycles,
|
|
1179
|
+
useSdkUiConfig as useSdkUiConfig3,
|
|
1159
1180
|
useUserActivity
|
|
1160
1181
|
} from "@agg-build/hooks";
|
|
1161
1182
|
import { Venue } from "@agg-build/sdk";
|
|
1162
|
-
import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo4,
|
|
1183
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo4, useState as useState6 } from "react";
|
|
1163
1184
|
|
|
1164
1185
|
// src/pages/user-profile/chain-display.ts
|
|
1165
1186
|
var CHAIN_ID_TO_LABEL = {
|
|
@@ -1182,6 +1203,7 @@ var formatChainIdLabel = (chainId) => {
|
|
|
1182
1203
|
};
|
|
1183
1204
|
|
|
1184
1205
|
// src/pages/user-profile/components/available-balance-card.tsx
|
|
1206
|
+
import { useLabels as useLabels3 } from "@agg-build/hooks";
|
|
1185
1207
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1186
1208
|
var BASE_URL = "https://assets.snagsolutions.io";
|
|
1187
1209
|
var CHAIN_ID_TO_ICON_URL = {
|
|
@@ -1210,6 +1232,9 @@ var CHAIN_VENUE_MAP = {
|
|
|
1210
1232
|
"1337": ["hyperliquid"]
|
|
1211
1233
|
// HyperCore
|
|
1212
1234
|
};
|
|
1235
|
+
var isPaperChain = (row) => {
|
|
1236
|
+
return row.key === "0" || row.label.trim().toLowerCase() === "paper";
|
|
1237
|
+
};
|
|
1213
1238
|
var chainIconUrl = (label, key) => {
|
|
1214
1239
|
if (key && CHAIN_ID_TO_ICON_URL[key]) return CHAIN_ID_TO_ICON_URL[key];
|
|
1215
1240
|
const k = label.trim().toLowerCase();
|
|
@@ -1227,12 +1252,16 @@ var chainIconUrl = (label, key) => {
|
|
|
1227
1252
|
return void 0;
|
|
1228
1253
|
};
|
|
1229
1254
|
var AvailableBalanceCard = ({
|
|
1230
|
-
label
|
|
1255
|
+
label,
|
|
1231
1256
|
valueLabel,
|
|
1232
1257
|
chains,
|
|
1233
1258
|
isLoading = false,
|
|
1234
1259
|
className
|
|
1235
1260
|
}) => {
|
|
1261
|
+
const labels = useLabels3();
|
|
1262
|
+
const balanceLabels = labels.userProfile.balance;
|
|
1263
|
+
const resolvedLabel = label != null ? label : balanceLabels.availableBalance;
|
|
1264
|
+
const hasPaperBalance = chains.some(isPaperChain);
|
|
1236
1265
|
return /* @__PURE__ */ jsxs3(
|
|
1237
1266
|
"div",
|
|
1238
1267
|
{
|
|
@@ -1262,21 +1291,23 @@ var AvailableBalanceCard = ({
|
|
|
1262
1291
|
)
|
|
1263
1292
|
}
|
|
1264
1293
|
),
|
|
1265
|
-
/* @__PURE__ */ jsx3("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children:
|
|
1294
|
+
/* @__PURE__ */ jsx3("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: resolvedLabel })
|
|
1266
1295
|
] }) }),
|
|
1267
1296
|
/* @__PURE__ */ jsxs3("div", { className: "agg-balance-summary flex items-center justify-between gap-3", children: [
|
|
1268
1297
|
/* @__PURE__ */ jsx3("div", { className: "agg-balance-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx3("div", { role: "status", "aria-label": "Loading available balance", children: /* @__PURE__ */ jsx3(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel }),
|
|
1269
1298
|
/* @__PURE__ */ jsx3(
|
|
1270
1299
|
Tooltip,
|
|
1271
1300
|
{
|
|
1272
|
-
"aria-label":
|
|
1301
|
+
"aria-label": balanceLabels.balanceByNetwork,
|
|
1273
1302
|
size: "medium",
|
|
1274
1303
|
side: "bottom",
|
|
1275
1304
|
content: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-4 items-start justify-start", children: [
|
|
1276
|
-
/* @__PURE__ */ jsx3("div", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children:
|
|
1305
|
+
/* @__PURE__ */ jsx3("div", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: balanceLabels.balanceByNetwork }),
|
|
1277
1306
|
/* @__PURE__ */ jsx3("div", { role: "list", className: "agg-balance-list flex flex-col gap-3 w-full", children: chains.map((row) => {
|
|
1278
1307
|
var _a;
|
|
1279
1308
|
const iconUrl = chainIconUrl(row.label, row.key);
|
|
1309
|
+
const isPaper = isPaperChain(row);
|
|
1310
|
+
const rowLabel = isPaper ? balanceLabels.paperModeNetwork : row.label;
|
|
1280
1311
|
return /* @__PURE__ */ jsxs3(
|
|
1281
1312
|
"div",
|
|
1282
1313
|
{
|
|
@@ -1292,8 +1323,8 @@ var AvailableBalanceCard = ({
|
|
|
1292
1323
|
"aria-hidden": true,
|
|
1293
1324
|
className: "size-full object-contain"
|
|
1294
1325
|
}
|
|
1295
|
-
) }) : /* @__PURE__ */ jsx3("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-agg-separator text-[10px] leading-3 text-agg-muted-foreground", children:
|
|
1296
|
-
/* @__PURE__ */ jsx3("span", { className: "truncate font-agg-sans text-agg-sm leading-5 font-agg-normal text-agg-foreground", children:
|
|
1326
|
+
) }) : isPaper ? /* @__PURE__ */ jsx3("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary-hover text-agg-primary", children: /* @__PURE__ */ jsx3(Icon, { name: "paper-mode", size: "small", className: "h-4 w-4" }) }) : /* @__PURE__ */ jsx3("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-agg-separator text-[10px] leading-3 text-agg-muted-foreground", children: rowLabel.slice(0, 2).toUpperCase() }),
|
|
1327
|
+
/* @__PURE__ */ jsx3("span", { className: "truncate font-agg-sans text-agg-sm leading-5 font-agg-normal text-agg-foreground", children: rowLabel })
|
|
1297
1328
|
] }),
|
|
1298
1329
|
/* @__PURE__ */ jsx3("span", { className: "w-[100px] shrink-0 whitespace-nowrap text-right tabular-nums font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground", children: row.balance.toLocaleString("en-US", {
|
|
1299
1330
|
style: "currency",
|
|
@@ -1315,17 +1346,29 @@ var AvailableBalanceCard = ({
|
|
|
1315
1346
|
row.key
|
|
1316
1347
|
);
|
|
1317
1348
|
}) }),
|
|
1318
|
-
/* @__PURE__ */ jsx3("div", { className: "agg-balance-
|
|
1349
|
+
hasPaperBalance ? /* @__PURE__ */ jsx3("div", { className: "agg-balance-paper-warning rounded-agg-lg bg-agg-primary/10 p-3", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-2", children: [
|
|
1350
|
+
/* @__PURE__ */ jsx3(
|
|
1351
|
+
Icon,
|
|
1352
|
+
{
|
|
1353
|
+
name: "paper-mode",
|
|
1354
|
+
size: "small",
|
|
1355
|
+
className: "mt-0.5 h-4 w-4 shrink-0 text-agg-primary"
|
|
1356
|
+
}
|
|
1357
|
+
),
|
|
1358
|
+
/* @__PURE__ */ jsx3("p", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-foreground", children: balanceLabels.paperModeWarning })
|
|
1359
|
+
] }) }) : null,
|
|
1360
|
+
/* @__PURE__ */ jsx3("div", { className: "agg-balance-note rounded-agg-lg bg-agg-secondary-hover p-3", children: /* @__PURE__ */ jsx3("p", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-foreground", children: balanceLabels.networkTooltipDescription }) })
|
|
1319
1361
|
] }),
|
|
1320
1362
|
children: /* @__PURE__ */ jsxs3(
|
|
1321
1363
|
"button",
|
|
1322
1364
|
{
|
|
1323
1365
|
type: "button",
|
|
1324
|
-
"aria-label":
|
|
1366
|
+
"aria-label": balanceLabels.balanceByNetwork,
|
|
1325
1367
|
className: "agg-balance-trigger flex min-h-[20px] min-w-[20px] items-center gap-1 rounded-[6px] border-0 bg-agg-secondary-hover p-1.5",
|
|
1326
1368
|
children: [
|
|
1327
1369
|
(chains.slice(0, 4).length > 0 ? chains.slice(0, 4) : [{ key: "placeholder", label: "", balance: 0, accountCount: 0 }]).map((row) => {
|
|
1328
1370
|
const iconUrl = chainIconUrl(row.label, row.key);
|
|
1371
|
+
const isPaper = isPaperChain(row);
|
|
1329
1372
|
return iconUrl ? /* @__PURE__ */ jsx3(
|
|
1330
1373
|
"span",
|
|
1331
1374
|
{
|
|
@@ -1333,6 +1376,21 @@ var AvailableBalanceCard = ({
|
|
|
1333
1376
|
children: /* @__PURE__ */ jsx3("img", { src: iconUrl, alt: row.label, className: "size-full object-contain" })
|
|
1334
1377
|
},
|
|
1335
1378
|
`icon-${row.key}`
|
|
1379
|
+
) : isPaper ? /* @__PURE__ */ jsx3(
|
|
1380
|
+
"span",
|
|
1381
|
+
{
|
|
1382
|
+
className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary text-agg-primary",
|
|
1383
|
+
children: /* @__PURE__ */ jsx3(
|
|
1384
|
+
Icon,
|
|
1385
|
+
{
|
|
1386
|
+
name: "paper-mode",
|
|
1387
|
+
size: "small",
|
|
1388
|
+
className: "h-4 w-4",
|
|
1389
|
+
title: balanceLabels.paperModeNetwork
|
|
1390
|
+
}
|
|
1391
|
+
)
|
|
1392
|
+
},
|
|
1393
|
+
`icon-${row.key}`
|
|
1336
1394
|
) : /* @__PURE__ */ jsx3(
|
|
1337
1395
|
"span",
|
|
1338
1396
|
{
|
|
@@ -1359,7 +1417,7 @@ var AvailableBalanceCard = ({
|
|
|
1359
1417
|
AvailableBalanceCard.displayName = "AvailableBalanceCard";
|
|
1360
1418
|
|
|
1361
1419
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
1362
|
-
import { optimizedImageUrl as optimizedImageUrl2, useLabels as
|
|
1420
|
+
import { optimizedImageUrl as optimizedImageUrl2, useLabels as useLabels5 } from "@agg-build/hooks";
|
|
1363
1421
|
import { Fragment as Fragment4, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
1364
1422
|
|
|
1365
1423
|
// src/pages/user-profile/user-profile.constants.ts
|
|
@@ -1566,18 +1624,31 @@ ConditionalWrapper.displayName = "ConditionalWrapper";
|
|
|
1566
1624
|
|
|
1567
1625
|
// src/pages/user-profile/components/activity-row.tsx
|
|
1568
1626
|
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1627
|
+
var shouldOpenInNewTab = (activity) => {
|
|
1628
|
+
return activity.kind === "redeem" || activity.kind === "deposit" || activity.kind === "withdrawal";
|
|
1629
|
+
};
|
|
1569
1630
|
var shouldUseNativeLinkNavigation = (event) => {
|
|
1570
1631
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
1571
1632
|
};
|
|
1572
|
-
var RowWrapper = ({
|
|
1633
|
+
var RowWrapper = ({
|
|
1634
|
+
className,
|
|
1635
|
+
href,
|
|
1636
|
+
target,
|
|
1637
|
+
rel,
|
|
1638
|
+
onClick,
|
|
1639
|
+
children
|
|
1640
|
+
}) => {
|
|
1573
1641
|
if (href) {
|
|
1642
|
+
const opensInNewTab = target === "_blank";
|
|
1574
1643
|
return /* @__PURE__ */ jsx4(
|
|
1575
1644
|
"a",
|
|
1576
1645
|
{
|
|
1577
1646
|
href,
|
|
1578
1647
|
className,
|
|
1648
|
+
target,
|
|
1649
|
+
rel,
|
|
1579
1650
|
onClick: (event) => {
|
|
1580
|
-
if (shouldUseNativeLinkNavigation(event)) return;
|
|
1651
|
+
if (shouldUseNativeLinkNavigation(event) || opensInNewTab) return;
|
|
1581
1652
|
event.preventDefault();
|
|
1582
1653
|
onClick();
|
|
1583
1654
|
},
|
|
@@ -1759,141 +1830,152 @@ var TradeOutcomeShares = ({
|
|
|
1759
1830
|
var RedeemRow = ({
|
|
1760
1831
|
activity,
|
|
1761
1832
|
className,
|
|
1833
|
+
href,
|
|
1762
1834
|
onClick
|
|
1763
1835
|
}) => {
|
|
1764
1836
|
const tone = resolveToneClasses(activity);
|
|
1765
1837
|
const statusVisual = getStatusVisual(activity);
|
|
1766
1838
|
const activityStatus = resolveActivityStatus(activity);
|
|
1767
1839
|
const shouldShowInlineStatus = activityStatus !== "completed";
|
|
1768
|
-
return /* @__PURE__ */ jsx4(
|
|
1769
|
-
|
|
1840
|
+
return /* @__PURE__ */ jsx4(
|
|
1841
|
+
RowWrapper,
|
|
1770
1842
|
{
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
/* @__PURE__ */ jsx4("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
|
|
1779
|
-
] }),
|
|
1780
|
-
sideOffset: 4,
|
|
1781
|
-
children
|
|
1782
|
-
}
|
|
1783
|
-
),
|
|
1784
|
-
children: /* @__PURE__ */ jsxs4(
|
|
1785
|
-
"div",
|
|
1843
|
+
className,
|
|
1844
|
+
href,
|
|
1845
|
+
target: href ? "_blank" : void 0,
|
|
1846
|
+
rel: href ? "noopener noreferrer" : void 0,
|
|
1847
|
+
onClick,
|
|
1848
|
+
children: /* @__PURE__ */ jsx4(
|
|
1849
|
+
ConditionalWrapper,
|
|
1786
1850
|
{
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1796
|
-
/* @__PURE__ */ jsx4(
|
|
1797
|
-
Icon,
|
|
1798
|
-
{
|
|
1799
|
-
name: "gift-bonus",
|
|
1800
|
-
size: "small",
|
|
1801
|
-
className: cn(
|
|
1802
|
-
"shrink-0 text-agg-foreground",
|
|
1803
|
-
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
1804
|
-
)
|
|
1805
|
-
}
|
|
1806
|
-
),
|
|
1807
|
-
/* @__PURE__ */ jsx4(
|
|
1808
|
-
"p",
|
|
1809
|
-
{
|
|
1810
|
-
className: cn(
|
|
1811
|
-
"agg-activity-type font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1812
|
-
tone.primary,
|
|
1813
|
-
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
1814
|
-
),
|
|
1815
|
-
children: activity.type
|
|
1816
|
-
}
|
|
1817
|
-
)
|
|
1851
|
+
condition: !!activity.errorMessage,
|
|
1852
|
+
wrapper: (children) => /* @__PURE__ */ jsx4(
|
|
1853
|
+
Tooltip,
|
|
1854
|
+
{
|
|
1855
|
+
size: "medium",
|
|
1856
|
+
content: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-4", children: [
|
|
1857
|
+
/* @__PURE__ */ jsx4(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
|
|
1858
|
+
/* @__PURE__ */ jsx4("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
|
|
1818
1859
|
] }),
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
/* @__PURE__ */
|
|
1833
|
-
|
|
1860
|
+
sideOffset: 4,
|
|
1861
|
+
children
|
|
1862
|
+
}
|
|
1863
|
+
),
|
|
1864
|
+
children: /* @__PURE__ */ jsxs4(
|
|
1865
|
+
"div",
|
|
1866
|
+
{
|
|
1867
|
+
className: cn(
|
|
1868
|
+
"flex w-full flex-col gap-3 text-left transition-colors sm:min-h-16 sm:flex-row sm:items-center",
|
|
1869
|
+
"relative z-10"
|
|
1870
|
+
),
|
|
1871
|
+
"data-status": activityStatus,
|
|
1872
|
+
children: [
|
|
1873
|
+
/* @__PURE__ */ jsx4(RedeemTypeCell, { activity, tone }),
|
|
1874
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
|
|
1875
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1834
1876
|
/* @__PURE__ */ jsx4(
|
|
1835
|
-
"p",
|
|
1836
|
-
{
|
|
1837
|
-
className: cn(
|
|
1838
|
-
"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-bold sm:text-agg-base sm:leading-agg-6",
|
|
1839
|
-
tone.primary
|
|
1840
|
-
),
|
|
1841
|
-
children: activity.title
|
|
1842
|
-
}
|
|
1843
|
-
),
|
|
1844
|
-
shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */ jsx4(
|
|
1845
|
-
LoadingIcon,
|
|
1846
|
-
{
|
|
1847
|
-
size: "small",
|
|
1848
|
-
className: cn("shrink-0", statusVisual.iconClassName)
|
|
1849
|
-
}
|
|
1850
|
-
) : /* @__PURE__ */ jsx4(
|
|
1851
1877
|
Icon,
|
|
1852
1878
|
{
|
|
1853
|
-
name:
|
|
1879
|
+
name: "gift-bonus",
|
|
1854
1880
|
size: "small",
|
|
1855
|
-
className: cn(
|
|
1881
|
+
className: cn(
|
|
1882
|
+
"shrink-0 text-agg-foreground",
|
|
1883
|
+
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
1884
|
+
)
|
|
1856
1885
|
}
|
|
1857
|
-
)
|
|
1858
|
-
] }),
|
|
1859
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: [
|
|
1860
|
-
/* @__PURE__ */ jsx4("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx4(OutcomeBadge, { label: activity.outcomeLabel, tone }) }),
|
|
1886
|
+
),
|
|
1861
1887
|
/* @__PURE__ */ jsx4(
|
|
1862
1888
|
"p",
|
|
1863
1889
|
{
|
|
1864
1890
|
className: cn(
|
|
1865
|
-
"
|
|
1866
|
-
tone.
|
|
1891
|
+
"agg-activity-type font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1892
|
+
tone.primary,
|
|
1893
|
+
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
1867
1894
|
),
|
|
1868
|
-
children: activity.
|
|
1895
|
+
children: activity.type
|
|
1869
1896
|
}
|
|
1870
1897
|
)
|
|
1871
|
-
] })
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1898
|
+
] }),
|
|
1899
|
+
/* @__PURE__ */ jsx4(OutcomeBadge, { label: activity.outcomeLabel, tone })
|
|
1900
|
+
] }),
|
|
1901
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
1902
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
1903
|
+
/* @__PURE__ */ jsx4("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx4(
|
|
1904
|
+
RemoteImage,
|
|
1905
|
+
{
|
|
1906
|
+
src: activity.thumbnailSrc,
|
|
1907
|
+
alt: "",
|
|
1908
|
+
className: "h-full w-full rounded-agg-sm object-cover sm:rounded-agg-lg",
|
|
1909
|
+
classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
|
|
1910
|
+
}
|
|
1911
|
+
) }),
|
|
1912
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1 sm:gap-2", children: [
|
|
1913
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1914
|
+
/* @__PURE__ */ jsx4(
|
|
1915
|
+
"p",
|
|
1916
|
+
{
|
|
1917
|
+
className: cn(
|
|
1918
|
+
"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-bold sm:text-agg-base sm:leading-agg-6",
|
|
1919
|
+
tone.primary
|
|
1920
|
+
),
|
|
1921
|
+
children: activity.title
|
|
1922
|
+
}
|
|
1923
|
+
),
|
|
1924
|
+
shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */ jsx4(
|
|
1925
|
+
LoadingIcon,
|
|
1926
|
+
{
|
|
1927
|
+
size: "small",
|
|
1928
|
+
className: cn("shrink-0", statusVisual.iconClassName)
|
|
1929
|
+
}
|
|
1930
|
+
) : /* @__PURE__ */ jsx4(
|
|
1931
|
+
Icon,
|
|
1932
|
+
{
|
|
1933
|
+
name: statusVisual.icon,
|
|
1934
|
+
size: "small",
|
|
1935
|
+
className: cn("shrink-0", statusVisual.iconClassName)
|
|
1936
|
+
}
|
|
1937
|
+
) : null
|
|
1938
|
+
] }),
|
|
1939
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: [
|
|
1940
|
+
/* @__PURE__ */ jsx4("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx4(OutcomeBadge, { label: activity.outcomeLabel, tone }) }),
|
|
1941
|
+
/* @__PURE__ */ jsx4(
|
|
1942
|
+
"p",
|
|
1943
|
+
{
|
|
1944
|
+
className: cn(
|
|
1945
|
+
"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1946
|
+
tone.meta
|
|
1947
|
+
),
|
|
1948
|
+
children: activity.marketTitle
|
|
1949
|
+
}
|
|
1950
|
+
)
|
|
1951
|
+
] })
|
|
1952
|
+
] })
|
|
1953
|
+
] }),
|
|
1954
|
+
/* @__PURE__ */ jsx4(
|
|
1955
|
+
AmountTimeStack,
|
|
1956
|
+
{
|
|
1957
|
+
amountLabel: activity.amountLabel,
|
|
1958
|
+
timeLabel: activity.timeLabel,
|
|
1959
|
+
tone,
|
|
1960
|
+
mobile: true
|
|
1961
|
+
}
|
|
1962
|
+
)
|
|
1963
|
+
] }),
|
|
1964
|
+
/* @__PURE__ */ jsx4(
|
|
1965
|
+
AmountTimeStack,
|
|
1966
|
+
{
|
|
1967
|
+
amountLabel: activity.amountLabel,
|
|
1968
|
+
timeLabel: activity.timeLabel,
|
|
1969
|
+
tone
|
|
1970
|
+
}
|
|
1971
|
+
)
|
|
1972
|
+
]
|
|
1973
|
+
}
|
|
1974
|
+
)
|
|
1893
1975
|
}
|
|
1894
1976
|
)
|
|
1895
1977
|
}
|
|
1896
|
-
)
|
|
1978
|
+
);
|
|
1897
1979
|
};
|
|
1898
1980
|
var TradeRow = ({
|
|
1899
1981
|
activity,
|
|
@@ -1996,124 +2078,135 @@ var TradeRow = ({
|
|
|
1996
2078
|
var TransferRow = ({
|
|
1997
2079
|
activity,
|
|
1998
2080
|
className,
|
|
2081
|
+
href,
|
|
1999
2082
|
onClick
|
|
2000
2083
|
}) => {
|
|
2001
2084
|
const tone = resolveToneClasses(activity);
|
|
2002
2085
|
const transferStatus = resolveActivityStatus(activity);
|
|
2003
2086
|
const transferIconName = TRANSFER_ICON[activity.kind];
|
|
2004
2087
|
const statusVisual = getStatusVisual(activity);
|
|
2005
|
-
return /* @__PURE__ */ jsx4(
|
|
2006
|
-
|
|
2088
|
+
return /* @__PURE__ */ jsx4(
|
|
2089
|
+
RowWrapper,
|
|
2007
2090
|
{
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
/* @__PURE__ */ jsx4("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
|
|
2016
|
-
] }),
|
|
2017
|
-
sideOffset: 4,
|
|
2018
|
-
children
|
|
2019
|
-
}
|
|
2020
|
-
),
|
|
2021
|
-
children: /* @__PURE__ */ jsxs4(
|
|
2022
|
-
"div",
|
|
2091
|
+
className,
|
|
2092
|
+
href,
|
|
2093
|
+
target: href ? "_blank" : void 0,
|
|
2094
|
+
rel: href ? "noopener noreferrer" : void 0,
|
|
2095
|
+
onClick,
|
|
2096
|
+
children: /* @__PURE__ */ jsx4(
|
|
2097
|
+
ConditionalWrapper,
|
|
2023
2098
|
{
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2099
|
+
condition: !!activity.errorMessage,
|
|
2100
|
+
wrapper: (children) => /* @__PURE__ */ jsx4(
|
|
2101
|
+
Tooltip,
|
|
2102
|
+
{
|
|
2103
|
+
size: "medium",
|
|
2104
|
+
content: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-4", children: [
|
|
2105
|
+
/* @__PURE__ */ jsx4(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
|
|
2106
|
+
/* @__PURE__ */ jsx4("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
|
|
2107
|
+
] }),
|
|
2108
|
+
sideOffset: 4,
|
|
2109
|
+
children
|
|
2110
|
+
}
|
|
2027
2111
|
),
|
|
2028
|
-
children:
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
name: transferIconName,
|
|
2035
|
-
size: "small",
|
|
2036
|
-
className: cn(
|
|
2037
|
-
"shrink-0 text-agg-foreground",
|
|
2038
|
-
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
2039
|
-
)
|
|
2040
|
-
}
|
|
2112
|
+
children: /* @__PURE__ */ jsxs4(
|
|
2113
|
+
"div",
|
|
2114
|
+
{
|
|
2115
|
+
className: cn(
|
|
2116
|
+
"flex w-full flex-col gap-3 text-left transition-colors sm:min-h-16 sm:flex-row sm:items-center",
|
|
2117
|
+
"relative z-10"
|
|
2041
2118
|
),
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
{
|
|
2045
|
-
className: cn(
|
|
2046
|
-
"font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
2047
|
-
tone.primary,
|
|
2048
|
-
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
2049
|
-
),
|
|
2050
|
-
children: activity.type
|
|
2051
|
-
}
|
|
2052
|
-
)
|
|
2053
|
-
] }) }),
|
|
2054
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
2055
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
2056
|
-
/* @__PURE__ */ jsx4(
|
|
2057
|
-
"div",
|
|
2058
|
-
{
|
|
2059
|
-
className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex",
|
|
2060
|
-
"data-status": transferStatus,
|
|
2061
|
-
children: statusVisual.spin ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "medium", className: cn(statusVisual.iconClassName) }) : /* @__PURE__ */ jsx4(
|
|
2062
|
-
Icon,
|
|
2063
|
-
{
|
|
2064
|
-
name: statusVisual.icon,
|
|
2065
|
-
size: "medium",
|
|
2066
|
-
className: cn(statusVisual.iconClassName)
|
|
2067
|
-
}
|
|
2068
|
-
)
|
|
2069
|
-
}
|
|
2070
|
-
),
|
|
2071
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
|
|
2119
|
+
children: [
|
|
2120
|
+
/* @__PURE__ */ jsx4(TransferTypeCell, { activity, tone }),
|
|
2121
|
+
/* @__PURE__ */ jsx4("div", { className: "flex w-full items-center justify-between sm:hidden", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
2072
2122
|
/* @__PURE__ */ jsx4(
|
|
2073
|
-
|
|
2123
|
+
Icon,
|
|
2074
2124
|
{
|
|
2125
|
+
name: transferIconName,
|
|
2126
|
+
size: "small",
|
|
2075
2127
|
className: cn(
|
|
2076
|
-
"
|
|
2077
|
-
|
|
2078
|
-
)
|
|
2079
|
-
children: activity.title
|
|
2128
|
+
"shrink-0 text-agg-foreground",
|
|
2129
|
+
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
2130
|
+
)
|
|
2080
2131
|
}
|
|
2081
2132
|
),
|
|
2082
2133
|
/* @__PURE__ */ jsx4(
|
|
2083
2134
|
"p",
|
|
2084
2135
|
{
|
|
2085
2136
|
className: cn(
|
|
2086
|
-
"
|
|
2087
|
-
tone.
|
|
2137
|
+
"font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
2138
|
+
tone.primary,
|
|
2139
|
+
activity.hasError || activity.errorMessage ? "text-agg-error!" : ""
|
|
2088
2140
|
),
|
|
2089
|
-
children: activity.
|
|
2141
|
+
children: activity.type
|
|
2090
2142
|
}
|
|
2091
2143
|
)
|
|
2092
|
-
] })
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2144
|
+
] }) }),
|
|
2145
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
2146
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
2147
|
+
/* @__PURE__ */ jsx4(
|
|
2148
|
+
"div",
|
|
2149
|
+
{
|
|
2150
|
+
className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex",
|
|
2151
|
+
"data-status": transferStatus,
|
|
2152
|
+
children: statusVisual.spin ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "medium", className: cn(statusVisual.iconClassName) }) : /* @__PURE__ */ jsx4(
|
|
2153
|
+
Icon,
|
|
2154
|
+
{
|
|
2155
|
+
name: statusVisual.icon,
|
|
2156
|
+
size: "medium",
|
|
2157
|
+
className: cn(statusVisual.iconClassName)
|
|
2158
|
+
}
|
|
2159
|
+
)
|
|
2160
|
+
}
|
|
2161
|
+
),
|
|
2162
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
|
|
2163
|
+
/* @__PURE__ */ jsx4(
|
|
2164
|
+
"p",
|
|
2165
|
+
{
|
|
2166
|
+
className: cn(
|
|
2167
|
+
"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-bold sm:text-agg-base sm:leading-agg-6",
|
|
2168
|
+
tone.primary
|
|
2169
|
+
),
|
|
2170
|
+
children: activity.title
|
|
2171
|
+
}
|
|
2172
|
+
),
|
|
2173
|
+
/* @__PURE__ */ jsx4(
|
|
2174
|
+
"p",
|
|
2175
|
+
{
|
|
2176
|
+
className: cn(
|
|
2177
|
+
"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
2178
|
+
tone.meta
|
|
2179
|
+
),
|
|
2180
|
+
children: activity.subtitleLabel
|
|
2181
|
+
}
|
|
2182
|
+
)
|
|
2183
|
+
] })
|
|
2184
|
+
] }),
|
|
2185
|
+
/* @__PURE__ */ jsx4(
|
|
2186
|
+
AmountTimeStack,
|
|
2187
|
+
{
|
|
2188
|
+
amountLabel: activity.amountLabel,
|
|
2189
|
+
timeLabel: activity.timeLabel,
|
|
2190
|
+
tone,
|
|
2191
|
+
mobile: true
|
|
2192
|
+
}
|
|
2193
|
+
)
|
|
2194
|
+
] }),
|
|
2195
|
+
/* @__PURE__ */ jsx4(
|
|
2196
|
+
AmountTimeStack,
|
|
2197
|
+
{
|
|
2198
|
+
amountLabel: activity.amountLabel,
|
|
2199
|
+
timeLabel: activity.timeLabel,
|
|
2200
|
+
tone
|
|
2201
|
+
}
|
|
2202
|
+
)
|
|
2203
|
+
]
|
|
2204
|
+
}
|
|
2205
|
+
)
|
|
2113
2206
|
}
|
|
2114
2207
|
)
|
|
2115
2208
|
}
|
|
2116
|
-
)
|
|
2209
|
+
);
|
|
2117
2210
|
};
|
|
2118
2211
|
var ActivityRow = ({ activity, href, onClick }) => {
|
|
2119
2212
|
const handleClick = () => {
|
|
@@ -2130,9 +2223,25 @@ var ActivityRow = ({ activity, href, onClick }) => {
|
|
|
2130
2223
|
return /* @__PURE__ */ jsx4(TradeRow, { activity, className: sharedClassName, href, onClick: handleClick });
|
|
2131
2224
|
}
|
|
2132
2225
|
if (activity.kind === "redeem") {
|
|
2133
|
-
return /* @__PURE__ */ jsx4(
|
|
2226
|
+
return /* @__PURE__ */ jsx4(
|
|
2227
|
+
RedeemRow,
|
|
2228
|
+
{
|
|
2229
|
+
activity,
|
|
2230
|
+
className: sharedClassName,
|
|
2231
|
+
href: shouldOpenInNewTab(activity) ? href : void 0,
|
|
2232
|
+
onClick: handleClick
|
|
2233
|
+
}
|
|
2234
|
+
);
|
|
2134
2235
|
}
|
|
2135
|
-
return /* @__PURE__ */ jsx4(
|
|
2236
|
+
return /* @__PURE__ */ jsx4(
|
|
2237
|
+
TransferRow,
|
|
2238
|
+
{
|
|
2239
|
+
activity,
|
|
2240
|
+
className: sharedClassName,
|
|
2241
|
+
href: shouldOpenInNewTab(activity) ? href : void 0,
|
|
2242
|
+
onClick: handleClick
|
|
2243
|
+
}
|
|
2244
|
+
);
|
|
2136
2245
|
};
|
|
2137
2246
|
ActivityRow.displayName = "ActivityRow";
|
|
2138
2247
|
|
|
@@ -2158,7 +2267,7 @@ var EmptyState = ({ title, description, className }) => {
|
|
|
2158
2267
|
EmptyState.displayName = "EmptyState";
|
|
2159
2268
|
|
|
2160
2269
|
// src/pages/user-profile/components/position-row.tsx
|
|
2161
|
-
import { optimizedImageUrl, useLabels as
|
|
2270
|
+
import { optimizedImageUrl, useLabels as useLabels4 } from "@agg-build/hooks";
|
|
2162
2271
|
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2163
2272
|
var shouldUseNativeLinkNavigation2 = (event) => {
|
|
2164
2273
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
@@ -2296,7 +2405,7 @@ var PositionRow = ({
|
|
|
2296
2405
|
onClaim,
|
|
2297
2406
|
isClaiming = false
|
|
2298
2407
|
}) => {
|
|
2299
|
-
const labels =
|
|
2408
|
+
const labels = useLabels4().userProfile.positions;
|
|
2300
2409
|
const model = toPositionRowViewModel(position, {
|
|
2301
2410
|
avgPrefix: labels.avgPrefix,
|
|
2302
2411
|
nowPrefix: labels.nowPrefix,
|
|
@@ -2509,7 +2618,7 @@ var PositionsActivity = ({
|
|
|
2509
2618
|
initialPositionFilter = "active",
|
|
2510
2619
|
className
|
|
2511
2620
|
}) => {
|
|
2512
|
-
const positionsLabels =
|
|
2621
|
+
const positionsLabels = useLabels5().userProfile.positions;
|
|
2513
2622
|
const isTabControlled = tab !== void 0;
|
|
2514
2623
|
const [internalActiveTab, setInternalActiveTab] = useState5(
|
|
2515
2624
|
tab != null ? tab : USER_PROFILE_TAB_POSITIONS
|
|
@@ -2979,7 +3088,7 @@ var PositionsValueCard = ({
|
|
|
2979
3088
|
PositionsValueCard.displayName = "PositionsValueCard";
|
|
2980
3089
|
|
|
2981
3090
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
2982
|
-
import { optimizedImageUrl as optimizedImageUrl3, useLabels as
|
|
3091
|
+
import { optimizedImageUrl as optimizedImageUrl3, useLabels as useLabels6 } from "@agg-build/hooks";
|
|
2983
3092
|
|
|
2984
3093
|
// src/pages/user-profile/components/default-avatar.tsx
|
|
2985
3094
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
@@ -3038,7 +3147,7 @@ var UserInfoCard = ({
|
|
|
3038
3147
|
className
|
|
3039
3148
|
}) => {
|
|
3040
3149
|
var _a;
|
|
3041
|
-
const labels =
|
|
3150
|
+
const labels = useLabels6();
|
|
3042
3151
|
const wallets = (_a = user.connectedWallets) != null ? _a : [];
|
|
3043
3152
|
const hasWallets = wallets.length > 0;
|
|
3044
3153
|
return /* @__PURE__ */ jsxs10(
|
|
@@ -3171,6 +3280,27 @@ var UserInfoCard = ({
|
|
|
3171
3280
|
};
|
|
3172
3281
|
UserInfoCard.displayName = "UserInfoCard";
|
|
3173
3282
|
|
|
3283
|
+
// src/pages/user-profile/transaction-explorer.ts
|
|
3284
|
+
var AGG_TX_EXPLORER_URLS = {
|
|
3285
|
+
"1": "https://etherscan.io/tx/",
|
|
3286
|
+
"56": "https://bscscan.com/tx/",
|
|
3287
|
+
"137": "https://polygonscan.com/tx/",
|
|
3288
|
+
"1337": "https://app.hyperliquid.xyz/explorer/tx/",
|
|
3289
|
+
"8453": "https://basescan.org/tx/",
|
|
3290
|
+
"42161": "https://arbiscan.io/tx/",
|
|
3291
|
+
"792703809": "https://solscan.io/tx/"
|
|
3292
|
+
};
|
|
3293
|
+
var buildAggTxExplorerHref = (chainId, txHash) => {
|
|
3294
|
+
if (chainId === null || chainId === void 0) return void 0;
|
|
3295
|
+
if (!txHash) return void 0;
|
|
3296
|
+
const normalizedChainId = String(chainId).trim();
|
|
3297
|
+
const normalizedTxHash = txHash.trim();
|
|
3298
|
+
if (!normalizedChainId || !normalizedTxHash) return void 0;
|
|
3299
|
+
const baseUrl = AGG_TX_EXPLORER_URLS[normalizedChainId];
|
|
3300
|
+
if (!baseUrl) return void 0;
|
|
3301
|
+
return `${baseUrl}${normalizedTxHash}`;
|
|
3302
|
+
};
|
|
3303
|
+
|
|
3174
3304
|
// src/pages/user-profile/index.tsx
|
|
3175
3305
|
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3176
3306
|
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
@@ -3210,7 +3340,11 @@ var TOKEN_DECIMALS_BY_SYMBOL = {
|
|
|
3210
3340
|
var TOKEN_DECIMALS_BY_CHAIN_AND_SYMBOL = {
|
|
3211
3341
|
"56": {
|
|
3212
3342
|
USDC: 18,
|
|
3213
|
-
USDT: 18
|
|
3343
|
+
USDT: 18,
|
|
3344
|
+
// USD1 (World Liberty Financial) is the Myriad settlement token on BNB and
|
|
3345
|
+
// is 18-dec like the other BNB stables. Without this it falls back to 6-dec
|
|
3346
|
+
// and renders an 18-dec amount inflated by ~10^12 (e.g. $3.90 → trillions).
|
|
3347
|
+
USD1: 18
|
|
3214
3348
|
}
|
|
3215
3349
|
};
|
|
3216
3350
|
var parseRawMicroValue = (value) => {
|
|
@@ -3525,10 +3659,6 @@ function buildVenueShareBreakdown(outcome) {
|
|
|
3525
3659
|
sharesLabel: `${twoDecimalNumberFormatter.format(row.size)} shares`
|
|
3526
3660
|
}));
|
|
3527
3661
|
}
|
|
3528
|
-
var toClaimError = (err) => {
|
|
3529
|
-
if (err instanceof Error) return err;
|
|
3530
|
-
return new Error(String(err));
|
|
3531
|
-
};
|
|
3532
3662
|
var UserProfilePage = ({
|
|
3533
3663
|
user,
|
|
3534
3664
|
balanceChainsOverride,
|
|
@@ -3537,7 +3667,7 @@ var UserProfilePage = ({
|
|
|
3537
3667
|
activePositions,
|
|
3538
3668
|
closedPositions,
|
|
3539
3669
|
activities,
|
|
3540
|
-
executionMode
|
|
3670
|
+
executionMode,
|
|
3541
3671
|
onEditProfile,
|
|
3542
3672
|
onDeposit,
|
|
3543
3673
|
onWithdraw,
|
|
@@ -3586,30 +3716,18 @@ var UserProfilePage = ({
|
|
|
3586
3716
|
const { isDepositBlocked } = useGeoBlock();
|
|
3587
3717
|
const balanceState = useAggBalance();
|
|
3588
3718
|
const client = useAggClient();
|
|
3589
|
-
const labels =
|
|
3590
|
-
const
|
|
3591
|
-
|
|
3719
|
+
const labels = useLabels7();
|
|
3720
|
+
const {
|
|
3721
|
+
trading: { executionMode: configuredExecutionMode }
|
|
3722
|
+
} = useSdkUiConfig3();
|
|
3592
3723
|
const queryClient = useQueryClient();
|
|
3593
|
-
const redeemMutation = useRedeem();
|
|
3594
3724
|
const [internalCancellingIds, setInternalCancellingIds] = useState6({});
|
|
3595
|
-
const
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
() => Object.values(activeRedeems),
|
|
3602
|
-
[activeRedeems]
|
|
3603
|
-
);
|
|
3604
|
-
const lifecycleStates = useRedeemLifecycles(lifecycleInputs);
|
|
3605
|
-
const internalClaimingIds = useMemo4(() => {
|
|
3606
|
-
const out = __spreadValues({}, submittingClaimKeys);
|
|
3607
|
-
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
3608
|
-
const state = lifecycleStates[active.redeemId];
|
|
3609
|
-
if (!state || !state.terminal) out[claimKey] = true;
|
|
3610
|
-
}
|
|
3611
|
-
return out;
|
|
3612
|
-
}, [activeRedeems, lifecycleStates, submittingClaimKeys]);
|
|
3725
|
+
const { claim: startClaim, claimingKeys } = useClaimWinnings({
|
|
3726
|
+
onClaim,
|
|
3727
|
+
onClaimResult,
|
|
3728
|
+
onClaimSubmitError,
|
|
3729
|
+
externalClaimingKeys: claimingPositionKeys
|
|
3730
|
+
});
|
|
3613
3731
|
const [profileUser, setProfileUser] = useState6(void 0);
|
|
3614
3732
|
const shouldUseHookData = !user;
|
|
3615
3733
|
const connectedVenues = useMemo4(() => {
|
|
@@ -3619,7 +3737,8 @@ var UserProfilePage = ({
|
|
|
3619
3737
|
return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
|
|
3620
3738
|
}, [balanceState, shouldUseHookData]);
|
|
3621
3739
|
const [positionFilter, setPositionFilter] = useState6(initialPositionFilter);
|
|
3622
|
-
const
|
|
3740
|
+
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
3741
|
+
const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
|
|
3623
3742
|
const activePositionsQuery = useExecutionPositions({
|
|
3624
3743
|
enabled: shouldUseHookData && isAuthenticated,
|
|
3625
3744
|
status: "active",
|
|
@@ -3671,207 +3790,17 @@ var UserProfilePage = ({
|
|
|
3671
3790
|
}),
|
|
3672
3791
|
[client, onCancelOrder, queryClient]
|
|
3673
3792
|
);
|
|
3674
|
-
const invalidateClaimUiState = useCallback3(() => {
|
|
3675
|
-
invalidateBalanceQueries(queryClient);
|
|
3676
|
-
invalidatePositionQueries(queryClient);
|
|
3677
|
-
queryClient.invalidateQueries({
|
|
3678
|
-
queryKey: executionKeys.claimablePositionsCount(),
|
|
3679
|
-
refetchType: "active"
|
|
3680
|
-
});
|
|
3681
|
-
invalidateUserActivityQueries(queryClient);
|
|
3682
|
-
}, [queryClient]);
|
|
3683
3793
|
const handleClaimPosition = useCallback3(
|
|
3684
|
-
(position) =>
|
|
3794
|
+
(position) => {
|
|
3685
3795
|
var _a, _b;
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
activeClaimKeysRef.current.add(claimKey);
|
|
3691
|
-
setSubmittingClaimKeys((prev) => __spreadProps(__spreadValues({}, prev), { [claimKey]: true }));
|
|
3692
|
-
const pendingToastId = toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.pendingMessage, {
|
|
3693
|
-
title: claimNotificationLabels.pendingTitle,
|
|
3694
|
-
tone: "info"
|
|
3796
|
+
return startClaim({
|
|
3797
|
+
claimKey: (_a = position.marketId) != null ? _a : position.id,
|
|
3798
|
+
winningOutcomeIds: (_b = position.winningOutcomeIds) != null ? _b : [],
|
|
3799
|
+
payload: position
|
|
3695
3800
|
});
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
}
|
|
3699
|
-
if (onClaim) {
|
|
3700
|
-
try {
|
|
3701
|
-
yield onClaim(position);
|
|
3702
|
-
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
3703
|
-
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
3704
|
-
delete pendingClaimToastIdsRef.current[claimKey];
|
|
3705
|
-
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.successMessage, {
|
|
3706
|
-
title: claimNotificationLabels.successTitle,
|
|
3707
|
-
tone: "success"
|
|
3708
|
-
});
|
|
3709
|
-
} catch (err) {
|
|
3710
|
-
const error = toClaimError(err);
|
|
3711
|
-
console.error("[UserProfilePage] redeem failed", error);
|
|
3712
|
-
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
3713
|
-
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
3714
|
-
delete pendingClaimToastIdsRef.current[claimKey];
|
|
3715
|
-
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage(error.message), {
|
|
3716
|
-
title: claimNotificationLabels.failedTitle,
|
|
3717
|
-
tone: "error"
|
|
3718
|
-
});
|
|
3719
|
-
onClaimSubmitError == null ? void 0 : onClaimSubmitError(claimKey, error);
|
|
3720
|
-
throw error;
|
|
3721
|
-
} finally {
|
|
3722
|
-
invalidateClaimUiState();
|
|
3723
|
-
activeClaimKeysRef.current.delete(claimKey);
|
|
3724
|
-
setSubmittingClaimKeys((prev) => {
|
|
3725
|
-
const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
|
|
3726
|
-
return rest;
|
|
3727
|
-
});
|
|
3728
|
-
}
|
|
3729
|
-
return;
|
|
3730
|
-
}
|
|
3731
|
-
const venueMarketOutcomeIds = (_b = position.winningOutcomeIds) != null ? _b : [];
|
|
3732
|
-
if (venueMarketOutcomeIds.length === 0) {
|
|
3733
|
-
const error = new Error(claimNotificationLabels.missingOutcomeMessage);
|
|
3734
|
-
console.error("[UserProfilePage] redeem failed", error);
|
|
3735
|
-
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
3736
|
-
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
3737
|
-
delete pendingClaimToastIdsRef.current[claimKey];
|
|
3738
|
-
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage(error.message), {
|
|
3739
|
-
title: claimNotificationLabels.failedTitle,
|
|
3740
|
-
tone: "error"
|
|
3741
|
-
});
|
|
3742
|
-
onClaimSubmitError == null ? void 0 : onClaimSubmitError(claimKey, error);
|
|
3743
|
-
invalidateClaimUiState();
|
|
3744
|
-
activeClaimKeysRef.current.delete(claimKey);
|
|
3745
|
-
setSubmittingClaimKeys((prev) => {
|
|
3746
|
-
const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
|
|
3747
|
-
return rest;
|
|
3748
|
-
});
|
|
3749
|
-
throw error;
|
|
3750
|
-
}
|
|
3751
|
-
try {
|
|
3752
|
-
const response = yield redeemMutation.mutateAsync({ venueMarketOutcomeIds });
|
|
3753
|
-
const expectedOutcomeIds = [];
|
|
3754
|
-
const preFailedOutcomeIds = [];
|
|
3755
|
-
const preFailedReasons = {};
|
|
3756
|
-
const preConfirmedOutcomeIds = [];
|
|
3757
|
-
const preConfirmedTxHashes = {};
|
|
3758
|
-
for (const result of response.results) {
|
|
3759
|
-
if (result.status === "submitted") {
|
|
3760
|
-
expectedOutcomeIds.push(result.venueMarketOutcomeId);
|
|
3761
|
-
} else if (result.status === "confirmed") {
|
|
3762
|
-
preConfirmedOutcomeIds.push(result.venueMarketOutcomeId);
|
|
3763
|
-
preConfirmedTxHashes[result.venueMarketOutcomeId] = result.txHash;
|
|
3764
|
-
} else if (result.status === "ineligible" || result.status === "rejected") {
|
|
3765
|
-
preFailedOutcomeIds.push(result.venueMarketOutcomeId);
|
|
3766
|
-
preFailedReasons[result.venueMarketOutcomeId] = result.reason;
|
|
3767
|
-
}
|
|
3768
|
-
}
|
|
3769
|
-
if (expectedOutcomeIds.length > 0) {
|
|
3770
|
-
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
3771
|
-
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
3772
|
-
delete pendingClaimToastIdsRef.current[claimKey];
|
|
3773
|
-
submittedClaimToastKeysRef.current.add(claimKey);
|
|
3774
|
-
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.submittedMessage, {
|
|
3775
|
-
title: claimNotificationLabels.submittedTitle,
|
|
3776
|
-
tone: "success"
|
|
3777
|
-
});
|
|
3778
|
-
}
|
|
3779
|
-
setActiveRedeems((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3780
|
-
[claimKey]: {
|
|
3781
|
-
redeemId: response.redeemId,
|
|
3782
|
-
expectedOutcomeIds,
|
|
3783
|
-
preFailedOutcomeIds,
|
|
3784
|
-
preFailedReasons,
|
|
3785
|
-
preConfirmedOutcomeIds,
|
|
3786
|
-
preConfirmedTxHashes
|
|
3787
|
-
}
|
|
3788
|
-
}));
|
|
3789
|
-
yield queryClient.invalidateQueries({ queryKey: ["current-user"] });
|
|
3790
|
-
} catch (err) {
|
|
3791
|
-
const error = toClaimError(err);
|
|
3792
|
-
console.error("[UserProfilePage] redeem failed", error);
|
|
3793
|
-
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
3794
|
-
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
3795
|
-
delete pendingClaimToastIdsRef.current[claimKey];
|
|
3796
|
-
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage(error.message), {
|
|
3797
|
-
title: claimNotificationLabels.failedTitle,
|
|
3798
|
-
tone: "error"
|
|
3799
|
-
});
|
|
3800
|
-
onClaimSubmitError == null ? void 0 : onClaimSubmitError(claimKey, error);
|
|
3801
|
-
throw error;
|
|
3802
|
-
} finally {
|
|
3803
|
-
activeClaimKeysRef.current.delete(claimKey);
|
|
3804
|
-
setSubmittingClaimKeys((prev) => {
|
|
3805
|
-
const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
|
|
3806
|
-
return rest;
|
|
3807
|
-
});
|
|
3808
|
-
}
|
|
3809
|
-
}),
|
|
3810
|
-
[
|
|
3811
|
-
claimingPositionKeys,
|
|
3812
|
-
claimNotificationLabels,
|
|
3813
|
-
invalidateClaimUiState,
|
|
3814
|
-
internalClaimingIds,
|
|
3815
|
-
onClaim,
|
|
3816
|
-
onClaimSubmitError,
|
|
3817
|
-
queryClient,
|
|
3818
|
-
redeemMutation,
|
|
3819
|
-
toastCtx
|
|
3820
|
-
]
|
|
3801
|
+
},
|
|
3802
|
+
[startClaim]
|
|
3821
3803
|
);
|
|
3822
|
-
const firedTerminalRef = useRef5({});
|
|
3823
|
-
useEffect5(() => {
|
|
3824
|
-
var _a, _b;
|
|
3825
|
-
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
3826
|
-
const state = lifecycleStates[active.redeemId];
|
|
3827
|
-
if (!state || !state.terminal) continue;
|
|
3828
|
-
if (firedTerminalRef.current[active.redeemId]) continue;
|
|
3829
|
-
firedTerminalRef.current[active.redeemId] = true;
|
|
3830
|
-
onClaimResult == null ? void 0 : onClaimResult(claimKey, {
|
|
3831
|
-
allConfirmed: state.allConfirmed,
|
|
3832
|
-
anyFailed: state.anyFailed,
|
|
3833
|
-
errorMessage: state.errorMessage
|
|
3834
|
-
});
|
|
3835
|
-
const pendingId = pendingClaimToastIdsRef.current[claimKey];
|
|
3836
|
-
if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
|
|
3837
|
-
delete pendingClaimToastIdsRef.current[claimKey];
|
|
3838
|
-
if (state.allConfirmed) {
|
|
3839
|
-
if (!submittedClaimToastKeysRef.current.has(claimKey)) {
|
|
3840
|
-
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.successMessage, {
|
|
3841
|
-
title: claimNotificationLabels.successTitle,
|
|
3842
|
-
tone: "success"
|
|
3843
|
-
});
|
|
3844
|
-
}
|
|
3845
|
-
} else if (state.anyFailed) {
|
|
3846
|
-
const hasConfirmedLeg = Object.values(state.legs).some((leg) => leg.status === "confirmed");
|
|
3847
|
-
if (hasConfirmedLeg) {
|
|
3848
|
-
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.partialMessage((_a = state.errorMessage) != null ? _a : void 0), {
|
|
3849
|
-
title: claimNotificationLabels.partialTitle,
|
|
3850
|
-
tone: "warning"
|
|
3851
|
-
});
|
|
3852
|
-
} else {
|
|
3853
|
-
toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage((_b = state.errorMessage) != null ? _b : void 0), {
|
|
3854
|
-
title: claimNotificationLabels.failedTitle,
|
|
3855
|
-
tone: "error"
|
|
3856
|
-
});
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
submittedClaimToastKeysRef.current.delete(claimKey);
|
|
3860
|
-
invalidateClaimUiState();
|
|
3861
|
-
delete firedTerminalRef.current[active.redeemId];
|
|
3862
|
-
setActiveRedeems((prev) => {
|
|
3863
|
-
const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
|
|
3864
|
-
return rest;
|
|
3865
|
-
});
|
|
3866
|
-
}
|
|
3867
|
-
}, [
|
|
3868
|
-
activeRedeems,
|
|
3869
|
-
claimNotificationLabels,
|
|
3870
|
-
invalidateClaimUiState,
|
|
3871
|
-
lifecycleStates,
|
|
3872
|
-
onClaimResult,
|
|
3873
|
-
toastCtx
|
|
3874
|
-
]);
|
|
3875
3804
|
useEffect5(() => {
|
|
3876
3805
|
if (!shouldUseHookData || !isAuthenticated) {
|
|
3877
3806
|
setProfileUser(void 0);
|
|
@@ -3951,7 +3880,7 @@ var UserProfilePage = ({
|
|
|
3951
3880
|
if (activities) return activities.filter(isVisibleUserProfileActivity);
|
|
3952
3881
|
const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
|
|
3953
3882
|
return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
|
|
3954
|
-
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;
|
|
3883
|
+
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;
|
|
3955
3884
|
const timeLabel = formatTime(getRuntimeActivityCreatedAt(item));
|
|
3956
3885
|
if (item.type === "trade") {
|
|
3957
3886
|
const tradeItem = item;
|
|
@@ -4006,13 +3935,15 @@ var UserProfilePage = ({
|
|
|
4006
3935
|
return {
|
|
4007
3936
|
kind: "withdrawal",
|
|
4008
3937
|
id: withdrawalItem.id,
|
|
3938
|
+
chainId: (_p = withdrawalItem.chainId) != null ? _p : void 0,
|
|
3939
|
+
txHash: (_q = withdrawalItem.txHash) != null ? _q : void 0,
|
|
4009
3940
|
isFailed,
|
|
4010
3941
|
hasError,
|
|
4011
3942
|
errorMessage,
|
|
4012
3943
|
status,
|
|
4013
3944
|
type: labels.userProfile.activity.withdrawalType,
|
|
4014
3945
|
title: titleByStatus[status],
|
|
4015
|
-
subtitleLabel: `to ${(
|
|
3946
|
+
subtitleLabel: `to ${(_r = shortenAddress(withdrawalItem.destinationAddress)) != null ? _r : withdrawalItem.destinationAddress} \xB7 ${formatChainIdLabel(withdrawalItem.destinationChainId)}`,
|
|
4016
3947
|
amountLabel,
|
|
4017
3948
|
timeLabel
|
|
4018
3949
|
};
|
|
@@ -4022,7 +3953,7 @@ var UserProfilePage = ({
|
|
|
4022
3953
|
const normalizedStatus = normalizeDepositStatus(depositItem.status);
|
|
4023
3954
|
const timedOut = normalizedStatus === "pending" && isPendingTransferTimedOut(depositItem.createdAt);
|
|
4024
3955
|
const status = timedOut ? "failed" : normalizedStatus;
|
|
4025
|
-
const errorMessage = timedOut ? PENDING_TRANSFER_TIMEOUT_ERROR_MESSAGE : (
|
|
3956
|
+
const errorMessage = timedOut ? PENDING_TRANSFER_TIMEOUT_ERROR_MESSAGE : (_s = getActivityErrorMessage(depositItem)) != null ? _s : void 0;
|
|
4026
3957
|
const isFailed = status === "failed";
|
|
4027
3958
|
const hasError = timedOut || hasActivityError(depositItem);
|
|
4028
3959
|
const depositSource = depositItem.source;
|
|
@@ -4039,17 +3970,18 @@ var UserProfilePage = ({
|
|
|
4039
3970
|
return {
|
|
4040
3971
|
kind: "deposit",
|
|
4041
3972
|
id: depositItem.id,
|
|
3973
|
+
chainId: depositItem.chainId,
|
|
3974
|
+
txHash: depositItem.txHash,
|
|
4042
3975
|
isFailed,
|
|
4043
3976
|
hasError,
|
|
4044
3977
|
errorMessage,
|
|
4045
3978
|
status,
|
|
4046
3979
|
type: labels.userProfile.activity.depositType,
|
|
4047
3980
|
title: depositTitlesBySource[depositSource][status],
|
|
4048
|
-
subtitleLabel: `from ${(
|
|
3981
|
+
subtitleLabel: `from ${(_t = shortenAddress(depositItem.fromAddress)) != null ? _t : depositItem.fromAddress} \xB7 ${formatChainIdLabel(depositItem.chainId)}`,
|
|
4049
3982
|
amountLabel,
|
|
4050
3983
|
timeLabel,
|
|
4051
|
-
depositSource: depositSource === "connected_wallet" ? "wallet" : "crypto"
|
|
4052
|
-
chainId: depositItem.chainId
|
|
3984
|
+
depositSource: depositSource === "connected_wallet" ? "wallet" : "crypto"
|
|
4053
3985
|
};
|
|
4054
3986
|
}
|
|
4055
3987
|
if (item.type === "redeem") {
|
|
@@ -4057,23 +3989,25 @@ var UserProfilePage = ({
|
|
|
4057
3989
|
const redeemLegs = Array.isArray(redeemItem.legs) ? redeemItem.legs : [];
|
|
4058
3990
|
const firstLeg = redeemLegs[0];
|
|
4059
3991
|
const status = getDerivedRedeemStatus(redeemItem);
|
|
4060
|
-
const firstLegErrorMessage = (
|
|
4061
|
-
const errorMessage = (
|
|
3992
|
+
const firstLegErrorMessage = (_v = (_u = redeemLegs.find((leg) => typeof leg.errorMessage === "string" && leg.errorMessage)) == null ? void 0 : _u.errorMessage) != null ? _v : void 0;
|
|
3993
|
+
const errorMessage = (_w = getActivityErrorMessage(redeemItem)) != null ? _w : firstLegErrorMessage;
|
|
4062
3994
|
const isFailed = status === "failed";
|
|
4063
3995
|
const hasError = isFailed || !!(errorMessage == null ? void 0 : errorMessage.trim());
|
|
4064
3996
|
const titleByStatus = labels.userProfile.activity.redeemStatusTitles;
|
|
4065
3997
|
return {
|
|
4066
3998
|
kind: "redeem",
|
|
4067
3999
|
id: redeemItem.id,
|
|
4000
|
+
chainId: (_x = firstLeg == null ? void 0 : firstLeg.chainId) != null ? _x : void 0,
|
|
4001
|
+
txHash: (_y = firstLeg == null ? void 0 : firstLeg.txHash) != null ? _y : void 0,
|
|
4068
4002
|
isFailed,
|
|
4069
4003
|
hasError,
|
|
4070
4004
|
errorMessage: errorMessage != null ? errorMessage : void 0,
|
|
4071
4005
|
status,
|
|
4072
4006
|
type: labels.userProfile.activity.redeemType,
|
|
4073
4007
|
title: titleByStatus[status],
|
|
4074
|
-
thumbnailSrc: (
|
|
4075
|
-
marketTitle: (
|
|
4076
|
-
outcomeLabel: (
|
|
4008
|
+
thumbnailSrc: (_A = (_z = firstLeg == null ? void 0 : firstLeg.venueMarket) == null ? void 0 : _z.image) != null ? _A : fallbackThumbnailSrc,
|
|
4009
|
+
marketTitle: (_C = (_B = firstLeg == null ? void 0 : firstLeg.venueMarket) == null ? void 0 : _B.question) != null ? _C : "Market",
|
|
4010
|
+
outcomeLabel: (_G = (_F = (_D = firstLeg == null ? void 0 : firstLeg.venueMarketOutcome) == null ? void 0 : _D.title) != null ? _F : (_E = firstLeg == null ? void 0 : firstLeg.venueMarketOutcome) == null ? void 0 : _E.label) != null ? _G : "",
|
|
4077
4011
|
amountLabel: status === "failed" || status === "canceled" ? ZERO_AMOUNT_LABEL : toRedeemPayoutAmountLabel(redeemItem),
|
|
4078
4012
|
timeLabel
|
|
4079
4013
|
};
|
|
@@ -4271,7 +4205,7 @@ var UserProfilePage = ({
|
|
|
4271
4205
|
onPositionClick,
|
|
4272
4206
|
getPositionHref,
|
|
4273
4207
|
onClaim: handleClaimPosition,
|
|
4274
|
-
claimingPositionKeys:
|
|
4208
|
+
claimingPositionKeys: claimingKeys,
|
|
4275
4209
|
onActivityClick,
|
|
4276
4210
|
getActivityHref,
|
|
4277
4211
|
onOpenOrderClick,
|
|
@@ -4325,5 +4259,6 @@ export {
|
|
|
4325
4259
|
USER_PROFILE_TAB_POSITIONS,
|
|
4326
4260
|
USER_PROFILE_TAB_OPEN_ORDERS,
|
|
4327
4261
|
USER_PROFILE_TAB_ACTIVITY,
|
|
4262
|
+
buildAggTxExplorerHref,
|
|
4328
4263
|
UserProfilePage
|
|
4329
4264
|
};
|