@agg-build/hooks 4.9.0 → 4.10.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-5EXR5PKK.mjs → chunk-7DCOWPUQ.mjs} +1 -1
- package/dist/{chunk-PUI2EGWE.mjs → chunk-MIWXPZNP.mjs} +1 -1
- package/dist/{chunk-25XGLYBT.mjs → chunk-SFSGE25P.mjs} +19 -0
- package/dist/deposit.js +2 -0
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +70 -14
- package/dist/index.mjs +54 -17
- package/dist/withdraw.js +2 -0
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useOnWithdrawalLifecycle,
|
|
12
12
|
useSyncBalances,
|
|
13
13
|
useWithdrawManaged
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SFSGE25P.mjs";
|
|
15
15
|
|
|
16
16
|
// src/withdraw/use-withdraw-flow.ts
|
|
17
17
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
@@ -58,6 +58,7 @@ var Venue = /* @__PURE__ */ ((Venue2) => {
|
|
|
58
58
|
Venue2["limitless"] = "limitless";
|
|
59
59
|
Venue2["opinion"] = "opinion";
|
|
60
60
|
Venue2["predict"] = "predict";
|
|
61
|
+
Venue2["pred"] = "pred";
|
|
61
62
|
Venue2["probable"] = "probable";
|
|
62
63
|
Venue2["myriad"] = "myriad";
|
|
63
64
|
Venue2["hyperliquid"] = "hyperliquid";
|
|
@@ -71,6 +72,7 @@ var ACTIVE_VENUES = [
|
|
|
71
72
|
"limitless" /* limitless */,
|
|
72
73
|
"opinion" /* opinion */,
|
|
73
74
|
"predict" /* predict */,
|
|
75
|
+
"pred" /* pred */,
|
|
74
76
|
"probable" /* probable */,
|
|
75
77
|
"myriad" /* myriad */,
|
|
76
78
|
"hyperliquid" /* hyperliquid */,
|
|
@@ -179,6 +181,7 @@ var VENUE_SORT_ORDER = [
|
|
|
179
181
|
"opinion" /* opinion */,
|
|
180
182
|
"limitless" /* limitless */,
|
|
181
183
|
"predict" /* predict */,
|
|
184
|
+
"pred" /* pred */,
|
|
182
185
|
"myriad" /* myriad */,
|
|
183
186
|
"hyperliquid" /* hyperliquid */
|
|
184
187
|
];
|
|
@@ -248,6 +251,7 @@ var enUsLabels = {
|
|
|
248
251
|
kalshi: "Kalshi",
|
|
249
252
|
opinion: "Opinion",
|
|
250
253
|
predict: "Predict",
|
|
254
|
+
pred: "PRED",
|
|
251
255
|
limitless: "Limitless",
|
|
252
256
|
probable: "Probable",
|
|
253
257
|
myriad: "Myriad",
|
|
@@ -1021,6 +1025,7 @@ var enUsLabels = {
|
|
|
1021
1025
|
depositingFunds: (amount, tokenSymbol, destinationChain) => `Depositing ${amount} ${tokenSymbol} to ${destinationChain}...`,
|
|
1022
1026
|
fundsDeposited: (amount, tokenSymbol, destinationChain) => `Deposited ${amount} ${tokenSymbol} to ${destinationChain}`,
|
|
1023
1027
|
fillingOnVenue: (venueLabel) => `Filling on ${venueLabel}...`,
|
|
1028
|
+
orderStillSettling: "Still settling. This can take a bit \u2014 check your activity feed. You can keep trading.",
|
|
1024
1029
|
venueFilledAtPriceWithAmount: (venueLabel, amountLabel, priceLabel) => `${venueLabel} filled ${amountLabel} at ${priceLabel}`,
|
|
1025
1030
|
executionShares: (value) => `${value} shares`,
|
|
1026
1031
|
confirmTransactionInWallet: "Confirm the transaction in your wallet",
|
|
@@ -4202,6 +4207,20 @@ function useExecuteManaged(options) {
|
|
|
4202
4207
|
mutationFn: (params) => client.executeManaged(params),
|
|
4203
4208
|
onSuccess: (data) => {
|
|
4204
4209
|
var _a;
|
|
4210
|
+
queryClient.setQueriesData({ queryKey: ["smart-route"] }, (route) => {
|
|
4211
|
+
var _a2;
|
|
4212
|
+
if (!route) return route;
|
|
4213
|
+
const consumedPrimary = route.quoteId === data.quoteId;
|
|
4214
|
+
const consumedComparison = (_a2 = route.venueSoloQuotes) == null ? void 0 : _a2.some(
|
|
4215
|
+
(quote) => quote.quoteId === data.quoteId
|
|
4216
|
+
);
|
|
4217
|
+
if (!consumedPrimary && !consumedComparison) return route;
|
|
4218
|
+
return __spreadValues(__spreadValues(__spreadValues({}, route), consumedPrimary ? { quoteId: "" } : {}), consumedComparison ? {
|
|
4219
|
+
venueSoloQuotes: route.venueSoloQuotes.map(
|
|
4220
|
+
(quote) => quote.quoteId === data.quoteId ? __spreadProps(__spreadValues({}, quote), { quoteId: "" }) : quote
|
|
4221
|
+
)
|
|
4222
|
+
} : {});
|
|
4223
|
+
});
|
|
4205
4224
|
queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
|
|
4206
4225
|
queryClient.invalidateQueries({ queryKey: executionKeys.positionsPrefix() });
|
|
4207
4226
|
invalidateBalanceQueries(queryClient);
|
package/dist/deposit.js
CHANGED
|
@@ -168,6 +168,7 @@ var enUsLabels = {
|
|
|
168
168
|
kalshi: "Kalshi",
|
|
169
169
|
opinion: "Opinion",
|
|
170
170
|
predict: "Predict",
|
|
171
|
+
pred: "PRED",
|
|
171
172
|
limitless: "Limitless",
|
|
172
173
|
probable: "Probable",
|
|
173
174
|
myriad: "Myriad",
|
|
@@ -941,6 +942,7 @@ var enUsLabels = {
|
|
|
941
942
|
depositingFunds: (amount, tokenSymbol, destinationChain) => `Depositing ${amount} ${tokenSymbol} to ${destinationChain}...`,
|
|
942
943
|
fundsDeposited: (amount, tokenSymbol, destinationChain) => `Deposited ${amount} ${tokenSymbol} to ${destinationChain}`,
|
|
943
944
|
fillingOnVenue: (venueLabel) => `Filling on ${venueLabel}...`,
|
|
945
|
+
orderStillSettling: "Still settling. This can take a bit \u2014 check your activity feed. You can keep trading.",
|
|
944
946
|
venueFilledAtPriceWithAmount: (venueLabel, amountLabel, priceLabel) => `${venueLabel} filled ${amountLabel} at ${priceLabel}`,
|
|
945
947
|
executionShares: (value) => `${value} shares`,
|
|
946
948
|
confirmTransactionInWallet: "Confirm the transaction in your wallet",
|
package/dist/deposit.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRampQuotes,
|
|
3
3
|
useRampSession
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MIWXPZNP.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__async,
|
|
7
7
|
useAggAuthState,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useDepositAddresses,
|
|
12
12
|
useOptionalAggClient,
|
|
13
13
|
useSyncBalances
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SFSGE25P.mjs";
|
|
15
15
|
|
|
16
16
|
// src/deposit/normalize-wallet-error.ts
|
|
17
17
|
function normalizeWalletError(error, supportedChains) {
|
package/dist/index.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ declare enum Venue {
|
|
|
16
16
|
limitless = "limitless",
|
|
17
17
|
opinion = "opinion",
|
|
18
18
|
predict = "predict",
|
|
19
|
+
pred = "pred",
|
|
19
20
|
probable = "probable",
|
|
20
21
|
myriad = "myriad",
|
|
21
22
|
hyperliquid = "hyperliquid",
|
|
@@ -1363,6 +1364,7 @@ interface AggUiLabels {
|
|
|
1363
1364
|
depositingFunds: (amount: string, tokenSymbol: string, destinationChain: string) => string;
|
|
1364
1365
|
fundsDeposited: (amount: string, tokenSymbol: string, destinationChain: string) => string;
|
|
1365
1366
|
fillingOnVenue: (venueLabel: string) => string;
|
|
1367
|
+
orderStillSettling: string;
|
|
1366
1368
|
venueFilledAtPriceWithAmount: (venueLabel: string, amountLabel: string, priceLabel: string) => string;
|
|
1367
1369
|
executionShares: (value: string) => string;
|
|
1368
1370
|
confirmTransactionInWallet: string;
|
|
@@ -4387,12 +4389,11 @@ interface UseMarketOrderbookResult {
|
|
|
4387
4389
|
/**
|
|
4388
4390
|
* Subscribe to a live orderbook for the selected outcome(s).
|
|
4389
4391
|
*
|
|
4390
|
-
*
|
|
4391
|
-
* deltas via the gateway, reads from the React Query live cache
|
|
4392
|
-
* the ws-provider maintains. No REST fetch needed.
|
|
4392
|
+
* WS-driven in steady state: subscribes to outcome IDs, receives snapshots
|
|
4393
|
+
* + deltas via the gateway, reads from the React Query live cache.
|
|
4393
4394
|
*
|
|
4394
|
-
*
|
|
4395
|
-
*
|
|
4395
|
+
* REST-seeds `GET /orderbook/outcome/:id` so the book still renders when the
|
|
4396
|
+
* websocket is down or the snapshot never arrives. WS overwrites the seed.
|
|
4396
4397
|
*/
|
|
4397
4398
|
declare function useMarketOrderbook(options: UseMarketOrderbookOptions): UseMarketOrderbookResult;
|
|
4398
4399
|
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare enum Venue {
|
|
|
16
16
|
limitless = "limitless",
|
|
17
17
|
opinion = "opinion",
|
|
18
18
|
predict = "predict",
|
|
19
|
+
pred = "pred",
|
|
19
20
|
probable = "probable",
|
|
20
21
|
myriad = "myriad",
|
|
21
22
|
hyperliquid = "hyperliquid",
|
|
@@ -1363,6 +1364,7 @@ interface AggUiLabels {
|
|
|
1363
1364
|
depositingFunds: (amount: string, tokenSymbol: string, destinationChain: string) => string;
|
|
1364
1365
|
fundsDeposited: (amount: string, tokenSymbol: string, destinationChain: string) => string;
|
|
1365
1366
|
fillingOnVenue: (venueLabel: string) => string;
|
|
1367
|
+
orderStillSettling: string;
|
|
1366
1368
|
venueFilledAtPriceWithAmount: (venueLabel: string, amountLabel: string, priceLabel: string) => string;
|
|
1367
1369
|
executionShares: (value: string) => string;
|
|
1368
1370
|
confirmTransactionInWallet: string;
|
|
@@ -4387,12 +4389,11 @@ interface UseMarketOrderbookResult {
|
|
|
4387
4389
|
/**
|
|
4388
4390
|
* Subscribe to a live orderbook for the selected outcome(s).
|
|
4389
4391
|
*
|
|
4390
|
-
*
|
|
4391
|
-
* deltas via the gateway, reads from the React Query live cache
|
|
4392
|
-
* the ws-provider maintains. No REST fetch needed.
|
|
4392
|
+
* WS-driven in steady state: subscribes to outcome IDs, receives snapshots
|
|
4393
|
+
* + deltas via the gateway, reads from the React Query live cache.
|
|
4393
4394
|
*
|
|
4394
|
-
*
|
|
4395
|
-
*
|
|
4395
|
+
* REST-seeds `GET /orderbook/outcome/:id` so the book still renders when the
|
|
4396
|
+
* websocket is down or the snapshot never arrives. WS overwrites the seed.
|
|
4396
4397
|
*/
|
|
4397
4398
|
declare function useMarketOrderbook(options: UseMarketOrderbookOptions): UseMarketOrderbookResult;
|
|
4398
4399
|
|
package/dist/index.js
CHANGED
|
@@ -242,6 +242,7 @@ var Venue = /* @__PURE__ */ ((Venue2) => {
|
|
|
242
242
|
Venue2["limitless"] = "limitless";
|
|
243
243
|
Venue2["opinion"] = "opinion";
|
|
244
244
|
Venue2["predict"] = "predict";
|
|
245
|
+
Venue2["pred"] = "pred";
|
|
245
246
|
Venue2["probable"] = "probable";
|
|
246
247
|
Venue2["myriad"] = "myriad";
|
|
247
248
|
Venue2["hyperliquid"] = "hyperliquid";
|
|
@@ -255,6 +256,7 @@ var ACTIVE_VENUES = [
|
|
|
255
256
|
"limitless" /* limitless */,
|
|
256
257
|
"opinion" /* opinion */,
|
|
257
258
|
"predict" /* predict */,
|
|
259
|
+
"pred" /* pred */,
|
|
258
260
|
"probable" /* probable */,
|
|
259
261
|
"myriad" /* myriad */,
|
|
260
262
|
"hyperliquid" /* hyperliquid */,
|
|
@@ -363,6 +365,7 @@ var VENUE_SORT_ORDER = [
|
|
|
363
365
|
"opinion" /* opinion */,
|
|
364
366
|
"limitless" /* limitless */,
|
|
365
367
|
"predict" /* predict */,
|
|
368
|
+
"pred" /* pred */,
|
|
366
369
|
"myriad" /* myriad */,
|
|
367
370
|
"hyperliquid" /* hyperliquid */
|
|
368
371
|
];
|
|
@@ -605,6 +608,7 @@ var enUsLabels = {
|
|
|
605
608
|
kalshi: "Kalshi",
|
|
606
609
|
opinion: "Opinion",
|
|
607
610
|
predict: "Predict",
|
|
611
|
+
pred: "PRED",
|
|
608
612
|
limitless: "Limitless",
|
|
609
613
|
probable: "Probable",
|
|
610
614
|
myriad: "Myriad",
|
|
@@ -1378,6 +1382,7 @@ var enUsLabels = {
|
|
|
1378
1382
|
depositingFunds: (amount, tokenSymbol, destinationChain) => `Depositing ${amount} ${tokenSymbol} to ${destinationChain}...`,
|
|
1379
1383
|
fundsDeposited: (amount, tokenSymbol, destinationChain) => `Deposited ${amount} ${tokenSymbol} to ${destinationChain}`,
|
|
1380
1384
|
fillingOnVenue: (venueLabel) => `Filling on ${venueLabel}...`,
|
|
1385
|
+
orderStillSettling: "Still settling. This can take a bit \u2014 check your activity feed. You can keep trading.",
|
|
1381
1386
|
venueFilledAtPriceWithAmount: (venueLabel, amountLabel, priceLabel) => `${venueLabel} filled ${amountLabel} at ${priceLabel}`,
|
|
1382
1387
|
executionShares: (value) => `${value} shares`,
|
|
1383
1388
|
confirmTransactionInWallet: "Confirm the transaction in your wallet",
|
|
@@ -4408,6 +4413,20 @@ function useExecuteManaged(options) {
|
|
|
4408
4413
|
mutationFn: (params) => client.executeManaged(params),
|
|
4409
4414
|
onSuccess: (data) => {
|
|
4410
4415
|
var _a;
|
|
4416
|
+
queryClient.setQueriesData({ queryKey: ["smart-route"] }, (route) => {
|
|
4417
|
+
var _a2;
|
|
4418
|
+
if (!route) return route;
|
|
4419
|
+
const consumedPrimary = route.quoteId === data.quoteId;
|
|
4420
|
+
const consumedComparison = (_a2 = route.venueSoloQuotes) == null ? void 0 : _a2.some(
|
|
4421
|
+
(quote) => quote.quoteId === data.quoteId
|
|
4422
|
+
);
|
|
4423
|
+
if (!consumedPrimary && !consumedComparison) return route;
|
|
4424
|
+
return __spreadValues(__spreadValues(__spreadValues({}, route), consumedPrimary ? { quoteId: "" } : {}), consumedComparison ? {
|
|
4425
|
+
venueSoloQuotes: route.venueSoloQuotes.map(
|
|
4426
|
+
(quote) => quote.quoteId === data.quoteId ? __spreadProps(__spreadValues({}, quote), { quoteId: "" }) : quote
|
|
4427
|
+
)
|
|
4428
|
+
} : {});
|
|
4429
|
+
});
|
|
4411
4430
|
queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
|
|
4412
4431
|
queryClient.invalidateQueries({ queryKey: executionKeys.positionsPrefix() });
|
|
4413
4432
|
invalidateBalanceQueries(queryClient);
|
|
@@ -7674,8 +7693,9 @@ var useRollingChartWindow = (options) => {
|
|
|
7674
7693
|
// src/use-market-orderbook.ts
|
|
7675
7694
|
var import_react_query32 = require("@tanstack/react-query");
|
|
7676
7695
|
function useMarketOrderbook(options) {
|
|
7677
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
7696
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
7678
7697
|
const queryClient = (0, import_react_query32.useQueryClient)();
|
|
7698
|
+
const client = useAggClient();
|
|
7679
7699
|
const ws = useAggWebSocket();
|
|
7680
7700
|
const isConnected = useAggWebSocketConnectionState();
|
|
7681
7701
|
const {
|
|
@@ -7704,12 +7724,30 @@ function useMarketOrderbook(options) {
|
|
|
7704
7724
|
refetchOnReconnect: false
|
|
7705
7725
|
}))
|
|
7706
7726
|
});
|
|
7727
|
+
const seedQueries = (0, import_react_query32.useQueries)({
|
|
7728
|
+
queries: subscriptionIds.map((subscriptionId) => ({
|
|
7729
|
+
queryKey: ["market-orderbook-seed", subscriptionId],
|
|
7730
|
+
queryFn: ({ signal }) => client.getOutcomeOrderbook(subscriptionId, { signal }),
|
|
7731
|
+
enabled: enabled && !!subscriptionId,
|
|
7732
|
+
staleTime: 5e3,
|
|
7733
|
+
gcTime: 6e4,
|
|
7734
|
+
refetchOnWindowFocus: false,
|
|
7735
|
+
retry: 1
|
|
7736
|
+
}))
|
|
7737
|
+
});
|
|
7707
7738
|
const liveStates = subscriptionIds.map((subscriptionId, index) => {
|
|
7708
7739
|
var _a2, _b2;
|
|
7709
7740
|
return (_b2 = (_a2 = liveQueries[index]) == null ? void 0 : _a2.data) != null ? _b2 : createMarketLiveState(subscriptionId);
|
|
7710
7741
|
});
|
|
7711
|
-
const
|
|
7712
|
-
|
|
7742
|
+
const seededOrderbooks = subscriptionIds.map((subscriptionId, index) => {
|
|
7743
|
+
var _a2, _b2, _c2, _d2;
|
|
7744
|
+
const liveBook = (_b2 = (_a2 = liveStates[index]) == null ? void 0 : _a2.orderbook) != null ? _b2 : null;
|
|
7745
|
+
if (liveBook) return liveBook;
|
|
7746
|
+
const seed = (_c2 = seedQueries[index]) == null ? void 0 : _c2.data;
|
|
7747
|
+
return ((_d2 = seed == null ? void 0 : seed.orderbook) == null ? void 0 : _d2.bids) && seed.orderbook.asks ? outcomeOrderbookToState(seed, subscriptionId) : null;
|
|
7748
|
+
});
|
|
7749
|
+
const primaryOrderbook = (_c = seededOrderbooks[0]) != null ? _c : null;
|
|
7750
|
+
const primarySnapshotVersion = (_e = (_d = liveStates[0]) == null ? void 0 : _d.orderbookSnapshotVersion) != null ? _e : 0;
|
|
7713
7751
|
const data = primaryOrderbook ? applyOrderbookDepth(
|
|
7714
7752
|
createMarketOrderbookDataFromState(primaryOrderbook, {
|
|
7715
7753
|
snapshotVersion: primarySnapshotVersion
|
|
@@ -7717,14 +7755,15 @@ function useMarketOrderbook(options) {
|
|
|
7717
7755
|
depth
|
|
7718
7756
|
) : null;
|
|
7719
7757
|
const dataById = Object.fromEntries(
|
|
7720
|
-
|
|
7721
|
-
|
|
7758
|
+
seededOrderbooks.flatMap((orderbook, index) => {
|
|
7759
|
+
var _a2;
|
|
7760
|
+
if (!orderbook) return [];
|
|
7722
7761
|
return [
|
|
7723
7762
|
[
|
|
7724
7763
|
subscriptionIds[index],
|
|
7725
7764
|
applyOrderbookDepth(
|
|
7726
|
-
createMarketOrderbookDataFromState(
|
|
7727
|
-
snapshotVersion:
|
|
7765
|
+
createMarketOrderbookDataFromState(orderbook, {
|
|
7766
|
+
snapshotVersion: (_a2 = liveStates[index]) == null ? void 0 : _a2.orderbookSnapshotVersion
|
|
7728
7767
|
}),
|
|
7729
7768
|
depth
|
|
7730
7769
|
)
|
|
@@ -7732,14 +7771,15 @@ function useMarketOrderbook(options) {
|
|
|
7732
7771
|
];
|
|
7733
7772
|
})
|
|
7734
7773
|
);
|
|
7735
|
-
const hasAnyOrderbook =
|
|
7736
|
-
const
|
|
7774
|
+
const hasAnyOrderbook = seededOrderbooks.some((orderbook) => orderbook != null);
|
|
7775
|
+
const seedLoading = seedQueries.some((query) => query.isLoading);
|
|
7776
|
+
const liveOrderbookErrorMessage = enabled && liveEnabled && !hasAnyOrderbook ? (_g = (_f = liveStates.find(
|
|
7737
7777
|
(liveState) => typeof liveState.orderbookError === "string" && liveState.orderbookError.length > 0
|
|
7738
|
-
)) == null ? void 0 :
|
|
7778
|
+
)) == null ? void 0 : _f.orderbookError) != null ? _g : null : null;
|
|
7739
7779
|
return {
|
|
7740
7780
|
data,
|
|
7741
7781
|
dataById,
|
|
7742
|
-
isLoading: enabled &&
|
|
7782
|
+
isLoading: enabled && !hasAnyOrderbook && liveOrderbookErrorMessage == null && (isConnected || seedLoading),
|
|
7743
7783
|
error: liveOrderbookErrorMessage ? new Error(liveOrderbookErrorMessage) : null,
|
|
7744
7784
|
isLive: Boolean(liveEnabled && selectedOutcomeId && isConnected),
|
|
7745
7785
|
refetch: () => __async(null, null, function* () {
|
|
@@ -8272,8 +8312,10 @@ var assessThinSmartRouteLiquidity = (quote, nowMs = Date.now()) => {
|
|
|
8272
8312
|
};
|
|
8273
8313
|
};
|
|
8274
8314
|
var resolveSmartRouteRefetchInterval = (args, nowMs = Date.now()) => {
|
|
8315
|
+
var _a, _b;
|
|
8275
8316
|
const {
|
|
8276
8317
|
aggressiveIntervalMs = THIN_SMART_ROUTE_REFETCH_INTERVAL_MS,
|
|
8318
|
+
adaptive = true,
|
|
8277
8319
|
data,
|
|
8278
8320
|
defaultIntervalMs,
|
|
8279
8321
|
isDocumentVisible,
|
|
@@ -8289,6 +8331,18 @@ var resolveSmartRouteRefetchInterval = (args, nowMs = Date.now()) => {
|
|
|
8289
8331
|
if (!queryEnabled || !isInputValid || !isActivelyViewingQuote || !isMarketOpen || isSubmitting || !isDocumentVisible) {
|
|
8290
8332
|
return false;
|
|
8291
8333
|
}
|
|
8334
|
+
const primaryUsesProphetx = ((_a = data == null ? void 0 : data.fills) == null ? void 0 : _a.some((fill) => fill.venue === "prophetx")) || (data == null ? void 0 : data.status) !== "ok";
|
|
8335
|
+
const deadlines = [
|
|
8336
|
+
data == null ? void 0 : data.quoteRefreshNotBefore,
|
|
8337
|
+
...primaryUsesProphetx ? [(_b = data == null ? void 0 : data.quoteFailure) == null ? void 0 : _b.retryAt] : []
|
|
8338
|
+
].filter((value) => !!value).map(Date.parse).filter((value) => Number.isFinite(value) && value > nowMs);
|
|
8339
|
+
if (deadlines.length) return Math.max(...deadlines) - nowMs;
|
|
8340
|
+
if (!adaptive)
|
|
8341
|
+
return clampIntervalToRefreshDeadline({
|
|
8342
|
+
intervalMs: defaultIntervalMs,
|
|
8343
|
+
refreshAt: void 0,
|
|
8344
|
+
nowMs
|
|
8345
|
+
});
|
|
8292
8346
|
const defaultInterval = clampIntervalToRefreshDeadline({
|
|
8293
8347
|
intervalMs: defaultIntervalMs,
|
|
8294
8348
|
refreshAt: data == null ? void 0 : data.refreshAt,
|
|
@@ -8375,7 +8429,8 @@ function useSmartRoute(options) {
|
|
|
8375
8429
|
return resolveSmartRouteRefetchInterval({
|
|
8376
8430
|
// SELL already fans out into one quote per venue. Keep that group on a
|
|
8377
8431
|
// stable cadence instead of multiplying the adaptive 5s/refreshAt poll.
|
|
8378
|
-
data:
|
|
8432
|
+
data: queryState.state.data,
|
|
8433
|
+
adaptive: tradeSide !== "sell",
|
|
8379
8434
|
defaultIntervalMs: staleTimeMs,
|
|
8380
8435
|
isDocumentVisible: getIsDocumentVisible(),
|
|
8381
8436
|
isEditing: (_a2 = refreshContext == null ? void 0 : refreshContext.isEditing) != null ? _a2 : false,
|
|
@@ -8630,13 +8685,14 @@ var useVenueSellQuotes = (options) => {
|
|
|
8630
8685
|
}),
|
|
8631
8686
|
enabled: queryEnabled,
|
|
8632
8687
|
staleTime: staleTimeMs,
|
|
8633
|
-
refetchInterval: (
|
|
8688
|
+
refetchInterval: (queryState) => {
|
|
8634
8689
|
var _a2, _b2, _c, _d;
|
|
8635
8690
|
return resolveSmartRouteRefetchInterval({
|
|
8636
8691
|
// Venue quotes are display companions to the aggregate SELL quote.
|
|
8637
8692
|
// Poll them at the normal cadence rather than independently
|
|
8638
8693
|
// accelerating every venue to the thin-liquidity interval.
|
|
8639
|
-
data:
|
|
8694
|
+
data: queryState.state.data,
|
|
8695
|
+
adaptive: false,
|
|
8640
8696
|
defaultIntervalMs: staleTimeMs,
|
|
8641
8697
|
isDocumentVisible: getIsDocumentVisible3(),
|
|
8642
8698
|
isEditing: (_a2 = refreshContext == null ? void 0 : refreshContext.isEditing) != null ? _a2 : false,
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRampQuotes,
|
|
3
3
|
useRampSession
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MIWXPZNP.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useWithdrawEstimate,
|
|
7
7
|
useWithdrawFlow,
|
|
8
8
|
useWithdrawPreview,
|
|
9
9
|
useWithdrawalLifecycle
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7DCOWPUQ.mjs";
|
|
11
11
|
import {
|
|
12
12
|
AggAuthContext,
|
|
13
13
|
AggBalanceProvider,
|
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
useSyncBalances,
|
|
102
102
|
useWithdrawManaged,
|
|
103
103
|
userActivityQueryKeys
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-SFSGE25P.mjs";
|
|
105
105
|
|
|
106
106
|
// src/index.ts
|
|
107
107
|
import { QueryClient as QueryClient4, QueryClientProvider, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
@@ -1693,8 +1693,9 @@ var useRollingChartWindow = (options) => {
|
|
|
1693
1693
|
// src/use-market-orderbook.ts
|
|
1694
1694
|
import { useQueries as useQueries5, useQueryClient } from "@tanstack/react-query";
|
|
1695
1695
|
function useMarketOrderbook(options) {
|
|
1696
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
1696
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1697
1697
|
const queryClient = useQueryClient();
|
|
1698
|
+
const client = useAggClient();
|
|
1698
1699
|
const ws = useAggWebSocket();
|
|
1699
1700
|
const isConnected = useAggWebSocketConnectionState();
|
|
1700
1701
|
const {
|
|
@@ -1723,12 +1724,30 @@ function useMarketOrderbook(options) {
|
|
|
1723
1724
|
refetchOnReconnect: false
|
|
1724
1725
|
}))
|
|
1725
1726
|
});
|
|
1727
|
+
const seedQueries = useQueries5({
|
|
1728
|
+
queries: subscriptionIds.map((subscriptionId) => ({
|
|
1729
|
+
queryKey: ["market-orderbook-seed", subscriptionId],
|
|
1730
|
+
queryFn: ({ signal }) => client.getOutcomeOrderbook(subscriptionId, { signal }),
|
|
1731
|
+
enabled: enabled && !!subscriptionId,
|
|
1732
|
+
staleTime: 5e3,
|
|
1733
|
+
gcTime: 6e4,
|
|
1734
|
+
refetchOnWindowFocus: false,
|
|
1735
|
+
retry: 1
|
|
1736
|
+
}))
|
|
1737
|
+
});
|
|
1726
1738
|
const liveStates = subscriptionIds.map((subscriptionId, index) => {
|
|
1727
1739
|
var _a2, _b2;
|
|
1728
1740
|
return (_b2 = (_a2 = liveQueries[index]) == null ? void 0 : _a2.data) != null ? _b2 : createMarketLiveState(subscriptionId);
|
|
1729
1741
|
});
|
|
1730
|
-
const
|
|
1731
|
-
|
|
1742
|
+
const seededOrderbooks = subscriptionIds.map((subscriptionId, index) => {
|
|
1743
|
+
var _a2, _b2, _c2, _d2;
|
|
1744
|
+
const liveBook = (_b2 = (_a2 = liveStates[index]) == null ? void 0 : _a2.orderbook) != null ? _b2 : null;
|
|
1745
|
+
if (liveBook) return liveBook;
|
|
1746
|
+
const seed = (_c2 = seedQueries[index]) == null ? void 0 : _c2.data;
|
|
1747
|
+
return ((_d2 = seed == null ? void 0 : seed.orderbook) == null ? void 0 : _d2.bids) && seed.orderbook.asks ? outcomeOrderbookToState(seed, subscriptionId) : null;
|
|
1748
|
+
});
|
|
1749
|
+
const primaryOrderbook = (_c = seededOrderbooks[0]) != null ? _c : null;
|
|
1750
|
+
const primarySnapshotVersion = (_e = (_d = liveStates[0]) == null ? void 0 : _d.orderbookSnapshotVersion) != null ? _e : 0;
|
|
1732
1751
|
const data = primaryOrderbook ? applyOrderbookDepth(
|
|
1733
1752
|
createMarketOrderbookDataFromState(primaryOrderbook, {
|
|
1734
1753
|
snapshotVersion: primarySnapshotVersion
|
|
@@ -1736,14 +1755,15 @@ function useMarketOrderbook(options) {
|
|
|
1736
1755
|
depth
|
|
1737
1756
|
) : null;
|
|
1738
1757
|
const dataById = Object.fromEntries(
|
|
1739
|
-
|
|
1740
|
-
|
|
1758
|
+
seededOrderbooks.flatMap((orderbook, index) => {
|
|
1759
|
+
var _a2;
|
|
1760
|
+
if (!orderbook) return [];
|
|
1741
1761
|
return [
|
|
1742
1762
|
[
|
|
1743
1763
|
subscriptionIds[index],
|
|
1744
1764
|
applyOrderbookDepth(
|
|
1745
|
-
createMarketOrderbookDataFromState(
|
|
1746
|
-
snapshotVersion:
|
|
1765
|
+
createMarketOrderbookDataFromState(orderbook, {
|
|
1766
|
+
snapshotVersion: (_a2 = liveStates[index]) == null ? void 0 : _a2.orderbookSnapshotVersion
|
|
1747
1767
|
}),
|
|
1748
1768
|
depth
|
|
1749
1769
|
)
|
|
@@ -1751,14 +1771,15 @@ function useMarketOrderbook(options) {
|
|
|
1751
1771
|
];
|
|
1752
1772
|
})
|
|
1753
1773
|
);
|
|
1754
|
-
const hasAnyOrderbook =
|
|
1755
|
-
const
|
|
1774
|
+
const hasAnyOrderbook = seededOrderbooks.some((orderbook) => orderbook != null);
|
|
1775
|
+
const seedLoading = seedQueries.some((query) => query.isLoading);
|
|
1776
|
+
const liveOrderbookErrorMessage = enabled && liveEnabled && !hasAnyOrderbook ? (_g = (_f = liveStates.find(
|
|
1756
1777
|
(liveState) => typeof liveState.orderbookError === "string" && liveState.orderbookError.length > 0
|
|
1757
|
-
)) == null ? void 0 :
|
|
1778
|
+
)) == null ? void 0 : _f.orderbookError) != null ? _g : null : null;
|
|
1758
1779
|
return {
|
|
1759
1780
|
data,
|
|
1760
1781
|
dataById,
|
|
1761
|
-
isLoading: enabled &&
|
|
1782
|
+
isLoading: enabled && !hasAnyOrderbook && liveOrderbookErrorMessage == null && (isConnected || seedLoading),
|
|
1762
1783
|
error: liveOrderbookErrorMessage ? new Error(liveOrderbookErrorMessage) : null,
|
|
1763
1784
|
isLive: Boolean(liveEnabled && selectedOutcomeId && isConnected),
|
|
1764
1785
|
refetch: () => __async(null, null, function* () {
|
|
@@ -2296,8 +2317,10 @@ var assessThinSmartRouteLiquidity = (quote, nowMs = Date.now()) => {
|
|
|
2296
2317
|
};
|
|
2297
2318
|
};
|
|
2298
2319
|
var resolveSmartRouteRefetchInterval = (args, nowMs = Date.now()) => {
|
|
2320
|
+
var _a, _b;
|
|
2299
2321
|
const {
|
|
2300
2322
|
aggressiveIntervalMs = THIN_SMART_ROUTE_REFETCH_INTERVAL_MS,
|
|
2323
|
+
adaptive = true,
|
|
2301
2324
|
data,
|
|
2302
2325
|
defaultIntervalMs,
|
|
2303
2326
|
isDocumentVisible,
|
|
@@ -2313,6 +2336,18 @@ var resolveSmartRouteRefetchInterval = (args, nowMs = Date.now()) => {
|
|
|
2313
2336
|
if (!queryEnabled || !isInputValid || !isActivelyViewingQuote || !isMarketOpen || isSubmitting || !isDocumentVisible) {
|
|
2314
2337
|
return false;
|
|
2315
2338
|
}
|
|
2339
|
+
const primaryUsesProphetx = ((_a = data == null ? void 0 : data.fills) == null ? void 0 : _a.some((fill) => fill.venue === "prophetx")) || (data == null ? void 0 : data.status) !== "ok";
|
|
2340
|
+
const deadlines = [
|
|
2341
|
+
data == null ? void 0 : data.quoteRefreshNotBefore,
|
|
2342
|
+
...primaryUsesProphetx ? [(_b = data == null ? void 0 : data.quoteFailure) == null ? void 0 : _b.retryAt] : []
|
|
2343
|
+
].filter((value) => !!value).map(Date.parse).filter((value) => Number.isFinite(value) && value > nowMs);
|
|
2344
|
+
if (deadlines.length) return Math.max(...deadlines) - nowMs;
|
|
2345
|
+
if (!adaptive)
|
|
2346
|
+
return clampIntervalToRefreshDeadline({
|
|
2347
|
+
intervalMs: defaultIntervalMs,
|
|
2348
|
+
refreshAt: void 0,
|
|
2349
|
+
nowMs
|
|
2350
|
+
});
|
|
2316
2351
|
const defaultInterval = clampIntervalToRefreshDeadline({
|
|
2317
2352
|
intervalMs: defaultIntervalMs,
|
|
2318
2353
|
refreshAt: data == null ? void 0 : data.refreshAt,
|
|
@@ -2399,7 +2434,8 @@ function useSmartRoute(options) {
|
|
|
2399
2434
|
return resolveSmartRouteRefetchInterval({
|
|
2400
2435
|
// SELL already fans out into one quote per venue. Keep that group on a
|
|
2401
2436
|
// stable cadence instead of multiplying the adaptive 5s/refreshAt poll.
|
|
2402
|
-
data:
|
|
2437
|
+
data: queryState.state.data,
|
|
2438
|
+
adaptive: tradeSide !== "sell",
|
|
2403
2439
|
defaultIntervalMs: staleTimeMs,
|
|
2404
2440
|
isDocumentVisible: getIsDocumentVisible(),
|
|
2405
2441
|
isEditing: (_a2 = refreshContext == null ? void 0 : refreshContext.isEditing) != null ? _a2 : false,
|
|
@@ -2654,13 +2690,14 @@ var useVenueSellQuotes = (options) => {
|
|
|
2654
2690
|
}),
|
|
2655
2691
|
enabled: queryEnabled,
|
|
2656
2692
|
staleTime: staleTimeMs,
|
|
2657
|
-
refetchInterval: (
|
|
2693
|
+
refetchInterval: (queryState) => {
|
|
2658
2694
|
var _a2, _b2, _c, _d;
|
|
2659
2695
|
return resolveSmartRouteRefetchInterval({
|
|
2660
2696
|
// Venue quotes are display companions to the aggregate SELL quote.
|
|
2661
2697
|
// Poll them at the normal cadence rather than independently
|
|
2662
2698
|
// accelerating every venue to the thin-liquidity interval.
|
|
2663
|
-
data:
|
|
2699
|
+
data: queryState.state.data,
|
|
2700
|
+
adaptive: false,
|
|
2664
2701
|
defaultIntervalMs: staleTimeMs,
|
|
2665
2702
|
isDocumentVisible: getIsDocumentVisible3(),
|
|
2666
2703
|
isEditing: (_a2 = refreshContext == null ? void 0 : refreshContext.isEditing) != null ? _a2 : false,
|
package/dist/withdraw.js
CHANGED
|
@@ -98,6 +98,7 @@ var enUsLabels = {
|
|
|
98
98
|
kalshi: "Kalshi",
|
|
99
99
|
opinion: "Opinion",
|
|
100
100
|
predict: "Predict",
|
|
101
|
+
pred: "PRED",
|
|
101
102
|
limitless: "Limitless",
|
|
102
103
|
probable: "Probable",
|
|
103
104
|
myriad: "Myriad",
|
|
@@ -871,6 +872,7 @@ var enUsLabels = {
|
|
|
871
872
|
depositingFunds: (amount, tokenSymbol, destinationChain) => `Depositing ${amount} ${tokenSymbol} to ${destinationChain}...`,
|
|
872
873
|
fundsDeposited: (amount, tokenSymbol, destinationChain) => `Deposited ${amount} ${tokenSymbol} to ${destinationChain}`,
|
|
873
874
|
fillingOnVenue: (venueLabel) => `Filling on ${venueLabel}...`,
|
|
875
|
+
orderStillSettling: "Still settling. This can take a bit \u2014 check your activity feed. You can keep trading.",
|
|
874
876
|
venueFilledAtPriceWithAmount: (venueLabel, amountLabel, priceLabel) => `${venueLabel} filled ${amountLabel} at ${priceLabel}`,
|
|
875
877
|
executionShares: (value) => `${value} shares`,
|
|
876
878
|
confirmTransactionInWallet: "Confirm the transaction in your wallet",
|
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-7DCOWPUQ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useDepositAddresses,
|
|
9
9
|
useManagedBalances,
|
|
10
10
|
useWithdrawManaged
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SFSGE25P.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.10.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.10.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@solana/wallet-adapter-react": {
|