@agg-build/hooks 4.7.3 → 4.9.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-TXHUUPRD.mjs → chunk-25XGLYBT.mjs} +972 -821
- package/dist/{chunk-M5EQG5G3.mjs → chunk-5EXR5PKK.mjs} +1 -1
- package/dist/{chunk-IY5SCAR3.mjs → chunk-PUI2EGWE.mjs} +1 -1
- package/dist/deposit.js +54 -1
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +205 -5
- package/dist/index.d.ts +205 -5
- package/dist/index.js +649 -457
- package/dist/index.mjs +128 -84
- package/dist/withdraw.js +58 -1
- 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-PUI2EGWE.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useWithdrawEstimate,
|
|
7
7
|
useWithdrawFlow,
|
|
8
8
|
useWithdrawPreview,
|
|
9
9
|
useWithdrawalLifecycle
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5EXR5PKK.mjs";
|
|
11
11
|
import {
|
|
12
12
|
AggAuthContext,
|
|
13
13
|
AggBalanceProvider,
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
__objRest,
|
|
29
29
|
__spreadProps,
|
|
30
30
|
__spreadValues,
|
|
31
|
+
appConfigQueryKey,
|
|
31
32
|
applyOrderbookDepth,
|
|
32
33
|
computeClosedPositionTotals,
|
|
33
34
|
createMarketChartData,
|
|
@@ -71,7 +72,9 @@ import {
|
|
|
71
72
|
useAggUiConfig,
|
|
72
73
|
useAggWebSocket,
|
|
73
74
|
useAggWebSocketConnectionState,
|
|
75
|
+
useAppConfig,
|
|
74
76
|
useBalanceRefillPolicies,
|
|
77
|
+
useCachedAppConfig,
|
|
75
78
|
useCancelManagedOrder,
|
|
76
79
|
useDepositAddresses,
|
|
77
80
|
useEventListState,
|
|
@@ -92,15 +95,16 @@ import {
|
|
|
92
95
|
useRedeemEligibleCount,
|
|
93
96
|
useRedeemLifecycle,
|
|
94
97
|
useRedeemLifecycles,
|
|
98
|
+
useResolvedExecutionMode,
|
|
95
99
|
useSdkLabels,
|
|
96
100
|
useSdkUiConfig,
|
|
97
101
|
useSyncBalances,
|
|
98
102
|
useWithdrawManaged,
|
|
99
103
|
userActivityQueryKeys
|
|
100
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-25XGLYBT.mjs";
|
|
101
105
|
|
|
102
106
|
// src/index.ts
|
|
103
|
-
import { QueryClient as QueryClient4, QueryClientProvider, useQueryClient as
|
|
107
|
+
import { QueryClient as QueryClient4, QueryClientProvider, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
104
108
|
import { TurnstileChallengeError } from "@agg-build/sdk";
|
|
105
109
|
|
|
106
110
|
// src/use-geo-block.ts
|
|
@@ -166,8 +170,42 @@ var useVenueKeyStatus = (venue, enabled = true) => {
|
|
|
166
170
|
});
|
|
167
171
|
};
|
|
168
172
|
|
|
169
|
-
// src/use-
|
|
173
|
+
// src/use-shared-kyc.ts
|
|
170
174
|
import { useCallback } from "react";
|
|
175
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
176
|
+
var sharedKycQueryKeys = {
|
|
177
|
+
status: (userId) => ["agg", "shared-kyc", userId]
|
|
178
|
+
};
|
|
179
|
+
var useSharedKyc = () => {
|
|
180
|
+
var _a, _b;
|
|
181
|
+
const client = useAggClient();
|
|
182
|
+
const { isAuthenticated, user } = useAggAuthContext();
|
|
183
|
+
const userId = (_a = user == null ? void 0 : user.id) != null ? _a : null;
|
|
184
|
+
const query = useQuery2({
|
|
185
|
+
queryKey: sharedKycQueryKeys.status(userId),
|
|
186
|
+
queryFn: () => client.getSharedKycStatus(),
|
|
187
|
+
enabled: isAuthenticated && userId !== null,
|
|
188
|
+
staleTime: 15e3,
|
|
189
|
+
retry: false
|
|
190
|
+
});
|
|
191
|
+
const { refetch } = query;
|
|
192
|
+
const refreshStatus = useCallback(() => __async(null, null, function* () {
|
|
193
|
+
var _a2;
|
|
194
|
+
if (!isAuthenticated || !userId) return "unverified";
|
|
195
|
+
const result = yield refetch({ cancelRefetch: false });
|
|
196
|
+
if (result.error) throw result.error;
|
|
197
|
+
return ((_a2 = result.data) == null ? void 0 : _a2.verified) === true ? "verified" : "unverified";
|
|
198
|
+
}), [isAuthenticated, userId, refetch]);
|
|
199
|
+
const initiateVerification = useCallback(
|
|
200
|
+
({ venue, redirectUri }) => client.initiateKyc(venue, redirectUri),
|
|
201
|
+
[client]
|
|
202
|
+
);
|
|
203
|
+
const status = !isAuthenticated ? "unverified" : !userId || query.isPending ? "loading" : ((_b = query.data) == null ? void 0 : _b.verified) === true ? "verified" : "unverified";
|
|
204
|
+
return { status, refreshStatus, initiateVerification };
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// src/use-agg-auth.ts
|
|
208
|
+
import { useCallback as useCallback2 } from "react";
|
|
171
209
|
function useAggAuth(options = {}) {
|
|
172
210
|
const {
|
|
173
211
|
isAuthenticated,
|
|
@@ -177,7 +215,7 @@ function useAggAuth(options = {}) {
|
|
|
177
215
|
signIn: signInWithProvider,
|
|
178
216
|
signOut
|
|
179
217
|
} = useAggAuthContext();
|
|
180
|
-
const signIn =
|
|
218
|
+
const signIn = useCallback2(
|
|
181
219
|
(statement) => __async(null, null, function* () {
|
|
182
220
|
if (!options.signMessage) {
|
|
183
221
|
throw new Error(
|
|
@@ -201,7 +239,7 @@ function useAggAuth(options = {}) {
|
|
|
201
239
|
}
|
|
202
240
|
|
|
203
241
|
// src/use-link-account.ts
|
|
204
|
-
import { useCallback as
|
|
242
|
+
import { useCallback as useCallback3, useState } from "react";
|
|
205
243
|
function useLinkAccount() {
|
|
206
244
|
const client = useAggClient();
|
|
207
245
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -215,11 +253,11 @@ function useLinkAccount() {
|
|
|
215
253
|
throw err;
|
|
216
254
|
}).finally(() => setIsLoading(false));
|
|
217
255
|
};
|
|
218
|
-
const startLink =
|
|
256
|
+
const startLink = useCallback3(
|
|
219
257
|
(body) => run(() => client.linkAccount(body)),
|
|
220
258
|
[client]
|
|
221
259
|
);
|
|
222
|
-
const confirmLink =
|
|
260
|
+
const confirmLink = useCallback3(
|
|
223
261
|
(input) => run(() => client.linkAccountConfirm(input)),
|
|
224
262
|
[client]
|
|
225
263
|
);
|
|
@@ -436,13 +474,13 @@ function useUserActivity(options = {}) {
|
|
|
436
474
|
}
|
|
437
475
|
|
|
438
476
|
// src/use-external-id.ts
|
|
439
|
-
import { useCallback as
|
|
477
|
+
import { useCallback as useCallback4, useState as useState3 } from "react";
|
|
440
478
|
function useExternalId(options = {}) {
|
|
441
479
|
const client = useAggClient();
|
|
442
480
|
const { onSuccess, onError: onErrorCb } = options;
|
|
443
481
|
const [isLoading, setIsLoading] = useState3(false);
|
|
444
482
|
const [error, setError] = useState3(null);
|
|
445
|
-
const linkExternalId =
|
|
483
|
+
const linkExternalId = useCallback4(
|
|
446
484
|
(assertion) => __async(null, null, function* () {
|
|
447
485
|
setIsLoading(true);
|
|
448
486
|
setError(null);
|
|
@@ -494,7 +532,7 @@ function useExecutionPositions(options = {}) {
|
|
|
494
532
|
}
|
|
495
533
|
|
|
496
534
|
// src/use-live-candle-overlay.ts
|
|
497
|
-
import { useCallback as
|
|
535
|
+
import { useCallback as useCallback5, useMemo as useMemo4 } from "react";
|
|
498
536
|
|
|
499
537
|
// src/use-live-candles.ts
|
|
500
538
|
import { useMemo as useMemo3 } from "react";
|
|
@@ -801,7 +839,7 @@ function useLiveCandleOverlay(options) {
|
|
|
801
839
|
startTs,
|
|
802
840
|
endTs
|
|
803
841
|
});
|
|
804
|
-
const scaleCandle =
|
|
842
|
+
const scaleCandle = useCallback5(
|
|
805
843
|
(candle) => ({
|
|
806
844
|
time: candle.time,
|
|
807
845
|
open: candle.o * scale,
|
|
@@ -864,7 +902,7 @@ function useEventOrderbookData(venueMarkets, selectedMarketId) {
|
|
|
864
902
|
}
|
|
865
903
|
|
|
866
904
|
// src/use-live-market.ts
|
|
867
|
-
import { useQuery as
|
|
905
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
868
906
|
function outcomeOrderbookToState(response, marketId) {
|
|
869
907
|
var _a, _b, _c, _d;
|
|
870
908
|
const { venue, orderbook, midpoint, spread, seq, checksum, timestamp, venueMarketOutcomeId } = response;
|
|
@@ -914,7 +952,7 @@ function useLiveMarket(canonicalMarketId) {
|
|
|
914
952
|
enabled: isLiveSubscriptionEnabled,
|
|
915
953
|
orderbook: true
|
|
916
954
|
});
|
|
917
|
-
const query =
|
|
955
|
+
const query = useQuery3({
|
|
918
956
|
queryKey: marketDataKeys.live(canonicalMarketId != null ? canonicalMarketId : "__disabled__"),
|
|
919
957
|
queryFn: () => __async(null, null, function* () {
|
|
920
958
|
return createMarketLiveState(canonicalMarketId != null ? canonicalMarketId : "__disabled__");
|
|
@@ -926,7 +964,7 @@ function useLiveMarket(canonicalMarketId) {
|
|
|
926
964
|
isConnected: Boolean(isLiveSubscriptionEnabled && isConnected)
|
|
927
965
|
})
|
|
928
966
|
});
|
|
929
|
-
const seedQuery =
|
|
967
|
+
const seedQuery = useQuery3({
|
|
930
968
|
queryKey: ["live-market-seed", canonicalMarketId],
|
|
931
969
|
queryFn: ({ signal }) => canonicalMarketId ? client.getOutcomeOrderbook(canonicalMarketId, { signal }) : Promise.resolve(null),
|
|
932
970
|
enabled: Boolean(canonicalMarketId),
|
|
@@ -1325,7 +1363,7 @@ function useLiveTrades(canonicalMarketId) {
|
|
|
1325
1363
|
}
|
|
1326
1364
|
|
|
1327
1365
|
// src/use-midpoints.ts
|
|
1328
|
-
import { useQuery as
|
|
1366
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
1329
1367
|
import { useMemo as useMemo8 } from "react";
|
|
1330
1368
|
var normalizeVenueMarketIds = (venueMarkets) => {
|
|
1331
1369
|
var _a;
|
|
@@ -1504,7 +1542,7 @@ function useMidpoints(venueMarkets, options) {
|
|
|
1504
1542
|
() => resolveBestMidpointCandidateOutcomeIds(venueMarkets),
|
|
1505
1543
|
[venueMarkets]
|
|
1506
1544
|
);
|
|
1507
|
-
const { data, isLoading } =
|
|
1545
|
+
const { data, isLoading } = useQuery4({
|
|
1508
1546
|
queryKey: ["midpoints", ids, maxMidpointIdsPerRequest],
|
|
1509
1547
|
queryFn: () => client.getMidpoints(ids, { bestPrice: true, maxMidpointIdsPerRequest }),
|
|
1510
1548
|
enabled: ids.length > 0,
|
|
@@ -1798,7 +1836,7 @@ function useArbFeed() {
|
|
|
1798
1836
|
}
|
|
1799
1837
|
|
|
1800
1838
|
// src/use-order-book.ts
|
|
1801
|
-
import { keepPreviousData as keepPreviousData3, useQuery as
|
|
1839
|
+
import { keepPreviousData as keepPreviousData3, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
1802
1840
|
function useOrderBook(options) {
|
|
1803
1841
|
const client = useAggClient();
|
|
1804
1842
|
const { orderbooks, enabled = true, canonicalMarketId } = options;
|
|
@@ -1811,7 +1849,7 @@ function useOrderBook(options) {
|
|
|
1811
1849
|
venueMarketOutcomeId: outcome.id
|
|
1812
1850
|
})) : void 0
|
|
1813
1851
|
});
|
|
1814
|
-
const batchedResult =
|
|
1852
|
+
const batchedResult = useQuery5({
|
|
1815
1853
|
queryKey: requestedVenueMarketIds.length ? ["orderbooks", requestedVenueMarketIds, null] : ["orderbooks", "__disabled__", null],
|
|
1816
1854
|
queryFn: ({ signal }) => client.getOrderbooks(
|
|
1817
1855
|
{
|
|
@@ -1879,7 +1917,7 @@ function useOrderBook(options) {
|
|
|
1879
1917
|
}
|
|
1880
1918
|
|
|
1881
1919
|
// src/use-orderbook-quote.ts
|
|
1882
|
-
import { keepPreviousData as keepPreviousData4, useQuery as
|
|
1920
|
+
import { keepPreviousData as keepPreviousData4, useQuery as useQuery6 } from "@tanstack/react-query";
|
|
1883
1921
|
var QUOTE_DEBOUNCE_MS = 300;
|
|
1884
1922
|
var createUnavailableOrderbookError = (message, code, retryable) => {
|
|
1885
1923
|
const error = new Error(message);
|
|
@@ -1941,7 +1979,7 @@ function useOrderbookQuote(options) {
|
|
|
1941
1979
|
const { marketId, side, size, enabled = true } = options;
|
|
1942
1980
|
const debouncedSize = useDebouncedValue(size, QUOTE_DEBOUNCE_MS);
|
|
1943
1981
|
const shouldFetch = enabled && !!marketId && debouncedSize > 0;
|
|
1944
|
-
const query =
|
|
1982
|
+
const query = useQuery6({
|
|
1945
1983
|
queryKey: marketId ? marketDataKeys.orderbookQuote(marketId, side, debouncedSize) : ["market-data", "orderbook-quote", "__disabled__"],
|
|
1946
1984
|
queryFn: () => __async(null, null, function* () {
|
|
1947
1985
|
var _a2, _b, _c, _d;
|
|
@@ -1983,12 +2021,12 @@ function useOrderbookQuote(options) {
|
|
|
1983
2021
|
}
|
|
1984
2022
|
|
|
1985
2023
|
// src/use-orders.ts
|
|
1986
|
-
import { useQuery as
|
|
2024
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
1987
2025
|
function useOrders(options = {}) {
|
|
1988
2026
|
var _a, _b, _c, _d;
|
|
1989
2027
|
const client = useAggClient();
|
|
1990
2028
|
const { userId, status, limit = 50, offset = 0, enabled = true } = options;
|
|
1991
|
-
const query =
|
|
2029
|
+
const query = useQuery7({
|
|
1992
2030
|
queryKey: ["orders", userId != null ? userId : "me", status != null ? status : "all", limit, offset],
|
|
1993
2031
|
queryFn: () => client.getOrders({
|
|
1994
2032
|
userId,
|
|
@@ -2082,7 +2120,7 @@ function useSearch(options) {
|
|
|
2082
2120
|
}
|
|
2083
2121
|
|
|
2084
2122
|
// src/use-market-search.ts
|
|
2085
|
-
import { useCallback as
|
|
2123
|
+
import { useCallback as useCallback6, useState as useState7 } from "react";
|
|
2086
2124
|
function useMarketSearch(options) {
|
|
2087
2125
|
var _a;
|
|
2088
2126
|
const {
|
|
@@ -2118,10 +2156,10 @@ function useMarketSearch(options) {
|
|
|
2118
2156
|
enabled: submittedQ.length > 0,
|
|
2119
2157
|
deep: true
|
|
2120
2158
|
});
|
|
2121
|
-
const setQuery =
|
|
2159
|
+
const setQuery = useCallback6((value) => {
|
|
2122
2160
|
setQueryState(value);
|
|
2123
2161
|
}, []);
|
|
2124
|
-
const submit =
|
|
2162
|
+
const submit = useCallback6(
|
|
2125
2163
|
(q) => {
|
|
2126
2164
|
const target = (q != null ? q : query).trim();
|
|
2127
2165
|
if (target.length === 0) return;
|
|
@@ -2129,7 +2167,7 @@ function useMarketSearch(options) {
|
|
|
2129
2167
|
},
|
|
2130
2168
|
[query]
|
|
2131
2169
|
);
|
|
2132
|
-
const clear =
|
|
2170
|
+
const clear = useCallback6(() => {
|
|
2133
2171
|
setQueryState("");
|
|
2134
2172
|
setSubmittedQuery(null);
|
|
2135
2173
|
}, []);
|
|
@@ -2171,7 +2209,7 @@ function useMarketSearch(options) {
|
|
|
2171
2209
|
}
|
|
2172
2210
|
|
|
2173
2211
|
// src/use-smart-route.ts
|
|
2174
|
-
import { keepPreviousData as keepPreviousData6, useQuery as
|
|
2212
|
+
import { keepPreviousData as keepPreviousData6, useQuery as useQuery8 } from "@tanstack/react-query";
|
|
2175
2213
|
|
|
2176
2214
|
// src/smart-route-refresh-policy.ts
|
|
2177
2215
|
var THIN_SMART_ROUTE_REFETCH_INTERVAL_MS = 5e3;
|
|
@@ -2321,7 +2359,7 @@ function useSmartRoute(options) {
|
|
|
2321
2359
|
const resolvedVenueMarketOutcomeId = (_a = venueMarketOutcomeId != null ? venueMarketOutcomeId : venueMarketId) != null ? _a : outcomeId;
|
|
2322
2360
|
const hasValidInput = (maxSpend != null ? maxSpend : 0) > 0 || (sellShares != null ? sellShares : 0) > 0;
|
|
2323
2361
|
const queryEnabled = enabled && !!resolvedVenueMarketOutcomeId && hasValidInput;
|
|
2324
|
-
const query =
|
|
2362
|
+
const query = useQuery8({
|
|
2325
2363
|
queryKey: [
|
|
2326
2364
|
"smart-route",
|
|
2327
2365
|
resolvedVenueMarketOutcomeId,
|
|
@@ -2402,7 +2440,7 @@ function useSmartRoute(options) {
|
|
|
2402
2440
|
}
|
|
2403
2441
|
|
|
2404
2442
|
// src/use-limit-order-venue-quotes.ts
|
|
2405
|
-
import { keepPreviousData as keepPreviousData7, useQueries as useQueries6, useQuery as
|
|
2443
|
+
import { keepPreviousData as keepPreviousData7, useQueries as useQueries6, useQuery as useQuery9 } from "@tanstack/react-query";
|
|
2406
2444
|
var getIsDocumentVisible2 = () => {
|
|
2407
2445
|
if (typeof document === "undefined") return true;
|
|
2408
2446
|
return document.visibilityState !== "hidden";
|
|
@@ -2457,7 +2495,7 @@ var useLimitOrderVenueQuotes = (options) => {
|
|
|
2457
2495
|
const hasRequiredAccount = tradeSide === "buy" || Boolean(accountId);
|
|
2458
2496
|
const queryEnabled = enabled && hasValidInput && hasRequiredAccount;
|
|
2459
2497
|
const serializedChainBalances = chainBalances ? JSON.stringify(chainBalances) : null;
|
|
2460
|
-
const tickMetadataQuery =
|
|
2498
|
+
const tickMetadataQuery = useQuery9({
|
|
2461
2499
|
queryKey: ["orderbooks", marketId != null ? marketId : "__disabled__", "limit-order-ticks"],
|
|
2462
2500
|
queryFn: ({ signal }) => client.getOrderbooks({ venueMarketIds: [marketId] }, { signal }),
|
|
2463
2501
|
enabled: enabled && Boolean(marketId),
|
|
@@ -2696,10 +2734,10 @@ function useUserHoldings(options) {
|
|
|
2696
2734
|
import { useMemo as useMemo10 } from "react";
|
|
2697
2735
|
|
|
2698
2736
|
// src/use-venue-event.ts
|
|
2699
|
-
import { useQuery as
|
|
2737
|
+
import { useQuery as useQuery11 } from "@tanstack/react-query";
|
|
2700
2738
|
|
|
2701
2739
|
// src/use-recurring-crypto-markets.ts
|
|
2702
|
-
import { useQuery as
|
|
2740
|
+
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
2703
2741
|
var RESOLVING_POLL_INTERVAL_MS = 15e3;
|
|
2704
2742
|
var FALLBACK_VENUE_EVENT_PAGE_LIMIT = 100;
|
|
2705
2743
|
var FALLBACK_VENUE_EVENT_MAX_PAGES = 5;
|
|
@@ -3193,7 +3231,7 @@ var useRecurringCryptoMarkets = ({
|
|
|
3193
3231
|
const client = useAggClient();
|
|
3194
3232
|
const identity = event ? resolveRecurringCryptoIdentity(event) : null;
|
|
3195
3233
|
const isEnabled = enabled && event != null && identity != null;
|
|
3196
|
-
const query =
|
|
3234
|
+
const query = useQuery10({
|
|
3197
3235
|
queryKey: [
|
|
3198
3236
|
"recurring-crypto-markets",
|
|
3199
3237
|
event == null ? void 0 : event.id,
|
|
@@ -3255,7 +3293,7 @@ function useVenueEvent(options) {
|
|
|
3255
3293
|
var _a;
|
|
3256
3294
|
const client = useAggClient();
|
|
3257
3295
|
const { eventId, enabled = true, cluster } = options;
|
|
3258
|
-
const query =
|
|
3296
|
+
const query = useQuery11({
|
|
3259
3297
|
queryKey: ["venue-event", eventId, cluster === false ? "no-cluster" : ""],
|
|
3260
3298
|
queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
|
|
3261
3299
|
return client.getVenueEventById(eventId, { signal, cluster });
|
|
@@ -3561,7 +3599,7 @@ function useVenueEvents(options) {
|
|
|
3561
3599
|
}
|
|
3562
3600
|
|
|
3563
3601
|
// src/use-sports-live.ts
|
|
3564
|
-
import { useQuery as
|
|
3602
|
+
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
3565
3603
|
var SPORTS_LIVE_POLL_INTERVAL_MS = 5e3;
|
|
3566
3604
|
var SPORTS_SCHEDULED_POLL_INTERVAL_MS = 3e4;
|
|
3567
3605
|
var sportsLiveQueryKey = (sortedEventIds) => ["sports-live", ...sortedEventIds];
|
|
@@ -3581,7 +3619,7 @@ var useSportsLive = (eventIds, enabled = true) => {
|
|
|
3581
3619
|
const sortedEventIds = [
|
|
3582
3620
|
...new Set(eventIds.map((eventId) => eventId.trim()).filter(Boolean))
|
|
3583
3621
|
].sort();
|
|
3584
|
-
const query =
|
|
3622
|
+
const query = useQuery12({
|
|
3585
3623
|
queryKey: sportsLiveQueryKey(sortedEventIds),
|
|
3586
3624
|
queryFn: ({ signal }) => client.getSportsLive(sortedEventIds, { signal }),
|
|
3587
3625
|
enabled: enabled && sortedEventIds.length > 0,
|
|
@@ -3601,7 +3639,7 @@ var useSportsLive = (eventIds, enabled = true) => {
|
|
|
3601
3639
|
};
|
|
3602
3640
|
|
|
3603
3641
|
// src/use-venue-market-midpoints.ts
|
|
3604
|
-
import { keepPreviousData as keepPreviousData9, useQuery as
|
|
3642
|
+
import { keepPreviousData as keepPreviousData9, useQuery as useQuery13 } from "@tanstack/react-query";
|
|
3605
3643
|
var normalizeVenueMarketIds2 = (venueMarketIds) => {
|
|
3606
3644
|
return [
|
|
3607
3645
|
...new Set(venueMarketIds.map((venueMarketId) => venueMarketId.trim()).filter(Boolean))
|
|
@@ -3640,7 +3678,7 @@ function useVenueMarketMidpoints(options) {
|
|
|
3640
3678
|
const enabled = (_a = options.enabled) != null ? _a : true;
|
|
3641
3679
|
const requestedVenueMarketIds = normalizeVenueMarketIds2(options.venueMarketIds);
|
|
3642
3680
|
const maxMidpointIdsPerRequest = (_b = options.maxMidpointIdsPerRequest) != null ? _b : configuredMaxMidpointIdsPerRequest;
|
|
3643
|
-
const query =
|
|
3681
|
+
const query = useQuery13({
|
|
3644
3682
|
queryKey: requestedVenueMarketIds.length ? ["venue-market-midpoints", requestedVenueMarketIds, maxMidpointIdsPerRequest] : ["venue-market-midpoints", "__disabled__"],
|
|
3645
3683
|
queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
|
|
3646
3684
|
if (requestedVenueMarketIds.length === 0) {
|
|
@@ -3834,7 +3872,7 @@ function useViewportMidpoints(visibleMarkets, options) {
|
|
|
3834
3872
|
}
|
|
3835
3873
|
|
|
3836
3874
|
// src/use-visible-ids.ts
|
|
3837
|
-
import { useCallback as
|
|
3875
|
+
import { useCallback as useCallback7, useEffect as useEffect11, useRef as useRef7, useState as useState11 } from "react";
|
|
3838
3876
|
function useVisibleIds(options = {}) {
|
|
3839
3877
|
const { rootMargin = "0px", threshold = 0 } = options;
|
|
3840
3878
|
const [visibleIds, setVisibleIds] = useState11(() => /* @__PURE__ */ new Set());
|
|
@@ -3874,7 +3912,7 @@ function useVisibleIds(options = {}) {
|
|
|
3874
3912
|
observerRef.current = null;
|
|
3875
3913
|
};
|
|
3876
3914
|
}, [rootMargin, threshold]);
|
|
3877
|
-
const register =
|
|
3915
|
+
const register = useCallback7((id) => {
|
|
3878
3916
|
const existing = callbackRefsRef.current.get(id);
|
|
3879
3917
|
if (existing) return existing;
|
|
3880
3918
|
const callback = (el) => {
|
|
@@ -3906,48 +3944,49 @@ function useVisibleIds(options = {}) {
|
|
|
3906
3944
|
return { visibleIds, register };
|
|
3907
3945
|
}
|
|
3908
3946
|
|
|
3909
|
-
// src/use-
|
|
3910
|
-
import {
|
|
3911
|
-
var
|
|
3912
|
-
var
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
const query = useQuery13({
|
|
3929
|
-
queryKey: APP_CONFIG_QUERY_KEY,
|
|
3930
|
-
enabled: false,
|
|
3931
|
-
initialData: () => queryClient.getQueryData(APP_CONFIG_QUERY_KEY),
|
|
3932
|
-
staleTime: FIVE_MINUTES
|
|
3933
|
-
});
|
|
3934
|
-
return toAppConfigResult({
|
|
3935
|
-
data: query.data,
|
|
3936
|
-
isLoading: query.isLoading,
|
|
3937
|
-
error: query.error
|
|
3938
|
-
});
|
|
3939
|
-
}
|
|
3940
|
-
var toAppConfigResult = (query) => {
|
|
3941
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3942
|
-
return {
|
|
3943
|
-
disabledVenues: (_b = (_a = query.data) == null ? void 0 : _a.disabledVenues) != null ? _b : [],
|
|
3944
|
-
disabledCategoryPresets: (_d = (_c = query.data) == null ? void 0 : _c.disabledCategoryPresets) != null ? _d : [],
|
|
3945
|
-
earlyAccessEnabled: (_f = (_e = query.data) == null ? void 0 : _e.earlyAccessEnabled) != null ? _f : false,
|
|
3946
|
-
authOptions: (_h = (_g = query.data) == null ? void 0 : _g.authOptions) != null ? _h : [],
|
|
3947
|
-
isLoading: query.isLoading,
|
|
3948
|
-
error: query.error
|
|
3949
|
-
};
|
|
3947
|
+
// src/use-paper-onboarding.ts
|
|
3948
|
+
import { useCallback as useCallback8, useEffect as useEffect12, useState as useState12 } from "react";
|
|
3949
|
+
var STORAGE_KEY = "agg_paper_onboarding_seen";
|
|
3950
|
+
var isBrowser = () => typeof window !== "undefined" && "localStorage" in window;
|
|
3951
|
+
var seenKey = (userId) => `${STORAGE_KEY}:${userId}`;
|
|
3952
|
+
var hasSeen = (userId) => {
|
|
3953
|
+
if (!isBrowser()) return false;
|
|
3954
|
+
try {
|
|
3955
|
+
return window.localStorage.getItem(seenKey(userId)) === "1";
|
|
3956
|
+
} catch (e) {
|
|
3957
|
+
return true;
|
|
3958
|
+
}
|
|
3959
|
+
};
|
|
3960
|
+
var markSeen = (userId) => {
|
|
3961
|
+
if (!isBrowser()) return;
|
|
3962
|
+
try {
|
|
3963
|
+
window.localStorage.setItem(seenKey(userId), "1");
|
|
3964
|
+
} catch (e) {
|
|
3965
|
+
}
|
|
3950
3966
|
};
|
|
3967
|
+
function usePaperOnboarding() {
|
|
3968
|
+
const { isPaperMode, isResolving } = useResolvedExecutionMode();
|
|
3969
|
+
const { isAuthenticated, user } = useAggAuthContext();
|
|
3970
|
+
const userId = user == null ? void 0 : user.id;
|
|
3971
|
+
const [dismissed, setDismissed] = useState12(false);
|
|
3972
|
+
const [seen, setSeen] = useState12(null);
|
|
3973
|
+
useEffect12(() => {
|
|
3974
|
+
if (!userId) {
|
|
3975
|
+
setSeen(null);
|
|
3976
|
+
return;
|
|
3977
|
+
}
|
|
3978
|
+
setSeen(hasSeen(userId));
|
|
3979
|
+
}, [userId]);
|
|
3980
|
+
useEffect12(() => {
|
|
3981
|
+
setDismissed(false);
|
|
3982
|
+
}, [userId]);
|
|
3983
|
+
const dismiss = useCallback8(() => {
|
|
3984
|
+
setDismissed(true);
|
|
3985
|
+
if (userId) markSeen(userId);
|
|
3986
|
+
}, [userId]);
|
|
3987
|
+
const isOpen = isPaperMode && !isResolving && isAuthenticated && Boolean(userId) && seen === false && !dismissed;
|
|
3988
|
+
return { isOpen, dismiss };
|
|
3989
|
+
}
|
|
3951
3990
|
export {
|
|
3952
3991
|
AUTH_CHOOSER_OPEN_EVENT,
|
|
3953
3992
|
AggBalanceProvider,
|
|
@@ -3971,6 +4010,7 @@ export {
|
|
|
3971
4010
|
TradeSide,
|
|
3972
4011
|
TurnstileChallengeError,
|
|
3973
4012
|
Venue,
|
|
4013
|
+
appConfigQueryKey,
|
|
3974
4014
|
buildLiveBestPriceCandidates,
|
|
3975
4015
|
computeClosedPositionTotals,
|
|
3976
4016
|
computePriceGaps,
|
|
@@ -4012,6 +4052,7 @@ export {
|
|
|
4012
4052
|
resolveRecurringCryptoTimeline,
|
|
4013
4053
|
resolveRollingWindow,
|
|
4014
4054
|
resolveTradingStateKind,
|
|
4055
|
+
sharedKycQueryKeys,
|
|
4015
4056
|
sortVenues,
|
|
4016
4057
|
sportsLiveQueryKey,
|
|
4017
4058
|
sportsLiveRefetchInterval,
|
|
@@ -4072,9 +4113,10 @@ export {
|
|
|
4072
4113
|
useOrderBook,
|
|
4073
4114
|
useOrderbookQuote,
|
|
4074
4115
|
useOrders,
|
|
4116
|
+
usePaperOnboarding,
|
|
4075
4117
|
usePlaceLimitOrder,
|
|
4076
4118
|
usePositions,
|
|
4077
|
-
|
|
4119
|
+
useQueryClient2 as useQueryClient,
|
|
4078
4120
|
useRampQuotes,
|
|
4079
4121
|
useRampSession,
|
|
4080
4122
|
useRecurringCryptoMarkets,
|
|
@@ -4082,10 +4124,12 @@ export {
|
|
|
4082
4124
|
useRedeemEligibleCount,
|
|
4083
4125
|
useRedeemLifecycle,
|
|
4084
4126
|
useRedeemLifecycles,
|
|
4127
|
+
useResolvedExecutionMode,
|
|
4085
4128
|
useRollingChartWindow,
|
|
4086
4129
|
useSdkLabels,
|
|
4087
4130
|
useSdkUiConfig,
|
|
4088
4131
|
useSearch,
|
|
4132
|
+
useSharedKyc,
|
|
4089
4133
|
useSmartRoute,
|
|
4090
4134
|
useSportsLive,
|
|
4091
4135
|
useSyncBalances,
|
package/dist/withdraw.js
CHANGED
|
@@ -727,7 +727,7 @@ var enUsLabels = {
|
|
|
727
727
|
venueMinOrderSize: "Order size is below the venue minimum. Try a larger amount.",
|
|
728
728
|
sourceBalanceChanged: "Your balance changed since the quote. Refresh and try again, or pick a smaller amount.",
|
|
729
729
|
venueMarketResolved: "This market just resolved. Pick a different market or wait for the next round.",
|
|
730
|
-
dflowWalletUnverified: "
|
|
730
|
+
dflowWalletUnverified: "This route is unavailable for your wallet. Check your account connection and try again.",
|
|
731
731
|
venueNoQuotePath: "No active quote path for this market right now. Try a different size, or wait a moment and re-quote.",
|
|
732
732
|
solanaBlockhashExpired: "Solana transaction expired before submission. Please re-quote and try again.",
|
|
733
733
|
venueRateLimited: "The venue is rate-limiting requests right now. Please wait a moment and try again.",
|
|
@@ -771,6 +771,25 @@ var enUsLabels = {
|
|
|
771
771
|
kycSuccessTitle: "Verification successful",
|
|
772
772
|
kycSuccessDescription: "Your identity has been confirmed and you now have full access to trade on Kalshi markets.",
|
|
773
773
|
kycSuccessDone: "Done",
|
|
774
|
+
sharedKyc: {
|
|
775
|
+
required: "KYC required",
|
|
776
|
+
completeToTrade: "Complete KYC to trade",
|
|
777
|
+
checkingStatus: "Checking verification status",
|
|
778
|
+
modal: {
|
|
779
|
+
ariaLabel: "Identity verification",
|
|
780
|
+
title: "Verify Your Identity",
|
|
781
|
+
freeDescription: "Complete a one-time identity verification to trade all KYC-required venues.",
|
|
782
|
+
pendingTitle: "Verification pending",
|
|
783
|
+
pendingDescription: "Your verification is being reviewed. Check back for approval before trading.",
|
|
784
|
+
checkStatus: "Check verification status",
|
|
785
|
+
startVerification: "Start verification",
|
|
786
|
+
doItLater: "Do it later",
|
|
787
|
+
successTitle: "Verification successful",
|
|
788
|
+
successDescription: "Your identity has been verified. You can now trade on all KYC-required venues.",
|
|
789
|
+
done: "Done",
|
|
790
|
+
error: "We couldn't confirm your verification."
|
|
791
|
+
}
|
|
792
|
+
},
|
|
774
793
|
connectKalshi: "Connect to trade Kalshi",
|
|
775
794
|
tradingAccessVenues: "Venues",
|
|
776
795
|
tradingAccessAvailable: "Available",
|
|
@@ -815,9 +834,13 @@ var enUsLabels = {
|
|
|
815
834
|
insufficientVenueInventory: (sharesLabel, priceLabel) => `Only ${sharesLabel} \xB7 ${priceLabel}`,
|
|
816
835
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
817
836
|
venueUnavailableInRegion: "Unavailable in your region",
|
|
837
|
+
venueTemporarilyUnavailable: "Temporarily unavailable",
|
|
818
838
|
verified: "Verified",
|
|
819
839
|
platformFee: "0% platform fees",
|
|
820
840
|
estimatedFees: "Estimated fees",
|
|
841
|
+
executionReserve: "Execution reserve",
|
|
842
|
+
executionReserveTooltipAria: "Why funds are reserved",
|
|
843
|
+
executionReserveDescription: "Held for price movement or possible venue charges, not a confirmed fee. Unused funds are returned after execution.",
|
|
821
844
|
estimatedFeesTooltipAria: "Estimated fees breakdown",
|
|
822
845
|
feeBreakdownVenueFees: "Venue",
|
|
823
846
|
feeBreakdownBridgeFees: "Bridging",
|
|
@@ -1092,6 +1115,35 @@ var enUsLabels = {
|
|
|
1092
1115
|
bannerAria: "Site header",
|
|
1093
1116
|
logoAria: "Home"
|
|
1094
1117
|
},
|
|
1118
|
+
paperTrading: {
|
|
1119
|
+
badge: "Paper trading",
|
|
1120
|
+
badgeTooltip: "Trade real prediction markets with simulated funds. No real money at risk.",
|
|
1121
|
+
profile: {
|
|
1122
|
+
buyingPower: "Paper Buying Power",
|
|
1123
|
+
earnings: "Paper Earnings",
|
|
1124
|
+
earningsCaption: "Keep what you earn"
|
|
1125
|
+
},
|
|
1126
|
+
onboarding: {
|
|
1127
|
+
stepEyebrow: ({ current, total }) => `STEP ${current} OF ${total}`,
|
|
1128
|
+
skip: "Skip",
|
|
1129
|
+
back: "Back",
|
|
1130
|
+
next: "Next",
|
|
1131
|
+
// Figma reads "Get Strated" (node 4772:31236) — a typo, not copy.
|
|
1132
|
+
done: "Get started",
|
|
1133
|
+
realMarkets: {
|
|
1134
|
+
title: "Real markets, real prices",
|
|
1135
|
+
body: "Follow live prediction markets and trade using real-time market prices from leading venues."
|
|
1136
|
+
},
|
|
1137
|
+
zeroRisk: {
|
|
1138
|
+
title: "Paper trading, zero risk",
|
|
1139
|
+
body: ({ amount }) => `Start with ${amount} in simulated funds. No deposit, no real money, and no risk.`
|
|
1140
|
+
},
|
|
1141
|
+
readyToTrade: {
|
|
1142
|
+
title: "You're ready to trade",
|
|
1143
|
+
body: "Pick a market, make your prediction, and track your performance."
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
},
|
|
1095
1147
|
notifications: {
|
|
1096
1148
|
order: {
|
|
1097
1149
|
filledTitle: "Order filled",
|
|
@@ -1259,6 +1311,7 @@ var defaultAggUiConfig = {
|
|
|
1259
1311
|
// src/core/providers/contexts.ts
|
|
1260
1312
|
var AggClientContext = (0, import_react.createContext)(null);
|
|
1261
1313
|
var AggUiContext = (0, import_react.createContext)(defaultAggUiConfig);
|
|
1314
|
+
var AggExecutionModeContext = (0, import_react.createContext)(null);
|
|
1262
1315
|
var AggLabelsContext = (0, import_react.createContext)(defaultAggUiConfig.general.labels);
|
|
1263
1316
|
var AggAuthContext = (0, import_react.createContext)(null);
|
|
1264
1317
|
var AggBalanceContext = (0, import_react.createContext)(null);
|
|
@@ -1416,6 +1469,10 @@ function useManagedBalances(options) {
|
|
|
1416
1469
|
queryFn: () => client.getManagedBalances(mode ? { mode } : void 0),
|
|
1417
1470
|
enabled,
|
|
1418
1471
|
staleTime: 1e4,
|
|
1472
|
+
// A matched fill can precede settlement and the API's next balance snapshot.
|
|
1473
|
+
// Keep visible clients converging even if that first invalidation reads old cash.
|
|
1474
|
+
refetchInterval: mode === "paper" ? false : 5e3,
|
|
1475
|
+
refetchIntervalInBackground: false,
|
|
1419
1476
|
gcTime: 5 * 6e4,
|
|
1420
1477
|
retry: 1
|
|
1421
1478
|
});
|
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-5EXR5PKK.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useDepositAddresses,
|
|
9
9
|
useManagedBalances,
|
|
10
10
|
useWithdrawManaged
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-25XGLYBT.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": "4.
|
|
3
|
+
"version": "4.9.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": "^4.
|
|
86
|
+
"@agg-build/sdk": "^4.9.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@solana/wallet-adapter-react": {
|