@agg-build/hooks 2.4.6 → 2.5.1
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-CAG2RCHR.mjs → chunk-5NJBAP42.mjs} +195 -44
- package/dist/{chunk-4IRZFXAC.mjs → chunk-DPY6RZNW.mjs} +1 -1
- package/dist/{chunk-X32MRBHC.mjs → chunk-PK2JGXQV.mjs} +1 -1
- package/dist/deposit.js +55 -0
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +114 -3
- package/dist/index.d.ts +114 -3
- package/dist/index.js +275 -122
- package/dist/index.mjs +7 -3
- package/dist/withdraw.js +55 -0
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -84,8 +84,8 @@ __export(src_exports, {
|
|
|
84
84
|
MarketStatus: () => MarketStatus,
|
|
85
85
|
MatchStatus: () => MatchStatus,
|
|
86
86
|
MatchType: () => MatchType,
|
|
87
|
-
QueryClient: () =>
|
|
88
|
-
QueryClientProvider: () =>
|
|
87
|
+
QueryClient: () => import_react_query41.QueryClient,
|
|
88
|
+
QueryClientProvider: () => import_react_query41.QueryClientProvider,
|
|
89
89
|
RedeemRejectedError: () => RedeemRejectedError,
|
|
90
90
|
TradeSide: () => TradeSide,
|
|
91
91
|
TurnstileChallengeError: () => import_sdk4.TurnstileChallengeError,
|
|
@@ -142,6 +142,7 @@ __export(src_exports, {
|
|
|
142
142
|
useAppConfig: () => useAppConfig,
|
|
143
143
|
useArbFeed: () => useArbFeed,
|
|
144
144
|
useCachedAppConfig: () => useCachedAppConfig,
|
|
145
|
+
useCancelManagedOrder: () => useCancelManagedOrder,
|
|
145
146
|
useCategories: () => useCategories,
|
|
146
147
|
useCategoryChildren: () => useCategoryChildren,
|
|
147
148
|
useDebouncedValue: () => useDebouncedValue,
|
|
@@ -181,8 +182,9 @@ __export(src_exports, {
|
|
|
181
182
|
useOrderBook: () => useOrderBook,
|
|
182
183
|
useOrderbookQuote: () => useOrderbookQuote,
|
|
183
184
|
useOrders: () => useOrders,
|
|
185
|
+
usePlaceLimitOrder: () => usePlaceLimitOrder,
|
|
184
186
|
usePositions: () => usePositions,
|
|
185
|
-
useQueryClient: () =>
|
|
187
|
+
useQueryClient: () => import_react_query41.useQueryClient,
|
|
186
188
|
useQuoteManaged: () => useQuoteManaged,
|
|
187
189
|
useRampQuotes: () => useRampQuotes,
|
|
188
190
|
useRampSession: () => useRampSession,
|
|
@@ -347,7 +349,7 @@ var getVenueOrder = (venue) => {
|
|
|
347
349
|
var sortVenues = (venues) => [...venues].sort((a, b) => getVenueOrder(a) - getVenueOrder(b));
|
|
348
350
|
|
|
349
351
|
// src/index.ts
|
|
350
|
-
var
|
|
352
|
+
var import_react_query41 = require("@tanstack/react-query");
|
|
351
353
|
|
|
352
354
|
// src/candle-store.ts
|
|
353
355
|
var import_sdk = require("@agg-build/sdk");
|
|
@@ -809,8 +811,14 @@ var enUsLabels = {
|
|
|
809
811
|
categoryTabsAria: "Home page category tabs"
|
|
810
812
|
},
|
|
811
813
|
userProfile: {
|
|
814
|
+
tabs: {
|
|
815
|
+
positions: "Positions",
|
|
816
|
+
openOrders: "Open orders",
|
|
817
|
+
activity: "Activity"
|
|
818
|
+
},
|
|
812
819
|
balance: {
|
|
813
820
|
availableBalance: "Available Balance",
|
|
821
|
+
reservedForOpenOrders: (amount) => `${amount} reserved for open orders`,
|
|
814
822
|
balanceByNetwork: "Balance by network",
|
|
815
823
|
paperModeNetwork: "Paper",
|
|
816
824
|
paperModeWarning: "Paper mode is enabled. These are simulated funds for paper trading.",
|
|
@@ -893,6 +901,25 @@ var enUsLabels = {
|
|
|
893
901
|
avgPrefix: "avg",
|
|
894
902
|
nowPrefix: "now",
|
|
895
903
|
finalPrefix: "final"
|
|
904
|
+
},
|
|
905
|
+
openOrders: {
|
|
906
|
+
marketHeader: "Market",
|
|
907
|
+
limitPriceHeader: "Limit price",
|
|
908
|
+
filledHeader: "Filled",
|
|
909
|
+
totalHeader: "Total",
|
|
910
|
+
filledShort: "Filled",
|
|
911
|
+
totalShort: "Total",
|
|
912
|
+
expirationHeader: "Expiration",
|
|
913
|
+
goodTilCanceled: "Good 'til canceled",
|
|
914
|
+
expired: "Expired",
|
|
915
|
+
cancel: "Cancel",
|
|
916
|
+
cancelOrderAria: (orderId) => `Cancel order ${orderId}`,
|
|
917
|
+
loading: "Loading open orders",
|
|
918
|
+
loadingMore: "Loading more open orders",
|
|
919
|
+
errorTitle: "Unable to load open orders",
|
|
920
|
+
errorDescription: "Please try again in a moment.",
|
|
921
|
+
emptyTitle: "No open orders",
|
|
922
|
+
emptyDescription: "Your open limit orders will appear here."
|
|
896
923
|
}
|
|
897
924
|
},
|
|
898
925
|
eventList: {
|
|
@@ -1138,6 +1165,29 @@ var enUsLabels = {
|
|
|
1138
1165
|
kycSuccessDone: "Done",
|
|
1139
1166
|
outcome: (label) => `Outcome: ${label}`,
|
|
1140
1167
|
smartRouting: "Smart Routing",
|
|
1168
|
+
orderTypeMarket: "Market",
|
|
1169
|
+
orderTypeLimit: "Limit",
|
|
1170
|
+
orderTypeAria: "Order type",
|
|
1171
|
+
limitPrice: "Limit price",
|
|
1172
|
+
limitPriceInputAria: "Limit price in cents",
|
|
1173
|
+
limitPriceInvalid: "Limit price must be greater than 0 and less than 100.",
|
|
1174
|
+
limitPriceDecreaseAria: "Decrease limit price",
|
|
1175
|
+
limitPriceIncreaseAria: "Increase limit price",
|
|
1176
|
+
expiration: "Expiration",
|
|
1177
|
+
expirationGoodTilCanceled: "Good 'til canceled",
|
|
1178
|
+
expirationFiveMinutes: "5m",
|
|
1179
|
+
expirationOneHour: "1h",
|
|
1180
|
+
expirationEndOfDay: "End of day (EST)",
|
|
1181
|
+
expirationCustom: "Custom",
|
|
1182
|
+
expirationMenuAria: "Choose expiration",
|
|
1183
|
+
expirationOptions: "Expiration options",
|
|
1184
|
+
expirationDateAria: "Limit order expiration date",
|
|
1185
|
+
expirationStartTime: "Start time",
|
|
1186
|
+
expirationStartTimeHint: "24-hour format",
|
|
1187
|
+
expirationCancel: "Cancel",
|
|
1188
|
+
expirationApply: "Apply",
|
|
1189
|
+
limitOrderPlacedTitle: "Limit order placed",
|
|
1190
|
+
limitOrderPlacedDescription: "Your limit order has been submitted.",
|
|
1141
1191
|
orderSplitting: "Order Splitting",
|
|
1142
1192
|
splitOrderDescription: "We split your order for the best price:",
|
|
1143
1193
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
@@ -1403,6 +1453,12 @@ var enUsLabels = {
|
|
|
1403
1453
|
const venue = venueLabel ? ` on ${venueLabel}` : "";
|
|
1404
1454
|
return `${action}${amount}${price}${venue}`.trim();
|
|
1405
1455
|
},
|
|
1456
|
+
cancelledTitle: "Order canceled",
|
|
1457
|
+
cancelledMessage: "Your open order was canceled.",
|
|
1458
|
+
cancelPendingTitle: "Cancellation submitted",
|
|
1459
|
+
cancelPendingMessage: "Your cancellation request is being processed.",
|
|
1460
|
+
cancelFailedTitle: "Cancellation failed",
|
|
1461
|
+
cancelFailedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your open order could not be canceled. Please try again.",
|
|
1406
1462
|
failedTitle: "Order failed",
|
|
1407
1463
|
failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your order could not be completed. Please try again."
|
|
1408
1464
|
},
|
|
@@ -1542,6 +1598,7 @@ var defaultAggUiConfig = {
|
|
|
1542
1598
|
enableGradients: false,
|
|
1543
1599
|
enableVenueEventDiscoveryFilters: false,
|
|
1544
1600
|
enableNotifications: true,
|
|
1601
|
+
showLimitOrders: false,
|
|
1545
1602
|
showSportsMarkets: false
|
|
1546
1603
|
},
|
|
1547
1604
|
market: {
|
|
@@ -1573,7 +1630,7 @@ var mergeAggUiSearchConfig = (config) => {
|
|
|
1573
1630
|
};
|
|
1574
1631
|
};
|
|
1575
1632
|
var mergeAggUiConfig = (persisted, config) => {
|
|
1576
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z
|
|
1633
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$;
|
|
1577
1634
|
const locale = (_d = (_c = (_a = config == null ? void 0 : config.general) == null ? void 0 : _a.locale) != null ? _c : (_b = persisted.general) == null ? void 0 : _b.locale) != null ? _d : DEFAULT_LOCALE;
|
|
1578
1635
|
const theme = (_h = (_g = (_e = config == null ? void 0 : config.general) == null ? void 0 : _e.theme) != null ? _g : (_f = persisted.general) == null ? void 0 : _f.theme) != null ? _h : defaultAggUiConfig.general.theme;
|
|
1579
1636
|
const formatters = createFormatters(locale);
|
|
@@ -1596,27 +1653,28 @@ var mergeAggUiConfig = (persisted, config) => {
|
|
|
1596
1653
|
enableGradients: (_x = (_w = config == null ? void 0 : config.features) == null ? void 0 : _w.enableGradients) != null ? _x : defaultAggUiConfig.features.enableGradients,
|
|
1597
1654
|
enableVenueEventDiscoveryFilters: (_z = (_y = config == null ? void 0 : config.features) == null ? void 0 : _y.enableVenueEventDiscoveryFilters) != null ? _z : defaultAggUiConfig.features.enableVenueEventDiscoveryFilters,
|
|
1598
1655
|
enableNotifications: (_B = (_A = config == null ? void 0 : config.features) == null ? void 0 : _A.enableNotifications) != null ? _B : defaultAggUiConfig.features.enableNotifications,
|
|
1599
|
-
|
|
1656
|
+
showLimitOrders: (_D = (_C = config == null ? void 0 : config.features) == null ? void 0 : _C.showLimitOrders) != null ? _D : defaultAggUiConfig.features.showLimitOrders,
|
|
1657
|
+
showSportsMarkets: (_F = (_E = config == null ? void 0 : config.features) == null ? void 0 : _E.showSportsMarkets) != null ? _F : defaultAggUiConfig.features.showSportsMarkets
|
|
1600
1658
|
},
|
|
1601
1659
|
market: {
|
|
1602
|
-
arbitrageThreshold: (
|
|
1603
|
-
maxMidpointIdsPerRequest: (
|
|
1660
|
+
arbitrageThreshold: (_H = (_G = config == null ? void 0 : config.market) == null ? void 0 : _G.arbitrageThreshold) != null ? _H : defaultAggUiConfig.market.arbitrageThreshold,
|
|
1661
|
+
maxMidpointIdsPerRequest: (_J = (_I = config == null ? void 0 : config.market) == null ? void 0 : _I.maxMidpointIdsPerRequest) != null ? _J : defaultAggUiConfig.market.maxMidpointIdsPerRequest
|
|
1604
1662
|
},
|
|
1605
1663
|
chart: {
|
|
1606
|
-
defaultChartTimeRange: (
|
|
1607
|
-
selectedChartTimeRange: (
|
|
1664
|
+
defaultChartTimeRange: (_L = (_K = config == null ? void 0 : config.chart) == null ? void 0 : _K.defaultChartTimeRange) != null ? _L : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1665
|
+
selectedChartTimeRange: (_P = (_O = (_M = persisted.chart) == null ? void 0 : _M.selectedChartTimeRange) != null ? _O : (_N = config == null ? void 0 : config.chart) == null ? void 0 : _N.defaultChartTimeRange) != null ? _P : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1608
1666
|
setSelectedChartTimeRange: defaultAggUiConfig.chart.setSelectedChartTimeRange
|
|
1609
1667
|
},
|
|
1610
1668
|
formatting: {
|
|
1611
|
-
formatNumber: (
|
|
1612
|
-
formatPercent: (
|
|
1613
|
-
formatCurrency: (
|
|
1614
|
-
formatCompactCurrency: (
|
|
1615
|
-
formatDate: (
|
|
1669
|
+
formatNumber: (_R = (_Q = config == null ? void 0 : config.formatting) == null ? void 0 : _Q.formatNumber) != null ? _R : formatters.formatNumber,
|
|
1670
|
+
formatPercent: (_T = (_S = config == null ? void 0 : config.formatting) == null ? void 0 : _S.formatPercent) != null ? _T : formatters.formatPercent,
|
|
1671
|
+
formatCurrency: (_V = (_U = config == null ? void 0 : config.formatting) == null ? void 0 : _U.formatCurrency) != null ? _V : formatters.formatCurrency,
|
|
1672
|
+
formatCompactCurrency: (_X = (_W = config == null ? void 0 : config.formatting) == null ? void 0 : _W.formatCompactCurrency) != null ? _X : formatters.formatCompactCurrency,
|
|
1673
|
+
formatDate: (_Z = (_Y = config == null ? void 0 : config.formatting) == null ? void 0 : _Y.formatDate) != null ? _Z : formatters.formatDate
|
|
1616
1674
|
},
|
|
1617
1675
|
search: mergeAggUiSearchConfig(config == null ? void 0 : config.search),
|
|
1618
1676
|
trading: {
|
|
1619
|
-
executionMode: (
|
|
1677
|
+
executionMode: (_$ = (__ = config == null ? void 0 : config.trading) == null ? void 0 : __.executionMode) != null ? _$ : defaultAggUiConfig.trading.executionMode
|
|
1620
1678
|
},
|
|
1621
1679
|
walletActions: config == null ? void 0 : config.walletActions,
|
|
1622
1680
|
solanaRpcUrl: config == null ? void 0 : config.solanaRpcUrl
|
|
@@ -2056,31 +2114,73 @@ function AggBalanceProvider({ children }) {
|
|
|
2056
2114
|
return sum + tokenAcrossChains;
|
|
2057
2115
|
}, 0);
|
|
2058
2116
|
}, [managedBalances]);
|
|
2059
|
-
const
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
if (!isUsdBasedToken(token.tokenSymbol)) continue;
|
|
2065
|
-
for (const chain of token.chains) {
|
|
2066
|
-
const current = (_a = byChain.get(chain.chainId)) != null ? _a : {
|
|
2067
|
-
label: chainLabelFromId(chain.chainId),
|
|
2068
|
-
balance: 0,
|
|
2069
|
-
accountCount: 0
|
|
2070
|
-
};
|
|
2071
|
-
current.balance += toTokenUnits(chain.balanceRaw, (_b = chain.decimals) != null ? _b : token.decimals);
|
|
2072
|
-
current.accountCount += 1;
|
|
2073
|
-
byChain.set(chain.chainId, current);
|
|
2117
|
+
const availableBalance = (0, import_react3.useMemo)(() => {
|
|
2118
|
+
return managedBalances.cash.reduce((sum, token) => {
|
|
2119
|
+
if (!isUsdBasedToken(token.tokenSymbol)) return sum;
|
|
2120
|
+
if (token.availableRaw != null) {
|
|
2121
|
+
return sum + toTokenUnits(token.availableRaw, token.decimals);
|
|
2074
2122
|
}
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
})
|
|
2083
|
-
}, [
|
|
2123
|
+
return sum + token.chains.reduce(
|
|
2124
|
+
(chainSum, chain) => {
|
|
2125
|
+
var _a, _b;
|
|
2126
|
+
return chainSum + toTokenUnits((_a = chain.availableRaw) != null ? _a : chain.balanceRaw, (_b = chain.decimals) != null ? _b : token.decimals);
|
|
2127
|
+
},
|
|
2128
|
+
0
|
|
2129
|
+
);
|
|
2130
|
+
}, 0);
|
|
2131
|
+
}, [managedBalances]);
|
|
2132
|
+
const reservedBalance = (0, import_react3.useMemo)(() => {
|
|
2133
|
+
return managedBalances.cash.reduce((sum, token) => {
|
|
2134
|
+
if (!isUsdBasedToken(token.tokenSymbol)) return sum;
|
|
2135
|
+
if (token.reservedRaw != null) {
|
|
2136
|
+
return sum + toTokenUnits(token.reservedRaw, token.decimals);
|
|
2137
|
+
}
|
|
2138
|
+
return sum + token.chains.reduce(
|
|
2139
|
+
(chainSum, chain) => {
|
|
2140
|
+
var _a, _b;
|
|
2141
|
+
return chainSum + toTokenUnits((_a = chain.heldRaw) != null ? _a : "0", (_b = chain.decimals) != null ? _b : token.decimals);
|
|
2142
|
+
},
|
|
2143
|
+
0
|
|
2144
|
+
);
|
|
2145
|
+
}, 0);
|
|
2146
|
+
}, [managedBalances]);
|
|
2147
|
+
const buildBalanceBreakdown = (0, import_react3.useCallback)(
|
|
2148
|
+
(rawForChain) => {
|
|
2149
|
+
var _a, _b;
|
|
2150
|
+
const byChain = /* @__PURE__ */ new Map();
|
|
2151
|
+
const cash = managedBalances.cash;
|
|
2152
|
+
for (const token of cash) {
|
|
2153
|
+
if (!isUsdBasedToken(token.tokenSymbol)) continue;
|
|
2154
|
+
for (const chain of token.chains) {
|
|
2155
|
+
const current = (_a = byChain.get(chain.chainId)) != null ? _a : {
|
|
2156
|
+
label: chainLabelFromId(chain.chainId),
|
|
2157
|
+
balance: 0,
|
|
2158
|
+
accountCount: 0
|
|
2159
|
+
};
|
|
2160
|
+
current.balance += toTokenUnits(rawForChain(chain), (_b = chain.decimals) != null ? _b : token.decimals);
|
|
2161
|
+
current.accountCount += 1;
|
|
2162
|
+
byChain.set(chain.chainId, current);
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
return Array.from(byChain.entries()).sort((a, b) => a[1].label.localeCompare(b[1].label)).map(([chainId, value2]) => ({
|
|
2166
|
+
key: String(chainId),
|
|
2167
|
+
label: value2.label,
|
|
2168
|
+
balance: value2.balance,
|
|
2169
|
+
accountCount: value2.accountCount,
|
|
2170
|
+
venues: connectedVenues.length > 0 ? connectedVenues : void 0
|
|
2171
|
+
}));
|
|
2172
|
+
},
|
|
2173
|
+
[connectedVenues, managedBalances.cash]
|
|
2174
|
+
);
|
|
2175
|
+
const balanceBreakdown = (0, import_react3.useMemo)(() => {
|
|
2176
|
+
return buildBalanceBreakdown((chain) => chain.balanceRaw);
|
|
2177
|
+
}, [buildBalanceBreakdown]);
|
|
2178
|
+
const availableBalanceBreakdown = (0, import_react3.useMemo)(() => {
|
|
2179
|
+
return buildBalanceBreakdown((chain) => {
|
|
2180
|
+
var _a;
|
|
2181
|
+
return (_a = chain.availableRaw) != null ? _a : chain.balanceRaw;
|
|
2182
|
+
});
|
|
2183
|
+
}, [buildBalanceBreakdown]);
|
|
2084
2184
|
const positionsBalanceTotal = (0, import_react3.useMemo)(() => {
|
|
2085
2185
|
const positions = managedBalances.positions;
|
|
2086
2186
|
return positions.reduce(
|
|
@@ -2101,8 +2201,11 @@ function AggBalanceProvider({ children }) {
|
|
|
2101
2201
|
return {
|
|
2102
2202
|
managedBalances,
|
|
2103
2203
|
totalBalance: 0,
|
|
2204
|
+
availableBalance: 0,
|
|
2205
|
+
reservedBalance: 0,
|
|
2104
2206
|
positionsBalanceTotal: 0,
|
|
2105
2207
|
balanceBreakdown: [],
|
|
2208
|
+
availableBalanceBreakdown: [],
|
|
2106
2209
|
connectedVenues: [],
|
|
2107
2210
|
isLoading: false,
|
|
2108
2211
|
error: null,
|
|
@@ -2114,8 +2217,11 @@ function AggBalanceProvider({ children }) {
|
|
|
2114
2217
|
return {
|
|
2115
2218
|
managedBalances,
|
|
2116
2219
|
totalBalance,
|
|
2220
|
+
availableBalance,
|
|
2221
|
+
reservedBalance,
|
|
2117
2222
|
positionsBalanceTotal,
|
|
2118
2223
|
balanceBreakdown,
|
|
2224
|
+
availableBalanceBreakdown,
|
|
2119
2225
|
connectedVenues,
|
|
2120
2226
|
isLoading: isBalancesLoading,
|
|
2121
2227
|
error,
|
|
@@ -2124,6 +2230,8 @@ function AggBalanceProvider({ children }) {
|
|
|
2124
2230
|
};
|
|
2125
2231
|
}, [
|
|
2126
2232
|
balanceBreakdown,
|
|
2233
|
+
availableBalance,
|
|
2234
|
+
availableBalanceBreakdown,
|
|
2127
2235
|
balancesError,
|
|
2128
2236
|
connectedVenues,
|
|
2129
2237
|
isBalancesLoading,
|
|
@@ -2132,6 +2240,7 @@ function AggBalanceProvider({ children }) {
|
|
|
2132
2240
|
positionsBalanceTotal,
|
|
2133
2241
|
refetch,
|
|
2134
2242
|
refetchConnectionStatus,
|
|
2243
|
+
reservedBalance,
|
|
2135
2244
|
totalBalance
|
|
2136
2245
|
]);
|
|
2137
2246
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AggBalanceContext.Provider, { value, children });
|
|
@@ -3995,12 +4104,54 @@ function useExecuteManaged(options) {
|
|
|
3995
4104
|
});
|
|
3996
4105
|
}
|
|
3997
4106
|
|
|
3998
|
-
// src/execution/use-
|
|
4107
|
+
// src/execution/use-place-limit-order.ts
|
|
3999
4108
|
var import_react_query9 = require("@tanstack/react-query");
|
|
4000
|
-
function
|
|
4109
|
+
function usePlaceLimitOrder(options) {
|
|
4001
4110
|
const client = useAggClient();
|
|
4002
4111
|
const queryClient = (0, import_react_query9.useQueryClient)();
|
|
4003
4112
|
return (0, import_react_query9.useMutation)({
|
|
4113
|
+
mutationFn: (params) => client.placeLimitOrder(params),
|
|
4114
|
+
onSuccess: (data) => {
|
|
4115
|
+
var _a;
|
|
4116
|
+
queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
|
|
4117
|
+
queryClient.invalidateQueries({ queryKey: ["execution-orders"] });
|
|
4118
|
+
queryClient.invalidateQueries({ queryKey: executionKeys.positionsPrefix() });
|
|
4119
|
+
invalidateBalanceQueries(queryClient);
|
|
4120
|
+
(_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data);
|
|
4121
|
+
},
|
|
4122
|
+
onError: options == null ? void 0 : options.onError
|
|
4123
|
+
});
|
|
4124
|
+
}
|
|
4125
|
+
|
|
4126
|
+
// src/execution/use-cancel-managed-order.ts
|
|
4127
|
+
var import_react_query10 = require("@tanstack/react-query");
|
|
4128
|
+
function useCancelManagedOrder(options) {
|
|
4129
|
+
const client = useAggClient();
|
|
4130
|
+
const queryClient = (0, import_react_query10.useQueryClient)();
|
|
4131
|
+
return (0, import_react_query10.useMutation)({
|
|
4132
|
+
mutationFn: (orderId) => client.cancelManagedOrder(orderId),
|
|
4133
|
+
onSuccess: (data, orderId) => {
|
|
4134
|
+
var _a;
|
|
4135
|
+
queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
|
|
4136
|
+
queryClient.invalidateQueries({ queryKey: ["execution-orders"] });
|
|
4137
|
+
invalidatePositionQueries(queryClient);
|
|
4138
|
+
invalidateBalanceQueries(queryClient);
|
|
4139
|
+
invalidateUserActivityQueries(queryClient);
|
|
4140
|
+
(_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data, orderId);
|
|
4141
|
+
},
|
|
4142
|
+
onError: (error, orderId) => {
|
|
4143
|
+
var _a;
|
|
4144
|
+
(_a = options == null ? void 0 : options.onError) == null ? void 0 : _a.call(options, error, orderId);
|
|
4145
|
+
}
|
|
4146
|
+
});
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
// src/execution/use-withdraw-managed.ts
|
|
4150
|
+
var import_react_query11 = require("@tanstack/react-query");
|
|
4151
|
+
function useWithdrawManaged(options) {
|
|
4152
|
+
const client = useAggClient();
|
|
4153
|
+
const queryClient = (0, import_react_query11.useQueryClient)();
|
|
4154
|
+
return (0, import_react_query11.useMutation)({
|
|
4004
4155
|
mutationFn: (params) => client.withdrawManaged(params),
|
|
4005
4156
|
onSuccess: (data) => {
|
|
4006
4157
|
var _a;
|
|
@@ -4012,11 +4163,11 @@ function useWithdrawManaged(options) {
|
|
|
4012
4163
|
}
|
|
4013
4164
|
|
|
4014
4165
|
// src/execution/use-managed-balances.ts
|
|
4015
|
-
var
|
|
4166
|
+
var import_react_query12 = require("@tanstack/react-query");
|
|
4016
4167
|
function useManagedBalances(options) {
|
|
4017
4168
|
const client = useAggClient();
|
|
4018
4169
|
const { enabled = true, mode } = options != null ? options : {};
|
|
4019
|
-
const query = (0,
|
|
4170
|
+
const query = (0, import_react_query12.useQuery)({
|
|
4020
4171
|
queryKey: executionKeys.balances(mode),
|
|
4021
4172
|
queryFn: () => client.getManagedBalances(mode ? { mode } : void 0),
|
|
4022
4173
|
enabled,
|
|
@@ -4030,12 +4181,12 @@ function useManagedBalances(options) {
|
|
|
4030
4181
|
}
|
|
4031
4182
|
|
|
4032
4183
|
// src/execution/use-positions.ts
|
|
4033
|
-
var
|
|
4184
|
+
var import_react_query13 = require("@tanstack/react-query");
|
|
4034
4185
|
function usePositions(options) {
|
|
4035
4186
|
var _a, _b, _c, _d;
|
|
4036
4187
|
const client = useAggClient();
|
|
4037
4188
|
const { enabled = true, cursor, limit, status, mode } = options != null ? options : {};
|
|
4038
|
-
const query = (0,
|
|
4189
|
+
const query = (0, import_react_query13.useQuery)({
|
|
4039
4190
|
queryKey: executionKeys.positions(cursor, limit, status, mode),
|
|
4040
4191
|
queryFn: () => client.getPositions(__spreadValues({ cursor, limit, status }, mode ? { mode } : {})),
|
|
4041
4192
|
enabled,
|
|
@@ -4052,7 +4203,7 @@ function usePositions(options) {
|
|
|
4052
4203
|
|
|
4053
4204
|
// src/execution/use-deposit-addresses.ts
|
|
4054
4205
|
var import_react9 = require("react");
|
|
4055
|
-
var
|
|
4206
|
+
var import_react_query14 = require("@tanstack/react-query");
|
|
4056
4207
|
var SVM_CHAIN_IDS = /* @__PURE__ */ new Set([792703809]);
|
|
4057
4208
|
function getDepositAddress(chainId, data) {
|
|
4058
4209
|
return chainId !== void 0 && SVM_CHAIN_IDS.has(chainId) ? data.svmAddress : data.evmAddress;
|
|
@@ -4076,7 +4227,7 @@ function useDepositAddresses(options) {
|
|
|
4076
4227
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4077
4228
|
};
|
|
4078
4229
|
}, [enabled, poll, timeoutMs]);
|
|
4079
|
-
const query = (0,
|
|
4230
|
+
const query = (0, import_react_query14.useQuery)({
|
|
4080
4231
|
queryKey: executionKeys.depositAddresses(),
|
|
4081
4232
|
queryFn: () => client.getDepositAddresses(),
|
|
4082
4233
|
enabled,
|
|
@@ -4108,11 +4259,11 @@ function useDepositAddresses(options) {
|
|
|
4108
4259
|
}
|
|
4109
4260
|
|
|
4110
4261
|
// src/execution/use-sync-balances.ts
|
|
4111
|
-
var
|
|
4262
|
+
var import_react_query15 = require("@tanstack/react-query");
|
|
4112
4263
|
function useSyncBalances(options) {
|
|
4113
4264
|
const client = useAggClient();
|
|
4114
|
-
const queryClient = (0,
|
|
4115
|
-
return (0,
|
|
4265
|
+
const queryClient = (0, import_react_query15.useQueryClient)();
|
|
4266
|
+
return (0, import_react_query15.useMutation)({
|
|
4116
4267
|
mutationFn: () => client.syncManagedBalances(),
|
|
4117
4268
|
onSuccess: () => {
|
|
4118
4269
|
var _a;
|
|
@@ -4643,7 +4794,7 @@ var computeClosedPositionTotals = (group) => {
|
|
|
4643
4794
|
};
|
|
4644
4795
|
|
|
4645
4796
|
// src/execution/use-redeem.ts
|
|
4646
|
-
var
|
|
4797
|
+
var import_react_query16 = require("@tanstack/react-query");
|
|
4647
4798
|
var RedeemRejectedError = class extends Error {
|
|
4648
4799
|
constructor(message, response) {
|
|
4649
4800
|
super(message);
|
|
@@ -4654,8 +4805,8 @@ var RedeemRejectedError = class extends Error {
|
|
|
4654
4805
|
var isLegRejected = (status) => status === "ineligible" || status === "rejected";
|
|
4655
4806
|
var useRedeem = () => {
|
|
4656
4807
|
const client = useAggClient();
|
|
4657
|
-
const queryClient = (0,
|
|
4658
|
-
return (0,
|
|
4808
|
+
const queryClient = (0, import_react_query16.useQueryClient)();
|
|
4809
|
+
return (0, import_react_query16.useMutation)({
|
|
4659
4810
|
mutationFn: (body) => __async(null, null, function* () {
|
|
4660
4811
|
const response = yield client.redeem(body);
|
|
4661
4812
|
if (response.results.length > 0 && response.results.every((r) => isLegRejected(r.status))) {
|
|
@@ -4677,7 +4828,7 @@ var useOnRedeemEvent2 = (listener) => {
|
|
|
4677
4828
|
};
|
|
4678
4829
|
|
|
4679
4830
|
// src/execution/use-redeem-eligible-count.ts
|
|
4680
|
-
var
|
|
4831
|
+
var import_react_query17 = require("@tanstack/react-query");
|
|
4681
4832
|
var CLAIMABLE_COUNT_PAGE_LIMIT = 100;
|
|
4682
4833
|
var getClaimablePositionsCount = (client) => __async(null, null, function* () {
|
|
4683
4834
|
var _a;
|
|
@@ -4702,7 +4853,7 @@ var useRedeemEligibleCount = () => {
|
|
|
4702
4853
|
var _a;
|
|
4703
4854
|
const client = useAggClient();
|
|
4704
4855
|
const { isAuthenticated } = useAggAuthState();
|
|
4705
|
-
const query = (0,
|
|
4856
|
+
const query = (0, import_react_query17.useQuery)({
|
|
4706
4857
|
queryKey: executionKeys.claimablePositionsCount(),
|
|
4707
4858
|
queryFn: () => getClaimablePositionsCount(client),
|
|
4708
4859
|
enabled: isAuthenticated,
|
|
@@ -5178,7 +5329,7 @@ function useWithdrawEstimate({
|
|
|
5178
5329
|
|
|
5179
5330
|
// src/withdraw/use-withdrawal-lifecycle.ts
|
|
5180
5331
|
var import_react15 = require("react");
|
|
5181
|
-
var
|
|
5332
|
+
var import_react_query18 = require("@tanstack/react-query");
|
|
5182
5333
|
var INITIAL_STATE2 = {
|
|
5183
5334
|
pending: true,
|
|
5184
5335
|
status: null,
|
|
@@ -5235,7 +5386,7 @@ var restToLifecycleState = (response) => {
|
|
|
5235
5386
|
function useWithdrawalLifecycle(withdrawalId) {
|
|
5236
5387
|
const client = useAggClient();
|
|
5237
5388
|
const wsConnected = useAggWebSocketConnectionState();
|
|
5238
|
-
const queryClient = (0,
|
|
5389
|
+
const queryClient = (0, import_react_query18.useQueryClient)();
|
|
5239
5390
|
const [state, setState] = (0, import_react15.useState)(INITIAL_STATE2);
|
|
5240
5391
|
const stateRef = (0, import_react15.useRef)(state);
|
|
5241
5392
|
stateRef.current = state;
|
|
@@ -5304,7 +5455,7 @@ function useWithdrawalLifecycle(withdrawalId) {
|
|
|
5304
5455
|
}
|
|
5305
5456
|
|
|
5306
5457
|
// src/withdraw/use-withdraw-preview.ts
|
|
5307
|
-
var
|
|
5458
|
+
var import_react_query19 = require("@tanstack/react-query");
|
|
5308
5459
|
function useWithdrawPreview({
|
|
5309
5460
|
amountRaw,
|
|
5310
5461
|
tokenSymbol,
|
|
@@ -5314,7 +5465,7 @@ function useWithdrawPreview({
|
|
|
5314
5465
|
}) {
|
|
5315
5466
|
const client = useAggClient();
|
|
5316
5467
|
const enabled = !!amountRaw && BigInt(amountRaw || "0") > BigInt(0) && !!tokenSymbol && !!destinationChainId && !!destinationAddress;
|
|
5317
|
-
return (0,
|
|
5468
|
+
return (0, import_react_query19.useQuery)({
|
|
5318
5469
|
queryKey: [
|
|
5319
5470
|
"withdraw-preview",
|
|
5320
5471
|
tokenSymbol,
|
|
@@ -5451,7 +5602,7 @@ var requestAggAuthChooserOpen = () => {
|
|
|
5451
5602
|
};
|
|
5452
5603
|
|
|
5453
5604
|
// src/use-categories.ts
|
|
5454
|
-
var
|
|
5605
|
+
var import_react_query20 = require("@tanstack/react-query");
|
|
5455
5606
|
function useCategories(options) {
|
|
5456
5607
|
var _a, _b, _c, _d, _e, _f;
|
|
5457
5608
|
const client = useAggClient();
|
|
@@ -5459,7 +5610,7 @@ function useCategories(options) {
|
|
|
5459
5610
|
const parentId = (_b = options == null ? void 0 : options.parentId) != null ? _b : null;
|
|
5460
5611
|
const enabled = (_c = options == null ? void 0 : options.enabled) != null ? _c : true;
|
|
5461
5612
|
const limit = (_d = options == null ? void 0 : options.limit) != null ? _d : 20;
|
|
5462
|
-
const query = (0,
|
|
5613
|
+
const query = (0, import_react_query20.useInfiniteQuery)({
|
|
5463
5614
|
queryKey: [queryKeyScope, "parent", parentId != null ? parentId : "__root__", limit],
|
|
5464
5615
|
queryFn: (_0) => __async(null, [_0], function* ({ pageParam }) {
|
|
5465
5616
|
const res = yield client.getCategories(__spreadValues({
|
|
@@ -5491,7 +5642,7 @@ function useCategoryChildren(options) {
|
|
|
5491
5642
|
const parentIds = Array.from(
|
|
5492
5643
|
new Set(((_d = options == null ? void 0 : options.parentIds) != null ? _d : []).filter((parentId) => Boolean(parentId)))
|
|
5493
5644
|
);
|
|
5494
|
-
const queries = (0,
|
|
5645
|
+
const queries = (0, import_react_query20.useQueries)({
|
|
5495
5646
|
queries: parentIds.map((parentId) => ({
|
|
5496
5647
|
queryKey: [queryKeyScope, "parent", parentId, limit],
|
|
5497
5648
|
queryFn: () => __async(null, null, function* () {
|
|
@@ -5534,7 +5685,7 @@ function useDebouncedValue(value, delay) {
|
|
|
5534
5685
|
}
|
|
5535
5686
|
|
|
5536
5687
|
// src/use-execution-orders.ts
|
|
5537
|
-
var
|
|
5688
|
+
var import_react_query21 = require("@tanstack/react-query");
|
|
5538
5689
|
function useExecutionOrders(options = {}) {
|
|
5539
5690
|
var _a, _b;
|
|
5540
5691
|
const client = useAggClient();
|
|
@@ -5547,7 +5698,7 @@ function useExecutionOrders(options = {}) {
|
|
|
5547
5698
|
enabled = true,
|
|
5548
5699
|
refetchIntervalMs = false
|
|
5549
5700
|
} = options;
|
|
5550
|
-
const query = (0,
|
|
5701
|
+
const query = (0, import_react_query21.useInfiniteQuery)({
|
|
5551
5702
|
// quoteId + orderId are part of the cache key — different filters
|
|
5552
5703
|
// produce different result sets, so they have to vary the key.
|
|
5553
5704
|
queryKey: [
|
|
@@ -5583,7 +5734,7 @@ function useExecutionOrders(options = {}) {
|
|
|
5583
5734
|
}
|
|
5584
5735
|
|
|
5585
5736
|
// src/use-user-activity.ts
|
|
5586
|
-
var
|
|
5737
|
+
var import_react_query22 = require("@tanstack/react-query");
|
|
5587
5738
|
var DEFAULT_PENDING_REFETCH_INTERVAL_MS = 15e3;
|
|
5588
5739
|
var PENDING_ACTIVITY_STATUSES = /* @__PURE__ */ new Set([
|
|
5589
5740
|
"pending",
|
|
@@ -5617,7 +5768,7 @@ function useUserActivity(options = {}) {
|
|
|
5617
5768
|
enabled = true,
|
|
5618
5769
|
pendingRefetchIntervalMs = DEFAULT_PENDING_REFETCH_INTERVAL_MS
|
|
5619
5770
|
} = options;
|
|
5620
|
-
const query = (0,
|
|
5771
|
+
const query = (0, import_react_query22.useInfiniteQuery)({
|
|
5621
5772
|
queryKey: userActivityQueryKeys.feed(type, limit),
|
|
5622
5773
|
queryFn: ({ pageParam }) => client.getUserActivity({
|
|
5623
5774
|
type,
|
|
@@ -5634,7 +5785,7 @@ function useUserActivity(options = {}) {
|
|
|
5634
5785
|
// flight (typically after a deposit / withdraw cache invalidation).
|
|
5635
5786
|
// Without this the feed flashes to the skeleton mid-session, which
|
|
5636
5787
|
// is worse UX than briefly showing slightly-stale rows.
|
|
5637
|
-
placeholderData:
|
|
5788
|
+
placeholderData: import_react_query22.keepPreviousData,
|
|
5638
5789
|
refetchInterval: (q) => {
|
|
5639
5790
|
if (pendingRefetchIntervalMs === false) return false;
|
|
5640
5791
|
const data = q.state.data;
|
|
@@ -5679,12 +5830,12 @@ function useExternalId(options = {}) {
|
|
|
5679
5830
|
}
|
|
5680
5831
|
|
|
5681
5832
|
// src/use-execution-positions.ts
|
|
5682
|
-
var
|
|
5833
|
+
var import_react_query23 = require("@tanstack/react-query");
|
|
5683
5834
|
function useExecutionPositions(options = {}) {
|
|
5684
5835
|
var _a, _b;
|
|
5685
5836
|
const client = useAggClient();
|
|
5686
5837
|
const { limit = 50, status, mode, enabled = true } = options;
|
|
5687
|
-
const query = (0,
|
|
5838
|
+
const query = (0, import_react_query23.useInfiniteQuery)({
|
|
5688
5839
|
queryKey: executionKeys.positions(null, limit, status != null ? status : null, mode != null ? mode : null),
|
|
5689
5840
|
queryFn: ({ pageParam }) => client.getExecutionPositions(__spreadProps(__spreadValues({
|
|
5690
5841
|
limit,
|
|
@@ -5715,7 +5866,7 @@ var import_react23 = require("react");
|
|
|
5715
5866
|
var import_sdk3 = require("@agg-build/sdk");
|
|
5716
5867
|
|
|
5717
5868
|
// src/use-market-chart.ts
|
|
5718
|
-
var
|
|
5869
|
+
var import_react_query24 = require("@tanstack/react-query");
|
|
5719
5870
|
|
|
5720
5871
|
// src/market-data/subscription.ts
|
|
5721
5872
|
var import_react21 = require("react");
|
|
@@ -5800,7 +5951,7 @@ function useMarketChart(options) {
|
|
|
5800
5951
|
orderbook: true,
|
|
5801
5952
|
trades: true
|
|
5802
5953
|
});
|
|
5803
|
-
const queries = (0,
|
|
5954
|
+
const queries = (0, import_react_query24.useQueries)({
|
|
5804
5955
|
queries: outcomeIds.map((outcomeId) => ({
|
|
5805
5956
|
// Cache key is intentionally time-free. The rolling window's
|
|
5806
5957
|
// startTs/endTs advance on every bucket but the user expects the same
|
|
@@ -5835,7 +5986,7 @@ function useMarketChart(options) {
|
|
|
5835
5986
|
gcTime: 60 * 6e4,
|
|
5836
5987
|
refetchOnWindowFocus: false,
|
|
5837
5988
|
retry: 1,
|
|
5838
|
-
placeholderData:
|
|
5989
|
+
placeholderData: import_react_query24.keepPreviousData,
|
|
5839
5990
|
refetchInterval: refetchIntervalMs != null && refetchIntervalMs > 0 ? refetchIntervalMs : false,
|
|
5840
5991
|
refetchIntervalInBackground: false
|
|
5841
5992
|
}))
|
|
@@ -6078,7 +6229,7 @@ function useEventOrderbookData(venueMarkets, selectedMarketId) {
|
|
|
6078
6229
|
}
|
|
6079
6230
|
|
|
6080
6231
|
// src/use-live-market.ts
|
|
6081
|
-
var
|
|
6232
|
+
var import_react_query25 = require("@tanstack/react-query");
|
|
6082
6233
|
function outcomeOrderbookToState(response, marketId) {
|
|
6083
6234
|
var _a, _b, _c, _d;
|
|
6084
6235
|
const { venue, orderbook, midpoint, spread, seq, checksum, timestamp, venueMarketOutcomeId } = response;
|
|
@@ -6128,7 +6279,7 @@ function useLiveMarket(canonicalMarketId) {
|
|
|
6128
6279
|
enabled: isLiveSubscriptionEnabled,
|
|
6129
6280
|
orderbook: true
|
|
6130
6281
|
});
|
|
6131
|
-
const query = (0,
|
|
6282
|
+
const query = (0, import_react_query25.useQuery)({
|
|
6132
6283
|
queryKey: marketDataKeys.live(canonicalMarketId != null ? canonicalMarketId : "__disabled__"),
|
|
6133
6284
|
queryFn: () => __async(null, null, function* () {
|
|
6134
6285
|
return createMarketLiveState(canonicalMarketId != null ? canonicalMarketId : "__disabled__");
|
|
@@ -6140,7 +6291,7 @@ function useLiveMarket(canonicalMarketId) {
|
|
|
6140
6291
|
isConnected: Boolean(isLiveSubscriptionEnabled && isConnected)
|
|
6141
6292
|
})
|
|
6142
6293
|
});
|
|
6143
|
-
const seedQuery = (0,
|
|
6294
|
+
const seedQuery = (0, import_react_query25.useQuery)({
|
|
6144
6295
|
queryKey: ["live-market-seed", canonicalMarketId],
|
|
6145
6296
|
queryFn: ({ signal }) => canonicalMarketId ? client.getOutcomeOrderbook(canonicalMarketId, { signal }) : Promise.resolve(null),
|
|
6146
6297
|
enabled: Boolean(canonicalMarketId),
|
|
@@ -6161,7 +6312,7 @@ function useLiveMarket(canonicalMarketId) {
|
|
|
6161
6312
|
|
|
6162
6313
|
// src/use-live-outcome-prices.ts
|
|
6163
6314
|
var import_react26 = require("react");
|
|
6164
|
-
var
|
|
6315
|
+
var import_react_query26 = require("@tanstack/react-query");
|
|
6165
6316
|
var EMPTY_PRICES = /* @__PURE__ */ new Map();
|
|
6166
6317
|
var buildMidpointFingerprint = (outcomeIds, queries) => {
|
|
6167
6318
|
var _a, _b, _c;
|
|
@@ -6187,7 +6338,7 @@ function useLiveOutcomePrices(venueMarkets) {
|
|
|
6187
6338
|
}
|
|
6188
6339
|
return [...ids].sort();
|
|
6189
6340
|
}, [venueMarkets]);
|
|
6190
|
-
const queries = (0,
|
|
6341
|
+
const queries = (0, import_react_query26.useQueries)({
|
|
6191
6342
|
queries: outcomeIds.map((id) => ({
|
|
6192
6343
|
queryKey: marketDataKeys.live(id),
|
|
6193
6344
|
queryFn: () => createMarketLiveState(id),
|
|
@@ -6236,7 +6387,7 @@ function findLivePriceById(livePrices, id) {
|
|
|
6236
6387
|
|
|
6237
6388
|
// src/use-live-best-prices.ts
|
|
6238
6389
|
var import_react27 = require("react");
|
|
6239
|
-
var
|
|
6390
|
+
var import_react_query27 = require("@tanstack/react-query");
|
|
6240
6391
|
var EMPTY = /* @__PURE__ */ new Map();
|
|
6241
6392
|
var EMPTY_CANDIDATES = /* @__PURE__ */ new Map();
|
|
6242
6393
|
var extractOutcomeBestPrices = (state) => {
|
|
@@ -6279,7 +6430,7 @@ function useLiveBestPrices(venueMarkets) {
|
|
|
6279
6430
|
}
|
|
6280
6431
|
return [...ids].sort();
|
|
6281
6432
|
}, [venueMarkets]);
|
|
6282
|
-
const queries = (0,
|
|
6433
|
+
const queries = (0, import_react_query27.useQueries)({
|
|
6283
6434
|
queries: outcomeIds.map((id) => ({
|
|
6284
6435
|
queryKey: marketDataKeys.live(id),
|
|
6285
6436
|
queryFn: () => createMarketLiveState(id),
|
|
@@ -6498,7 +6649,7 @@ function useLiveBestPriceCandidates(venueMarkets) {
|
|
|
6498
6649
|
}
|
|
6499
6650
|
return [...ids].sort();
|
|
6500
6651
|
}, [venueMarkets]);
|
|
6501
|
-
const queries = (0,
|
|
6652
|
+
const queries = (0, import_react_query27.useQueries)({
|
|
6502
6653
|
queries: outcomeIds.map((id) => ({
|
|
6503
6654
|
queryKey: marketDataKeys.live(id),
|
|
6504
6655
|
queryFn: () => createMarketLiveState(id),
|
|
@@ -6542,7 +6693,7 @@ function useLiveTrades(canonicalMarketId) {
|
|
|
6542
6693
|
}
|
|
6543
6694
|
|
|
6544
6695
|
// src/use-midpoints.ts
|
|
6545
|
-
var
|
|
6696
|
+
var import_react_query28 = require("@tanstack/react-query");
|
|
6546
6697
|
var import_react28 = require("react");
|
|
6547
6698
|
var normalizeVenueMarketIds = (venueMarkets) => {
|
|
6548
6699
|
var _a;
|
|
@@ -6721,7 +6872,7 @@ function useMidpoints(venueMarkets, options) {
|
|
|
6721
6872
|
() => resolveBestMidpointCandidateOutcomeIds(venueMarkets),
|
|
6722
6873
|
[venueMarkets]
|
|
6723
6874
|
);
|
|
6724
|
-
const { data, isLoading } = (0,
|
|
6875
|
+
const { data, isLoading } = (0, import_react_query28.useQuery)({
|
|
6725
6876
|
queryKey: ["midpoints", ids, maxMidpointIdsPerRequest],
|
|
6726
6877
|
queryFn: () => client.getMidpoints(ids, { bestPrice: true, maxMidpointIdsPerRequest }),
|
|
6727
6878
|
enabled: ids.length > 0,
|
|
@@ -6866,10 +7017,10 @@ var useRollingChartWindow = (options) => {
|
|
|
6866
7017
|
};
|
|
6867
7018
|
|
|
6868
7019
|
// src/use-market-orderbook.ts
|
|
6869
|
-
var
|
|
7020
|
+
var import_react_query29 = require("@tanstack/react-query");
|
|
6870
7021
|
function useMarketOrderbook(options) {
|
|
6871
7022
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6872
|
-
const queryClient = (0,
|
|
7023
|
+
const queryClient = (0, import_react_query29.useQueryClient)();
|
|
6873
7024
|
const ws = useAggWebSocket();
|
|
6874
7025
|
const isConnected = useAggWebSocketConnectionState();
|
|
6875
7026
|
const {
|
|
@@ -6887,7 +7038,7 @@ function useMarketOrderbook(options) {
|
|
|
6887
7038
|
enabled: enabled && !!selectedOutcomeId,
|
|
6888
7039
|
orderbook: true
|
|
6889
7040
|
});
|
|
6890
|
-
const liveQueries = (0,
|
|
7041
|
+
const liveQueries = (0, import_react_query29.useQueries)({
|
|
6891
7042
|
queries: subscriptionIds.map((subscriptionId) => ({
|
|
6892
7043
|
queryKey: marketDataKeys.live(subscriptionId),
|
|
6893
7044
|
queryFn: () => createMarketLiveState(subscriptionId),
|
|
@@ -7011,7 +7162,7 @@ function useArbFeed() {
|
|
|
7011
7162
|
}
|
|
7012
7163
|
|
|
7013
7164
|
// src/use-order-book.ts
|
|
7014
|
-
var
|
|
7165
|
+
var import_react_query30 = require("@tanstack/react-query");
|
|
7015
7166
|
function useOrderBook(options) {
|
|
7016
7167
|
const client = useAggClient();
|
|
7017
7168
|
const { orderbooks, enabled = true, canonicalMarketId } = options;
|
|
@@ -7024,7 +7175,7 @@ function useOrderBook(options) {
|
|
|
7024
7175
|
venueMarketOutcomeId: outcome.id
|
|
7025
7176
|
})) : void 0
|
|
7026
7177
|
});
|
|
7027
|
-
const batchedResult = (0,
|
|
7178
|
+
const batchedResult = (0, import_react_query30.useQuery)({
|
|
7028
7179
|
queryKey: requestedVenueMarketIds.length ? ["orderbooks", requestedVenueMarketIds, null] : ["orderbooks", "__disabled__", null],
|
|
7029
7180
|
queryFn: ({ signal }) => client.getOrderbooks(
|
|
7030
7181
|
{
|
|
@@ -7037,7 +7188,7 @@ function useOrderBook(options) {
|
|
|
7037
7188
|
gcTime: 5 * 6e4,
|
|
7038
7189
|
refetchOnWindowFocus: false,
|
|
7039
7190
|
retry: 1,
|
|
7040
|
-
placeholderData:
|
|
7191
|
+
placeholderData: import_react_query30.keepPreviousData
|
|
7041
7192
|
});
|
|
7042
7193
|
const data = (() => {
|
|
7043
7194
|
var _a, _b;
|
|
@@ -7092,7 +7243,7 @@ function useOrderBook(options) {
|
|
|
7092
7243
|
}
|
|
7093
7244
|
|
|
7094
7245
|
// src/use-orderbook-quote.ts
|
|
7095
|
-
var
|
|
7246
|
+
var import_react_query31 = require("@tanstack/react-query");
|
|
7096
7247
|
var QUOTE_DEBOUNCE_MS = 300;
|
|
7097
7248
|
var createUnavailableOrderbookError = (message, code, retryable) => {
|
|
7098
7249
|
const error = new Error(message);
|
|
@@ -7154,7 +7305,7 @@ function useOrderbookQuote(options) {
|
|
|
7154
7305
|
const { marketId, side, size, enabled = true } = options;
|
|
7155
7306
|
const debouncedSize = useDebouncedValue(size, QUOTE_DEBOUNCE_MS);
|
|
7156
7307
|
const shouldFetch = enabled && !!marketId && debouncedSize > 0;
|
|
7157
|
-
const query = (0,
|
|
7308
|
+
const query = (0, import_react_query31.useQuery)({
|
|
7158
7309
|
queryKey: marketId ? marketDataKeys.orderbookQuote(marketId, side, debouncedSize) : ["market-data", "orderbook-quote", "__disabled__"],
|
|
7159
7310
|
queryFn: () => __async(null, null, function* () {
|
|
7160
7311
|
var _a2, _b, _c, _d;
|
|
@@ -7185,7 +7336,7 @@ function useOrderbookQuote(options) {
|
|
|
7185
7336
|
staleTime: 1e4,
|
|
7186
7337
|
gcTime: 5 * 6e4,
|
|
7187
7338
|
retry: 1,
|
|
7188
|
-
placeholderData:
|
|
7339
|
+
placeholderData: import_react_query31.keepPreviousData
|
|
7189
7340
|
});
|
|
7190
7341
|
return {
|
|
7191
7342
|
data: (_a = query.data) != null ? _a : null,
|
|
@@ -7196,12 +7347,12 @@ function useOrderbookQuote(options) {
|
|
|
7196
7347
|
}
|
|
7197
7348
|
|
|
7198
7349
|
// src/use-orders.ts
|
|
7199
|
-
var
|
|
7350
|
+
var import_react_query32 = require("@tanstack/react-query");
|
|
7200
7351
|
function useOrders(options = {}) {
|
|
7201
7352
|
var _a, _b, _c, _d;
|
|
7202
7353
|
const client = useAggClient();
|
|
7203
7354
|
const { userId, status, limit = 50, offset = 0, enabled = true } = options;
|
|
7204
|
-
const query = (0,
|
|
7355
|
+
const query = (0, import_react_query32.useQuery)({
|
|
7205
7356
|
queryKey: ["orders", userId != null ? userId : "me", status != null ? status : "all", limit, offset],
|
|
7206
7357
|
queryFn: () => client.getOrders({
|
|
7207
7358
|
userId,
|
|
@@ -7218,13 +7369,13 @@ function useOrders(options = {}) {
|
|
|
7218
7369
|
}
|
|
7219
7370
|
|
|
7220
7371
|
// src/use-search.ts
|
|
7221
|
-
var
|
|
7372
|
+
var import_react_query33 = require("@tanstack/react-query");
|
|
7222
7373
|
var import_react31 = require("react");
|
|
7223
7374
|
function useSearch(options) {
|
|
7224
7375
|
var _a, _b, _c, _d;
|
|
7225
7376
|
const client = (0, import_react31.useContext)(AggClientContext);
|
|
7226
|
-
const queryClient = (0, import_react31.useContext)(
|
|
7227
|
-
const [fallbackQueryClient] = (0, import_react31.useState)(() => new
|
|
7377
|
+
const queryClient = (0, import_react31.useContext)(import_react_query33.QueryClientContext);
|
|
7378
|
+
const [fallbackQueryClient] = (0, import_react31.useState)(() => new import_react_query33.QueryClient());
|
|
7228
7379
|
const { q, type, categoryIds, status, limit = 20, enabled = true, deep = false } = options;
|
|
7229
7380
|
const isEnabled = enabled && q.length > 0;
|
|
7230
7381
|
(0, import_react31.useEffect)(() => {
|
|
@@ -7237,7 +7388,7 @@ function useSearch(options) {
|
|
|
7237
7388
|
if (isEnabled && !client) {
|
|
7238
7389
|
throw new Error("useSearch must be used within an <AggProvider>");
|
|
7239
7390
|
}
|
|
7240
|
-
const query = (0,
|
|
7391
|
+
const query = (0, import_react_query33.useInfiniteQuery)(
|
|
7241
7392
|
{
|
|
7242
7393
|
// deep is part of the key — TanStack treats deep vs light as
|
|
7243
7394
|
// independent queries so users can have both modes cached side-by-side.
|
|
@@ -7271,7 +7422,7 @@ function useSearch(options) {
|
|
|
7271
7422
|
if (!lastPage.hasMore) return void 0;
|
|
7272
7423
|
return (_a2 = lastPage.nextCursor) != null ? _a2 : void 0;
|
|
7273
7424
|
},
|
|
7274
|
-
placeholderData:
|
|
7425
|
+
placeholderData: import_react_query33.keepPreviousData,
|
|
7275
7426
|
enabled: isEnabled && !!client
|
|
7276
7427
|
},
|
|
7277
7428
|
queryClient != null ? queryClient : fallbackQueryClient
|
|
@@ -7379,7 +7530,7 @@ function useMarketSearch(options) {
|
|
|
7379
7530
|
}
|
|
7380
7531
|
|
|
7381
7532
|
// src/use-smart-route.ts
|
|
7382
|
-
var
|
|
7533
|
+
var import_react_query34 = require("@tanstack/react-query");
|
|
7383
7534
|
|
|
7384
7535
|
// src/smart-route-refresh-policy.ts
|
|
7385
7536
|
var THIN_SMART_ROUTE_REFETCH_INTERVAL_MS = 5e3;
|
|
@@ -7527,7 +7678,7 @@ function useSmartRoute(options) {
|
|
|
7527
7678
|
const resolvedVenueMarketOutcomeId = (_a = venueMarketOutcomeId != null ? venueMarketOutcomeId : venueMarketId) != null ? _a : outcomeId;
|
|
7528
7679
|
const hasValidInput = (maxSpend != null ? maxSpend : 0) > 0 || (sellShares != null ? sellShares : 0) > 0;
|
|
7529
7680
|
const queryEnabled = enabled && !!resolvedVenueMarketOutcomeId && hasValidInput;
|
|
7530
|
-
const query = (0,
|
|
7681
|
+
const query = (0, import_react_query34.useQuery)({
|
|
7531
7682
|
queryKey: [
|
|
7532
7683
|
"smart-route",
|
|
7533
7684
|
resolvedVenueMarketOutcomeId,
|
|
@@ -7578,7 +7729,7 @@ function useSmartRoute(options) {
|
|
|
7578
7729
|
refetchOnWindowFocus: false,
|
|
7579
7730
|
refetchIntervalInBackground: false,
|
|
7580
7731
|
retry: 1,
|
|
7581
|
-
placeholderData:
|
|
7732
|
+
placeholderData: import_react_query34.keepPreviousData
|
|
7582
7733
|
});
|
|
7583
7734
|
const error = query.error;
|
|
7584
7735
|
let loadingReason = null;
|
|
@@ -7600,12 +7751,12 @@ function useSmartRoute(options) {
|
|
|
7600
7751
|
}
|
|
7601
7752
|
|
|
7602
7753
|
// src/use-user-holdings.ts
|
|
7603
|
-
var
|
|
7754
|
+
var import_react_query35 = require("@tanstack/react-query");
|
|
7604
7755
|
function useUserHoldings(options) {
|
|
7605
7756
|
var _a, _b;
|
|
7606
7757
|
const client = useAggClient();
|
|
7607
7758
|
const { venue, venueMarketId, venueEventId, enabled = true } = options;
|
|
7608
|
-
const query = (0,
|
|
7759
|
+
const query = (0, import_react_query35.useInfiniteQuery)({
|
|
7609
7760
|
queryKey: ["user-holdings", venue, venueMarketId, venueEventId],
|
|
7610
7761
|
queryFn: (_0) => __async(null, [_0], function* ({ pageParam }) {
|
|
7611
7762
|
return client.getUserHoldings({
|
|
@@ -7634,7 +7785,7 @@ function useUserHoldings(options) {
|
|
|
7634
7785
|
var import_react34 = require("react");
|
|
7635
7786
|
|
|
7636
7787
|
// src/use-venue-event.ts
|
|
7637
|
-
var
|
|
7788
|
+
var import_react_query36 = require("@tanstack/react-query");
|
|
7638
7789
|
var RESOLUTION_POLL_MS = 15e3;
|
|
7639
7790
|
var RESOLUTION_POLL_MAX_PAST_END_MS = 60 * 6e4;
|
|
7640
7791
|
function resolutionPollInterval(event) {
|
|
@@ -7652,7 +7803,7 @@ function useVenueEvent(options) {
|
|
|
7652
7803
|
var _a;
|
|
7653
7804
|
const client = useAggClient();
|
|
7654
7805
|
const { eventId, enabled = true } = options;
|
|
7655
|
-
const query = (0,
|
|
7806
|
+
const query = (0, import_react_query36.useQuery)({
|
|
7656
7807
|
queryKey: ["venue-event", eventId],
|
|
7657
7808
|
queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
|
|
7658
7809
|
return client.getVenueEventById(eventId, { signal });
|
|
@@ -7672,13 +7823,13 @@ function useVenueEvent(options) {
|
|
|
7672
7823
|
}
|
|
7673
7824
|
|
|
7674
7825
|
// src/use-venue-markets.ts
|
|
7675
|
-
var
|
|
7826
|
+
var import_react_query37 = require("@tanstack/react-query");
|
|
7676
7827
|
var import_react33 = require("react");
|
|
7677
7828
|
function useVenueMarkets(options) {
|
|
7678
7829
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
7679
7830
|
const client = (0, import_react33.useContext)(AggClientContext);
|
|
7680
|
-
const queryClient = (0, import_react33.useContext)(
|
|
7681
|
-
const [fallbackQueryClient] = (0, import_react33.useState)(() => new
|
|
7831
|
+
const queryClient = (0, import_react33.useContext)(import_react_query37.QueryClientContext);
|
|
7832
|
+
const [fallbackQueryClient] = (0, import_react33.useState)(() => new import_react_query37.QueryClient());
|
|
7682
7833
|
const venue = options == null ? void 0 : options.venue;
|
|
7683
7834
|
const venueEventId = options == null ? void 0 : options.venueEventId;
|
|
7684
7835
|
const search = options == null ? void 0 : options.search;
|
|
@@ -7705,7 +7856,7 @@ function useVenueMarkets(options) {
|
|
|
7705
7856
|
if (enabled && !client) {
|
|
7706
7857
|
throw new Error("useVenueMarkets must be used within an <AggProvider>");
|
|
7707
7858
|
}
|
|
7708
|
-
const query = (0,
|
|
7859
|
+
const query = (0, import_react_query37.useInfiniteQuery)(
|
|
7709
7860
|
{
|
|
7710
7861
|
queryKey: [
|
|
7711
7862
|
"venue-markets",
|
|
@@ -7816,13 +7967,13 @@ function useEnrichedVenueEvent(options) {
|
|
|
7816
7967
|
}
|
|
7817
7968
|
|
|
7818
7969
|
// src/use-venue-events.ts
|
|
7819
|
-
var
|
|
7970
|
+
var import_react_query38 = require("@tanstack/react-query");
|
|
7820
7971
|
var import_react35 = require("react");
|
|
7821
7972
|
function useVenueEvents(options) {
|
|
7822
7973
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
7823
7974
|
const client = (0, import_react35.useContext)(AggClientContext);
|
|
7824
|
-
const queryClient = (0, import_react35.useContext)(
|
|
7825
|
-
const [fallbackQueryClient] = (0, import_react35.useState)(() => new
|
|
7975
|
+
const queryClient = (0, import_react35.useContext)(import_react_query38.QueryClientContext);
|
|
7976
|
+
const [fallbackQueryClient] = (0, import_react35.useState)(() => new import_react_query38.QueryClient());
|
|
7826
7977
|
const venues = options == null ? void 0 : options.venues;
|
|
7827
7978
|
const search = options == null ? void 0 : options.search;
|
|
7828
7979
|
const categoryIds = options == null ? void 0 : options.categoryIds;
|
|
@@ -7849,7 +8000,7 @@ function useVenueEvents(options) {
|
|
|
7849
8000
|
if (enabled && !client) {
|
|
7850
8001
|
throw new Error("useVenueEvents must be used within an <AggProvider>");
|
|
7851
8002
|
}
|
|
7852
|
-
const query = (0,
|
|
8003
|
+
const query = (0, import_react_query38.useInfiniteQuery)(
|
|
7853
8004
|
{
|
|
7854
8005
|
queryKey: [
|
|
7855
8006
|
queryKeyScope,
|
|
@@ -7896,7 +8047,7 @@ function useVenueEvents(options) {
|
|
|
7896
8047
|
return (_a2 = lastPage.nextCursor) != null ? _a2 : void 0;
|
|
7897
8048
|
},
|
|
7898
8049
|
// TODO: RMIK - Comment out to show skeletons on category switch
|
|
7899
|
-
placeholderData:
|
|
8050
|
+
placeholderData: import_react_query38.keepPreviousData,
|
|
7900
8051
|
enabled: enabled && !!client
|
|
7901
8052
|
},
|
|
7902
8053
|
queryClient != null ? queryClient : fallbackQueryClient
|
|
@@ -7938,7 +8089,7 @@ function useVenueEvents(options) {
|
|
|
7938
8089
|
}
|
|
7939
8090
|
|
|
7940
8091
|
// src/use-venue-market-midpoints.ts
|
|
7941
|
-
var
|
|
8092
|
+
var import_react_query39 = require("@tanstack/react-query");
|
|
7942
8093
|
var normalizeVenueMarketIds2 = (venueMarketIds) => {
|
|
7943
8094
|
return [
|
|
7944
8095
|
...new Set(venueMarketIds.map((venueMarketId) => venueMarketId.trim()).filter(Boolean))
|
|
@@ -7977,7 +8128,7 @@ function useVenueMarketMidpoints(options) {
|
|
|
7977
8128
|
const enabled = (_a = options.enabled) != null ? _a : true;
|
|
7978
8129
|
const requestedVenueMarketIds = normalizeVenueMarketIds2(options.venueMarketIds);
|
|
7979
8130
|
const maxMidpointIdsPerRequest = (_b = options.maxMidpointIdsPerRequest) != null ? _b : configuredMaxMidpointIdsPerRequest;
|
|
7980
|
-
const query = (0,
|
|
8131
|
+
const query = (0, import_react_query39.useQuery)({
|
|
7981
8132
|
queryKey: requestedVenueMarketIds.length ? ["venue-market-midpoints", requestedVenueMarketIds, maxMidpointIdsPerRequest] : ["venue-market-midpoints", "__disabled__"],
|
|
7982
8133
|
queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
|
|
7983
8134
|
if (requestedVenueMarketIds.length === 0) {
|
|
@@ -7993,7 +8144,7 @@ function useVenueMarketMidpoints(options) {
|
|
|
7993
8144
|
gcTime: 5 * 6e4,
|
|
7994
8145
|
refetchOnWindowFocus: false,
|
|
7995
8146
|
retry: 1,
|
|
7996
|
-
placeholderData:
|
|
8147
|
+
placeholderData: import_react_query39.keepPreviousData
|
|
7997
8148
|
});
|
|
7998
8149
|
const midpointRows = (_d = (_c = query.data) == null ? void 0 : _c.data) != null ? _d : [];
|
|
7999
8150
|
const midpointsByVenueMarketId = mapMidpointsByVenueMarketId(midpointRows);
|
|
@@ -8244,12 +8395,12 @@ function useVisibleIds(options = {}) {
|
|
|
8244
8395
|
}
|
|
8245
8396
|
|
|
8246
8397
|
// src/use-app-config.ts
|
|
8247
|
-
var
|
|
8398
|
+
var import_react_query40 = require("@tanstack/react-query");
|
|
8248
8399
|
var FIVE_MINUTES = 5 * 60 * 1e3;
|
|
8249
8400
|
var APP_CONFIG_QUERY_KEY = ["agg", "app-config"];
|
|
8250
8401
|
function useAppConfig() {
|
|
8251
8402
|
const client = useAggClient();
|
|
8252
|
-
const query = (0,
|
|
8403
|
+
const query = (0, import_react_query40.useQuery)({
|
|
8253
8404
|
queryKey: APP_CONFIG_QUERY_KEY,
|
|
8254
8405
|
queryFn: () => client.getAppConfig(),
|
|
8255
8406
|
staleTime: FIVE_MINUTES
|
|
@@ -8261,8 +8412,8 @@ function useAppConfig() {
|
|
|
8261
8412
|
});
|
|
8262
8413
|
}
|
|
8263
8414
|
function useCachedAppConfig() {
|
|
8264
|
-
const queryClient = (0,
|
|
8265
|
-
const query = (0,
|
|
8415
|
+
const queryClient = (0, import_react_query40.useQueryClient)();
|
|
8416
|
+
const query = (0, import_react_query40.useQuery)({
|
|
8266
8417
|
queryKey: APP_CONFIG_QUERY_KEY,
|
|
8267
8418
|
enabled: false,
|
|
8268
8419
|
initialData: () => queryClient.getQueryData(APP_CONFIG_QUERY_KEY),
|
|
@@ -8359,6 +8510,7 @@ var toAppConfigResult = (query) => {
|
|
|
8359
8510
|
useAppConfig,
|
|
8360
8511
|
useArbFeed,
|
|
8361
8512
|
useCachedAppConfig,
|
|
8513
|
+
useCancelManagedOrder,
|
|
8362
8514
|
useCategories,
|
|
8363
8515
|
useCategoryChildren,
|
|
8364
8516
|
useDebouncedValue,
|
|
@@ -8398,6 +8550,7 @@ var toAppConfigResult = (query) => {
|
|
|
8398
8550
|
useOrderBook,
|
|
8399
8551
|
useOrderbookQuote,
|
|
8400
8552
|
useOrders,
|
|
8553
|
+
usePlaceLimitOrder,
|
|
8401
8554
|
usePositions,
|
|
8402
8555
|
useQueryClient,
|
|
8403
8556
|
useQuoteManaged,
|