@agg-build/hooks 2.4.6 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-X32MRBHC.mjs → chunk-DP6VYGAX.mjs} +1 -1
- package/dist/{chunk-4IRZFXAC.mjs → chunk-Q4FRCMP6.mjs} +1 -1
- package/dist/{chunk-CAG2RCHR.mjs → chunk-TJRQ55UC.mjs} +239 -46
- package/dist/deposit.js +87 -0
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +209 -4
- package/dist/index.d.ts +209 -4
- package/dist/index.js +467 -132
- package/dist/index.mjs +172 -31
- package/dist/withdraw.js +87 -0
- 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-Q4FRCMP6.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useWithdrawEstimate,
|
|
7
7
|
useWithdrawFlow,
|
|
8
8
|
useWithdrawPreview,
|
|
9
9
|
useWithdrawalLifecycle
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DP6VYGAX.mjs";
|
|
11
11
|
import {
|
|
12
12
|
AggAuthContext,
|
|
13
13
|
AggBalanceProvider,
|
|
@@ -71,6 +71,7 @@ import {
|
|
|
71
71
|
useAggUiConfig,
|
|
72
72
|
useAggWebSocket,
|
|
73
73
|
useAggWebSocketConnectionState,
|
|
74
|
+
useCancelManagedOrder,
|
|
74
75
|
useDepositAddresses,
|
|
75
76
|
useEventListState,
|
|
76
77
|
useEventTradingContext,
|
|
@@ -84,6 +85,7 @@ import {
|
|
|
84
85
|
useOnRedeemEvent,
|
|
85
86
|
useOnWithdrawalLifecycle,
|
|
86
87
|
useOptionalAggClient,
|
|
88
|
+
usePlaceLimitOrder,
|
|
87
89
|
usePositions,
|
|
88
90
|
useQuoteManaged,
|
|
89
91
|
useRedeem,
|
|
@@ -95,7 +97,7 @@ import {
|
|
|
95
97
|
useSyncBalances,
|
|
96
98
|
useWithdrawManaged,
|
|
97
99
|
userActivityQueryKeys
|
|
98
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-TJRQ55UC.mjs";
|
|
99
101
|
|
|
100
102
|
// src/index.ts
|
|
101
103
|
import { QueryClient as QueryClient4, QueryClientProvider, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
@@ -140,13 +142,30 @@ var getVisibleVenueIdsByConfig = (venueIds, disabledVenues) => {
|
|
|
140
142
|
var getVenueAvailabilityState = ({
|
|
141
143
|
venueId,
|
|
142
144
|
disabledVenues,
|
|
145
|
+
isConfigLoading,
|
|
143
146
|
isLocationBlocked
|
|
144
147
|
}) => {
|
|
148
|
+
if (isConfigLoading) return "hidden";
|
|
145
149
|
if (isVenueDisabledByConfig(venueId, disabledVenues)) return "hidden";
|
|
146
150
|
if (isLocationBlocked) return "geoblocked";
|
|
147
151
|
return "available";
|
|
148
152
|
};
|
|
149
153
|
|
|
154
|
+
// src/use-venue-key-status.ts
|
|
155
|
+
import { useQuery } from "@tanstack/react-query";
|
|
156
|
+
var venueKeyQueryKeys = {
|
|
157
|
+
all: ["agg", "venue-keys"],
|
|
158
|
+
status: (venue) => [...venueKeyQueryKeys.all, venue, "status"]
|
|
159
|
+
};
|
|
160
|
+
var useVenueKeyStatus = (venue, enabled = true) => {
|
|
161
|
+
const client = useAggClient();
|
|
162
|
+
return useQuery({
|
|
163
|
+
queryKey: venueKeyQueryKeys.status(venue),
|
|
164
|
+
queryFn: () => client.getVenueKeyStatus(venue),
|
|
165
|
+
enabled
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
|
|
150
169
|
// src/use-agg-auth.ts
|
|
151
170
|
import { useCallback } from "react";
|
|
152
171
|
function useAggAuth(options = {}) {
|
|
@@ -842,7 +861,7 @@ function useEventOrderbookData(venueMarkets, selectedMarketId) {
|
|
|
842
861
|
}
|
|
843
862
|
|
|
844
863
|
// src/use-live-market.ts
|
|
845
|
-
import { useQuery } from "@tanstack/react-query";
|
|
864
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
846
865
|
function outcomeOrderbookToState(response, marketId) {
|
|
847
866
|
var _a, _b, _c, _d;
|
|
848
867
|
const { venue, orderbook, midpoint, spread, seq, checksum, timestamp, venueMarketOutcomeId } = response;
|
|
@@ -892,7 +911,7 @@ function useLiveMarket(canonicalMarketId) {
|
|
|
892
911
|
enabled: isLiveSubscriptionEnabled,
|
|
893
912
|
orderbook: true
|
|
894
913
|
});
|
|
895
|
-
const query =
|
|
914
|
+
const query = useQuery2({
|
|
896
915
|
queryKey: marketDataKeys.live(canonicalMarketId != null ? canonicalMarketId : "__disabled__"),
|
|
897
916
|
queryFn: () => __async(null, null, function* () {
|
|
898
917
|
return createMarketLiveState(canonicalMarketId != null ? canonicalMarketId : "__disabled__");
|
|
@@ -904,7 +923,7 @@ function useLiveMarket(canonicalMarketId) {
|
|
|
904
923
|
isConnected: Boolean(isLiveSubscriptionEnabled && isConnected)
|
|
905
924
|
})
|
|
906
925
|
});
|
|
907
|
-
const seedQuery =
|
|
926
|
+
const seedQuery = useQuery2({
|
|
908
927
|
queryKey: ["live-market-seed", canonicalMarketId],
|
|
909
928
|
queryFn: ({ signal }) => canonicalMarketId ? client.getOutcomeOrderbook(canonicalMarketId, { signal }) : Promise.resolve(null),
|
|
910
929
|
enabled: Boolean(canonicalMarketId),
|
|
@@ -1306,7 +1325,7 @@ function useLiveTrades(canonicalMarketId) {
|
|
|
1306
1325
|
}
|
|
1307
1326
|
|
|
1308
1327
|
// src/use-midpoints.ts
|
|
1309
|
-
import { useQuery as
|
|
1328
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
1310
1329
|
import { useMemo as useMemo8 } from "react";
|
|
1311
1330
|
var normalizeVenueMarketIds = (venueMarkets) => {
|
|
1312
1331
|
var _a;
|
|
@@ -1485,7 +1504,7 @@ function useMidpoints(venueMarkets, options) {
|
|
|
1485
1504
|
() => resolveBestMidpointCandidateOutcomeIds(venueMarkets),
|
|
1486
1505
|
[venueMarkets]
|
|
1487
1506
|
);
|
|
1488
|
-
const { data, isLoading } =
|
|
1507
|
+
const { data, isLoading } = useQuery3({
|
|
1489
1508
|
queryKey: ["midpoints", ids, maxMidpointIdsPerRequest],
|
|
1490
1509
|
queryFn: () => client.getMidpoints(ids, { bestPrice: true, maxMidpointIdsPerRequest }),
|
|
1491
1510
|
enabled: ids.length > 0,
|
|
@@ -1775,7 +1794,7 @@ function useArbFeed() {
|
|
|
1775
1794
|
}
|
|
1776
1795
|
|
|
1777
1796
|
// src/use-order-book.ts
|
|
1778
|
-
import { keepPreviousData as keepPreviousData3, useQuery as
|
|
1797
|
+
import { keepPreviousData as keepPreviousData3, useQuery as useQuery4 } from "@tanstack/react-query";
|
|
1779
1798
|
function useOrderBook(options) {
|
|
1780
1799
|
const client = useAggClient();
|
|
1781
1800
|
const { orderbooks, enabled = true, canonicalMarketId } = options;
|
|
@@ -1788,7 +1807,7 @@ function useOrderBook(options) {
|
|
|
1788
1807
|
venueMarketOutcomeId: outcome.id
|
|
1789
1808
|
})) : void 0
|
|
1790
1809
|
});
|
|
1791
|
-
const batchedResult =
|
|
1810
|
+
const batchedResult = useQuery4({
|
|
1792
1811
|
queryKey: requestedVenueMarketIds.length ? ["orderbooks", requestedVenueMarketIds, null] : ["orderbooks", "__disabled__", null],
|
|
1793
1812
|
queryFn: ({ signal }) => client.getOrderbooks(
|
|
1794
1813
|
{
|
|
@@ -1856,7 +1875,7 @@ function useOrderBook(options) {
|
|
|
1856
1875
|
}
|
|
1857
1876
|
|
|
1858
1877
|
// src/use-orderbook-quote.ts
|
|
1859
|
-
import { keepPreviousData as keepPreviousData4, useQuery as
|
|
1878
|
+
import { keepPreviousData as keepPreviousData4, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
1860
1879
|
var QUOTE_DEBOUNCE_MS = 300;
|
|
1861
1880
|
var createUnavailableOrderbookError = (message, code, retryable) => {
|
|
1862
1881
|
const error = new Error(message);
|
|
@@ -1918,7 +1937,7 @@ function useOrderbookQuote(options) {
|
|
|
1918
1937
|
const { marketId, side, size, enabled = true } = options;
|
|
1919
1938
|
const debouncedSize = useDebouncedValue(size, QUOTE_DEBOUNCE_MS);
|
|
1920
1939
|
const shouldFetch = enabled && !!marketId && debouncedSize > 0;
|
|
1921
|
-
const query =
|
|
1940
|
+
const query = useQuery5({
|
|
1922
1941
|
queryKey: marketId ? marketDataKeys.orderbookQuote(marketId, side, debouncedSize) : ["market-data", "orderbook-quote", "__disabled__"],
|
|
1923
1942
|
queryFn: () => __async(null, null, function* () {
|
|
1924
1943
|
var _a2, _b, _c, _d;
|
|
@@ -1960,12 +1979,12 @@ function useOrderbookQuote(options) {
|
|
|
1960
1979
|
}
|
|
1961
1980
|
|
|
1962
1981
|
// src/use-orders.ts
|
|
1963
|
-
import { useQuery as
|
|
1982
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
1964
1983
|
function useOrders(options = {}) {
|
|
1965
1984
|
var _a, _b, _c, _d;
|
|
1966
1985
|
const client = useAggClient();
|
|
1967
1986
|
const { userId, status, limit = 50, offset = 0, enabled = true } = options;
|
|
1968
|
-
const query =
|
|
1987
|
+
const query = useQuery6({
|
|
1969
1988
|
queryKey: ["orders", userId != null ? userId : "me", status != null ? status : "all", limit, offset],
|
|
1970
1989
|
queryFn: () => client.getOrders({
|
|
1971
1990
|
userId,
|
|
@@ -2148,7 +2167,7 @@ function useMarketSearch(options) {
|
|
|
2148
2167
|
}
|
|
2149
2168
|
|
|
2150
2169
|
// src/use-smart-route.ts
|
|
2151
|
-
import { keepPreviousData as keepPreviousData6, useQuery as
|
|
2170
|
+
import { keepPreviousData as keepPreviousData6, useQuery as useQuery7 } from "@tanstack/react-query";
|
|
2152
2171
|
|
|
2153
2172
|
// src/smart-route-refresh-policy.ts
|
|
2154
2173
|
var THIN_SMART_ROUTE_REFETCH_INTERVAL_MS = 5e3;
|
|
@@ -2274,7 +2293,7 @@ var getIsDocumentVisible = () => {
|
|
|
2274
2293
|
return document.visibilityState !== "hidden";
|
|
2275
2294
|
};
|
|
2276
2295
|
function useSmartRoute(options) {
|
|
2277
|
-
var _a, _b;
|
|
2296
|
+
var _a, _b, _c, _d;
|
|
2278
2297
|
const client = useAggClient();
|
|
2279
2298
|
const {
|
|
2280
2299
|
venueMarketOutcomeId,
|
|
@@ -2288,6 +2307,7 @@ function useSmartRoute(options) {
|
|
|
2288
2307
|
chainBalances,
|
|
2289
2308
|
slipCapBps,
|
|
2290
2309
|
compareVenues,
|
|
2310
|
+
sellCacheScope,
|
|
2291
2311
|
deepEstimate,
|
|
2292
2312
|
enabled = true,
|
|
2293
2313
|
staleTimeMs = SMART_ROUTE_STALE_TIME_MS,
|
|
@@ -2296,7 +2316,7 @@ function useSmartRoute(options) {
|
|
|
2296
2316
|
const resolvedVenueMarketOutcomeId = (_a = venueMarketOutcomeId != null ? venueMarketOutcomeId : venueMarketId) != null ? _a : outcomeId;
|
|
2297
2317
|
const hasValidInput = (maxSpend != null ? maxSpend : 0) > 0 || (sellShares != null ? sellShares : 0) > 0;
|
|
2298
2318
|
const queryEnabled = enabled && !!resolvedVenueMarketOutcomeId && hasValidInput;
|
|
2299
|
-
const query =
|
|
2319
|
+
const query = useQuery7({
|
|
2300
2320
|
queryKey: [
|
|
2301
2321
|
"smart-route",
|
|
2302
2322
|
resolvedVenueMarketOutcomeId,
|
|
@@ -2308,7 +2328,8 @@ function useSmartRoute(options) {
|
|
|
2308
2328
|
chainBalances ? JSON.stringify(chainBalances) : null,
|
|
2309
2329
|
slipCapBps != null ? slipCapBps : null,
|
|
2310
2330
|
compareVenues != null ? compareVenues : false,
|
|
2311
|
-
deepEstimate != null ? deepEstimate : false
|
|
2331
|
+
deepEstimate != null ? deepEstimate : false,
|
|
2332
|
+
...tradeSide === "sell" ? [(_b = sellCacheScope == null ? void 0 : sellCacheScope.accountId) != null ? _b : null, (_c = sellCacheScope == null ? void 0 : sellCacheScope.positionVersion) != null ? _c : null] : []
|
|
2312
2333
|
],
|
|
2313
2334
|
queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
|
|
2314
2335
|
return client.getSmartRoute(
|
|
@@ -2330,7 +2351,7 @@ function useSmartRoute(options) {
|
|
|
2330
2351
|
enabled: queryEnabled,
|
|
2331
2352
|
staleTime: staleTimeMs,
|
|
2332
2353
|
refetchInterval: (queryState) => {
|
|
2333
|
-
var _a2, _b2,
|
|
2354
|
+
var _a2, _b2, _c2, _d2;
|
|
2334
2355
|
return resolveSmartRouteRefetchInterval({
|
|
2335
2356
|
data: queryState.state.data,
|
|
2336
2357
|
defaultIntervalMs: staleTimeMs,
|
|
@@ -2338,8 +2359,8 @@ function useSmartRoute(options) {
|
|
|
2338
2359
|
isEditing: (_a2 = refreshContext == null ? void 0 : refreshContext.isEditing) != null ? _a2 : false,
|
|
2339
2360
|
isInputValid: hasValidInput,
|
|
2340
2361
|
isMarketOpen: (_b2 = refreshContext == null ? void 0 : refreshContext.isMarketOpen) != null ? _b2 : true,
|
|
2341
|
-
isPanelActive: (
|
|
2342
|
-
isSubmitting: (
|
|
2362
|
+
isPanelActive: (_c2 = refreshContext == null ? void 0 : refreshContext.isPanelActive) != null ? _c2 : true,
|
|
2363
|
+
isSubmitting: (_d2 = refreshContext == null ? void 0 : refreshContext.isSubmitting) != null ? _d2 : false,
|
|
2343
2364
|
queryEnabled
|
|
2344
2365
|
});
|
|
2345
2366
|
},
|
|
@@ -2347,7 +2368,11 @@ function useSmartRoute(options) {
|
|
|
2347
2368
|
refetchOnWindowFocus: false,
|
|
2348
2369
|
refetchIntervalInBackground: false,
|
|
2349
2370
|
retry: 1,
|
|
2350
|
-
|
|
2371
|
+
// A previous SELL quote can carry a quoteId and position availability for
|
|
2372
|
+
// a different amount or position snapshot. Never expose it under a new
|
|
2373
|
+
// sell key while the replacement request is in flight. BUY retains the
|
|
2374
|
+
// existing no-flicker behavior.
|
|
2375
|
+
placeholderData: tradeSide === "sell" ? void 0 : keepPreviousData6
|
|
2351
2376
|
});
|
|
2352
2377
|
const error = query.error;
|
|
2353
2378
|
let loadingReason = null;
|
|
@@ -2359,7 +2384,7 @@ function useSmartRoute(options) {
|
|
|
2359
2384
|
}
|
|
2360
2385
|
}
|
|
2361
2386
|
return {
|
|
2362
|
-
data: (
|
|
2387
|
+
data: (_d = query.data) != null ? _d : null,
|
|
2363
2388
|
isLoading: query.isLoading,
|
|
2364
2389
|
isFetching: query.isFetching,
|
|
2365
2390
|
error: error instanceof Error ? error : error ? new Error(String(error)) : null,
|
|
@@ -2368,6 +2393,117 @@ function useSmartRoute(options) {
|
|
|
2368
2393
|
};
|
|
2369
2394
|
}
|
|
2370
2395
|
|
|
2396
|
+
// src/use-venue-sell-quotes.ts
|
|
2397
|
+
import { useQueries as useQueries6 } from "@tanstack/react-query";
|
|
2398
|
+
var getIsDocumentVisible2 = () => {
|
|
2399
|
+
if (typeof document === "undefined") return true;
|
|
2400
|
+
return document.visibilityState !== "hidden";
|
|
2401
|
+
};
|
|
2402
|
+
var getUniqueVenueRequests = (requests) => {
|
|
2403
|
+
const requestsByVenue = /* @__PURE__ */ new Map();
|
|
2404
|
+
for (const request of requests) {
|
|
2405
|
+
if (request.requestedSellShares <= 0 || request.sellShares <= 0 || request.availableShares <= 0) {
|
|
2406
|
+
continue;
|
|
2407
|
+
}
|
|
2408
|
+
if (requestsByVenue.has(request.venue)) continue;
|
|
2409
|
+
requestsByVenue.set(request.venue, request);
|
|
2410
|
+
}
|
|
2411
|
+
return [...requestsByVenue.values()].sort((left, right) => left.venue.localeCompare(right.venue));
|
|
2412
|
+
};
|
|
2413
|
+
var useVenueSellQuotes = (options) => {
|
|
2414
|
+
var _a, _b;
|
|
2415
|
+
const client = useAggClient();
|
|
2416
|
+
const {
|
|
2417
|
+
venueMarketOutcomeId,
|
|
2418
|
+
accountId,
|
|
2419
|
+
positionVersion,
|
|
2420
|
+
requests,
|
|
2421
|
+
mode,
|
|
2422
|
+
slipCapBps,
|
|
2423
|
+
enabled = true,
|
|
2424
|
+
staleTimeMs = SMART_ROUTE_STALE_TIME_MS,
|
|
2425
|
+
refreshContext
|
|
2426
|
+
} = options;
|
|
2427
|
+
const uniqueRequests = getUniqueVenueRequests(requests);
|
|
2428
|
+
const queries = useQueries6({
|
|
2429
|
+
queries: uniqueRequests.map((request) => {
|
|
2430
|
+
const hasValidInput = request.requestedSellShares > 0 && request.sellShares > 0 && request.availableShares > 0;
|
|
2431
|
+
const queryEnabled = enabled && !!venueMarketOutcomeId && !!accountId && hasValidInput;
|
|
2432
|
+
return {
|
|
2433
|
+
queryKey: [
|
|
2434
|
+
"smart-route",
|
|
2435
|
+
venueMarketOutcomeId,
|
|
2436
|
+
"venue-sell",
|
|
2437
|
+
{
|
|
2438
|
+
accountId: accountId != null ? accountId : null,
|
|
2439
|
+
positionVersion: positionVersion != null ? positionVersion : null,
|
|
2440
|
+
requestedSellShares: request.requestedSellShares,
|
|
2441
|
+
sellShares: request.sellShares,
|
|
2442
|
+
availableShares: request.availableShares,
|
|
2443
|
+
allowedVenues: [request.venue],
|
|
2444
|
+
compareVenues: false,
|
|
2445
|
+
tradeSide: "sell",
|
|
2446
|
+
mode: mode != null ? mode : null,
|
|
2447
|
+
slipCapBps: slipCapBps != null ? slipCapBps : null
|
|
2448
|
+
}
|
|
2449
|
+
],
|
|
2450
|
+
queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
|
|
2451
|
+
return client.getSmartRoute(
|
|
2452
|
+
__spreadProps(__spreadValues({
|
|
2453
|
+
venueMarketOutcomeId,
|
|
2454
|
+
tradeSide: "sell"
|
|
2455
|
+
}, mode ? { mode } : {}), {
|
|
2456
|
+
sellShares: request.sellShares,
|
|
2457
|
+
slipCapBps,
|
|
2458
|
+
allowedVenues: [request.venue]
|
|
2459
|
+
}),
|
|
2460
|
+
{ signal }
|
|
2461
|
+
);
|
|
2462
|
+
}),
|
|
2463
|
+
enabled: queryEnabled,
|
|
2464
|
+
staleTime: staleTimeMs,
|
|
2465
|
+
refetchInterval: (queryState) => {
|
|
2466
|
+
var _a2, _b2, _c, _d;
|
|
2467
|
+
return resolveSmartRouteRefetchInterval({
|
|
2468
|
+
data: queryState.state.data,
|
|
2469
|
+
defaultIntervalMs: staleTimeMs,
|
|
2470
|
+
isDocumentVisible: getIsDocumentVisible2(),
|
|
2471
|
+
isEditing: (_a2 = refreshContext == null ? void 0 : refreshContext.isEditing) != null ? _a2 : false,
|
|
2472
|
+
isInputValid: hasValidInput,
|
|
2473
|
+
isMarketOpen: (_b2 = refreshContext == null ? void 0 : refreshContext.isMarketOpen) != null ? _b2 : true,
|
|
2474
|
+
isPanelActive: (_c = refreshContext == null ? void 0 : refreshContext.isPanelActive) != null ? _c : true,
|
|
2475
|
+
isSubmitting: (_d = refreshContext == null ? void 0 : refreshContext.isSubmitting) != null ? _d : false,
|
|
2476
|
+
queryEnabled
|
|
2477
|
+
});
|
|
2478
|
+
},
|
|
2479
|
+
gcTime: 6e4,
|
|
2480
|
+
refetchOnWindowFocus: false,
|
|
2481
|
+
refetchIntervalInBackground: false,
|
|
2482
|
+
retry: 1
|
|
2483
|
+
};
|
|
2484
|
+
})
|
|
2485
|
+
});
|
|
2486
|
+
const quotes = queries.map((query, index) => {
|
|
2487
|
+
var _a2;
|
|
2488
|
+
const queryError = query.error;
|
|
2489
|
+
return {
|
|
2490
|
+
request: uniqueRequests[index],
|
|
2491
|
+
data: (_a2 = query.data) != null ? _a2 : null,
|
|
2492
|
+
isLoading: query.isLoading,
|
|
2493
|
+
isFetching: query.isFetching,
|
|
2494
|
+
error: queryError instanceof Error ? queryError : queryError ? new Error(String(queryError)) : null,
|
|
2495
|
+
refetch: query.refetch
|
|
2496
|
+
};
|
|
2497
|
+
});
|
|
2498
|
+
return {
|
|
2499
|
+
quotes,
|
|
2500
|
+
isLoading: quotes.some((quote) => quote.isLoading),
|
|
2501
|
+
isFetching: quotes.some((quote) => quote.isFetching),
|
|
2502
|
+
error: (_b = (_a = quotes.find((quote) => quote.error)) == null ? void 0 : _a.error) != null ? _b : null,
|
|
2503
|
+
refetch: () => Promise.all(quotes.map((quote) => quote.refetch()))
|
|
2504
|
+
};
|
|
2505
|
+
};
|
|
2506
|
+
|
|
2371
2507
|
// src/use-user-holdings.ts
|
|
2372
2508
|
import { useInfiniteQuery as useInfiniteQuery6 } from "@tanstack/react-query";
|
|
2373
2509
|
function useUserHoldings(options) {
|
|
@@ -2403,7 +2539,7 @@ function useUserHoldings(options) {
|
|
|
2403
2539
|
import { useMemo as useMemo10 } from "react";
|
|
2404
2540
|
|
|
2405
2541
|
// src/use-venue-event.ts
|
|
2406
|
-
import { useQuery as
|
|
2542
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
2407
2543
|
var RESOLUTION_POLL_MS = 15e3;
|
|
2408
2544
|
var RESOLUTION_POLL_MAX_PAST_END_MS = 60 * 6e4;
|
|
2409
2545
|
function resolutionPollInterval(event) {
|
|
@@ -2421,7 +2557,7 @@ function useVenueEvent(options) {
|
|
|
2421
2557
|
var _a;
|
|
2422
2558
|
const client = useAggClient();
|
|
2423
2559
|
const { eventId, enabled = true } = options;
|
|
2424
|
-
const query =
|
|
2560
|
+
const query = useQuery8({
|
|
2425
2561
|
queryKey: ["venue-event", eventId],
|
|
2426
2562
|
queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
|
|
2427
2563
|
return client.getVenueEventById(eventId, { signal });
|
|
@@ -2712,7 +2848,7 @@ function useVenueEvents(options) {
|
|
|
2712
2848
|
}
|
|
2713
2849
|
|
|
2714
2850
|
// src/use-venue-market-midpoints.ts
|
|
2715
|
-
import { keepPreviousData as keepPreviousData8, useQuery as
|
|
2851
|
+
import { keepPreviousData as keepPreviousData8, useQuery as useQuery9 } from "@tanstack/react-query";
|
|
2716
2852
|
var normalizeVenueMarketIds2 = (venueMarketIds) => {
|
|
2717
2853
|
return [
|
|
2718
2854
|
...new Set(venueMarketIds.map((venueMarketId) => venueMarketId.trim()).filter(Boolean))
|
|
@@ -2751,7 +2887,7 @@ function useVenueMarketMidpoints(options) {
|
|
|
2751
2887
|
const enabled = (_a = options.enabled) != null ? _a : true;
|
|
2752
2888
|
const requestedVenueMarketIds = normalizeVenueMarketIds2(options.venueMarketIds);
|
|
2753
2889
|
const maxMidpointIdsPerRequest = (_b = options.maxMidpointIdsPerRequest) != null ? _b : configuredMaxMidpointIdsPerRequest;
|
|
2754
|
-
const query =
|
|
2890
|
+
const query = useQuery9({
|
|
2755
2891
|
queryKey: requestedVenueMarketIds.length ? ["venue-market-midpoints", requestedVenueMarketIds, maxMidpointIdsPerRequest] : ["venue-market-midpoints", "__disabled__"],
|
|
2756
2892
|
queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
|
|
2757
2893
|
if (requestedVenueMarketIds.length === 0) {
|
|
@@ -3018,12 +3154,12 @@ function useVisibleIds(options = {}) {
|
|
|
3018
3154
|
}
|
|
3019
3155
|
|
|
3020
3156
|
// src/use-app-config.ts
|
|
3021
|
-
import { useQuery as
|
|
3157
|
+
import { useQuery as useQuery10, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
3022
3158
|
var FIVE_MINUTES = 5 * 60 * 1e3;
|
|
3023
3159
|
var APP_CONFIG_QUERY_KEY = ["agg", "app-config"];
|
|
3024
3160
|
function useAppConfig() {
|
|
3025
3161
|
const client = useAggClient();
|
|
3026
|
-
const query =
|
|
3162
|
+
const query = useQuery10({
|
|
3027
3163
|
queryKey: APP_CONFIG_QUERY_KEY,
|
|
3028
3164
|
queryFn: () => client.getAppConfig(),
|
|
3029
3165
|
staleTime: FIVE_MINUTES
|
|
@@ -3036,7 +3172,7 @@ function useAppConfig() {
|
|
|
3036
3172
|
}
|
|
3037
3173
|
function useCachedAppConfig() {
|
|
3038
3174
|
const queryClient = useQueryClient2();
|
|
3039
|
-
const query =
|
|
3175
|
+
const query = useQuery10({
|
|
3040
3176
|
queryKey: APP_CONFIG_QUERY_KEY,
|
|
3041
3177
|
enabled: false,
|
|
3042
3178
|
initialData: () => queryClient.getQueryData(APP_CONFIG_QUERY_KEY),
|
|
@@ -3132,6 +3268,7 @@ export {
|
|
|
3132
3268
|
useAppConfig,
|
|
3133
3269
|
useArbFeed,
|
|
3134
3270
|
useCachedAppConfig,
|
|
3271
|
+
useCancelManagedOrder,
|
|
3135
3272
|
useCategories,
|
|
3136
3273
|
useCategoryChildren,
|
|
3137
3274
|
useDebouncedValue,
|
|
@@ -3171,6 +3308,7 @@ export {
|
|
|
3171
3308
|
useOrderBook,
|
|
3172
3309
|
useOrderbookQuote,
|
|
3173
3310
|
useOrders,
|
|
3311
|
+
usePlaceLimitOrder,
|
|
3174
3312
|
usePositions,
|
|
3175
3313
|
useQueryClient3 as useQueryClient,
|
|
3176
3314
|
useQuoteManaged,
|
|
@@ -3190,8 +3328,10 @@ export {
|
|
|
3190
3328
|
useUserHoldings,
|
|
3191
3329
|
useVenueEvent,
|
|
3192
3330
|
useVenueEvents,
|
|
3331
|
+
useVenueKeyStatus,
|
|
3193
3332
|
useVenueMarketMidpoints,
|
|
3194
3333
|
useVenueMarkets,
|
|
3334
|
+
useVenueSellQuotes,
|
|
3195
3335
|
useViewportMidpoints,
|
|
3196
3336
|
useVisibleIds,
|
|
3197
3337
|
useWithdrawEstimate,
|
|
@@ -3199,5 +3339,6 @@ export {
|
|
|
3199
3339
|
useWithdrawManaged,
|
|
3200
3340
|
useWithdrawPreview,
|
|
3201
3341
|
useWithdrawalLifecycle,
|
|
3202
|
-
userActivityQueryKeys
|
|
3342
|
+
userActivityQueryKeys,
|
|
3343
|
+
venueKeyQueryKeys
|
|
3203
3344
|
};
|
package/dist/withdraw.js
CHANGED
|
@@ -330,8 +330,16 @@ var enUsLabels = {
|
|
|
330
330
|
categoryTabsAria: "Home page category tabs"
|
|
331
331
|
},
|
|
332
332
|
userProfile: {
|
|
333
|
+
tabs: {
|
|
334
|
+
positions: "Positions",
|
|
335
|
+
openOrders: "Open orders",
|
|
336
|
+
activity: "Activity"
|
|
337
|
+
},
|
|
333
338
|
balance: {
|
|
334
339
|
availableBalance: "Available Balance",
|
|
340
|
+
reservedForOpenOrders: (amount) => `${amount} reserved for open orders`,
|
|
341
|
+
positionsValue: "Positions Value",
|
|
342
|
+
kalshiBalance: "Kalshi Balance",
|
|
335
343
|
balanceByNetwork: "Balance by network",
|
|
336
344
|
paperModeNetwork: "Paper",
|
|
337
345
|
paperModeWarning: "Paper mode is enabled. These are simulated funds for paper trading.",
|
|
@@ -414,6 +422,25 @@ var enUsLabels = {
|
|
|
414
422
|
avgPrefix: "avg",
|
|
415
423
|
nowPrefix: "now",
|
|
416
424
|
finalPrefix: "final"
|
|
425
|
+
},
|
|
426
|
+
openOrders: {
|
|
427
|
+
marketHeader: "Market",
|
|
428
|
+
limitPriceHeader: "Limit price",
|
|
429
|
+
filledHeader: "Filled",
|
|
430
|
+
totalHeader: "Total",
|
|
431
|
+
filledShort: "Filled",
|
|
432
|
+
totalShort: "Total",
|
|
433
|
+
expirationHeader: "Expiration",
|
|
434
|
+
goodTilCanceled: "Good 'til canceled",
|
|
435
|
+
expired: "Expired",
|
|
436
|
+
cancel: "Cancel",
|
|
437
|
+
cancelOrderAria: (orderId) => `Cancel order ${orderId}`,
|
|
438
|
+
loading: "Loading open orders",
|
|
439
|
+
loadingMore: "Loading more open orders",
|
|
440
|
+
errorTitle: "Unable to load open orders",
|
|
441
|
+
errorDescription: "Please try again in a moment.",
|
|
442
|
+
emptyTitle: "No open orders",
|
|
443
|
+
emptyDescription: "Your open limit orders will appear here."
|
|
417
444
|
}
|
|
418
445
|
},
|
|
419
446
|
eventList: {
|
|
@@ -647,6 +674,24 @@ var enUsLabels = {
|
|
|
647
674
|
noBidsAboveMinPrice: "No venue bids above the minimum price.",
|
|
648
675
|
signInToTrade: "Sign in to trade",
|
|
649
676
|
deposit: "Deposit",
|
|
677
|
+
addFundsToKalshi: "Add funds to Kalshi",
|
|
678
|
+
fundKalshiModal: {
|
|
679
|
+
ariaLabel: "Fund your Kalshi account",
|
|
680
|
+
title: "Fund Your Kalshi Account",
|
|
681
|
+
description: "Kalshi manages its own account balances, so funds can't be deposited through agg.market. Add funds directly in Kalshi, then return here to trade with your updated balance.",
|
|
682
|
+
howItWorks: "How it works",
|
|
683
|
+
kalshiLinkLabel: "Kalshi",
|
|
684
|
+
kalshiUrl: "https://kalshi.com",
|
|
685
|
+
firstStepPrefix: "Go to",
|
|
686
|
+
firstStepSuffix: "and sign in to your account.",
|
|
687
|
+
remainingSteps: [
|
|
688
|
+
"Click Add Funds.",
|
|
689
|
+
"Complete your deposit using your preferred payment method.",
|
|
690
|
+
"Return here - your Kalshi balance will be available automatically."
|
|
691
|
+
],
|
|
692
|
+
doItLater: "I'll do it later",
|
|
693
|
+
done: "Done"
|
|
694
|
+
},
|
|
650
695
|
kycRequired: "Verify to trade Kalshi",
|
|
651
696
|
kycNotVerifiedTooltip: "You have not been verified yet",
|
|
652
697
|
kycVerify: "Verify Identity",
|
|
@@ -657,8 +702,35 @@ var enUsLabels = {
|
|
|
657
702
|
kycSuccessTitle: "Verification successful",
|
|
658
703
|
kycSuccessDescription: "Your identity has been confirmed and you now have full access to trade on Kalshi markets.",
|
|
659
704
|
kycSuccessDone: "Done",
|
|
705
|
+
connectKalshi: "Connect to trade Kalshi",
|
|
706
|
+
tradingAccessVenues: "Venues",
|
|
707
|
+
tradingAccessAvailable: "Available",
|
|
708
|
+
tradingAccessAddKalshiAccount: "Add Kalshi Account",
|
|
660
709
|
outcome: (label) => `Outcome: ${label}`,
|
|
661
710
|
smartRouting: "Smart Routing",
|
|
711
|
+
orderTypeMarket: "Market",
|
|
712
|
+
orderTypeLimit: "Limit",
|
|
713
|
+
orderTypeAria: "Order type",
|
|
714
|
+
limitPrice: "Limit price",
|
|
715
|
+
limitPriceInputAria: "Limit price in cents",
|
|
716
|
+
limitPriceInvalid: "Limit price must be greater than 0 and less than 100.",
|
|
717
|
+
limitPriceDecreaseAria: "Decrease limit price",
|
|
718
|
+
limitPriceIncreaseAria: "Increase limit price",
|
|
719
|
+
expiration: "Expiration",
|
|
720
|
+
expirationGoodTilCanceled: "Good 'til canceled",
|
|
721
|
+
expirationFiveMinutes: "5m",
|
|
722
|
+
expirationOneHour: "1h",
|
|
723
|
+
expirationEndOfDay: "End of day (EST)",
|
|
724
|
+
expirationCustom: "Custom",
|
|
725
|
+
expirationMenuAria: "Choose expiration",
|
|
726
|
+
expirationOptions: "Expiration options",
|
|
727
|
+
expirationDateAria: "Limit order expiration date",
|
|
728
|
+
expirationStartTime: "Start time",
|
|
729
|
+
expirationStartTimeHint: "24-hour format",
|
|
730
|
+
expirationCancel: "Cancel",
|
|
731
|
+
expirationApply: "Apply",
|
|
732
|
+
limitOrderPlacedTitle: "Limit order placed",
|
|
733
|
+
limitOrderPlacedDescription: "Your limit order has been submitted.",
|
|
662
734
|
orderSplitting: "Order Splitting",
|
|
663
735
|
splitOrderDescription: "We split your order for the best price:",
|
|
664
736
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
@@ -825,6 +897,11 @@ var enUsLabels = {
|
|
|
825
897
|
cancel: "Cancel",
|
|
826
898
|
verifyConnection: "Verify Connection"
|
|
827
899
|
},
|
|
900
|
+
success: {
|
|
901
|
+
title: "Kalshi Account Connected",
|
|
902
|
+
description: "Your Kalshi account is now connected to AGG. You can start trading Kalshi markets.",
|
|
903
|
+
done: "Done"
|
|
904
|
+
},
|
|
828
905
|
fallbackError: "Verification failed. Please check your credentials and try again."
|
|
829
906
|
}
|
|
830
907
|
},
|
|
@@ -874,6 +951,9 @@ var enUsLabels = {
|
|
|
874
951
|
moreMarketsTitle: "More markets",
|
|
875
952
|
gameLinesTab: "Game Lines",
|
|
876
953
|
halvesTab: "Halves",
|
|
954
|
+
quartersTab: "Quarters",
|
|
955
|
+
setsTab: "Sets",
|
|
956
|
+
playerPropsTab: "Player Props",
|
|
877
957
|
exactScoreTab: "Exact Score",
|
|
878
958
|
cornersTab: "Corners",
|
|
879
959
|
goalsTab: "Goals",
|
|
@@ -924,6 +1004,12 @@ var enUsLabels = {
|
|
|
924
1004
|
const venue = venueLabel ? ` on ${venueLabel}` : "";
|
|
925
1005
|
return `${action}${amount}${price}${venue}`.trim();
|
|
926
1006
|
},
|
|
1007
|
+
cancelledTitle: "Order canceled",
|
|
1008
|
+
cancelledMessage: "Your open order was canceled.",
|
|
1009
|
+
cancelPendingTitle: "Cancellation submitted",
|
|
1010
|
+
cancelPendingMessage: "Your cancellation request is being processed.",
|
|
1011
|
+
cancelFailedTitle: "Cancellation failed",
|
|
1012
|
+
cancelFailedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your open order could not be canceled. Please try again.",
|
|
927
1013
|
failedTitle: "Order failed",
|
|
928
1014
|
failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your order could not be completed. Please try again."
|
|
929
1015
|
},
|
|
@@ -1043,6 +1129,7 @@ var defaultAggUiConfig = {
|
|
|
1043
1129
|
enableGradients: false,
|
|
1044
1130
|
enableVenueEventDiscoveryFilters: false,
|
|
1045
1131
|
enableNotifications: true,
|
|
1132
|
+
showLimitOrders: false,
|
|
1046
1133
|
showSportsMarkets: false
|
|
1047
1134
|
},
|
|
1048
1135
|
market: {
|
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-DP6VYGAX.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useDepositAddresses,
|
|
9
9
|
useManagedBalances,
|
|
10
10
|
useWithdrawManaged
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TJRQ55UC.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.
|
|
3
|
+
"version": "2.6.0",
|
|
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.
|
|
86
|
+
"@agg-build/sdk": "^2.5.1"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@solana/wallet-adapter-react": {
|