@agg-build/hooks 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-7UDYSDKQ.mjs → chunk-56RISN73.mjs} +250 -16
- package/dist/{chunk-FBYQBFFR.mjs → chunk-NZEXGOFC.mjs} +1 -1
- package/dist/{chunk-5VDUIUJB.mjs → chunk-SN4AO5D7.mjs} +1 -1
- package/dist/deposit.d.mts +1 -1
- package/dist/deposit.d.ts +1 -1
- package/dist/deposit.js +88 -18
- package/dist/deposit.mjs +30 -9
- package/dist/index.d.mts +99 -37
- package/dist/index.d.ts +99 -37
- package/dist/index.js +479 -104
- package/dist/index.mjs +190 -48
- package/dist/withdraw.js +49 -2
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRampQuotes,
|
|
3
3
|
useRampSession
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SN4AO5D7.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useWithdrawEstimate,
|
|
7
7
|
useWithdrawFlow,
|
|
8
8
|
useWithdrawPreview,
|
|
9
9
|
useWithdrawalLifecycle
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NZEXGOFC.mjs";
|
|
11
11
|
import {
|
|
12
12
|
AggAuthContext,
|
|
13
13
|
AggBalanceProvider,
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
useSyncBalances,
|
|
96
96
|
useWithdrawManaged,
|
|
97
97
|
userActivityQueryKeys
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-56RISN73.mjs";
|
|
99
99
|
|
|
100
100
|
// src/index.ts
|
|
101
101
|
import { QueryClient as QueryClient4, QueryClientProvider, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
@@ -1534,31 +1534,8 @@ function useMidpoints(venueMarkets, options) {
|
|
|
1534
1534
|
};
|
|
1535
1535
|
}
|
|
1536
1536
|
|
|
1537
|
-
// src/use-tradable-venues.ts
|
|
1538
|
-
import { useMemo as useMemo9 } from "react";
|
|
1539
|
-
function useTradableVenues(venueMarkets) {
|
|
1540
|
-
const { prices, isLoading } = useMidpoints(venueMarkets);
|
|
1541
|
-
const tradableVenues = useMemo9(() => {
|
|
1542
|
-
var _a;
|
|
1543
|
-
if (isLoading) return null;
|
|
1544
|
-
if (!venueMarkets || venueMarkets.length === 0) return /* @__PURE__ */ new Set();
|
|
1545
|
-
const set = /* @__PURE__ */ new Set();
|
|
1546
|
-
for (const market of venueMarkets) {
|
|
1547
|
-
const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
|
|
1548
|
-
for (const outcome of outcomes) {
|
|
1549
|
-
if (prices.has(outcome.id)) {
|
|
1550
|
-
set.add(market.venue);
|
|
1551
|
-
break;
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
return set;
|
|
1556
|
-
}, [venueMarkets, prices, isLoading]);
|
|
1557
|
-
return { tradableVenues, isLoading };
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
1537
|
// src/use-rolling-chart-window.ts
|
|
1561
|
-
import { useEffect as useEffect5, useMemo as
|
|
1538
|
+
import { useEffect as useEffect5, useMemo as useMemo9, useState as useState4 } from "react";
|
|
1562
1539
|
var RANGE_SECONDS_BY_RANGE = {
|
|
1563
1540
|
"1H": 60 * 60,
|
|
1564
1541
|
"6H": 6 * 60 * 60,
|
|
@@ -1589,7 +1566,7 @@ var useRollingChartWindow = (options) => {
|
|
|
1589
1566
|
var _a;
|
|
1590
1567
|
const tickMs = (_a = options.tickMs) != null ? _a : 1e3;
|
|
1591
1568
|
const optionsNowMs = options.nowMs;
|
|
1592
|
-
const nowMs =
|
|
1569
|
+
const nowMs = useMemo9(() => optionsNowMs != null ? optionsNowMs : (() => Date.now()), [optionsNowMs]);
|
|
1593
1570
|
const [nowSec, setNowSec] = useState4(() => Math.floor(nowMs() / 1e3));
|
|
1594
1571
|
useEffect5(() => {
|
|
1595
1572
|
setNowSec(Math.floor(nowMs() / 1e3));
|
|
@@ -1598,7 +1575,7 @@ var useRollingChartWindow = (options) => {
|
|
|
1598
1575
|
}, tickMs);
|
|
1599
1576
|
return () => clearInterval(handle);
|
|
1600
1577
|
}, [tickMs, nowMs]);
|
|
1601
|
-
return
|
|
1578
|
+
return useMemo9(
|
|
1602
1579
|
() => resolveRollingWindow({ range: options.range, nowSec, interval: options.interval }),
|
|
1603
1580
|
[options.range, options.interval, nowSec]
|
|
1604
1581
|
);
|
|
@@ -2111,7 +2088,130 @@ function useMarketSearch(options) {
|
|
|
2111
2088
|
|
|
2112
2089
|
// src/use-smart-route.ts
|
|
2113
2090
|
import { keepPreviousData as keepPreviousData6, useQuery as useQuery6 } from "@tanstack/react-query";
|
|
2091
|
+
|
|
2092
|
+
// src/smart-route-refresh-policy.ts
|
|
2093
|
+
var THIN_SMART_ROUTE_REFETCH_INTERVAL_MS = 5e3;
|
|
2094
|
+
var SMART_ROUTE_REFRESH_DEADLINE_BUFFER_MS = 4e3;
|
|
2095
|
+
var SMART_ROUTE_MIN_REFETCH_INTERVAL_MS = 5e3;
|
|
2096
|
+
var SMART_ROUTE_MAX_REFETCH_INTERVAL_MS = 2e4;
|
|
2097
|
+
var SMART_ROUTE_HIGH_SLIPPAGE_BPS = 75;
|
|
2098
|
+
var SMART_ROUTE_SHALLOW_TOP_LEVEL_RATIO = 0.7;
|
|
2099
|
+
var SMART_ROUTE_DEEP_FILL_LEVEL_COUNT = 3;
|
|
2100
|
+
var LIQUIDITY_CONSTRAINED_STATUSES = /* @__PURE__ */ new Set([
|
|
2101
|
+
"infeasible",
|
|
2102
|
+
"no_orderbooks",
|
|
2103
|
+
"insufficient_depth",
|
|
2104
|
+
"no_bids_above_min_price"
|
|
2105
|
+
]);
|
|
2106
|
+
var THIN_LIQUIDITY_WARNING_PATTERN = /partial(?:[_\s-]?fill)?|insufficient(?:[_\s-]?liquidity|[_\s-]?depth)|shallow|price moved|no active quote path|couldn'?t fill|unable to fill|quote stale|stale/i;
|
|
2107
|
+
var resolveMsUntilIsoTimestamp = (value, nowMs) => {
|
|
2108
|
+
if (!value) return null;
|
|
2109
|
+
const parsedValue = Date.parse(value);
|
|
2110
|
+
if (!Number.isFinite(parsedValue)) return null;
|
|
2111
|
+
return parsedValue - nowMs;
|
|
2112
|
+
};
|
|
2113
|
+
var clampIntervalToRefreshDeadline = ({
|
|
2114
|
+
intervalMs,
|
|
2115
|
+
refreshAt,
|
|
2116
|
+
nowMs
|
|
2117
|
+
}) => {
|
|
2118
|
+
const msUntilRefresh = resolveMsUntilIsoTimestamp(refreshAt, nowMs);
|
|
2119
|
+
if (msUntilRefresh == null || msUntilRefresh <= 0) {
|
|
2120
|
+
return Math.min(
|
|
2121
|
+
SMART_ROUTE_MAX_REFETCH_INTERVAL_MS,
|
|
2122
|
+
Math.max(SMART_ROUTE_MIN_REFETCH_INTERVAL_MS, intervalMs)
|
|
2123
|
+
);
|
|
2124
|
+
}
|
|
2125
|
+
return Math.max(
|
|
2126
|
+
SMART_ROUTE_MIN_REFETCH_INTERVAL_MS,
|
|
2127
|
+
Math.min(SMART_ROUTE_MAX_REFETCH_INTERVAL_MS, intervalMs, Math.floor(msUntilRefresh))
|
|
2128
|
+
);
|
|
2129
|
+
};
|
|
2130
|
+
var assessThinSmartRouteLiquidity = (quote, nowMs = Date.now()) => {
|
|
2131
|
+
var _a, _b;
|
|
2132
|
+
if (!quote) {
|
|
2133
|
+
return {
|
|
2134
|
+
isThin: false,
|
|
2135
|
+
reasons: []
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
const reasons = /* @__PURE__ */ new Set();
|
|
2139
|
+
if (LIQUIDITY_CONSTRAINED_STATUSES.has(quote.status)) {
|
|
2140
|
+
reasons.add("liquidity_status");
|
|
2141
|
+
}
|
|
2142
|
+
if (typeof ((_a = quote.slippage) == null ? void 0 : _a.slippageBps) === "number" && Number.isFinite(quote.slippage.slippageBps) && quote.slippage.slippageBps >= SMART_ROUTE_HIGH_SLIPPAGE_BPS) {
|
|
2143
|
+
reasons.add("high_slippage");
|
|
2144
|
+
}
|
|
2145
|
+
const msUntilRefresh = resolveMsUntilIsoTimestamp(quote.refreshAt, nowMs);
|
|
2146
|
+
if (msUntilRefresh != null && msUntilRefresh <= SMART_ROUTE_REFRESH_DEADLINE_BUFFER_MS) {
|
|
2147
|
+
reasons.add("refresh_due_soon");
|
|
2148
|
+
}
|
|
2149
|
+
const hasShallowTopLevel = quote.fills.some((fill) => {
|
|
2150
|
+
var _a2, _b2;
|
|
2151
|
+
if (fill.fills.length <= 1 || fill.venueQty <= 0) return false;
|
|
2152
|
+
const topLevelSize = (_b2 = (_a2 = fill.fills[0]) == null ? void 0 : _a2.size) != null ? _b2 : 0;
|
|
2153
|
+
if (!Number.isFinite(topLevelSize) || topLevelSize <= 0) return false;
|
|
2154
|
+
return topLevelSize / fill.venueQty < SMART_ROUTE_SHALLOW_TOP_LEVEL_RATIO;
|
|
2155
|
+
});
|
|
2156
|
+
if (hasShallowTopLevel) {
|
|
2157
|
+
reasons.add("shallow_top_level");
|
|
2158
|
+
}
|
|
2159
|
+
const hasDeepFillLevels = quote.fills.some(
|
|
2160
|
+
(fill) => fill.fills.length >= SMART_ROUTE_DEEP_FILL_LEVEL_COUNT
|
|
2161
|
+
);
|
|
2162
|
+
if (hasDeepFillLevels) {
|
|
2163
|
+
reasons.add("deep_fill_levels");
|
|
2164
|
+
}
|
|
2165
|
+
const hasThinWarning = ((_b = quote.warnings) != null ? _b : []).some(
|
|
2166
|
+
(warning) => THIN_LIQUIDITY_WARNING_PATTERN.test(warning.reason)
|
|
2167
|
+
);
|
|
2168
|
+
if (hasThinWarning) {
|
|
2169
|
+
reasons.add("warning_signal");
|
|
2170
|
+
}
|
|
2171
|
+
return {
|
|
2172
|
+
isThin: reasons.size > 0,
|
|
2173
|
+
reasons: [...reasons]
|
|
2174
|
+
};
|
|
2175
|
+
};
|
|
2176
|
+
var resolveSmartRouteRefetchInterval = (args, nowMs = Date.now()) => {
|
|
2177
|
+
const {
|
|
2178
|
+
aggressiveIntervalMs = THIN_SMART_ROUTE_REFETCH_INTERVAL_MS,
|
|
2179
|
+
data,
|
|
2180
|
+
defaultIntervalMs,
|
|
2181
|
+
isDocumentVisible,
|
|
2182
|
+
isEditing = false,
|
|
2183
|
+
isInputValid,
|
|
2184
|
+
isMarketOpen,
|
|
2185
|
+
isPanelActive,
|
|
2186
|
+
isSubmitting,
|
|
2187
|
+
queryEnabled
|
|
2188
|
+
} = args;
|
|
2189
|
+
if (defaultIntervalMs <= 0) return false;
|
|
2190
|
+
const isActivelyViewingQuote = isPanelActive || isEditing;
|
|
2191
|
+
if (!queryEnabled || !isInputValid || !isActivelyViewingQuote || !isMarketOpen || isSubmitting || !isDocumentVisible) {
|
|
2192
|
+
return false;
|
|
2193
|
+
}
|
|
2194
|
+
const defaultInterval = clampIntervalToRefreshDeadline({
|
|
2195
|
+
intervalMs: defaultIntervalMs,
|
|
2196
|
+
refreshAt: data == null ? void 0 : data.refreshAt,
|
|
2197
|
+
nowMs
|
|
2198
|
+
});
|
|
2199
|
+
if (!data) return defaultInterval;
|
|
2200
|
+
const thinLiquidity = assessThinSmartRouteLiquidity(data, nowMs);
|
|
2201
|
+
if (!thinLiquidity.isThin) return defaultInterval;
|
|
2202
|
+
return clampIntervalToRefreshDeadline({
|
|
2203
|
+
intervalMs: aggressiveIntervalMs,
|
|
2204
|
+
refreshAt: data.refreshAt,
|
|
2205
|
+
nowMs
|
|
2206
|
+
});
|
|
2207
|
+
};
|
|
2208
|
+
|
|
2209
|
+
// src/use-smart-route.ts
|
|
2114
2210
|
var SMART_ROUTE_STALE_TIME_MS = 2e4;
|
|
2211
|
+
var getIsDocumentVisible = () => {
|
|
2212
|
+
if (typeof document === "undefined") return true;
|
|
2213
|
+
return document.visibilityState !== "hidden";
|
|
2214
|
+
};
|
|
2115
2215
|
function useSmartRoute(options) {
|
|
2116
2216
|
var _a, _b;
|
|
2117
2217
|
const client = useAggClient();
|
|
@@ -2129,9 +2229,12 @@ function useSmartRoute(options) {
|
|
|
2129
2229
|
compareVenues,
|
|
2130
2230
|
deepEstimate,
|
|
2131
2231
|
enabled = true,
|
|
2132
|
-
staleTimeMs = SMART_ROUTE_STALE_TIME_MS
|
|
2232
|
+
staleTimeMs = SMART_ROUTE_STALE_TIME_MS,
|
|
2233
|
+
refreshContext
|
|
2133
2234
|
} = options;
|
|
2134
2235
|
const resolvedVenueMarketOutcomeId = (_a = venueMarketOutcomeId != null ? venueMarketOutcomeId : venueMarketId) != null ? _a : outcomeId;
|
|
2236
|
+
const hasValidInput = (maxSpend != null ? maxSpend : 0) > 0 || (sellShares != null ? sellShares : 0) > 0;
|
|
2237
|
+
const queryEnabled = enabled && !!resolvedVenueMarketOutcomeId && hasValidInput;
|
|
2135
2238
|
const query = useQuery6({
|
|
2136
2239
|
queryKey: [
|
|
2137
2240
|
"smart-route",
|
|
@@ -2163,11 +2266,25 @@ function useSmartRoute(options) {
|
|
|
2163
2266
|
{ signal }
|
|
2164
2267
|
);
|
|
2165
2268
|
}),
|
|
2166
|
-
enabled:
|
|
2269
|
+
enabled: queryEnabled,
|
|
2167
2270
|
staleTime: staleTimeMs,
|
|
2168
|
-
refetchInterval:
|
|
2271
|
+
refetchInterval: (queryState) => {
|
|
2272
|
+
var _a2, _b2, _c, _d;
|
|
2273
|
+
return resolveSmartRouteRefetchInterval({
|
|
2274
|
+
data: queryState.state.data,
|
|
2275
|
+
defaultIntervalMs: staleTimeMs,
|
|
2276
|
+
isDocumentVisible: getIsDocumentVisible(),
|
|
2277
|
+
isEditing: (_a2 = refreshContext == null ? void 0 : refreshContext.isEditing) != null ? _a2 : false,
|
|
2278
|
+
isInputValid: hasValidInput,
|
|
2279
|
+
isMarketOpen: (_b2 = refreshContext == null ? void 0 : refreshContext.isMarketOpen) != null ? _b2 : true,
|
|
2280
|
+
isPanelActive: (_c = refreshContext == null ? void 0 : refreshContext.isPanelActive) != null ? _c : true,
|
|
2281
|
+
isSubmitting: (_d = refreshContext == null ? void 0 : refreshContext.isSubmitting) != null ? _d : false,
|
|
2282
|
+
queryEnabled
|
|
2283
|
+
});
|
|
2284
|
+
},
|
|
2169
2285
|
gcTime: 6e4,
|
|
2170
2286
|
refetchOnWindowFocus: false,
|
|
2287
|
+
refetchIntervalInBackground: false,
|
|
2171
2288
|
retry: 1,
|
|
2172
2289
|
placeholderData: keepPreviousData6
|
|
2173
2290
|
});
|
|
@@ -2222,7 +2339,7 @@ function useUserHoldings(options) {
|
|
|
2222
2339
|
}
|
|
2223
2340
|
|
|
2224
2341
|
// src/use-enriched-venue-event.ts
|
|
2225
|
-
import { useMemo as
|
|
2342
|
+
import { useMemo as useMemo10 } from "react";
|
|
2226
2343
|
|
|
2227
2344
|
// src/use-venue-event.ts
|
|
2228
2345
|
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
@@ -2252,7 +2369,7 @@ function useVenueEvent(options) {
|
|
|
2252
2369
|
import { QueryClient as QueryClient2, QueryClientContext as QueryClientContext2, useInfiniteQuery as useInfiniteQuery7 } from "@tanstack/react-query";
|
|
2253
2370
|
import { useContext as useContext3, useEffect as useEffect8, useState as useState8 } from "react";
|
|
2254
2371
|
function useVenueMarkets(options) {
|
|
2255
|
-
var _a, _b, _c, _d, _e;
|
|
2372
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2256
2373
|
const client = useContext3(AggClientContext);
|
|
2257
2374
|
const queryClient = useContext3(QueryClientContext2);
|
|
2258
2375
|
const [fallbackQueryClient] = useState8(() => new QueryClient2());
|
|
@@ -2262,10 +2379,16 @@ function useVenueMarkets(options) {
|
|
|
2262
2379
|
const matchStatus = options == null ? void 0 : options.matchStatus;
|
|
2263
2380
|
const status = options == null ? void 0 : options.status;
|
|
2264
2381
|
const categoryIds = options == null ? void 0 : options.categoryIds;
|
|
2382
|
+
const aggKey = options == null ? void 0 : options.aggKey;
|
|
2383
|
+
const sportsMarketType = options == null ? void 0 : options.sportsMarketType;
|
|
2384
|
+
const period = options == null ? void 0 : options.period;
|
|
2385
|
+
const marketCategory = options == null ? void 0 : options.marketCategory;
|
|
2386
|
+
const marketGroup = options == null ? void 0 : options.marketGroup;
|
|
2265
2387
|
const enabled = (_a = options == null ? void 0 : options.enabled) != null ? _a : true;
|
|
2266
2388
|
const limit = (_b = options == null ? void 0 : options.limit) != null ? _b : 20;
|
|
2267
2389
|
const sortBy = options == null ? void 0 : options.sortBy;
|
|
2268
2390
|
const sortDir = options == null ? void 0 : options.sortDir;
|
|
2391
|
+
const context = options == null ? void 0 : options.context;
|
|
2269
2392
|
useEffect8(() => {
|
|
2270
2393
|
if (queryClient) return void 0;
|
|
2271
2394
|
fallbackQueryClient.mount();
|
|
@@ -2286,9 +2409,15 @@ function useVenueMarkets(options) {
|
|
|
2286
2409
|
matchStatus != null ? matchStatus : "",
|
|
2287
2410
|
status != null ? status : "",
|
|
2288
2411
|
(_c = categoryIds == null ? void 0 : categoryIds.join(",")) != null ? _c : "",
|
|
2412
|
+
(_d = aggKey == null ? void 0 : aggKey.join(",")) != null ? _d : "",
|
|
2413
|
+
(_e = sportsMarketType == null ? void 0 : sportsMarketType.join(",")) != null ? _e : "",
|
|
2414
|
+
(_f = period == null ? void 0 : period.join(",")) != null ? _f : "",
|
|
2415
|
+
(_g = marketCategory == null ? void 0 : marketCategory.join(",")) != null ? _g : "",
|
|
2416
|
+
(_h = marketGroup == null ? void 0 : marketGroup.join(",")) != null ? _h : "",
|
|
2289
2417
|
limit,
|
|
2290
2418
|
sortBy != null ? sortBy : "",
|
|
2291
|
-
sortDir != null ? sortDir : ""
|
|
2419
|
+
sortDir != null ? sortDir : "",
|
|
2420
|
+
context != null ? context : ""
|
|
2292
2421
|
],
|
|
2293
2422
|
queryFn: (_0) => __async(null, [_0], function* ({ pageParam }) {
|
|
2294
2423
|
if (!client) {
|
|
@@ -2301,10 +2430,16 @@ function useVenueMarkets(options) {
|
|
|
2301
2430
|
matchStatus,
|
|
2302
2431
|
status,
|
|
2303
2432
|
categoryIds,
|
|
2433
|
+
aggKey,
|
|
2434
|
+
sportsMarketType,
|
|
2435
|
+
period,
|
|
2436
|
+
marketCategory,
|
|
2437
|
+
marketGroup,
|
|
2304
2438
|
limit,
|
|
2305
2439
|
cursor: pageParam,
|
|
2306
2440
|
sortBy,
|
|
2307
|
-
sortDir
|
|
2441
|
+
sortDir,
|
|
2442
|
+
context
|
|
2308
2443
|
});
|
|
2309
2444
|
return res;
|
|
2310
2445
|
}),
|
|
@@ -2318,7 +2453,7 @@ function useVenueMarkets(options) {
|
|
|
2318
2453
|
},
|
|
2319
2454
|
queryClient != null ? queryClient : fallbackQueryClient
|
|
2320
2455
|
);
|
|
2321
|
-
const markets = (
|
|
2456
|
+
const markets = (_j = (_i = query.data) == null ? void 0 : _i.pages.flatMap((page) => page.data)) != null ? _j : [];
|
|
2322
2457
|
const hasNextPage = !!query.hasNextPage;
|
|
2323
2458
|
return __spreadProps(__spreadValues({}, query), {
|
|
2324
2459
|
markets,
|
|
@@ -2330,7 +2465,8 @@ function useVenueMarkets(options) {
|
|
|
2330
2465
|
function mergeEventWithFullMarkets(event, fullMarkets) {
|
|
2331
2466
|
if (fullMarkets.length === 0) return event;
|
|
2332
2467
|
const fullById = new Map(fullMarkets.map((m) => [m.id, m]));
|
|
2333
|
-
const
|
|
2468
|
+
const ordering = event.venueMarkets.length > 0 ? event.venueMarkets : fullMarkets;
|
|
2469
|
+
const mergedMarkets = ordering.map((minimal) => {
|
|
2334
2470
|
var _a;
|
|
2335
2471
|
return (_a = fullById.get(minimal.id)) != null ? _a : minimal;
|
|
2336
2472
|
});
|
|
@@ -2339,14 +2475,18 @@ function mergeEventWithFullMarkets(event, fullMarkets) {
|
|
|
2339
2475
|
function useEnrichedVenueEvent(options) {
|
|
2340
2476
|
var _b;
|
|
2341
2477
|
const _a = useVenueEvent(options), { event, isLoading, error } = _a, rest = __objRest(_a, ["event", "isLoading", "error"]);
|
|
2478
|
+
const eventEndedAt = (event == null ? void 0 : event.endDate) && Number.isFinite(Date.parse(event.endDate)) ? Date.parse(event.endDate) : null;
|
|
2479
|
+
const shouldFetchOnlyOpenMarkets = eventEndedAt == null || eventEndedAt >= Date.now();
|
|
2342
2480
|
const { markets, isLoading: isEnriching } = useVenueMarkets({
|
|
2343
2481
|
venueEventId: options.eventId,
|
|
2344
2482
|
enabled: ((_b = options.enabled) != null ? _b : true) && !!event,
|
|
2345
|
-
status: "open" /* open
|
|
2346
|
-
sortBy:
|
|
2347
|
-
|
|
2483
|
+
status: shouldFetchOnlyOpenMarkets ? "open" /* open */ : void 0
|
|
2484
|
+
// No explicit sortBy: event-scoped /venue-markets sorts by the event's
|
|
2485
|
+
// type-aware order (structureOrderBy). Keeping this in lockstep with
|
|
2486
|
+
// MarketDetailsList preserves the shared React Query cache key and the
|
|
2487
|
+
// event-type ordering.
|
|
2348
2488
|
});
|
|
2349
|
-
const enrichedEvent =
|
|
2489
|
+
const enrichedEvent = useMemo10(() => {
|
|
2350
2490
|
if (!event) return void 0;
|
|
2351
2491
|
if (markets.length === 0) return event;
|
|
2352
2492
|
return mergeEventWithFullMarkets(event, markets);
|
|
@@ -2366,7 +2506,7 @@ import {
|
|
|
2366
2506
|
keepPreviousData as keepPreviousData7,
|
|
2367
2507
|
useInfiniteQuery as useInfiniteQuery8
|
|
2368
2508
|
} from "@tanstack/react-query";
|
|
2369
|
-
import { useContext as useContext4, useEffect as useEffect9, useMemo as
|
|
2509
|
+
import { useContext as useContext4, useEffect as useEffect9, useMemo as useMemo11, useRef as useRef5, useState as useState9 } from "react";
|
|
2370
2510
|
function useVenueEvents(options) {
|
|
2371
2511
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2372
2512
|
const client = useContext4(AggClientContext);
|
|
@@ -2386,6 +2526,7 @@ function useVenueEvents(options) {
|
|
|
2386
2526
|
const minYesPrice = options == null ? void 0 : options.minYesPrice;
|
|
2387
2527
|
const maxYesPrice = options == null ? void 0 : options.maxYesPrice;
|
|
2388
2528
|
const endDateFrom = options == null ? void 0 : options.endDateFrom;
|
|
2529
|
+
const grouped = options == null ? void 0 : options.grouped;
|
|
2389
2530
|
const initialPages = options == null ? void 0 : options.initialPages;
|
|
2390
2531
|
useEffect9(() => {
|
|
2391
2532
|
if (queryClient) return void 0;
|
|
@@ -2412,6 +2553,7 @@ function useVenueEvents(options) {
|
|
|
2412
2553
|
minYesPrice != null ? minYesPrice : "",
|
|
2413
2554
|
maxYesPrice != null ? maxYesPrice : "",
|
|
2414
2555
|
endDateFrom != null ? endDateFrom : "",
|
|
2556
|
+
grouped != null ? grouped : false,
|
|
2415
2557
|
limit
|
|
2416
2558
|
],
|
|
2417
2559
|
queryFn: (_0) => __async(null, [_0], function* ({ pageParam }) {
|
|
@@ -2431,6 +2573,7 @@ function useVenueEvents(options) {
|
|
|
2431
2573
|
minYesPrice,
|
|
2432
2574
|
maxYesPrice,
|
|
2433
2575
|
endDateFrom,
|
|
2576
|
+
grouped,
|
|
2434
2577
|
cursor: pageParam
|
|
2435
2578
|
});
|
|
2436
2579
|
return res;
|
|
@@ -2466,7 +2609,7 @@ function useVenueEvents(options) {
|
|
|
2466
2609
|
query.hasNextPage,
|
|
2467
2610
|
query.fetchNextPage
|
|
2468
2611
|
]);
|
|
2469
|
-
const events =
|
|
2612
|
+
const events = useMemo11(
|
|
2470
2613
|
() => {
|
|
2471
2614
|
var _a2, _b2;
|
|
2472
2615
|
return (_b2 = (_a2 = query.data) == null ? void 0 : _a2.pages.flatMap((page) => page.data)) != null ? _b2 : [];
|
|
@@ -2584,7 +2727,7 @@ var computePriceGaps = ({
|
|
|
2584
2727
|
};
|
|
2585
2728
|
|
|
2586
2729
|
// src/use-viewport-midpoints.ts
|
|
2587
|
-
import { useEffect as useEffect10, useMemo as
|
|
2730
|
+
import { useEffect as useEffect10, useMemo as useMemo12, useRef as useRef6, useState as useState10 } from "react";
|
|
2588
2731
|
var buildOutcomeMidpointMap = (outcomes) => {
|
|
2589
2732
|
const m = /* @__PURE__ */ new Map();
|
|
2590
2733
|
if (!outcomes) return m;
|
|
@@ -2641,7 +2784,7 @@ function useViewportMidpoints(visibleMarkets, options) {
|
|
|
2641
2784
|
const inFlightRef = useRef6(/* @__PURE__ */ new Set());
|
|
2642
2785
|
const visibleRef = useRef6(visibleMarkets);
|
|
2643
2786
|
visibleRef.current = visibleMarkets;
|
|
2644
|
-
const visibleFp =
|
|
2787
|
+
const visibleFp = useMemo12(
|
|
2645
2788
|
() => [...new Set(visibleMarkets.map((m) => m.id))].sort().join("|"),
|
|
2646
2789
|
[visibleMarkets]
|
|
2647
2790
|
);
|
|
@@ -2669,7 +2812,7 @@ function useViewportMidpoints(visibleMarkets, options) {
|
|
|
2669
2812
|
cancelled = true;
|
|
2670
2813
|
};
|
|
2671
2814
|
}, [visibleFp, cache, maxMidpointIdsPerRequest]);
|
|
2672
|
-
const { prices, venueByOutcomeId } =
|
|
2815
|
+
const { prices, venueByOutcomeId } = useMemo12(() => {
|
|
2673
2816
|
var _a2, _b, _c, _d;
|
|
2674
2817
|
const map = /* @__PURE__ */ new Map();
|
|
2675
2818
|
const venueMap = /* @__PURE__ */ new Map();
|
|
@@ -2943,7 +3086,6 @@ export {
|
|
|
2943
3086
|
useSearch,
|
|
2944
3087
|
useSmartRoute,
|
|
2945
3088
|
useSyncBalances,
|
|
2946
|
-
useTradableVenues,
|
|
2947
3089
|
useUserActivity,
|
|
2948
3090
|
useUserHoldings,
|
|
2949
3091
|
useVenueEvent,
|
package/dist/withdraw.js
CHANGED
|
@@ -529,6 +529,8 @@ var enUsLabels = {
|
|
|
529
529
|
showOutcomeAria: (label) => `Show ${label} outcome`,
|
|
530
530
|
viewResolved: "View resolved",
|
|
531
531
|
hideResolved: "Hide resolved",
|
|
532
|
+
resolvingTitle: "Resolving market\u2026",
|
|
533
|
+
resolvingDescription: "This market has closed. We're waiting for final settlement data and will update the result once it's confirmed on-chain.",
|
|
532
534
|
volumeUnavailable: "Volume unavailable",
|
|
533
535
|
tabs: {
|
|
534
536
|
orderBook: "Order Book",
|
|
@@ -847,7 +849,51 @@ var enUsLabels = {
|
|
|
847
849
|
winningOutcome: (label) => `Winning outcome: ${label}`,
|
|
848
850
|
resolvedOutcome: (label) => `Resolved: ${label}`,
|
|
849
851
|
marketDetailsAriaByDate: (dateLabel) => `Market details for ${dateLabel}`,
|
|
850
|
-
marketDetailsAriaByQuestion: (question) => `Market details for ${question}
|
|
852
|
+
marketDetailsAriaByQuestion: (question) => `Market details for ${question}`,
|
|
853
|
+
sports: {
|
|
854
|
+
summaryAria: "Sports event summary",
|
|
855
|
+
sectionTabsAria: "Sports market sections",
|
|
856
|
+
lineSelectorAria: (marketTitle) => `Select line for ${marketTitle}`,
|
|
857
|
+
previousLineAria: (marketTitle) => `Show previous lines for ${marketTitle}`,
|
|
858
|
+
nextLineAria: (marketTitle) => `Show next lines for ${marketTitle}`,
|
|
859
|
+
comparisonToggleAria: (marketTitle, expanded) => `${expanded ? "Hide" : "Show"} venue comparison for ${marketTitle}`,
|
|
860
|
+
comparisonTitle: "Venue alternatives",
|
|
861
|
+
compareVenues: (count) => `Compare ${count} venues`,
|
|
862
|
+
marketCount: (count) => `${count} markets`,
|
|
863
|
+
venueCount: (count) => `${count} venues`,
|
|
864
|
+
volumeShort: "Vol.",
|
|
865
|
+
totalVolumeShort: "Total Vol.",
|
|
866
|
+
gameStarts: "Game starts",
|
|
867
|
+
moreMarketsTitle: "More markets",
|
|
868
|
+
gameLinesTab: "Game Lines",
|
|
869
|
+
halvesTab: "Halves",
|
|
870
|
+
exactScoreTab: "Exact Score",
|
|
871
|
+
cornersTab: "Corners",
|
|
872
|
+
goalsTab: "Goals",
|
|
873
|
+
assistsTab: "Assists",
|
|
874
|
+
shotsTab: "Shots",
|
|
875
|
+
otherTab: "Other",
|
|
876
|
+
moneylineTitle: "Moneyline",
|
|
877
|
+
spreadTitle: "Spreads",
|
|
878
|
+
totalTitle: "Totals",
|
|
879
|
+
fullPeriod: "Regular time",
|
|
880
|
+
firstHalfPeriod: "1st half",
|
|
881
|
+
secondHalfPeriod: "2nd half",
|
|
882
|
+
quarterOnePeriod: "1st quarter",
|
|
883
|
+
quarterTwoPeriod: "2nd quarter",
|
|
884
|
+
quarterThreePeriod: "3rd quarter",
|
|
885
|
+
quarterFourPeriod: "4th quarter",
|
|
886
|
+
overtimePeriod: "Overtime",
|
|
887
|
+
otherPeriod: "Other",
|
|
888
|
+
loadingTitle: "Loading section",
|
|
889
|
+
loadingDescription: "Fetching the latest markets for this game.",
|
|
890
|
+
emptyTitle: "No markets available",
|
|
891
|
+
emptyDescription: (sectionLabel) => `There are no ${sectionLabel} markets yet.`,
|
|
892
|
+
loadMore: "Load more",
|
|
893
|
+
loadingMore: "Loading more",
|
|
894
|
+
bestPriceBadge: "Best price",
|
|
895
|
+
selectOutcomeAria: (marketTitle, outcomeLabel, priceLabel) => `Select ${outcomeLabel} in ${marketTitle} at ${priceLabel}`
|
|
896
|
+
}
|
|
851
897
|
},
|
|
852
898
|
header: {
|
|
853
899
|
bannerAria: "Site header",
|
|
@@ -989,7 +1035,8 @@ var defaultAggUiConfig = {
|
|
|
989
1035
|
showFeesBreakdown: false,
|
|
990
1036
|
enableGradients: false,
|
|
991
1037
|
enableVenueEventDiscoveryFilters: false,
|
|
992
|
-
enableNotifications: true
|
|
1038
|
+
enableNotifications: true,
|
|
1039
|
+
showSportsMarkets: false
|
|
993
1040
|
},
|
|
994
1041
|
market: {
|
|
995
1042
|
arbitrageThreshold: 0,
|
package/dist/withdraw.mjs
CHANGED
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
useWithdrawFlow,
|
|
4
4
|
useWithdrawPreview,
|
|
5
5
|
useWithdrawalLifecycle
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NZEXGOFC.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useDepositAddresses,
|
|
9
9
|
useManagedBalances,
|
|
10
10
|
useWithdrawManaged
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-56RISN73.mjs";
|
|
12
12
|
export {
|
|
13
13
|
useDepositAddresses,
|
|
14
14
|
useManagedBalances,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/hooks",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "React hooks and providers for the AGG prediction market aggregator. Wraps @agg-build/sdk with TanStack Query, shared session state, and live WebSocket data.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"react": "^18.0.0 || ^19.0.0",
|
|
84
84
|
"viem": "^2.0.0",
|
|
85
85
|
"wagmi": "^3.0.0 || ^2.0.0",
|
|
86
|
-
"@agg-build/sdk": "^2.1.
|
|
86
|
+
"@agg-build/sdk": "^2.1.3"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@solana/wallet-adapter-react": {
|